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

Function arithOp

src/backend/opencl/sparse_arith.cpp:87–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85
86template<typename T, af_op_t op>
87SparseArray<T> arithOp(const SparseArray<T> &lhs, const Array<T> &rhs,
88 const bool reverse) {
89 lhs.eval();
90 rhs.eval();
91
92 SparseArray<T> out = createArrayDataSparseArray<T>(
93 lhs.dims(), lhs.getValues(), lhs.getRowIdx(), lhs.getColIdx(),
94 lhs.getStorage(), true);
95 out.eval();
96 switch (lhs.getStorage()) {
97 case AF_STORAGE_CSR:
98 kernel::sparseArithOpCSR<T, op>(out.getValues(), out.getRowIdx(),
99 out.getColIdx(), rhs, reverse);
100 break;
101 case AF_STORAGE_COO:
102 kernel::sparseArithOpCOO<T, op>(out.getValues(), out.getRowIdx(),
103 out.getColIdx(), rhs, reverse);
104 break;
105 default:
106 AF_ERROR("Sparse Arithmetic only supported for CSR or COO",
107 AF_ERR_NOT_SUPPORTED);
108 }
109
110 return out;
111}
112
113template<typename T, af_op_t op>
114SparseArray<T> arithOp(const SparseArray<T> &lhs, const SparseArray<T> &rhs) {

Callers

nothing calls this directly

Calls 7

getStorageMethod · 0.80
getNNZMethod · 0.80
dim4Class · 0.50
csrCalcOutNNZFunction · 0.50
evalMethod · 0.45
dimsMethod · 0.45

Tested by

no test coverage detected