MCPcopy Create free account
hub / github.com/TinyMPC/TinyMPC / isLowerTriangular

Method isLowerTriangular

include/Eigen/Eigen/src/Core/TriangularMatrix.h:692–709  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

690 */
691template<typename Derived>
692bool MatrixBase<Derived>::isLowerTriangular(const RealScalar& prec) const
693{
694 RealScalar maxAbsOnLowerPart = static_cast<RealScalar>(-1);
695 for(Index j = 0; j < cols(); ++j)
696 for(Index i = j; i < rows(); ++i)
697 {
698 RealScalar absValue = numext::abs(coeff(i,j));
699 if(absValue > maxAbsOnLowerPart) maxAbsOnLowerPart = absValue;
700 }
701 RealScalar threshold = maxAbsOnLowerPart * prec;
702 for(Index j = 1; j < cols(); ++j)
703 {
704 Index maxi = numext::mini(j, rows()-1);
705 for(Index i = 0; i < maxi; ++i)
706 if(numext::abs(coeff(i, j)) > threshold) return false;
707 }
708 return true;
709}
710
711
712/***************************************************************************

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected