Created attachment 786 [details]
Codes that reproduce the error.
When using LeastSquaresConjugateGradient for row-major sparse matrices with more rows than columns, Eigen crashes at the following function in Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h:
LeastSquareDiagonalPreconditioner& factorize(const MatType& mat)
// Compute the inverse squared-norm of each column of mat
for(Index j=0; j<mat.outerSize(); ++j)
RealScalar sum = mat.innerVector(j).squaredNorm();
m_invdiag(j) = RealScalar(1)/sum;
m_invdiag(j) = RealScalar(1);
Base::m_isInitialized = true;
Here the dimension of m_invdiag is the number of columns, but mat.outerSize() is the number of rows, resulting in out-of-bound access of m_invdiag in the loop.
Thank you for the report, fixed:
-- GitLab Migration Automatic Message --
This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1423.