MCPcopy Create free account
hub / github.com/ErrorAtLine0/infinipaint / isUpperTriangular

Method isUpperTriangular

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

Source from the content-addressed store, hash-verified

583 */
584template <typename Derived>
585bool MatrixBase<Derived>::isUpperTriangular(const RealScalar& prec) const {
586 RealScalar maxAbsOnUpperPart = static_cast<RealScalar>(-1);
587 for (Index j = 0; j < cols(); ++j) {
588 Index maxi = numext::mini(j, rows() - 1);
589 for (Index i = 0; i <= maxi; ++i) {
590 RealScalar absValue = numext::abs(coeff(i, j));
591 if (absValue > maxAbsOnUpperPart) maxAbsOnUpperPart = absValue;
592 }
593 }
594 RealScalar threshold = maxAbsOnUpperPart * prec;
595 for (Index j = 0; j < cols(); ++j)
596 for (Index i = j + 1; i < rows(); ++i)
597 if (numext::abs(coeff(i, j)) > threshold) return false;
598 return true;
599}
600
601/** \returns true if *this is approximately equal to a lower triangular matrix,
602 * within the precision given by \a prec.

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