| 85 | |
| 86 | template<typename T, af_op_t op> |
| 87 | SparseArray<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 | |
| 113 | template<typename T, af_op_t op> |
| 114 | SparseArray<T> arithOp(const SparseArray<T> &lhs, const SparseArray<T> &rhs) { |
nothing calls this directly
no test coverage detected