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

Function sparseConvertStorageToDense

src/backend/opencl/sparse.cpp:98–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96
97template<typename T, af_storage stype>
98Array<T> sparseConvertStorageToDense(const SparseArray<T> &in_) {
99 if (stype != AF_STORAGE_CSR) {
100 AF_ERROR("OpenCL Backend only supports CSR or COO to Dense",
101 AF_ERR_NOT_SUPPORTED);
102 }
103
104 in_.eval();
105
106 Array<T> dense_ = createValueArray<T>(in_.dims(), scalar<T>(0));
107 dense_.eval();
108
109 const Array<T> &values = in_.getValues();
110 const Array<int> &rowIdx = in_.getRowIdx();
111 const Array<int> &colIdx = in_.getColIdx();
112
113 if (stype == AF_STORAGE_CSR) {
114 kernel::csr2dense<T>(dense_, values, rowIdx, colIdx);
115 } else {
116 AF_ERROR("OpenCL Backend only supports CSR or COO to Dense",
117 AF_ERR_NOT_SUPPORTED);
118 }
119
120 return dense_;
121}
122
123template<typename T, af_storage dest, af_storage src>
124SparseArray<T> sparseConvertStorageToStorage(const SparseArray<T> &in) {

Callers

nothing calls this directly

Calls 2

evalMethod · 0.45
dimsMethod · 0.45

Tested by

no test coverage detected