Repository navigation
Conversation
…loor The sval_pyth column, sqrt(|s_gesdd^2 - s_abrik^2|) / s_gesdd, is the root of a difference of two eps-accurate numbers, so it floors at sqrt(2 eps), about 2e-8, even when s_abrik is correct to all digits. Three new columns measure the same quantity from the computed vectors instead: - rq_diff = 1 - rho / sigma (signed), with rho = u' A v of ABRIK's unit-scaled vectors and sigma the singular value of GESDD's triplet taken as exact. Writing v = c_v v_gesdd + s_v w and u = c_u u_gesdd + s_u z gives rq_diff = (1 - c_u c_v) - s_u s_v (z' A w) / s_gesdd, a sum of small terms. c, s and s w come from the Householder QR that the svec_diff sine already runs (now followed by ORGQR); z' A w costs one matvec per triplet. - sval_rq = sqrt(|rq_diff (2 - rq_diff)|): sval_pyth with rho in place of s_abrik. - rq_gap = |u' A v / (||u|| ||v||) - s_abrik| / s_abrik: how far the measured Rayleigh quotient is from the returned singular value. The existing thirteen columns are unchanged; svec_diff reads the same |R(2,2)| as before. The CSV now has sixteen columns. Checked on two 1500 x 1500 dense synthetic inputs (b = 16, 32 iterations, two runs, MKL). Where sval_pyth > 1e-5, sval_rq agrees with it to within 7e-6 relative. Below the floor, sval_rq tracks res_err_abrik (median ratio 1.0) down to about 1e-15. rq_gap is at most 2.6e-15 on every triplet. A numpy replica of the formula agrees with a 40-digit mpmath reference: 1.512e-11 against 1.512e-11 at an angle of 1e-12, where the literal (s_gesdd - rho) / s_gesdd would give 3.9e-8.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ABRIK_accuracy_analysisreports the singular-value error assval_pyth = sqrt(|s_gesdd^2 - s_abrik^2|) / s_gesdd. That is the square root of a difference of two numbers that are each accurate to machine precision, so it cannot fall below aboutsqrt(2 eps) = 2e-8, even whens_abrikis correct to all digits.This PR adds a version of the same metric that has no such floor. It is computed from the computed singular vectors rather than from
s_abrik. Write each computed vector as the GESDD vector plus a small orthogonal correction:v = c_v v_gesdd + s_v wandu = c_u u_gesdd + s_u z. Then the Rayleigh quotientrho = u' A vsatisfies1 - rho / sigma = (1 - c_u c_v) - s_u s_v (z' A w) / sigma,and every term on the right is small by construction. The cosines and sines come from the Householder QR that the singular-vector error already runs, and
z' A wcosts one matvec per triplet.Changes
benchmark/bench_ABRIK/ABRIK_accuracy_analysis.cc: three new CSV columns, all appended after the existing ones.rq_diff: the signed1 - rho / sigmafrom the identity above.sval_rq:sqrt(|rq_diff (2 - rq_diff)|), the Pythagorean error withrhoin place ofs_abrik.rq_gap:|rho - s_abrik| / s_abrik, withrhoformed directly, so readers can see how far the measured Rayleigh quotient is from the returned singular value.per_triplet_residualsoptionally returnsu' A v.