| [eigen] SparseLU generates dense representation somewere | 
[ Thread Index | 
Date Index
| More lists.tuxfamily.org/eigen Archives
] 
Hello all,
sorry for the potentially very basic question. I'm trying to solve a 
sparse square linear system using Eigen 3.2's new SparseLU method and 
seem to be running into issues. If I compile the snippet below (silly 
but hopefully explains the issue), I get:
$ ./test
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
[2]    152688 abort (core dumped)  ./test
So it seems like for some reason it is allocating a dense 
representation. What am I doing wrong?
Thank you,
Wenzel
=========
#define NDEBUG
#include <Eigen/SparseCore>
#include <Eigen/SparseLU>
int main(int argc, char **argv) {
    typedef Eigen::SparseMatrix<double, Eigen::ColMajor> SMatrix;
    const int N = 500000;
    SMatrix A(N,N), B(N, N), C(N, N);
    A.setIdentity();
    B.setIdentity();
    A.makeCompressed();
    B.makeCompressed();
    Eigen::SparseLU<SMatrix> lu;
    lu.compute(A);
    C = lu.solve(B);
}