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

Function solveTester

test/solve_common.hpp:31–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29
30template<typename T>
31void solveTester(const int m, const int n, const int k, double eps,
32 int targetDevice = -1) {
33 if (targetDevice >= 0) af::setDevice(targetDevice);
34
35 af::deviceGC();
36
37 SUPPORTED_TYPE_CHECK(T);
38 LAPACK_ENABLED_CHECK();
39
40#if 1
41 af::array A = cpu_randu<T>(af::dim4(m, n));
42 af::array X0 = cpu_randu<T>(af::dim4(n, k));
43#else
44 af::array A = af::randu(m, n, (af::dtype)af::dtype_traits<T>::af_type);
45 af::array X0 = af::randu(n, k, (af::dtype)af::dtype_traits<T>::af_type);
46#endif
47 af::array B0 = af::matmul(A, X0);
48
49 //! [ex_solve]
50 af::array X1 = af::solve(A, B0);
51 //! [ex_solve]
52
53 //! [ex_solve_recon]
54 af::array B1 = af::matmul(A, X1);
55 //! [ex_solve_recon]
56
57 ASSERT_ARRAYS_NEAR(B0, B1, eps);
58}
59
60template<typename T>
61void solveLUTester(const int n, const int k, double eps,

Callers

nothing calls this directly

Calls 6

deviceGCFunction · 0.85
randuFunction · 0.85
setDeviceFunction · 0.50
dim4Class · 0.50
matmulFunction · 0.50
solveFunction · 0.50

Tested by

no test coverage detected