Skip to content

Use syevd for the eigenvectors of EigenWorkspace - #107

Merged
blegat merged 2 commits into
mainfrom
bl/syevd
Nov 9, 2026
Merged

blegat merged 2 commits into
mainfrom
bl/syevd

Conversation

@blegat

@blegat blegat commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

The divide-and-conquer algorithm of syevd is about twice as fast as the MRRR algorithm of syevr to compute all eigenvectors when the eigenvalues are clustered, as for the NT scaling of Loraine near the central path, where X Z ≈ μ I. LAPACK.syevd! allocates its work arrays until FastLapackInterface supports syevd! with a preallocated workspace.

Eigenvalues and eigenvectors of a symmetric 801 × 801 matrix with the eigenvalues 1 + δ * randn() and 10 BLAS threads:

Spectrum syevr syevd
exp10.(range(-8, 2)) 42.2 ms 32.1 ms
δ = 1e-1 75.4 ms 35.9 ms
δ = 1e-3 72.7 ms 34.4 ms
δ = 1e-6 75.3 ms 34.1 ms

Total time with Loraine (kit=0 unless specified):

Problem syevr syevd
theta1 0.33 s 0.33 s
control1 0.32 s 0.32 s
tru9 9.1 s 8.9 s
vib9 29.6 s 29.4 s
vib9, kit=1 2.1 s 2.0 s
maxG11 5.5 s 5.1 s
thetaG11 7.1 s 5.7 s
thetaG51 (first 4 iterations) 7.3 s 7.1 s

The divide-and-conquer algorithm of `syevd` is about twice as fast as the
MRRR algorithm of `syevr` to compute all eigenvectors when the eigenvalues
are clustered, as for the NT scaling of Loraine near the central path, where
`X Z ≈ μ I`. `LAPACK.syevd!` allocates its work arrays until
FastLapackInterface supports `syevd!` with a preallocated workspace.

Eigenvalues and eigenvectors of a symmetric `801 × 801` matrix with the
eigenvalues `1 + δ * randn()` and 10 BLAS threads:

| Spectrum | syevr | syevd |
|---|---|---|
| exp10.(range(-8, 2)) | 42.2 ms | 32.1 ms |
| δ = 1e-1 | 75.4 ms | 35.9 ms |
| δ = 1e-3 | 72.7 ms | 34.4 ms |
| δ = 1e-6 | 75.3 ms | 34.1 ms |

Total time with Loraine (kit=0 unless specified):

| Problem | syevr | syevd |
|---|---|---|
| theta1 | 0.33 s | 0.33 s |
| control1 | 0.32 s | 0.32 s |
| tru9 | 9.1 s | 8.9 s |
| vib9 | 29.6 s | 29.4 s |
| vib9, kit=1 | 2.1 s | 2.0 s |
| maxG11 | 5.5 s | 5.1 s |
| thetaG11 | 7.1 s | 5.7 s |
| thetaG51 (first 4 iterations) | 7.3 s | 7.1 s |
@codecov

codecov Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.59%. Comparing base (88e8a40) to head (09d3c87).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #107   +/-   ##
=======================================
  Coverage   99.59%   99.59%           
=======================================
  Files          29       29           
  Lines        1966     1988   +22     
=======================================
+ Hits         1958     1980   +22     
  Misses          8        8           

☔ View full report in Codecov by Harness.
📢 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.

`LinearAlgebra.LAPACK.syevd!` allocates its eigenvalues and work arrays,
which made the iterations of Loraine allocate 1280 B. Call `dsyevd` and
`ssyevd` directly with work arrays stored in `EigenWorkspace`, resized by
the first call. The branch `bl/fli_syevd` replaces this with
`FastLapackInterface.syevd!` from
DynareJulia/FastLapackInterface.jl#55 once it is
released.
@blegat
blegat added this pull request to stack #114 November 9, 2026 08:44
@blegat
blegat merged commit 23c3332 into main Nov 9, 2026
6 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.

1 participant