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