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

Function equalsIdentity

test/nullary.cpp:14–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12
13template<typename MatrixType>
14bool equalsIdentity(const MatrixType& A)
15{
16 typedef typename MatrixType::Scalar Scalar;
17 Scalar zero = static_cast<Scalar>(0);
18
19 bool offDiagOK = true;
20 for (Index i = 0; i < A.rows(); ++i) {
21 for (Index j = i+1; j < A.cols(); ++j) {
22 offDiagOK = offDiagOK && (A(i,j) == zero);
23 }
24 }
25 for (Index i = 0; i < A.rows(); ++i) {
26 for (Index j = 0; j < (std::min)(i, A.cols()); ++j) {
27 offDiagOK = offDiagOK && (A(i,j) == zero);
28 }
29 }
30
31 bool diagOK = (A.diagonal().array() == 1).all();
32 return offDiagOK && diagOK;
33
34}
35
36template<typename VectorType>
37void check_extremity_accuracy(const VectorType &v, const typename VectorType::Scalar &low, const typename VectorType::Scalar &high)

Callers 1

testMatrixTypeFunction · 0.85

Calls 5

rowsMethod · 0.45
colsMethod · 0.45
allMethod · 0.45
arrayMethod · 0.45
diagonalMethod · 0.45

Tested by

no test coverage detected