[Scipy-svn] r6855 - trunk/scipy/sparse

scipy-svn@scip... scipy-svn@scip...
Sun Oct 24 14:19:43 CDT 2010


Author: warren.weckesser
Date: 2010-10-24 14:19:41 -0500 (Sun, 24 Oct 2010)
New Revision: 6855

Modified:
   trunk/scipy/sparse/info.py
Log:
DOC-BUG: sparse: Fixed Example 1 in the sparse module docstring (info.py)

Modified: trunk/scipy/sparse/info.py
===================================================================
--- trunk/scipy/sparse/info.py	2010-10-23 14:42:01 UTC (rev 6854)
+++ trunk/scipy/sparse/info.py	2010-10-24 19:19:41 UTC (rev 6855)
@@ -33,10 +33,12 @@
 ---------
 Construct a 1000x1000 lil_matrix and add some values to it:
 
->>> from scipy import sparse, linsolve
->>> from numpy import linalg
+>>> from scipy.sparse import lil_matrix
+>>> from scipy.sparse.linalg import spsolve
+>>> from numpy.linalg import solve, norm
 >>> from numpy.random import rand
->>> A = sparse.lil_matrix((1000, 1000))
+
+>>> A = lil_matrix((1000, 1000))
 >>> A[0, :100] = rand(100)
 >>> A[1, 100:200] = A[0, :100]
 >>> A.setdiag(rand(1000))
@@ -45,16 +47,16 @@
 
 >>> A = A.tocsr()
 >>> b = rand(1000)
->>> x = linsolve.spsolve(A, b)
+>>> x = spsolve(A, b)
 
 Convert it to a dense matrix and solve, and check that the result
 is the same:
 
->>> x_ = linalg.solve(A.todense(), b)
+>>> x_ = solve(A.todense(), b)
 
 Now we can compute norm of the error with:
 
->>> err = linalg.norm(x-x_)
+>>> err = norm(x-x_)
 >>> err < 1e-10
 True
 



More information about the Scipy-svn mailing list