[Scipy-svn] r5530 - in trunk/scipy/sparse: . sparsetools

scipy-svn at scipy.org scipy-svn at scipy.org
Sat Jan 31 22:57:10 EST 2009


Author: wnbell
Date: 2009-01-31 21:57:01 -0600 (Sat, 31 Jan 2009)
New Revision: 5530

Modified:
   trunk/scipy/sparse/bsr.py
   trunk/scipy/sparse/sparsetools/bsr.h
   trunk/scipy/sparse/sparsetools/bsr.py
   trunk/scipy/sparse/sparsetools/bsr_wrap.cxx
   trunk/scipy/sparse/sparsetools/coo.py
   trunk/scipy/sparse/sparsetools/csr.h
   trunk/scipy/sparse/sparsetools/dia.py
   trunk/scipy/sparse/sparsetools/scratch.h
   trunk/scipy/sparse/sparsetools/setup.py
Log:
added path for BSR (op) BSR where the BSR format is not canonical


Modified: trunk/scipy/sparse/bsr.py
===================================================================
--- trunk/scipy/sparse/bsr.py	2009-01-31 04:41:39 UTC (rev 5529)
+++ trunk/scipy/sparse/bsr.py	2009-02-01 03:57:01 UTC (rev 5530)
@@ -490,16 +490,11 @@
     # utility functions
     def _binopt(self, other, op, in_shape=None, out_shape=None):
         """apply the binary operation fn to two sparse matrices"""
-        other = self.__class__(other,blocksize=self.blocksize)
 
-        if in_shape is None:
-            in_shape = self.shape
-        if out_shape is None:
-            out_shape = self.shape
+        # ideally we'd take the GCDs of the blocksize dimensions
+        # and explode self and other to match
+        other = self.__class__(other, blocksize=self.blocksize)
 
-        self.sort_indices()
-        other.sort_indices()
-
         # e.g. bsr_plus_bsr, etc.
         fn = getattr(sparsetools, self.format + op + self.format)
 
@@ -510,7 +505,7 @@
         indices = np.empty(max_bnnz, dtype=np.intc)
         data    = np.empty(R*C*max_bnnz, dtype=upcast(self.dtype,other.dtype))
 
-        fn(in_shape[0]/R, in_shape[1]/C, R, C, \
+        fn(self.shape[0]/R, self.shape[1]/C, R, C,
                 self.indptr,  self.indices,  np.ravel(self.data),
                 other.indptr, other.indices, np.ravel(other.data),
                 indptr,       indices,       data)
@@ -525,7 +520,7 @@
 
         data = data.reshape(-1,R,C)
 
-        return self.__class__((data, indices, indptr), shape=out_shape)
+        return self.__class__((data, indices, indptr), shape=self.shape)
 
     # needed by _data_matrix
     def _with_data(self,data,copy=True):

Modified: trunk/scipy/sparse/sparsetools/bsr.h
===================================================================
--- trunk/scipy/sparse/sparsetools/bsr.h	2009-01-31 04:41:39 UTC (rev 5529)
+++ trunk/scipy/sparse/sparsetools/bsr.h	2009-02-01 03:57:01 UTC (rev 5530)
@@ -330,21 +330,123 @@
 
 
 
+/*
+ * Compute C = A (binary_op) B for BSR matrices that are not
+ * necessarily canonical BSR format.  Specifically, this method
+ * works even when the input matrices have duplicate and/or
+ * unsorted column indices within a given row.
+ *
+ * Refer to bsr_binop_bsr() for additional information
+ *   
+ * Note:
+ *   Output arrays Cp, Cj, and Cx must be preallocated
+ *   If nnz(C) is not known a priori, a conservative bound is:
+ *          nnz(C) <= nnz(A) + nnz(B)
+ *
+ * Note: 
+ *   Input:  A and B column indices are not assumed to be in sorted order 
+ *   Output: C column indices are not generally in sorted order
+ *           C will not contain any duplicate entries or explicit zeros.
+ *
+ */
 template <class I, class T, class bin_op>
-void bsr_binop_bsr(const I n_brow, const I n_bcol, 
-                   const I R,      const I C, 
-                   const I Ap[],   const I Aj[],    const T Ax[],
-                   const I Bp[],   const I Bj[],    const T Bx[],
-                         I Cp[],         I Cj[],          T Cx[],
-                   const bin_op& op)
+void bsr_binop_bsr_general(const I n_brow, const I n_bcol,
+                           const I R,      const I C,
+                           const I Ap[],  const I Aj[],  const T Ax[],
+                           const I Bp[],  const I Bj[],  const T Bx[],
+                                 I Cp[],        I Cj[],        T Cx[],
+                           const bin_op& op)
 {
-    assert( R > 0 && C > 0);
-    
-    if( R == 1 && C == 1 ){
-        csr_binop_csr(n_brow, n_bcol, Ap, Aj, Ax, Bp, Bj, Bx, Cp, Cj, Cx, op); //use CSR for 1x1 blocksize 
-        return;
+    //Method that works for duplicate and/or unsorted indices
+    const I RC = R*C;
+
+    Cp[0] = 0;
+    I nnz = 0;
+
+    std::vector<I>  next(n_bcol,     -1);
+    std::vector<T> A_row(n_bcol * RC, 0);   // this approach can be problematic for large R
+    std::vector<T> B_row(n_bcol * RC, 0);
+
+    for(I i = 0; i < n_brow; i++){
+        I head   = -2;
+        I length =  0;
+
+        //add a row of A to A_row
+        for(I jj = Ap[i]; jj < Ap[i+1]; jj++){
+            I j = Aj[jj];
+
+            for(I n = 0; n < RC; n++)
+                A_row[RC*j + n] += Ax[RC*jj + n];
+
+            if(next[j] == -1){
+                next[j] = head;                       
+                head = j;
+                length++;
+            }
+        }
+
+        //add a row of B to B_row
+        for(I jj = Bp[i]; jj < Bp[i+1]; jj++){
+            I j = Bj[jj];
+
+            for(I n = 0; n < RC; n++)
+                B_row[RC*j + n] += Bx[RC*jj + n];
+
+            if(next[j] == -1){
+                next[j] = head;                       
+                head = j;
+                length++;
+            }
+        }
+
+
+        for(I jj = 0; jj < length; jj++){
+            // compute op(block_A, block_B)
+            for(I n = 0; n < RC; n++)
+                Cx[RC * nnz + n] = op(A_row[RC*head + n], B_row[RC*head + n]);
+
+            // advance counter if block is nonzero
+            if( is_nonzero_block(Cx + (RC * nnz), RC) )
+                Cj[nnz++] = head;
+
+            // clear block_A and block_B values
+            for(I n = 0; n < RC; n++){
+                A_row[RC*head + n] = 0;
+                B_row[RC*head + n] = 0;
+            }
+
+            I temp = head;               
+            head = next[head];
+            next[temp] = -1;
+        }
+        
+        Cp[i + 1] = nnz;
     }
+}
 
+
+/*
+ * Compute C = A (binary_op) B for BSR matrices that are in the 
+ * canonical BSR format.  Specifically, this method requires that
+ * the rows of the input matrices are free of duplicate column indices
+ * and that the column indices are in sorted order.
+ *
+ * Refer to bsr_binop_bsr() for additional information
+ *
+ * Note: 
+ *   Input:  A and B column indices are assumed to be in sorted order 
+ *   Output: C column indices will be in sorted order
+ *           Cx will not contain any zero entries
+ *
+ */
+template <class I, class T, class bin_op>
+void bsr_binop_bsr_canonical(const I n_brow, const I n_bcol, 
+                             const I R,      const I C, 
+                             const I Ap[],  const I Aj[],  const T Ax[],
+                             const I Bp[],  const I Bj[],  const T Bx[],
+                                   I Cp[],        I Cj[],        T Cx[],
+                             const bin_op& op)
+{
     const I RC = R*C;
     T * result = Cx;
 
@@ -364,7 +466,7 @@
 
             if(A_j == B_j){
                 for(I n = 0; n < RC; n++){
-                    result[n] = op(Ax[RC*A_pos + n],Bx[RC*B_pos + n]);
+                    result[n] = op(Ax[RC*A_pos + n], Bx[RC*B_pos + n]);
                 }
 
                 if( is_nonzero_block(result,RC) ){
@@ -377,7 +479,7 @@
                 B_pos++;
             } else if (A_j < B_j) {
                 for(I n = 0; n < RC; n++){
-                    result[n] = op(Ax[RC*A_pos + n],0);
+                    result[n] = op(Ax[RC*A_pos + n], 0);
                 }
 
                 if(is_nonzero_block(result,RC)){
@@ -390,7 +492,7 @@
             } else {
                 //B_j < A_j
                 for(I n = 0; n < RC; n++){
-                    result[n] = op(0,Bx[RC*B_pos + n]);
+                    result[n] = op(0, Bx[RC*B_pos + n]);
                 }
                 if(is_nonzero_block(result,RC)){
                     Cj[nnz] = B_j;
@@ -405,10 +507,10 @@
         //tail
         while(A_pos < A_end){
             for(I n = 0; n < RC; n++){
-                result[n] = op(Ax[RC*A_pos + n],0);
+                result[n] = op(Ax[RC*A_pos + n], 0);
             }
 
-            if(is_nonzero_block(result,RC)){
+            if(is_nonzero_block(result, RC)){
                 Cj[nnz] = Aj[A_pos];
                 result += RC;
                 nnz++;
@@ -421,7 +523,7 @@
                 result[n] = op(0,Bx[RC*B_pos + n]);
             }
 
-            if(is_nonzero_block(result,RC)){
+            if(is_nonzero_block(result, RC)){
                 Cj[nnz] = Bj[B_pos];
                 result += RC;
                 nnz++;
@@ -434,6 +536,62 @@
     }
 }
 
+
+/*
+ * Compute C = A (binary_op) B for CSR matrices A,B where the column 
+ * indices with the rows of A and B are known to be sorted.
+ *
+ *   binary_op(x,y) - binary operator to apply elementwise
+ *
+ * Input Arguments:
+ *   I    n_row       - number of rows in A (and B)
+ *   I    n_col       - number of columns in A (and B)
+ *   I    Ap[n_row+1] - row pointer
+ *   I    Aj[nnz(A)]  - column indices
+ *   T    Ax[nnz(A)]  - nonzeros
+ *   I    Bp[n_row+1] - row pointer
+ *   I    Bj[nnz(B)]  - column indices
+ *   T    Bx[nnz(B)]  - nonzeros
+ * Output Arguments:
+ *   I    Cp[n_row+1] - row pointer
+ *   I    Cj[nnz(C)]  - column indices
+ *   T    Cx[nnz(C)]  - nonzeros
+ *   
+ * Note:
+ *   Output arrays Cp, Cj, and Cx must be preallocated
+ *   If nnz(C) is not known a priori, a conservative bound is:
+ *          nnz(C) <= nnz(A) + nnz(B)
+ *
+ * Note: 
+ *   Input:  A and B column indices are not assumed to be in sorted order.
+ *   Output: C column indices will be in sorted if both A and B have sorted indices.
+ *           Cx will not contain any zero entries
+ *
+ */
+template <class I, class T, class bin_op>
+void bsr_binop_bsr(const I n_brow, const I n_bcol, 
+                   const I R,     const I C, 
+                   const I Ap[],  const I Aj[],  const T Ax[],
+                   const I Bp[],  const I Bj[],  const T Bx[],
+                         I Cp[],        I Cj[],        T Cx[],
+                   const bin_op& op)
+{
+    assert( R > 0 && C > 0);
+    
+    if( R == 1 && C == 1 ){
+        //use CSR for 1x1 blocksize
+        csr_binop_csr(n_brow, n_bcol, Ap, Aj, Ax, Bp, Bj, Bx, Cp, Cj, Cx, op);
+    }
+    else if ( csr_has_canonical_format(n_brow, Ap, Aj) && csr_has_canonical_format(n_brow, Bp, Bj) ){
+        // prefer faster implementation
+        bsr_binop_bsr_canonical(n_brow, n_bcol, R, C, Ap, Aj, Ax, Bp, Bj, Bx, Cp, Cj, Cx, op);
+    }
+    else {
+        // slower fallback method
+        bsr_binop_bsr_general(n_brow, n_bcol, R, C, Ap, Aj, Ax, Bp, Bj, Bx, Cp, Cj, Cx, op);
+    }
+}
+
 /* element-wise binary operations */
 template <class I, class T>
 void bsr_elmul_bsr(const I n_row, const I n_col, const I R, const I C, 
@@ -529,6 +687,8 @@
         }
     }
 }
+
+
 /*
  * Compute Y += A*X for BSR matrix A and dense block vectors X,Y
  *

Modified: trunk/scipy/sparse/sparsetools/bsr.py
===================================================================
--- trunk/scipy/sparse/sparsetools/bsr.py	2009-01-31 04:41:39 UTC (rev 5529)
+++ trunk/scipy/sparse/sparsetools/bsr.py	2009-02-01 03:57:01 UTC (rev 5530)
@@ -1,5 +1,5 @@
 # This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.34
+# Version 1.3.36
 #
 # Don't modify this file, modify the SWIG interface instead.
 # This file is compatible with both classic and new-style classes.
@@ -51,483 +51,484 @@
 
 
 def bsr_diagonal(*args):
+  """
+    bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        signed char Ax, signed char Yx)
+    bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        unsigned char Ax, unsigned char Yx)
+    bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        short Ax, short Yx)
+    bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        unsigned short Ax, unsigned short Yx)
+    bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        int Ax, int Yx)
+    bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        unsigned int Ax, unsigned int Yx)
+    bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        long long Ax, long long Yx)
+    bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        unsigned long long Ax, unsigned long long Yx)
+    bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        float Ax, float Yx)
+    bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        double Ax, double Yx)
+    bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        long double Ax, long double Yx)
+    bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        npy_cfloat_wrapper Ax, npy_cfloat_wrapper Yx)
+    bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        npy_cdouble_wrapper Ax, npy_cdouble_wrapper Yx)
+    bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        npy_clongdouble_wrapper Ax, npy_clongdouble_wrapper Yx)
     """
-      bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          signed char Ax, signed char Yx)
-      bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          unsigned char Ax, unsigned char Yx)
-      bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          short Ax, short Yx)
-      bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          unsigned short Ax, unsigned short Yx)
-      bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          int Ax, int Yx)
-      bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          unsigned int Ax, unsigned int Yx)
-      bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          long long Ax, long long Yx)
-      bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          unsigned long long Ax, unsigned long long Yx)
-      bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          float Ax, float Yx)
-      bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          double Ax, double Yx)
-      bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          long double Ax, long double Yx)
-      bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          npy_cfloat_wrapper Ax, npy_cfloat_wrapper Yx)
-      bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          npy_cdouble_wrapper Ax, npy_cdouble_wrapper Yx)
-      bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          npy_clongdouble_wrapper Ax, npy_clongdouble_wrapper Yx)
-      """
-    return _bsr.bsr_diagonal(*args)
+  return _bsr.bsr_diagonal(*args)
 
 def bsr_scale_rows(*args):
+  """
+    bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        signed char Ax, signed char Xx)
+    bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        unsigned char Ax, unsigned char Xx)
+    bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        short Ax, short Xx)
+    bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        unsigned short Ax, unsigned short Xx)
+    bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        int Ax, int Xx)
+    bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        unsigned int Ax, unsigned int Xx)
+    bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        long long Ax, long long Xx)
+    bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        unsigned long long Ax, unsigned long long Xx)
+    bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        float Ax, float Xx)
+    bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        double Ax, double Xx)
+    bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        long double Ax, long double Xx)
+    bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        npy_cfloat_wrapper Ax, npy_cfloat_wrapper Xx)
+    bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        npy_cdouble_wrapper Ax, npy_cdouble_wrapper Xx)
+    bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        npy_clongdouble_wrapper Ax, npy_clongdouble_wrapper Xx)
     """
-      bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          signed char Ax, signed char Xx)
-      bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          unsigned char Ax, unsigned char Xx)
-      bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          short Ax, short Xx)
-      bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          unsigned short Ax, unsigned short Xx)
-      bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          int Ax, int Xx)
-      bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          unsigned int Ax, unsigned int Xx)
-      bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          long long Ax, long long Xx)
-      bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          unsigned long long Ax, unsigned long long Xx)
-      bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          float Ax, float Xx)
-      bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          double Ax, double Xx)
-      bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          long double Ax, long double Xx)
-      bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          npy_cfloat_wrapper Ax, npy_cfloat_wrapper Xx)
-      bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          npy_cdouble_wrapper Ax, npy_cdouble_wrapper Xx)
-      bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          npy_clongdouble_wrapper Ax, npy_clongdouble_wrapper Xx)
-      """
-    return _bsr.bsr_scale_rows(*args)
+  return _bsr.bsr_scale_rows(*args)
 
 def bsr_scale_columns(*args):
+  """
+    bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        signed char Ax, signed char Xx)
+    bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        unsigned char Ax, unsigned char Xx)
+    bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        short Ax, short Xx)
+    bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        unsigned short Ax, unsigned short Xx)
+    bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        int Ax, int Xx)
+    bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        unsigned int Ax, unsigned int Xx)
+    bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        long long Ax, long long Xx)
+    bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        unsigned long long Ax, unsigned long long Xx)
+    bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        float Ax, float Xx)
+    bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        double Ax, double Xx)
+    bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        long double Ax, long double Xx)
+    bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        npy_cfloat_wrapper Ax, npy_cfloat_wrapper Xx)
+    bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        npy_cdouble_wrapper Ax, npy_cdouble_wrapper Xx)
+    bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        npy_clongdouble_wrapper Ax, npy_clongdouble_wrapper Xx)
     """
-      bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          signed char Ax, signed char Xx)
-      bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          unsigned char Ax, unsigned char Xx)
-      bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          short Ax, short Xx)
-      bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          unsigned short Ax, unsigned short Xx)
-      bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          int Ax, int Xx)
-      bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          unsigned int Ax, unsigned int Xx)
-      bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          long long Ax, long long Xx)
-      bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          unsigned long long Ax, unsigned long long Xx)
-      bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          float Ax, float Xx)
-      bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          double Ax, double Xx)
-      bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          long double Ax, long double Xx)
-      bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          npy_cfloat_wrapper Ax, npy_cfloat_wrapper Xx)
-      bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          npy_cdouble_wrapper Ax, npy_cdouble_wrapper Xx)
-      bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          npy_clongdouble_wrapper Ax, npy_clongdouble_wrapper Xx)
-      """
-    return _bsr.bsr_scale_columns(*args)
+  return _bsr.bsr_scale_columns(*args)
 
 def bsr_transpose(*args):
+  """
+    bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        signed char Ax, int Bp, int Bj, signed char Bx)
+    bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        unsigned char Ax, int Bp, int Bj, unsigned char Bx)
+    bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        short Ax, int Bp, int Bj, short Bx)
+    bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        unsigned short Ax, int Bp, int Bj, unsigned short Bx)
+    bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        int Ax, int Bp, int Bj, int Bx)
+    bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        unsigned int Ax, int Bp, int Bj, unsigned int Bx)
+    bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        long long Ax, int Bp, int Bj, long long Bx)
+    bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        unsigned long long Ax, int Bp, int Bj, unsigned long long Bx)
+    bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        float Ax, int Bp, int Bj, float Bx)
+    bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        double Ax, int Bp, int Bj, double Bx)
+    bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        long double Ax, int Bp, int Bj, long double Bx)
+    bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx)
+    bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx)
+    bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        npy_clongdouble_wrapper Ax, int Bp, int Bj, 
+        npy_clongdouble_wrapper Bx)
     """
-      bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          signed char Ax, int Bp, int Bj, signed char Bx)
-      bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          unsigned char Ax, int Bp, int Bj, unsigned char Bx)
-      bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          short Ax, int Bp, int Bj, short Bx)
-      bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          unsigned short Ax, int Bp, int Bj, unsigned short Bx)
-      bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          int Ax, int Bp, int Bj, int Bx)
-      bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          unsigned int Ax, int Bp, int Bj, unsigned int Bx)
-      bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          long long Ax, int Bp, int Bj, long long Bx)
-      bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          unsigned long long Ax, int Bp, int Bj, unsigned long long Bx)
-      bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          float Ax, int Bp, int Bj, float Bx)
-      bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          double Ax, int Bp, int Bj, double Bx)
-      bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          long double Ax, int Bp, int Bj, long double Bx)
-      bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx)
-      bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx)
-      bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          npy_clongdouble_wrapper Ax, int Bp, int Bj,
-          npy_clongdouble_wrapper Bx)
-      """
-    return _bsr.bsr_transpose(*args)
+  return _bsr.bsr_transpose(*args)
 
 def bsr_matmat_pass2(*args):
+  """
+    bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, 
+        int Aj, signed char Ax, int Bp, int Bj, signed char Bx, 
+        int Cp, int Cj, signed char Cx)
+    bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, 
+        int Aj, unsigned char Ax, int Bp, int Bj, unsigned char Bx, 
+        int Cp, int Cj, unsigned char Cx)
+    bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, 
+        int Aj, short Ax, int Bp, int Bj, short Bx, 
+        int Cp, int Cj, short Cx)
+    bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, 
+        int Aj, unsigned short Ax, int Bp, int Bj, 
+        unsigned short Bx, int Cp, int Cj, unsigned short Cx)
+    bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, 
+        int Aj, int Ax, int Bp, int Bj, int Bx, int Cp, 
+        int Cj, int Cx)
+    bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, 
+        int Aj, unsigned int Ax, int Bp, int Bj, unsigned int Bx, 
+        int Cp, int Cj, unsigned int Cx)
+    bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, 
+        int Aj, long long Ax, int Bp, int Bj, long long Bx, 
+        int Cp, int Cj, long long Cx)
+    bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, 
+        int Aj, unsigned long long Ax, int Bp, int Bj, 
+        unsigned long long Bx, int Cp, int Cj, unsigned long long Cx)
+    bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, 
+        int Aj, float Ax, int Bp, int Bj, float Bx, 
+        int Cp, int Cj, float Cx)
+    bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, 
+        int Aj, double Ax, int Bp, int Bj, double Bx, 
+        int Cp, int Cj, double Cx)
+    bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, 
+        int Aj, long double Ax, int Bp, int Bj, long double Bx, 
+        int Cp, int Cj, long double Cx)
+    bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, 
+        int Aj, npy_cfloat_wrapper Ax, int Bp, int Bj, 
+        npy_cfloat_wrapper Bx, int Cp, int Cj, npy_cfloat_wrapper Cx)
+    bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, 
+        int Aj, npy_cdouble_wrapper Ax, int Bp, int Bj, 
+        npy_cdouble_wrapper Bx, int Cp, int Cj, 
+        npy_cdouble_wrapper Cx)
+    bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, 
+        int Aj, npy_clongdouble_wrapper Ax, int Bp, 
+        int Bj, npy_clongdouble_wrapper Bx, int Cp, 
+        int Cj, npy_clongdouble_wrapper Cx)
     """
-      bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap,
-          int Aj, signed char Ax, int Bp, int Bj, signed char Bx,
-          int Cp, int Cj, signed char Cx)
-      bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap,
-          int Aj, unsigned char Ax, int Bp, int Bj, unsigned char Bx,
-          int Cp, int Cj, unsigned char Cx)
-      bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap,
-          int Aj, short Ax, int Bp, int Bj, short Bx,
-          int Cp, int Cj, short Cx)
-      bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap,
-          int Aj, unsigned short Ax, int Bp, int Bj,
-          unsigned short Bx, int Cp, int Cj, unsigned short Cx)
-      bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap,
-          int Aj, int Ax, int Bp, int Bj, int Bx, int Cp,
-          int Cj, int Cx)
-      bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap,
-          int Aj, unsigned int Ax, int Bp, int Bj, unsigned int Bx,
-          int Cp, int Cj, unsigned int Cx)
-      bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap,
-          int Aj, long long Ax, int Bp, int Bj, long long Bx,
-          int Cp, int Cj, long long Cx)
-      bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap,
-          int Aj, unsigned long long Ax, int Bp, int Bj,
-          unsigned long long Bx, int Cp, int Cj, unsigned long long Cx)
-      bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap,
-          int Aj, float Ax, int Bp, int Bj, float Bx,
-          int Cp, int Cj, float Cx)
-      bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap,
-          int Aj, double Ax, int Bp, int Bj, double Bx,
-          int Cp, int Cj, double Cx)
-      bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap,
-          int Aj, long double Ax, int Bp, int Bj, long double Bx,
-          int Cp, int Cj, long double Cx)
-      bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap,
-          int Aj, npy_cfloat_wrapper Ax, int Bp, int Bj,
-          npy_cfloat_wrapper Bx, int Cp, int Cj, npy_cfloat_wrapper Cx)
-      bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap,
-          int Aj, npy_cdouble_wrapper Ax, int Bp, int Bj,
-          npy_cdouble_wrapper Bx, int Cp, int Cj,
-          npy_cdouble_wrapper Cx)
-      bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap,
-          int Aj, npy_clongdouble_wrapper Ax, int Bp,
-          int Bj, npy_clongdouble_wrapper Bx, int Cp,
-          int Cj, npy_clongdouble_wrapper Cx)
-      """
-    return _bsr.bsr_matmat_pass2(*args)
+  return _bsr.bsr_matmat_pass2(*args)
 
 def bsr_matvec(*args):
+  """
+    bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        signed char Ax, signed char Xx, signed char Yx)
+    bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        unsigned char Ax, unsigned char Xx, unsigned char Yx)
+    bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        short Ax, short Xx, short Yx)
+    bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        unsigned short Ax, unsigned short Xx, unsigned short Yx)
+    bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        int Ax, int Xx, int Yx)
+    bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        unsigned int Ax, unsigned int Xx, unsigned int Yx)
+    bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        long long Ax, long long Xx, long long Yx)
+    bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        unsigned long long Ax, unsigned long long Xx, 
+        unsigned long long Yx)
+    bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        float Ax, float Xx, float Yx)
+    bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        double Ax, double Xx, double Yx)
+    bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        long double Ax, long double Xx, long double Yx)
+    bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        npy_cfloat_wrapper Ax, npy_cfloat_wrapper Xx, 
+        npy_cfloat_wrapper Yx)
+    bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        npy_cdouble_wrapper Ax, npy_cdouble_wrapper Xx, 
+        npy_cdouble_wrapper Yx)
+    bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        npy_clongdouble_wrapper Ax, npy_clongdouble_wrapper Xx, 
+        npy_clongdouble_wrapper Yx)
     """
-      bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          signed char Ax, signed char Xx, signed char Yx)
-      bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          unsigned char Ax, unsigned char Xx, unsigned char Yx)
-      bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          short Ax, short Xx, short Yx)
-      bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          unsigned short Ax, unsigned short Xx, unsigned short Yx)
-      bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          int Ax, int Xx, int Yx)
-      bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          unsigned int Ax, unsigned int Xx, unsigned int Yx)
-      bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          long long Ax, long long Xx, long long Yx)
-      bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          unsigned long long Ax, unsigned long long Xx,
-          unsigned long long Yx)
-      bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          float Ax, float Xx, float Yx)
-      bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          double Ax, double Xx, double Yx)
-      bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          long double Ax, long double Xx, long double Yx)
-      bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          npy_cfloat_wrapper Ax, npy_cfloat_wrapper Xx,
-          npy_cfloat_wrapper Yx)
-      bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          npy_cdouble_wrapper Ax, npy_cdouble_wrapper Xx,
-          npy_cdouble_wrapper Yx)
-      bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          npy_clongdouble_wrapper Ax, npy_clongdouble_wrapper Xx,
-          npy_clongdouble_wrapper Yx)
-      """
-    return _bsr.bsr_matvec(*args)
+  return _bsr.bsr_matvec(*args)
 
 def bsr_matvecs(*args):
+  """
+    bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, 
+        int Aj, signed char Ax, signed char Xx, 
+        signed char Yx)
+    bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, 
+        int Aj, unsigned char Ax, unsigned char Xx, 
+        unsigned char Yx)
+    bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, 
+        int Aj, short Ax, short Xx, short Yx)
+    bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, 
+        int Aj, unsigned short Ax, unsigned short Xx, 
+        unsigned short Yx)
+    bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, 
+        int Aj, int Ax, int Xx, int Yx)
+    bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, 
+        int Aj, unsigned int Ax, unsigned int Xx, 
+        unsigned int Yx)
+    bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, 
+        int Aj, long long Ax, long long Xx, long long Yx)
+    bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, 
+        int Aj, unsigned long long Ax, unsigned long long Xx, 
+        unsigned long long Yx)
+    bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, 
+        int Aj, float Ax, float Xx, float Yx)
+    bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, 
+        int Aj, double Ax, double Xx, double Yx)
+    bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, 
+        int Aj, long double Ax, long double Xx, 
+        long double Yx)
+    bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, 
+        int Aj, npy_cfloat_wrapper Ax, npy_cfloat_wrapper Xx, 
+        npy_cfloat_wrapper Yx)
+    bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, 
+        int Aj, npy_cdouble_wrapper Ax, npy_cdouble_wrapper Xx, 
+        npy_cdouble_wrapper Yx)
+    bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, 
+        int Aj, npy_clongdouble_wrapper Ax, npy_clongdouble_wrapper Xx, 
+        npy_clongdouble_wrapper Yx)
     """
-      bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap,
-          int Aj, signed char Ax, signed char Xx,
-          signed char Yx)
-      bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap,
-          int Aj, unsigned char Ax, unsigned char Xx,
-          unsigned char Yx)
-      bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap,
-          int Aj, short Ax, short Xx, short Yx)
-      bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap,
-          int Aj, unsigned short Ax, unsigned short Xx,
-          unsigned short Yx)
-      bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap,
-          int Aj, int Ax, int Xx, int Yx)
-      bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap,
-          int Aj, unsigned int Ax, unsigned int Xx,
-          unsigned int Yx)
-      bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap,
-          int Aj, long long Ax, long long Xx, long long Yx)
-      bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap,
-          int Aj, unsigned long long Ax, unsigned long long Xx,
-          unsigned long long Yx)
-      bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap,
-          int Aj, float Ax, float Xx, float Yx)
-      bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap,
-          int Aj, double Ax, double Xx, double Yx)
-      bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap,
-          int Aj, long double Ax, long double Xx,
-          long double Yx)
-      bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap,
-          int Aj, npy_cfloat_wrapper Ax, npy_cfloat_wrapper Xx,
-          npy_cfloat_wrapper Yx)
-      bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap,
-          int Aj, npy_cdouble_wrapper Ax, npy_cdouble_wrapper Xx,
-          npy_cdouble_wrapper Yx)
-      bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap,
-          int Aj, npy_clongdouble_wrapper Ax, npy_clongdouble_wrapper Xx,
-          npy_clongdouble_wrapper Yx)
-      """
-    return _bsr.bsr_matvecs(*args)
+  return _bsr.bsr_matvecs(*args)
 
 def bsr_elmul_bsr(*args):
+  """
+    bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        signed char Ax, int Bp, int Bj, signed char Bx, 
+        int Cp, int Cj, signed char Cx)
+    bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        unsigned char Ax, int Bp, int Bj, unsigned char Bx, 
+        int Cp, int Cj, unsigned char Cx)
+    bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        short Ax, int Bp, int Bj, short Bx, int Cp, 
+        int Cj, short Cx)
+    bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        unsigned short Ax, int Bp, int Bj, unsigned short Bx, 
+        int Cp, int Cj, unsigned short Cx)
+    bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        int Ax, int Bp, int Bj, int Bx, int Cp, int Cj, 
+        int Cx)
+    bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        unsigned int Ax, int Bp, int Bj, unsigned int Bx, 
+        int Cp, int Cj, unsigned int Cx)
+    bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        long long Ax, int Bp, int Bj, long long Bx, 
+        int Cp, int Cj, long long Cx)
+    bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        unsigned long long Ax, int Bp, int Bj, unsigned long long Bx, 
+        int Cp, int Cj, unsigned long long Cx)
+    bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        float Ax, int Bp, int Bj, float Bx, int Cp, 
+        int Cj, float Cx)
+    bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        double Ax, int Bp, int Bj, double Bx, int Cp, 
+        int Cj, double Cx)
+    bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        long double Ax, int Bp, int Bj, long double Bx, 
+        int Cp, int Cj, long double Cx)
+    bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, 
+        int Cp, int Cj, npy_cfloat_wrapper Cx)
+    bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, 
+        int Cp, int Cj, npy_cdouble_wrapper Cx)
+    bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        npy_clongdouble_wrapper Ax, int Bp, int Bj, 
+        npy_clongdouble_wrapper Bx, int Cp, int Cj, npy_clongdouble_wrapper Cx)
     """
-      bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          signed char Ax, int Bp, int Bj, signed char Bx,
-          int Cp, int Cj, signed char Cx)
-      bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          unsigned char Ax, int Bp, int Bj, unsigned char Bx,
-          int Cp, int Cj, unsigned char Cx)
-      bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          short Ax, int Bp, int Bj, short Bx, int Cp,
-          int Cj, short Cx)
-      bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          unsigned short Ax, int Bp, int Bj, unsigned short Bx,
-          int Cp, int Cj, unsigned short Cx)
-      bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          int Ax, int Bp, int Bj, int Bx, int Cp, int Cj,
-          int Cx)
-      bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          unsigned int Ax, int Bp, int Bj, unsigned int Bx,
-          int Cp, int Cj, unsigned int Cx)
-      bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          long long Ax, int Bp, int Bj, long long Bx,
-          int Cp, int Cj, long long Cx)
-      bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          unsigned long long Ax, int Bp, int Bj, unsigned long long Bx,
-          int Cp, int Cj, unsigned long long Cx)
-      bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          float Ax, int Bp, int Bj, float Bx, int Cp,
-          int Cj, float Cx)
-      bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          double Ax, int Bp, int Bj, double Bx, int Cp,
-          int Cj, double Cx)
-      bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          long double Ax, int Bp, int Bj, long double Bx,
-          int Cp, int Cj, long double Cx)
-      bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx,
-          int Cp, int Cj, npy_cfloat_wrapper Cx)
-      bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx,
-          int Cp, int Cj, npy_cdouble_wrapper Cx)
-      bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          npy_clongdouble_wrapper Ax, int Bp, int Bj,
-          npy_clongdouble_wrapper Bx, int Cp, int Cj, npy_clongdouble_wrapper Cx)
-      """
-    return _bsr.bsr_elmul_bsr(*args)
+  return _bsr.bsr_elmul_bsr(*args)
 
 def bsr_eldiv_bsr(*args):
+  """
+    bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        signed char Ax, int Bp, int Bj, signed char Bx, 
+        int Cp, int Cj, signed char Cx)
+    bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        unsigned char Ax, int Bp, int Bj, unsigned char Bx, 
+        int Cp, int Cj, unsigned char Cx)
+    bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        short Ax, int Bp, int Bj, short Bx, int Cp, 
+        int Cj, short Cx)
+    bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        unsigned short Ax, int Bp, int Bj, unsigned short Bx, 
+        int Cp, int Cj, unsigned short Cx)
+    bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        int Ax, int Bp, int Bj, int Bx, int Cp, int Cj, 
+        int Cx)
+    bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        unsigned int Ax, int Bp, int Bj, unsigned int Bx, 
+        int Cp, int Cj, unsigned int Cx)
+    bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        long long Ax, int Bp, int Bj, long long Bx, 
+        int Cp, int Cj, long long Cx)
+    bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        unsigned long long Ax, int Bp, int Bj, unsigned long long Bx, 
+        int Cp, int Cj, unsigned long long Cx)
+    bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        float Ax, int Bp, int Bj, float Bx, int Cp, 
+        int Cj, float Cx)
+    bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        double Ax, int Bp, int Bj, double Bx, int Cp, 
+        int Cj, double Cx)
+    bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        long double Ax, int Bp, int Bj, long double Bx, 
+        int Cp, int Cj, long double Cx)
+    bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, 
+        int Cp, int Cj, npy_cfloat_wrapper Cx)
+    bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, 
+        int Cp, int Cj, npy_cdouble_wrapper Cx)
+    bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        npy_clongdouble_wrapper Ax, int Bp, int Bj, 
+        npy_clongdouble_wrapper Bx, int Cp, int Cj, npy_clongdouble_wrapper Cx)
     """
-      bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          signed char Ax, int Bp, int Bj, signed char Bx,
-          int Cp, int Cj, signed char Cx)
-      bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          unsigned char Ax, int Bp, int Bj, unsigned char Bx,
-          int Cp, int Cj, unsigned char Cx)
-      bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          short Ax, int Bp, int Bj, short Bx, int Cp,
-          int Cj, short Cx)
-      bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          unsigned short Ax, int Bp, int Bj, unsigned short Bx,
-          int Cp, int Cj, unsigned short Cx)
-      bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          int Ax, int Bp, int Bj, int Bx, int Cp, int Cj,
-          int Cx)
-      bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          unsigned int Ax, int Bp, int Bj, unsigned int Bx,
-          int Cp, int Cj, unsigned int Cx)
-      bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          long long Ax, int Bp, int Bj, long long Bx,
-          int Cp, int Cj, long long Cx)
-      bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          unsigned long long Ax, int Bp, int Bj, unsigned long long Bx,
-          int Cp, int Cj, unsigned long long Cx)
-      bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          float Ax, int Bp, int Bj, float Bx, int Cp,
-          int Cj, float Cx)
-      bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          double Ax, int Bp, int Bj, double Bx, int Cp,
-          int Cj, double Cx)
-      bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          long double Ax, int Bp, int Bj, long double Bx,
-          int Cp, int Cj, long double Cx)
-      bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx,
-          int Cp, int Cj, npy_cfloat_wrapper Cx)
-      bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx,
-          int Cp, int Cj, npy_cdouble_wrapper Cx)
-      bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          npy_clongdouble_wrapper Ax, int Bp, int Bj,
-          npy_clongdouble_wrapper Bx, int Cp, int Cj, npy_clongdouble_wrapper Cx)
-      """
-    return _bsr.bsr_eldiv_bsr(*args)
+  return _bsr.bsr_eldiv_bsr(*args)
 
 def bsr_plus_bsr(*args):
+  """
+    bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        signed char Ax, int Bp, int Bj, signed char Bx, 
+        int Cp, int Cj, signed char Cx)
+    bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        unsigned char Ax, int Bp, int Bj, unsigned char Bx, 
+        int Cp, int Cj, unsigned char Cx)
+    bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        short Ax, int Bp, int Bj, short Bx, int Cp, 
+        int Cj, short Cx)
+    bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        unsigned short Ax, int Bp, int Bj, unsigned short Bx, 
+        int Cp, int Cj, unsigned short Cx)
+    bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        int Ax, int Bp, int Bj, int Bx, int Cp, int Cj, 
+        int Cx)
+    bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        unsigned int Ax, int Bp, int Bj, unsigned int Bx, 
+        int Cp, int Cj, unsigned int Cx)
+    bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        long long Ax, int Bp, int Bj, long long Bx, 
+        int Cp, int Cj, long long Cx)
+    bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        unsigned long long Ax, int Bp, int Bj, unsigned long long Bx, 
+        int Cp, int Cj, unsigned long long Cx)
+    bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        float Ax, int Bp, int Bj, float Bx, int Cp, 
+        int Cj, float Cx)
+    bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        double Ax, int Bp, int Bj, double Bx, int Cp, 
+        int Cj, double Cx)
+    bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        long double Ax, int Bp, int Bj, long double Bx, 
+        int Cp, int Cj, long double Cx)
+    bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, 
+        int Cp, int Cj, npy_cfloat_wrapper Cx)
+    bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, 
+        int Cp, int Cj, npy_cdouble_wrapper Cx)
+    bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        npy_clongdouble_wrapper Ax, int Bp, int Bj, 
+        npy_clongdouble_wrapper Bx, int Cp, int Cj, npy_clongdouble_wrapper Cx)
     """
-      bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          signed char Ax, int Bp, int Bj, signed char Bx,
-          int Cp, int Cj, signed char Cx)
-      bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          unsigned char Ax, int Bp, int Bj, unsigned char Bx,
-          int Cp, int Cj, unsigned char Cx)
-      bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          short Ax, int Bp, int Bj, short Bx, int Cp,
-          int Cj, short Cx)
-      bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          unsigned short Ax, int Bp, int Bj, unsigned short Bx,
-          int Cp, int Cj, unsigned short Cx)
-      bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          int Ax, int Bp, int Bj, int Bx, int Cp, int Cj,
-          int Cx)
-      bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          unsigned int Ax, int Bp, int Bj, unsigned int Bx,
-          int Cp, int Cj, unsigned int Cx)
-      bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          long long Ax, int Bp, int Bj, long long Bx,
-          int Cp, int Cj, long long Cx)
-      bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          unsigned long long Ax, int Bp, int Bj, unsigned long long Bx,
-          int Cp, int Cj, unsigned long long Cx)
-      bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          float Ax, int Bp, int Bj, float Bx, int Cp,
-          int Cj, float Cx)
-      bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          double Ax, int Bp, int Bj, double Bx, int Cp,
-          int Cj, double Cx)
-      bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          long double Ax, int Bp, int Bj, long double Bx,
-          int Cp, int Cj, long double Cx)
-      bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx,
-          int Cp, int Cj, npy_cfloat_wrapper Cx)
-      bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx,
-          int Cp, int Cj, npy_cdouble_wrapper Cx)
-      bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          npy_clongdouble_wrapper Ax, int Bp, int Bj,
-          npy_clongdouble_wrapper Bx, int Cp, int Cj, npy_clongdouble_wrapper Cx)
-      """
-    return _bsr.bsr_plus_bsr(*args)
+  return _bsr.bsr_plus_bsr(*args)
 
 def bsr_minus_bsr(*args):
+  """
+    bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        signed char Ax, int Bp, int Bj, signed char Bx, 
+        int Cp, int Cj, signed char Cx)
+    bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        unsigned char Ax, int Bp, int Bj, unsigned char Bx, 
+        int Cp, int Cj, unsigned char Cx)
+    bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        short Ax, int Bp, int Bj, short Bx, int Cp, 
+        int Cj, short Cx)
+    bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        unsigned short Ax, int Bp, int Bj, unsigned short Bx, 
+        int Cp, int Cj, unsigned short Cx)
+    bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        int Ax, int Bp, int Bj, int Bx, int Cp, int Cj, 
+        int Cx)
+    bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        unsigned int Ax, int Bp, int Bj, unsigned int Bx, 
+        int Cp, int Cj, unsigned int Cx)
+    bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        long long Ax, int Bp, int Bj, long long Bx, 
+        int Cp, int Cj, long long Cx)
+    bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        unsigned long long Ax, int Bp, int Bj, unsigned long long Bx, 
+        int Cp, int Cj, unsigned long long Cx)
+    bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        float Ax, int Bp, int Bj, float Bx, int Cp, 
+        int Cj, float Cx)
+    bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        double Ax, int Bp, int Bj, double Bx, int Cp, 
+        int Cj, double Cx)
+    bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        long double Ax, int Bp, int Bj, long double Bx, 
+        int Cp, int Cj, long double Cx)
+    bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, 
+        int Cp, int Cj, npy_cfloat_wrapper Cx)
+    bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, 
+        int Cp, int Cj, npy_cdouble_wrapper Cx)
+    bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, 
+        npy_clongdouble_wrapper Ax, int Bp, int Bj, 
+        npy_clongdouble_wrapper Bx, int Cp, int Cj, npy_clongdouble_wrapper Cx)
     """
-      bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          signed char Ax, int Bp, int Bj, signed char Bx,
-          int Cp, int Cj, signed char Cx)
-      bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          unsigned char Ax, int Bp, int Bj, unsigned char Bx,
-          int Cp, int Cj, unsigned char Cx)
-      bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          short Ax, int Bp, int Bj, short Bx, int Cp,
-          int Cj, short Cx)
-      bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          unsigned short Ax, int Bp, int Bj, unsigned short Bx,
-          int Cp, int Cj, unsigned short Cx)
-      bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          int Ax, int Bp, int Bj, int Bx, int Cp, int Cj,
-          int Cx)
-      bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          unsigned int Ax, int Bp, int Bj, unsigned int Bx,
-          int Cp, int Cj, unsigned int Cx)
-      bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          long long Ax, int Bp, int Bj, long long Bx,
-          int Cp, int Cj, long long Cx)
-      bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          unsigned long long Ax, int Bp, int Bj, unsigned long long Bx,
-          int Cp, int Cj, unsigned long long Cx)
-      bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          float Ax, int Bp, int Bj, float Bx, int Cp,
-          int Cj, float Cx)
-      bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          double Ax, int Bp, int Bj, double Bx, int Cp,
-          int Cj, double Cx)
-      bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          long double Ax, int Bp, int Bj, long double Bx,
-          int Cp, int Cj, long double Cx)
-      bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx,
-          int Cp, int Cj, npy_cfloat_wrapper Cx)
-      bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx,
-          int Cp, int Cj, npy_cdouble_wrapper Cx)
-      bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj,
-          npy_clongdouble_wrapper Ax, int Bp, int Bj,
-          npy_clongdouble_wrapper Bx, int Cp, int Cj, npy_clongdouble_wrapper Cx)
-      """
-    return _bsr.bsr_minus_bsr(*args)
+  return _bsr.bsr_minus_bsr(*args)
 
 def bsr_sort_indices(*args):
+  """
+    bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        signed char Ax)
+    bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        unsigned char Ax)
+    bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        short Ax)
+    bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        unsigned short Ax)
+    bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        int Ax)
+    bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        unsigned int Ax)
+    bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        long long Ax)
+    bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        unsigned long long Ax)
+    bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        float Ax)
+    bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        double Ax)
+    bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        long double Ax)
+    bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        npy_cfloat_wrapper Ax)
+    bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        npy_cdouble_wrapper Ax)
+    bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, 
+        npy_clongdouble_wrapper Ax)
     """
-      bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          signed char Ax)
-      bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          unsigned char Ax)
-      bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          short Ax)
-      bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          unsigned short Ax)
-      bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          int Ax)
-      bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          unsigned int Ax)
-      bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          long long Ax)
-      bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          unsigned long long Ax)
-      bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          float Ax)
-      bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          double Ax)
-      bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          long double Ax)
-      bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          npy_cfloat_wrapper Ax)
-      bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          npy_cdouble_wrapper Ax)
-      bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj,
-          npy_clongdouble_wrapper Ax)
-      """
-    return _bsr.bsr_sort_indices(*args)
+  return _bsr.bsr_sort_indices(*args)
+

Modified: trunk/scipy/sparse/sparsetools/bsr_wrap.cxx
===================================================================
--- trunk/scipy/sparse/sparsetools/bsr_wrap.cxx	2009-01-31 04:41:39 UTC (rev 5529)
+++ trunk/scipy/sparse/sparsetools/bsr_wrap.cxx	2009-02-01 03:57:01 UTC (rev 5530)
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.34
+ * Version 1.3.36
  * 
  * This file is not intended to be easily readable and contains a number of 
  * coding conventions designed to improve portability and efficiency. Do not make
@@ -73,6 +73,12 @@
 # endif
 #endif
 
+#ifndef SWIG_MSC_UNSUPPRESS_4505
+# if defined(_MSC_VER)
+#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
+# endif 
+#endif
+
 #ifndef SWIGUNUSEDPARM
 # ifdef __cplusplus
 #   define SWIGUNUSEDPARM(p)
@@ -2516,7 +2522,7 @@
 
 #define SWIG_name    "_bsr"
 
-#define SWIGVERSION 0x010334 
+#define SWIGVERSION 0x010336 
 #define SWIG_VERSION SWIGVERSION
 
 
@@ -2544,7 +2550,9 @@
     
     PyObject_ptr(PyObject *obj, bool initial_ref = true) :_obj(obj)
     {
-      if (initial_ref) Py_XINCREF(_obj);
+      if (initial_ref) {
+        Py_XINCREF(_obj);
+      }
     }
     
     PyObject_ptr & operator=(const PyObject_ptr& item) 

Modified: trunk/scipy/sparse/sparsetools/coo.py
===================================================================
--- trunk/scipy/sparse/sparsetools/coo.py	2009-01-31 04:41:39 UTC (rev 5529)
+++ trunk/scipy/sparse/sparsetools/coo.py	2009-02-01 03:57:01 UTC (rev 5530)
@@ -50,134 +50,135 @@
 
 
 def coo_count_diagonals(*args):
-    """coo_count_diagonals(int nnz, int Ai, int Aj) -> int"""
-    return _coo.coo_count_diagonals(*args)
+  """coo_count_diagonals(int nnz, int Ai, int Aj) -> int"""
+  return _coo.coo_count_diagonals(*args)
 
 
 def coo_tocsr(*args):
+  """
+    coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, signed char Ax, 
+        int Bp, int Bj, signed char Bx)
+    coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned char Ax, 
+        int Bp, int Bj, unsigned char Bx)
+    coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, short Ax, 
+        int Bp, int Bj, short Bx)
+    coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned short Ax, 
+        int Bp, int Bj, unsigned short Bx)
+    coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, int Ax, 
+        int Bp, int Bj, int Bx)
+    coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned int Ax, 
+        int Bp, int Bj, unsigned int Bx)
+    coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, long long Ax, 
+        int Bp, int Bj, long long Bx)
+    coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned long long Ax, 
+        int Bp, int Bj, unsigned long long Bx)
+    coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, float Ax, 
+        int Bp, int Bj, float Bx)
+    coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, double Ax, 
+        int Bp, int Bj, double Bx)
+    coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, long double Ax, 
+        int Bp, int Bj, long double Bx)
+    coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cfloat_wrapper Ax, 
+        int Bp, int Bj, npy_cfloat_wrapper Bx)
+    coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cdouble_wrapper Ax, 
+        int Bp, int Bj, npy_cdouble_wrapper Bx)
+    coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, npy_clongdouble_wrapper Ax, 
+        int Bp, int Bj, npy_clongdouble_wrapper Bx)
     """
-      coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, signed char Ax,
-          int Bp, int Bj, signed char Bx)
-      coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned char Ax,
-          int Bp, int Bj, unsigned char Bx)
-      coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, short Ax,
-          int Bp, int Bj, short Bx)
-      coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned short Ax,
-          int Bp, int Bj, unsigned short Bx)
-      coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, int Ax,
-          int Bp, int Bj, int Bx)
-      coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned int Ax,
-          int Bp, int Bj, unsigned int Bx)
-      coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, long long Ax,
-          int Bp, int Bj, long long Bx)
-      coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned long long Ax,
-          int Bp, int Bj, unsigned long long Bx)
-      coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, float Ax,
-          int Bp, int Bj, float Bx)
-      coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, double Ax,
-          int Bp, int Bj, double Bx)
-      coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, long double Ax,
-          int Bp, int Bj, long double Bx)
-      coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cfloat_wrapper Ax,
-          int Bp, int Bj, npy_cfloat_wrapper Bx)
-      coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cdouble_wrapper Ax,
-          int Bp, int Bj, npy_cdouble_wrapper Bx)
-      coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, npy_clongdouble_wrapper Ax,
-          int Bp, int Bj, npy_clongdouble_wrapper Bx)
-      """
-    return _coo.coo_tocsr(*args)
+  return _coo.coo_tocsr(*args)
 
 def coo_tocsc(*args):
+  """
+    coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, signed char Ax, 
+        int Bp, int Bi, signed char Bx)
+    coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned char Ax, 
+        int Bp, int Bi, unsigned char Bx)
+    coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, short Ax, 
+        int Bp, int Bi, short Bx)
+    coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned short Ax, 
+        int Bp, int Bi, unsigned short Bx)
+    coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, int Ax, 
+        int Bp, int Bi, int Bx)
+    coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned int Ax, 
+        int Bp, int Bi, unsigned int Bx)
+    coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, long long Ax, 
+        int Bp, int Bi, long long Bx)
+    coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned long long Ax, 
+        int Bp, int Bi, unsigned long long Bx)
+    coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, float Ax, 
+        int Bp, int Bi, float Bx)
+    coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, double Ax, 
+        int Bp, int Bi, double Bx)
+    coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, long double Ax, 
+        int Bp, int Bi, long double Bx)
+    coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cfloat_wrapper Ax, 
+        int Bp, int Bi, npy_cfloat_wrapper Bx)
+    coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cdouble_wrapper Ax, 
+        int Bp, int Bi, npy_cdouble_wrapper Bx)
+    coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, npy_clongdouble_wrapper Ax, 
+        int Bp, int Bi, npy_clongdouble_wrapper Bx)
     """
-      coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, signed char Ax,
-          int Bp, int Bi, signed char Bx)
-      coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned char Ax,
-          int Bp, int Bi, unsigned char Bx)
-      coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, short Ax,
-          int Bp, int Bi, short Bx)
-      coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned short Ax,
-          int Bp, int Bi, unsigned short Bx)
-      coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, int Ax,
-          int Bp, int Bi, int Bx)
-      coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned int Ax,
-          int Bp, int Bi, unsigned int Bx)
-      coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, long long Ax,
-          int Bp, int Bi, long long Bx)
-      coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned long long Ax,
-          int Bp, int Bi, unsigned long long Bx)
-      coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, float Ax,
-          int Bp, int Bi, float Bx)
-      coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, double Ax,
-          int Bp, int Bi, double Bx)
-      coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, long double Ax,
-          int Bp, int Bi, long double Bx)
-      coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cfloat_wrapper Ax,
-          int Bp, int Bi, npy_cfloat_wrapper Bx)
-      coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cdouble_wrapper Ax,
-          int Bp, int Bi, npy_cdouble_wrapper Bx)
-      coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, npy_clongdouble_wrapper Ax,
-          int Bp, int Bi, npy_clongdouble_wrapper Bx)
-      """
-    return _coo.coo_tocsc(*args)
+  return _coo.coo_tocsc(*args)
 
 def coo_todense(*args):
+  """
+    coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, signed char Ax, 
+        signed char Bx)
+    coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned char Ax, 
+        unsigned char Bx)
+    coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, short Ax, 
+        short Bx)
+    coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned short Ax, 
+        unsigned short Bx)
+    coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, int Ax, 
+        int Bx)
+    coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned int Ax, 
+        unsigned int Bx)
+    coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, long long Ax, 
+        long long Bx)
+    coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned long long Ax, 
+        unsigned long long Bx)
+    coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, float Ax, 
+        float Bx)
+    coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, double Ax, 
+        double Bx)
+    coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, long double Ax, 
+        long double Bx)
+    coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cfloat_wrapper Ax, 
+        npy_cfloat_wrapper Bx)
+    coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cdouble_wrapper Ax, 
+        npy_cdouble_wrapper Bx)
+    coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, npy_clongdouble_wrapper Ax, 
+        npy_clongdouble_wrapper Bx)
     """
-      coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, signed char Ax,
-          signed char Bx)
-      coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned char Ax,
-          unsigned char Bx)
-      coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, short Ax,
-          short Bx)
-      coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned short Ax,
-          unsigned short Bx)
-      coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, int Ax,
-          int Bx)
-      coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned int Ax,
-          unsigned int Bx)
-      coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, long long Ax,
-          long long Bx)
-      coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned long long Ax,
-          unsigned long long Bx)
-      coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, float Ax,
-          float Bx)
-      coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, double Ax,
-          double Bx)
-      coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, long double Ax,
-          long double Bx)
-      coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cfloat_wrapper Ax,
-          npy_cfloat_wrapper Bx)
-      coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cdouble_wrapper Ax,
-          npy_cdouble_wrapper Bx)
-      coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, npy_clongdouble_wrapper Ax,
-          npy_clongdouble_wrapper Bx)
-      """
-    return _coo.coo_todense(*args)
+  return _coo.coo_todense(*args)
 
 def coo_matvec(*args):
+  """
+    coo_matvec(int nnz, int Ai, int Aj, signed char Ax, signed char Xx, 
+        signed char Yx)
+    coo_matvec(int nnz, int Ai, int Aj, unsigned char Ax, unsigned char Xx, 
+        unsigned char Yx)
+    coo_matvec(int nnz, int Ai, int Aj, short Ax, short Xx, short Yx)
+    coo_matvec(int nnz, int Ai, int Aj, unsigned short Ax, unsigned short Xx, 
+        unsigned short Yx)
+    coo_matvec(int nnz, int Ai, int Aj, int Ax, int Xx, int Yx)
+    coo_matvec(int nnz, int Ai, int Aj, unsigned int Ax, unsigned int Xx, 
+        unsigned int Yx)
+    coo_matvec(int nnz, int Ai, int Aj, long long Ax, long long Xx, 
+        long long Yx)
+    coo_matvec(int nnz, int Ai, int Aj, unsigned long long Ax, unsigned long long Xx, 
+        unsigned long long Yx)
+    coo_matvec(int nnz, int Ai, int Aj, float Ax, float Xx, float Yx)
+    coo_matvec(int nnz, int Ai, int Aj, double Ax, double Xx, double Yx)
+    coo_matvec(int nnz, int Ai, int Aj, long double Ax, long double Xx, 
+        long double Yx)
+    coo_matvec(int nnz, int Ai, int Aj, npy_cfloat_wrapper Ax, npy_cfloat_wrapper Xx, 
+        npy_cfloat_wrapper Yx)
+    coo_matvec(int nnz, int Ai, int Aj, npy_cdouble_wrapper Ax, npy_cdouble_wrapper Xx, 
+        npy_cdouble_wrapper Yx)
+    coo_matvec(int nnz, int Ai, int Aj, npy_clongdouble_wrapper Ax, 
+        npy_clongdouble_wrapper Xx, npy_clongdouble_wrapper Yx)
     """
-      coo_matvec(int nnz, int Ai, int Aj, signed char Ax, signed char Xx,
-          signed char Yx)
-      coo_matvec(int nnz, int Ai, int Aj, unsigned char Ax, unsigned char Xx,
-          unsigned char Yx)
-      coo_matvec(int nnz, int Ai, int Aj, short Ax, short Xx, short Yx)
-      coo_matvec(int nnz, int Ai, int Aj, unsigned short Ax, unsigned short Xx,
-          unsigned short Yx)
-      coo_matvec(int nnz, int Ai, int Aj, int Ax, int Xx, int Yx)
-      coo_matvec(int nnz, int Ai, int Aj, unsigned int Ax, unsigned int Xx,
-          unsigned int Yx)
-      coo_matvec(int nnz, int Ai, int Aj, long long Ax, long long Xx,
-          long long Yx)
-      coo_matvec(int nnz, int Ai, int Aj, unsigned long long Ax, unsigned long long Xx,
-          unsigned long long Yx)
-      coo_matvec(int nnz, int Ai, int Aj, float Ax, float Xx, float Yx)
-      coo_matvec(int nnz, int Ai, int Aj, double Ax, double Xx, double Yx)
-      coo_matvec(int nnz, int Ai, int Aj, long double Ax, long double Xx,
-          long double Yx)
-      coo_matvec(int nnz, int Ai, int Aj, npy_cfloat_wrapper Ax, npy_cfloat_wrapper Xx,
-          npy_cfloat_wrapper Yx)
-      coo_matvec(int nnz, int Ai, int Aj, npy_cdouble_wrapper Ax, npy_cdouble_wrapper Xx,
-          npy_cdouble_wrapper Yx)
-      coo_matvec(int nnz, int Ai, int Aj, npy_clongdouble_wrapper Ax,
-          npy_clongdouble_wrapper Xx, npy_clongdouble_wrapper Yx)
-      """
-    return _coo.coo_matvec(*args)
+  return _coo.coo_matvec(*args)
+

Modified: trunk/scipy/sparse/sparsetools/csr.h
===================================================================
--- trunk/scipy/sparse/sparsetools/csr.h	2009-01-31 04:41:39 UTC (rev 5529)
+++ trunk/scipy/sparse/sparsetools/csr.h	2009-02-01 03:57:01 UTC (rev 5530)
@@ -83,6 +83,7 @@
     }
 }
 
+
 /*
  * Scale the rows of a CSR matrix *in place*
  *
@@ -104,6 +105,7 @@
     }
 }
 
+
 /*
  * Scale the columns of a CSR matrix *in place*
  *
@@ -189,7 +191,6 @@
  *
  * 
  */
-
 template <class I, class T>
 void csr_tobsr(const I n_row,
 	           const I n_col, 
@@ -243,15 +244,13 @@
 }
 
 
-
 /*
- * Sort CSR column indices inplace
+ * Determine whether the CSR column indices are in sorted order.
  *
  * Input Arguments:
  *   I  n_row           - number of rows in A
  *   I  Ap[n_row+1]     - row pointer
  *   I  Aj[nnz(A)]      - column indices
- *   T  Ax[nnz(A)]      - nonzeros 
  *
  */
 template <class I>
@@ -268,11 +267,54 @@
   }
   return true;
 }
+
+
+
+/*
+ * Determine whether the matrix structure is canonical CSR.
+ * Canonical CSR implies that column indices within each row
+ * are (1) sorted and (2) unique.  Matrices that meet these 
+ * conditions facilitate faster matrix computations.
+ *
+ * Input Arguments:
+ *   I  n_row           - number of rows in A
+ *   I  Ap[n_row+1]     - row pointer
+ *   I  Aj[nnz(A)]      - column indices
+ *
+ */
+template <class I>
+bool csr_has_canonical_format(const I n_row, 
+                              const I Ap[],
+                              const I Aj[])
+{
+    for(I i = 0; i < n_row; i++){
+        if (Ap[i] > Ap[i+1])
+            return false;
+        for(I jj = Ap[i] + 1; jj < Ap[i+1]; jj++){
+            if( !(Aj[jj-1] < Aj[jj]) ){
+                return false;
+            }
+        }
+    }
+    return true;
+}
+
+
 template< class T1, class T2 >
 bool kv_pair_less(const std::pair<T1,T2>& x, const std::pair<T1,T2>& y){
     return x.first < y.first;
 }
 
+/*
+ * Sort CSR column indices inplace
+ *
+ * Input Arguments:
+ *   I  n_row           - number of rows in A
+ *   I  Ap[n_row+1]     - row pointer
+ *   I  Aj[nnz(A)]      - column indices
+ *   T  Ax[nnz(A)]      - nonzeros 
+ *
+ */
 template<class I, class T>
 void csr_sort_indices(const I n_row,
                       const I Ap[], 
@@ -486,52 +528,8 @@
                       const I Bj[],
                             I Cp[])
 {
-//    // method that uses O(1) temp storage
-//    const I hash_size = 1 << 5;
-//    I vals[hash_size];
-//    I mask[hash_size];
-//
-//    std::set<I> spill;    
-//    
-//    for(I i = 0; i < hash_size; i++){
-//        vals[i] = -1;
-//        mask[i] = -1;
-//    }
-//
-//    Cp[0] = 0;
-//
-//    I slow_inserts = 0;
-//    I total_inserts = 0;
-//    I nnz = 0;
-//    for(I i = 0; i < n_row; i++){
-//        spill.clear();
-//        for(I jj = Ap[i]; jj < Ap[i+1]; jj++){
-//            I j = Aj[jj];
-//            for(I kk = Bp[j]; kk < Bp[j+1]; kk++){
-//                I k = Bj[kk];
-//                // I hash = k & (hash_size - 1);
-//                I hash = ((I)2654435761 * k) & (hash_size -1 );
-//                total_inserts++;
-//                if(mask[hash] != i){
-//                    mask[hash] = i;                        
-//                    vals[hash] = k;
-//                    nnz++;
-//                } else {
-//                    if (vals[hash] != k){
-//                        slow_inserts++;
-//                        spill.insert(k);
-//                    }
-//                }
-//            }
-//        }       
-//        nnz += spill.size();
-//        Cp[i+1] = nnz;
-//    }
-//
-//    std::cout << "slow fraction " << ((float) slow_inserts)/ ((float) total_inserts) << std::endl;
-
     // method that uses O(n) temp storage
-    std::vector<I> mask(n_col,-1);
+    std::vector<I> mask(n_col, -1);
     Cp[0] = 0;
 
     I nnz = 0;
@@ -594,7 +592,7 @@
 
                 if(next[k] == -1){
                     next[k] = head;                        
-                    head = k;
+                    head  = k;
                     length++;
                 }
             }
@@ -621,8 +619,10 @@
 
 
 /*
- * Compute C = A (binary_op) B for CSR matrices A,B where the column 
- * indices with the rows of A and B are not known to be sorted.
+ * Compute C = A (binary_op) B for CSR matrices that are not
+ * necessarily canonical CSR format.  Specifically, this method
+ * works even when the input matrices have duplicate and/or
+ * unsorted column indices within a given row.
  *
  * Refer to csr_binop_csr() for additional information
  *   
@@ -634,34 +634,26 @@
  * Note: 
  *   Input:  A and B column indices are not assumed to be in sorted order 
  *   Output: C column indices are not generally in sorted order
- *           Cx will not contain any zero entries
+ *           C will not contain any duplicate entries or explicit zeros.
  *
  */
 template <class I, class T, class binary_op>
-void csr_binop_csr_unsorted(const I n_row,
-                            const I n_col, 
-                            const I Ap[], 
-                            const I Aj[], 
-                            const T Ax[],
-                            const I Bp[],
-                            const I Bj[],
-                            const T Bx[],
-                                  I Cp[],
-                                  I Cj[],
-                                  T Cx[],
-                            const binary_op& op)
+void csr_binop_csr_general(const I n_row, const I n_col, 
+                           const I Ap[], const I Aj[], const T Ax[],
+                           const I Bp[], const I Bj[], const T Bx[],
+                                 I Cp[],       I Cj[],       T Cx[],
+                           const binary_op& op)
 {
-    //Method that works for unsorted indices
+    //Method that works for duplicate and/or unsorted indices
 
     std::vector<I>  next(n_col,-1);
     std::vector<T> A_row(n_col, 0);
     std::vector<T> B_row(n_col, 0);
 
     I nnz = 0;
+    Cp[0] = 0;
     
     for(I i = 0; i < n_row; i++){
-        Cp[i] = nnz;
-
         I head   = -2;
         I length =  0;
     
@@ -714,15 +706,18 @@
             A_row[temp] =  0;                             
             B_row[temp] =  0;
         }
-    }
 
-    Cp[n_row] = nnz;
+        Cp[i + 1] = nnz;
+    }
 }
 
 
+
 /*
- * Compute C = A (binary_op) B for CSR matrices A,B where the column 
- * indices with the rows of A and B are known to be sorted.
+ * Compute C = A (binary_op) B for CSR matrices that are in the 
+ * canonical CSR format.  Specifically, this method requires that
+ * the rows of the input matrices are free of duplicate column indices
+ * and that the column indices are in sorted order.
  *
  * Refer to csr_binop_csr() for additional information
  *
@@ -733,20 +728,13 @@
  *
  */
 template <class I, class T, class binary_op>
-void csr_binop_csr_sorted(const I n_row,
-                          const I n_col, 
-                          const I Ap[], 
-                          const I Aj[], 
-                          const T Ax[],
-                          const I Bp[],
-                          const I Bj[],
-                          const T Bx[],
-                                I Cp[],
-                                I Cj[],
-                                T Cx[],
-                          const binary_op& op)
+void csr_binop_csr_canonical(const I n_row, const I n_col, 
+                             const I Ap[], const I Aj[], const T Ax[],
+                             const I Bp[], const I Bj[], const T Bx[],
+                                   I Cp[],       I Cj[],       T Cx[],
+                             const binary_op& op)
 {
-    //Method that works for sorted indices
+    //Method that works for canonical CSR matrices 
 
     Cp[0] = 0;
     I nnz = 0;
@@ -810,6 +798,7 @@
             }
             B_pos++;
         }
+
         Cp[i+1] = nnz;
     }
 }
@@ -860,10 +849,10 @@
                          T Cx[],
                    const binary_op& op)
 {
-    if (csr_has_sorted_indices(n_row,Ap,Aj) && csr_has_sorted_indices(n_row,Bp,Bj))
-        csr_binop_csr_sorted(n_row, n_col, Ap, Aj, Ax, Bp, Bj, Bx, Cp, Cj, Cx, op);
+    if (csr_has_canonical_format(n_row,Ap,Aj) && csr_has_canonical_format(n_row,Bp,Bj))
+        csr_binop_csr_canonical(n_row, n_col, Ap, Aj, Ax, Bp, Bj, Bx, Cp, Cj, Cx, op);
     else
-        csr_binop_csr_unsorted(n_row, n_col, Ap, Aj, Ax, Bp, Bj, Bx, Cp, Cj, Cx, op);
+        csr_binop_csr_general(n_row, n_col, Ap, Aj, Ax, Bp, Bj, Bx, Cp, Cj, Cx, op);
 }
 
 

Modified: trunk/scipy/sparse/sparsetools/dia.py
===================================================================
--- trunk/scipy/sparse/sparsetools/dia.py	2009-01-31 04:41:39 UTC (rev 5529)
+++ trunk/scipy/sparse/sparsetools/dia.py	2009-02-01 03:57:01 UTC (rev 5530)
@@ -51,39 +51,40 @@
 
 
 def dia_matvec(*args):
+  """
+    dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, 
+        signed char diags, signed char Xx, signed char Yx)
+    dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, 
+        unsigned char diags, unsigned char Xx, unsigned char Yx)
+    dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, 
+        short diags, short Xx, short Yx)
+    dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, 
+        unsigned short diags, unsigned short Xx, 
+        unsigned short Yx)
+    dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, 
+        int diags, int Xx, int Yx)
+    dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, 
+        unsigned int diags, unsigned int Xx, unsigned int Yx)
+    dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, 
+        long long diags, long long Xx, long long Yx)
+    dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, 
+        unsigned long long diags, unsigned long long Xx, 
+        unsigned long long Yx)
+    dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, 
+        float diags, float Xx, float Yx)
+    dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, 
+        double diags, double Xx, double Yx)
+    dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, 
+        long double diags, long double Xx, long double Yx)
+    dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, 
+        npy_cfloat_wrapper diags, npy_cfloat_wrapper Xx, 
+        npy_cfloat_wrapper Yx)
+    dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, 
+        npy_cdouble_wrapper diags, npy_cdouble_wrapper Xx, 
+        npy_cdouble_wrapper Yx)
+    dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, 
+        npy_clongdouble_wrapper diags, npy_clongdouble_wrapper Xx, 
+        npy_clongdouble_wrapper Yx)
     """
-      dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets,
-          signed char diags, signed char Xx, signed char Yx)
-      dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets,
-          unsigned char diags, unsigned char Xx, unsigned char Yx)
-      dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets,
-          short diags, short Xx, short Yx)
-      dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets,
-          unsigned short diags, unsigned short Xx,
-          unsigned short Yx)
-      dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets,
-          int diags, int Xx, int Yx)
-      dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets,
-          unsigned int diags, unsigned int Xx, unsigned int Yx)
-      dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets,
-          long long diags, long long Xx, long long Yx)
-      dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets,
-          unsigned long long diags, unsigned long long Xx,
-          unsigned long long Yx)
-      dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets,
-          float diags, float Xx, float Yx)
-      dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets,
-          double diags, double Xx, double Yx)
-      dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets,
-          long double diags, long double Xx, long double Yx)
-      dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets,
-          npy_cfloat_wrapper diags, npy_cfloat_wrapper Xx,
-          npy_cfloat_wrapper Yx)
-      dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets,
-          npy_cdouble_wrapper diags, npy_cdouble_wrapper Xx,
-          npy_cdouble_wrapper Yx)
-      dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets,
-          npy_clongdouble_wrapper diags, npy_clongdouble_wrapper Xx,
-          npy_clongdouble_wrapper Yx)
-      """
-    return _dia.dia_matvec(*args)
+  return _dia.dia_matvec(*args)
+

Modified: trunk/scipy/sparse/sparsetools/scratch.h
===================================================================
--- trunk/scipy/sparse/sparsetools/scratch.h	2009-01-31 04:41:39 UTC (rev 5529)
+++ trunk/scipy/sparse/sparsetools/scratch.h	2009-02-01 03:57:01 UTC (rev 5530)
@@ -329,3 +329,63 @@
     }
 }
 
+
+/*
+ * Pass 1 computes CSR row pointer for the matrix product C = A * B
+ *
+ */
+template <class I>
+void csr_matmat_pass1(const I n_row,
+                      const I n_col, 
+                      const I Ap[], 
+                      const I Aj[], 
+                      const I Bp[],
+                      const I Bj[],
+                            I Cp[])
+{
+    // method that uses O(1) temp storage
+    const I hash_size = 1 << 5;
+    I vals[hash_size];
+    I mask[hash_size];
+
+    std::set<I> spill;    
+    
+    for(I i = 0; i < hash_size; i++){
+        vals[i] = -1;
+        mask[i] = -1;
+    }
+
+    Cp[0] = 0;
+
+    I slow_inserts = 0;
+    I total_inserts = 0;
+    I nnz = 0;
+    for(I i = 0; i < n_row; i++){
+        spill.clear();
+        for(I jj = Ap[i]; jj < Ap[i+1]; jj++){
+            I j = Aj[jj];
+            for(I kk = Bp[j]; kk < Bp[j+1]; kk++){
+                I k = Bj[kk];
+                // I hash = k & (hash_size - 1);
+                I hash = ((I)2654435761 * k) & (hash_size -1 );
+                total_inserts++;
+                if(mask[hash] != i){
+                    mask[hash] = i;                        
+                    vals[hash] = k;
+                    nnz++;
+                } else {
+                    if (vals[hash] != k){
+                        slow_inserts++;
+                        spill.insert(k);
+                    }
+                }
+            }
+        }       
+        nnz += spill.size();
+        Cp[i+1] = nnz;
+    }
+
+    std::cout << "slow fraction " << ((float) slow_inserts)/ ((float) total_inserts) << std::endl;
+}
+
+

Modified: trunk/scipy/sparse/sparsetools/setup.py
===================================================================
--- trunk/scipy/sparse/sparsetools/setup.py	2009-01-31 04:41:39 UTC (rev 5529)
+++ trunk/scipy/sparse/sparsetools/setup.py	2009-02-01 03:57:01 UTC (rev 5530)
@@ -8,7 +8,8 @@
 
     for fmt in ['csr','csc','coo','bsr','dia']:
         sources = [ fmt + '_wrap.cxx' ]
-        config.add_extension('_' + fmt, sources=sources)
+        depends = [ fmt + '.h' ]
+        config.add_extension('_' + fmt, sources=sources, depends=depends)
 
     return config
 




More information about the Scipy-svn mailing list