| 37 | using std::vector; |
| 38 | |
| 39 | TEST(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 | |
| 77 | TEST(LU, SplitSmall) { |
| 78 | LAPACK_ENABLED_CHECK(); |
nothing calls this directly
no test coverage detected