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

scipy-svn at scipy.org scipy-svn at scipy.org
Sun Dec 23 19:17:01 EST 2007


Author: wnbell
Date: 2007-12-23 18:16:09 -0600 (Sun, 23 Dec 2007)
New Revision: 3700

Modified:
   trunk/scipy/sparse/block.py
   trunk/scipy/sparse/compressed.py
   trunk/scipy/sparse/coo.py
   trunk/scipy/sparse/csc.py
   trunk/scipy/sparse/csr.py
   trunk/scipy/sparse/dia.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/tests/test_base.py
Log:
used sorted indices in arithmetic
working towards parallel sparsetools



Modified: trunk/scipy/sparse/block.py
===================================================================
--- trunk/scipy/sparse/block.py	2007-12-23 21:07:00 UTC (rev 3699)
+++ trunk/scipy/sparse/block.py	2007-12-24 00:16:09 UTC (rev 3700)
@@ -1,5 +1,7 @@
 """base class for block sparse formats"""
 
+from warnings import warn
+
 from numpy import zeros, intc, array, asarray, arange, diff, tile, rank, \
         prod, ravel
 
@@ -155,6 +157,9 @@
                     raise ValueError,'index pointer values must form a " \
                                         "non-decreasing sequence'
 
+        if not self.has_sorted_indices():
+            warn('Indices were not in sorted order. Sorting indices.')
+            self.sort_indices(check_first=False)
 
     def _get_blocksize(self):
         return self.data.shape[1:]
@@ -313,6 +318,12 @@
 
 
     # methods that modify the internal data structure
+    def has_sorted_indices(self):
+        """Determine whether the matrix has sorted indices
+        """
+        fn = sparsetools.csr_has_sorted_indices
+        return fn( len(self.indptr) - 1, self.indptr, self.indices)
+
     def sorted_indices(self):
         """Return a copy of this matrix with sorted indices
         """
@@ -324,7 +335,7 @@
         # typically the previous option is faster
         #return self.toother().toother()
 
-    def sort_indices(self):
+    def sort_indices(self, check_first=True):
         """Sort the indices of this matrix *in place*
         """
         from csr import csr_matrix
@@ -340,7 +351,7 @@
         proxy.sort_indices()
 
         self.data[:] = self.data[proxy.data]
-        self.indices = proxy.indices
+        self.indices[:] = proxy.indices
 
     def prune(self):
         """ Remove empty space after all non-zero elements.

Modified: trunk/scipy/sparse/compressed.py
===================================================================
--- trunk/scipy/sparse/compressed.py	2007-12-23 21:07:00 UTC (rev 3699)
+++ trunk/scipy/sparse/compressed.py	2007-12-24 00:16:09 UTC (rev 3700)
@@ -94,8 +94,7 @@
                 else:
                     self.shape = self._swap((major_dim,minor_dim))
 
-        #self.check_format(full_check=False)
-        self.check_format(full_check=True)
+        self.check_format(full_check=False)
 
     def getnnz(self):
         return self.indptr[-1]
@@ -122,9 +121,6 @@
                     False - basic check, O(1) operations
 
         """
-        #TODO does spmatrix take care of this?
-        self.shape = tuple([int(x) for x in self.shape])  # for floats etc.
-
         #use _swap to determine proper bounds
         major_name,minor_name = self._swap(('row','column'))
         major_dim,minor_dim = self._swap(self.shape)
@@ -179,9 +175,14 @@
                 if numpy.diff(self.indptr).min() < 0:
                     raise ValueError,'index pointer values must form a " \
                                         "non-decreasing sequence'
+        
+        #if not self.has_sorted_indices():
+        #    warn('Indices were not in sorted order.  Sorting indices.')
+        #    self.sort_indices()
+        #    assert(self.has_sorted_indices())
+        #TODO check for duplicates?
 
 
-
     def __add__(self,other):
         # First check if argument is a scalar
         if isscalarlike(other):
@@ -455,9 +456,8 @@
 
         The is an *in place* operation
         """
-        fn = getattr(sparsetools,self.format + '_sum_duplicates')
-
-        M,N = self.shape
+        fn = sparsetools.csr_sum_duplicates
+        M,N = self._swap(self.shape)
         fn( M, N, self.indptr, self.indices, self.data)
 
         self.prune() #nnz may have changed
@@ -465,9 +465,8 @@
     def has_sorted_indices(self):
         """Determine whether the matrix has sorted indices
         """
-        fn = sparsetools.has_sorted_indices
-        M,N = self._swap(self.shape)
-        return fn( M, N, self.indptr, self.indices)
+        fn = sparsetools.csr_has_sorted_indices
+        return fn( len(self.indptr) - 1, self.indptr, self.indices)
 
     def sorted_indices(self):
         """Return a copy of this matrix with sorted indices
@@ -480,18 +479,16 @@
         # typically the previous option is faster
         #return self.toother().toother()
 
-    def sort_indices(self):
+    def sort_indices(self,check_first=True):
         """Sort the indices of this matrix *in place*
         """
-        if self.has_sorted_indices(): 
-            #see if sorting can be avoided
+        #see if sorting can be avoided
+        if check_first and self.has_sorted_indices(): 
             return
 
-        fn = getattr(sparsetools,self.format + '_sort_indices')
+        fn = sparsetools.csr_sort_indices
+        fn( len(self.indptr) - 1, self.indptr, self.indices, self.data)
 
-        M,N = self.shape
-        fn( M, N, self.indptr, self.indices, self.data)
-
     def ensure_sorted_indices(self, inplace=False):
         """Return a copy of this matrix where the column indices are sorted
         """
@@ -544,8 +541,8 @@
             out_shape = self.shape
 
         #only necessary for sorted binopt method
-        #self.sort_indices()
-        #other.sort_indices()
+        self.sort_indices()
+        other.sort_indices()
 
         # e.g. csr_plus_csr, cscmucsc, etc.
         fn = getattr(sparsetools, self.format + op + self.format)

Modified: trunk/scipy/sparse/coo.py
===================================================================
--- trunk/scipy/sparse/coo.py	2007-12-23 21:07:00 UTC (rev 3699)
+++ trunk/scipy/sparse/coo.py	2007-12-24 00:16:09 UTC (rev 3700)
@@ -227,11 +227,12 @@
             indices = empty(self.nnz, dtype=intc)
             data    = empty(self.nnz, dtype=upcast(self.dtype))
 
-            coo_tocsc(self.shape[0], self.shape[1], self.nnz, \
-                      self.row, self.col, self.data, \
+            coo_tocsr(self.shape[1], self.shape[0], self.nnz, \
+                      self.col, self.row, self.data, \
                       indptr, indices, data)
 
             A = csc_matrix((data, indices, indptr), self.shape)
+            A.sort_indices()
             A.sum_duplicates()
             return A
 
@@ -255,7 +256,9 @@
                       indptr, indices, data)
 
             A = csr_matrix((data, indices, indptr), self.shape)
-            A.sum_duplicates()
+            if sum_duplicates:
+                A.sort_indices()
+                A.sum_duplicates()
             return A
     
 

Modified: trunk/scipy/sparse/csc.py
===================================================================
--- trunk/scipy/sparse/csc.py	2007-12-23 21:07:00 UTC (rev 3699)
+++ trunk/scipy/sparse/csc.py	2007-12-24 00:16:09 UTC (rev 3700)
@@ -7,7 +7,8 @@
 
 import numpy
 from numpy import array, matrix, asarray, asmatrix, zeros, rank, intc, \
-        empty, hstack, isscalar, ndarray, shape, searchsorted, where
+        empty, hstack, isscalar, ndarray, shape, searchsorted, where, \
+        concatenate
 
 from base import spmatrix,isspmatrix
 from sparsetools import csc_tocsr
@@ -172,18 +173,15 @@
     
             if len(indxs[0]) == 0:
                 #value not present
-                #TODO handle this with concatenation
-                self.data    = resize1d(self.data,    self.nnz + 1)
-                self.indices = resize1d(self.indices, self.nnz + 1)
+                newindx = self.indices[self.indptr[col]:self.indptr[col+1]].searchsorted(row)
+                newindx += self.indptr[col]
 
-                newindex = self.indptr[col]
-                self.data[newindex+1:]    = self.data[newindex:-1]
-                self.indices[newindex+1:] = self.indices[newindex:-1]
+                val = array([val],dtype=self.data.dtype)
+                row = array([row],dtype=self.indices.dtype)
+                self.data    = concatenate((self.data[:newindx],val,self.data[newindx:]))
+                self.indices = concatenate((self.indices[:newindx],row,self.indices[newindx:]))
 
-                self.data[newindex]   = val
-                self.indices[newindex] = row
                 self.indptr[col+1:] += 1
-
             elif len(indxs[0]) == 1:
                 #value already present
                 self.data[self.indptr[col]:self.indptr[col+1]][indxs[0]] = val

Modified: trunk/scipy/sparse/csr.py
===================================================================
--- trunk/scipy/sparse/csr.py	2007-12-23 21:07:00 UTC (rev 3699)
+++ trunk/scipy/sparse/csr.py	2007-12-24 00:16:09 UTC (rev 3700)
@@ -8,7 +8,8 @@
 
 import numpy
 from numpy import array, matrix, asarray, asmatrix, zeros, rank, intc, \
-        empty, hstack, isscalar, ndarray, shape, searchsorted, where
+        empty, hstack, isscalar, ndarray, shape, searchsorted, where, \
+        concatenate
 
 from base import spmatrix,isspmatrix
 from sparsetools import csr_tocsc
@@ -161,15 +162,14 @@
             indxs = numpy.where(col == self.indices[self.indptr[row]:self.indptr[row+1]])
             if len(indxs[0]) == 0:
                 #value not present
-                self.data    = resize1d(self.data, self.nnz + 1)
-                self.indices = resize1d(self.indices, self.nnz + 1)
+                newindx = self.indices[self.indptr[row]:self.indptr[row+1]].searchsorted(col)
+                newindx += self.indptr[row]
 
-                newindex = self.indptr[row]
-                self.data[newindex+1:]   = self.data[newindex:-1]
-                self.indices[newindex+1:] = self.indices[newindex:-1]
+                val = array([val],dtype=self.data.dtype)
+                col = array([col],dtype=self.indices.dtype)
+                self.data    = concatenate((self.data[:newindx],val,self.data[newindx:]))
+                self.indices = concatenate((self.indices[:newindx],col,self.indices[newindx:]))
 
-                self.data[newindex]   = val
-                self.indices[newindex] = col
                 self.indptr[row+1:] += 1
 
             elif len(indxs[0]) == 1:
@@ -178,7 +178,7 @@
             else:
                 raise IndexError, "row index occurs more than once"
 
-            self.check_format(full_check=False)
+            self.check_format(full_check=True)
         else:
             # We should allow slices here!
             raise IndexError, "invalid index"

Modified: trunk/scipy/sparse/dia.py
===================================================================
--- trunk/scipy/sparse/dia.py	2007-12-23 21:07:00 UTC (rev 3699)
+++ trunk/scipy/sparse/dia.py	2007-12-24 00:16:09 UTC (rev 3700)
@@ -224,7 +224,10 @@
         for i,k in enumerate(self.diags):
             row[i,:] -= k
         
-        mask = (row >= 0) & (row < self.shape[0]) & (col < self.shape[1])
+        mask  = (row >= 0) 
+        mask &= (row < self.shape[0]) 
+        mask &= (col < self.shape[1])
+        mask &= self.data != 0
         row,col,data = row[mask],col[mask],self.data[mask]
         row,col,data = row.reshape(-1),col.reshape(-1),data.reshape(-1)
        

Modified: trunk/scipy/sparse/sparsetools/sparsetools.h
===================================================================
--- trunk/scipy/sparse/sparsetools/sparsetools.h	2007-12-23 21:07:00 UTC (rev 3699)
+++ trunk/scipy/sparse/sparsetools/sparsetools.h	2007-12-24 00:16:09 UTC (rev 3700)
@@ -140,17 +140,15 @@
  *
  * Input Arguments:
  *   I  n_row           - number of rows in A
- *   I  n_col           - number of columns in A
  *   I  Ap[n_row+1]     - row pointer
  *   I  Aj[nnz(A)]      - column indices
  *   T  Ax[nnz(A)]      - nonzeros 
  *
  */
 template <class I>
-bool has_sorted_indices(const I n_row, 
-                        const I n_col,
-                        const I Ap[],
-                        const I Aj[])
+bool csr_has_sorted_indices(const I n_row, 
+                            const I Ap[],
+                            const I Aj[])
 {
   for(I i = 0; i < n_row; i++){
       for(I jj = Ap[i]; jj < Ap[i+1] - 1; jj++){
@@ -168,7 +166,6 @@
 
 template<class I, class T>
 void csr_sort_indices(const I n_row,
-                      const I n_col,
                       const I Ap[], 
                             I Aj[], 
                             T Ax[])
@@ -420,10 +417,18 @@
 
 
 
+template <class I, class T>
+bool is_nonzero_block(const T block[], const I blocksize){
+    for(I i = 0; i < blocksize; i++){
+        if(block[i] != 0){
+            return true;
+        }
+    }
+    return false;
+}
 
 
 
-
 template <class I, class T, class bin_op>
 void bsr_binop_bsr(const I n_brow, const I n_bcol, 
                    const I R,      const I C, 
@@ -434,76 +439,180 @@
                    std::vector<T>* Cx,
                    const bin_op& op)
 {
-    Cp->resize(n_brow + 1, 0);
+   //Method that works for unsorted indices
+    assert( csr_has_sorted_indices(n_brow,Ap,Aj) );
+    assert( csr_has_sorted_indices(n_brow,Bp,Bj) );
 
     const I RC = R*C;
+    T result[8*8];
+    //T zeros[8*8];
+    Cp->resize(n_brow + 1, 0);
+    (*Cp)[0] = 0;
 
-    std::vector<I>  next(n_bcol,-1);
-    std::vector<T> A_row(n_bcol*RC, 0);
-    std::vector<T> B_row(n_bcol*RC, 0);
-
     for(I i = 0; i < n_brow; i++){
-        I head   = -2;
-        I length =  0;
+        I A_pos = RC*Ap[i];
+        I B_pos = RC*Bp[i];
+        I A_end = RC*Ap[i+1];
+        I B_end = RC*Bp[i+1];
 
-        //add a row of A to A_row
-        for(I jj = Ap[i]; jj < Ap[i+1]; jj++){
-            I j = Aj[jj];
+        I A_j = Aj[A_pos];
+        I B_j = Bj[B_pos];
+            
+        //while not finished with either row
+        while(A_pos < A_end && B_pos < B_end){
+            if(A_j == B_j){
+                for(I n = 0; n < RC; n++){
+                    result[n] = op(Ax[A_pos + n],Bx[B_pos + n]);
+                }
+                //vec_binop(Ax[RC*A_pos],Bx[RC*B_pos],result,op);
 
-            for(I n = 0; n < RC; n++)
-                A_row[RC*j + n] += Ax[RC*jj + n];
+                if( is_nonzero_block(result,RC) ){
+                    Cj->push_back(A_j);
+                    for(I n = 0; n < RC; n++){
+                        Cx->push_back(result[n]);
+                    }
+                }
 
-            if(next[j] == -1){
-                next[j] = head;                        
-                head = j;
-                length++;
-            }
-        }
+                A_j = Aj[++A_pos]; 
+                B_j = Bj[++B_pos];
 
-        //add a row of B to B_row
-        for(I jj = Bp[i]; jj < Bp[i+1]; jj++){
-            I j = Bj[jj];
+            } else if (A_j < B_j) {
+                for(I n = 0; n < RC; n++){
+                    result[n] = op(Ax[A_pos + n],0);
+                }
 
-            for(I n = 0; n < RC; n++)
-                B_row[RC*j + n] += Bx[RC*jj + n];
+                if(is_nonzero_block(result,RC)){
+                    Cj->push_back(A_j);
+                    for(I n = 0; n < RC; n++){
+                        Cx->push_back(result[n]);
+                    }
+                }
 
-            if(next[j] == -1){
-                next[j] = head;                        
-                head = j;
-                length++;
+                A_j = Aj[++A_pos]; 
+
+            } else {
+                //B_j < A_j
+                for(I n = 0; n < RC; n++){
+                    result[n] = op(0,Bx[B_pos + n]);
+                }
+
+                if(is_nonzero_block(result,RC)){
+                    Cj->push_back(B_j);
+                    for(I n = 0; n < RC; n++){
+                        Cx->push_back(result[n]);
+                    }
+                }
+
+                B_j = Bj[++B_pos];
+
             }
         }
 
-
-        for(I jj = 0; jj < length; jj++){
-            bool nonzero_block = false;
+        //tail
+        while(A_pos < A_end){
             for(I n = 0; n < RC; n++){
-                T result = op(A_row[RC*head + n],B_row[RC*head + n]);
-                A_row[RC*head + n] = result;
-                if(result != 0)
-                    nonzero_block = true;
+                result[n] = op(Ax[A_pos + n],0);
             }
 
-
-            if(nonzero_block){
-                Cj->push_back(head);
+            if(is_nonzero_block(result,RC)){
+                Cj->push_back(A_j);
                 for(I n = 0; n < RC; n++){
-                    Cx->push_back(A_row[RC*head + n]);
+                    Cx->push_back(result[n]);
                 }
             }
 
+            A_j = Aj[++A_pos]; 
+        }
+        while(B_pos < B_end){
             for(I n = 0; n < RC; n++){
-                A_row[RC*head + n] = 0;
-                B_row[RC*head + n] = 0;
+                result[n] = op(0,Bx[B_pos + n]);
             }
 
-            I temp = head;                
-            head = next[head];
-            next[temp] = -1;
+            if(is_nonzero_block(result,RC)){
+                Cj->push_back(B_j);
+                for(I n = 0; n < RC; n++){
+                    Cx->push_back(result[n]);
+                }
+            }
+
+            B_j = Bj[++B_pos];
         }
+        (*Cp)[i+1] = Cx->size();
+    }
 
-        (*Cp)[i+1] = Cj->size();
-    }
+
+//   //Method that works for unsorted indices
+//
+//    Cp->resize(n_brow + 1, 0);
+//
+//    const I RC = R*C;
+//
+//    std::vector<I>  next(n_bcol,-1);
+//    std::vector<T> A_row(n_bcol*RC, 0);
+//    std::vector<T> B_row(n_bcol*RC, 0);
+//
+//    for(I i = 0; i < n_brow; i++){
+//        I head   = -2;
+//        I length =  0;
+//
+//        //add a row of A to A_row
+//        for(I jj = Ap[i]; jj < Ap[i+1]; jj++){
+//            I j = Aj[jj];
+//
+//            for(I n = 0; n < RC; n++)
+//                A_row[RC*j + n] += Ax[RC*jj + n];
+//
+//            if(next[j] == -1){
+//                next[j] = head;                        
+//                head = j;
+//                length++;
+//            }
+//        }
+//
+//        //add a row of B to B_row
+//        for(I jj = Bp[i]; jj < Bp[i+1]; jj++){
+//            I j = Bj[jj];
+//
+//            for(I n = 0; n < RC; n++)
+//                B_row[RC*j + n] += Bx[RC*jj + n];
+//
+//            if(next[j] == -1){
+//                next[j] = head;                        
+//                head = j;
+//                length++;
+//            }
+//        }
+//
+//
+//        for(I jj = 0; jj < length; jj++){
+//            bool nonzero_block = false;
+//            for(I n = 0; n < RC; n++){
+//                T result = op(A_row[RC*head + n],B_row[RC*head + n]);
+//                A_row[RC*head + n] = result;
+//                if(result != 0)
+//                    nonzero_block = true;
+//            }
+//
+//
+//            if(nonzero_block){
+//                Cj->push_back(head);
+//                for(I n = 0; n < RC; n++){
+//                    Cx->push_back(A_row[RC*head + n]);
+//                }
+//            }
+//
+//            for(I n = 0; n < RC; n++){
+//                A_row[RC*head + n] = 0;
+//                B_row[RC*head + n] = 0;
+//            }
+//
+//            I temp = head;                
+//            head = next[head];
+//            next[temp] = -1;
+//        }
+//
+//        (*Cp)[i+1] = Cj->size();
+//    }
 }
 
 /* element-wise binary operations*/
@@ -590,129 +699,131 @@
                    std::vector<T>* Cx,
                    const bin_op& op)
 {
+   //Method that works for sorted indices
+    assert( csr_has_sorted_indices(n_row,Ap,Aj) );
+    assert( csr_has_sorted_indices(n_row,Bp,Bj) );
+
+    Cp->resize(n_row + 1, 0);
+    (*Cp)[0] = 0;
+
+    for(I i = 0; i < n_row; i++){
+        I A_pos = Ap[i];
+        I B_pos = Bp[i];
+        I A_end = Ap[i+1];
+        I B_end = Bp[i+1];
+
+        I A_j = Aj[A_pos];
+        I B_j = Bj[B_pos];
+            
+        //while not finished with either row
+        while(A_pos < A_end && B_pos < B_end){
+            if(A_j == B_j){
+                T result = op(Ax[A_pos],Bx[B_pos]);
+                if(result != 0){
+                    Cj->push_back(A_j);
+                    Cx->push_back(result);
+                }
+                A_j = Aj[++A_pos]; 
+                B_j = Bj[++B_pos];
+            } else if (A_j < B_j) {
+                T result = op(Ax[A_pos],0);
+                if (result != 0){
+                    Cj->push_back(A_j);
+                    Cx->push_back(result);
+                }
+                A_j = Aj[++A_pos]; 
+            } else {
+                //B_j < A_j
+                T result = op(0,Bx[B_pos]);
+                if (result != 0){
+                    Cj->push_back(B_j);
+                    Cx->push_back(result);
+                }
+                B_j = Bj[++B_pos];
+            }
+        }
+
+        //tail
+        while(A_pos < A_end){
+            T result = op(Ax[A_pos],0);
+            if (result != 0){
+                Cj->push_back(A_j);
+                Cx->push_back(result);
+            }
+            A_j = Aj[++A_pos]; 
+        }
+        while(B_pos < B_end){
+            T result = op(0,Bx[B_pos]);
+            if (result != 0){
+                Cj->push_back(B_j);
+                Cx->push_back(result);
+            }
+            B_j = Bj[++B_pos];
+        }
+        (*Cp)[i+1] = Cx->size();
+    }
+
+
 //   //Method that works for unsorted indices
 //    Cp->resize(n_row + 1, 0);
-//    (*Cp)[0] = 0;
 //
+//    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 A_pos = Ap[i];
-//        I B_pos = Bp[i];
-//        I A_end = Ap[i+1];
-//        I B_end = Bp[i+1];
+//        I head   = -2;
+//        I length =  0;
 //
-//        I A_j = Aj[A_pos];
-//        I B_j = Bj[B_pos];
-//            
-//        //while not finished with either row
-//        while(A_pos < A_end && B_pos < B_end){
-//            if(A_j == B_j){
-//                T result = op(Ax[A_pos],Bx[B_pos]);
-//                if(result != 0){
-//                    Cj->push_back(A_j);
-//                    Cx->push_back(result);
-//                }
-//                A_j = Aj[++A_pos]; 
-//                B_j = Bj[++B_pos];
-//            } else if (A_j < B_j) {
-//                T result = op(Ax[A_pos],0);
-//                if (result != 0){
-//                    Cj->push_back(A_j);
-//                    Cx->push_back(result);
-//                }
-//                A_j = Aj[++A_pos]; 
-//            } else {
-//                //B_j < A_j
-//                T result = op(0,Bx[B_pos]);
-//                if (result != 0){
-//                    Cj->push_back(B_j);
-//                    Cx->push_back(result);
-//                }
-//                B_j = Bj[++B_pos];
+//        //add a row of A to A_row
+//        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(next[j] == -1){
+//                next[j] = head;                        
+//                head = j;
+//                length++;
 //            }
 //        }
 //
-//        //tail
-//        while(A_pos < A_end){
-//            T result = op(Ax[A_pos],0);
-//            if (result != 0){
-//                Cj->push_back(A_j);
-//                Cx->push_back(result);
+//        //add a row of B to B_row
+//        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(next[j] == -1){
+//                next[j] = head;                        
+//                head = j;
+//                length++;
 //            }
-//            A_j = Aj[++A_pos]; 
 //        }
-//        while(B_pos < B_end){
-//            T result = op(0,Bx[B_pos]);
-//            if (result != 0){
-//                Cj->push_back(B_j);
+//
+//
+//        for(I jj = 0; jj < length; jj++){
+//            T result = op(A_row[head],B_row[head]);
+//
+//            if(result != 0){
+//                Cj->push_back(head);
 //                Cx->push_back(result);
 //            }
-//            B_j = Bj[++B_pos];
+//
+//            I temp = head;                
+//            head = next[head];
+//
+//            next[temp] = -1;
+//            A_row[temp] =  0;                              
+//            B_row[temp] =  0;
 //        }
-//        (*Cp)[i+1] = Cx->size();
+//
+//        (*Cp)[i+1] = Cj->size();
 //    }
-
-
-   //Method that works for unsorted indices
-
-    Cp->resize(n_row + 1, 0);
-
-    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 head   = -2;
-        I length =  0;
-
-        //add a row of A to A_row
-        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(next[j] == -1){
-                next[j] = head;                        
-                head = j;
-                length++;
-            }
-        }
-
-        //add a row of B to B_row
-        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(next[j] == -1){
-                next[j] = head;                        
-                head = j;
-                length++;
-            }
-        }
-
-
-        for(I jj = 0; jj < length; jj++){
-            T result = op(A_row[head],B_row[head]);
-
-            if(result != 0){
-                Cj->push_back(head);
-                Cx->push_back(result);
-            }
-
-            I temp = head;                
-            head = next[head];
-
-            next[temp] = -1;
-            A_row[temp] =  0;                              
-            B_row[temp] =  0;
-        }
-
-        (*Cp)[i+1] = Cj->size();
-    }
 }
 
 /* element-wise binary operations*/
@@ -777,46 +888,68 @@
                               I Aj[], 
                               T Ax[])
 {
-  std::vector<I>  next(n_col,-1);
-  std::vector<T>  sums(n_col, 0);
-
-  I nnz = 0;
-
-  I row_start = 0;
-  I row_end   = 0;
-  
-  for(I i = 0; i < n_row; i++){
-    I head = -2;
-    
-    row_start = row_end; //Ap[i] may have been changed
-    row_end   = Ap[i+1]; //Ap[i+1] is safe
-    
-    for(I jj = row_start; jj < row_end; jj++){
-      I j = Aj[jj];
-
-      sums[j] += Ax[jj];
-      
-      if(next[j] == -1){
-	    next[j] = head;                        
-	    head    = j;
-      }
-    }
-
-    while(head != -2){
-        I curr = head; //current column
-        head   = next[curr];
-        
-        if(sums[curr] != 0){
-            Aj[nnz] = curr;
-            Ax[nnz] = sums[curr];
+    I nnz = 0;
+    I row_end = 0;
+    for(I i = 0; i < n_row; i++){
+        I jj = row_end;
+        row_end = Ap[i+1];
+        while( jj < row_end ){
+            I j = Aj[jj];
+            T x = Ax[jj];
+            jj++;
+            while( Aj[jj] == j && jj < row_end ){
+                x += Ax[jj];
+                jj++;
+            }
+            Aj[nnz] = j;
+            Ax[nnz] = x;
             nnz++;
         }
-        
-        next[curr] = -1;
-        sums[curr] =  0;
+        Ap[i+1] = nnz;
     }
-    Ap[i+1] = nnz;
-  }
+
+
+  //method that works on unsorted indices
+//  std::vector<I>  next(n_col,-1);
+//  std::vector<T>  sums(n_col, 0);
+//
+//  I nnz = 0;
+//
+//  I row_start = 0;
+//  I row_end   = 0;
+//  
+//  for(I i = 0; i < n_row; i++){
+//    I head = -2;
+//    
+//    row_start = row_end; //Ap[i] may have been changed
+//    row_end   = Ap[i+1]; //Ap[i+1] is safe
+//    
+//    for(I jj = row_start; jj < row_end; jj++){
+//      I j = Aj[jj];
+//
+//      sums[j] += Ax[jj];
+//      
+//      if(next[j] == -1){
+//	    next[j] = head;                        
+//	    head    = j;
+//      }
+//    }
+//
+//    while(head != -2){
+//        I curr = head; //current column
+//        head   = next[curr];
+//        
+//        if(sums[curr] != 0){
+//            Aj[nnz] = curr;
+//            Ax[nnz] = sums[curr];
+//            nnz++;
+//        }
+//        
+//        next[curr] = -1;
+//        sums[curr] =  0;
+//    }
+//    Ap[i+1] = nnz;
+//  }
 }
 
 
@@ -1294,28 +1427,7 @@
 
 
 
-template <class I, class T>
-void csc_sum_duplicates(const I n_row,
-                        const I n_col, 
-                              I Ap[], 
-                              I Ai[], 
-                              T Ax[])
-{ csr_sum_duplicates(n_col, n_row, Ap, Ai, Ax); }
 
-
-template<class I, class T>
-void csc_sort_indices(const I n_row,
-                      const I n_col,
-                      const I Ap[], 
-                      I       Ai[], 
-                      T       Ax[])
-{ csr_sort_indices(n_col, n_row, Ap, Ai, Ax); }
-
-
-
-
-
-
 /* 
  * These are sparsetools functions that are not currently used
  * 

Modified: trunk/scipy/sparse/sparsetools/sparsetools.i
===================================================================
--- trunk/scipy/sparse/sparsetools/sparsetools.i	2007-12-23 21:07:00 UTC (rev 3699)
+++ trunk/scipy/sparse/sparsetools/sparsetools.i	2007-12-24 00:16:09 UTC (rev 3700)
@@ -240,18 +240,16 @@
 INSTANTIATE_ALL(bsr_minus_bsr)
 
 /*
- * Sort CSR/CSC indices.
+ * Sort indices.
  */
-%template(has_sorted_indices)   has_sorted_indices<int>;
+%template(csr_has_sorted_indices)   csr_has_sorted_indices<int>;
 INSTANTIATE_ALL(csr_sort_indices)
-INSTANTIATE_ALL(csc_sort_indices)
 
 
 /*
- * Sum duplicate CSR/CSC entries.
+ * Sum duplicate entries.
  */
 INSTANTIATE_ALL(csr_sum_duplicates)
-INSTANTIATE_ALL(csc_sum_duplicates)
 
 /*
  * Extract submatrices

Modified: trunk/scipy/sparse/sparsetools/sparsetools.py
===================================================================
--- trunk/scipy/sparse/sparsetools/sparsetools.py	2007-12-23 21:07:00 UTC (rev 3699)
+++ trunk/scipy/sparse/sparsetools/sparsetools.py	2007-12-24 00:16:09 UTC (rev 3700)
@@ -71,9 +71,9 @@
     """
   return _sparsetools.csc_matmat_pass1(*args)
 
-def has_sorted_indices(*args):
-  """has_sorted_indices(int n_row, int n_col, int Ap, int Aj) -> bool"""
-  return _sparsetools.has_sorted_indices(*args)
+def csr_has_sorted_indices(*args):
+  """csr_has_sorted_indices(int n_row, int Ap, int Aj) -> bool"""
+  return _sparsetools.csr_has_sorted_indices(*args)
 
 
 def csr_diagonal(*args):
@@ -755,32 +755,18 @@
 
 def csr_sort_indices(*args):
   """
-    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)
+    csr_sort_indices(int n_row, int Ap, int Aj, signed char Ax)
+    csr_sort_indices(int n_row, int Ap, int Aj, unsigned char Ax)
+    csr_sort_indices(int n_row, int Ap, int Aj, short Ax)
+    csr_sort_indices(int n_row, int Ap, int Aj, int Ax)
+    csr_sort_indices(int n_row, int Ap, int Aj, long long Ax)
+    csr_sort_indices(int n_row, int Ap, int Aj, float Ax)
+    csr_sort_indices(int n_row, int Ap, int Aj, double Ax)
+    csr_sort_indices(int n_row, int Ap, int Aj, npy_cfloat_wrapper Ax)
+    csr_sort_indices(int n_row, int Ap, int Aj, npy_cdouble_wrapper Ax)
     """
   return _sparsetools.csr_sort_indices(*args)
 
-def csc_sort_indices(*args):
-  """
-    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.csc_sort_indices(*args)
-
 def csr_sum_duplicates(*args):
   """
     csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, signed char Ax)
@@ -795,20 +781,6 @@
     """
   return _sparsetools.csr_sum_duplicates(*args)
 
-def csc_sum_duplicates(*args):
-  """
-    csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, signed char Ax)
-    csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, unsigned char Ax)
-    csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, short Ax)
-    csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, int Ax)
-    csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, long long Ax)
-    csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, float Ax)
-    csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, double Ax)
-    csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax)
-    csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax)
-    """
-  return _sparsetools.csc_sum_duplicates(*args)
-
 def get_csr_submatrix(*args):
   """
     get_csr_submatrix(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-23 21:07:00 UTC (rev 3699)
+++ trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx	2007-12-24 00:16:09 UTC (rev 3700)
@@ -47557,72 +47557,63 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_has_sorted_indices(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csr_has_sorted_indices(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
-  int arg2 ;
+  int *arg2 ;
   int *arg3 ;
-  int *arg4 ;
   bool result;
   int val1 ;
   int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
+  PyArrayObject *array2 = NULL ;
+  int is_new_object2 ;
   PyArrayObject *array3 = NULL ;
   int is_new_object3 ;
-  PyArrayObject *array4 = NULL ;
-  int is_new_object4 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOO:has_sorted_indices",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOO:csr_has_sorted_indices",&obj0,&obj1,&obj2)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "has_sorted_indices" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_has_sorted_indices" "', 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 '" "has_sorted_indices" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
   {
     npy_intp size[1] = {
       -1
     };
-    array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3);
-    if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1)
-      || !require_contiguous(array3)   || !require_native(array3)) SWIG_fail;
+    array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_INT, &is_new_object2);
+    if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1)
+      || !require_contiguous(array2)   || !require_native(array2)) SWIG_fail;
     
-    arg3 = (int*) array3->data;
+    arg2 = (int*) array2->data;
   }
   {
     npy_intp size[1] = {
       -1
     };
-    array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4);
-    if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1)
-      || !require_contiguous(array4)   || !require_native(array4)) SWIG_fail;
+    array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3);
+    if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1)
+      || !require_contiguous(array3)   || !require_native(array3)) SWIG_fail;
     
-    arg4 = (int*) array4->data;
+    arg3 = (int*) array3->data;
   }
-  result = (bool)has_sorted_indices<int >(arg1,arg2,(int const (*))arg3,(int const (*))arg4);
+  result = (bool)csr_has_sorted_indices<int >(arg1,(int const (*))arg2,(int const (*))arg3);
   resultobj = SWIG_From_bool(static_cast< bool >(result));
   {
-    if (is_new_object3 && array3) Py_DECREF(array3);
+    if (is_new_object2 && array2) Py_DECREF(array2);
   }
   {
-    if (is_new_object4 && array4) Py_DECREF(array4);
+    if (is_new_object3 && array3) Py_DECREF(array3);
   }
   return resultobj;
 fail:
   {
-    if (is_new_object3 && array3) Py_DECREF(array3);
+    if (is_new_object2 && array2) Py_DECREF(array2);
   }
   {
-    if (is_new_object4 && array4) Py_DECREF(array4);
+    if (is_new_object3 && array3) Py_DECREF(array3);
   }
   return NULL;
 }
@@ -47631,64 +47622,55 @@
 SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
-  int arg2 ;
+  int *arg2 ;
   int *arg3 ;
-  int *arg4 ;
-  signed char *arg5 ;
+  signed char *arg4 ;
   int val1 ;
   int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *array3 = NULL ;
-  int is_new_object3 ;
+  PyArrayObject *array2 = NULL ;
+  int is_new_object2 ;
+  PyArrayObject *temp3 = NULL ;
   PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', 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 '" "csr_sort_indices" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
   {
     npy_intp size[1] = {
       -1
     };
-    array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3);
-    if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1)
-      || !require_contiguous(array3)   || !require_native(array3)) SWIG_fail;
+    array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_INT, &is_new_object2);
+    if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1)
+      || !require_contiguous(array2)   || !require_native(array2)) SWIG_fail;
     
-    arg3 = (int*) array3->data;
+    arg2 = (int*) array2->data;
   }
   {
-    temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
-    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
-    arg4 = (int*) array_data(temp4);
+    temp3 = obj_to_array_no_conversion(obj2,PyArray_INT);
+    if (!temp3  || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail;
+    arg3 = (int*) array_data(temp3);
   }
   {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_BYTE);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (signed char*) array_data(temp5);
+    temp4 = obj_to_array_no_conversion(obj3,PyArray_BYTE);
+    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
+    arg4 = (signed char*) array_data(temp4);
   }
-  csr_sort_indices<int,signed char >(arg1,arg2,(int const (*))arg3,arg4,arg5);
+  csr_sort_indices<int,signed char >(arg1,(int const (*))arg2,arg3,arg4);
   resultobj = SWIG_Py_Void();
   {
-    if (is_new_object3 && array3) Py_DECREF(array3);
+    if (is_new_object2 && array2) Py_DECREF(array2);
   }
   return resultobj;
 fail:
   {
-    if (is_new_object3 && array3) Py_DECREF(array3);
+    if (is_new_object2 && array2) Py_DECREF(array2);
   }
   return NULL;
 }
@@ -47697,64 +47679,55 @@
 SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
-  int arg2 ;
+  int *arg2 ;
   int *arg3 ;
-  int *arg4 ;
-  unsigned char *arg5 ;
+  unsigned char *arg4 ;
   int val1 ;
   int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *array3 = NULL ;
-  int is_new_object3 ;
+  PyArrayObject *array2 = NULL ;
+  int is_new_object2 ;
+  PyArrayObject *temp3 = NULL ;
   PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', 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 '" "csr_sort_indices" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
   {
     npy_intp size[1] = {
       -1
     };
-    array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3);
-    if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1)
-      || !require_contiguous(array3)   || !require_native(array3)) SWIG_fail;
+    array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_INT, &is_new_object2);
+    if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1)
+      || !require_contiguous(array2)   || !require_native(array2)) SWIG_fail;
     
-    arg3 = (int*) array3->data;
+    arg2 = (int*) array2->data;
   }
   {
-    temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
-    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
-    arg4 = (int*) array_data(temp4);
+    temp3 = obj_to_array_no_conversion(obj2,PyArray_INT);
+    if (!temp3  || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail;
+    arg3 = (int*) array_data(temp3);
   }
   {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_UBYTE);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (unsigned char*) array_data(temp5);
+    temp4 = obj_to_array_no_conversion(obj3,PyArray_UBYTE);
+    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
+    arg4 = (unsigned char*) array_data(temp4);
   }
-  csr_sort_indices<int,unsigned char >(arg1,arg2,(int const (*))arg3,arg4,arg5);
+  csr_sort_indices<int,unsigned char >(arg1,(int const (*))arg2,arg3,arg4);
   resultobj = SWIG_Py_Void();
   {
-    if (is_new_object3 && array3) Py_DECREF(array3);
+    if (is_new_object2 && array2) Py_DECREF(array2);
   }
   return resultobj;
 fail:
   {
-    if (is_new_object3 && array3) Py_DECREF(array3);
+    if (is_new_object2 && array2) Py_DECREF(array2);
   }
   return NULL;
 }
@@ -47763,64 +47736,55 @@
 SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
-  int arg2 ;
+  int *arg2 ;
   int *arg3 ;
-  int *arg4 ;
-  short *arg5 ;
+  short *arg4 ;
   int val1 ;
   int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *array3 = NULL ;
-  int is_new_object3 ;
+  PyArrayObject *array2 = NULL ;
+  int is_new_object2 ;
+  PyArrayObject *temp3 = NULL ;
   PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', 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 '" "csr_sort_indices" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
   {
     npy_intp size[1] = {
       -1
     };
-    array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3);
-    if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1)
-      || !require_contiguous(array3)   || !require_native(array3)) SWIG_fail;
+    array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_INT, &is_new_object2);
+    if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1)
+      || !require_contiguous(array2)   || !require_native(array2)) SWIG_fail;
     
-    arg3 = (int*) array3->data;
+    arg2 = (int*) array2->data;
   }
   {
-    temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
-    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
-    arg4 = (int*) array_data(temp4);
+    temp3 = obj_to_array_no_conversion(obj2,PyArray_INT);
+    if (!temp3  || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail;
+    arg3 = (int*) array_data(temp3);
   }
   {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_SHORT);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (short*) array_data(temp5);
+    temp4 = obj_to_array_no_conversion(obj3,PyArray_SHORT);
+    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
+    arg4 = (short*) array_data(temp4);
   }
-  csr_sort_indices<int,short >(arg1,arg2,(int const (*))arg3,arg4,arg5);
+  csr_sort_indices<int,short >(arg1,(int const (*))arg2,arg3,arg4);
   resultobj = SWIG_Py_Void();
   {
-    if (is_new_object3 && array3) Py_DECREF(array3);
+    if (is_new_object2 && array2) Py_DECREF(array2);
   }
   return resultobj;
 fail:
   {
-    if (is_new_object3 && array3) Py_DECREF(array3);
+    if (is_new_object2 && array2) Py_DECREF(array2);
   }
   return NULL;
 }
@@ -47829,64 +47793,55 @@
 SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
-  int arg2 ;
+  int *arg2 ;
   int *arg3 ;
   int *arg4 ;
-  int *arg5 ;
   int val1 ;
   int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *array3 = NULL ;
-  int is_new_object3 ;
+  PyArrayObject *array2 = NULL ;
+  int is_new_object2 ;
+  PyArrayObject *temp3 = NULL ;
   PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', 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 '" "csr_sort_indices" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
   {
     npy_intp size[1] = {
       -1
     };
-    array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3);
-    if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1)
-      || !require_contiguous(array3)   || !require_native(array3)) SWIG_fail;
+    array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_INT, &is_new_object2);
+    if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1)
+      || !require_contiguous(array2)   || !require_native(array2)) SWIG_fail;
     
-    arg3 = (int*) array3->data;
+    arg2 = (int*) array2->data;
   }
   {
+    temp3 = obj_to_array_no_conversion(obj2,PyArray_INT);
+    if (!temp3  || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail;
+    arg3 = (int*) array_data(temp3);
+  }
+  {
     temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
     if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
     arg4 = (int*) array_data(temp4);
   }
-  {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_INT);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (int*) array_data(temp5);
-  }
-  csr_sort_indices<int,int >(arg1,arg2,(int const (*))arg3,arg4,arg5);
+  csr_sort_indices<int,int >(arg1,(int const (*))arg2,arg3,arg4);
   resultobj = SWIG_Py_Void();
   {
-    if (is_new_object3 && array3) Py_DECREF(array3);
+    if (is_new_object2 && array2) Py_DECREF(array2);
   }
   return resultobj;
 fail:
   {
-    if (is_new_object3 && array3) Py_DECREF(array3);
+    if (is_new_object2 && array2) Py_DECREF(array2);
   }
   return NULL;
 }
@@ -47895,64 +47850,55 @@
 SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
-  int arg2 ;
+  int *arg2 ;
   int *arg3 ;
-  int *arg4 ;
-  long long *arg5 ;
+  long long *arg4 ;
   int val1 ;
   int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *array3 = NULL ;
-  int is_new_object3 ;
+  PyArrayObject *array2 = NULL ;
+  int is_new_object2 ;
+  PyArrayObject *temp3 = NULL ;
   PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', 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 '" "csr_sort_indices" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
   {
     npy_intp size[1] = {
       -1
     };
-    array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3);
-    if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1)
-      || !require_contiguous(array3)   || !require_native(array3)) SWIG_fail;
+    array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_INT, &is_new_object2);
+    if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1)
+      || !require_contiguous(array2)   || !require_native(array2)) SWIG_fail;
     
-    arg3 = (int*) array3->data;
+    arg2 = (int*) array2->data;
   }
   {
-    temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
-    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
-    arg4 = (int*) array_data(temp4);
+    temp3 = obj_to_array_no_conversion(obj2,PyArray_INT);
+    if (!temp3  || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail;
+    arg3 = (int*) array_data(temp3);
   }
   {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_LONGLONG);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (long long*) array_data(temp5);
+    temp4 = obj_to_array_no_conversion(obj3,PyArray_LONGLONG);
+    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
+    arg4 = (long long*) array_data(temp4);
   }
-  csr_sort_indices<int,long long >(arg1,arg2,(int const (*))arg3,arg4,arg5);
+  csr_sort_indices<int,long long >(arg1,(int const (*))arg2,arg3,arg4);
   resultobj = SWIG_Py_Void();
   {
-    if (is_new_object3 && array3) Py_DECREF(array3);
+    if (is_new_object2 && array2) Py_DECREF(array2);
   }
   return resultobj;
 fail:
   {
-    if (is_new_object3 && array3) Py_DECREF(array3);
+    if (is_new_object2 && array2) Py_DECREF(array2);
   }
   return NULL;
 }
@@ -47961,64 +47907,55 @@
 SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
-  int arg2 ;
+  int *arg2 ;
   int *arg3 ;
-  int *arg4 ;
-  float *arg5 ;
+  float *arg4 ;
   int val1 ;
   int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *array3 = NULL ;
-  int is_new_object3 ;
+  PyArrayObject *array2 = NULL ;
+  int is_new_object2 ;
+  PyArrayObject *temp3 = NULL ;
   PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', 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 '" "csr_sort_indices" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
   {
     npy_intp size[1] = {
       -1
     };
-    array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3);
-    if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1)
-      || !require_contiguous(array3)   || !require_native(array3)) SWIG_fail;
+    array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_INT, &is_new_object2);
+    if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1)
+      || !require_contiguous(array2)   || !require_native(array2)) SWIG_fail;
     
-    arg3 = (int*) array3->data;
+    arg2 = (int*) array2->data;
   }
   {
-    temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
-    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
-    arg4 = (int*) array_data(temp4);
+    temp3 = obj_to_array_no_conversion(obj2,PyArray_INT);
+    if (!temp3  || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail;
+    arg3 = (int*) array_data(temp3);
   }
   {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_FLOAT);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (float*) array_data(temp5);
+    temp4 = obj_to_array_no_conversion(obj3,PyArray_FLOAT);
+    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
+    arg4 = (float*) array_data(temp4);
   }
-  csr_sort_indices<int,float >(arg1,arg2,(int const (*))arg3,arg4,arg5);
+  csr_sort_indices<int,float >(arg1,(int const (*))arg2,arg3,arg4);
   resultobj = SWIG_Py_Void();
   {
-    if (is_new_object3 && array3) Py_DECREF(array3);
+    if (is_new_object2 && array2) Py_DECREF(array2);
   }
   return resultobj;
 fail:
   {
-    if (is_new_object3 && array3) Py_DECREF(array3);
+    if (is_new_object2 && array2) Py_DECREF(array2);
   }
   return NULL;
 }
@@ -48027,64 +47964,55 @@
 SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
-  int arg2 ;
+  int *arg2 ;
   int *arg3 ;
-  int *arg4 ;
-  double *arg5 ;
+  double *arg4 ;
   int val1 ;
   int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *array3 = NULL ;
-  int is_new_object3 ;
+  PyArrayObject *array2 = NULL ;
+  int is_new_object2 ;
+  PyArrayObject *temp3 = NULL ;
   PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', 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 '" "csr_sort_indices" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
   {
     npy_intp size[1] = {
       -1
     };
-    array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3);
-    if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1)
-      || !require_contiguous(array3)   || !require_native(array3)) SWIG_fail;
+    array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_INT, &is_new_object2);
+    if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1)
+      || !require_contiguous(array2)   || !require_native(array2)) SWIG_fail;
     
-    arg3 = (int*) array3->data;
+    arg2 = (int*) array2->data;
   }
   {
-    temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
-    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
-    arg4 = (int*) array_data(temp4);
+    temp3 = obj_to_array_no_conversion(obj2,PyArray_INT);
+    if (!temp3  || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail;
+    arg3 = (int*) array_data(temp3);
   }
   {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_DOUBLE);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (double*) array_data(temp5);
+    temp4 = obj_to_array_no_conversion(obj3,PyArray_DOUBLE);
+    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
+    arg4 = (double*) array_data(temp4);
   }
-  csr_sort_indices<int,double >(arg1,arg2,(int const (*))arg3,arg4,arg5);
+  csr_sort_indices<int,double >(arg1,(int const (*))arg2,arg3,arg4);
   resultobj = SWIG_Py_Void();
   {
-    if (is_new_object3 && array3) Py_DECREF(array3);
+    if (is_new_object2 && array2) Py_DECREF(array2);
   }
   return resultobj;
 fail:
   {
-    if (is_new_object3 && array3) Py_DECREF(array3);
+    if (is_new_object2 && array2) Py_DECREF(array2);
   }
   return NULL;
 }
@@ -48093,64 +48021,55 @@
 SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
-  int arg2 ;
+  int *arg2 ;
   int *arg3 ;
-  int *arg4 ;
-  npy_cfloat_wrapper *arg5 ;
+  npy_cfloat_wrapper *arg4 ;
   int val1 ;
   int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *array3 = NULL ;
-  int is_new_object3 ;
+  PyArrayObject *array2 = NULL ;
+  int is_new_object2 ;
+  PyArrayObject *temp3 = NULL ;
   PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', 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 '" "csr_sort_indices" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
   {
     npy_intp size[1] = {
       -1
     };
-    array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3);
-    if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1)
-      || !require_contiguous(array3)   || !require_native(array3)) SWIG_fail;
+    array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_INT, &is_new_object2);
+    if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1)
+      || !require_contiguous(array2)   || !require_native(array2)) SWIG_fail;
     
-    arg3 = (int*) array3->data;
+    arg2 = (int*) array2->data;
   }
   {
-    temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
-    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
-    arg4 = (int*) array_data(temp4);
+    temp3 = obj_to_array_no_conversion(obj2,PyArray_INT);
+    if (!temp3  || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail;
+    arg3 = (int*) array_data(temp3);
   }
   {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_CFLOAT);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (npy_cfloat_wrapper*) array_data(temp5);
+    temp4 = obj_to_array_no_conversion(obj3,PyArray_CFLOAT);
+    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
+    arg4 = (npy_cfloat_wrapper*) array_data(temp4);
   }
-  csr_sort_indices<int,npy_cfloat_wrapper >(arg1,arg2,(int const (*))arg3,arg4,arg5);
+  csr_sort_indices<int,npy_cfloat_wrapper >(arg1,(int const (*))arg2,arg3,arg4);
   resultobj = SWIG_Py_Void();
   {
-    if (is_new_object3 && array3) Py_DECREF(array3);
+    if (is_new_object2 && array2) Py_DECREF(array2);
   }
   return resultobj;
 fail:
   {
-    if (is_new_object3 && array3) Py_DECREF(array3);
+    if (is_new_object2 && array2) Py_DECREF(array2);
   }
   return NULL;
 }
@@ -48159,64 +48078,55 @@
 SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
-  int arg2 ;
+  int *arg2 ;
   int *arg3 ;
-  int *arg4 ;
-  npy_cdouble_wrapper *arg5 ;
+  npy_cdouble_wrapper *arg4 ;
   int val1 ;
   int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *array3 = NULL ;
-  int is_new_object3 ;
+  PyArrayObject *array2 = NULL ;
+  int is_new_object2 ;
+  PyArrayObject *temp3 = NULL ;
   PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', 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 '" "csr_sort_indices" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
   {
     npy_intp size[1] = {
       -1
     };
-    array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3);
-    if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1)
-      || !require_contiguous(array3)   || !require_native(array3)) SWIG_fail;
+    array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_INT, &is_new_object2);
+    if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1)
+      || !require_contiguous(array2)   || !require_native(array2)) SWIG_fail;
     
-    arg3 = (int*) array3->data;
+    arg2 = (int*) array2->data;
   }
   {
-    temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
-    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
-    arg4 = (int*) array_data(temp4);
+    temp3 = obj_to_array_no_conversion(obj2,PyArray_INT);
+    if (!temp3  || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail;
+    arg3 = (int*) array_data(temp3);
   }
   {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_CDOUBLE);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (npy_cdouble_wrapper*) array_data(temp5);
+    temp4 = obj_to_array_no_conversion(obj3,PyArray_CDOUBLE);
+    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
+    arg4 = (npy_cdouble_wrapper*) array_data(temp4);
   }
-  csr_sort_indices<int,npy_cdouble_wrapper >(arg1,arg2,(int const (*))arg3,arg4,arg5);
+  csr_sort_indices<int,npy_cdouble_wrapper >(arg1,(int const (*))arg2,arg3,arg4);
   resultobj = SWIG_Py_Void();
   {
-    if (is_new_object3 && array3) Py_DECREF(array3);
+    if (is_new_object2 && array2) Py_DECREF(array2);
   }
   return resultobj;
 fail:
   {
-    if (is_new_object3 && array3) Py_DECREF(array3);
+    if (is_new_object2 && array2) Py_DECREF(array2);
   }
   return NULL;
 }
@@ -48224,15 +48134,15 @@
 
 SWIGINTERN PyObject *_wrap_csr_sort_indices(PyObject *self, PyObject *args) {
   int argc;
-  PyObject *argv[6];
+  PyObject *argv[5];
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
   argc = (int)PyObject_Length(args);
-  for (ii = 0; (ii < argc) && (ii < 5); ii++) {
+  for (ii = 0; (ii < argc) && (ii < 4); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
-  if (argc == 5) {
+  if (argc == 4) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -48240,8 +48150,7 @@
     }
     if (_v) {
       {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
+        _v = (is_array(argv[1]) && PyArray_CanCastSafely(PyArray_TYPE(argv[1]),PyArray_INT)) ? 1 : 0;
       }
       if (_v) {
         {
@@ -48249,21 +48158,16 @@
         }
         if (_v) {
           {
-            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
+            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_BYTE)) ? 1 : 0;
           }
           if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_BYTE)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csr_sort_indices__SWIG_1(self, args);
-            }
+            return _wrap_csr_sort_indices__SWIG_1(self, args);
           }
         }
       }
     }
   }
-  if (argc == 5) {
+  if (argc == 4) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -48271,8 +48175,7 @@
     }
     if (_v) {
       {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
+        _v = (is_array(argv[1]) && PyArray_CanCastSafely(PyArray_TYPE(argv[1]),PyArray_INT)) ? 1 : 0;
       }
       if (_v) {
         {
@@ -48280,21 +48183,16 @@
         }
         if (_v) {
           {
-            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
+            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_UBYTE)) ? 1 : 0;
           }
           if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_UBYTE)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csr_sort_indices__SWIG_2(self, args);
-            }
+            return _wrap_csr_sort_indices__SWIG_2(self, args);
           }
         }
       }
     }
   }
-  if (argc == 5) {
+  if (argc == 4) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -48302,8 +48200,7 @@
     }
     if (_v) {
       {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
+        _v = (is_array(argv[1]) && PyArray_CanCastSafely(PyArray_TYPE(argv[1]),PyArray_INT)) ? 1 : 0;
       }
       if (_v) {
         {
@@ -48311,21 +48208,16 @@
         }
         if (_v) {
           {
-            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
+            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_SHORT)) ? 1 : 0;
           }
           if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_SHORT)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csr_sort_indices__SWIG_3(self, args);
-            }
+            return _wrap_csr_sort_indices__SWIG_3(self, args);
           }
         }
       }
     }
   }
-  if (argc == 5) {
+  if (argc == 4) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -48333,8 +48225,7 @@
     }
     if (_v) {
       {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
+        _v = (is_array(argv[1]) && PyArray_CanCastSafely(PyArray_TYPE(argv[1]),PyArray_INT)) ? 1 : 0;
       }
       if (_v) {
         {
@@ -48345,18 +48236,13 @@
             _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
           }
           if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csr_sort_indices__SWIG_4(self, args);
-            }
+            return _wrap_csr_sort_indices__SWIG_4(self, args);
           }
         }
       }
     }
   }
-  if (argc == 5) {
+  if (argc == 4) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -48364,8 +48250,7 @@
     }
     if (_v) {
       {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
+        _v = (is_array(argv[1]) && PyArray_CanCastSafely(PyArray_TYPE(argv[1]),PyArray_INT)) ? 1 : 0;
       }
       if (_v) {
         {
@@ -48373,21 +48258,16 @@
         }
         if (_v) {
           {
-            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
+            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_LONGLONG)) ? 1 : 0;
           }
           if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_LONGLONG)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csr_sort_indices__SWIG_5(self, args);
-            }
+            return _wrap_csr_sort_indices__SWIG_5(self, args);
           }
         }
       }
     }
   }
-  if (argc == 5) {
+  if (argc == 4) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -48395,8 +48275,7 @@
     }
     if (_v) {
       {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
+        _v = (is_array(argv[1]) && PyArray_CanCastSafely(PyArray_TYPE(argv[1]),PyArray_INT)) ? 1 : 0;
       }
       if (_v) {
         {
@@ -48404,21 +48283,16 @@
         }
         if (_v) {
           {
-            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
+            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_FLOAT)) ? 1 : 0;
           }
           if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csr_sort_indices__SWIG_6(self, args);
-            }
+            return _wrap_csr_sort_indices__SWIG_6(self, args);
           }
         }
       }
     }
   }
-  if (argc == 5) {
+  if (argc == 4) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -48426,8 +48300,7 @@
     }
     if (_v) {
       {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
+        _v = (is_array(argv[1]) && PyArray_CanCastSafely(PyArray_TYPE(argv[1]),PyArray_INT)) ? 1 : 0;
       }
       if (_v) {
         {
@@ -48435,21 +48308,16 @@
         }
         if (_v) {
           {
-            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
+            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_DOUBLE)) ? 1 : 0;
           }
           if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csr_sort_indices__SWIG_7(self, args);
-            }
+            return _wrap_csr_sort_indices__SWIG_7(self, args);
           }
         }
       }
     }
   }
-  if (argc == 5) {
+  if (argc == 4) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -48457,8 +48325,7 @@
     }
     if (_v) {
       {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
+        _v = (is_array(argv[1]) && PyArray_CanCastSafely(PyArray_TYPE(argv[1]),PyArray_INT)) ? 1 : 0;
       }
       if (_v) {
         {
@@ -48466,21 +48333,16 @@
         }
         if (_v) {
           {
-            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
+            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_CFLOAT)) ? 1 : 0;
           }
           if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CFLOAT)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csr_sort_indices__SWIG_8(self, args);
-            }
+            return _wrap_csr_sort_indices__SWIG_8(self, args);
           }
         }
       }
     }
   }
-  if (argc == 5) {
+  if (argc == 4) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -48488,8 +48350,7 @@
     }
     if (_v) {
       {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
+        _v = (is_array(argv[1]) && PyArray_CanCastSafely(PyArray_TYPE(argv[1]),PyArray_INT)) ? 1 : 0;
       }
       if (_v) {
         {
@@ -48497,15 +48358,10 @@
         }
         if (_v) {
           {
-            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
+            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_CDOUBLE)) ? 1 : 0;
           }
           if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CDOUBLE)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csr_sort_indices__SWIG_9(self, args);
-            }
+            return _wrap_csr_sort_indices__SWIG_9(self, args);
           }
         }
       }
@@ -48513,901 +48369,11 @@
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_sort_indices'.\n  Possible C/C++ prototypes are:\n""    csr_sort_indices<(int,signed char)>(int const,int const,int const [],int [],signed char [])\n""    csr_sort_indices<(int,unsigned char)>(int const,int const,int const [],int [],unsigned char [])\n""    csr_sort_indices<(int,short)>(int const,int const,int const [],int [],short [])\n""    csr_sort_indices<(int,int)>(int const,int const,int const [],int [],int [])\n""    csr_sort_indices<(int,long long)>(int const,int const,int const [],int [],long long [])\n""    csr_sort_indices<(int,float)>(int const,int const,int const [],int [],float [])\n""    csr_sort_indices<(int,double)>(int const,int const,int const [],int [],double [])\n""    csr_sort_indices<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int [],npy_cfloat_wrapper [])\n""    csr_sort_indices<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int [],npy_cdouble_wrapper [])\n");
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_sort_indices'.\n  Possible C/C++ prototypes are:\n""    csr_sort_indices<(int,signed char)>(int const,int const [],int [],signed char [])\n""    csr_sort_indices<(int,unsigned char)>(int const,int const [],int [],unsigned char [])\n""    csr_sort_indices<(int,short)>(int const,int const [],int [],short [])\n""    csr_sort_indices<(int,int)>(int const,int const [],int [],int [])\n""    csr_sort_indices<(int,long long)>(int const,int const [],int [],long long [])\n""    csr_sort_indices<(int,float)>(int const,int const [],int [],float [])\n""    csr_sort_indices<(int,double)>(int const,int const [],int [],double [])\n""    csr_sort_indices<(int,npy_cfloat_wrapper)>(int const,int const [],int [],npy_cfloat_wrapper [])\n""    csr_sort_indices<(int,npy_cdouble_wrapper)>(int const,int const [],int [],npy_cdouble_wrapper [])\n");
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  int arg1 ;
-  int arg2 ;
-  int *arg3 ;
-  int *arg4 ;
-  signed char *arg5 ;
-  int val1 ;
-  int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *array3 = NULL ;
-  int is_new_object3 ;
-  PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
-  ecode1 = SWIG_AsVal_int(obj0, &val1);
-  if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', 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 '" "csc_sort_indices" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  {
-    npy_intp size[1] = {
-      -1
-    };
-    array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3);
-    if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1)
-      || !require_contiguous(array3)   || !require_native(array3)) SWIG_fail;
-    
-    arg3 = (int*) array3->data;
-  }
-  {
-    temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
-    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
-    arg4 = (int*) array_data(temp4);
-  }
-  {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_BYTE);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (signed char*) array_data(temp5);
-  }
-  csc_sort_indices<int,signed char >(arg1,arg2,(int const (*))arg3,arg4,arg5);
-  resultobj = SWIG_Py_Void();
-  {
-    if (is_new_object3 && array3) Py_DECREF(array3);
-  }
-  return resultobj;
-fail:
-  {
-    if (is_new_object3 && array3) Py_DECREF(array3);
-  }
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  int arg1 ;
-  int arg2 ;
-  int *arg3 ;
-  int *arg4 ;
-  unsigned char *arg5 ;
-  int val1 ;
-  int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *array3 = NULL ;
-  int is_new_object3 ;
-  PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
-  ecode1 = SWIG_AsVal_int(obj0, &val1);
-  if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', 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 '" "csc_sort_indices" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  {
-    npy_intp size[1] = {
-      -1
-    };
-    array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3);
-    if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1)
-      || !require_contiguous(array3)   || !require_native(array3)) SWIG_fail;
-    
-    arg3 = (int*) array3->data;
-  }
-  {
-    temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
-    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
-    arg4 = (int*) array_data(temp4);
-  }
-  {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_UBYTE);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (unsigned char*) array_data(temp5);
-  }
-  csc_sort_indices<int,unsigned char >(arg1,arg2,(int const (*))arg3,arg4,arg5);
-  resultobj = SWIG_Py_Void();
-  {
-    if (is_new_object3 && array3) Py_DECREF(array3);
-  }
-  return resultobj;
-fail:
-  {
-    if (is_new_object3 && array3) Py_DECREF(array3);
-  }
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  int arg1 ;
-  int arg2 ;
-  int *arg3 ;
-  int *arg4 ;
-  short *arg5 ;
-  int val1 ;
-  int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *array3 = NULL ;
-  int is_new_object3 ;
-  PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
-  ecode1 = SWIG_AsVal_int(obj0, &val1);
-  if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', 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 '" "csc_sort_indices" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  {
-    npy_intp size[1] = {
-      -1
-    };
-    array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3);
-    if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1)
-      || !require_contiguous(array3)   || !require_native(array3)) SWIG_fail;
-    
-    arg3 = (int*) array3->data;
-  }
-  {
-    temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
-    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
-    arg4 = (int*) array_data(temp4);
-  }
-  {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_SHORT);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (short*) array_data(temp5);
-  }
-  csc_sort_indices<int,short >(arg1,arg2,(int const (*))arg3,arg4,arg5);
-  resultobj = SWIG_Py_Void();
-  {
-    if (is_new_object3 && array3) Py_DECREF(array3);
-  }
-  return resultobj;
-fail:
-  {
-    if (is_new_object3 && array3) Py_DECREF(array3);
-  }
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  int arg1 ;
-  int arg2 ;
-  int *arg3 ;
-  int *arg4 ;
-  int *arg5 ;
-  int val1 ;
-  int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *array3 = NULL ;
-  int is_new_object3 ;
-  PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
-  ecode1 = SWIG_AsVal_int(obj0, &val1);
-  if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', 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 '" "csc_sort_indices" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  {
-    npy_intp size[1] = {
-      -1
-    };
-    array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3);
-    if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1)
-      || !require_contiguous(array3)   || !require_native(array3)) SWIG_fail;
-    
-    arg3 = (int*) array3->data;
-  }
-  {
-    temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
-    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
-    arg4 = (int*) array_data(temp4);
-  }
-  {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_INT);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (int*) array_data(temp5);
-  }
-  csc_sort_indices<int,int >(arg1,arg2,(int const (*))arg3,arg4,arg5);
-  resultobj = SWIG_Py_Void();
-  {
-    if (is_new_object3 && array3) Py_DECREF(array3);
-  }
-  return resultobj;
-fail:
-  {
-    if (is_new_object3 && array3) Py_DECREF(array3);
-  }
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  int arg1 ;
-  int arg2 ;
-  int *arg3 ;
-  int *arg4 ;
-  long long *arg5 ;
-  int val1 ;
-  int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *array3 = NULL ;
-  int is_new_object3 ;
-  PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
-  ecode1 = SWIG_AsVal_int(obj0, &val1);
-  if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', 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 '" "csc_sort_indices" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  {
-    npy_intp size[1] = {
-      -1
-    };
-    array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3);
-    if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1)
-      || !require_contiguous(array3)   || !require_native(array3)) SWIG_fail;
-    
-    arg3 = (int*) array3->data;
-  }
-  {
-    temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
-    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
-    arg4 = (int*) array_data(temp4);
-  }
-  {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_LONGLONG);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (long long*) array_data(temp5);
-  }
-  csc_sort_indices<int,long long >(arg1,arg2,(int const (*))arg3,arg4,arg5);
-  resultobj = SWIG_Py_Void();
-  {
-    if (is_new_object3 && array3) Py_DECREF(array3);
-  }
-  return resultobj;
-fail:
-  {
-    if (is_new_object3 && array3) Py_DECREF(array3);
-  }
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  int arg1 ;
-  int arg2 ;
-  int *arg3 ;
-  int *arg4 ;
-  float *arg5 ;
-  int val1 ;
-  int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *array3 = NULL ;
-  int is_new_object3 ;
-  PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
-  ecode1 = SWIG_AsVal_int(obj0, &val1);
-  if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', 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 '" "csc_sort_indices" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  {
-    npy_intp size[1] = {
-      -1
-    };
-    array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3);
-    if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1)
-      || !require_contiguous(array3)   || !require_native(array3)) SWIG_fail;
-    
-    arg3 = (int*) array3->data;
-  }
-  {
-    temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
-    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
-    arg4 = (int*) array_data(temp4);
-  }
-  {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_FLOAT);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (float*) array_data(temp5);
-  }
-  csc_sort_indices<int,float >(arg1,arg2,(int const (*))arg3,arg4,arg5);
-  resultobj = SWIG_Py_Void();
-  {
-    if (is_new_object3 && array3) Py_DECREF(array3);
-  }
-  return resultobj;
-fail:
-  {
-    if (is_new_object3 && array3) Py_DECREF(array3);
-  }
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  int arg1 ;
-  int arg2 ;
-  int *arg3 ;
-  int *arg4 ;
-  double *arg5 ;
-  int val1 ;
-  int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *array3 = NULL ;
-  int is_new_object3 ;
-  PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
-  ecode1 = SWIG_AsVal_int(obj0, &val1);
-  if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', 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 '" "csc_sort_indices" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  {
-    npy_intp size[1] = {
-      -1
-    };
-    array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3);
-    if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1)
-      || !require_contiguous(array3)   || !require_native(array3)) SWIG_fail;
-    
-    arg3 = (int*) array3->data;
-  }
-  {
-    temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
-    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
-    arg4 = (int*) array_data(temp4);
-  }
-  {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_DOUBLE);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (double*) array_data(temp5);
-  }
-  csc_sort_indices<int,double >(arg1,arg2,(int const (*))arg3,arg4,arg5);
-  resultobj = SWIG_Py_Void();
-  {
-    if (is_new_object3 && array3) Py_DECREF(array3);
-  }
-  return resultobj;
-fail:
-  {
-    if (is_new_object3 && array3) Py_DECREF(array3);
-  }
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  int arg1 ;
-  int arg2 ;
-  int *arg3 ;
-  int *arg4 ;
-  npy_cfloat_wrapper *arg5 ;
-  int val1 ;
-  int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *array3 = NULL ;
-  int is_new_object3 ;
-  PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
-  ecode1 = SWIG_AsVal_int(obj0, &val1);
-  if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', 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 '" "csc_sort_indices" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  {
-    npy_intp size[1] = {
-      -1
-    };
-    array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3);
-    if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1)
-      || !require_contiguous(array3)   || !require_native(array3)) SWIG_fail;
-    
-    arg3 = (int*) array3->data;
-  }
-  {
-    temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
-    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
-    arg4 = (int*) array_data(temp4);
-  }
-  {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_CFLOAT);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (npy_cfloat_wrapper*) array_data(temp5);
-  }
-  csc_sort_indices<int,npy_cfloat_wrapper >(arg1,arg2,(int const (*))arg3,arg4,arg5);
-  resultobj = SWIG_Py_Void();
-  {
-    if (is_new_object3 && array3) Py_DECREF(array3);
-  }
-  return resultobj;
-fail:
-  {
-    if (is_new_object3 && array3) Py_DECREF(array3);
-  }
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  int arg1 ;
-  int arg2 ;
-  int *arg3 ;
-  int *arg4 ;
-  npy_cdouble_wrapper *arg5 ;
-  int val1 ;
-  int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *array3 = NULL ;
-  int is_new_object3 ;
-  PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
-  ecode1 = SWIG_AsVal_int(obj0, &val1);
-  if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', 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 '" "csc_sort_indices" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  {
-    npy_intp size[1] = {
-      -1
-    };
-    array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3);
-    if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1)
-      || !require_contiguous(array3)   || !require_native(array3)) SWIG_fail;
-    
-    arg3 = (int*) array3->data;
-  }
-  {
-    temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
-    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
-    arg4 = (int*) array_data(temp4);
-  }
-  {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_CDOUBLE);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (npy_cdouble_wrapper*) array_data(temp5);
-  }
-  csc_sort_indices<int,npy_cdouble_wrapper >(arg1,arg2,(int const (*))arg3,arg4,arg5);
-  resultobj = SWIG_Py_Void();
-  {
-    if (is_new_object3 && array3) Py_DECREF(array3);
-  }
-  return resultobj;
-fail:
-  {
-    if (is_new_object3 && array3) Py_DECREF(array3);
-  }
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_csc_sort_indices(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[6];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = (int)PyObject_Length(args);
-  for (ii = 0; (ii < argc) && (ii < 5); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 5) {
-    int _v;
-    {
-      int res = SWIG_AsVal_int(argv[0], NULL);
-      _v = SWIG_CheckState(res);
-    }
-    if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0;
-        }
-        if (_v) {
-          {
-            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
-          }
-          if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_BYTE)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csc_sort_indices__SWIG_1(self, args);
-            }
-          }
-        }
-      }
-    }
-  }
-  if (argc == 5) {
-    int _v;
-    {
-      int res = SWIG_AsVal_int(argv[0], NULL);
-      _v = SWIG_CheckState(res);
-    }
-    if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0;
-        }
-        if (_v) {
-          {
-            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
-          }
-          if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_UBYTE)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csc_sort_indices__SWIG_2(self, args);
-            }
-          }
-        }
-      }
-    }
-  }
-  if (argc == 5) {
-    int _v;
-    {
-      int res = SWIG_AsVal_int(argv[0], NULL);
-      _v = SWIG_CheckState(res);
-    }
-    if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0;
-        }
-        if (_v) {
-          {
-            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
-          }
-          if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_SHORT)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csc_sort_indices__SWIG_3(self, args);
-            }
-          }
-        }
-      }
-    }
-  }
-  if (argc == 5) {
-    int _v;
-    {
-      int res = SWIG_AsVal_int(argv[0], NULL);
-      _v = SWIG_CheckState(res);
-    }
-    if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0;
-        }
-        if (_v) {
-          {
-            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
-          }
-          if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csc_sort_indices__SWIG_4(self, args);
-            }
-          }
-        }
-      }
-    }
-  }
-  if (argc == 5) {
-    int _v;
-    {
-      int res = SWIG_AsVal_int(argv[0], NULL);
-      _v = SWIG_CheckState(res);
-    }
-    if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0;
-        }
-        if (_v) {
-          {
-            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
-          }
-          if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_LONGLONG)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csc_sort_indices__SWIG_5(self, args);
-            }
-          }
-        }
-      }
-    }
-  }
-  if (argc == 5) {
-    int _v;
-    {
-      int res = SWIG_AsVal_int(argv[0], NULL);
-      _v = SWIG_CheckState(res);
-    }
-    if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0;
-        }
-        if (_v) {
-          {
-            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
-          }
-          if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csc_sort_indices__SWIG_6(self, args);
-            }
-          }
-        }
-      }
-    }
-  }
-  if (argc == 5) {
-    int _v;
-    {
-      int res = SWIG_AsVal_int(argv[0], NULL);
-      _v = SWIG_CheckState(res);
-    }
-    if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0;
-        }
-        if (_v) {
-          {
-            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
-          }
-          if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csc_sort_indices__SWIG_7(self, args);
-            }
-          }
-        }
-      }
-    }
-  }
-  if (argc == 5) {
-    int _v;
-    {
-      int res = SWIG_AsVal_int(argv[0], NULL);
-      _v = SWIG_CheckState(res);
-    }
-    if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0;
-        }
-        if (_v) {
-          {
-            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
-          }
-          if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CFLOAT)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csc_sort_indices__SWIG_8(self, args);
-            }
-          }
-        }
-      }
-    }
-  }
-  if (argc == 5) {
-    int _v;
-    {
-      int res = SWIG_AsVal_int(argv[0], NULL);
-      _v = SWIG_CheckState(res);
-    }
-    if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0;
-        }
-        if (_v) {
-          {
-            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
-          }
-          if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CDOUBLE)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csc_sort_indices__SWIG_9(self, args);
-            }
-          }
-        }
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_sort_indices'.\n  Possible C/C++ prototypes are:\n""    csc_sort_indices<(int,signed char)>(int const,int const,int const [],int [],signed char [])\n""    csc_sort_indices<(int,unsigned char)>(int const,int const,int const [],int [],unsigned char [])\n""    csc_sort_indices<(int,short)>(int const,int const,int const [],int [],short [])\n""    csc_sort_indices<(int,int)>(int const,int const,int const [],int [],int [])\n""    csc_sort_indices<(int,long long)>(int const,int const,int const [],int [],long long [])\n""    csc_sort_indices<(int,float)>(int const,int const,int const [],int [],float [])\n""    csc_sort_indices<(int,double)>(int const,int const,int const [],int [],double [])\n""    csc_sort_indices<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int [],npy_cfloat_wrapper [])\n""    csc_sort_indices<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int [],npy_cdouble_wrapper [])\n");
-  return NULL;
-}
-
-
 SWIGINTERN PyObject *_wrap_csr_sum_duplicates__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
@@ -50190,788 +49156,6 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  int arg1 ;
-  int arg2 ;
-  int *arg3 ;
-  int *arg4 ;
-  signed char *arg5 ;
-  int val1 ;
-  int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *temp3 = NULL ;
-  PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
-  ecode1 = SWIG_AsVal_int(obj0, &val1);
-  if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', 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 '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  {
-    temp3 = obj_to_array_no_conversion(obj2,PyArray_INT);
-    if (!temp3  || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail;
-    arg3 = (int*) array_data(temp3);
-  }
-  {
-    temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
-    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
-    arg4 = (int*) array_data(temp4);
-  }
-  {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_BYTE);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (signed char*) array_data(temp5);
-  }
-  csc_sum_duplicates<int,signed char >(arg1,arg2,arg3,arg4,arg5);
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  int arg1 ;
-  int arg2 ;
-  int *arg3 ;
-  int *arg4 ;
-  unsigned char *arg5 ;
-  int val1 ;
-  int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *temp3 = NULL ;
-  PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
-  ecode1 = SWIG_AsVal_int(obj0, &val1);
-  if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', 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 '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  {
-    temp3 = obj_to_array_no_conversion(obj2,PyArray_INT);
-    if (!temp3  || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail;
-    arg3 = (int*) array_data(temp3);
-  }
-  {
-    temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
-    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
-    arg4 = (int*) array_data(temp4);
-  }
-  {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_UBYTE);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (unsigned char*) array_data(temp5);
-  }
-  csc_sum_duplicates<int,unsigned char >(arg1,arg2,arg3,arg4,arg5);
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  int arg1 ;
-  int arg2 ;
-  int *arg3 ;
-  int *arg4 ;
-  short *arg5 ;
-  int val1 ;
-  int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *temp3 = NULL ;
-  PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
-  ecode1 = SWIG_AsVal_int(obj0, &val1);
-  if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', 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 '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  {
-    temp3 = obj_to_array_no_conversion(obj2,PyArray_INT);
-    if (!temp3  || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail;
-    arg3 = (int*) array_data(temp3);
-  }
-  {
-    temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
-    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
-    arg4 = (int*) array_data(temp4);
-  }
-  {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_SHORT);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (short*) array_data(temp5);
-  }
-  csc_sum_duplicates<int,short >(arg1,arg2,arg3,arg4,arg5);
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  int arg1 ;
-  int arg2 ;
-  int *arg3 ;
-  int *arg4 ;
-  int *arg5 ;
-  int val1 ;
-  int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *temp3 = NULL ;
-  PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
-  ecode1 = SWIG_AsVal_int(obj0, &val1);
-  if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', 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 '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  {
-    temp3 = obj_to_array_no_conversion(obj2,PyArray_INT);
-    if (!temp3  || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail;
-    arg3 = (int*) array_data(temp3);
-  }
-  {
-    temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
-    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
-    arg4 = (int*) array_data(temp4);
-  }
-  {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_INT);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (int*) array_data(temp5);
-  }
-  csc_sum_duplicates<int,int >(arg1,arg2,arg3,arg4,arg5);
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  int arg1 ;
-  int arg2 ;
-  int *arg3 ;
-  int *arg4 ;
-  long long *arg5 ;
-  int val1 ;
-  int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *temp3 = NULL ;
-  PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
-  ecode1 = SWIG_AsVal_int(obj0, &val1);
-  if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', 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 '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  {
-    temp3 = obj_to_array_no_conversion(obj2,PyArray_INT);
-    if (!temp3  || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail;
-    arg3 = (int*) array_data(temp3);
-  }
-  {
-    temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
-    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
-    arg4 = (int*) array_data(temp4);
-  }
-  {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_LONGLONG);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (long long*) array_data(temp5);
-  }
-  csc_sum_duplicates<int,long long >(arg1,arg2,arg3,arg4,arg5);
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  int arg1 ;
-  int arg2 ;
-  int *arg3 ;
-  int *arg4 ;
-  float *arg5 ;
-  int val1 ;
-  int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *temp3 = NULL ;
-  PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
-  ecode1 = SWIG_AsVal_int(obj0, &val1);
-  if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', 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 '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  {
-    temp3 = obj_to_array_no_conversion(obj2,PyArray_INT);
-    if (!temp3  || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail;
-    arg3 = (int*) array_data(temp3);
-  }
-  {
-    temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
-    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
-    arg4 = (int*) array_data(temp4);
-  }
-  {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_FLOAT);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (float*) array_data(temp5);
-  }
-  csc_sum_duplicates<int,float >(arg1,arg2,arg3,arg4,arg5);
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  int arg1 ;
-  int arg2 ;
-  int *arg3 ;
-  int *arg4 ;
-  double *arg5 ;
-  int val1 ;
-  int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *temp3 = NULL ;
-  PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
-  ecode1 = SWIG_AsVal_int(obj0, &val1);
-  if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', 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 '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  {
-    temp3 = obj_to_array_no_conversion(obj2,PyArray_INT);
-    if (!temp3  || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail;
-    arg3 = (int*) array_data(temp3);
-  }
-  {
-    temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
-    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
-    arg4 = (int*) array_data(temp4);
-  }
-  {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_DOUBLE);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (double*) array_data(temp5);
-  }
-  csc_sum_duplicates<int,double >(arg1,arg2,arg3,arg4,arg5);
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  int arg1 ;
-  int arg2 ;
-  int *arg3 ;
-  int *arg4 ;
-  npy_cfloat_wrapper *arg5 ;
-  int val1 ;
-  int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *temp3 = NULL ;
-  PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
-  ecode1 = SWIG_AsVal_int(obj0, &val1);
-  if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', 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 '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  {
-    temp3 = obj_to_array_no_conversion(obj2,PyArray_INT);
-    if (!temp3  || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail;
-    arg3 = (int*) array_data(temp3);
-  }
-  {
-    temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
-    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
-    arg4 = (int*) array_data(temp4);
-  }
-  {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_CFLOAT);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (npy_cfloat_wrapper*) array_data(temp5);
-  }
-  csc_sum_duplicates<int,npy_cfloat_wrapper >(arg1,arg2,arg3,arg4,arg5);
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  int arg1 ;
-  int arg2 ;
-  int *arg3 ;
-  int *arg4 ;
-  npy_cdouble_wrapper *arg5 ;
-  int val1 ;
-  int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *temp3 = NULL ;
-  PyArrayObject *temp4 = NULL ;
-  PyArrayObject *temp5 = NULL ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
-  ecode1 = SWIG_AsVal_int(obj0, &val1);
-  if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', 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 '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'");
-  } 
-  arg2 = static_cast< int >(val2);
-  {
-    temp3 = obj_to_array_no_conversion(obj2,PyArray_INT);
-    if (!temp3  || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail;
-    arg3 = (int*) array_data(temp3);
-  }
-  {
-    temp4 = obj_to_array_no_conversion(obj3,PyArray_INT);
-    if (!temp4  || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail;
-    arg4 = (int*) array_data(temp4);
-  }
-  {
-    temp5 = obj_to_array_no_conversion(obj4,PyArray_CDOUBLE);
-    if (!temp5  || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail;
-    arg5 = (npy_cdouble_wrapper*) array_data(temp5);
-  }
-  csc_sum_duplicates<int,npy_cdouble_wrapper >(arg1,arg2,arg3,arg4,arg5);
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_csc_sum_duplicates(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[6];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = (int)PyObject_Length(args);
-  for (ii = 0; (ii < argc) && (ii < 5); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 5) {
-    int _v;
-    {
-      int res = SWIG_AsVal_int(argv[0], NULL);
-      _v = SWIG_CheckState(res);
-    }
-    if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0;
-        }
-        if (_v) {
-          {
-            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
-          }
-          if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_BYTE)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csc_sum_duplicates__SWIG_1(self, args);
-            }
-          }
-        }
-      }
-    }
-  }
-  if (argc == 5) {
-    int _v;
-    {
-      int res = SWIG_AsVal_int(argv[0], NULL);
-      _v = SWIG_CheckState(res);
-    }
-    if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0;
-        }
-        if (_v) {
-          {
-            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
-          }
-          if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_UBYTE)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csc_sum_duplicates__SWIG_2(self, args);
-            }
-          }
-        }
-      }
-    }
-  }
-  if (argc == 5) {
-    int _v;
-    {
-      int res = SWIG_AsVal_int(argv[0], NULL);
-      _v = SWIG_CheckState(res);
-    }
-    if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0;
-        }
-        if (_v) {
-          {
-            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
-          }
-          if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_SHORT)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csc_sum_duplicates__SWIG_3(self, args);
-            }
-          }
-        }
-      }
-    }
-  }
-  if (argc == 5) {
-    int _v;
-    {
-      int res = SWIG_AsVal_int(argv[0], NULL);
-      _v = SWIG_CheckState(res);
-    }
-    if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0;
-        }
-        if (_v) {
-          {
-            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
-          }
-          if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csc_sum_duplicates__SWIG_4(self, args);
-            }
-          }
-        }
-      }
-    }
-  }
-  if (argc == 5) {
-    int _v;
-    {
-      int res = SWIG_AsVal_int(argv[0], NULL);
-      _v = SWIG_CheckState(res);
-    }
-    if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0;
-        }
-        if (_v) {
-          {
-            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
-          }
-          if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_LONGLONG)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csc_sum_duplicates__SWIG_5(self, args);
-            }
-          }
-        }
-      }
-    }
-  }
-  if (argc == 5) {
-    int _v;
-    {
-      int res = SWIG_AsVal_int(argv[0], NULL);
-      _v = SWIG_CheckState(res);
-    }
-    if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0;
-        }
-        if (_v) {
-          {
-            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
-          }
-          if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csc_sum_duplicates__SWIG_6(self, args);
-            }
-          }
-        }
-      }
-    }
-  }
-  if (argc == 5) {
-    int _v;
-    {
-      int res = SWIG_AsVal_int(argv[0], NULL);
-      _v = SWIG_CheckState(res);
-    }
-    if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0;
-        }
-        if (_v) {
-          {
-            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
-          }
-          if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csc_sum_duplicates__SWIG_7(self, args);
-            }
-          }
-        }
-      }
-    }
-  }
-  if (argc == 5) {
-    int _v;
-    {
-      int res = SWIG_AsVal_int(argv[0], NULL);
-      _v = SWIG_CheckState(res);
-    }
-    if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0;
-        }
-        if (_v) {
-          {
-            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
-          }
-          if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CFLOAT)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csc_sum_duplicates__SWIG_8(self, args);
-            }
-          }
-        }
-      }
-    }
-  }
-  if (argc == 5) {
-    int _v;
-    {
-      int res = SWIG_AsVal_int(argv[0], NULL);
-      _v = SWIG_CheckState(res);
-    }
-    if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0;
-        }
-        if (_v) {
-          {
-            _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0;
-          }
-          if (_v) {
-            {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CDOUBLE)) ? 1 : 0;
-            }
-            if (_v) {
-              return _wrap_csc_sum_duplicates__SWIG_9(self, args);
-            }
-          }
-        }
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_sum_duplicates'.\n  Possible C/C++ prototypes are:\n""    csc_sum_duplicates<(int,signed char)>(int const,int const,int [],int [],signed char [])\n""    csc_sum_duplicates<(int,unsigned char)>(int const,int const,int [],int [],unsigned char [])\n""    csc_sum_duplicates<(int,short)>(int const,int const,int [],int [],short [])\n""    csc_sum_duplicates<(int,int)>(int const,int const,int [],int [],int [])\n""    csc_sum_duplicates<(int,long long)>(int const,int const,int [],int [],long long [])\n""    csc_sum_duplicates<(int,float)>(int const,int const,int [],int [],float [])\n""    csc_sum_duplicates<(int,double)>(int const,int const,int [],int [],double [])\n""    csc_sum_duplicates<(int,npy_cfloat_wrapper)>(int const,int const,int [],int [],npy_cfloat_wrapper [])\n""    csc_sum_duplicates<(int,npy_cdouble_wrapper)>(int const,int const,int [],int [],npy_cdouble_wrapper [])\n");
-  return NULL;
-}
-
-
 SWIGINTERN PyObject *_wrap_get_csr_submatrix__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
@@ -53588,29 +51772,18 @@
 		"    std::vector<(int)> Cp, std::vector<(int)> Cj, \n"
 		"    std::vector<(npy_cdouble_wrapper)> Cx)\n"
 		""},
-	 { (char *)"has_sorted_indices", _wrap_has_sorted_indices, METH_VARARGS, (char *)"has_sorted_indices(int n_row, int n_col, int Ap, int Aj) -> bool"},
+	 { (char *)"csr_has_sorted_indices", _wrap_csr_has_sorted_indices, METH_VARARGS, (char *)"csr_has_sorted_indices(int n_row, int Ap, int Aj) -> bool"},
 	 { (char *)"csr_sort_indices", _wrap_csr_sort_indices, METH_VARARGS, (char *)"\n"
-		"csr_sort_indices(int n_row, int n_col, int Ap, int Aj, signed char Ax)\n"
-		"csr_sort_indices(int n_row, int n_col, int Ap, int Aj, unsigned char Ax)\n"
-		"csr_sort_indices(int n_row, int n_col, int Ap, int Aj, short Ax)\n"
-		"csr_sort_indices(int n_row, int n_col, int Ap, int Aj, int Ax)\n"
-		"csr_sort_indices(int n_row, int n_col, int Ap, int Aj, long long Ax)\n"
-		"csr_sort_indices(int n_row, int n_col, int Ap, int Aj, float Ax)\n"
-		"csr_sort_indices(int n_row, int n_col, int Ap, int Aj, double Ax)\n"
-		"csr_sort_indices(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax)\n"
-		"csr_sort_indices(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax)\n"
+		"csr_sort_indices(int n_row, int Ap, int Aj, signed char Ax)\n"
+		"csr_sort_indices(int n_row, int Ap, int Aj, unsigned char Ax)\n"
+		"csr_sort_indices(int n_row, int Ap, int Aj, short Ax)\n"
+		"csr_sort_indices(int n_row, int Ap, int Aj, int Ax)\n"
+		"csr_sort_indices(int n_row, int Ap, int Aj, long long Ax)\n"
+		"csr_sort_indices(int n_row, int Ap, int Aj, float Ax)\n"
+		"csr_sort_indices(int n_row, int Ap, int Aj, double Ax)\n"
+		"csr_sort_indices(int n_row, int Ap, int Aj, npy_cfloat_wrapper Ax)\n"
+		"csr_sort_indices(int n_row, int Ap, int Aj, npy_cdouble_wrapper Ax)\n"
 		""},
-	 { (char *)"csc_sort_indices", _wrap_csc_sort_indices, METH_VARARGS, (char *)"\n"
-		"csc_sort_indices(int n_row, int n_col, int Ap, int Ai, signed char Ax)\n"
-		"csc_sort_indices(int n_row, int n_col, int Ap, int Ai, unsigned char Ax)\n"
-		"csc_sort_indices(int n_row, int n_col, int Ap, int Ai, short Ax)\n"
-		"csc_sort_indices(int n_row, int n_col, int Ap, int Ai, int Ax)\n"
-		"csc_sort_indices(int n_row, int n_col, int Ap, int Ai, long long Ax)\n"
-		"csc_sort_indices(int n_row, int n_col, int Ap, int Ai, float Ax)\n"
-		"csc_sort_indices(int n_row, int n_col, int Ap, int Ai, double Ax)\n"
-		"csc_sort_indices(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax)\n"
-		"csc_sort_indices(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax)\n"
-		""},
 	 { (char *)"csr_sum_duplicates", _wrap_csr_sum_duplicates, METH_VARARGS, (char *)"\n"
 		"csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, signed char Ax)\n"
 		"csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, unsigned char Ax)\n"
@@ -53622,17 +51795,6 @@
 		"csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax)\n"
 		"csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax)\n"
 		""},
-	 { (char *)"csc_sum_duplicates", _wrap_csc_sum_duplicates, METH_VARARGS, (char *)"\n"
-		"csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, signed char Ax)\n"
-		"csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, unsigned char Ax)\n"
-		"csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, short Ax)\n"
-		"csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, int Ax)\n"
-		"csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, long long Ax)\n"
-		"csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, float Ax)\n"
-		"csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, double Ax)\n"
-		"csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax)\n"
-		"csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax)\n"
-		""},
 	 { (char *)"get_csr_submatrix", _wrap_get_csr_submatrix, METH_VARARGS, (char *)"\n"
 		"get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n"
 		"    int ir0, int ir1, int ic0, int ic1, std::vector<(int)> Bp, \n"

Modified: trunk/scipy/sparse/tests/test_base.py
===================================================================
--- trunk/scipy/sparse/tests/test_base.py	2007-12-23 21:07:00 UTC (rev 3699)
+++ trunk/scipy/sparse/tests/test_base.py	2007-12-24 00:16:09 UTC (rev 3700)
@@ -163,7 +163,8 @@
         assert_array_equal(c.todense(),[[1,0,0,4],[9,0,1,0],[0,4,0,0]])
 
     def check_eldiv(self):
-        assert_array_equal((self.datsp / self.datsp).todense(),[[1,0,0,1],[1,0,1,0],[0,1,0,0]])
+        expected = [[1,0,0,1],[1,0,1,0],[0,1,0,0]] 
+        assert_array_equal((self.datsp / self.datsp).todense(),expected)
 
         denom = self.spmatrix(matrix([[1,0,0,4],[-1,0,0,0],[0,8,0,-5]],'d'))
         res = matrix([[1,0,0,0.5],[-3,0,numpy.inf,0],[0,0.25,0,0]],'d')
@@ -340,7 +341,8 @@
     def check_large(self):
         # Create a 100x100 matrix with 100 non-zero elements
         # and play around with it
-        #TODO make this use self.spmatrix or move it elsewhere
+        #TODO move this out of Common since it doesn't use spmatrix
+        random.seed(0)
         A = dok_matrix((100,100))
         for k in range(100):
             i = random.randrange(100)
@@ -496,7 +498,7 @@
 
 class _TestGetSet:
     def check_setelement(self):
-        a = self.datsp - self.datsp
+        a = self.spmatrix((3,4))
         a[1,2] = 4.0
         a[0,1] = 3
         a[2,0] = 2.0




More information about the Scipy-svn mailing list