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

Function solveLUTester

test/solve_dense.cpp:84–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82
83template<typename T>
84void solveLUTester(const int n, const int k, double eps,
85 int targetDevice = -1) {
86 if (targetDevice >= 0) setDevice(targetDevice);
87
88 deviceGC();
89
90 SUPPORTED_TYPE_CHECK(T);
91 LAPACK_ENABLED_CHECK();
92
93#if 1
94 array A = cpu_randu<T>(dim4(n, n));
95 array X0 = cpu_randu<T>(dim4(n, k));
96#else
97 array A = randu(n, n, (dtype)dtype_traits<T>::af_type);
98 array X0 = randu(n, k, (dtype)dtype_traits<T>::af_type);
99#endif
100 array B0 = matmul(A, X0);
101
102 //! [ex_solve_lu]
103 array A_lu, pivot;
104 lu(A_lu, pivot, A);
105 array X1 = solveLU(A_lu, pivot, B0);
106 //! [ex_solve_lu]
107
108 array B1 = matmul(A, X1);
109
110 ASSERT_NEAR(
111 0,
112 sum<typename dtype_traits<T>::base_type>(abs(real(B0 - B1))) / (n * k),
113 eps);
114 ASSERT_NEAR(
115 0,
116 sum<typename dtype_traits<T>::base_type>(abs(imag(B0 - B1))) / (n * k),
117 eps);
118}
119
120template<typename T>
121void solveTriangleTester(const int n, const int k, bool is_upper, double eps,

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected