SPQR with SPQR_ORDERING_FIXED makes solve() crash
Summary
Using setSPQROrdering(SPQR_ORDERING_FIXED) leads to a crash in both solve() and accessing the permutation matrix (which should be the identity).
Environment
- Operating System : OpenSUSE Linux 15.1
- Architecture : x64
- Eigen Version : 3.3.9
- Compiler Version : Gcc7.5
- Compile Flags : -O3 -std_c++11
- Vector Extension : SSE/AVX
Minimal Example
//The following code snippet shows the essential parts:
// ... Generate a sparse matrix having full column rank
typedef SuiteSparse_long Index;
typedef SparseMatrix<double,ColMajor,Index> mySM;
mySM X = readsp();
// Decompose
SPQR<mySM> qrX;
qrX.setSPQROrdering(SPQR_ORDERING_FIXED);
qrX.setPivotThreshold(SPQR_NO_TOL);
qrX.compute(X);
if (qrX.info() != Success) {
// cerr << QR.lastErrorMessage() << endl;
cerr << "DirectSolver: QR decomposition failed" << endl;
exit(1);
}
// ... This works
cerr << "Solve with R, only" << endl;
VectorXd rhs = VectorXd::Constant(X.rows(),1.0);
VectorXd sol = qrX.matrixR().triangularView<Upper>().solve(rhs.head(R.cols()));
// ... This leads to Segemtation violation
VectorXd rhs = VectorXd::Constant(X.rows(),1.0);
cerr << "Use standard solve" << endl;
VectorXd su = qrX.solve(rhs);
The complete program (100 lines) is included in the appendix together with the data file.
Steps to reproduce
- Compile the program
- Run it
What is the current bug behavior?
The decomposition phase (compute()) is working fine. Trying to access the permutation matrix via colsPermutation() or solving the system via solve() leads to Segmentation violation.
What is the expected correct behavior?
-
I expect to be able to access the permutation even for SPQR_ORDERING_FIXED set. I intend to make a security check if SPQR works as expected.
-
Calling solve() should succeed independent of the active ordering strategy.
Relevant logs
none
Anything else that might help
I guess that in case of the FIXED ordering strategy, the output m_E is notcorrectly set. However, trying to fix it myself failed.TriangularSolveTest.cppX.coo
-
Have a plan to fix this issue.