| 124 | } |
| 125 | |
| 126 | af_err af_norm(double *out, const af_array in, const af_norm_type type, |
| 127 | const double p, const double q) { |
| 128 | try { |
| 129 | const ArrayInfo &i_info = getInfo(in); |
| 130 | if (i_info.ndims() > 2) { |
| 131 | AF_ERROR("solve can not be used in batch mode", AF_ERR_BATCH); |
| 132 | } |
| 133 | |
| 134 | af_dtype i_type = i_info.getType(); |
| 135 | ARG_ASSERT(1, i_info.isFloating()); // Only floating and complex types |
| 136 | *out = 0; |
| 137 | if (i_info.ndims() == 0) { return AF_SUCCESS; } |
| 138 | |
| 139 | switch (i_type) { |
| 140 | case f32: *out = norm<float>(in, type, p, q); break; |
| 141 | case f64: *out = norm<double>(in, type, p, q); break; |
| 142 | case c32: *out = norm<cfloat>(in, type, p, q); break; |
| 143 | case c64: *out = norm<cdouble>(in, type, p, q); break; |
| 144 | case f16: *out = norm<arrayfire::common::half>(in, type, p, q); break; |
| 145 | default: TYPE_ERROR(1, i_type); |
| 146 | } |
| 147 | } |
| 148 | CATCHALL; |
| 149 | |
| 150 | return AF_SUCCESS; |
| 151 | } |
no test coverage detected