| 690 | */ |
| 691 | template<typename Derived> |
| 692 | bool 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 | /*************************************************************************** |