[Scipy-svn] r3664 - in trunk/scipy: linsolve/umfpack linsolve/umfpack/tests sparse sparse/sparsetools sparse/tests

scipy-svn@scip... scipy-svn@scip...
Fri Dec 14 23:59:31 CST 2007


Author: wnbell
Date: 2007-12-14 23:59:12 -0600 (Fri, 14 Dec 2007)
New Revision: 3664

Modified:
   trunk/scipy/linsolve/umfpack/tests/test_umfpack.py
   trunk/scipy/linsolve/umfpack/umfpack.py
   trunk/scipy/sparse/base.py
   trunk/scipy/sparse/compressed.py
   trunk/scipy/sparse/construct.py
   trunk/scipy/sparse/coo.py
   trunk/scipy/sparse/csc.py
   trunk/scipy/sparse/csr.py
   trunk/scipy/sparse/dia.py
   trunk/scipy/sparse/lil.py
   trunk/scipy/sparse/sparsetools/sparsetools.h
   trunk/scipy/sparse/sparsetools/sparsetools.i
   trunk/scipy/sparse/sparsetools/sparsetools.py
   trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx
   trunk/scipy/sparse/spfuncs.py
   trunk/scipy/sparse/tests/test_construct.py
Log:
changed sparsetools interface.
made sparse matrix multiplication a 2-pass algorithm.
replaced sparsetools csr_matrix -> dense with numpy coo_matrix -> dense.
fixed spdiags and added unittests (now returns dia_matrix)
misc fixes



Modified: trunk/scipy/linsolve/umfpack/tests/test_umfpack.py
===================================================================
--- trunk/scipy/linsolve/umfpack/tests/test_umfpack.py	2007-12-15 05:38:59 UTC (rev 3663)
+++ trunk/scipy/linsolve/umfpack/tests/test_umfpack.py	2007-12-15 05:59:12 UTC (rev 3664)
@@ -150,15 +150,17 @@
         random.seed(0) #make tests repeatable
         self.real_matrices = []
         self.real_matrices.append(spdiags([[1, 2, 3, 4, 5], [6, 5, 8, 9, 10]],
-                                          [0, 1], 5, 5))
+                                          [0, 1], 5, 5) )
         self.real_matrices.append(spdiags([[1, 2, 3, 4, 5], [6, 5, 8, 9, 10]],
-                                          [0, 1], 4, 5))
+                                          [0, 1], 4, 5) )
         self.real_matrices.append(spdiags([[1, 2, 3, 4, 5], [6, 5, 8, 9, 10]],
-                                          [0, 2], 5, 5))
-        self.real_matrices.append(csc_matrix(rand(3,3)))
-        self.real_matrices.append(csc_matrix(rand(5,4)))
-        self.real_matrices.append(csc_matrix(rand(4,5)))
+                                          [0, 2], 5, 5) )
+        self.real_matrices.append(rand(3,3))
+        self.real_matrices.append(rand(5,4))
+        self.real_matrices.append(rand(4,5))
 
+        self.real_matrices = [csc_matrix(x).astype('d') for x \
+                in self.real_matrices]
         self.complex_matrices = [x.astype(nm.complex128)
                                  for x in self.real_matrices]
 

Modified: trunk/scipy/linsolve/umfpack/umfpack.py
===================================================================
--- trunk/scipy/linsolve/umfpack/umfpack.py	2007-12-15 05:38:59 UTC (rev 3663)
+++ trunk/scipy/linsolve/umfpack/umfpack.py	2007-12-15 05:59:12 UTC (rev 3664)
@@ -353,11 +353,12 @@
         sparsity pattern."""
         self.free_symbolic()
 
+        indx = self._getIndx( mtx )
+
         if not assumeSortedIndices:
             # row/column indices cannot be assumed to be sorted
             mtx.sort_indices()
 
-        indx = self._getIndx( mtx )
         if self.isReal:
             status, self._symbolic\
                     = self.funs.symbolic( mtx.shape[0], mtx.shape[1],

Modified: trunk/scipy/sparse/base.py
===================================================================
--- trunk/scipy/sparse/base.py	2007-12-15 05:38:59 UTC (rev 3663)
+++ trunk/scipy/sparse/base.py	2007-12-15 05:59:12 UTC (rev 3664)
@@ -364,8 +364,7 @@
         return asmatrix(self.toarray())
 
     def toarray(self):
-        csr = self.tocsr()
-        return csr.toarray()
+        return self.tocsr().toarray()
 
     def todok(self):
         return self.tocoo().todok()
@@ -379,13 +378,6 @@
     def todia(self):
         return self.tocoo().todia()
 
-#    def toself(self, copy=False):
-#        if copy:
-#            new = self.copy()
-#        else:
-#            new = self
-#        return new
-
     def copy(self):
         return self.__class__(self,copy=True)
 

Modified: trunk/scipy/sparse/compressed.py
===================================================================
--- trunk/scipy/sparse/compressed.py	2007-12-15 05:38:59 UTC (rev 3663)
+++ trunk/scipy/sparse/compressed.py	2007-12-15 05:59:12 UTC (rev 3664)
@@ -171,10 +171,10 @@
         if full_check:
             #check format validity (more expensive)
             if self.nnz > 0:
-                if amax(self.indices) >= minor_dim:
+                if self.indices.max() >= minor_dim:
                     raise ValueError, "%s index values must be < %d" % \
                             (minor_name,minor_dim)
-                if amin(self.indices) < 0:
+                if self.indices.min() < 0:
                     raise ValueError, "%s index values must be >= 0" % \
                             minor_name
                 if numpy.diff(self.indptr).min() < 0:
@@ -315,9 +315,34 @@
             K2, N = other.shape
             if (K1 != K2):
                 raise ValueError, "shape mismatch error"
+
+            #return self._binopt(other,'mu',in_shape=(M,N),out_shape=(M,N))
+
+            major_axis = self._swap((M,N))[0]        
+            indptr = empty( major_axis + 1, dtype=intc )
+            
             other = self._tothis(other)
+            fn = getattr(sparsetools, self.format + '_matmat_pass1')
+            fn( M, N, self.indptr, self.indices, \
+                      other.indptr, other.indices, \
+                      indptr)
+            
+            nnz = indptr[-1]
+            indices = empty( nnz, dtype=intc)
+            data    = empty( nnz, dtype=upcast(self.dtype,other.dtype))
 
-            return self._binopt(other,'mu',in_shape=(M,N),out_shape=(M,N))
+            fn = getattr(sparsetools, self.format + '_matmat_pass2')
+            fn( M, N, self.indptr, self.indices, self.data, \
+                      other.indptr, other.indices, other.data, \
+                      indptr, indices, data)
+
+            nnz = indptr[-1] #may have changed
+            #indices = indices[:nnz]
+            #data    = indices[:nnz]
+
+            return self.__class__((data,indices,indptr),shape=(M,N))
+
+
         elif isdense(other):
             # TODO make sparse * dense matrix multiplication more efficient
 
@@ -333,7 +358,7 @@
                 raise ValueError, "dimension mismatch"
 
             # csrmux, cscmux
-            fn = getattr(sparsetools,self.format + 'mux')
+            fn = getattr(sparsetools,self.format + '_matvec')
     
             #output array
             y = empty( self.shape[0], dtype=upcast(self.dtype,other.dtype) )
@@ -445,7 +470,7 @@
     def sort_indices(self):
         """Sort the indices of this matrix *in place*
         """
-        fn = getattr(sparsetools,'sort_' + self.format + '_indices')
+        fn = getattr(sparsetools,self.format + '_sort_indices')
 
         M,N = self.shape
         fn( M, N, self.indptr, self.indices, self.data)

Modified: trunk/scipy/sparse/construct.py
===================================================================
--- trunk/scipy/sparse/construct.py	2007-12-15 05:38:59 UTC (rev 3663)
+++ trunk/scipy/sparse/construct.py	2007-12-15 05:59:12 UTC (rev 3664)
@@ -4,7 +4,7 @@
 
 __all__ = [ 'spdiags','speye','spidentity','spkron', 'lil_eye', 'lil_diags' ]
 
-import itertools
+from itertools import izip
 from warnings import warn
 
 import numpy
@@ -15,9 +15,9 @@
 from coo import coo_matrix
 from dok import dok_matrix
 from lil import lil_matrix
+from dia import dia_matrix
 from base import isspmatrix
 
-import sparsetools
 
 def spdiags(diags, offsets, m, n, format=None):
     """Return a sparse matrix given its diagonals.
@@ -47,19 +47,7 @@
 
     """
     #TODO update this example
-    
-    if format == 'csc':
-        diags = array(diags, copy = True)
-        if diags.dtype.char not in 'fdFD':
-            diags = diags.astype('d')
-        if not hasattr(offsets, '__len__' ):
-            offsets = (offsets,)
-        offsets = array(offsets, copy=False, dtype=intc)
-        assert(len(offsets) == diags.shape[0])
-        indptr, rowind, data = sparsetools.spdiags(m, n, len(offsets), offsets, diags)
-        return csc_matrix((data, rowind, indptr), (m, n))
-    else:
-        return spdiags( diags, offsets, m, n, format='csc').asformat(format)
+    return dia_matrix((diags, offsets), shape=(m,n)).asformat(format)
 
 def spidentity(n, dtype='d', format=None):
     """spidentity(n) returns an (n x n) identity matrix"""
@@ -201,7 +189,7 @@
                              "diagonal %s." % k)
 
     out = lil_matrix((m,n),dtype=dtype)
-    for k,diag in itertools.izip(offsets,diags):
+    for k,diag in izip(offsets,diags):
         for ix,c in enumerate(xrange(clip(k,0,n),clip(m+k,0,n))):
             out.rows[c-k].append(c)
             out.data[c-k].append(diag[ix])

Modified: trunk/scipy/sparse/coo.py
===================================================================
--- trunk/scipy/sparse/coo.py	2007-12-15 05:38:59 UTC (rev 3663)
+++ trunk/scipy/sparse/coo.py	2007-12-15 05:59:12 UTC (rev 3664)
@@ -5,9 +5,9 @@
 from itertools import izip
 from warnings import warn 
 
-from numpy import array, asarray, empty, intc
+from numpy import array, asarray, empty, intc, zeros, bincount
 
-from sparsetools import cootocsr, cootocsc
+from sparsetools import coo_tocsr, coo_tocsc
 from base import spmatrix, isspmatrix
 from sputils import upcast, to_native, isshape, getdtype
 
@@ -161,7 +161,6 @@
         self.shape = tuple([int(x) for x in self.shape])
         self.nnz = nnz
 
-
     def rowcol(self, num):
         return (self.row[num], self.col[num])
 
@@ -172,6 +171,12 @@
         M,N = self.shape
         return coo_matrix((self.data,(self.col,self.row)),(N,M),copy=copy)
 
+    def toarray(self):
+        A = self.tocsr().tocoo(copy=False) #eliminate (i,j) duplicates
+        M = zeros(self.shape, dtype=self.dtype)
+        M[A.row, A.col] = A.data
+        return M
+
     def tocsc(self):
         from csc import csc_matrix
         if self.nnz == 0:
@@ -181,9 +186,9 @@
             indices = empty(self.nnz, dtype=intc)
             data    = empty(self.nnz, dtype=upcast(self.dtype))
 
-            cootocsc(self.shape[0], self.shape[1], self.nnz, \
-                     self.row, self.col, self.data, \
-                     indptr, indices, data)
+            coo_tocsc(self.shape[0], self.shape[1], self.nnz, \
+                      self.row, self.col, self.data, \
+                      indptr, indices, data)
 
             return csc_matrix((data, indices, indptr), self.shape)
 
@@ -196,9 +201,9 @@
             indices = empty(self.nnz, dtype=intc)
             data    = empty(self.nnz, dtype=upcast(self.dtype))
 
-            cootocsr(self.shape[0], self.shape[1], self.nnz, \
-                     self.row, self.col, self.data, \
-                     indptr, indices, data)
+            coo_tocsr(self.shape[0], self.shape[1], self.nnz, \
+                      self.row, self.col, self.data, \
+                      indptr, indices, data)
 
             return csr_matrix((data, indices, indptr), self.shape)
     

Modified: trunk/scipy/sparse/csc.py
===================================================================
--- trunk/scipy/sparse/csc.py	2007-12-15 05:38:59 UTC (rev 3663)
+++ trunk/scipy/sparse/csc.py	2007-12-15 05:59:12 UTC (rev 3664)
@@ -10,7 +10,7 @@
         empty, hstack, isscalar, ndarray, shape, searchsorted
 
 from base import spmatrix,isspmatrix
-from sparsetools import csctocsr
+from sparsetools import csc_tocsr
 from sputils import upcast, to_native, isdense, isshape, getdtype, \
         isscalarlike
 
@@ -161,15 +161,18 @@
         indices = empty(self.nnz, dtype=intc)
         data    = empty(self.nnz, dtype=upcast(self.dtype))
 
-        csctocsr(self.shape[0], self.shape[1], \
-                self.indptr, self.indices, self.data, \
-                indptr, indices, data)
+        csc_tocsr(self.shape[0], self.shape[1], \
+                 self.indptr, self.indices, self.data, \
+                 indptr, indices, data)
 
         from csr import csr_matrix
         return csr_matrix((data, indices, indptr), self.shape)
-
+    
     def toarray(self):
-        return self.tocsr().toarray()
+        A = self.tocoo(copy=False)
+        M = zeros(self.shape, dtype=self.dtype)
+        M[A.row, A.col] = A.data
+        return M
 
     def get_submatrix( self, slice0, slice1 ):
         """Return a submatrix of this matrix (new matrix is created).
@@ -197,6 +200,7 @@
 
     def _tothis(self, other):
         return other.tocsc()
+
 from sputils import _isinstance
 
 def isspmatrix_csc(x):

Modified: trunk/scipy/sparse/csr.py
===================================================================
--- trunk/scipy/sparse/csr.py	2007-12-15 05:38:59 UTC (rev 3663)
+++ trunk/scipy/sparse/csr.py	2007-12-15 05:59:12 UTC (rev 3664)
@@ -11,7 +11,7 @@
         empty, hstack, isscalar, ndarray, shape, searchsorted
 
 from base import spmatrix,isspmatrix
-from sparsetools import csrtodense, csrtocsc
+from sparsetools import csr_tocsc
 from sputils import upcast, to_native, isdense, isshape, getdtype, \
         isscalarlike
 
@@ -168,19 +168,18 @@
         indices = empty(self.nnz, dtype=intc)
         data    = empty(self.nnz, dtype=upcast(self.dtype))
 
-        csrtocsc(self.shape[0], self.shape[1], \
-                 self.indptr, self.indices, self.data, \
-                 indptr, indices, data)
+        csr_tocsc(self.shape[0], self.shape[1], \
+                  self.indptr, self.indices, self.data, \
+                  indptr, indices, data)
 
         from csc import csc_matrix
         return csc_matrix((data, indices, indptr), self.shape)
     
     def toarray(self):
-        #TODO use a cheap tocoo() and make coo->todense()
-        data = numpy.zeros(self.shape, dtype=upcast(self.data.dtype))
-        csrtodense(self.shape[0], self.shape[1], self.indptr, self.indices,
-                   self.data, data)
-        return data
+        A = self.tocoo(copy=False)
+        M = zeros(self.shape, dtype=self.dtype)
+        M[A.row, A.col] = A.data
+        return M
     
     def get_submatrix( self, slice0, slice1 ):
         """Return a submatrix of this matrix (new matrix is created).

Modified: trunk/scipy/sparse/dia.py
===================================================================
--- trunk/scipy/sparse/dia.py	2007-12-15 05:38:59 UTC (rev 3663)
+++ trunk/scipy/sparse/dia.py	2007-12-15 05:59:12 UTC (rev 3664)
@@ -3,7 +3,7 @@
 __all__ = ['dia_matrix','isspmatrix_dia']
 
 from numpy import asarray, asmatrix, matrix, zeros, arange, unique, \
-        searchsorted, intc
+        searchsorted, intc, atleast_1d, atleast_2d
 
 from base import spmatrix, isspmatrix, isdense
 from sputils import isscalarlike, isshape, upcast, getdtype
@@ -55,8 +55,8 @@
                 else:
                     if shape is None:
                         raise ValueError,'expected a shape argument'
-                    self.diags   = asarray(arg1[0],dtype=dtype)
-                    self.offsets = asarray(arg1[1],dtype='i')
+                    self.diags   = atleast_2d(asarray(arg1[0],dtype=dtype))
+                    self.offsets = atleast_1d(asarray(arg1[1],dtype='i'))
                     self.shape   = shape
 
         #check format

Modified: trunk/scipy/sparse/lil.py
===================================================================
--- trunk/scipy/sparse/lil.py	2007-12-15 05:38:59 UTC (rev 3663)
+++ trunk/scipy/sparse/lil.py	2007-12-15 05:59:12 UTC (rev 3664)
@@ -3,6 +3,8 @@
 Original code by Ed Schofield.
 """
 
+__all__ = ['lil_matrix','isspmatrix_lil']
+
 import copy
 from bisect import bisect_left
 

Modified: trunk/scipy/sparse/sparsetools/sparsetools.h
===================================================================
--- trunk/scipy/sparse/sparsetools/sparsetools.h	2007-12-15 05:38:59 UTC (rev 3663)
+++ trunk/scipy/sparse/sparsetools/sparsetools.h	2007-12-15 05:59:12 UTC (rev 3664)
@@ -45,12 +45,12 @@
  * 
  */
 template <class I, class T>
-void extract_csr_diagonal(const I n_row,
-                          const I n_col, 
-	                      const I Ap[], 
-	                      const I Aj[], 
-	                      const T Ax[],
-	                            T Yx[])
+void csr_diagonal(const I n_row,
+                  const I n_col, 
+	              const I Ap[], 
+	              const I Aj[], 
+	              const T Ax[],
+	                    T Yx[])
 {
   const I N = std::min(n_row, n_col);
   
@@ -132,21 +132,21 @@
  * 
  */
 template <class I, class T>
-void csrtocsc(const I n_row,
-	          const I n_col, 
-	          const I Ap[], 
-	          const I Aj[], 
-	          const T Ax[],
-	                I Bp[],
-	                I Bi[],
-	                T Bx[])
+void csr_tocsc(const I n_row,
+	           const I n_col, 
+	           const I Ap[], 
+	           const I Aj[], 
+	           const T Ax[],
+	                 I Bp[],
+	                 I Bi[],
+	                 T Bx[])
 {  
-  I NNZ = Ap[n_row];
+  I nnz = Ap[n_row];
   
   std::vector<I> temp(n_col,0); //temp array
  
   //compute number of non-zero entries per column of A 
-  for (I i = 0; i < NNZ; i++){            
+  for (I i = 0; i < nnz; i++){            
     temp[Aj[i]]++;
   }
         
@@ -155,7 +155,7 @@
     Bp[i] = cumsum;
     cumsum += temp[i];
   }
-  Bp[n_col] = NNZ; 
+  Bp[n_col] = nnz; 
   std::copy(Bp, Bp + n_col, temp.begin());
 
   
@@ -203,19 +203,19 @@
  * 
  */
 template <class I, class T>
-void csrtocoo(const I n_row,
-	          const I n_col, 
-              const I Ap[], 
-              const I Aj[], 
-              const T Ax[],
-              std::vector<I>* Bi,
-              std::vector<I>* Bj,
-              std::vector<T>* Bx)
+void csr_tocoo(const I n_row,
+	           const I n_col, 
+               const I Ap[], 
+               const I Aj[], 
+               const T Ax[],
+               std::vector<I>* Bi,
+               std::vector<I>* Bj,
+               std::vector<T>* Bx)
 {
-  I NNZ = Ap[n_row];
-  Bi->reserve(NNZ);
-  Bi->reserve(NNZ);
-  Bx->reserve(NNZ);
+  I nnz = Ap[n_row];
+  Bi->reserve(nnz);
+  Bi->reserve(nnz);
+  Bx->reserve(nnz);
   for(I i = 0; i < n_row; i++){
     I row_start = Ap[i];
     I row_end   = Ap[i+1];
@@ -230,6 +230,120 @@
 
 
 /*
+ * Compute 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[])
+{
+    std::vector<I> next(n_col,-1);
+
+    Cp[0] = 0;
+
+    for(I i = 0; i < n_row; i++){
+        I head   = -2;
+        I length =  0;
+
+        I jj_start = Ap[i];
+        I jj_end   = Ap[i+1];
+        for(I jj = jj_start; jj < jj_end; jj++){
+            I j = Aj[jj];
+            I kk_start = Bp[j];
+            I kk_end   = Bp[j+1];
+            for(I kk = kk_start; kk < kk_end; kk++){
+                I k = Bj[kk];
+                if(next[k] == -1){
+                    next[k] = head;                        
+                    head = k;
+                    length++;
+                }
+            }
+        }         
+
+        for(I jj = 0; jj < length; jj++){
+            I temp = head;                
+            head = next[head];      
+            next[temp] = -1;
+        }
+        
+        Cp[i+1] = Cp[i] + length;
+    }
+}
+
+template <class I, class T>
+void csr_matmat_pass2(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[])
+{
+    std::vector<I> next(n_col,-1);
+    std::vector<T> sums(n_col, 0);
+
+    I nnz = 0;
+
+    Cp[0] = 0;
+
+    for(I i = 0; i < n_row; i++){
+        I head = -2;
+        I length =  0;
+
+        I jj_start = Ap[i];
+        I jj_end   = Ap[i+1];
+        for(I jj = jj_start; jj < jj_end; jj++){
+            I j = Aj[jj];
+            T v = Ax[jj];
+
+            I kk_start = Bp[j];
+            I kk_end   = Bp[j+1];
+            for(I kk = kk_start; kk < kk_end; kk++){
+                I k = Bj[kk];
+
+                sums[k] += v*Bx[kk];
+
+                if(next[k] == -1){
+                    next[k] = head;                        
+                    head = k;
+                    length++;
+                }
+            }
+        }         
+
+        for(I jj = 0; jj < length; jj++){
+
+            if(sums[head] != 0){
+                Cj[nnz] = head;
+                Cx[nnz] = sums[head];
+                nnz++;
+            }
+
+            I temp = head;                
+            head = next[head];
+
+            next[temp] = -1; //clear arrays
+            sums[temp] =  0;                              
+        }
+
+        Cp[i+1] = nnz;
+    }
+}
+
+
+
+
+/*
  * Compute C = A*B for CSR matrices A,B
  *
  *
@@ -282,45 +396,50 @@
       	      std::vector<I>* Cj,
       	      std::vector<T>* Cx)
 {
-  Cp->resize(n_row+1,0);
-  
-  std::vector<I> index(n_col,-1);
-  std::vector<T> sums(n_col,0);
+    Cp->resize(n_row+1,0);
 
-  for(I i = 0; i < n_row; i++){
-    I istart = -2;
-    I length =  0;
-    
-    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];
-        
-	    sums[k] += Ax[jj]*Bx[kk];
-        
-	    if(index[k] == -1){
-	        index[k] = istart;                        
-	        istart = k;
-	        length++;
-	    }
-      }
-    }         
+    std::vector<I> next(n_col,-1);
+    std::vector<T> sums(n_col, 0);
 
-    for(I jj = 0; jj < length; jj++){
-      if(sums[istart] != 0){
-	    Cj->push_back(istart);
-	    Cx->push_back(sums[istart]);
-      }
-	
-      I temp = istart;                
-      istart = index[istart];
-      
-      index[temp] = -1; //clear arrays
-      sums[temp]  =  0;                              
+    for(I i = 0; i < n_row; i++){
+        I head = -2;
+        I length =  0;
+
+        I jj_start = Ap[i];
+        I jj_end   = Ap[i+1];
+        for(I jj = jj_start; jj < jj_end; jj++){
+            I j = Aj[jj];
+
+            I kk_start = Bp[j];
+            I kk_end   = Bp[j+1];
+            for(I kk = kk_start; kk < kk_end; kk++){
+                I k = Bj[kk];
+
+                sums[k] += Ax[jj]*Bx[kk];
+
+                if(next[k] == -1){
+                    next[k] = head;                        
+                    head = k;
+                    length++;
+                }
+            }
+        }         
+
+        for(I jj = 0; jj < length; jj++){
+            if(sums[head] != 0){
+                Cj->push_back(head);
+                Cx->push_back(sums[head]);
+            }
+
+            I temp = head;                
+            head = next[head];
+
+            next[temp] = -1; //clear arrays
+            sums[temp]  =  0;                              
+        }
+
+        (*Cp)[i+1] = Cx->size();
     }
-    
-    (*Cp)[i+1] = Cx->size();
-  }
 }
 
 
@@ -371,53 +490,57 @@
 {
   Cp->resize(n_row+1,0);
   
-  std::vector<I>   index(n_col,-1);
+  std::vector<I>   next(n_col,-1);
   std::vector<T> A_row(n_col,0);
   std::vector<T> B_row(n_col,0);
 
   for(I i = 0; i < n_row; i++){
-    I istart = -2;
+    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 i_start = Ap[i];
+    I i_end   = Ap[i+1];
+    for(I jj = i_start; jj < i_end; jj++){
       I j = Aj[jj];
 
       A_row[j] += Ax[jj];
       
-      if(index[j] == -1){
-	    index[j] = istart;                        
-	    istart = j;
+      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_start = Bp[i];
+    i_end   = Bp[i+1];
+    for(I jj = i_start; jj < i_end; jj++){
       I j = Bj[jj];
 
       B_row[j] += Bx[jj];
 
-      if(index[j] == -1){
-          index[j] = istart;                        
-	      istart = j;
+      if(next[j] == -1){
+          next[j] = head;                        
+	      head = j;
 	      length++;
       }
     }
 
 
     for(I jj = 0; jj < length; jj++){
-      T result = op(A_row[istart],B_row[istart]);
+      T result = op(A_row[head],B_row[head]);
       
       if(result != 0){
-	    Cj->push_back(istart);
+	    Cj->push_back(head);
 	    Cx->push_back(result);
       }
       
-      I temp = istart;                
-      istart = index[istart];
+      I temp = head;                
+      head = next[head];
       
-      index[temp] = -1;
+      next[temp] = -1;
       A_row[temp] =  0;                              
       B_row[temp] =  0;
     }
@@ -491,7 +614,7 @@
   std::vector<I>  next(n_col,-1);
   std::vector<T>  sums(n_col, 0);
 
-  I NNZ = 0;
+  I nnz = 0;
 
   I row_start = 0;
   I row_end   = 0;
@@ -518,15 +641,15 @@
         head   = next[curr];
         
         if(sums[curr] != 0){
-            Aj[NNZ] = curr;
-            Ax[NNZ] = sums[curr];
-            NNZ++;
+            Aj[nnz] = curr;
+            Ax[nnz] = sums[curr];
+            nnz++;
         }
         
         next[curr] = -1;
         sums[curr] =  0;
     }
-    Ap[i+1] = NNZ;
+    Ap[i+1] = nnz;
   }
 }
 
@@ -539,6 +662,7 @@
  * Input Arguments:
  *   I  n_row      - number of rows in A
  *   I  n_col      - number of columns in A
+ *   I  nnz        - number of nonzeros in A
  *   I  Ai[nnz(A)] - row indices
  *   I  Aj[nnz(A)] - column indices
  *   T  Ax[nnz(A)] - nonzeros
@@ -561,20 +685,20 @@
  * 
  */
 template <class I, class T>
-void cootocsr(const I n_row,
-              const I n_col,
-              const I NNZ,
-              const I Ai[],
-              const I Aj[],
-              const T Ax[],
-                    I Bp[],
-                    I Bj[],
-                    T Bx[])
+void coo_tocsr(const I n_row,
+               const I n_col,
+               const I nnz,
+               const I Ai[],
+               const I Aj[],
+               const T Ax[],
+                     I Bp[],
+                     I Bj[],
+                     T Bx[])
 {
   std::vector<I> temp(n_row,0);
 
   //compute nnz per row, then compute Bp
-  for(I i = 0; i < NNZ; i++){
+  for(I i = 0; i < nnz; i++){
     temp[Ai[i]]++;
   }
   //cumsum the nnz per row to get Bp[]
@@ -582,11 +706,11 @@
     Bp[i] = cumsum;
     cumsum += temp[i];
   }
-  Bp[n_row] = NNZ; 
+  Bp[n_row] = nnz; 
   std::copy(Bp, Bp + n_row, temp.begin());
 
   //write Aj,Ax into Bj,Bx
-  for(I i = 0; i < NNZ; i++){
+  for(I i = 0; i < nnz; i++){
     I row = Ai[i];
     I n   = temp[row];
 
@@ -626,13 +750,13 @@
  * 
  */
 template <class I, class T>
-void csrmux(const I n_row,
-	        const I n_col, 
-	        const I Ap[], 
-	        const I Aj[], 
-	        const T Ax[],
-	        const T Xx[],
-	              T Yx[])
+void csr_matvec(const I n_row,
+	            const I n_col, 
+	            const I Ap[], 
+	            const I Aj[], 
+	            const T Ax[],
+	            const T Xx[],
+	                  T Yx[])
 {
   for(I i = 0; i < n_row; i++){
     I row_start = Ap[i];
@@ -671,13 +795,13 @@
  * 
  */
 template <class I, class T>
-void cscmux(const I n_row,
-	        const I n_col, 
-	        const I Ap[], 
-	        const I Ai[], 
-	        const T Ax[],
-	        const T Xx[],
-	              T Yx[])
+void csc_matvec(const I n_row,
+	            const I n_col, 
+	            const I Ap[], 
+	            const I Ai[], 
+	            const T Ax[],
+	            const T Xx[],
+	                  T Yx[])
 { 
  for(I i = 0; i < n_row; i++){
       Yx[i] = 0;
@@ -772,12 +896,12 @@
  *
  */
 template <class I, class T>
-void csrtodense(const I  n_row,
-                const I  n_col,
-                const I  Ap[],
-                const I  Aj[],
-                const T  Ax[],
-                      T  Mx[])
+void csr_todense(const I  n_row,
+                 const I  n_col,
+                 const I  Ap[],
+                 const I  Aj[],
+                 const T  Ax[],
+                       T  Mx[])
 {
   I row_base = 0;
   for(I i = 0; i < n_row; i++){
@@ -809,12 +933,12 @@
  *
  */
 template <class I, class T>
-void densetocsr(const I n_row,
-                const I n_col,
-                const T Mx[],
-                std::vector<I>* Ap,
-                std::vector<I>* Aj,
-                std::vector<T>* Ax)
+void dense_tocsr(const I n_row,
+                 const I n_col,
+                 const T Mx[],
+                 std::vector<I>* Ap,
+                 std::vector<I>* Aj,
+                 std::vector<T>* Ax)
 {
   const T* x_ptr = Mx;
 
@@ -852,7 +976,7 @@
 }
 
 template<class I, class T>
-void sort_csr_indices(const I n_row,
+void csr_sort_indices(const I n_row,
                       const I n_col,
                       const I Ap[], 
                       I       Aj[], 
@@ -933,33 +1057,35 @@
 }
 
 
+
+
+
 /*
  * Derived methods
  */
-
 template <class I, class T>
-void extract_csc_diagonal(const I n_row,
-                          const I n_col, 
-	                      const I Ap[], 
-	                      const I Aj[], 
-	                      const T Ax[],
-	                            T Yx[])
-{  extract_csr_diagonal(n_col, n_row, Ap, Aj, Ax, Yx); }
+void csc_diagonal(const I n_row,
+                  const I n_col, 
+	              const I Ap[], 
+	              const I Aj[], 
+	              const T Ax[],
+	                    T Yx[])
+{ csr_diagonal(n_col, n_row, Ap, Aj, Ax, Yx); }
 
 
 template <class I, class T>
-void csctocsr(const I n_row,
-              const I n_col, 
-              const I Ap[], 
-              const I Ai[], 
-              const T Ax[],
-                    I Bp[],
-                    I Bj[],
-                    T Bx[])
-{ csrtocsc<I,T>(n_col,n_row,Ap,Ai,Ax,Bp,Bj,Bx); }
+void csc_tocsr(const I n_row,
+               const I n_col, 
+               const I Ap[], 
+               const I Ai[], 
+               const T Ax[],
+                     I Bp[],
+                     I Bj[],
+                     T Bx[])
+{ csr_tocsc<I,T>(n_col, n_row, Ap, Ai, Ax, Bp, Bj, Bx); }
 
 template <class I, class T>
-void csctocoo(const I n_row,
+void csc_tocoo(const I n_row,
               const I n_col, 
               const I Ap[], 
               const I Ai[], 
@@ -967,7 +1093,31 @@
               std::vector<I>* Bi,
               std::vector<I>* Bj,
               std::vector<T>* Bx)
-{ csrtocoo<I,T>(n_col,n_row,Ap,Ai,Ax,Bj,Bi,Bx); }
+{ csr_tocoo<I,T>(n_col, n_row, Ap, Ai, Ax, Bj, Bi, Bx); }
+    
+template <class I>
+void csc_matmat_pass1(const I n_row,
+                      const I n_col, 
+                      const I Ap[], 
+                      const I Ai[], 
+                      const I Bp[],
+                      const I Bi[],
+                            I Cp[])
+{ csr_matmat_pass1(n_col, n_row, Bp, Bi, Ap, Ai, Cp); }
+    
+template <class I, class T>
+void csc_matmat_pass2(const I n_row,
+      	              const I n_col, 
+      	              const I Ap[], 
+      	              const I Ai[], 
+      	              const T Ax[],
+      	              const I Bp[],
+      	              const I Bi[],
+      	              const T Bx[],
+      	                    I Cp[],
+      	                    I Ci[],
+      	                    T Cx[])
+{ csr_matmat_pass2(n_col, n_row, Bp, Bi, Bx, Ap, Ai, Ax, Cp, Ci, Cx); }
 
 template <class I, class T>
 void cscmucsc(const I n_row,
@@ -981,19 +1131,19 @@
               std::vector<I>* Cp,
               std::vector<I>* Ci,
               std::vector<T>* Cx)
-{ csrmucsr<I,T>(n_col,n_row,Bp,Bi,Bx,Ap,Ai,Ax,Cp,Ci,Cx); }
+{ csrmucsr<I,T>(n_col, n_row, Bp, Bi, Bx, Ap, Ai, Ax, Cp, Ci, Cx); }
 
 template<class I, class T>
-void cootocsc(const I n_row,
-      	      const I n_col,
-      	      const I NNZ,
-      	      const I Ai[],
-      	      const I Aj[],
-      	      const T Ax[],
-      	            I Bp[],
-      	            I Bi[],
-      	            T Bx[])
-{ cootocsr<I,T>(n_col,n_row,NNZ,Aj,Ai,Ax,Bp,Bi,Bx); }
+void coo_tocsc(const I n_row,
+      	       const I n_col,
+      	       const I nnz,
+      	       const I Ai[],
+      	       const I Aj[],
+      	       const T Ax[],
+      	             I Bp[],
+      	             I Bi[],
+      	             T Bx[])
+{ coo_tocsr<I,T>(n_col, n_row, nnz, Aj, Ai, Ax, Bp, Bi, Bx); }
 
 
 
@@ -1003,7 +1153,7 @@
                    const I Bp [], const I Bi [], const T Bx [],
                    std::vector<I>* Cp, std::vector<I>* Ci, std::vector<T>* Cx)
 {
-    csr_elmul_csr(n_col,n_row,Ap,Ai,Ax,Bp,Bi,Bx,Cp,Ci,Cx);
+    csr_elmul_csr(n_col, n_row, Ap, Ai, Ax, Bp, Bi, Bx, Cp, Ci, Cx);
 }
 
 template <class I, class T>
@@ -1012,7 +1162,7 @@
                    const I Bp [], const I Bi [], const T Bx [],
                    std::vector<I>* Cp, std::vector<I>* Ci, std::vector<T>* Cx)
 {
-    csr_eldiv_csr(n_col,n_row,Ap,Ai,Ax,Bp,Bi,Bx,Cp,Ci,Cx);
+    csr_eldiv_csr(n_col, n_row, Ap, Ai, Ax, Bp, Bi, Bx, Cp, Ci, Cx);
 }
 
 
@@ -1022,7 +1172,7 @@
                   const I Bp [], const I Bi [], const T Bx [],
                   std::vector<I>* Cp, std::vector<I>* Ci, std::vector<T>* Cx)
 {
-    csr_plus_csr(n_col,n_row,Ap,Ai,Ax,Bp,Bi,Bx,Cp,Ci,Cx);
+    csr_plus_csr(n_col, n_row, Ap, Ai, Ax, Bp, Bi, Bx, Cp, Ci, Cx);
 }
 
 template <class I, class T>
@@ -1031,7 +1181,7 @@
                    const I Bp [], const I Bi [], const T Bx [],
                    std::vector<I>* Cp, std::vector<I>* Ci, std::vector<T>* Cx)
 {
-    csr_minus_csr(n_col,n_row,Ap,Ai,Ax,Bp,Bi,Bx,Cp,Ci,Cx);
+    csr_minus_csr(n_col, n_row, Ap, Ai, Ax, Bp, Bi, Bx, Cp, Ci, Cx);
 }
 
 
@@ -1042,15 +1192,15 @@
                               I Ap[], 
                               I Ai[], 
                               T Ax[])
-{ sum_csr_duplicates(n_col,n_row,Ap,Ai,Ax); }
+{ sum_csr_duplicates(n_col, n_row, Ap, Ai, Ax); }
 
 
 template<class I, class T>
-void sort_csc_indices(const I n_row,
+void csc_sort_indices(const I n_row,
                       const I n_col,
                       const I Ap[], 
                       I       Ai[], 
                       T       Ax[])
-{ sort_csr_indices(n_col,n_row,Ap,Ai,Ax); }
+{ csr_sort_indices(n_col, n_row, Ap, Ai, Ax); }
 
 #endif

Modified: trunk/scipy/sparse/sparsetools/sparsetools.i
===================================================================
--- trunk/scipy/sparse/sparsetools/sparsetools.i	2007-12-15 05:38:59 UTC (rev 3663)
+++ trunk/scipy/sparse/sparsetools/sparsetools.i	2007-12-15 05:59:12 UTC (rev 3664)
@@ -33,6 +33,9 @@
     const ctype Bp [ ],
     const ctype Bi [ ],	
     const ctype Bj [ ],
+    const ctype Cp [ ],
+    const ctype Ci [ ],	
+    const ctype Cj [ ],
     const ctype offsets [ ]
 };
 %enddef
@@ -41,6 +44,7 @@
 %apply ctype * IN_ARRAY1 {
     const ctype Ax [ ],
     const ctype Bx [ ],
+    const ctype Cx [ ],
     const ctype Xx [ ],
     const ctype Yx [ ]
 };
@@ -94,7 +98,10 @@
   ctype Aj [ ],
   ctype Bp [ ],
   ctype Bi [ ],
-  ctype Bj [ ]
+  ctype Bj [ ],
+  ctype Cp [ ],
+  ctype Ci [ ],
+  ctype Cj [ ]
 };
 %enddef
 
@@ -102,6 +109,7 @@
 %apply ctype * INPLACE_ARRAY {
   ctype Ax [ ],
   ctype Bx [ ],
+  ctype Cx [ ],
   ctype Yx [ ]
 };
 %enddef
@@ -175,15 +183,15 @@
 /*
  *  diag(CSR) and diag(CSC)
  */
-INSTANTIATE_ALL(extract_csr_diagonal)
-INSTANTIATE_ALL(extract_csc_diagonal)
+INSTANTIATE_ALL(csr_diagonal)
+INSTANTIATE_ALL(csc_diagonal)
 
 
 /*
  *  CSR->CSC or CSC->CSR or CSR = CSR^T or CSC = CSC^T
  */
-INSTANTIATE_ALL(csrtocsc)
-INSTANTIATE_ALL(csctocsr)
+INSTANTIATE_ALL(csr_tocsc)
+INSTANTIATE_ALL(csc_tocsr)
 
 /*
  * CSR<->COO and CSC<->COO
@@ -191,21 +199,25 @@
 %template(expandptr)   expandptr<int>;
 /*INSTANTIATE_ALL(csrtocoo)*/
 /*INSTANTIATE_ALL(csctocoo)*/
-INSTANTIATE_ALL(cootocsr)
-INSTANTIATE_ALL(cootocsc)
+INSTANTIATE_ALL(coo_tocsr)
+INSTANTIATE_ALL(coo_tocsc)
 
 
 /*
  * CSR*CSR and CSC*CSC
  */
-INSTANTIATE_ALL(csrmucsr)
-INSTANTIATE_ALL(cscmucsc)
+%template(csr_matmat_pass1)   csr_matmat_pass1<int>;
+%template(csc_matmat_pass1)   csc_matmat_pass1<int>;
+INSTANTIATE_ALL(csr_matmat_pass2)
+INSTANTIATE_ALL(csc_matmat_pass2)
+/*INSTANTIATE_ALL(csrmucsr)*/
+/*INSTANTIATE_ALL(cscmucsc)*/
 
 /*
  * CSR*x and CSC*x
  */
-INSTANTIATE_ALL(csrmux)
-INSTANTIATE_ALL(cscmux)
+INSTANTIATE_ALL(csr_matvec)
+INSTANTIATE_ALL(csc_matvec)
 
 /*
  * CSR (binary op) CSR and CSC (binary op) CSC
@@ -225,19 +237,19 @@
 /*
  * spdiags->CSC
  */
-INSTANTIATE_ALL(spdiags)
+/*INSTANTIATE_ALL(spdiags)*/
 
 /*
  * CSR<->Dense
  */
-INSTANTIATE_ALL(csrtodense)
+/*INSTANTIATE_ALL(csr_todense)*/
 /*INSTANTIATE_ALL(densetocsr)*/ 
 
 /*
  * Sort CSR/CSC indices.
  */
-INSTANTIATE_ALL(sort_csr_indices)
-INSTANTIATE_ALL(sort_csc_indices)
+INSTANTIATE_ALL(csr_sort_indices)
+INSTANTIATE_ALL(csc_sort_indices)
 
 
 /*

Modified: trunk/scipy/sparse/sparsetools/sparsetools.py
===================================================================
--- trunk/scipy/sparse/sparsetools/sparsetools.py	2007-12-15 05:38:59 UTC (rev 3663)
+++ trunk/scipy/sparse/sparsetools/sparsetools.py	2007-12-15 05:59:12 UTC (rev 3664)
@@ -53,250 +53,252 @@
   """expandptr(int n_row, int Ap, int Bi)"""
   return _sparsetools.expandptr(*args)
 
+def csr_matmat_pass1(*args):
+  """
+    csr_matmat_pass1(int n_row, int n_col, int Ap, int Aj, int Bp, int Bj, 
+        int Cp)
+    """
+  return _sparsetools.csr_matmat_pass1(*args)
 
-def extract_csr_diagonal(*args):
+def csc_matmat_pass1(*args):
   """
-    extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, signed char Ax, 
+    csc_matmat_pass1(int n_row, int n_col, int Ap, int Ai, int Bp, int Bi, 
+        int Cp)
+    """
+  return _sparsetools.csc_matmat_pass1(*args)
+
+
+def csr_diagonal(*args):
+  """
+    csr_diagonal(int n_row, int n_col, int Ap, int Aj, signed char Ax, 
         signed char Yx)
-    extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, 
+    csr_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, 
         unsigned char Yx)
-    extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, short Ax, short Yx)
-    extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, int Ax, int Yx)
-    extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, long long Ax, 
+    csr_diagonal(int n_row, int n_col, int Ap, int Aj, short Ax, short Yx)
+    csr_diagonal(int n_row, int n_col, int Ap, int Aj, int Ax, int Yx)
+    csr_diagonal(int n_row, int n_col, int Ap, int Aj, long long Ax, 
         long long Yx)
-    extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, float Ax, float Yx)
-    extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, double Ax, double Yx)
-    extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, 
+    csr_diagonal(int n_row, int n_col, int Ap, int Aj, float Ax, float Yx)
+    csr_diagonal(int n_row, int n_col, int Ap, int Aj, double Ax, double Yx)
+    csr_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, 
         npy_cfloat_wrapper Yx)
-    extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, 
+    csr_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, 
         npy_cdouble_wrapper Yx)
     """
-  return _sparsetools.extract_csr_diagonal(*args)
+  return _sparsetools.csr_diagonal(*args)
 
-def extract_csc_diagonal(*args):
+def csc_diagonal(*args):
   """
-    extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, signed char Ax, 
+    csc_diagonal(int n_row, int n_col, int Ap, int Aj, signed char Ax, 
         signed char Yx)
-    extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, 
+    csc_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, 
         unsigned char Yx)
-    extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, short Ax, short Yx)
-    extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, int Ax, int Yx)
-    extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, long long Ax, 
+    csc_diagonal(int n_row, int n_col, int Ap, int Aj, short Ax, short Yx)
+    csc_diagonal(int n_row, int n_col, int Ap, int Aj, int Ax, int Yx)
+    csc_diagonal(int n_row, int n_col, int Ap, int Aj, long long Ax, 
         long long Yx)
-    extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, float Ax, float Yx)
-    extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, double Ax, double Yx)
-    extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, 
+    csc_diagonal(int n_row, int n_col, int Ap, int Aj, float Ax, float Yx)
+    csc_diagonal(int n_row, int n_col, int Ap, int Aj, double Ax, double Yx)
+    csc_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, 
         npy_cfloat_wrapper Yx)
-    extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, 
+    csc_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, 
         npy_cdouble_wrapper Yx)
     """
-  return _sparsetools.extract_csc_diagonal(*args)
+  return _sparsetools.csc_diagonal(*args)
 
-def csrtocsc(*args):
+def csr_tocsc(*args):
   """
-    csrtocsc(int n_row, int n_col, int Ap, int Aj, signed char Ax, 
+    csr_tocsc(int n_row, int n_col, int Ap, int Aj, signed char Ax, 
         int Bp, int Bi, signed char Bx)
-    csrtocsc(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, 
+    csr_tocsc(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, 
         int Bp, int Bi, unsigned char Bx)
-    csrtocsc(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, 
+    csr_tocsc(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, 
         int Bi, short Bx)
-    csrtocsc(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, 
+    csr_tocsc(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, 
         int Bi, int Bx)
-    csrtocsc(int n_row, int n_col, int Ap, int Aj, long long Ax, 
+    csr_tocsc(int n_row, int n_col, int Ap, int Aj, long long Ax, 
         int Bp, int Bi, long long Bx)
-    csrtocsc(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, 
+    csr_tocsc(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, 
         int Bi, float Bx)
-    csrtocsc(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, 
+    csr_tocsc(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, 
         int Bi, double Bx)
-    csrtocsc(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, 
+    csr_tocsc(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, 
         int Bp, int Bi, npy_cfloat_wrapper Bx)
-    csrtocsc(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, 
+    csr_tocsc(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, 
         int Bp, int Bi, npy_cdouble_wrapper Bx)
     """
-  return _sparsetools.csrtocsc(*args)
+  return _sparsetools.csr_tocsc(*args)
 
-def csctocsr(*args):
+def csc_tocsr(*args):
   """
-    csctocsr(int n_row, int n_col, int Ap, int Ai, signed char Ax, 
+    csc_tocsr(int n_row, int n_col, int Ap, int Ai, signed char Ax, 
         int Bp, int Bj, signed char Bx)
-    csctocsr(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, 
+    csc_tocsr(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, 
         int Bp, int Bj, unsigned char Bx)
-    csctocsr(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, 
+    csc_tocsr(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, 
         int Bj, short Bx)
-    csctocsr(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, 
+    csc_tocsr(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, 
         int Bj, int Bx)
-    csctocsr(int n_row, int n_col, int Ap, int Ai, long long Ax, 
+    csc_tocsr(int n_row, int n_col, int Ap, int Ai, long long Ax, 
         int Bp, int Bj, long long Bx)
-    csctocsr(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, 
+    csc_tocsr(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, 
         int Bj, float Bx)
-    csctocsr(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, 
+    csc_tocsr(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, 
         int Bj, double Bx)
-    csctocsr(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, 
+    csc_tocsr(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, 
         int Bp, int Bj, npy_cfloat_wrapper Bx)
-    csctocsr(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, 
+    csc_tocsr(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, 
         int Bp, int Bj, npy_cdouble_wrapper Bx)
     """
-  return _sparsetools.csctocsr(*args)
+  return _sparsetools.csc_tocsr(*args)
 
-def cootocsr(*args):
+def coo_tocsr(*args):
   """
-    cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, signed char Ax, 
+    coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, signed char Ax, 
         int Bp, int Bj, signed char Bx)
-    cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, unsigned char Ax, 
+    coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned char Ax, 
         int Bp, int Bj, unsigned char Bx)
-    cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, short Ax, 
+    coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, short Ax, 
         int Bp, int Bj, short Bx)
-    cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, int Ax, 
+    coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, int Ax, 
         int Bp, int Bj, int Bx)
-    cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, long long Ax, 
+    coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, long long Ax, 
         int Bp, int Bj, long long Bx)
-    cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, float Ax, 
+    coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, float Ax, 
         int Bp, int Bj, float Bx)
-    cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, double Ax, 
+    coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, double Ax, 
         int Bp, int Bj, double Bx)
-    cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cfloat_wrapper Ax, 
+    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)
-    cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cdouble_wrapper Ax, 
+    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)
     """
-  return _sparsetools.cootocsr(*args)
+  return _sparsetools.coo_tocsr(*args)
 
-def cootocsc(*args):
+def coo_tocsc(*args):
   """
-    cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, signed char Ax, 
+    coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, signed char Ax, 
         int Bp, int Bi, signed char Bx)
-    cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, unsigned char Ax, 
+    coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned char Ax, 
         int Bp, int Bi, unsigned char Bx)
-    cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, short Ax, 
+    coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, short Ax, 
         int Bp, int Bi, short Bx)
-    cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, int Ax, 
+    coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, int Ax, 
         int Bp, int Bi, int Bx)
-    cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, long long Ax, 
+    coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, long long Ax, 
         int Bp, int Bi, long long Bx)
-    cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, float Ax, 
+    coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, float Ax, 
         int Bp, int Bi, float Bx)
-    cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, double Ax, 
+    coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, double Ax, 
         int Bp, int Bi, double Bx)
-    cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cfloat_wrapper Ax, 
+    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)
-    cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cdouble_wrapper Ax, 
+    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)
     """
-  return _sparsetools.cootocsc(*args)
+  return _sparsetools.coo_tocsc(*args)
 
-def csrmucsr(*args):
+def csr_matmat_pass2(*args):
   """
-    csrmucsr(int n_row, int n_col, int Ap, int Aj, signed char Ax, 
-        int Bp, int Bj, signed char Bx, std::vector<(int)> Cp, 
-        std::vector<(int)> Cj, std::vector<(signed char)> Cx)
-    csrmucsr(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, 
-        int Bp, int Bj, unsigned char Bx, std::vector<(int)> Cp, 
-        std::vector<(int)> Cj, std::vector<(unsigned char)> Cx)
-    csrmucsr(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, 
-        int Bj, short Bx, std::vector<(int)> Cp, 
-        std::vector<(int)> Cj, std::vector<(short)> Cx)
-    csrmucsr(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, 
-        int Bj, int Bx, std::vector<(int)> Cp, std::vector<(int)> Cj, 
-        std::vector<(int)> Cx)
-    csrmucsr(int n_row, int n_col, int Ap, int Aj, long long Ax, 
-        int Bp, int Bj, long long Bx, std::vector<(int)> Cp, 
-        std::vector<(int)> Cj, std::vector<(long long)> Cx)
-    csrmucsr(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, 
-        int Bj, float Bx, std::vector<(int)> Cp, 
-        std::vector<(int)> Cj, std::vector<(float)> Cx)
-    csrmucsr(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, 
-        int Bj, double Bx, std::vector<(int)> Cp, 
-        std::vector<(int)> Cj, std::vector<(double)> Cx)
-    csrmucsr(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, 
+    csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, signed char Ax, 
+        int Bp, int Bj, signed char Bx, int Cp, int Cj, 
+        signed char Cx)
+    csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, 
+        int Bp, int Bj, unsigned char Bx, int Cp, 
+        int Cj, unsigned char Cx)
+    csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, 
+        int Bj, short Bx, int Cp, int Cj, short Cx)
+    csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, 
+        int Bj, int Bx, int Cp, int Cj, int Cx)
+    csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, long long Ax, 
+        int Bp, int Bj, long long Bx, int Cp, int Cj, 
+        long long Cx)
+    csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, 
+        int Bj, float Bx, int Cp, int Cj, float Cx)
+    csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, 
+        int Bj, double Bx, int Cp, int Cj, double Cx)
+    csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, 
         int Bp, int Bj, npy_cfloat_wrapper Bx, 
-        std::vector<(int)> Cp, std::vector<(int)> Cj, 
-        std::vector<(npy_cfloat_wrapper)> Cx)
-    csrmucsr(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, 
+        int Cp, int Cj, npy_cfloat_wrapper Cx)
+    csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, 
         int Bp, int Bj, npy_cdouble_wrapper Bx, 
-        std::vector<(int)> Cp, std::vector<(int)> Cj, 
-        std::vector<(npy_cdouble_wrapper)> Cx)
+        int Cp, int Cj, npy_cdouble_wrapper Cx)
     """
-  return _sparsetools.csrmucsr(*args)
+  return _sparsetools.csr_matmat_pass2(*args)
 
-def cscmucsc(*args):
+def csc_matmat_pass2(*args):
   """
-    cscmucsc(int n_row, int n_col, int Ap, int Ai, signed char Ax, 
-        int Bp, int Bi, signed char Bx, std::vector<(int)> Cp, 
-        std::vector<(int)> Ci, std::vector<(signed char)> Cx)
-    cscmucsc(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, 
-        int Bp, int Bi, unsigned char Bx, std::vector<(int)> Cp, 
-        std::vector<(int)> Ci, std::vector<(unsigned char)> Cx)
-    cscmucsc(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, 
-        int Bi, short Bx, std::vector<(int)> Cp, 
-        std::vector<(int)> Ci, std::vector<(short)> Cx)
-    cscmucsc(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, 
-        int Bi, int Bx, std::vector<(int)> Cp, std::vector<(int)> Ci, 
-        std::vector<(int)> Cx)
-    cscmucsc(int n_row, int n_col, int Ap, int Ai, long long Ax, 
-        int Bp, int Bi, long long Bx, std::vector<(int)> Cp, 
-        std::vector<(int)> Ci, std::vector<(long long)> Cx)
-    cscmucsc(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, 
-        int Bi, float Bx, std::vector<(int)> Cp, 
-        std::vector<(int)> Ci, std::vector<(float)> Cx)
-    cscmucsc(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, 
-        int Bi, double Bx, std::vector<(int)> Cp, 
-        std::vector<(int)> Ci, std::vector<(double)> Cx)
-    cscmucsc(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, 
+    csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, signed char Ax, 
+        int Bp, int Bi, signed char Bx, int Cp, int Ci, 
+        signed char Cx)
+    csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, 
+        int Bp, int Bi, unsigned char Bx, int Cp, 
+        int Ci, unsigned char Cx)
+    csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, 
+        int Bi, short Bx, int Cp, int Ci, short Cx)
+    csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, 
+        int Bi, int Bx, int Cp, int Ci, int Cx)
+    csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, long long Ax, 
+        int Bp, int Bi, long long Bx, int Cp, int Ci, 
+        long long Cx)
+    csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, 
+        int Bi, float Bx, int Cp, int Ci, float Cx)
+    csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, 
+        int Bi, double Bx, int Cp, int Ci, double Cx)
+    csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, 
         int Bp, int Bi, npy_cfloat_wrapper Bx, 
-        std::vector<(int)> Cp, std::vector<(int)> Ci, 
-        std::vector<(npy_cfloat_wrapper)> Cx)
-    cscmucsc(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, 
+        int Cp, int Ci, npy_cfloat_wrapper Cx)
+    csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, 
         int Bp, int Bi, npy_cdouble_wrapper Bx, 
-        std::vector<(int)> Cp, std::vector<(int)> Ci, 
-        std::vector<(npy_cdouble_wrapper)> Cx)
+        int Cp, int Ci, npy_cdouble_wrapper Cx)
     """
-  return _sparsetools.cscmucsc(*args)
+  return _sparsetools.csc_matmat_pass2(*args)
 
-def csrmux(*args):
+def csr_matvec(*args):
   """
-    csrmux(int n_row, int n_col, int Ap, int Aj, signed char Ax, 
+    csr_matvec(int n_row, int n_col, int Ap, int Aj, signed char Ax, 
         signed char Xx, signed char Yx)
-    csrmux(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, 
+    csr_matvec(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, 
         unsigned char Xx, unsigned char Yx)
-    csrmux(int n_row, int n_col, int Ap, int Aj, short Ax, short Xx, 
+    csr_matvec(int n_row, int n_col, int Ap, int Aj, short Ax, short Xx, 
         short Yx)
-    csrmux(int n_row, int n_col, int Ap, int Aj, int Ax, int Xx, 
+    csr_matvec(int n_row, int n_col, int Ap, int Aj, int Ax, int Xx, 
         int Yx)
-    csrmux(int n_row, int n_col, int Ap, int Aj, long long Ax, 
+    csr_matvec(int n_row, int n_col, int Ap, int Aj, long long Ax, 
         long long Xx, long long Yx)
-    csrmux(int n_row, int n_col, int Ap, int Aj, float Ax, float Xx, 
+    csr_matvec(int n_row, int n_col, int Ap, int Aj, float Ax, float Xx, 
         float Yx)
-    csrmux(int n_row, int n_col, int Ap, int Aj, double Ax, double Xx, 
+    csr_matvec(int n_row, int n_col, int Ap, int Aj, double Ax, double Xx, 
         double Yx)
-    csrmux(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, 
+    csr_matvec(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, 
         npy_cfloat_wrapper Xx, npy_cfloat_wrapper Yx)
-    csrmux(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, 
+    csr_matvec(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, 
         npy_cdouble_wrapper Xx, npy_cdouble_wrapper Yx)
     """
-  return _sparsetools.csrmux(*args)
+  return _sparsetools.csr_matvec(*args)
 
-def cscmux(*args):
+def csc_matvec(*args):
   """
-    cscmux(int n_row, int n_col, int Ap, int Ai, signed char Ax, 
+    csc_matvec(int n_row, int n_col, int Ap, int Ai, signed char Ax, 
         signed char Xx, signed char Yx)
-    cscmux(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, 
+    csc_matvec(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, 
         unsigned char Xx, unsigned char Yx)
-    cscmux(int n_row, int n_col, int Ap, int Ai, short Ax, short Xx, 
+    csc_matvec(int n_row, int n_col, int Ap, int Ai, short Ax, short Xx, 
         short Yx)
-    cscmux(int n_row, int n_col, int Ap, int Ai, int Ax, int Xx, 
+    csc_matvec(int n_row, int n_col, int Ap, int Ai, int Ax, int Xx, 
         int Yx)
-    cscmux(int n_row, int n_col, int Ap, int Ai, long long Ax, 
+    csc_matvec(int n_row, int n_col, int Ap, int Ai, long long Ax, 
         long long Xx, long long Yx)
-    cscmux(int n_row, int n_col, int Ap, int Ai, float Ax, float Xx, 
+    csc_matvec(int n_row, int n_col, int Ap, int Ai, float Ax, float Xx, 
         float Yx)
-    cscmux(int n_row, int n_col, int Ap, int Ai, double Ax, double Xx, 
+    csc_matvec(int n_row, int n_col, int Ap, int Ai, double Ax, double Xx, 
         double Yx)
-    cscmux(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, 
+    csc_matvec(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, 
         npy_cfloat_wrapper Xx, npy_cfloat_wrapper Yx)
-    cscmux(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, 
+    csc_matvec(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, 
         npy_cdouble_wrapper Xx, npy_cdouble_wrapper Yx)
     """
-  return _sparsetools.cscmux(*args)
+  return _sparsetools.csc_matvec(*args)
 
 def csr_elmul_csr(*args):
   """
@@ -570,85 +572,34 @@
     """
   return _sparsetools.csc_minus_csc(*args)
 
-def spdiags(*args):
+def csr_sort_indices(*args):
   """
-    spdiags(int n_row, int n_col, int n_diag, int offsets, signed char diags, 
-        std::vector<(int)> Ap, std::vector<(int)> Ai, 
-        std::vector<(signed char)> Ax)
-    spdiags(int n_row, int n_col, int n_diag, int offsets, unsigned char diags, 
-        std::vector<(int)> Ap, std::vector<(int)> Ai, 
-        std::vector<(unsigned char)> Ax)
-    spdiags(int n_row, int n_col, int n_diag, int offsets, short diags, 
-        std::vector<(int)> Ap, std::vector<(int)> Ai, 
-        std::vector<(short)> Ax)
-    spdiags(int n_row, int n_col, int n_diag, int offsets, int diags, 
-        std::vector<(int)> Ap, std::vector<(int)> Ai, 
-        std::vector<(int)> Ax)
-    spdiags(int n_row, int n_col, int n_diag, int offsets, long long diags, 
-        std::vector<(int)> Ap, std::vector<(int)> Ai, 
-        std::vector<(long long)> Ax)
-    spdiags(int n_row, int n_col, int n_diag, int offsets, float diags, 
-        std::vector<(int)> Ap, std::vector<(int)> Ai, 
-        std::vector<(float)> Ax)
-    spdiags(int n_row, int n_col, int n_diag, int offsets, double diags, 
-        std::vector<(int)> Ap, std::vector<(int)> Ai, 
-        std::vector<(double)> Ax)
-    spdiags(int n_row, int n_col, int n_diag, int offsets, npy_cfloat_wrapper diags, 
-        std::vector<(int)> Ap, 
-        std::vector<(int)> Ai, std::vector<(npy_cfloat_wrapper)> Ax)
-    spdiags(int n_row, int n_col, int n_diag, int offsets, npy_cdouble_wrapper diags, 
-        std::vector<(int)> Ap, 
-        std::vector<(int)> Ai, std::vector<(npy_cdouble_wrapper)> Ax)
+    csr_sort_indices(int n_row, int n_col, int Ap, int Aj, signed char Ax)
+    csr_sort_indices(int n_row, int n_col, int Ap, int Aj, unsigned char Ax)
+    csr_sort_indices(int n_row, int n_col, int Ap, int Aj, short Ax)
+    csr_sort_indices(int n_row, int n_col, int Ap, int Aj, int Ax)
+    csr_sort_indices(int n_row, int n_col, int Ap, int Aj, long long Ax)
+    csr_sort_indices(int n_row, int n_col, int Ap, int Aj, float Ax)
+    csr_sort_indices(int n_row, int n_col, int Ap, int Aj, double Ax)
+    csr_sort_indices(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax)
+    csr_sort_indices(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax)
     """
-  return _sparsetools.spdiags(*args)
+  return _sparsetools.csr_sort_indices(*args)
 
-def csrtodense(*args):
+def csc_sort_indices(*args):
   """
-    csrtodense(int n_row, int n_col, int Ap, int Aj, signed char Ax, 
-        signed char Mx)
-    csrtodense(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, 
-        unsigned char Mx)
-    csrtodense(int n_row, int n_col, int Ap, int Aj, short Ax, short Mx)
-    csrtodense(int n_row, int n_col, int Ap, int Aj, int Ax, int Mx)
-    csrtodense(int n_row, int n_col, int Ap, int Aj, long long Ax, 
-        long long Mx)
-    csrtodense(int n_row, int n_col, int Ap, int Aj, float Ax, float Mx)
-    csrtodense(int n_row, int n_col, int Ap, int Aj, double Ax, double Mx)
-    csrtodense(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, 
-        npy_cfloat_wrapper Mx)
-    csrtodense(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, 
-        npy_cdouble_wrapper Mx)
+    csc_sort_indices(int n_row, int n_col, int Ap, int Ai, signed char Ax)
+    csc_sort_indices(int n_row, int n_col, int Ap, int Ai, unsigned char Ax)
+    csc_sort_indices(int n_row, int n_col, int Ap, int Ai, short Ax)
+    csc_sort_indices(int n_row, int n_col, int Ap, int Ai, int Ax)
+    csc_sort_indices(int n_row, int n_col, int Ap, int Ai, long long Ax)
+    csc_sort_indices(int n_row, int n_col, int Ap, int Ai, float Ax)
+    csc_sort_indices(int n_row, int n_col, int Ap, int Ai, double Ax)
+    csc_sort_indices(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax)
+    csc_sort_indices(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax)
     """
-  return _sparsetools.csrtodense(*args)
+  return _sparsetools.csc_sort_indices(*args)
 
-def sort_csr_indices(*args):
-  """
-    sort_csr_indices(int n_row, int n_col, int Ap, int Aj, signed char Ax)
-    sort_csr_indices(int n_row, int n_col, int Ap, int Aj, unsigned char Ax)
-    sort_csr_indices(int n_row, int n_col, int Ap, int Aj, short Ax)
-    sort_csr_indices(int n_row, int n_col, int Ap, int Aj, int Ax)
-    sort_csr_indices(int n_row, int n_col, int Ap, int Aj, long long Ax)
-    sort_csr_indices(int n_row, int n_col, int Ap, int Aj, float Ax)
-    sort_csr_indices(int n_row, int n_col, int Ap, int Aj, double Ax)
-    sort_csr_indices(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax)
-    sort_csr_indices(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax)
-    """
-  return _sparsetools.sort_csr_indices(*args)
-
-def sort_csc_indices(*args):
-  """
-    sort_csc_indices(int n_row, int n_col, int Ap, int Ai, signed char Ax)
-    sort_csc_indices(int n_row, int n_col, int Ap, int Ai, unsigned char Ax)
-    sort_csc_indices(int n_row, int n_col, int Ap, int Ai, short Ax)
-    sort_csc_indices(int n_row, int n_col, int Ap, int Ai, int Ax)
-    sort_csc_indices(int n_row, int n_col, int Ap, int Ai, long long Ax)
-    sort_csc_indices(int n_row, int n_col, int Ap, int Ai, float Ax)
-    sort_csc_indices(int n_row, int n_col, int Ap, int Ai, double Ax)
-    sort_csc_indices(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax)
-    sort_csc_indices(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax)
-    """
-  return _sparsetools.sort_csc_indices(*args)
-
 def sum_csr_duplicates(*args):
   """
     sum_csr_duplicates(int n_row, int n_col, int Ap, int Aj, signed char Ax)

Modified: trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx
===================================================================
--- trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx	2007-12-15 05:38:59 UTC (rev 3663)
+++ trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx	2007-12-15 05:59:12 UTC (rev 3664)
@@ -3080,7 +3080,7 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-SWIGINTERN PyObject *_wrap_extract_csr_diagonal__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csr_diagonal__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
@@ -3106,15 +3106,15 @@
   PyObject * obj4 = 0 ;
   PyObject * obj5 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_diagonal" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csr_diagonal" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_diagonal" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
   {
@@ -3152,7 +3152,7 @@
     if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
     arg6 = (signed char*) array_data(temp6);
   }
-  extract_csr_diagonal<int,signed char >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6);
+  csr_diagonal<int,signed char >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6);
   resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
@@ -3178,7 +3178,7 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_extract_csr_diagonal__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csr_diagonal__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
@@ -3204,15 +3204,15 @@
   PyObject * obj4 = 0 ;
   PyObject * obj5 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_diagonal" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csr_diagonal" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_diagonal" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
   {
@@ -3250,7 +3250,7 @@
     if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
     arg6 = (unsigned char*) array_data(temp6);
   }
-  extract_csr_diagonal<int,unsigned char >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6);
+  csr_diagonal<int,unsigned char >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6);
   resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
@@ -3276,7 +3276,7 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_extract_csr_diagonal__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csr_diagonal__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
@@ -3302,15 +3302,15 @@
   PyObject * obj4 = 0 ;
   PyObject * obj5 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_diagonal" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csr_diagonal" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_diagonal" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
   {
@@ -3348,7 +3348,7 @@
     if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
     arg6 = (short*) array_data(temp6);
   }
-  extract_csr_diagonal<int,short >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6);
+  csr_diagonal<int,short >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6);
   resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
@@ -3374,7 +3374,7 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_extract_csr_diagonal__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csr_diagonal__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
@@ -3400,15 +3400,15 @@
   PyObject * obj4 = 0 ;
   PyObject * obj5 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_diagonal" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csr_diagonal" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_diagonal" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
   {
@@ -3446,7 +3446,7 @@
     if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
     arg6 = (int*) array_data(temp6);
   }
-  extract_csr_diagonal<int,int >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6);
+  csr_diagonal<int,int >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6);
   resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
@@ -3472,7 +3472,7 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_extract_csr_diagonal__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csr_diagonal__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
@@ -3498,15 +3498,15 @@
   PyObject * obj4 = 0 ;
   PyObject * obj5 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_diagonal" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csr_diagonal" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_diagonal" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
   {
@@ -3544,7 +3544,7 @@
     if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
     arg6 = (long long*) array_data(temp6);
   }
-  extract_csr_diagonal<int,long long >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,arg6);
+  csr_diagonal<int,long long >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,arg6);
   resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
@@ -3570,7 +3570,7 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_extract_csr_diagonal__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csr_diagonal__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
@@ -3596,15 +3596,15 @@
   PyObject * obj4 = 0 ;
   PyObject * obj5 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_diagonal" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csr_diagonal" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_diagonal" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
   {
@@ -3642,7 +3642,7 @@
     if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
     arg6 = (float*) array_data(temp6);
   }
-  extract_csr_diagonal<int,float >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6);
+  csr_diagonal<int,float >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6);
   resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
@@ -3668,7 +3668,7 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_extract_csr_diagonal__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csr_diagonal__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
@@ -3694,15 +3694,15 @@
   PyObject * obj4 = 0 ;
   PyObject * obj5 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_diagonal" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csr_diagonal" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_diagonal" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
   {
@@ -3740,7 +3740,7 @@
     if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
     arg6 = (double*) array_data(temp6);
   }
-  extract_csr_diagonal<int,double >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6);
+  csr_diagonal<int,double >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6);
   resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
@@ -3766,7 +3766,7 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_extract_csr_diagonal__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csr_diagonal__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
@@ -3792,15 +3792,15 @@
   PyObject * obj4 = 0 ;
   PyObject * obj5 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_diagonal" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csr_diagonal" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_diagonal" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
   {
@@ -3838,7 +3838,7 @@
     if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
     arg6 = (npy_cfloat_wrapper*) array_data(temp6);
   }
-  extract_csr_diagonal<int,npy_cfloat_wrapper >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,arg6);
+  csr_diagonal<int,npy_cfloat_wrapper >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,arg6);
   resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
@@ -3864,7 +3864,7 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_extract_csr_diagonal__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csr_diagonal__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
@@ -3890,15 +3890,15 @@
   PyObject * obj4 = 0 ;
   PyObject * obj5 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_diagonal" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csr_diagonal" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_diagonal" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
   {
@@ -3936,7 +3936,7 @@
     if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
     arg6 = (npy_cdouble_wrapper*) array_data(temp6);
   }
-  extract_csr_diagonal<int,npy_cdouble_wrapper >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,arg6);
+  csr_diagonal<int,npy_cdouble_wrapper >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,arg6);
   resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
@@ -3962,7 +3962,7 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_extract_csr_diagonal(PyObject *self, PyObject *args) {
+SWIGINTERN PyObject *_wrap_csr_diagonal(PyObject *self, PyObject *args) {
   int argc;
   PyObject *argv[7];
   int ii;
@@ -4000,7 +4000,7 @@
                 _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_BYTE)) ? 1 : 0;
               }
               if (_v) {
-                return _wrap_extract_csr_diagonal__SWIG_1(self, args);
+                return _wrap_csr_diagonal__SWIG_1(self, args);
               }
             }
           }
@@ -4036,7 +4036,7 @@
                 _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_UBYTE)) ? 1 : 0;
               }
               if (_v) {
-                return _wrap_extract_csr_diagonal__SWIG_2(self, args);
+                return _wrap_csr_diagonal__SWIG_2(self, args);
               }
             }
           }
@@ -4072,7 +4072,7 @@
                 _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_SHORT)) ? 1 : 0;
               }
               if (_v) {
-                return _wrap_extract_csr_diagonal__SWIG_3(self, args);
+                return _wrap_csr_diagonal__SWIG_3(self, args);
               }
             }
           }
@@ -4108,7 +4108,7 @@
                 _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0;
               }
               if (_v) {
-                return _wrap_extract_csr_diagonal__SWIG_4(self, args);
+                return _wrap_csr_diagonal__SWIG_4(self, args);
               }
             }
           }
@@ -4144,7 +4144,7 @@
                 _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_LONGLONG)) ? 1 : 0;
               }
               if (_v) {
-                return _wrap_extract_csr_diagonal__SWIG_5(self, args);
+                return _wrap_csr_diagonal__SWIG_5(self, args);
               }
             }
           }
@@ -4180,7 +4180,7 @@
                 _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_FLOAT)) ? 1 : 0;
               }
               if (_v) {
-                return _wrap_extract_csr_diagonal__SWIG_6(self, args);
+                return _wrap_csr_diagonal__SWIG_6(self, args);
               }
             }
           }
@@ -4216,7 +4216,7 @@
                 _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_DOUBLE)) ? 1 : 0;
               }
               if (_v) {
-                return _wrap_extract_csr_diagonal__SWIG_7(self, args);
+                return _wrap_csr_diagonal__SWIG_7(self, args);
               }
             }
           }
@@ -4252,7 +4252,7 @@
                 _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_CFLOAT)) ? 1 : 0;
               }
               if (_v) {
-                return _wrap_extract_csr_diagonal__SWIG_8(self, args);
+                return _wrap_csr_diagonal__SWIG_8(self, args);
               }
             }
           }
@@ -4288,7 +4288,7 @@
                 _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_CDOUBLE)) ? 1 : 0;
               }
               if (_v) {
-                return _wrap_extract_csr_diagonal__SWIG_9(self, args);
+                return _wrap_csr_diagonal__SWIG_9(self, args);
               }
             }
           }
@@ -4298,12 +4298,12 @@
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'extract_csr_diagonal'.\n  Possible C/C++ prototypes are:\n""    extract_csr_diagonal<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],signed char [])\n""    extract_csr_diagonal<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],unsigned char [])\n""    extract_csr_diagonal<(int,short)>(int const,int const,int const [],int const [],short const [],short [])\n""    extract_csr_diagonal<(int,int)>(int const,int const,int const [],int const [],int const [],int [])\n""    extract_csr_diagonal<(int,long long)>(int const,int const,int const [],int const [],long long const [],long long [])\n""    extract_csr_diagonal<(int,float)>(int const,int const,int const [],int const [],float const [],float [])\n""    extract_csr_diagonal<(int,double)>(int const,int const,int const [],int const [],double const [],double [])\n""    extract_csr_diagonal<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper [])\n""    extract_csr_diagonal<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper [])\n");
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_diagonal'.\n  Possible C/C++ prototypes are:\n""    csr_diagonal<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],signed char [])\n""    csr_diagonal<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],unsigned char [])\n""    csr_diagonal<(int,short)>(int const,int const,int const [],int const [],short const [],short [])\n""    csr_diagonal<(int,int)>(int const,int const,int const [],int const [],int const [],int [])\n""    csr_diagonal<(int,long long)>(int const,int const,int const [],int const [],long long const [],long long [])\n""    csr_diagonal<(int,float)>(int const,int const,int const [],int const [],float const [],float [])\n""    csr_diagonal<(int,double)>(int const,int const,int const [],int const [],double const [],double [])\n""    csr_diagonal<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper [])\n""    csr_diagonal<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper [])\n");
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_extract_csc_diagonal__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csc_diagonal__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
@@ -4329,15 +4329,15 @@
   PyObject * obj4 = 0 ;
   PyObject * obj5 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_diagonal" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csc_diagonal" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_diagonal" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
   {
@@ -4375,7 +4375,7 @@
     if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
     arg6 = (signed char*) array_data(temp6);
   }
-  extract_csc_diagonal<int,signed char >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6);
+  csc_diagonal<int,signed char >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6);
   resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
@@ -4401,7 +4401,7 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_extract_csc_diagonal__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csc_diagonal__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
@@ -4427,15 +4427,15 @@
   PyObject * obj4 = 0 ;
   PyObject * obj5 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_diagonal" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csc_diagonal" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_diagonal" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
   {
@@ -4473,7 +4473,7 @@
     if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
     arg6 = (unsigned char*) array_data(temp6);
   }
-  extract_csc_diagonal<int,unsigned char >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6);
+  csc_diagonal<int,unsigned char >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6);
   resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
@@ -4499,7 +4499,7 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_extract_csc_diagonal__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csc_diagonal__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
@@ -4525,15 +4525,15 @@
   PyObject * obj4 = 0 ;
   PyObject * obj5 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_diagonal" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csc_diagonal" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_diagonal" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
   {
@@ -4571,7 +4571,7 @@
     if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
     arg6 = (short*) array_data(temp6);
   }
-  extract_csc_diagonal<int,short >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6);
+  csc_diagonal<int,short >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6);
   resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
@@ -4597,7 +4597,7 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_extract_csc_diagonal__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csc_diagonal__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
@@ -4623,15 +4623,15 @@
   PyObject * obj4 = 0 ;
   PyObject * obj5 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_diagonal" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csc_diagonal" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_diagonal" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
   {
@@ -4669,7 +4669,7 @@
     if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
     arg6 = (int*) array_data(temp6);
   }
-  extract_csc_diagonal<int,int >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6);
+  csc_diagonal<int,int >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6);
   resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
@@ -4695,7 +4695,7 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_extract_csc_diagonal__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csc_diagonal__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
@@ -4721,15 +4721,15 @@
   PyObject * obj4 = 0 ;
   PyObject * obj5 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_diagonal" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csc_diagonal" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_diagonal" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
   {
@@ -4767,7 +4767,7 @@
     if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
     arg6 = (long long*) array_data(temp6);
   }
-  extract_csc_diagonal<int,long long >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,arg6);
+  csc_diagonal<int,long long >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,arg6);
   resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
@@ -4793,7 +4793,7 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_extract_csc_diagonal__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csc_diagonal__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
@@ -4819,15 +4819,15 @@
   PyObject * obj4 = 0 ;
   PyObject * obj5 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_diagonal" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csc_diagonal" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_diagonal" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
   {
@@ -4865,7 +4865,7 @@
     if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
     arg6 = (float*) array_data(temp6);
   }
-  extract_csc_diagonal<int,float >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6);
+  csc_diagonal<int,float >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6);
   resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
@@ -4891,7 +4891,7 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_extract_csc_diagonal__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csc_diagonal__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
@@ -4917,15 +4917,15 @@
   PyObject * obj4 = 0 ;
   PyObject * obj5 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_diagonal" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csc_diagonal" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_diagonal" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
   {
@@ -4963,7 +4963,7 @@
     if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
     arg6 = (double*) array_data(temp6);
   }
-  extract_csc_diagonal<int,double >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6);
+  csc_diagonal<int,double >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6);
   resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
@@ -4989,7 +4989,7 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_extract_csc_diagonal__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csc_diagonal__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
@@ -5015,15 +5015,15 @@
   PyObject * obj4 = 0 ;
   PyObject * obj5 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_diagonal" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csc_diagonal" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_diagonal" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
   {
@@ -5061,7 +5061,7 @@
     if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
     arg6 = (npy_cfloat_wrapper*) array_data(temp6);
   }
-  extract_csc_diagonal<int,npy_cfloat_wrapper >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,arg6);
+  csc_diagonal<int,npy_cfloat_wrapper >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,arg6);
   resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
@@ -5087,7 +5087,7 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_extract_csc_diagonal__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csc_diagonal__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
@@ -5113,15 +5113,15 @@
   PyObject * obj4 = 0 ;
   PyObject * obj5 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_diagonal" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csc_diagonal" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_diagonal" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
   {
@@ -5159,7 +5159,7 @@
     if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
     arg6 = (npy_cdouble_wrapper*) array_data(temp6);
   }
-  extract_csc_diagonal<int,npy_cdouble_wrapper >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,arg6);
+  csc_diagonal<int,npy_cdouble_wrapper >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,arg6);
   resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
@@ -5185,7 +5185,7 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_extract_csc_diagonal(PyObject *self, PyObject *args) {
+SWIGINTERN PyObject *_wrap_csc_diagonal(PyObject *self, PyObject *args) {
   int argc;
   PyObject *argv[7];
   int ii;
@@ -5223,7 +5223,7 @@
                 _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_BYTE)) ? 1 : 0;
               }
               if (_v) {
-                return _wrap_extract_csc_diagonal__SWIG_1(self, args);
+                return _wrap_csc_diagonal__SWIG_1(self, args);
               }
             }
           }
@@ -5259,7 +5259,7 @@
                 _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_UBYTE)) ? 1 : 0;
               }
               if (_v) {
-                return _wrap_extract_csc_diagonal__SWIG_2(self, args);
+                return _wrap_csc_diagonal__SWIG_2(self, args);
               }
             }
           }
@@ -5295,7 +5295,7 @@
                 _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_SHORT)) ? 1 : 0;
               }
               if (_v) {
-                return _wrap_extract_csc_diagonal__SWIG_3(self, args);
+                return _wrap_csc_diagonal__SWIG_3(self, args);
               }
             }
           }
@@ -5331,7 +5331,7 @@
                 _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0;
               }
               if (_v) {
-                return _wrap_extract_csc_diagonal__SWIG_4(self, args);
+                return _wrap_csc_diagonal__SWIG_4(self, args);
               }
             }
           }
@@ -5367,7 +5367,7 @@
                 _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_LONGLONG)) ? 1 : 0;
               }
               if (_v) {
-                return _wrap_extract_csc_diagonal__SWIG_5(self, args);
+                return _wrap_csc_diagonal__SWIG_5(self, args);
               }
             }
           }
@@ -5403,7 +5403,7 @@
                 _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_FLOAT)) ? 1 : 0;
               }
               if (_v) {
-                return _wrap_extract_csc_diagonal__SWIG_6(self, args);
+                return _wrap_csc_diagonal__SWIG_6(self, args);
               }
             }
           }
@@ -5439,7 +5439,7 @@
                 _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_DOUBLE)) ? 1 : 0;
               }
               if (_v) {
-                return _wrap_extract_csc_diagonal__SWIG_7(self, args);
+                return _wrap_csc_diagonal__SWIG_7(self, args);
               }
             }
           }
@@ -5475,7 +5475,7 @@
                 _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_CFLOAT)) ? 1 : 0;
               }
               if (_v) {
-                return _wrap_extract_csc_diagonal__SWIG_8(self, args);
+                return _wrap_csc_diagonal__SWIG_8(self, args);
               }
             }
           }
@@ -5511,7 +5511,7 @@
                 _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_CDOUBLE)) ? 1 : 0;
               }
               if (_v) {
-                return _wrap_extract_csc_diagonal__SWIG_9(self, args);
+                return _wrap_csc_diagonal__SWIG_9(self, args);
               }
             }
           }
@@ -5521,12 +5521,12 @@
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'extract_csc_diagonal'.\n  Possible C/C++ prototypes are:\n""    extract_csc_diagonal<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],signed char [])\n""    extract_csc_diagonal<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],unsigned char [])\n""    extract_csc_diagonal<(int,short)>(int const,int const,int const [],int const [],short const [],short [])\n""    extract_csc_diagonal<(int,int)>(int const,int const,int const [],int const [],int const [],int [])\n""    extract_csc_diagonal<(int,long long)>(int const,int const,int const [],int const [],long long const [],long long [])\n""    extract_csc_diagonal<(int,float)>(int const,int const,int const [],int const [],float const [],float [])\n""    extract_csc_diagonal<(int,double)>(int const,int const,int const [],int const [],double const [],double [])\n""    extract_csc_diagonal<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper [])\n""    extract_csc_diagonal<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper [])\n");
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_diagonal'.\n  Possible C/C++ prototypes are:\n""    csc_diagonal<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],signed char [])\n""    csc_diagonal<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],unsigned char [])\n""    csc_diagonal<(int,short)>(int const,int const,int const [],int const [],short const [],short [])\n""    csc_diagonal<(int,int)>(int const,int const,int const [],int const [],int const [],int [])\n""    csc_diagonal<(int,long long)>(int const,int const,int const [],int const [],long long const [],long long [])\n""    csc_diagonal<(int,float)>(int const,int const,int const [],int const [],float const [],float [])\n""    csc_diagonal<(int,double)>(int const,int const,int const [],int const [],double const [],double [])\n""    csc_diagonal<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper [])\n""    csc_diagonal<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper [])\n");
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_csrtocsc__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csr_tocsc__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
@@ -5558,15 +5558,15 @@
   PyObject * obj6 = 0 ;
   PyObject * obj7 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_tocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_tocsc" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csrtocsc" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_tocsc" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
   {
@@ -5614,7 +5614,7 @@
     if (!temp8  || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail;
     arg8 = (signed char*) array_data(temp8);
   }
-  csrtocsc<int,signed char >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6,arg7,arg8);
+  csr_tocsc<int,signed char >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6,arg7,arg8);
   resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
@@ -5640,7 +5640,7 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_csrtocsc__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csr_tocsc__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
@@ -5672,15 +5672,15 @@
   PyObject * obj6 = 0 ;
   PyObject * obj7 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_tocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_tocsc" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csrtocsc" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_tocsc" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
   {
@@ -5728,7 +5728,7 @@
     if (!temp8  || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail;
     arg8 = (unsigned char*) array_data(temp8);
   }
-  csrtocsc<int,unsigned char >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6,arg7,arg8);
+  csr_tocsc<int,unsigned char >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6,arg7,arg8);
   resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
@@ -5754,7 +5754,7 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_csrtocsc__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csr_tocsc__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
@@ -5786,15 +5786,15 @@
   PyObject * obj6 = 0 ;
   PyObject * obj7 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_tocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_tocsc" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csrtocsc" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_tocsc" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
   {
@@ -5842,7 +5842,7 @@
     if (!temp8  || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail;
     arg8 = (short*) array_data(temp8);
   }
-  csrtocsc<int,short >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6,arg7,arg8);
+  csr_tocsc<int,short >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6,arg7,arg8);
   resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
@@ -5868,7 +5868,7 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_csrtocsc__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csr_tocsc__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
@@ -5900,15 +5900,15 @@
   PyObject * obj6 = 0 ;
   PyObject * obj7 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_tocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_tocsc" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csrtocsc" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_tocsc" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
   {
@@ -5956,7 +5956,7 @@
     if (!temp8  || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail;
     arg8 = (int*) array_data(temp8);
   }
-  csrtocsc<int,int >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6,arg7,arg8);
+  csr_tocsc<int,int >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6,arg7,arg8);
   resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
@@ -5982,7 +5982,7 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_csrtocsc__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csr_tocsc__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
@@ -6014,15 +6014,15 @@
   PyObject * obj6 = 0 ;
   PyObject * obj7 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_tocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_tocsc" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1,