[Scipy-svn] r3814 - branches/testing_cleanup/scipy/sparse

scipy-svn@scip... scipy-svn@scip...
Fri Jan 11 19:51:06 CST 2008


Author: matthew.brett@gmail.com
Date: 2008-01-11 19:50:57 -0600 (Fri, 11 Jan 2008)
New Revision: 3814

Modified:
   branches/testing_cleanup/scipy/sparse/__init__.py
   branches/testing_cleanup/scipy/sparse/base.py
   branches/testing_cleanup/scipy/sparse/compressed.py
   branches/testing_cleanup/scipy/sparse/construct.py
   branches/testing_cleanup/scipy/sparse/coo.py
   branches/testing_cleanup/scipy/sparse/csc.py
   branches/testing_cleanup/scipy/sparse/csr.py
   branches/testing_cleanup/scipy/sparse/dia.py
   branches/testing_cleanup/scipy/sparse/info.py
   branches/testing_cleanup/scipy/sparse/lil.py
   branches/testing_cleanup/scipy/sparse/spfuncs.py
   branches/testing_cleanup/scipy/sparse/sputils.py
Log:
Found changes to sparse documentation from missed merge

Modified: branches/testing_cleanup/scipy/sparse/__init__.py
===================================================================
--- branches/testing_cleanup/scipy/sparse/__init__.py	2008-01-11 19:21:45 UTC (rev 3813)
+++ branches/testing_cleanup/scipy/sparse/__init__.py	2008-01-12 01:50:57 UTC (rev 3814)
@@ -15,5 +15,5 @@
 from spfuncs import *
 
 __all__ = filter(lambda s:not s.startswith('_'),dir())
-from scipy.testing.pkgtester import Tester
-test = Tester().test
+from numpy.testing import NumpyTest
+test = NumpyTest().test

Modified: branches/testing_cleanup/scipy/sparse/base.py
===================================================================
--- branches/testing_cleanup/scipy/sparse/base.py	2008-01-11 19:21:45 UTC (rev 3813)
+++ branches/testing_cleanup/scipy/sparse/base.py	2008-01-12 01:50:57 UTC (rev 3814)
@@ -180,13 +180,15 @@
     def asformat(self, format):
         """Return this matrix in a given sparse format
 
-        *Parameters*:
-            format : desired sparse matrix format
-                If format is None then no conversion is performed
-                Other possible values include:
-                    "csr" for csr_matrix format
-                    "csc" for csc_matrix format
-                    "dok" for dok_matrix format and so on
+        Parameters
+        ==========
+            - format : desired sparse matrix format
+              - If format is None then no conversion is performed
+              - Other possible values include:
+                -  "csr" for csr_matrix format
+                -  "csc" for csc_matrix format
+                -  "dok" for dok_matrix format and so on
+
         """
 
         if format is None or format == self.format:
@@ -375,11 +377,12 @@
     def rmatvec(self, other, conjugate=True):
         """Multiplies the vector 'other' by the sparse matrix, returning a
         dense vector as a result.
-
+        
         If 'conjugate' is True:
-            returns A.transpose().conj() * other
+            - returns A.transpose().conj() * other
         Otherwise:
-            returns A.transpose() * other.
+            - returns A.transpose() * other.
+        
         """
         return self.tocsr().rmatvec(other, conjugate=conjugate)
 

Modified: branches/testing_cleanup/scipy/sparse/compressed.py
===================================================================
--- branches/testing_cleanup/scipy/sparse/compressed.py	2008-01-11 19:21:45 UTC (rev 3813)
+++ branches/testing_cleanup/scipy/sparse/compressed.py	2008-01-12 01:50:57 UTC (rev 3814)
@@ -109,11 +109,13 @@
     def check_format(self, full_check=True):
         """check whether the matrix format is valid
 
-            *Parameters*:
-                full_check:
-                    True  - rigorous check, O(N) operations : default
-                    False - basic check, O(1) operations
+        Parameters
+        ==========
 
+            - full_check : {bool}
+                - True  - rigorous check, O(N) operations : default
+                - False - basic check, O(1) operations
+
         """
         #use _swap to determine proper bounds
         major_name,minor_name = self._swap(('row','column'))

Modified: branches/testing_cleanup/scipy/sparse/construct.py
===================================================================
--- branches/testing_cleanup/scipy/sparse/construct.py	2008-01-11 19:21:45 UTC (rev 3813)
+++ branches/testing_cleanup/scipy/sparse/construct.py	2008-01-12 01:50:57 UTC (rev 3814)
@@ -25,19 +25,24 @@
 
     B = spdiags(diags, offsets, m, n)
 
-    *Parameters*:
-        data   : matrix whose rows contain the diagonal values
-        diags  : diagonals to set 
-                    k = 0 - the main diagonal
-                    k > 0 - the k-th upper diagonal
-                    k < 0 - the k-th lower diagonal
-        m, n   : dimensions of the result
-        format : format of the result (e.g. "csr")
-                    By default (format=None) an appropriate sparse matrix 
-                    format is returned.  This choice is subject to change.
+    Parameters
+    ==========
+        - data   : matrix whose rows contain the diagonal values
+        - diags  : diagonals to set 
+            - k = 0 - the main diagonal
+            - k > 0 - the k-th upper diagonal
+            - k < 0 - the k-th lower diagonal
+        - m, n   : dimensions of the result
+        - format : format of the result (e.g. "csr")
+            -  By default (format=None) an appropriate sparse matrix 
+               format is returned.  This choice is subject to change.
 
-    *Example*
-    -------
+    See Also
+    ========
+        The dia_matrix class which implements the DIAgonal format.
+
+    Example
+    =======
     >>> data = array([[1,2,3,4]]).repeat(3,axis=0)
     >>> diags = array([0,-1,2])
     >>> spdiags(data,diags,4,4).todense()
@@ -76,16 +81,19 @@
 def spkron(A, B, format=None):
     """kronecker product of sparse matrices A and B
 
-    *Parameters*:
-        A,B : sparse matrices
-            E.g. csr_matrix, csc_matrix, coo_matrix, etc.
+    Parameters
+    ==========
+        A,B    : dense or sparse matrices
+        format : format of the result (e.g. "csr")
+            -  By default (format=None) an appropriate sparse matrix 
+               format is returned.  This choice is subject to change.
 
-    *Returns*:
-        coo_matrix
-            kronecker product in COOrdinate format
+    Returns
+    =======
+        kronecker product in a sparse matrix format
 
-    *Example*:
-    -------
+    Examples
+    ========
 
     >>> A = csr_matrix(array([[0,2],[5,0]]))
     >>> B = csr_matrix(array([[1,2],[3,4]]))
@@ -95,8 +103,14 @@
             [  5.,  10.,   0.,   0.],
             [ 15.,  20.,   0.,   0.]])
 
+    >>> spkron(A,[[1,2],[3,4]]).todense()
+    matrix([[  0.,   0.,   2.,   4.],
+            [  0.,   0.,   6.,   8.],
+            [  5.,  10.,   0.,   0.],
+            [ 15.,  20.,   0.,   0.]])
+
     """
-    #TODO optimize for small dense B and CSR A
+    #TODO optimize for small dense B and CSR A -> BSR
     B = coo_matrix(B)
 
     
@@ -151,14 +165,15 @@
     """Generate a lil_matrix of dimensions (r,c) with the k-th
     diagonal set to 1.
 
-    :Parameters:
-        r,c : int
-            Row and column-dimensions of the output.
-        k : int
-            Diagonal offset.  In the output matrix,
-            out[m,m+k] == 1 for all m.
-        dtype : dtype
-            Data-type of the output array.
+    Parameters
+    ==========
+        - r,c : int
+            - row and column-dimensions of the output.
+        - k : int
+            - diagonal offset.  In the output matrix,
+            - out[m,m+k] == 1 for all m.
+        - dtype : dtype
+            - data-type of the output array.
 
     """
     warn("lil_eye is deprecated. use speye(... , format='lil') instead", \
@@ -171,19 +186,20 @@
 def lil_diags(diags,offsets,(m,n),dtype='d'):
     """Generate a lil_matrix with the given diagonals.
 
-    :Parameters:
-        diags : list of list of values e.g. [[1,2,3],[4,5]]
-            Values to be placed on each indicated diagonal.
-        offsets : list of ints
-            Diagonal offsets.  This indicates the diagonal on which
-            the given values should be placed.
-        (r,c) : tuple of ints
-            Row and column dimensions of the output.
-        dtype : dtype
-           Output data-type.
+    Parameters
+    ==========
+        - diags : list of list of values e.g. [[1,2,3],[4,5]]
+            - values to be placed on each indicated diagonal.
+        - offsets : list of ints
+            - diagonal offsets.  This indicates the diagonal on which
+              the given values should be placed.
+        - (r,c) : tuple of ints
+            - row and column dimensions of the output.
+        - dtype : dtype
+            - output data-type.
 
-    Example:
-    -------
+    Example
+    =======
 
     >>> lil_diags([[1,2,3],[4,5],[6]],[0,1,2],(3,3)).todense()
     matrix([[ 1.,  4.,  6.],

Modified: branches/testing_cleanup/scipy/sparse/coo.py
===================================================================
--- branches/testing_cleanup/scipy/sparse/coo.py	2008-01-11 19:21:45 UTC (rev 3813)
+++ branches/testing_cleanup/scipy/sparse/coo.py	2008-01-12 01:50:57 UTC (rev 3814)
@@ -1,4 +1,4 @@
-""" A sparse matrix in COOrdinate format """
+""" A sparse matrix in COOrdinate or 'triplet' format"""
 
 __all__ = ['coo_matrix', 'isspmatrix_coo']
 
@@ -21,34 +21,52 @@
 
     This can be instantiated in several ways:
       - coo_matrix(D)
-        with a dense matrix D
+        - with a dense matrix D
 
       - coo_matrix(S)
-        with another sparse matrix S (equivalent to S.tocoo())
+        - with another sparse matrix S (equivalent to S.tocoo())
 
       - coo_matrix((M, N), [dtype])
-        to construct an empty matrix with shape (M, N)
-        dtype is optional, defaulting to dtype='d'.
+        - to construct an empty matrix with shape (M, N)
+          dtype is optional, defaulting to dtype='d'.
 
       - coo_matrix((data, ij), [shape=(M, N)])
-        When shape is not specified, it is inferred from the index arrays:
-            ij[0][:] and ij[1][:]
+        - When shape is not specified, it is inferred from the index arrays:
+          - ij[0][:] and ij[1][:]
 
-        The arguments 'data' and 'ij' represent three arrays:
-            1. data[:]   the entries of the matrix, in any order
-            2. ij[0][:]  the row indices of the matrix entries
-            3. ij[1][:]  the column indices of the matrix entries
-    
-        So the following holds:
-            A[ij[0][k], ij[1][k] = data[k]
+        - The arguments 'data' and 'ij' represent three arrays:
+             1. data[:]   the entries of the matrix, in any order
+             2. ij[0][:]  the row indices of the matrix entries
+             3. ij[1][:]  the column indices of the matrix entries
+          So the following holds:
+           - A[ij[0][k], ij[1][k] = data[k]
 
-    Note:
-        When converting to CSR or CSC format, duplicate (i,j) entries
-        will be summed together.  This facilitates efficient construction
-        of finite element matrices and the like.
+    Notes
+    =====
+        Advantages of the COO format
+        ----------------------------
+          - facilitates fast conversion among sparse formats
+          - permits duplicate entries (see example)
+          - faster conversion to CSR/CSC than LIL
+        
+        Disadvantages of the COO format
+        -------------------------------
+          - does not currently support (forces COO->CSR conversion) 
+            - arithmetic operations
+            - slicing
+            - matrix vector products
+        
+        Usage
+        -----
+          - COO is a fast format for constructing sparse matrices
+          - once a matrix has been constructed, convert to CSR or 
+            CSC format for fast arithmetic and matrix vector operations
+          - By default when converting to CSR or CSC format, duplicate (i,j) 
+            entries will be summed together.  This facilitates efficient 
+            construction of finite element matrices and the like. (see example)
 
-    *Examples*
-    ----------
+    Examples
+    ========
 
     >>> from scipy.sparse import *
     >>> from scipy import *

Modified: branches/testing_cleanup/scipy/sparse/csc.py
===================================================================
--- branches/testing_cleanup/scipy/sparse/csc.py	2008-01-11 19:21:45 UTC (rev 3813)
+++ branches/testing_cleanup/scipy/sparse/csc.py	2008-01-12 01:50:57 UTC (rev 3814)
@@ -1,5 +1,4 @@
-"""Compressed Sparse Column matrix format
-"""
+"""Compressed Sparse Column matrix format"""
 
 __all__ = ['csc_matrix', 'isspmatrix_csc']
 
@@ -23,32 +22,45 @@
 
     This can be instantiated in several ways:
       - csc_matrix(D)
-        with a dense matrix or rank-2 ndarray D
+        - with a dense matrix or rank-2 ndarray D
 
       - csc_matrix(S)
-        with another sparse matrix S (equivalent to S.tocsc())
+        - with another sparse matrix S (equivalent to S.tocsc())
 
       - csc_matrix((M, N), [dtype])
-        to construct an empty matrix with shape (M, N)
-        dtype is optional, defaulting to dtype='d'.
+        - to construct an empty matrix with shape (M, N)
+        - dtype is optional, defaulting to dtype='d'.
 
       - csc_matrix((data, ij), [shape=(M, N)])
-        where data, ij satisfy:
-            a[ij[0, k], ij[1, k]] = data[k]
+        - where data, ij satisfy:
+          - a[ij[0, k], ij[1, k]] = data[k]
 
       - csc_matrix((data, indices, indptr), [shape=(M, N)])
-        is the native CSC representation where:
-            the row indices for column i are stored in
-                indices[ indptr[i]: indices[i+1] ] 
-            and their corresponding values are stored in
-                data[ indptr[i]: indptr[i+1] ]
-        If the shape parameter is not supplied, the matrix dimensions
-        are inferred from the index arrays.
+         - is the standard CSC representation where
+           the row indices for column i are stored in
+            - indices[ indptr[i]: indices[i+1] ] 
+           and their corresponding values are stored in
+            - data[ indptr[i]: indptr[i+1] ]
+         - If the shape parameter is not supplied, the matrix dimensions
+           are inferred from the index arrays.
 
+    Notes
+    =====
+        Advantages of the CSC format
+        ----------------------------
+          - efficient arithmetic operations CSC + CSC, CSC * CSC, etc.
+          - efficient column slicing
+          - fast matrix vector products (CSR,BSR may be faster)
+        
+        Disadvantages of the CSC format
+        -------------------------------
+          - slow row slicing operations (prefer CSR)
+          - changes to the sparsity structure are expensive (prefer LIL, DOK)
 
-    *Examples*
-    ----------
 
+    Examples
+    ========
+
     >>> from scipy.sparse import *
     >>> from scipy import *
     >>> csc_matrix( (3,4), dtype='i' ).todense()
@@ -132,9 +144,9 @@
     def get_submatrix( self, slice0, slice1 ):
         """Return a submatrix of this matrix (new matrix is created).
         Contigous range of rows and columns can be selected using:
-        1. a slice object
-        2. a tuple (from, to)
-        3. a scalar for single row/column selection."""
+          1. a slice object
+          2. a tuple (from, to)
+          3. a scalar for single row/column selection."""
         aux = _cs_matrix._get_submatrix( self, self.shape[1], self.shape[0],
                                          slice1, slice0 )
         nr, nc = aux[3:]

Modified: branches/testing_cleanup/scipy/sparse/csr.py
===================================================================
--- branches/testing_cleanup/scipy/sparse/csr.py	2008-01-11 19:21:45 UTC (rev 3813)
+++ branches/testing_cleanup/scipy/sparse/csr.py	2008-01-12 01:50:57 UTC (rev 3814)
@@ -1,5 +1,4 @@
-"""Compressed Sparse Row matrix format
-"""
+"""Compressed Sparse Row matrix format"""
 
 __all__ = ['csr_matrix', 'isspmatrix_csr']
 
@@ -23,32 +22,47 @@
 
     This can be instantiated in several ways:
       - csr_matrix(D)
-        with a dense matrix or rank-2 ndarray D
+        - with a dense matrix or rank-2 ndarray D
 
       - csr_matrix(S)
-        with another sparse matrix S (equivalent to S.tocsr())
+        - with another sparse matrix S (equivalent to S.tocsr())
 
       - csr_matrix((M, N), [dtype])
-        to construct an empty matrix with shape (M, N)
-        dtype is optional, defaulting to dtype='d'.
+        - to construct an empty matrix with shape (M, N)
+        - dtype is optional, defaulting to dtype='d'.
 
       - csr_matrix((data, ij), [shape=(M, N)])
-        where data, ij satisfy:
-            a[ij[0, k], ij[1, k]] = data[k]
+        - where data, ij satisfy:
+          - a[ij[0, k], ij[1, k]] = data[k]
 
       - csr_matrix((data, indices, indptr), [shape=(M, N)])
-        is the native CSR representation where:
-            the column indices for row i are stored in
-                indices[ indptr[i]: indices[i+1] ] 
-            and their corresponding values are stored in
-                data[ indptr[i]: indptr[i+1] ]
-        If the shape parameter is not supplied, the matrix dimensions
-        are inferred from the index arrays.
+        - is the standard CSR representation where
+          the column indices for row i are stored in
+           - indices[ indptr[i]: indices[i+1] ] 
+          and their corresponding values are stored in
+           - data[ indptr[i]: indptr[i+1] ]
+        - If the shape parameter is not supplied, the matrix dimensions
+          are inferred from the index arrays.
 
 
-    *Examples*
-    ----------
+    Notes
+    =====
+        Advantages of the CSR format
+        ----------------------------
+          - efficient arithmetic operations CSR + CSR, CSR * CSR, etc.
+          - efficient row slicing
+          - fast matrix vector products
+        
+        Disadvantages of the CSR format
+        -------------------------------
+          - slow column slicing operations (prefer CSC)
+          - changes to the sparsity structure are expensive (prefer LIL, DOK)
 
+
+
+    Examples
+    ========    
+
     >>> from scipy.sparse import *
     >>> from scipy import *
     >>> csr_matrix( (3,4), dtype='i' ).todense()
@@ -146,10 +160,12 @@
     def get_submatrix( self, slice0, slice1 ):
         """Return a submatrix of this matrix (new matrix is created).
         Contigous range of rows and columns can be selected using:
-        1. a slice object
-        2. a tuple (from, to)
-        3. a scalar for single row/column selection."""
+          1. a slice object
+          2. a tuple (from, to)
+          3. a scalar for single row/column selection.
 
+        """
+
         aux = _cs_matrix._get_submatrix( self, self.shape[0], self.shape[1],
                                          slice0, slice1 )
         nr, nc = aux[3:]

Modified: branches/testing_cleanup/scipy/sparse/dia.py
===================================================================
--- branches/testing_cleanup/scipy/sparse/dia.py	2008-01-11 19:21:45 UTC (rev 3813)
+++ branches/testing_cleanup/scipy/sparse/dia.py	2008-01-12 01:50:57 UTC (rev 3814)
@@ -15,23 +15,24 @@
 
     This can be instantiated in several ways:
       - dia_matrix(D)
-        with a dense matrix
+        - with a dense matrix
 
       - dia_matrix(S)
-        with another sparse matrix S (equivalent to S.todia())
+        - with another sparse matrix S (equivalent to S.todia())
 
       - dia_matrix((M, N), [dtype])
-        to construct an empty matrix with shape (M, N)
-        dtype is optional, defaulting to dtype='d'.
+        - to construct an empty matrix with shape (M, N)
+          dtype is optional, defaulting to dtype='d'.
 
       - dia_matrix((data, diags), shape=(M, N))
-        where the data[k,:] stores the diagonal entries for
-        diagonal diag[k] (See example below)
+        - where the data[k,:] stores the diagonal entries for
+          diagonal diag[k] (See example below)
 
 
-    *Examples*
-    ----------
+    Examples
+    ========
 
+
     >>> from scipy.sparse import *
     >>> from scipy import *
     >>> dia_matrix( (3,4), dtype='i').todense()

Modified: branches/testing_cleanup/scipy/sparse/info.py
===================================================================
--- branches/testing_cleanup/scipy/sparse/info.py	2008-01-11 19:21:45 UTC (rev 3813)
+++ branches/testing_cleanup/scipy/sparse/info.py	2008-01-12 01:50:57 UTC (rev 3814)
@@ -7,12 +7,14 @@
 Original code by Travis Oliphant.
 Modified and extended by Ed Schofield, Robert Cimrman, and Nathan Bell.
 
-There are five available sparse matrix types:
-    (1) csc_matrix: Compressed Sparse Column format
-    (2) csr_matrix: Compressed Sparse Row format
-    (3) lil_matrix: List of Lists format
-    (4) dok_matrix: Dictionary of Keys format
-    (5) coo_matrix: COOrdinate format (aka IJV, triplet format)
+There are seven available sparse matrix types:
+    1. csc_matrix: Compressed Sparse Column format
+    2. csr_matrix: Compressed Sparse Row format
+    3. bsr_matrix: Block Sparse Row format
+    4. lil_matrix: List of Lists format
+    5. dok_matrix: Dictionary of Keys format
+    6. coo_matrix: COOrdinate format (aka IJV, triplet format)
+    7. dig_matrix: DIAgonal format
 
 To construct a matrix efficiently, use either lil_matrix (recommended) or
 dok_matrix. The lil_matrix class supports basic slicing and fancy
@@ -27,8 +29,10 @@
 All conversions among the CSR, CSC, and COO formats are efficient,
 linear-time operations.
 
-Example:
+Example
+=======
     Construct a 1000x1000 lil_matrix and add some values to it:
+
     >>> from scipy import sparse, linsolve
     >>> from numpy import linalg
     >>> from numpy.random import rand
@@ -38,22 +42,28 @@
     >>> A.setdiag(rand(1000))
 
     Now convert it to CSR format and solve (A A^T) x = b for x:
+
     >>> A = A.tocsr()
     >>> b = rand(1000)
     >>> x = linsolve.spsolve(A * A.T, b)
 
     Convert it to a dense matrix and solve, and check that the result
     is the same:
+
     >>> A_ = A.todense()
     >>> x_ = linalg.solve(A_ * A_.T, b)
     >>> err = linalg.norm(x-x_)
 
     Now we can print the error norm with:
-        print "Norm error =", err
+
+    >>> print "Norm error =", err
+
     It should be small :)
 
-Example:
+Example
+=======
     Construct a matrix in COO format:
+
     >>> from scipy import sparse
     >>> from numpy import array
     >>> I = array([0,3,1,0])
@@ -64,6 +74,7 @@
     Notice that the indices do not need to be sorted.
 
     Duplicate (i,j) entries are summed when converting to CSR or CSC.
+
     >>> I = array([0,0,1,3,1,0,0])
     >>> J = array([0,2,1,3,1,0,0])
     >>> V = array([1,1,1,1,1,1,1])
@@ -72,13 +83,13 @@
     This is useful for constructing finite-element stiffness and
     mass matrices.
 
-Further Details:
+Further Details
+===============
+
     CSR column indices are not necessarily sorted.  Likewise for CSC row
     indices.  Use the .sorted_indices() and .sort_indices() methods when 
-    sorted indices are necessary.  Note that there is no expectation for 
-    sorted indices in the sparsetools module.  Furthermore some sparsetools 
-    functions produce matrices with unsorted indices even when sorted 
-    input is given.
+    sorted indices are required (e.g. when passing data to other libraries). 
+
 """
 
 postpone_import = 1

Modified: branches/testing_cleanup/scipy/sparse/lil.py
===================================================================
--- branches/testing_cleanup/scipy/sparse/lil.py	2008-01-11 19:21:45 UTC (rev 3813)
+++ branches/testing_cleanup/scipy/sparse/lil.py	2008-01-12 01:50:57 UTC (rev 3814)
@@ -21,6 +21,27 @@
     This contains a list (self.rows) of rows, each of which is a sorted
     list of column indices of non-zero elements. It also contains a list
     (self.data) of lists of these elements.
+
+    Notes
+    =====
+        Advantages of the LIL format
+        ----------------------------
+          - supports flexible slicing
+          - changes to the matrix sparsity structure are efficient
+        
+        Disadvantages of the LIL format
+        -------------------------------
+          - arithmetic operations LIL + LIL are slower than CSR/CSC
+          - slow column slicing
+          - matrix vector products are slower than CSR/CSC
+        
+        Usage
+        -----
+          - LIL is a convenient format for constructing sparse matrices 
+          - once a matrix has been constructed, convert to CSR or 
+            CSC format for fast arithmetic and matrix vector operations
+          - consider using the COO format when constructing large matrices
+        
     """
 
     def __init__(self, A=None, shape=None, dtype=None, copy=False):

Modified: branches/testing_cleanup/scipy/sparse/spfuncs.py
===================================================================
--- branches/testing_cleanup/scipy/sparse/spfuncs.py	2008-01-11 19:21:45 UTC (rev 3813)
+++ branches/testing_cleanup/scipy/sparse/spfuncs.py	2008-01-12 01:50:57 UTC (rev 3814)
@@ -14,9 +14,7 @@
 from sparsetools import csr_count_blocks
 
 def extract_diagonal(A):
-    """
-    extract_diagonal(A) returns the main diagonal of A.
-    """
+    """extract_diagonal(A) returns the main diagonal of A."""
     #TODO extract k-th diagonal
     if isspmatrix_csr(A) or isspmatrix_csc(A):
         fn = getattr(sparsetools, A.format + "_diagonal")
@@ -33,7 +31,7 @@
     """Attempt to determine the blocksize of a sparse matrix
 
     Returns a blocksize=(r,c) such that
-        A.nnz / A.tobsr( (r,c) ).nnz > efficiency
+        - A.nnz / A.tobsr( (r,c) ).nnz > efficiency
     """
     if not (isspmatrix_csr(A) or isspmatrix_csc(A)):
         A = csr_matrix(A)

Modified: branches/testing_cleanup/scipy/sparse/sputils.py
===================================================================
--- branches/testing_cleanup/scipy/sparse/sputils.py	2008-01-11 19:21:45 UTC (rev 3813)
+++ branches/testing_cleanup/scipy/sparse/sputils.py	2008-01-12 01:50:57 UTC (rev 3814)
@@ -21,8 +21,8 @@
 
     upcast(t0, t1, ..., tn) -> T  where T is a supported dtype
 
-    *Example*
-    -------
+    Example
+    =======
     
     >>> upcast('int32')
     <type 'numpy.int32'>



More information about the Scipy-svn mailing list