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

Function sparseConvertDenseToStorage

src/backend/opencl/sparse.cpp:62–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60
61template<typename T, af_storage stype>
62SparseArray<T> sparseConvertDenseToStorage(const Array<T> &in_) {
63 in_.eval();
64
65 uint nNZ = getScalar<uint>(reduce_all<af_notzero_t, T, uint>(in_));
66
67 SparseArray<T> sparse_ = createEmptySparseArray<T>(in_.dims(), nNZ, stype);
68 sparse_.eval();
69
70 Array<T> &values = sparse_.getValues();
71 Array<int> &rowIdx = sparse_.getRowIdx();
72 Array<int> &colIdx = sparse_.getColIdx();
73
74 kernel::dense2csr<T>(values, rowIdx, colIdx, in_);
75
76 return sparse_;
77}
78
79// Partial template specialization of sparseConvertStorageToDense for COO
80// However, template specialization is not allowed

Callers

nothing calls this directly

Calls 2

evalMethod · 0.45
dimsMethod · 0.45

Tested by

no test coverage detected