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

Function af_arith_sparse

src/api/c/binary.cpp:218–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

216
217template<af_op_t op>
218static 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
244template<af_op_t op>
245static af_err af_arith_sparse_dense(af_array *out, const af_array lhs,

Callers

nothing calls this directly

Calls 5

implicitFunction · 0.85
swapFunction · 0.85
getStorageMethod · 0.80
dimsMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected