SparseQR<SparseMatrix<double> >::factorize() hits assertion failure on uncompressed input matrix
Submitted by ren..@..mu.edu
Assigned to Nobody
Link to original bugzilla bug (#798)
Version: 3.2
Operating system: Linux
Description
Created attachment 454
source code to reproduce the problem
When I compile and run the attached program, which constructs a 2x2 sparse matrix of doubles and attempts to perform a QR factorization, I get the following output:
Nonzero entries:
(,) (,) (0.5,1) (,)
Outer pointers:
0 2 $
Inner non zeros:
0 1 $
0 0
0 0.5
a.out: eigen/Eigen/src/Core/DenseCoeffsBase.h:412: Eigen::DenseCoeffsBase<Derived, 1>::Scalar& Eigen::DenseCoeffsBase<Derived, 1>::operator()(Eigen::DenseCoeffsBase<Derived, 1>::Index) [with Derived = Eigen::Matrix<int, -0x00000000000000001, 1>, Eigen::DenseCoeffsBase<Derived, 1>::Scalar = int, Eigen::DenseCoeffsBase<Derived, 1>::Index = long int]: Assertion `index >= 0 && index < size()' failed.
Aborted (core dumped)
If I run the program under valgrind, I get some reports about uninitialized memory:
==20561== Conditional jump or move depends on uninitialised value(s)
==20561== at 0x515C8A8: sqrt (w_sqrt.c:28)
==20561== by 0x404D84: Eigen::SparseMatrixBase<Eigen::Block<Eigen::SparseMatrix<double, 0, int>, -1, 1, true> >::norm() const (SparseDot.h:90)
==20561== by 0x402B18: Eigen::SparseQR<Eigen::SparseMatrix<double, 0, int>, Eigen::NaturalOrdering >::factorize(Eigen::SparseMatrix<double, 0, int> const&) (SparseQR.h:332)
==20561== by 0x401FC3: Eigen::SparseQR<Eigen::SparseMatrix<double, 0, int>, Eigen::NaturalOrdering >::compute(Eigen::SparseMatrix<double, 0, int> const&) (SparseQR.h:87)
==20561== by 0x400FCB: main (bug135.cpp:19)
Attachment 454, "source code to reproduce the problem":
bug135.cpp