Original ticket http://projects.scipy.org/scipy/ticket/1208 on 2010-06-21 by trac user bemasc, assigned to @wnbell.
I encountered strange behavior from LOBPCG. It appeared to be nondeterministically giving me wrong answers. I am no longer able to reproduce the nondeterminism, but in developing a test case I discovered that it is sometimes returning eigenvectors and eigenvalues that bear no resemblance to correctness.
I attach a small test case. When I run the test case, I (deterministically) get the following output:
current block size: 2
eigenvalue: [ 0.50435954 0.66425668 0.86243781 1.0582824 ]
residual norms: [ 7.22519642e-05 4.14898903e-05 1.17014344e-04 5.14611779e-02]
current block size: 2
eigenvalue: [ 0.50435954 0.66425668 0.86243781 1.05827785]
residual norms: [ 7.39321241e-05 4.16901930e-05 1.20605505e-04 5.13056942e-02]
current block size: 1
eigenvalue: [ 0.50435954 0.66425668 0.86243781 1.05827416]
residual norms: [ 6.16121851e-05 4.06799197e-05 9.92769947e-05 4.90514218e-02]
final eigenvalue: [ 6.32873682e-13 6.83448383e-03 5.04359537e-01 6.64256678e-01]
final residual norms: [ 1.73078371e-05 3.58451238e+00 6.18198279e-05 4.06847212e-05]
Eigenvector 0 has norm 2.97625e-07, claimed eigenvalue 6.32874e-13, measured eigenvalue 58.1533, and inner product 0.122859.
Eigenvector 1 has norm 0.00240866, claimed eigenvalue 0.00683448, measured eigenvalue 1488.18, and inner product 0.791587.
Eigenvector 2 has norm 1.00001, claimed eigenvalue 0.50436, measured eigenvalue 0.504349, and inner product 1.
Eigenvector 3 has norm 1, claimed eigenvalue 0.664257, measured eigenvalue 0.664257, and inner product 1.
As this shows, the first two eigenvectors are not correctly normalized, correspond to incorrect eigenvalues, and are not in fact eigenvectors at all. The next two eigenvectors, in contrast, are correctly normalized and correctly correspond to the claimed eigenvalue.
This appears to be a serious bug in LOBPCG.
trac user bemasc wrote on 2010-06-21
Looks like my matrix is too big to be accepted here as an attachment, so I put up the testcase (.py and .pickle) at
@pv wrote on 2010-12-12
This is the same problem as gh-1830, which was fixed in c11ccc5
final eigenvalue: [ 0.50434824 0.66425669 0.86242622 1.0581144 ]
final residual norms: [ 2.00691932e-05 2.52561151e-05 2.38814255e-05 9.34494879e-05]
Eigenvector 0 has norm 0.999999, claimed eigenvalue 0.504348, measured eigenvalue 0.504349, and inner product 1.
Eigenvector 1 has norm 1, claimed eigenvalue 0.664257, measured eigenvalue 0.664257, and inner product 1.
Eigenvector 2 has norm 0.999999, claimed eigenvalue 0.862426, measured eigenvalue 0.862429, and inner product 1.
Eigenvector 3 has norm 1, claimed eigenvalue 1.05811, measured eigenvalue 1.05811, and inner product 1.
TST: mark TestEig.test_singular as knownfail on Windows for 0.11.x. See