MCPcopy Create free account
hub / github.com/Derious/cuMPC / testMatrixType

Function testMatrixType

dependence/eigen-3.4.0/test/nullary.cpp:216–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214
215template<typename MatrixType>
216void testMatrixType(const MatrixType& m)
217{
218 using std::abs;
219 const Index rows = m.rows();
220 const Index cols = m.cols();
221 typedef typename MatrixType::Scalar Scalar;
222 typedef typename MatrixType::RealScalar RealScalar;
223
224 Scalar s1;
225 do {
226 s1 = internal::random<Scalar>();
227 } while(abs(s1)<RealScalar(1e-5) && (!NumTraits<Scalar>::IsInteger));
228
229 MatrixType A;
230 A.setIdentity(rows, cols);
231 VERIFY(equalsIdentity(A));
232 VERIFY(equalsIdentity(MatrixType::Identity(rows, cols)));
233
234
235 A = MatrixType::Constant(rows,cols,s1);
236 Index i = internal::random<Index>(0,rows-1);
237 Index j = internal::random<Index>(0,cols-1);
238 VERIFY_IS_APPROX( MatrixType::Constant(rows,cols,s1)(i,j), s1 );
239 VERIFY_IS_APPROX( MatrixType::Constant(rows,cols,s1).coeff(i,j), s1 );
240 VERIFY_IS_APPROX( A(i,j), s1 );
241}
242
243template<int>
244void bug79()

Callers 1

EIGEN_DECLARE_TESTFunction · 0.70

Calls 7

equalsIdentityFunction · 0.85
absFunction · 0.70
AFunction · 0.50
rowsMethod · 0.45
colsMethod · 0.45
setIdentityMethod · 0.45
coeffMethod · 0.45

Tested by

no test coverage detected