[Scipy-svn] r6993 - trunk/scipy/sparse/linalg/eigen/arpack

scipy-svn at scipy.org scipy-svn at scipy.org
Sat Dec 4 15:26:06 EST 2010


Author: ptvirtan
Date: 2010-12-04 14:26:06 -0600 (Sat, 04 Dec 2010)
New Revision: 6993

Modified:
   trunk/scipy/sparse/linalg/eigen/arpack/README
   trunk/scipy/sparse/linalg/eigen/arpack/arpack.py
   trunk/scipy/sparse/linalg/eigen/arpack/info.py
Log:
ENH: sparse/arpack: Update the documentation including adding some references.

Modified: trunk/scipy/sparse/linalg/eigen/arpack/README
===================================================================
--- trunk/scipy/sparse/linalg/eigen/arpack/README	2010-12-04 20:25:55 UTC (rev 6992)
+++ trunk/scipy/sparse/linalg/eigen/arpack/README	2010-12-04 20:26:06 UTC (rev 6993)
@@ -49,8 +49,8 @@
 
 ---
 
-The ARPACK license is BSD-like.
-http://www.caam.rice.edu/software/ARPACK/RiceBSD.doc
+The ARPACK license is the BSD 3-clause license ("New BSD License")
+http://www.caam.rice.edu/software/ARPACK/RiceBSD.txt
 
 ---
 

Modified: trunk/scipy/sparse/linalg/eigen/arpack/arpack.py
===================================================================
--- trunk/scipy/sparse/linalg/eigen/arpack/arpack.py	2010-12-04 20:25:55 UTC (rev 6992)
+++ trunk/scipy/sparse/linalg/eigen/arpack/arpack.py	2010-12-04 20:26:06 UTC (rev 6993)
@@ -383,8 +383,8 @@
             if ierr != 0:
                 raise ArpackError(ierr, infodict=_NEUPD_ERRORS)
 
-            # The ARPACK nonsymmetric real and double interface (s,d)naupd return
-            # eigenvalues and eigenvectors in real (float,double) arrays.
+            # The ARPACK nonsymmetric real and double interface (s,d)naupd
+            # return eigenvalues and eigenvectors in real (float,double) arrays.
 
             # Build complex eigenvalues from real and imaginary parts
             d = dr + 1.0j * di
@@ -417,7 +417,8 @@
                 if self.which in ['LR','SR']:
                     ind = np.argsort(rd.real)
                 elif self.which in ['LI','SI']:
-                    # for LI,SI ARPACK returns largest,smallest abs(imaginary) why?
+                    # for LI,SI ARPACK returns largest,smallest
+                    # abs(imaginary) why?
                     ind = np.argsort(abs(rd.imag))
                 else:
                     ind = np.argsort(abs(rd))
@@ -517,12 +518,18 @@
 
         The currently converged eigenvalues and eigenvectors can be found
         as ``eigenvalues`` and ``eigenvectors`` attributes of the exception
-        objed.
+        object.
 
     See Also
     --------
     eigsh : eigenvalues and eigenvectors for symmetric matrix A
 
+    Notes
+    -----
+    This function is a wrapper to the ARPACK [1]_ SNEUPD, DNEUPD, CNEUPD,
+    ZNEUPD, functions which use the Implicitly Restarted Arnoldi Method to
+    find the eigenvalues and eigenvectors [2]_.
+
     Examples
     --------
     Find 6 eigenvectors of the identity matrix:
@@ -534,6 +541,12 @@
     >>> vecs.shape
     (13, 6)
 
+    References
+    ----------
+    .. [1] ARPACK Software, http://www.caam.rice.edu/software/ARPACK/
+    .. [2] R. B. Lehoucq, D. C. Sorensen, and C. Yang,  ARPACK USERS GUIDE:
+       Solution of Large Scale Eigenvalue Problems by Implicitly Restarted
+       Arnoldi Methods. SIAM, Philadelphia, PA, 1998.
     """
     A = aslinearoperator(A)
     if A.shape[0] != A.shape[1]:
@@ -561,14 +574,12 @@
     Solves A * x[i] = w[i] * x[i], the standard eigenvalue problem for
     w[i] eigenvalues with corresponding eigenvectors x[i].
 
-
     Parameters
     ----------
     A : matrix or array with real entries or object with matvec(x) method
         An N x N real symmetric matrix or array or an object with matvec(x)
         method to perform the matrix vector product A * x.  The sparse
         matrix formats in scipy.sparse are appropriate for A.
-
     k : integer
         The number of eigenvalues and eigenvectors desired.
 
@@ -576,7 +587,6 @@
     -------
     w : array
         Array of k eigenvalues
-
     v : array
        An array of k eigenvectors
        The v[i] is the eigenvector corresponding to the eigenvector w[i]
@@ -587,20 +597,15 @@
         (Not implemented)
         A symmetric positive-definite matrix for the generalized
         eigenvalue problem A * x = w * M * x
-
-
     sigma : real
         (Not implemented)
         Find eigenvalues near sigma.  Shift spectrum by sigma.
-
     v0 : array
         Starting vector for iteration.
-
     ncv : integer
         The number of Lanczos vectors generated
         ncv must be greater than k and smaller than n;
         it is recommended that ncv > 2*k
-
     which : string
         Which k eigenvectors and eigenvalues to find:
          - 'LA' : Largest (algebraic) eigenvalues
@@ -609,14 +614,11 @@
          - 'SM' : Smallest (in magnitude) eigenvalues
          - 'BE' : Half (k/2) from each end of the spectrum
                   When k is odd, return one more (k/2+1) from the high end
-
     maxiter : integer
         Maximum number of Arnoldi update iterations allowed
-
     tol : float
         Relative accuracy for eigenvalues (stopping criterion).
         The default value of 0 implies machine precision.
-
     return_eigenvectors : boolean
         Return eigenvectors (True) in addition to eigenvalues
 
@@ -627,7 +629,7 @@
 
         The currently converged eigenvalues and eigenvectors can be found
         as ``eigenvalues`` and ``eigenvectors`` attributes of the exception
-        objed.
+        object.
 
     See Also
     --------
@@ -635,9 +637,25 @@
 
     Notes
     -----
+    This function is a wrapper to the ARPACK [1]_ SSEUPD and DSEUPD
+    functions which use the Implicitly Restarted Lanczos Method to
+    find the eigenvalues and eigenvectors [2]_.
 
     Examples
     --------
+    >>> id = np.identity(13)
+    >>> vals, vecs = sp.sparse.linalg.eigsh(id, k=6)
+    >>> vals
+    array([ 1.+0.j,  1.+0.j,  1.+0.j,  1.+0.j,  1.+0.j,  1.+0.j])
+    >>> vecs.shape
+    (13, 6)
+
+    References
+    ----------
+    .. [1] ARPACK Software, http://www.caam.rice.edu/software/ARPACK/
+    .. [2] R. B. Lehoucq, D. C. Sorensen, and C. Yang,  ARPACK USERS GUIDE:
+       Solution of Large Scale Eigenvalue Problems by Implicitly Restarted
+       Arnoldi Methods. SIAM, Philadelphia, PA, 1998.
     """
     A = aslinearoperator(A)
     if A.shape[0] != A.shape[1]:
@@ -657,7 +675,7 @@
     return params.extract(return_eigenvectors)
 
 def svds(A, k=6, ncv=None, tol=0):
-    """Compute a few singular values/vectors for a sparse matrix using ARPACK.
+    """Compute k singular values/vectors for a sparse matrix using ARPACK.
 
     Parameters
     ----------

Modified: trunk/scipy/sparse/linalg/eigen/arpack/info.py
===================================================================
--- trunk/scipy/sparse/linalg/eigen/arpack/info.py	2010-12-04 20:25:55 UTC (rev 6992)
+++ trunk/scipy/sparse/linalg/eigen/arpack/info.py	2010-12-04 20:26:06 UTC (rev 6993)
@@ -2,20 +2,19 @@
 Eigenvalue solver using iterative methods.
 
 Find k eigenvectors and eigenvalues of a matrix A using the
-Arnoldi/Lanczos iterative methods from ARPACK.
+Arnoldi/Lanczos iterative methods from ARPACK [1]_,[2]_.
 
 These methods are most useful for large sparse matrices.
 
-  - eigen(A,k)
-  - eigen_symmetric(A,k)
+  - eigs(A,k)
+  - eigsh(A,k)
 
-Reference
----------
- - http://www.caam.rice.edu/
-software/ARPACK/
- - http://www.caam.rice.edu/software/ARPACK/UG/ug.html
- - http://books.google.com/books?hl=en&id=4E9PY7NT8a0C&dq=arpack+users+guide
-
+References
+----------
+.. [1] ARPACK Software, http://www.caam.rice.edu/software/ARPACK/
+.. [2] R. B. Lehoucq, D. C. Sorensen, and C. Yang,  ARPACK USERS GUIDE:
+   Solution of Large Scale Eigenvalue Problems by Implicitly Restarted
+   Arnoldi Methods. SIAM, Philadelphia, PA, 1998.
 """
 global_symbols = []
 postpone_import = 1




More information about the Scipy-svn mailing list