-
Notifications
You must be signed in to change notification settings - Fork 124
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
Program crash when calling DNEUPD after exiting DNAUPD with info=0 and iparam(5) > NEV #465
Comments
Do you set Would not be surprised this may fix the problem. |
Thank you for the reply! Yes, I do set I also forgot to mention, the same code works for several other matrices. The error only occurs with certain matrices. |
Lessons I learned from Feel free to PR a fix if you found one.
This looks wrong to me: https://github.com/opencollab/arpack-ng/blob/0b3038d139f874a423ba6a1cdf5098fc15336848/EXAMPLES/MATRIX_MARKET/arpackSolver.hpp#L803C22-L803C26 |
Not sure I guess, like often, that the problem may lie in the way you call/use
|
Indeed, seems you can: this works fine
|
... Nope ! If I remember well, for standard problem, only mode 1 (you used mode 3) is allowed with real shift only
You may have some clue here https://github.com/opencollab/arpack-ng/blob/master/README.md#faq (Lehoucq97.pdf) |
According to tests in the associated PR, it seems that if you need to shift, the back transform must be done only for mode 1. If you always back transform whatever the mode:
Then, for generalized problem (mode 3) you get an incorrect eigen value of 1. (instead of 3.) and the residual goes up to 1.2 (instead of 5.e-14).
Mixing type (real/double) is likely not supported by the arpack API: you likely need to use real shift for real matrices. I guess this issue is indeed a misuse of arpack as often as the doc is not clear to anybody !... :) |
Thank you for looking in to the issue!
I'll keep this in mind going forward, thank you.
If using complex shifts is a misuse of arpack, then should the documentation in |
I guess nobody could really do that... That's arpack's curse... Eigen problems are as difficult to solve as they are at the heart of many other scientific problems, but the original dev team do not more maintain this cumbersome F77 codebase so it's difficult to maintain / extend / document / use the arpack library... In the end, the only question is: how to use the damn thing which lasts up-to-now to be a reference?!...
Good point! If, and only if, the matrix is non sym, then only, it sounds like eigen values may be complex... And that is what you find here:
Also, from what I experienced / tested: you should only shift when it helps. In practice, you shift by order of magnitude like 1, 10 or 100, or, by 42 if you can estimate your eigen value is about 42 (= not sure if shifting 1.e-5 does mean something nor help - In case you are stuck in the zero staring vector problem, try to shift 1 to "get out into a convergence region"). So maybe you crash because you back transform by hand while you shouldn't?... Are your eigen values correct if you don't shift? BTW, increase CV may help convergence too HTH |
I have a lot of trouble trying to get it to converge at all without shifting. What I actually need in my use-case is the eigenvalue with the largest real part, which, given the spectrum of the matrices I'm solving, seems to be pretty tough for ARPACK. Since I'm solving a series of parametrized matrices, I've been trying to use the largest real eigenvalue from the previous matrix as a shift to help convergence, which has generally been doing better but, as we've been discussing, still has some problems. |
In fact, I just reproduced the same error in mode 1 without using shifts at all. I got it this matrix (failed_mtx_no_shift.txt) setting |
Can you compile both arpack and your code in debug
Give a chance to slepc too |
My apologies, I spoke too soon. In the mode 1 case, I am now finding instances where
I will look in to it, thanks! |
I've just tested some run with your matrice. This works if you allow the max residual norm to be 2.1 (the more eigen value you compute, the more you'll be imprecise so you need to relax the allowed residual norm)
But LR doesn't work
|
Pushing a few things I forgot to push that may help testing.
Just realizing: in your case, you may have more luck using restart instead of shift? |
Hello, I've run into what I think is a bug using the
DNAUPD
andDNEUPD
functions in shift-invert mode to calculate eigenvalues of some admittedly dificult matrices. The short of it is that sometimes callingDNEUPD
afterDNAUPD
leads to a program crash, despite the lack of an error on return fromDNAUPD
. I've found the when this occurs,iparam(5)
, the number of converged eigenvalues, is greater thanNEV
, the number of requested eigenvalues. I have attached a txt containing a sample matrix (failed_mat.txt), and a simple program that triggers the crash. More details provided below.Expected behavior
The
info
variable would be non-zero after callingDNAUPD
, indicating an error has occured, when trying to solve the provided matrix and others like it. Alternatively, callingDNEUPD
would return the correct eigenvalue.Actual behavior
Calling
DNEUPD
after a "sucessful" exit fromDNAUPD
causes the program to crash with the error shown below solving the attached matrix.Where/how to reproduce the problem
failed_mat.txt
for the matrix in question.Steps to reproduce the problem
failed_mat.txt
. Note that the calls to ARPACK functions are in the subroutineeigen_shift_invert
.Error message
The exact error message:
Callstack
Backtrace from lldb:
Notes, remarks
It seems from experimenting that the error occurs when
iparam(5) > NEV
after callingDNAUPD
. Handling this case seems to prevent the SIGBUS crash.The text was updated successfully, but these errors were encountered: