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

Function arithOp

src/backend/oneapi/sparse_arith.cpp:88–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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