| 216 | |
| 217 | template<af_op_t op> |
| 218 | static af_err af_arith_sparse(af_array *out, const af_array lhs, |
| 219 | const af_array rhs) { |
| 220 | try { |
| 221 | const SparseArrayBase linfo = getSparseArrayBase(lhs); |
| 222 | const SparseArrayBase rinfo = getSparseArrayBase(rhs); |
| 223 | |
| 224 | ARG_ASSERT(1, (linfo.getStorage() == rinfo.getStorage())); |
| 225 | ARG_ASSERT(1, (linfo.dims() == rinfo.dims())); |
| 226 | ARG_ASSERT(1, (linfo.getStorage() == AF_STORAGE_CSR)); |
| 227 | |
| 228 | const af_dtype otype = implicit(linfo.getType(), rinfo.getType()); |
| 229 | af_array res; |
| 230 | switch (otype) { |
| 231 | case f32: res = sparseArithOp<float, op>(lhs, rhs); break; |
| 232 | case f64: res = sparseArithOp<double, op>(lhs, rhs); break; |
| 233 | case c32: res = sparseArithOp<cfloat, op>(lhs, rhs); break; |
| 234 | case c64: res = sparseArithOp<cdouble, op>(lhs, rhs); break; |
| 235 | default: TYPE_ERROR(0, otype); |
| 236 | } |
| 237 | |
| 238 | std::swap(*out, res); |
| 239 | } |
| 240 | CATCHALL; |
| 241 | return AF_SUCCESS; |
| 242 | } |
| 243 | |
| 244 | template<af_op_t op> |
| 245 | static af_err af_arith_sparse_dense(af_array *out, const af_array lhs, |
nothing calls this directly
no test coverage detected