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

Function solveTester

test/solve_dense.cpp:47–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45
46template<typename T>
47void solveTester(const int m, const int n, const int k, const int b, double eps,
48 int targetDevice = -1) {
49 if (targetDevice >= 0) setDevice(targetDevice);
50
51 deviceGC();
52
53 SUPPORTED_TYPE_CHECK(T);
54 LAPACK_ENABLED_CHECK();
55
56#if 1
57 array A = cpu_randu<T>(dim4(m, n, b));
58 array X0 = cpu_randu<T>(dim4(n, k, b));
59#else
60 array A = randu(m, n, (dtype)dtype_traits<T>::af_type);
61 array X0 = randu(n, k, (dtype)dtype_traits<T>::af_type);
62#endif
63 array B0 = matmul(A, X0);
64
65 //! [ex_solve]
66 array X1 = solve(A, B0);
67 //! [ex_solve]
68
69 //! [ex_solve_recon]
70 array B1 = matmul(A, X1);
71 //! [ex_solve_recon]
72
73 ASSERT_NEAR(
74 0,
75 sum<typename dtype_traits<T>::base_type>(abs(real(B0 - B1))) / (m * k),
76 eps);
77 ASSERT_NEAR(
78 0,
79 sum<typename dtype_traits<T>::base_type>(abs(imag(B0 - B1))) / (m * k),
80 eps);
81}
82
83template<typename T>
84void solveLUTester(const int n, const int k, double eps,

Callers

nothing calls this directly

Calls 9

deviceGCFunction · 0.85
randuFunction · 0.85
absFunction · 0.70
realFunction · 0.70
imagFunction · 0.70
setDeviceFunction · 0.50
dim4Class · 0.50
matmulFunction · 0.50
solveFunction · 0.50

Tested by

no test coverage detected