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

Function createFunction

test/sparse_common.hpp:189–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

187// dimensions and indices using a very basic test
188template<af_storage stype>
189static void createFunction() {
190 af::array in = af::sparse(af::identity(3, 3), stype);
191
192 af::array values = sparseGetValues(in);
193 af::array rowIdx = sparseGetRowIdx(in);
194 af::array colIdx = sparseGetColIdx(in);
195 dim_t nNZ = sparseGetNNZ(in);
196
197 ASSERT_EQ(nNZ, values.elements());
198
199 ASSERT_EQ(0, af::max<double>(values - af::constant(1, nNZ)));
200 ASSERT_EQ(0, af::max<int>(rowIdx -
201 af::range(af::dim4(rowIdx.elements()), 0, s32)));
202 ASSERT_EQ(0, af::max<int>(colIdx -
203 af::range(af::dim4(colIdx.elements()), 0, s32)));
204}
205
206template<typename Ti, typename To>
207static void sparseCastTester(const int m, const int n, int factor) {

Callers

nothing calls this directly

Calls 10

sparseFunction · 0.85
sparseGetValuesFunction · 0.85
sparseGetRowIdxFunction · 0.85
sparseGetColIdxFunction · 0.85
sparseGetNNZFunction · 0.85
constantFunction · 0.85
identityFunction · 0.50
rangeFunction · 0.50
dim4Class · 0.50
elementsMethod · 0.45

Tested by

no test coverage detected