New user self-registration is currently disabled. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Bug 1092 - Bicgstab segfault when constructed from sparse matrix expression / temporary.
Bicgstab segfault when constructed from sparse matrix expression / temporary.
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: Sparse
3.2
x86 - 64-bit Linux
: Normal Crash
Assigned To: Nobody
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-18 13:34 UTC by Jure Slak
Modified: 2015-10-26 15:21 UTC (History)
2 users (show)



Attachments
Source code to reproduce the segfault (minimal working example). (2.02 KB, text/x-c++src)
2015-10-18 13:34 UTC, Jure Slak
no flags Details

Description Jure Slak 2015-10-18 13:34:49 UTC
Created attachment 615 [details]
Source code to reproduce the segfault (minimal working example).

This code segfaults for me:

Eigen::BiCGSTAB<SparseMatrix<double>> BCGST2(ID - dt * shape_laplace);
V2 = BCGST2.solve(V1);  //< this crashes 

where ID and shape_laplace are n by n matrices and dt is a double.
However this:

SparseMatrix<double> tmp = ID - dt * shape_laplace;
Eigen::BiCGSTAB<SparseMatrix<double>> BCGST2(tmp);
V2 = BCGST2.solve(V1);  //< this crashes 

works fine. I read the common pitfalls page and did not find anything to explain such behaviour. Am I missing something trivial or is this a bug?

Before I translated my code to the minimal working example, it sometimes crashed with EIGEN assert: 

./../include/Eigen/src/Core/ProductBase.h:102: Eigen::ProductBase<Derived, Lhs, Rhs>::ProductBase(const Lhs&, const Rhs&) [with Derived = Eigen::SparseTimeDenseProduct<Eigen::SparseMatrix<double, 0, int>, Eigen::Block<Eigen::Matrix<double, -1, 1>, -1, 1, true> >; Lhs = Eigen::SparseMatrix<double, 0, int>; Rhs = Eigen::Block<Eigen::Matrix<double, -1, 1>, -1, 1, true>]: Assertion `a_lhs.cols() == a_rhs.rows() && "invalid matrix product" && "if you wanted a coeff-wise or a dot product use the respective explicit functions"' failed.
Comment 1 Gael Guennebaud 2015-10-26 15:21:23 UTC
Thank you for the report.

Fixed in devel branch (c2aef7f3278b), and 3.2 branch (dd9b4efbd852)

Note You need to log in before you can comment on or make changes to this bug.