-
Notifications
You must be signed in to change notification settings - Fork 446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add extra exceptional shift to solve rare convergence issues #477
add extra exceptional shift to solve rare convergence issues #477
Conversation
Thanks! Note that in #475 the problem never arose when using single-precision complex numbers, only in the double precision case. Can you comment on how robust you expect the fix to be? Does precision suffer? Should we run more extensive tests to see if the extra shift strategy is generally sound? |
Codecov Report
@@ Coverage Diff @@
## master #477 +/- ##
==========================================
- Coverage 83.23% 83.23% -0.01%
==========================================
Files 1820 1820
Lines 170847 170871 +24
==========================================
+ Hits 142199 142216 +17
- Misses 28648 28655 +7
Continue to review full report at Codecov.
|
Precision should not suffer at all. This is only the shift strategy which does not introduce any roundoff. Even if the problem never arose in single precision, i still think we should keep the implementations as close as possible. I expect this solution to be fairly robust, but more extensive tests never hurt. You mentioned that you run into #475 a lot, so it would be great to test this PR against some more pencils to be sure. |
Ok, so now the coverage is complaining because the convergence never fails and the exception handling is never run ... I vote we just ignore it. I can't find any failing pencils. |
I'd like to find a way to try this PR within my Julia code, to try finding more failures, but I'm not sure it is possible until this trickles down to OpenBLAS and then to Julia... Thing is, the package that produces these matrices is Julia-only. (I guess one thing I could do is try to collect a bunch of failing examples with Julia and use your script in #475 to see if they all converge using this PR.) |
It's possible to compile julia yourself and link with a preinstalled BLAS/LAPACK library instead of OpenBLAS. See this variable but this is not an officially supported feature => YMMV. |
Hi all, Thjis: terrific work, oh my. This is cool. Here are two webpages with some history about this: Julien. |
|
The |
@langou thanks for the interesting history. It makes me doubt my exceptional shift strategy though. I'll have some more fun trying to think up better alternatives. @pablosanjose i'm afraid that i am but a lowly mathematician. The complexities of dynamic linking are beyond me and it seems LAPACK doesn't support it out of the box. I think your best bet is to clone OpenBLAS and apply my patch in the lapack-netlib folder. Then you can compile to a .dylib. You might have to disable multithreading though or you'll also need pthread. |
Thanks @thijssteel, that's just what I'm trying to do now! |
@MigMuc noted in OpenMathLib/OpenBLAS#3091 that in zhgeqz.f, there may be a typo: LSAME in line 329 should read LLSAME. Please check! |
btw. gfortran also warns about unused variabes "RTDISC" and "T1" and thinks ILZ,ILQ and ILSCHR may be uninitialised in chgeqz.f, if (and only if) you want to use the opportunity for a small cleanup. |
@thijssteel, thanks for this bug fix! :) Although the exceptional shift is chosen for no particularly good reason, could it be better to use ESHIFT = ESHIFT + ABI12 instead of ESHIFT = ESHIFT + ( ASCALE*H( ILAST,
$ ILAST ) )/( BSCALE*T( ILAST, ILAST ) ) in |
Not a bad idea, do note however that while this PR does add exceptional shifts, the main problem was the calculation of the shifts. For example, none of the tests ever even seem to use the second exceptional shift if you look at the test coverage. I think it's fine as is. |
Let us merge this in. Thanks @thijssteel! You're the best! |
…value-convergence-failure add extra exceptional shift to solve rare convergence issues
closes #475
This PR adds an extra exceptional shift choice to the complex implementations of the QZ algorithm.
As is tradition, it has been chosen for no particularly good reason.
Also adds some overflow protection to the original exceptional shift for good measure.