| 48 | |
| 49 | template<typename T> |
| 50 | static 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 | |
| 72 | template<typename T> |
| 73 | static void print(const char *exp, af_array arr, const int precision, |