| 605 | */ |
| 606 | template <typename Derived> |
| 607 | bool MatrixBase<Derived>::isLowerTriangular(const RealScalar& prec) const { |
| 608 | RealScalar maxAbsOnLowerPart = static_cast<RealScalar>(-1); |
| 609 | for (Index j = 0; j < cols(); ++j) |
| 610 | for (Index i = j; i < rows(); ++i) { |
| 611 | RealScalar absValue = numext::abs(coeff(i, j)); |
| 612 | if (absValue > maxAbsOnLowerPart) maxAbsOnLowerPart = absValue; |
| 613 | } |
| 614 | RealScalar threshold = maxAbsOnLowerPart * prec; |
| 615 | for (Index j = 1; j < cols(); ++j) { |
| 616 | Index maxi = numext::mini(j, rows() - 1); |
| 617 | for (Index i = 0; i < maxi; ++i) |
| 618 | if (numext::abs(coeff(i, j)) > threshold) return false; |
| 619 | } |
| 620 | return true; |
| 621 | } |
| 622 | |
| 623 | /*************************************************************************** |
| 624 | **************************************************************************** |