Skip to content

add exceptional shift#1603

Merged
alexhroom merged 3 commits into
dimforge:mainfrom
Toucan4Life:fix-611
Jun 18, 2026
Merged

add exceptional shift#1603
alexhroom merged 3 commits into
dimforge:mainfrom
Toucan4Life:fix-611

Conversation

@Toucan4Life

Copy link
Copy Markdown
Contributor

Summary of Changes

This PR fixes some cases where the search for eigenvalue could hang. This was solved by using the "Exceptional Shift" method in Wilkinson, J. H., & Reinsch, C. (1971).
Handbook for automatic computation (Vol. 2: Linear algebra).

Details

I first checked why the Lapack algorithm would converge and not hang. I looked at dlahqr procedure (https://netlib.org/lapack/explore-html/d8/df4/group__lahqr_ga100049ab080cef756846702a33e8e28f.html) saw the mention of the exceptional shift and the Ahues & Tisseur stopping criterion.

The last one was a red herring, I implemented it but the test matrix from #611 would still hang. I then implemented the exceptional shift and it worked. I tried tracing back the magical value (0.75 & -0.4375), and discovered https://www.netlib.org/eispack/hqr.f that led me to the original source:

Wilkinson, J. H., & Reinsch, C. (1971).
Handbook for automatic computation (Vol. 2: Linear algebra).

You can view the orignal magical number and algorithm implementation here : https://www.scribd.com/document/568239788/Wilkinson-Reinsch1971-Book-HandbookForAutomaticComputatio#page=373

AI was used to find the original paper

Testing

I implemented a test with the matrix from #611 that now pass successfully

Fixes #611

@Toucan4Life

Copy link
Copy Markdown
Contributor Author

@alexhroom still one case of eigen value search hanging that should be solved now :)

@alexhroom alexhroom left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for this! just a couple requests for more comments...

Comment thread src/linalg/schur.rs
Comment thread src/linalg/schur.rs
@Toucan4Life

Copy link
Copy Markdown
Contributor Author

Just added more comments, my bad I always forgot them. I will not resolve the conversations, I'll let you be the judge if they are good enough

Comment thread src/linalg/schur.rs Outdated
Co-authored-by: Alex H. Room <69592136+alexhroom@users.noreply.github.com>

@alexhroom alexhroom left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me! thanks for making the changes.

@alexhroom alexhroom merged commit 0ecccbf into dimforge:main Jun 18, 2026
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.

possible bug, hanging on getting eigenvalues?

2 participants