dimforge / nalgebra

Linear algebra library for Rust.
https://nalgebra.org
Apache License 2.0
3.93k stars 465 forks source link

eigenvalues() hangs with all 0's #1291

Open rbenefo opened 1 year ago

rbenefo commented 1 year ago

Running into an issue where when throwing in a matrix of all zeros into .eigenvalues(), the function hangs. To replicate, run the below:

use nalgebra::Matrix6;

fn main() {
    let test: Matrix6::<f64> = Matrix6::zeros();
    println!("{:?}", test.eigenvalues()); // This will hang
}

Looks like we're passing in by default max_niter = 0 into the Schur::do_decompose() call, which causes the function to run indefinitely -- not sure if that's best practice. At the very least, this behavior should be called out in the doc comments.

el-hult commented 5 months ago

This is a problem the call Matrix6::zeros().schur() as well.

I ran in to it while debugging another issue and got super stumped when suddenly my code didn't terminate.

PanieriLorenzo commented 4 months ago

I'm having this issue too, on non-zero matrices. Worth noting that this has been reported before in #764 and #611