| 181 | |
| 182 | template<af_op_t op> |
| 183 | static af_err af_arith_real(af_array *out, const af_array lhs, |
| 184 | const af_array rhs, const bool batchMode) { |
| 185 | try { |
| 186 | const ArrayInfo &linfo = getInfo(lhs); |
| 187 | const ArrayInfo &rinfo = getInfo(rhs); |
| 188 | |
| 189 | dim4 odims = getOutDims(linfo.dims(), rinfo.dims(), batchMode); |
| 190 | const af_dtype otype = implicit(linfo.getType(), rinfo.getType()); |
| 191 | if (odims.ndims() == 0) { |
| 192 | return af_create_handle(out, 0, nullptr, otype); |
| 193 | } |
| 194 | |
| 195 | af_array res; |
| 196 | switch (otype) { |
| 197 | case f32: res = arithOp<float, op>(lhs, rhs, odims); break; |
| 198 | case f64: res = arithOp<double, op>(lhs, rhs, odims); break; |
| 199 | case s32: res = arithOp<int, op>(lhs, rhs, odims); break; |
| 200 | case u32: res = arithOp<uint, op>(lhs, rhs, odims); break; |
| 201 | case s8: res = arithOp<schar, op>(lhs, rhs, odims); break; |
| 202 | case u8: res = arithOp<uchar, op>(lhs, rhs, odims); break; |
| 203 | case b8: res = arithOp<char, op>(lhs, rhs, odims); break; |
| 204 | case s64: res = arithOp<intl, op>(lhs, rhs, odims); break; |
| 205 | case u64: res = arithOp<uintl, op>(lhs, rhs, odims); break; |
| 206 | case s16: res = arithOp<short, op>(lhs, rhs, odims); break; |
| 207 | case u16: res = arithOp<ushort, op>(lhs, rhs, odims); break; |
| 208 | case f16: res = arithOp<half, op>(lhs, rhs, odims); break; |
| 209 | default: TYPE_ERROR(0, otype); |
| 210 | } |
| 211 | std::swap(*out, res); |
| 212 | } |
| 213 | CATCHALL; |
| 214 | return AF_SUCCESS; |
| 215 | } |
| 216 | |
| 217 | template<af_op_t op> |
| 218 | static af_err af_arith_sparse(af_array *out, const af_array lhs, |
nothing calls this directly
no test coverage detected