Search code examples
c++eigen

Check if matrix is Lower or Upper Triangular Matrix


Is there an API in Eigen library to check if a matrix is a lower or upper triangular matrix?. Obviously, we can write a function to check this. But I would like to know if Eigen has a way of checking this. When I looked in the documentation, I read about triangular views, but no calls to check if it is lower or upper.


Solution

  • According to documentation: https://eigen.tuxfamily.org/dox/classEigen_1_1MatrixBase.html#title51

    matrix.isUpperTriangular();
    matrix.isLowerTriangular();