Skip to content
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

sparse.linalg.eigs small eigenvalues of sparse.rand matrices: SM vs. shift-invert mode #11232

Open
denis-bz opened this issue Dec 16, 2019 · 5 comments

Comments

@denis-bz
Copy link

Running sparse.linalg.eigs for small eigenvalues of 100 x 100 sparse.rand matrices,
shift-invert mode which='LM', sigma=0 converges in 10 of 10 cases, seed 0 .. 10;
which='SM' converges in 0 of 10 with e.g.

ARPACK error -1: No convergence (1001 iterations, 0/6 eigenvectors converged) [ARPACK error -14: DNAUPD  did not find any eigenvalues to sufficient accuracy.]

tol=1e-5 doesn't change the picture
nor does OPENBLAS_NUM_THREADS=1 .

It would be easy to always use shift-invert for small eigenvalues --

if which == "SM":
    print( "eigs: using shift-invert mode for small eigenvalues, "
        "because it's more robust than SM on large non-symmetric problems" )
    which = "LM"
    sigma = 0

what do you think ?

(Does anyone use 'SM' for small eigenvalues on real problems ?
Cf. Bai, Day, Demmel, Dongarra, "A test matrix collection for non-Hermitian eigenvalue problems", 1996.)

The testbench for this is 99 % the same as in #11198,
shall I put it up again, here or gist.github ?

Versions: numpy 1.17.4 scipy 1.3.3 python 3.7.3 macos 10.10.5

@pv
Copy link
Member

pv commented Jan 19, 2020

iirc other users of ARPACK typically use LM + sigma=0 instead of SM

@denis-bz
Copy link
Author

Yes that's right, but some people who want small eigenvalues may not know that,
and use which='SM' (small) instead of LM (large) -- confusing and wrong.
The above 5 lines are an attempt to help them.
Is the sentence ""eigs: using shift-invert mode ... because ..." clear ?

@pv
Copy link
Member

pv commented Jan 25, 2020

By "users" I mean Octave/Matlab/et al. --- which iiuc don't use the arpack SM mode.

@denis-bz
Copy link
Author

Right, don't think we need it either: it's confusing and sometimes plain doesn't work.
The suggestion is to turn SR --> LM, sigma=0 (with a message), then both ways work.

@lobpcg
Copy link
Contributor

lobpcg commented Dec 21, 2021

For 100 x 100 sparse matrices it's likely faster and surely reliable just to convert them into a dense array and use a dense solver to compute all eigenvalues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants