1

I am compiling and trying to run the UMfPackLU<SparseMatrix<>> routine from Eigen 3.2.9 and UMFPACK v4.5 libraries with TDM-GCC 5.1.0 on Win64 platform. But I am getting Appcrash with exception code c0000005.

What I need to implement is the following:

     _ _        _ _
A = | P |, B = | R |, where P and Q are sparse and Z is 0 with 3 cols
    | Q |      | Z |
    |_ _|      |_ _|

X = A\B;

What I am doing (excerpt only) is the following:

#define num_t double
...
SparseMatrix<num_t,RowMajor> A(P.rows()+Q.rows(), P.cols());
A.topRows(P.rows()) = P;
A.bottomRows(Q.rows()) = Q;
Matrix<num_t, Dynamic, 3> B(P.rows()+Q.rows(), 3);
B.topLeftCorner(P.rows(), 3) = R;
B.bottomLeftCorner(Q.rows(), 3) = S;

UmfPackLU<SparseMatrix<num_t>> solver(A.transpose()*A);
auto AtB = A.transpose()*B;
X.col(0) = solver.solve(AtB.col(0)); // @@@ segmentation error here @@@
X.col(1) = solver.solve(AtB.col(1));
X.col(2) = solver.solve(AtB.col(2));

Note the SparseMatrix<> is in RowMajor format.

On debugging with gdb: I get Program received signal SIGSEGV, Segmentation fault. at the line marked as above`.

Instead of UmfPackLU<SparseMatrix<>>, solving with SimplicialLLT<SparseMatrix<>>, SimplicialLDLT<SparseMatrix<>> or CholmodDecomposition<SparseMatrix<>> is working correctly.

Thanks in advance for any help.

  • You could try to update to Eigen v3.2.9 first – kangshiyin Aug 02 '16 at 13:55
  • @kangshiyin: Updated to 3.2.9. Still the same error. –  Aug 02 '16 at 14:39
  • Win64 may be an issue. How about LP64? – kangshiyin Aug 02 '16 at 14:48
  • @kangshiyin: Right now I don't have any `LP64` environment. However, the error seems to come from the `i` variable which gets a high negative value in the lines: i = Ai [p] ; // here `i` gets a negative value /* axx = Ax [p] * xj ; */ ASSIGN (aij, Ax, Az, p, AXsplit) ; MULT (axx, aij, xj) ; /* W [i] -= axx ; */ DECREMENT (W [i], axx) ; in the function `UMF_solve()` in `umf_solve.c` of the `umfpack` library. –  Aug 02 '16 at 15:01
  • @kangshiyin: Also, I have a very little understanding of `LP64`. Could you explain me what you are asking me to do with that? –  Aug 02 '16 at 15:05
  • You could google "win64 lp64 lllp64 ilp64". You could test umfpack without Eigen to see whose fault this is. – kangshiyin Aug 02 '16 at 15:32
  • First of all, check that `solver.info()==Success` before trying to call `solve`. If this test is OK, then try to declare `AtB` as a `Matrix` instead of an expression and directly call `X = solver.solve(AtB)`. – ggael Aug 02 '16 at 21:42
  • @ggael: when i am doing `auto X2 = solver.solve(AtB);`, it runs without a error. But the error comes when I am assigning `X = solver.solve(AtB);` with `X` declared as `Matrix X`.The sizes are same. Could you suggest me a way to check the type of the output matrix `X2`. Note the same thing works for other solvers. BTW, `solver.info()==Success ` returns `true`. –  Aug 03 '16 at 00:51
  • btw, since you are factorizing a SPD matrix, Cholmod is probably a better choice. – ggael Aug 03 '16 at 21:16

2 Answers2

1

This is a shortcoming in Eigen 3.2.9 that has been fixed a while ago in the 3.3 branch. It's now fixed in the 3.2 branch too (changeset 1e7d97fea51d).

You can workaround the issue by calling compute(...) instead of the constructor:

UmfPackLU<SparseMatrix<num_t>> solver;
solver.compute(A.transpose()*A);
ggael
  • 28,425
  • 2
  • 65
  • 71
0

Please feel free to correct/enhance/establish my answer.

What I have found is that, I need to instantiate an explicit ColMajor matrix AtA before feeding it to the solver (RowMajor is not working) as follows:

SparseMatrix<num_t, ColMajor> AtA = A.transpose()*A;
UmfPackLU<SparseMatrix<num_t>> solver(AtA);

Is this a requirement due to Eigen's lazy evaluation implementation for calling an external routine?