MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / printer

Function printer

src/api/c/print.cpp:50–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48
49template<typename T>
50static void printer(ostream &out, const T *ptr, const ArrayInfo &info,
51 unsigned dim, const int precision) {
52 dim_t stride = info.strides()[dim];
53 dim_t d = info.dims()[dim];
54 ToNum<T> toNum;
55 using namespace detail; // NOLINT
56
57 if (dim == 0) {
58 for (dim_t i = 0, j = 0; i < d; i++, j += stride) {
59 out << std::fixed << std::setw(precision + 6)
60 << std::setprecision(precision) << toNum(ptr[j]) << " ";
61 }
62 out << endl;
63 } else {
64 for (dim_t i = 0; i < d; i++) {
65 printer(out, ptr, info, dim - 1, precision);
66 ptr += stride;
67 }
68 out << endl;
69 }
70}
71
72template<typename T>
73static void print(const char *exp, af_array arr, const int precision,

Callers 1

printFunction · 0.85

Calls 2

stridesMethod · 0.45
dimsMethod · 0.45

Tested by

no test coverage detected