xLAEIN: apply the growth test to the growth, not to |x| alone #1400
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 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.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1400"
general
weight: 0.35
martin-frbg
Summary
xLAEINdecides when one step of inverse iteration has produced an acceptable eigenvector. The residual of that step is governed by how much the solution grew relative to the starting vector, but the test compared the solution norm againstGROWTOon its own. That silently assumes every starting vector has the same constant norm, which is not the case.The criterion
One step of inverse iteration with shift
sigmaisThe residual of the vector it produces is an identity, not a bound:
The reciprocal of the right-hand side is the norm growth, and the vector is accepted once that growth is large enough that (1) delivers a residual at the level of the accuracy of the eigenvalue:
Then
|| r || <= (1/C) n eps ||A|| || v^(i+1) ||, the standard requirement on an approximate eigenpair. The essential point is that the criterion is a statement about the ratio: the norm of the starting vector belongs in it.This is Dhillon's section 3, issue IV (PDF), which attributes the criterion to Wilkinson's The Algebraic Eigenvalue Problem, p. 324.
What the old code did
Here
VNORMis the 1-norm of the solution andSCALEisxLATRS's scale factor, so dividing the test through bySCALEtimes the starting vector's 1-norm puts it in the same form as (2):The right-hand side is what (2) asks for only if
So the starting vector's norm was not so much ignored as assumed constant, and assumed equal to
ROOTNEPS3in particular. That is close to the norm of the restarting vectors the routine builds after a failed attempt, so the assumption holds to within a factor of two for those. It does not hold for the vector the iteration actually starts from:| starting vector | how it is built | its 1-norm | assumption off by |
|---|---|---|---|
| initial (
NOINIT) | every entryEPS3|NEPS3|ROOTN|| restart |
EPS3, thenEPS3/(ROOTN+1), one entry- EPS3ROOTN|~2ROOTNEPS3|~2|| supplied (
INITV='U') | rescaled to 2-normROOTNEPS3|ROOTNEPS3 .. NEPS3|1 .. ROOTN|The consequence follows from (1). Accepting a growth
ROOTNtimes smaller than required admits a residualROOTNtimes larger, so the bound degrades fromO( n eps ||H|| )toO( n*1.5 eps ||H|| ). NEP test 11 measures exactly that quantity divided bynagainst a threshold of 20, so the old bound permits a ratio of order10ROOTNand exceeds the threshold as soon asN > 4. The initial vector is where 28,451 of the 28,452 eigenvectors in the NEP test suite are accepted, so it is the case that usually decides the outcome, and one matrix crossed the threshold on aarch64 gfortran:Instrumenting the routine to print the residual of every accepted vector shows that case as
n=10, try 1, residual 27.9in units ofNEPS3|x|, while the very next starting vector gives0.0209- a residual 1300 times smaller for the same eigenvalue. So this was never an ill-conditioned eigenvector that no starting vector could resolve. A far better one was one restart away, and the test stopped short because it wasn't strict enough.The fix
xLAEINtakes exactly one solve from each starting vector - on insufficient growth it chooses a new starting vector rather than iterating on the result - soiis always 0 here. Mapping the notation of (2) onto this routine:| theory | xLAEIN | note |
|---|---|---|
|
A - sigma I|B| the U factor, zero pivots replaced byEPS3||
tau^(0)|SCALE| chosen byxLATRSto avoid overflow ||
v^(0)|VRon entry, the starting vector | 1-normV0NORM||
v^(1)|VRafter the solve | 1-normV1NORM||
epstimes the norm of A |EPS3| set byxHSEINtoULPtimes the block norm ||
n|N| ||
C|TENTH| the existing constant, unchanged |so (2) reads
GROWTObecomes the right-hand side of (3), and the test is then (3) verbatim:GROWTOchanges value, from0.1/SQRT(N)to0.1/(NEPS3), because it changes meaning: it is no longer a bound on||x||but the growth ratio that (3) requires. Nothing else in the routine uses it.The effective threshold each starting vector now faces, relative to before:
| starting vector | before | now |
|---|---|---|
| initial |
TENTHSCALE/ROOTN|ROOTNtimes stricter || restart |
TENTHSCALE/ROOTN|~2times stricter || supplied |
TENTHSCALE/ROOTN|1toROOTNtimes stricter |Effect
Worst
xneptest-11 ratio,|HX - XW| / (|H| |X| ulp)on aarch64 now:| precision | before (gfortran 15.2) | after (gfortran 15.2) | after (flang 21.1.8) |
|---|---|---|---|
| S | 27.24 | 4.17 | 2.74 |
| D | 3.05 | 3.05 | 3.05 |
| C | 3.95 | 3.95 | 6.20 |
| Z | 4.52 | 4.52 | 3.41 |
Because only the accept/reject decision changes and no iterate is touched, vectors that already passed come back bit-identical - visible above in the D and Z columns.
Notes
The
0.1/SQRT(N)threshold is inherited verbatim from EISPACK'sinvit, which hasgrowto = 0.1d0 / ukroot,ukroot = dsqrt(uk)under the commentgrowto is the criterion for the growth, and which implements [3]. The same missing normalisation is therefore present there. Every commit toSRC/[scdz]laein.fon master is cosmetic, so the criterion is untouched since that import.xSTEINavoids the problem from the other direction:SRC/dstein.frescales the right-hand side before every solve so its norm is a known constant, which is what makes its absolute test onNRMsound.References
1. I. S. Dhillon, Current inverse iteration software can fail, BIT Numerical Mathematics 38 (1998). PDF
2. J. H. Wilkinson, The Algebraic Eigenvalue Problem, Oxford University Press, 1965.
3. G. Peters and J. H. Wilkinson, The calculation of specified eigenvectors by inverse iteration, in Wilkinson & Reinsch, Handbook for Automatic Computation II: Linear Algebra, Springer, 1971.