Support `svd` and `svdvals` of `UpperHessenberg` matrices #1799
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.37) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 217 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.322
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1799"
general
weight: 0.35
stevengj
svd,svdvals,condandopnorm(H, 2)of anUpperHessenbergmatrix throw aMethodError:The cause:
svd(A)andsvdvals(A)copyAwitheigencopy_oftypeand callsvd!/svdvals!on the copy.UpperHessenberg,eigencopy_oftypekeeps the wrapper, which the Hessenberg eigensolvers need.svd!andsvdvals!methods forUpperHessenberg.LAPACK has no SVD routine for Hessenberg matrices: its SVD drivers take general or bidiagonal matrices. Exploiting the structure wouldn't save much either. A QR factorization of a Hessenberg matrix costs only O(n²), but the triangular factor still needs the O(n³) bidiagonal reduction.
So the new methods use the dense SVD on the parent, after zeroing the entries below the subdiagonal with
triu!(H.data, -1). TheUpperHessenbergeigensolvers already do the same before balancing.condandopnorm(H, 2)go throughsvdvals, so they work too.Tests
A new testset in
test/hessenberg.jl, forFloat16,Float64andComplexF64, compares with the dense matrix:svdvals;svd, andsvdwithfull = true;condandopnorm(H, 2).The parent has nonzero entries below the subdiagonal, so the testset also checks that those are ignored and that
His not modified.test/hessenberg.jl,svd.jl,generic.jlandambiguous_exec.jlpass locally.Found while checking how structured matrix types handle Infs and NaNs, the problem fixed in #1788 and #1798.
---
_Generated by Claude Code_