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

Method isUpperTriangular

dependence/eigen-3.4.0/Eigen/src/Core/TriangularMatrix.h:665–682  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

663 */
664template<typename Derived>
665bool MatrixBase<Derived>::isUpperTriangular(const RealScalar& prec) const
666{
667 RealScalar maxAbsOnUpperPart = static_cast<RealScalar>(-1);
668 for(Index j = 0; j < cols(); ++j)
669 {
670 Index maxi = numext::mini(j, rows()-1);
671 for(Index i = 0; i <= maxi; ++i)
672 {
673 RealScalar absValue = numext::abs(coeff(i,j));
674 if(absValue > maxAbsOnUpperPart) maxAbsOnUpperPart = absValue;
675 }
676 }
677 RealScalar threshold = maxAbsOnUpperPart * prec;
678 for(Index j = 0; j < cols(); ++j)
679 for(Index i = j+1; i < rows(); ++i)
680 if(numext::abs(coeff(i, j)) > threshold) return false;
681 return true;
682}
683
684/** \returns true if *this is approximately equal to a lower triangular matrix,
685 * 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 2

triangular_squareFunction · 0.64
triangular_rectFunction · 0.64