This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 527 - Crash in ConjugateGradient::solve() when expression is given.
Crash in ConjugateGradient::solve() when expression is given.
 Status: NEW None Eigen Unclassified Sparse (show other bugs) 3.1 x86 - 64-bit Windows Normal major Nobody

 Reported: 2012-10-24 09:00 UTC by Vladimir 2019-12-04 11:57 UTC (History) 0 users

Attachments
callstack1 (8.99 KB, text/plain)
 Vladimir 2012-10-24 09:00:18 UTC ```Created attachment 304 [details] callstack1 Here is the code snippet (part of the function body): void solve(const VectorXd& initial_alpha) { typedef Eigen::SparseMatrix SparseMatrixType; typedef Eigen::Triplet DoubleTriplet; SparseMatrixType laplacian; fill_laplacian(laplacian); /* laplacian's size is 2450x2450, it is symmetric, positive definite */ SparseMatrixType D(laplacian.rows(), laplacian.cols()); vector D_triplets; const double lambda = 0.1; for(int i = 0; i < laplacian.rows(); ++i) { double value = /* calculated value */; D_triplets.push_back(DoubleTriplet(i, i, value)); } D.setFromTriplets(D_triplets.begin(), D_triplets.end()); VectorXd b = ; ConjugateGradient cg; cg.setTolerance(1e-15); cg.setMaxIterations(500); cg.compute(laplacian + lambda * D); VectorXd alpha = cg.solve(lambda * D * initial_alpha); // <- crash } I've observed 2 types of crashes. 1. When both cg.compute() and cg.solve() are called with expressions, visual studio gives Access violation reading location . Crash is in the file Eigen/src/SparseCore/SparseMatrix.h, line 950, method SparseMatrix::InnerIterator::index() m_id = -544149818 Call stack is in the attached file callstack1.txt 2. If I replace an argument of solve() with pre-calculated variable: VectorXd b = lambda * D * initial_alpha; cg.compute(laplacian + lambda * D); VectorXd alpha = cg.solve(lambda * D * initial_alpha); // <- crash then I've got failed Eigen assertion: Assertion failed: (i>=0) && ( ((BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) && i