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

Function solveLUTester

test/solve_common.hpp:61–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59
60template<typename T>
61void solveLUTester(const int n, const int k, double eps,
62 int targetDevice = -1) {
63 if (targetDevice >= 0) af::setDevice(targetDevice);
64
65 af::deviceGC();
66
67 SUPPORTED_TYPE_CHECK(T);
68 LAPACK_ENABLED_CHECK();
69
70#if 1
71 af::array A = cpu_randu<T>(af::dim4(n, n));
72 af::array X0 = cpu_randu<T>(af::dim4(n, k));
73#else
74 af::array A = af::randu(n, n, (af::dtype)af::dtype_traits<T>::af_type);
75 af::array X0 = af::randu(n, k, (af::dtype)af::dtype_traits<T>::af_type);
76#endif
77 af::array B0 = af::matmul(A, X0);
78
79 //! [ex_solve_lu]
80 af::array A_lu, pivot;
81 af::lu(A_lu, pivot, A);
82 af::array X1 = af::solveLU(A_lu, pivot, B0);
83 //! [ex_solve_lu]
84
85 af::array B1 = af::matmul(A, X1);
86
87 ASSERT_ARRAYS_NEAR(B0, B1, eps);
88}
89
90template<typename T>
91void solveTriangleTester(const int n, const int k, bool is_upper, double eps,

Callers

nothing calls this directly

Calls 7

deviceGCFunction · 0.85
randuFunction · 0.85
setDeviceFunction · 0.50
dim4Class · 0.50
matmulFunction · 0.50
luFunction · 0.50
solveLUFunction · 0.50

Tested by

no test coverage detected