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

Function convertCSR

test/sparse_common.hpp:149–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147
148template<typename T>
149static void convertCSR(const int M, const int N, const double ratio,
150 int targetDevice = -1) {
151 if (targetDevice >= 0) af::setDevice(targetDevice);
152
153 SUPPORTED_TYPE_CHECK(T);
154#if 1
155 af::array a = cpu_randu<T>(af::dim4(M, N));
156#else
157 af::array a = af::randu(M, N);
158#endif
159 a = a * (a > ratio);
160
161 af::array s = af::sparse(a, AF_STORAGE_CSR);
162 af::array aa = af::dense(s);
163
164 ASSERT_ARRAYS_EQ(a, aa);
165}
166
167template<typename T>
168static void convertCSC(const int M, const int N, const double ratio,

Callers

nothing calls this directly

Calls 5

randuFunction · 0.85
sparseFunction · 0.85
denseFunction · 0.85
setDeviceFunction · 0.50
dim4Class · 0.50

Tested by

no test coverage detected