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

Function TEST

test/lu_dense.cpp:39–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37using std::vector;
38
39TEST(LU, InPlaceSmall) {
40 LAPACK_ENABLED_CHECK();
41
42 int resultIdx = 0;
43
44 vector<dim4> numDims;
45 vector<vector<float>> in;
46 vector<vector<float>> tests;
47 readTests<float, float, float>(string(TEST_DIR "/lapack/lu.test"), numDims,
48 in, tests);
49
50 dim4 idims = numDims[0];
51 array input(idims, &(in[0].front()));
52 array output, pivot;
53 lu(output, pivot, input);
54
55 dim4 odims = output.dims();
56
57 // Get result
58 float* outData = new float[tests[resultIdx].size()];
59 output.host((void*)outData);
60
61 // Compare result
62 for (int y = 0; y < (int)odims[1]; ++y) {
63 for (int x = 0; x < (int)odims[0]; ++x) {
64 // Check only upper triangle
65 if (x <= y) {
66 int elIter = y * odims[0] + x;
67 ASSERT_NEAR(tests[resultIdx][elIter], outData[elIter], 0.001)
68 << "at: " << elIter << endl;
69 }
70 }
71 }
72
73 // Delete
74 delete[] outData;
75}
76
77TEST(LU, SplitSmall) {
78 LAPACK_ENABLED_CHECK();

Callers

nothing calls this directly

Calls 10

hostMethod · 0.80
luFunction · 0.50
af_randuFunction · 0.50
af_luFunction · 0.50
af_release_arrayFunction · 0.50
af_lu_inplaceFunction · 0.50
dimsMethod · 0.45
elementsMethod · 0.45
ndimsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected