Skip to content

Conversation

@stevengj
Copy link
Member

@stevengj stevengj commented Nov 26, 2025

Implement the same meta-algorithm for SymTridiagonal as what syevr (the RobustRepresentations algorithm) does internally for its tridiagonal eigensolve. Fixes #1491.

This involves two changes to our current algorithm:

  1. For eigen or eigvals, if stegr or stev (respectively) fails it now falls back to stebz and stein.
  2. For eigen and eigvals, if a subset of the eigenvalues is requested, it now calls stebz (and stein, for eigvecs) instead of stegr.

I'm not so sure about change (2) — it seems to be slightly slower on my machine for a random 1000x1000 matrix. Any idea why syevr does this?

In order to implement change (1), I had to make an additional copy of the entries of the SymTridiagonal matrix, to preserve them for the fallback routine. I compensated for this by calling the new meta-algorithm directly from eigen and eigvals. However, it means that if you directly call eigen! or eigvals! on SymTridiagonal it will have an extra allocation. Ultimately, I would like us to allow multiple algorithm choices similar to eigen(::Symmetric).

Copy link
Collaborator

@araujoms araujoms left a comment

Choose a reason for hiding this comment

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

This makes tests pass, as stebz requires them to have the same type.

stevengj and others added 2 commits November 27, 2025 23:49
Co-authored-by: Mateus Araújo <maltusan@gmail.com>
Co-authored-by: Mateus Araújo <maltusan@gmail.com>
@codecov
Copy link

codecov bot commented Nov 28, 2025

Codecov Report

❌ Patch coverage is 92.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.86%. Comparing base (21af0af) to head (f5460b5).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
src/tridiag.jl 92.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1493      +/-   ##
==========================================
- Coverage   93.92%   93.86%   -0.07%     
==========================================
  Files          34       34              
  Lines       15979    16002      +23     
==========================================
+ Hits        15008    15020      +12     
- Misses        971      982      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

LAPACK exception thrown from eigen(::SymTridiagonal)

2 participants