MCPcopy Create free account
hub / github.com/PX4/eigen / randomTest

Function randomTest

unsupported/test/matrix_exponential.cpp:98–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96
97template<typename MatrixType>
98void randomTest(const MatrixType& m, double tol)
99{
100 /* this test covers the following files:
101 Inverse.h
102 */
103 typename MatrixType::Index rows = m.rows();
104 typename MatrixType::Index cols = m.cols();
105 MatrixType m1(rows, cols), m2(rows, cols), identity = MatrixType::Identity(rows, cols);
106
107 typedef typename NumTraits<typename internal::traits<MatrixType>::Scalar>::Real RealScalar;
108
109 for(int i = 0; i < g_repeat; i++) {
110 m1 = MatrixType::Random(rows, cols);
111
112 m2 = m1.matrixFunction(expfn) * (-m1).matrixFunction(expfn);
113 std::cout << "randomTest: error funm = " << relerr(identity, m2);
114 VERIFY(identity.isApprox(m2, static_cast<RealScalar>(tol)));
115
116 m2 = m1.exp() * (-m1).exp();
117 std::cout << " error expm = " << relerr(identity, m2) << "\n";
118 VERIFY(identity.isApprox(m2, static_cast<RealScalar>(tol)));
119 }
120}
121
122void test_matrix_exponential()
123{

Callers 1

test_matrix_exponentialFunction · 0.85

Calls 6

relerrFunction · 0.85
matrixFunctionMethod · 0.80
rowsMethod · 0.45
colsMethod · 0.45
isApproxMethod · 0.45
expMethod · 0.45

Tested by

no test coverage detected