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

Function testLogThenExp

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

Source from the content-addressed store, hash-verified

131
132template<typename MatrixType>
133void testLogThenExp(const MatrixType& m_const, const typename MatrixType::RealScalar& tol)
134{
135 // we need to pass by reference in order to prevent errors with
136 // MSVC for aligned data types ...
137 MatrixType& m = const_cast<MatrixType&>(m_const);
138
139 typedef typename MatrixType::Scalar Scalar;
140 Scalar x;
141
142 for (int i=0; i < g_repeat; ++i) {
143 generateTestMatrix<MatrixType>::run(m, m.rows());
144 x = internal::random<Scalar>();
145 VERIFY(m.pow(x).isApprox((x * m.log()).exp(), tol));
146 }
147}
148
149typedef Matrix<double,3,3,RowMajor> Matrix3dRowMajor;
150typedef Matrix<long double,3,3> Matrix3e;

Callers 1

test_matrix_powerFunction · 0.85

Calls 6

runFunction · 0.50
rowsMethod · 0.45
isApproxMethod · 0.45
powMethod · 0.45
expMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected