| 671 | */ |
| 672 | template<typename Derived> |
| 673 | bool MatrixBase<Derived>::isLowerTriangular(const RealScalar& prec) const |
| 674 | { |
| 675 | RealScalar maxAbsOnLowerPart = static_cast<RealScalar>(-1); |
| 676 | for(Index j = 0; j < cols(); ++j) |
| 677 | for(Index i = j; i < rows(); ++i) |
| 678 | { |
| 679 | RealScalar absValue = numext::abs(coeff(i,j)); |
| 680 | if(absValue > maxAbsOnLowerPart) maxAbsOnLowerPart = absValue; |
| 681 | } |
| 682 | RealScalar threshold = maxAbsOnLowerPart * prec; |
| 683 | for(Index j = 1; j < cols(); ++j) |
| 684 | { |
| 685 | Index maxi = numext::mini(j, rows()-1); |
| 686 | for(Index i = 0; i < maxi; ++i) |
| 687 | if(numext::abs(coeff(i, j)) > threshold) return false; |
| 688 | } |
| 689 | return true; |
| 690 | } |
| 691 | |
| 692 | |
| 693 | /*************************************************************************** |