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

Method isUpperTriangular

Eigen/src/Core/TriangularMatrix.h:648–665  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

646 */
647template<typename Derived>
648bool MatrixBase<Derived>::isUpperTriangular(const RealScalar& prec) const
649{
650 RealScalar maxAbsOnUpperPart = static_cast<RealScalar>(-1);
651 for(Index j = 0; j < cols(); ++j)
652 {
653 Index maxi = numext::mini(j, rows()-1);
654 for(Index i = 0; i <= maxi; ++i)
655 {
656 RealScalar absValue = numext::abs(coeff(i,j));
657 if(absValue > maxAbsOnUpperPart) maxAbsOnUpperPart = absValue;
658 }
659 }
660 RealScalar threshold = maxAbsOnUpperPart * prec;
661 for(Index j = 0; j < cols(); ++j)
662 for(Index i = j+1; i < rows(); ++i)
663 if(numext::abs(coeff(i, j)) > threshold) return false;
664 return true;
665}
666
667/** \returns true if *this is approximately equal to a lower triangular matrix,
668 * within the precision given by \a prec.

Callers 3

triangular_squareFunction · 0.80
triangular_rectFunction · 0.80

Calls 5

miniFunction · 0.85
colsFunction · 0.70
rowsFunction · 0.70
absFunction · 0.70
coeffFunction · 0.70

Tested by

no test coverage detected