This bugzilla service is closed. All entries have been migrated to
Bug 410 - EigenSolver::eigenvectors() crashes when solving matrix with infinity (-1.#IND) in it
Summary: EigenSolver::eigenvectors() crashes when solving matrix with infinity (-1.#IN...
Alias: None
Product: Eigen
Classification: Unclassified
Component: Eigenvalues (show other bugs)
Version: 3.1
Hardware: All All
: Normal Unknown
Assignee: Nobody
Depends on:
Reported: 2012-01-23 07:12 UTC by Alex Melkozerov
Modified: 2019-12-04 11:25 UTC (History)
4 users (show)


Description Alex Melkozerov 2012-01-23 07:12:17 UTC
Eigenvalues module crashes in release (or emits debug error in Debug mode) if one passes to Eigen::EigenSolver a 1x1 matrix with 1 indefinite element in it. A simple program to reproduce bug:

#include <Eigen/Eigenvalues>
typedef Eigen::MatrixXd EigenMatrix;

int main() {

	EigenMatrix A(1,1);
	A(0,0) = std::sqrt(-1.);
	Eigen::EigenSolver<EigenMatrix> solver(A);
	EigenMatrix V(1, 1);
	V(0,0) = solver.eigenvectors()(0,0).real();
	return 0;

The problem is in line 342 of EigenSolver.h ( internal::isMuchSmallerThan() check returns false, and line 357
is executed although matV contains just 1 column. This causes assertion failure in debug and crashes program in release.

Quick and dirty fix: add to line 342 second condition: || n == 1.
Comment 1 Gael Guennebaud 2012-01-25 19:05:09 UTC
Thanks for the analyze of the error, though I rather added:

|| j+1==n

Fixed there:
changeset:   d2189ba9dfd1
date:        2012-01-25 19:02:31
summary:     fix bug 410: fix a possible out of range access in EigenSolver
changeset:   b8c6abb0d78a
branch:      3.0
Comment 2 Nobody 2019-12-04 11:25:37 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to'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:

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