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

SimplicialLLT - Error for large matrices

Tags: None
(comma "," separated)
physicsguy
Registered Member
Posts
2
Karma
0
I am using the class SimplicialLLT in order to get the Cholesky matrix from a SparseMatrix<double>. The problem works fine for small matrices. But once I increase the size of my matrix above a certain value (roughly 2^15), I get the following error on runtime:

Assertion failed: ((m_outerIndex[outer+1]-m_outerIndex[outer]==0 || m_data.index(m_data.size()-1)<inner) && "Invalid ordered insertion (invalid inner index)"), function insertBackByOuterInner, file /usr/local/include/eigen3/Eigen/src/SparseCore/SparseMatrix.h, line 384.

What is the meaning of this and what are options to fix this?

If this is of any help. I checked that my matrix is symmetric. It should be positive semidefinite. I adjusted it to be positive definite by adding a small shift.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
Make sure you are using std::prtdiff_t as the index type:

typedef SparseMatrix<double,0,std::prtdiff_t> SpMat;
SpMat A;
SimplicialLLT<SpMat> llt(A);
physicsguy
Registered Member
Posts
2
Karma
0
Thanks! That worked. (I think you meant ptrdiff_t instead of prtdiff_t)

But what does it actually do? Since it is in the std namespace, is it part of some other library?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
By default SparseMatrix uses 32 bits int to index non-zeros elements, but for very large matrices, 32 bits int are too small, and you need to use a 64 bits integer type.

For ptrdiff_t: http://en.cppreference.com/w/cpp/types/ptrdiff_t


Bookmarks



Who is online

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