scipy / scipy

SciPy library main repository
https://scipy.org
BSD 3-Clause "New" or "Revised" License
12.92k stars 5.15k forks source link

lobpcg fails on some machines for trivial problems (Trac #1304) #1830

Closed scipy-gitbot closed 11 years ago

scipy-gitbot commented 11 years ago

Original ticket http://projects.scipy.org/scipy/ticket/1304 on 2010-10-13 by trac user nicki, assigned to @wnbell.

Hi,

the attached code fails on my machine with

==================== snip ==================== Solving generalized eigenvalue problem with preconditioning

matrix size 5 block size 1

No constraints

iteration 0 [ True] current block size: 1 eigenvalue: [ 25.] residual norms: [ 120.] iteration 1 [ True] current block size: 1 eigenvalue: [ 0.] residual norms: [ 1.03680013e+09] iteration 2 [ True] current block size: 1 eigenvalue: [ 0.] residual norms: [ 2.39610086e+45] iteration 3 Warning: overflow encountered in multiply [ True] current block size: 1 eigenvalue: [ 0.] residual norms: [ inf] Traceback (most recent call last): File "logpcg_test.py", line 8, in lobpcg( A, X, verbosityLevel = 10 ) File "/usr/lib64/python2.6/site-packages/scipy/sparse/linalg/eigen/lobpcg/lobpcg.py", line 391, in lobpcg aux = b_orthonormalize( B, activeBlockVectorR ) File "/usr/lib64/python2.6/site-packages/scipy/sparse/linalg/eigen/lobpcg/lobpcg.py", line 130, in b_orthonormalize gramVBV = sla.cholesky( gramVBV ) File "/usr/lib64/python2.6/site-packages/scipy/linalg/decomp_cholesky.py", line 66, in cholesky c, lower = _cholesky(a, lower=lower, overwrite_a=overwrite_a, clean=True) File "/usr/lib64/python2.6/site-packages/scipy/linalg/decomp_cholesky.py", line 16, in _cholesky a1 = asarray_chkfinite(a) File "/usr/lib64/python2.6/site-packages/numpy/lib/function_base.py", line 547, in asarray_chkfinite "array must not contain infs or NaNs") ValueError: array must not contain infs or NaNs ==================== snap ====================

whereas on another one, one receives the expected output

==================== snip ==================== Solving generalized eigenvalue problem with preconditioning

matrix size 5 block size 1

No constraints

iteration 0 [False] final eigenvalue: [ 1.] final residual norms: [ 0.] ==================== snap ====================

Cheers, Nico

scipy-gitbot commented 11 years ago

Attachment added by trac user nicki on 2010-10-13: logpcg_test.py

scipy-gitbot commented 11 years ago

trac user nicki wrote on 2010-10-13

One thing I've found now is that line line 131 of lobpcg.py,

sla.inv( gramVBV, overwrite_a = True )

gramVBV does not get overwritten. I'm sure this is the culprit; renaming the issue.

--Nico

scipy-gitbot commented 11 years ago

Title changed from lobpcg fails on some machines for trivial problems to scipy.linalg.inv ignores "overwrite_a = True" option by trac user nicki on 2010-10-13

scipy-gitbot commented 11 years ago

@pv wrote on 2010-10-13

It's the culprit -- the overwrite_a option is not meant to do that, it just gives room for optimization.

scipy-gitbot commented 11 years ago

Title changed from scipy.linalg.inv ignores "overwrite_a = True" option to lobpcg fails on some machines for trivial problems by @pv on 2010-10-13

scipy-gitbot commented 11 years ago

@pv wrote on 2010-10-13

Fixed in c11ccc5