This forum has been archived. All content is frozen. Please use KDE Discuss instead.

triangular solve - Assertion `it && it.index()==i' failed

Tags: None
(comma "," separated)
lzhang
Registered Member
Posts
5
Karma
0
Hi, I have following program which get the triangular view of a sparse matrix and solve it, but it failed.
Code: Select all
#include <Eigen/SparseCore>

typedef Eigen::SparseMatrix<double, Eigen::RowMajor>  MatrixType;
typedef Eigen::VectorXd  VecType;

int main() {
    VecType x, b;
    MatrixType A(1000, 1000);

    b = VecType::Random(1000);

    A.insert(1, 0) =  0.5;
    A.insert(10, 1) = 0.8;
    A.insert(1, 10) = 0.8;

    x = A.triangularView<Eigen::Lower>().solve(b);
    std::cout << x << std::endl;

    return 0;
}


The followings are error messages.
Code: Select all
a.out: /users/lnz5/loc/include/Eigen/src/SparseCore/TriangularSolver.h:124: static void Eigen::internal::sparse_solve_triangular_selector<Lhs, Rhs, Mode, 1, 0>::run(const Lhs&, Rhs&) [with Lhs = const Eigen::SparseMatrix<double>; Rhs = Eigen::Matrix<double, -1, 1>; int Mode = 1]: Assertion `it && it.index()==i' failed.
lzhang
Registered Member
Posts
5
Karma
0
I found the reason. It seem that the diagonal must be non-zero.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
indeed, otherwise the matrix is structurally non invertible


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot]