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

Function convertCSC

test/sparse_common.hpp:168–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166
167template<typename T>
168static void convertCSC(const int M, const int N, const double ratio,
169 int targetDevice = -1) {
170 if (targetDevice >= 0) af::setDevice(targetDevice);
171
172 SUPPORTED_TYPE_CHECK(T);
173#if 1
174 af::array a = cpu_randu<T>(af::dim4(M, N));
175#else
176 af::array a = af::randu(M, N);
177#endif
178 a = a * (a > ratio);
179
180 af::array s = af::sparse(a, AF_STORAGE_CSC);
181 af::array aa = af::dense(s);
182
183 ASSERT_ARRAYS_EQ(a, aa);
184}
185
186// This test essentially verifies that the sparse structures have the correct
187// dimensions and indices using a very basic test

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