MCPcopy Create free account
hub / github.com/abess-team/abess / testGeneral

Function testGeneral

python/include/unsupported/test/matrix_power.cpp:70–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68
69template<typename MatrixType>
70void testGeneral(const MatrixType& m, const typename MatrixType::RealScalar& tol)
71{
72 typedef typename MatrixType::RealScalar RealScalar;
73 MatrixType m1, m2, m3, m4, m5;
74 RealScalar x, y;
75
76 for (int i=0; i < g_repeat; ++i) {
77 generateTestMatrix<MatrixType>::run(m1, m.rows());
78 MatrixPower<MatrixType> mpow(m1);
79
80 x = internal::random<RealScalar>();
81 y = internal::random<RealScalar>();
82 m2 = mpow(x);
83 m3 = mpow(y);
84
85 m4 = mpow(x+y);
86 m5.noalias() = m2 * m3;
87 VERIFY(m4.isApprox(m5, tol));
88
89 m4 = mpow(x*y);
90 m5 = m2.pow(y);
91 VERIFY(m4.isApprox(m5, tol));
92
93 m4 = (std::abs(x) * m1).pow(y);
94 m5 = std::pow(std::abs(x), y) * m3;
95 VERIFY(m4.isApprox(m5, tol));
96 }
97}
98
99template<typename MatrixType>
100void testSingular(const MatrixType& m_const, const typename MatrixType::RealScalar& tol)

Callers 1

test_matrix_powerFunction · 0.85

Calls 7

noaliasMethod · 0.80
runFunction · 0.50
absFunction · 0.50
powFunction · 0.50
rowsMethod · 0.45
isApproxMethod · 0.45
powMethod · 0.45

Tested by

no test coverage detected