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

Function sparseConvertStorageToDense

src/backend/oneapi/sparse.cpp:103–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101
102template<typename T, af_storage stype>
103Array<T> sparseConvertStorageToDense(const SparseArray<T> &in_) {
104 if (stype != AF_STORAGE_CSR) {
105 AF_ERROR("oneAPI Backend only supports CSR or COO to Dense",
106 AF_ERR_NOT_SUPPORTED);
107 }
108
109 in_.eval();
110
111 Array<T> dense_ = createValueArray<T>(in_.dims(), scalar<T>(0));
112 dense_.eval();
113
114 const Array<T> &values = in_.getValues();
115 const Array<int> &rowIdx = in_.getRowIdx();
116 const Array<int> &colIdx = in_.getColIdx();
117
118 if (stype == AF_STORAGE_CSR) {
119 kernel::csr2dense<T>(dense_, values, rowIdx, colIdx);
120 } else {
121 AF_ERROR("oneAPI Backend only supports CSR or COO to Dense",
122 AF_ERR_NOT_SUPPORTED);
123 }
124
125 return dense_;
126}
127
128template<typename T, af_storage dest, af_storage src>
129SparseArray<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