This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen

Bug 478

Summary: Eigenvalue calculation does not converge on all-zeros matrix
Product: Eigen Reporter: Joris Mooij <j.mooij>
Component: EigenvaluesAssignee: Nobody <eigen.nobody>
Status: RESOLVED FIXED    
Severity: Unknown CC: colinbrownec, gael.guennebaud, jacob.benoit.1, jitseniesen
Priority: Normal    
Version: 3.3 (current stable)   
Hardware: All   
OS: All   
Whiteboard:

Description Joris Mooij 2012-06-19 15:34:06 UTC
Calculating eigenvalues of an all-zero matrix and querying the info() method yields NoConvergence.

Progam to reproduce the bug (on Debian testing):

---
#include <eigen3/Eigen/Dense>
#include <iostream>

using namespace std;
using Eigen::MatrixXd;
using Eigen::EigenSolver;

int main() {
    size_t size = 5;
    MatrixXd allzeros(size,size);
    allzeros = MatrixXd::Zero(size,size);
    EigenSolver<MatrixXd> eigensolver(allzeros);
    if( eigensolver.info() != Eigen::Success )
        cerr << "Eigenvalue calculation not successful (error code " << eigensolver.info() << ")" << endl;
    cout << eigensolver.eigenvalues() << endl;
}
---

Output:
---
Eigenvalue calculation not successful (error code 2)
(0,0)
(0,0)
(0,0)
(0,0)
(0,0)
---
Comment 1 Gael Guennebaud 2012-06-20 10:12:20 UTC
Thanks for the report.

https://bitbucket.org/eigen/eigen/changeset/0c1b3329762c/
changeset:   0c1b3329762c
user:        ggael
date:        2012-06-20 10:08:32
summary:     fix bug 478: RealSchur failed on a zero matrix.

https://bitbucket.org/eigen/eigen/changeset/e31c45aff2a5/
changeset:   e31c45aff2a5
branch:      3.0
user:        ggael
date:        2012-06-20 10:08:32
summary:     fix bug 478: RealSchur failed on a zero matrix.
(transplanted from 0c1b3329762c1c7c709282004bae9a2ddda12c07)
Comment 2 Colin 2017-01-30 21:25:48 UTC
This bug seems to have reappeared in Eigen 3.3 (at least 3.3.1 and 3.3.2). 3.2.10 does not seem to reproduce this bug.

Using the exact same test code as the original bug, I now get

Output (Windows 10, Visual Studio 12):
---
Eigenvalue calculation not successful (error code 2)
(-4.8367e-026,-4.8367e-026)
(-4.8367e-026,-4.8367e-026)
(-4.8367e-026,-4.8367e-026)
(-4.8367e-026,-4.8367e-026)
(-4.8367e-026,-4.8367e-026)
---

Output (RHEL 6.6, GCC 5.2.1)
---
Eigenvalue calculation not successful (error code 2)
(0,0)
(0,0)
(0,0)
(0,0)
(0,0)
---
Comment 3 Gael Guennebaud 2017-01-31 13:55:27 UTC
Fixed with unit tests this time!

https://bitbucket.org/eigen/eigen/commits/db4fef573c20/
Comment 4 Nobody 2019-12-04 11:44:01 UTC
-- 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/478.