-
Notifications
You must be signed in to change notification settings - Fork 29
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
remove automatic shift-invert when which==:SM #120
remove automatic shift-invert when which==:SM #120
Conversation
@stevengj @antoine-levitt @andreasnoack Can you review? |
@tomhaber I messed up the merge conflict. Is it possible for you to revert my commit and resolve the merge conflict? It really should be rebased to master. Sorry about this. |
What should we do with |
Thanks, will take a look. Also pinging @jarlebring |
I don't really understand the meaning of the |
I'm not sure about |
+1 on removing it. Seems to make the interface even more complicated:
|
This PR looks good to me. It doesn't solve all the confusion, but it's a start. |
I've fixed the ordering of the eigenvalues/vectors. In the SM case this was broken Not sure if you like the Might need some additional testing for the SM case |
Should we get this merged for now? |
@tomhaber Can I give you admin on this repo so that you don't have to wait for one of us? |
The reason for |
Should we merge this as is now, and then work with The main challenge here is that this package does not have a maintainer at the moment - and it would be great if one of the folks who uses it routinely can own the maintenance. I try to keep things moving the best I can for now (and so do some of the others). |
Since this is technically breaking maybe it would make more sense to break everything just once? I lack the motivation to do it because I use KrylovKit now... |
Yes, breaking everything once is a good idea. Could be in this PR, or a series of PRs and then tag a new minor release. Perhaps could even be 1.0. At that point, the package's capabilities will also become minimal and stable. |
The main challange with 1.0 clean rewrite that forwards operations to ARPACK as I see it is that the ARPACK fortran code does not have a clean interface. Forwarding the "reverse communication" directly to julia user would be easy (and it is actually essentially available in the functions More precisely: The Arpack fortran code does not own the main iteration loop, but only does a CPU-critical part of one step of the loop. The user is expected to write the for loop, which is in the julia code A much cleaner interface would be easier to construct if we restrict the cases, which would cripple the functionality, e.g., if we would remove generalized EV mode and target can only be |
I think what we'd want from the julia pov is something like KrylovKit's geneigsolve (https://jutho.github.io/KrylovKit.jl/latest/man/eig/#Generalized-eigenvalue-problems) : eigs(opA, opB, howmany, which) where which is the two-letter things that (can) correspond to extremal points : LM, LR, SR, LI, SI, and where opA and opB can be functions. Shift-invert has to be done by the user explicitly. Do you agree? |
Okay. That's a different idea, but that may be better. I see your suggestion as removing the For the record, your suggestion would also "cripple" Arpack.f-functionality, since the mode For me this is okay, since I think it would make the interface cleaner and allow us to remove a lot of code, which is very hard to maintain, and the above case can be handled separately if deemed necessary. You also suggest to have function handles instead of matrix-objects. I see it as something separate. It would require real-ness, symmetry to be inserted as kwargs, which goes against the idea of reducing the interface. I usually use |
I think KrylovKit doesn't support SM since it is unlikely to ever converge? But if Arpack does support it then sure, no reason we should forbid it. KrylovKit's interface seems simple, clean and complete to me. I don't actually understand Arpack's fortran interface (I looked at it a long time ago, was thoroughly confused and never had the courage to come back to it...), is what I suggest different from what the Fortran Arpack does? Do you think we should have an interface closer to Fortran Arpack?
OK I agree: essentially we should not type A and B and just allow the user to pass whatever object they want that supports |
It maybe complete, but considering the information handed in, it cannot exploit the situation I explained above. The symmetry information about for GEP is lost if you do shift-and-invert by hand, so I think Arpack.f can be faster for symmetric GEPs.
It's more complicated than that. Quite unintuative at first sight, the target parameter does not only influence how the Ritz value extraction method used. If |
I think I don't understand the kind of problems you have in mind. If you can cholesky B, then you can just convert your problem to standard form while keeping the symmetry and so you don't need anything fancy from Arpack, just do shift-invert by hand. If you can't cholesky B, how do you do shift-invert while keeping the symmetry? |
I agree that a factorization can be computed (by hand) to carry out matrix vector products. There is more to Arpack (and IRAM in general) than the matrix vector product operations. I already mentioned one point. I think the Ritz value extraction depends on the original matrices. |
OK, I see, sorry I'm slow. Is there reason to think the Ritz values of the original pencil are better than those of the transformed one? I did play with this kind of things at one point but couldn't see any difference. Otherwise I'd be tempted to say we just ignore this (messy) part of Arpack and just expose the "standard" mode. |
I don't know a specific situation / paper where this setup is a huge advantage, but I think it is along the same lines as the difference between Ritz values and harmonic Ritz values (which are not supported in Arpack). Removing the messy modes and do the standard modes properly 👍. Once we figure out how to simplify the standard mode, it might be clearer how we want to implement the remaining parts, but possibly as separate functions (e.g. |
That seems like a good plan! So to sum up: simply expose eigs(A, B, howmany, which) and forget about shift-invert completely. |
Won't that break people's codes? Maybe we ask them to clamp on an older version then? What's the plan on this PR? |
I think the plan is to break everything and request people to do shift invert manually with a much simple code and API. It should be OK if we tag a new major version, right? If we do that we should do it only once, so probably not merge this PR as is but have a bigger one where we do all of it. Or we merge this into a separate branch and work from there? |
end | ||
|
||
rev = which[1] == 'L' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This level of the arpack call is very tricky. @tomhaber why you prefer your version of dmap
combined with rev
? Over just dmap
including a sign in previous version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, it simplifies the logic.
If I remember correctly, this version allows shift-invert to also work with non magnitude modes and fixes wrong ordering for SM and no shift-invert.
I understand the removal of if-block in Arpack.jl. That part looks fine. The change of ordering logic in
Can you provide more details on the reasoning on this? |
How do folks feel about removing the automatic shift-invert for now? I suppose if we go down this path, we at least want other PRs ready for the full API simplification before we merge this one - otherwise we could end up with a partial API update and it will be difficult to make other bugfix releases. |
I was working on some unit tests for the ordering logic (as asked by @jarlebring). It was pretty much done, but it totally got away from me. |
I've added the unit test for the ordering modes.
Excerpt from the ARPACK sorting code
I hope this makes sense and is correct |
Wondering what the next steps are here to get it merged. |
I did a quick check on registered packages depending on
I also compared the results for the SM and no-shift-invert case with |
That's great! We should bump the version number in Project.toml to 0.6.0 in this PR here and also make a discourse announcement. Perhaps we should also update the project docs to mention these changes and how people should be able to reinstate some of this functionality on their own using this package. |
Shall we go ahead and merge? |
I have nothing to add |
@tomhaber @jarlebring I have invited you both to this org and will make sure you have write permissions here to make it easier to contribute. |
Thank you for your contributions! |
@ViralBShah should there be a new release after this? |
Yes, and it is a breaking change. I was trying to fix a few other things but was unable to fix. It would be giod to make a new release and we should announce it as well. This could potentially be breaking for some packages. We should discuss with @KristofferC how to do this in a sane way to minimize breakage. |
Related: #140 |
I think :SM was broken somewhere along the way here: please see #147 |
Hi. I want to share a recent experience. Last week I was in an important Engineering conference. In the last day we had a "Computational and Numerical Methods in Practice – Scientific Dissemination" where I was showing some Julia code to the participants. To my surprise, my code to evaluate buckling response was broken and I did not have a clue about it (I had just shown the package manager and some packages were updated). Latter on I found this thread and it happens I use :SM and matrix B is not spd. I really understand the burden of maintaining the code and the decisions you made, but such modification may have an important impact to the general user. Also, It would be advised to present some official workaround in the documentation, since not every user knows all the linear algebra theory needed to fix it (specially for large problems, where computing all the eigenvalues is not viable). Finally, we must remember that many users come from matlab/scilab/... where an easy interface for Arpack is provided (as was the Julia interface prior to this modification). Thank you, |
PR against v0.4.0
Can probably do something with the explicittransform parameter.
resolves #87