[Scipy-svn] r6835 - in trunk/scipy: linalg sparse/linalg/eigen/lobpcg sparse/linalg/eigen/lobpcg/tests

scipy-svn@scip... scipy-svn@scip...
Wed Oct 13 16:44:46 CDT 2010


Author: ptvirtan
Date: 2010-10-13 16:44:46 -0500 (Wed, 13 Oct 2010)
New Revision: 6835

Modified:
   trunk/scipy/linalg/basic.py
   trunk/scipy/sparse/linalg/eigen/lobpcg/lobpcg.py
   trunk/scipy/sparse/linalg/eigen/lobpcg/tests/test_lobpcg.py
Log:
BUG: scipy.sparse.linalg.eigen.lobpcg: remember that linalg.inv(overwrite_a=True) does not guarantee the output is overwritten (#1304)

Modified: trunk/scipy/linalg/basic.py
===================================================================
--- trunk/scipy/linalg/basic.py	2010-10-13 02:29:33 UTC (rev 6834)
+++ trunk/scipy/linalg/basic.py	2010-10-13 21:44:46 UTC (rev 6835)
@@ -206,6 +206,8 @@
     ----------
     a : array-like, shape (M, M)
         Matrix to be inverted
+    overwrite_a : bool, optional
+        Discard data in ``a`` (may improve performance)
 
     Returns
     -------

Modified: trunk/scipy/sparse/linalg/eigen/lobpcg/lobpcg.py
===================================================================
--- trunk/scipy/sparse/linalg/eigen/lobpcg/lobpcg.py	2010-10-13 02:29:33 UTC (rev 6834)
+++ trunk/scipy/sparse/linalg/eigen/lobpcg/lobpcg.py	2010-10-13 21:44:46 UTC (rev 6835)
@@ -137,7 +137,7 @@
             blockVectorBV = blockVectorV # Shared data!!!
     gramVBV = sp.dot( blockVectorV.T, blockVectorBV )
     gramVBV = sla.cholesky( gramVBV )
-    sla.inv( gramVBV, overwrite_a = True )
+    gramVBV = sla.inv( gramVBV, overwrite_a = True )
     # gramVBV is now R^{-1}.
     blockVectorV = sp.dot( blockVectorV, gramVBV )
     if B is not None:

Modified: trunk/scipy/sparse/linalg/eigen/lobpcg/tests/test_lobpcg.py
===================================================================
--- trunk/scipy/sparse/linalg/eigen/lobpcg/tests/test_lobpcg.py	2010-10-13 02:29:33 UTC (rev 6834)
+++ trunk/scipy/sparse/linalg/eigen/lobpcg/tests/test_lobpcg.py	2010-10-13 21:44:46 UTC (rev 6835)
@@ -5,7 +5,7 @@
 import numpy
 from numpy.testing import assert_almost_equal, run_module_suite
 
-from scipy import arange, ones, rand, set_printoptions, r_, diag, linalg
+from scipy import arange, ones, rand, set_printoptions, r_, diag, linalg, eye
 from scipy.linalg import eig
 from scipy.sparse.linalg.eigen.lobpcg import lobpcg
 
@@ -77,6 +77,11 @@
     A,B = MikotaPair(100)
     compare_solutions(A,B,20)
 
+def test_trivial():
+    n = 5
+    X = ones((n, 1))
+    A = eye(n)
+    compare_solutions(A, None, n)
 
 if __name__ == "__main__":
     run_module_suite()



More information about the Scipy-svn mailing list