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

SuperLU does not work. Please help!

Tags: None
(comma "," separated)
yesint
Registered Member
Posts
7
Karma
0

SuperLU does not work. Please help!

Sat Feb 27, 2010 8:02 am
Dear All,
I'm trying to solve the sparse matrix with SuperLU backend. I'm using the test function very similar to one in this post
viewtopic.php?f=74&t=84904&p=142935&hilit=superlu#p142935

Code: Select all
#define EIGEN_SUPERLU_SUPPORT
...
...
void computeTest()
{
   int N = 10;

   VectorXf x(N);
   x.setZero();

   // Create b
   VectorXf b(N);
   b.setRandom();

   // Create A
   Eigen::SparseMatrix<float> A(N,N);
   {
      Eigen::RandomSetter<Eigen::SparseMatrix<float> > setter(A);

      // Set random values in A
      for(int i=0; i<3*N; ++i)
         setter(rand()%N, rand()%N) = (double)rand()/(double)RAND_MAX;
   }

   A.finalize();
   cout << "filled" << endl;

   // Create solver
   Eigen::SparseLU<Eigen::SparseMatrix<float>,Eigen::SuperLU> slu(A);

   if(slu.succeeded())
      std::cout << "1 SUCCEDED!" << std::endl;
   else
      std::cout << "1 FAILED!" << std::endl;

   bool ok = slu.solve(b,&x);

   if(ok)
      std::cout << "2 SUCCEDED!" << std::endl;
   else
      std::cout << "2 FAILED!" << std::endl;
}


Here is the result:
Code: Select all
1 FAILED!
Segmentation fault


Eigen sparse tests are passed, so the SuperLU itself is installed correctly and works.
I can't figure out what I'm doing wrong...
Seb
Registered Member
Posts
99
Karma
0
I used SuperLU myself, the current implementation is indeed far from being finished.

Though: I could not reproduce your problem.

My settings:

I use double, not float.
I do not factorize using the constructor, but using
Code: Select all
SparseLU tmp;
tmp.Compute(A)

I can also confirm that the succeeded() function does not work for the external bindings.
Where the binding is quite buggy is memory consumption. You can use SuperLU only once during application lifetime when using large matrices because every call of 'compute(A)' will add new space the SuperLU buffer.

On the mailing list I posted a code for the MUMPS backend some weeks ago. Maybe you check this out?

Best regards
Sebastian
yesint
Registered Member
Posts
7
Karma
0
It seems that my problem is in the random matrix - sometimes it works, sometimes does not. However, I still can't get it working with double...
I'll probably try suggested MUMPS backend.
Seb
Registered Member
Posts
99
Karma
0
I think we should eliminate the possibility that RandomSetter has a bug.

Did you consider to fill your matrix using DynamicSparseMatrix?

When filling a matrix in random order, I usually use that one (you can directly add coefficients using mat.coeffRef(i,j)+=val) and then I convert it to a SparseMatrix. It is also very fast!


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]