I have a problem when solving a large sparse system in Eigen 3.3.7 using the SparseLU solver. I get a runtime assertion error of:
void Eigen::PlainObjectBase::resize(Eigen::Index) [with Derived = Eigen::Matrix<int, -1, 1>; Eigen::Index = long int]: Assertion ((SizeAtCompileTime == Dynamic && (MaxSizeAtCompileTime==Dynamic || size<=MaxSizeAtCompileTime)) || SizeAtCompileTime == size) && size>=0' failed.
After looking online I found that my problem is likely due to my matrix being very large and I need to change the Ordering type from int
to long int
, see here. Well changing COLAMDOrdering
to either COLAMDOrdering<Eigen::Index>
or COLAMDOrdering<long int>
did not work. I get a compiler error:
error: no match for call to ‘(Eigen::SparseQREigen::SparseMatrix<std::complex<double >, Eigen::COLAMDOrdering >::OrderingType {aka Eigen::COLAMDOrdering}) (const Eigen::SparseMatrixstd::complex<double >&, Eigen::SparseQREigen::SparseMatrix<std::complex<double >, Eigen::COLAMDOrdering >::PermutationType&)’ 315 |
ord(matCpy, m_perm_c);
It seems that Eigen::Index
is just an alias for long int
anyway. I tried using information from this link but it didn't help.
For reference, the size of the system im trying to solve is N = 98,000