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

Function sparseConvertDenseToStorage

src/backend/oneapi/sparse.cpp:67–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65
66template<typename T, af_storage stype>
67SparseArray<T> sparseConvertDenseToStorage(const Array<T> &in_) {
68 in_.eval();
69
70 uint nNZ = getScalar<uint>(reduce_all<af_notzero_t, T, uint>(in_));
71
72 SparseArray<T> sparse_ = createEmptySparseArray<T>(in_.dims(), nNZ, stype);
73 sparse_.eval();
74
75 Array<T> &values = sparse_.getValues();
76 Array<int> &rowIdx = sparse_.getRowIdx();
77 Array<int> &colIdx = sparse_.getColIdx();
78
79 kernel::dense2csr<T>(values, rowIdx, colIdx, in_);
80
81 return sparse_;
82}
83
84// Partial template specialization of sparseConvertStorageToDense for COO
85// 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