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

Function svdInPlaceTest

test/svd_dense.cpp:88–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86
87template<typename T>
88void svdInPlaceTest(const int M, const int N) {
89 SUPPORTED_TYPE_CHECK(T);
90 LAPACK_ENABLED_CHECK();
91
92 dtype ty = (dtype)dtype_traits<T>::af_type;
93
94 array A = randu(M, N, ty);
95 array A_copy = A.copy();
96
97 array U, S, Vt;
98 af::svdInPlace(U, S, Vt, A);
99
100 const int MN = std::min(M, N);
101
102 array UU = U(span, seq(MN));
103 array SS = diag(S, 0, false).as(ty);
104 array VV = Vt(seq(MN), span);
105
106 array AA = matmul(UU, SS, VV);
107
108#if defined(OS_MAC)
109 ASSERT_ARRAYS_NEAR(A_copy, AA, 3E-3);
110#else
111 ASSERT_ARRAYS_NEAR(A_copy, AA, 1E-3);
112#endif
113}
114
115template<typename T>
116void checkInPlaceSameResults(const int M, const int N) {

Callers

nothing calls this directly

Calls 8

randuFunction · 0.85
seqClass · 0.85
diagFunction · 0.85
asMethod · 0.80
minFunction · 0.70
svdInPlaceFunction · 0.50
matmulFunction · 0.50
copyMethod · 0.45

Tested by

no test coverage detected