*tgex2: loosen swap acceptance threshold to fix false rejections - #1299
*tgex2: loosen swap acceptance threshold to fix false rejections#1299jschueller wants to merge 2 commits into
Conversation
|
I don't fully understand "even though the swap is mathematically valid (verified via Sylvester equation-based proof)" Do you mean that the swap was accurate in the provided matlab script? Also in "BQRA21 can be ~5x larger than TWENTYEPS*SA due to round-off in the preceding QZ steps", I don't really understand what the preceding QZ steps have to do with this. Increasing the threshold does indeed fix the failures indicated by mathworks, but it misses the underlying issue. LAPACK and the matlab script use slightly different methods. LAPACK does
The script does:
You could certainly argue that since it appears to result in much less failures, we should switch to the method of the script. However, if my assumption is correct and you meant that the swap is accurate because the matlab script indicates good accuracy, then I think that is a step too far. Just because method2 is accurate, does not mean that method1 remains accurate with an increased tolerance. I think the best solution is a combination of method2 and Daan Camps' work, as I have implemented in LAPACK: tlapack/tlapack#608 |
|
fair enough, instead lets just change the acceptance criterion to check the off-diagonal of both A and B for now, that seems to fix the reported issue, I'll leave it for you to implement the robust change involving the algorithmic rewrite, |
The weak stability test in *TGEX2 rejects a block swap when the off-diagonal block of A (BQRA21 or BRQA21) exceeds THRESHA after the RQ/QR cleanup that triangularizes B. For certain matrices this cleanup can perturb the A off-diagonal beyond THRESHA even though the underlying Sylvester swap is mathematically valid, causing false rejections (reported by MathWorks from MATLAB's ORDQZ). Fix by checking the off-diagonal of both A and B from the raw Sylvester result *before* the RQ/QR cleanup. When both raw off-diagonals are below their thresholds, accept unconditionally -- the cleanup cannot trigger a false rejection. The safety factor is kept at TWENTY. Closes Reference-LAPACK#1201
The weak stability test in TGEX2 rejects a block swap when the off-diagonal block norm BQRA21 exceeds THRESHA = TWENTYEPSSA. For certain matrices (reported by MathWorks from MATLAB's ORDQZ), this threshold is too tight -- BQRA21 can be ~5x larger than TWENTYEPS*SA due to round-off in the preceding QZ steps, even though the swap is mathematically valid (verified via Sylvester equation-based proof).
Increase the safety factor from TWENTY (20) to HUNDRED (100), which fixes all known failing cases (3x3 and 4x4 pencils) while remaining well below the BRQA21 bound that guards against truly invalid swaps.
Closes #1201