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

Function inverseTester

test/inverse_dense.cpp:35–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33
34template<typename T>
35void inverseTester(const int m, const int n, double eps) {
36 SUPPORTED_TYPE_CHECK(T);
37 LAPACK_ENABLED_CHECK();
38#if 1
39 array A = cpu_randu<T>(dim4(m, n));
40#else
41 array A = randu(m, n, (dtype)dtype_traits<T>::af_type);
42#endif
43
44 //! [ex_inverse]
45 array IA = inverse(A);
46 array I = matmul(A, IA);
47 //! [ex_inverse]
48
49 array I2 = identity(m, n, (dtype)dtype_traits<T>::af_type);
50
51 ASSERT_NEAR(0, max<typename dtype_traits<T>::base_type>(abs(real(I - I2))),
52 eps);
53 ASSERT_NEAR(0, max<typename dtype_traits<T>::base_type>(abs(imag(I - I2))),
54 eps);
55}
56
57template<typename T>
58class Inverse : public ::testing::Test {};

Callers

nothing calls this directly

Calls 8

randuFunction · 0.85
absFunction · 0.70
realFunction · 0.70
imagFunction · 0.70
dim4Class · 0.50
inverseFunction · 0.50
matmulFunction · 0.50
identityFunction · 0.50

Tested by

no test coverage detected