Skip to content

Conversation

@Toucan4Life
Copy link
Contributor

@Toucan4Life Toucan4Life commented Oct 30, 2025

Fix #1528.
The issue was that, during the deflation step, the diagonal element of the matrix were all zero so the deflation never triggered based on this line :

t[(n, m)].clone().norm1() <= eps.clone() * (t[(n, n)].clone().norm1() + t[(m, m)].clone().norm1())

added a check to compare an off-diag element to an absolute very small value (eps.clone() * eps.clone())

the eigenvalues found are correctly :
Complex { re: -0.8611363115940531, im: 0.0 },
Complex { re: 0.8611363115940531, im: 0.0 },
Complex { re: -0.33998104358485637, im: 0.0 },
Complex { re: 0.33998104358485637, im: 0.0 }

@Toucan4Life
Copy link
Contributor Author

Hi everyone, could I get a feedback if this is implemented correctly or if I should have used another solution?

I would love to tackle other issues in this repository :)

@Toucan4Life
Copy link
Contributor Author

@alexhroom I am tagging you since you handled the original issue report

@alexhroom
Copy link
Collaborator

hey there, just approved the CI runs for you. I've got a pretty big stockpile of matrices that crash with the issue so next week I'll do some more robust checking that the issue's been sorted.

Thanks for figuring it out by the way, I had a go myself ages ago but couldn't quite figure out the problem...

@Toucan4Life
Copy link
Contributor Author

hey there, just approved the CI runs for you. I've got a pretty big stockpile of matrices that crash with the issue so next week I'll do some more robust checking that the issue's been sorted.

Thanks for figuring it out by the way, I had a go myself ages ago but couldn't quite figure out the problem...

Would love to help you on that :) I fixed the formatting issue preventing the pipeline to build also, first time contributor mistake

@alexhroom
Copy link
Collaborator

I've had a play around and it's looking good. only thing is if you have a source/citation for where the threshold criterion comes from?

@Toucan4Life
Copy link
Contributor Author

Toucan4Life commented Dec 4, 2025

I looked at LAPACK DLAHQR subroutine, and they use SMLNUM as their absolute criteria :
https://www.netlib.org/lapack/lapack-3.1.1/html/dlahqr.f.html.

SMLNUM is defined as the smallest possible value you can represent using the machine precision * number of rows of the matrix / epsilon.

The issue is that depends on the machine precision and I didn't find an easy way to do that in rust. So I choose eps * eps, because the relative test for deflation was already eps * ( t[n,n] + t[m,m] )

@alexhroom
Copy link
Collaborator

great - could I ask you to add that citation as a comment to the routine, and then we should be all good to go?

@Toucan4Life
Copy link
Contributor Author

Nice suggestion, comment has been added :)

@alexhroom alexhroom merged commit 0b2536b into dimforge:main Dec 7, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Infinite loop when computing eigen values

2 participants