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

scipy-svn@scip... scipy-svn@scip...
Mon Dec 10 14:47:44 CST 2007


Author: wnbell
Date: 2007-12-10 14:46:04 -0600 (Mon, 10 Dec 2007)
New Revision: 3627

Modified:
   trunk/scipy/sparse/sparse.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_sparse.py
Log:
anged sparsetools to use preallocated storage


Modified: trunk/scipy/sparse/sparse.py
===================================================================
--- trunk/scipy/sparse/sparse.py	2007-12-09 07:00:42 UTC (rev 3626)
+++ trunk/scipy/sparse/sparse.py	2007-12-10 20:46:04 UTC (rev 3627)
@@ -18,11 +18,11 @@
                   ndarray, amax, amin, rank, conj, searchsorted, ndarray,   \
                   less, where, greater, array, transpose, empty, ones, \
                   arange, shape, intc, clip, prod, unravel_index, hstack, \
-                  array_split, concatenate, cumsum
+                  array_split, concatenate, cumsum, diff, empty_like
 
 import numpy
 from scipy.sparse.sparsetools import csrtodense, \
-     cootocsr, csrtocoo, cootocsc, csctocoo, csctocsr, csrtocsc 
+     cootocsr, cootocsc, csctocsr, csrtocsc 
 
 import sparsetools
 import itertools, operator, copy
@@ -888,17 +888,8 @@
 #        else:
 #            raise TypeError,'unrecognized type'
 
-    def tocoo(self):
-        #TODO implement with arange(N).repeat(diff(indptr))
 
-        fn = getattr(sparsetools, self.format + 'tocoo')
-        
-        rows, cols, data = fn(self.shape[0], self.shape[1], \
-                              self.indptr, self.indices, self.data)
 
-        return coo_matrix((data, (rows, cols)), self.shape)
-
-
     def sum(self, axis=None):
         """Sum the matrix over the given axis.  If the axis is None, sum
         over both rows and columns, returning a scalar.
@@ -1150,12 +1141,38 @@
 
     def _tothis(self, other):
         return other.tocsc()
-
+    
     def tocsr(self):
-        indptr, colind, data = csctocsr(self.shape[0], self.shape[1], \
-                                        self.indptr, self.indices, self.data)
-        return csr_matrix((data, colind, indptr), self.shape)
+        indptr  = empty(self.shape[0] + 1, dtype=intc)
+        indices = empty(self.nnz, dtype=intc)
+        data    = empty(self.nnz, dtype=self.dtype)
 
+        csctocsr(self.shape[0], self.shape[1], \
+                self.indptr, self.indices, self.data, \
+                indptr, indices, data)
+
+        return csr_matrix((data, indices, indptr), self.shape)
+
+
+    def tocoo(self,copy=True):
+        """Return a COOrdinate representation of this matrix
+
+        When copy=False the index and data arrays are not copied.
+        """
+        M,N = self.shape
+
+        data = self.data[:self.nnz].copy()
+        row  = self.indices[:self.nnz].copy()
+
+        if copy:
+            data = data.copy()
+            row  = row.copy()
+
+        col = empty_like(row)
+        sparsetools.expandptr(N,self.indptr,col)
+
+        return coo_matrix((data,(row,col)), self.shape)
+    
     def toarray(self):
         return self.tocsr().toarray()
 
@@ -1347,10 +1364,36 @@
         return self.toself(copy)
 
     def tocsc(self):
-        indptr, rowind, data = csrtocsc(self.shape[0], self.shape[1], \
-                                        self.indptr, self.indices, self.data)
-        return csc_matrix((data, rowind, indptr), self.shape)
+        indptr  = empty(self.shape[1] + 1, dtype=intc)
+        indices = empty(self.nnz, dtype=intc)
+        data    = empty(self.nnz, self.dtype)
 
+        csrtocsc(self.shape[0], self.shape[1], \
+                 self.indptr, self.indices, self.data, \
+                 indptr, indices, data)
+
+        return csc_matrix((data, indices, indptr), self.shape)
+    
+    def tocoo(self,copy=True):
+        """Return a COOrdinate representation of this matrix
+
+        When copy=False the index and data arrays are not copied.
+        """
+        M,N = self.shape
+
+        data = self.data[:self.nnz].copy()
+        col  = self.indices[:self.nnz].copy()
+
+        if copy:
+            data = data.copy()
+            col  = col.copy()
+
+        row = empty_like(col)
+        sparsetools.expandptr(M,self.indptr,row)
+
+        return coo_matrix((data,(row,col)), self.shape)
+    
+
     def _toother(self):
         return self.tocsc()
 
@@ -2101,21 +2144,31 @@
         if self.nnz == 0:
             return csc_matrix(self.shape, dtype=self.dtype)
         else:
-            indptr, rowind, data = cootocsc(self.shape[0], self.shape[1], \
-                                            self.nnz, self.row, self.col, \
-                                            self.data)
-            return csc_matrix((data, rowind, indptr), self.shape)
+            indptr  = empty(self.shape[1] + 1,dtype=intc)
+            indices = empty(self.nnz, dtype=intc)
+            data    = empty(self.nnz, dtype=self.dtype)
 
+            cootocsc(self.shape[0], self.shape[1], self.nnz, \
+                     self.row, self.col, self.data, \
+                     indptr, indices, data)
 
+            return csc_matrix((data, indices, indptr), self.shape)
+
+
     def tocsr(self):
         if self.nnz == 0:
             return csr_matrix(self.shape, dtype=self.dtype)
         else:
-            indptr, colind, data = cootocsr(self.shape[0], self.shape[1], \
-                                            self.nnz, self.row, self.col, \
-                                            self.data)
-            return csr_matrix((data, colind, indptr), self.shape)
+            indptr  = empty(self.shape[0] + 1,dtype=intc)
+            indices = empty(self.nnz, dtype=intc)
+            data    = empty(self.nnz, dtype=self.dtype)
 
+            cootocsr(self.shape[0], self.shape[1], self.nnz, \
+                     self.row, self.col, self.data, \
+                     indptr, indices, data)
+
+            return csr_matrix((data, indices, indptr), self.shape)
+
     def tocoo(self, copy=False):
         return self.toself(copy)
 

Modified: trunk/scipy/sparse/sparsetools/sparsetools.h
===================================================================
--- trunk/scipy/sparse/sparsetools/sparsetools.h	2007-12-09 07:00:42 UTC (rev 3626)
+++ trunk/scipy/sparse/sparsetools/sparsetools.h	2007-12-10 20:46:04 UTC (rev 3627)
@@ -72,6 +72,38 @@
 
 
 /*
+ * Expand a compressed row pointer into a row array
+ *
+ * Input Arguments:
+ *   I  n_row         - number of rows in A
+ *   I  Ap[n_row+1]   - row pointer
+ *
+ * Output Arguments:
+ *   Bi  - row indices
+ *
+ * Note:
+ *   Output array Bi needs to be preallocated
+ *
+ * Note: 
+ *   Complexity: Linear.
+ * 
+ */
+template <class I>
+void expandptr(const I n_row,
+               const I Ap[], 
+                     I Bi[])
+{
+  for(I i = 0; i < n_row; i++){
+    I row_start = Ap[i];
+    I row_end   = Ap[i+1];
+    for(I jj = row_start; jj < row_end; jj++){
+      Bi[jj] = i;
+    }
+  }
+}
+
+
+/*
  * Compute B = A for CSR matrix A, CSC matrix B
  *
  * Also, with the appropriate arguments can also be used to:
@@ -87,12 +119,12 @@
  *   T  Ax[nnz(A)]    - nonzeros
  *
  * Output Arguments:
- *   vec<I>  Bp  - row pointer
- *   vec<I>  Bj  - column indices
- *   vec<T>  Bx  - nonzeros
+ *   I  Bp[n_col+1] - column pointer
+ *   I  Bj[nnz(A)]  - row indices
+ *   T  Bx[nnz(A)]  - nonzeros
  *
  * Note:
- *   Output arrays Bp,Bj,Bx will be allocated within in the method
+ *   Output arrays Bp,Bj,Bx should be preallocated
  *
  * Note: 
  *   Input:  column indices *are not* assumed to be in sorted order
@@ -107,42 +139,39 @@
 	          const I Ap[], 
 	          const I Aj[], 
 	          const T Ax[],
-	          std::vector<I>* Bp,
-	          std::vector<I>* Bi,
-	          std::vector<T>* Bx)
+	                I Bp[],
+	                I Bi[],
+	                T Bx[])
 {  
   I NNZ = Ap[n_row];
   
-  Bp->resize(n_col+1);
-  Bi->resize(NNZ);
-  Bx->resize(NNZ);
+  std::vector<I> temp(n_col,0); //temp array
  
-  std::vector<I> nnz_per_col(n_col,0); //temp array
- 
   //compute number of non-zero entries per column of A 
   for (I i = 0; i < NNZ; i++){            
-    nnz_per_col[Aj[i]]++;
+    temp[Aj[i]]++;
   }
         
-  //cumsum the nnz_per_col to get Bp[]
+  //cumsum the nnz per column to get Bp[]
   for(I i = 0, cumsum = 0; i < n_col; i++){     
-    (*Bp)[i]   = cumsum; 
-    cumsum += nnz_per_col[i];
-    nnz_per_col[i] = 0;              //reset count
+    Bp[i] = cumsum;
+    cumsum += temp[i];
   }
-  (*Bp)[n_col] = NNZ;
+  Bp[n_col] = NNZ; 
+  std::copy(Bp, Bp + n_col, temp.begin());
+
   
   for(I i = 0; i < n_row; i++){
     I row_start = Ap[i];
     I row_end   = Ap[i+1];
     for(I j = row_start; j < row_end; j++){
       I col = Aj[j];
-      I k   = (*Bp)[col] + nnz_per_col[col];
+      I k   = temp[col];
 
-      (*Bi)[k] = i;
-      (*Bx)[k] = Ax[j];
+      Bi[k] = i;
+      Bx[k] = Ax[j];
 
-      nnz_per_col[col]++;
+      temp[col]++;
     }
   }  
 }   
@@ -510,24 +539,25 @@
  *
  *
  * Input Arguments:
- *   I  n_row         - number of rows in A
- *   I  n_col         - number of columns in A
- *   I  Ai[nnz(A)]    - row indices
- *   I  Aj[nnz(A)]    - column indices
- *   T  Ax[nnz(A)]    - nonzeros
+ *   I  n_row      - number of rows in A
+ *   I  n_col      - number of columns in A
+ *   I  Ai[nnz(A)] - row indices
+ *   I  Aj[nnz(A)] - column indices
+ *   T  Ax[nnz(A)] - nonzeros
  * Output Arguments:
- *   vec<I> Bp        - row pointer
- *   vec<I> Bj        - column indices
- *   vec<T> Bx        - nonzeros
+ *   I Bp  - row pointer
+ *   I Bj  - column indices
+ *   T Bx  - nonzeros
  *
  * Note:
- *   Output arrays Bp,Bj,Bx will be allocated within in the method
+ *   Output arrays Bp,Bj,Bx should be preallocated
  *
  * Note: 
  *   Input:  row and column indices *are not* assumed to be ordered
  *           duplicate (i,j) entries will be summed together
- *
+ *           
  *   Output: CSR column indices *will be* in sorted order
+ *           Bp[n_row] will store the number of nonzeros
  *
  *   Complexity: Linear.  Specifically O(nnz(A) + max(n_row,n_col))
  * 
@@ -539,45 +569,37 @@
               const I Ai[],
               const I Aj[],
               const T Ax[],
-              std::vector<I>* Bp,
-              std::vector<I>* Bj,
-              std::vector<T>* Bx)
+                    I Bp[],
+                    I Bj[],
+                    T Bx[])
 {
-  Bp->resize(n_row+1,0);
-  Bj->resize(NNZ);
-  Bx->resize(NNZ);
-  
-  std::vector<I> nnz_per_row(n_row,0); //temp array
+  std::vector<I> temp(n_row,0);
 
   //compute nnz per row, then compute Bp
   for(I i = 0; i < NNZ; i++){
-    nnz_per_row[Ai[i]]++;
+    temp[Ai[i]]++;
   }
-  for(I i = 0, cumsum = 0; i < n_row; i++){
-    (*Bp)[i]          = cumsum;
-    cumsum        += nnz_per_row[i];
-    nnz_per_row[i] = 0; //reset count
+  //cumsum the nnz per row to get Bp[]
+  for(I i = 0, cumsum = 0; i < n_row; i++){     
+    Bp[i] = cumsum;
+    cumsum += temp[i];
   }
-  (*Bp)[n_row] = NNZ;
+  Bp[n_row] = NNZ; 
+  std::copy(Bp, Bp + n_row, temp.begin());
 
-
-  //write Aj,Ax Io tempBj,tempBx
+  //write Aj,Ax into Bj,Bx
   for(I i = 0; i < NNZ; i++){
     I row = Ai[i];
-    I n   = (*Bp)[row] + nnz_per_row[row];
+    I n   = temp[row];
 
-    (*Bj)[n] = Aj[i];
-    (*Bx)[n] = Ax[i];
+    Bj[n] = Aj[i];
+    Bx[n] = Ax[i];
 
-    nnz_per_row[row]++;
+    temp[row]++;
   }
-  //now tempBp,tempBj,tempBx form a CSR representation (with duplicates)
+  //now Bp,Bj,Bx form a CSR representation (with duplicates)
 
-  sum_csr_duplicates(n_row,n_col,&(*Bp)[0],&(*Bj)[0],&(*Bx)[0]);
-
-  //trim unused space at the end
-  Bj->resize(Bp->back());
-  Bx->resize(Bp->back());
+  sum_csr_duplicates(n_row,n_col,Bp,Bj,Bx);
 }
 	    
 
@@ -933,9 +955,9 @@
               const I Ap[], 
               const I Ai[], 
               const T Ax[],
-              std::vector<I>* Bp,
-              std::vector<I>* Bj,
-              std::vector<T>* Bx)
+                    I Bp[],
+                    I Bj[],
+                    T Bx[])
 { csrtocsc<I,T>(n_col,n_row,Ap,Ai,Ax,Bp,Bj,Bx); }
 
 template <class I, class T>
@@ -970,9 +992,9 @@
       	      const I Ai[],
       	      const I Aj[],
       	      const T Ax[],
-      	      std::vector<I>* Bp,
-      	      std::vector<I>* Bi,
-      	      std::vector<T>* Bx)
+      	            I Bp[],
+      	            I Bi[],
+      	            T Bx[])
 { cootocsr<I,T>(n_col,n_row,NNZ,Aj,Ai,Ax,Bp,Bi,Bx); }
 
 

Modified: trunk/scipy/sparse/sparsetools/sparsetools.i
===================================================================
--- trunk/scipy/sparse/sparsetools/sparsetools.i	2007-12-09 07:00:42 UTC (rev 3626)
+++ trunk/scipy/sparse/sparsetools/sparsetools.i	2007-12-10 20:46:04 UTC (rev 3627)
@@ -90,13 +90,17 @@
 %define I_INPLACE_ARRAY1( ctype )
 %apply ctype * INPLACE_ARRAY {
   ctype Ap [ ],
-  ctype Aj [ ]
+  ctype Aj [ ],
+  ctype Bp [ ],
+  ctype Bi [ ],
+  ctype Bj [ ]
 };
 %enddef
 
 %define T_INPLACE_ARRAY1( ctype )
 %apply ctype * INPLACE_ARRAY {
-  ctype Ax [ ]
+  ctype Ax [ ],
+  ctype Bx [ ]
 };
 %enddef
 
@@ -164,6 +168,8 @@
 %enddef
 
 
+
+
 /*
  *  diag(CSR) and diag(CSC)
  */
@@ -180,8 +186,9 @@
 /*
  * CSR<->COO and CSC<->COO
  */
-INSTANTIATE_ALL(csrtocoo)
-INSTANTIATE_ALL(csctocoo)
+%template(expandptr)   expandptr<int>;
+/*INSTANTIATE_ALL(csrtocoo)*/
+/*INSTANTIATE_ALL(csctocoo)*/
 INSTANTIATE_ALL(cootocsr)
 INSTANTIATE_ALL(cootocsc)
 

Modified: trunk/scipy/sparse/sparsetools/sparsetools.py
===================================================================
--- trunk/scipy/sparse/sparsetools/sparsetools.py	2007-12-09 07:00:42 UTC (rev 3626)
+++ trunk/scipy/sparse/sparsetools/sparsetools.py	2007-12-10 20:46:04 UTC (rev 3627)
@@ -49,7 +49,11 @@
 
 
 
+def expandptr(*args):
+  """expandptr(int n_row, int Ap, int Bi)"""
+  return _sparsetools.expandptr(*args)
 
+
 def extract_csr_diagonal(*args):
   """
     extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, signed char Ax, 
@@ -91,176 +95,92 @@
 def csrtocsc(*args):
   """
     csrtocsc(int n_row, int n_col, int Ap, int Aj, signed char Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bi, 
-        std::vector<(signed char)> Bx)
+        int Bp, int Bi, signed char Bx)
     csrtocsc(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bi, 
-        std::vector<(unsigned char)> Bx)
-    csrtocsc(int n_row, int n_col, int Ap, int Aj, short Ax, std::vector<(int)> Bp, 
-        std::vector<(int)> Bi, std::vector<(short)> Bx)
-    csrtocsc(int n_row, int n_col, int Ap, int Aj, int Ax, std::vector<(int)> Bp, 
-        std::vector<(int)> Bi, std::vector<(int)> Bx)
+        int Bp, int Bi, unsigned char Bx)
+    csrtocsc(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, 
+        int Bi, short Bx)
+    csrtocsc(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, 
+        int Bi, int Bx)
     csrtocsc(int n_row, int n_col, int Ap, int Aj, long long Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bi, 
-        std::vector<(long long)> Bx)
-    csrtocsc(int n_row, int n_col, int Ap, int Aj, float Ax, std::vector<(int)> Bp, 
-        std::vector<(int)> Bi, std::vector<(float)> Bx)
-    csrtocsc(int n_row, int n_col, int Ap, int Aj, double Ax, std::vector<(int)> Bp, 
-        std::vector<(int)> Bi, std::vector<(double)> Bx)
+        int Bp, int Bi, long long Bx)
+    csrtocsc(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, 
+        int Bi, float Bx)
+    csrtocsc(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, 
+        int Bi, double Bx)
     csrtocsc(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bi, 
-        std::vector<(npy_cfloat_wrapper)> Bx)
+        int Bp, int Bi, npy_cfloat_wrapper Bx)
     csrtocsc(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bi, 
-        std::vector<(npy_cdouble_wrapper)> Bx)
+        int Bp, int Bi, npy_cdouble_wrapper Bx)
     """
   return _sparsetools.csrtocsc(*args)
 
 def csctocsr(*args):
   """
     csctocsr(int n_row, int n_col, int Ap, int Ai, signed char Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bj, 
-        std::vector<(signed char)> Bx)
+        int Bp, int Bj, signed char Bx)
     csctocsr(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bj, 
-        std::vector<(unsigned char)> Bx)
-    csctocsr(int n_row, int n_col, int Ap, int Ai, short Ax, std::vector<(int)> Bp, 
-        std::vector<(int)> Bj, std::vector<(short)> Bx)
-    csctocsr(int n_row, int n_col, int Ap, int Ai, int Ax, std::vector<(int)> Bp, 
-        std::vector<(int)> Bj, std::vector<(int)> Bx)
+        int Bp, int Bj, unsigned char Bx)
+    csctocsr(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, 
+        int Bj, short Bx)
+    csctocsr(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, 
+        int Bj, int Bx)
     csctocsr(int n_row, int n_col, int Ap, int Ai, long long Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bj, 
-        std::vector<(long long)> Bx)
-    csctocsr(int n_row, int n_col, int Ap, int Ai, float Ax, std::vector<(int)> Bp, 
-        std::vector<(int)> Bj, std::vector<(float)> Bx)
-    csctocsr(int n_row, int n_col, int Ap, int Ai, double Ax, std::vector<(int)> Bp, 
-        std::vector<(int)> Bj, std::vector<(double)> Bx)
+        int Bp, int Bj, long long Bx)
+    csctocsr(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, 
+        int Bj, float Bx)
+    csctocsr(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, 
+        int Bj, double Bx)
     csctocsr(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bj, 
-        std::vector<(npy_cfloat_wrapper)> Bx)
+        int Bp, int Bj, npy_cfloat_wrapper Bx)
     csctocsr(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bj, 
-        std::vector<(npy_cdouble_wrapper)> Bx)
+        int Bp, int Bj, npy_cdouble_wrapper Bx)
     """
   return _sparsetools.csctocsr(*args)
 
-def csrtocoo(*args):
-  """
-    csrtocoo(int n_row, int n_col, int Ap, int Aj, signed char Ax, 
-        std::vector<(int)> Bi, std::vector<(int)> Bj, 
-        std::vector<(signed char)> Bx)
-    csrtocoo(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, 
-        std::vector<(int)> Bi, std::vector<(int)> Bj, 
-        std::vector<(unsigned char)> Bx)
-    csrtocoo(int n_row, int n_col, int Ap, int Aj, short Ax, std::vector<(int)> Bi, 
-        std::vector<(int)> Bj, std::vector<(short)> Bx)
-    csrtocoo(int n_row, int n_col, int Ap, int Aj, int Ax, std::vector<(int)> Bi, 
-        std::vector<(int)> Bj, std::vector<(int)> Bx)
-    csrtocoo(int n_row, int n_col, int Ap, int Aj, long long Ax, 
-        std::vector<(int)> Bi, std::vector<(int)> Bj, 
-        std::vector<(long long)> Bx)
-    csrtocoo(int n_row, int n_col, int Ap, int Aj, float Ax, std::vector<(int)> Bi, 
-        std::vector<(int)> Bj, std::vector<(float)> Bx)
-    csrtocoo(int n_row, int n_col, int Ap, int Aj, double Ax, std::vector<(int)> Bi, 
-        std::vector<(int)> Bj, std::vector<(double)> Bx)
-    csrtocoo(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, 
-        std::vector<(int)> Bi, std::vector<(int)> Bj, 
-        std::vector<(npy_cfloat_wrapper)> Bx)
-    csrtocoo(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, 
-        std::vector<(int)> Bi, std::vector<(int)> Bj, 
-        std::vector<(npy_cdouble_wrapper)> Bx)
-    """
-  return _sparsetools.csrtocoo(*args)
-
-def csctocoo(*args):
-  """
-    csctocoo(int n_row, int n_col, int Ap, int Ai, signed char Ax, 
-        std::vector<(int)> Bi, std::vector<(int)> Bj, 
-        std::vector<(signed char)> Bx)
-    csctocoo(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, 
-        std::vector<(int)> Bi, std::vector<(int)> Bj, 
-        std::vector<(unsigned char)> Bx)
-    csctocoo(int n_row, int n_col, int Ap, int Ai, short Ax, std::vector<(int)> Bi, 
-        std::vector<(int)> Bj, std::vector<(short)> Bx)
-    csctocoo(int n_row, int n_col, int Ap, int Ai, int Ax, std::vector<(int)> Bi, 
-        std::vector<(int)> Bj, std::vector<(int)> Bx)
-    csctocoo(int n_row, int n_col, int Ap, int Ai, long long Ax, 
-        std::vector<(int)> Bi, std::vector<(int)> Bj, 
-        std::vector<(long long)> Bx)
-    csctocoo(int n_row, int n_col, int Ap, int Ai, float Ax, std::vector<(int)> Bi, 
-        std::vector<(int)> Bj, std::vector<(float)> Bx)
-    csctocoo(int n_row, int n_col, int Ap, int Ai, double Ax, std::vector<(int)> Bi, 
-        std::vector<(int)> Bj, std::vector<(double)> Bx)
-    csctocoo(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, 
-        std::vector<(int)> Bi, std::vector<(int)> Bj, 
-        std::vector<(npy_cfloat_wrapper)> Bx)
-    csctocoo(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, 
-        std::vector<(int)> Bi, std::vector<(int)> Bj, 
-        std::vector<(npy_cdouble_wrapper)> Bx)
-    """
-  return _sparsetools.csctocoo(*args)
-
 def cootocsr(*args):
   """
     cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, signed char Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bj, 
-        std::vector<(signed char)> Bx)
+        int Bp, int Bj, signed char Bx)
     cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, unsigned char Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bj, 
-        std::vector<(unsigned char)> Bx)
+        int Bp, int Bj, unsigned char Bx)
     cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, short Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bj, 
-        std::vector<(short)> Bx)
+        int Bp, int Bj, short Bx)
     cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, int Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bj, 
-        std::vector<(int)> Bx)
+        int Bp, int Bj, int Bx)
     cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, long long Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bj, 
-        std::vector<(long long)> Bx)
+        int Bp, int Bj, long long Bx)
     cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, float Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bj, 
-        std::vector<(float)> Bx)
+        int Bp, int Bj, float Bx)
     cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, double Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bj, 
-        std::vector<(double)> Bx)
+        int Bp, int Bj, double Bx)
     cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cfloat_wrapper Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bj, 
-        std::vector<(npy_cfloat_wrapper)> Bx)
+        int Bp, int Bj, npy_cfloat_wrapper Bx)
     cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cdouble_wrapper Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bj, 
-        std::vector<(npy_cdouble_wrapper)> Bx)
+        int Bp, int Bj, npy_cdouble_wrapper Bx)
     """
   return _sparsetools.cootocsr(*args)
 
 def cootocsc(*args):
   """
     cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, signed char Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bi, 
-        std::vector<(signed char)> Bx)
+        int Bp, int Bi, signed char Bx)
     cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, unsigned char Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bi, 
-        std::vector<(unsigned char)> Bx)
+        int Bp, int Bi, unsigned char Bx)
     cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, short Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bi, 
-        std::vector<(short)> Bx)
+        int Bp, int Bi, short Bx)
     cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, int Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bi, 
-        std::vector<(int)> Bx)
+        int Bp, int Bi, int Bx)
     cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, long long Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bi, 
-        std::vector<(long long)> Bx)
+        int Bp, int Bi, long long Bx)
     cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, float Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bi, 
-        std::vector<(float)> Bx)
+        int Bp, int Bi, float Bx)
     cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, double Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bi, 
-        std::vector<(double)> Bx)
+        int Bp, int Bi, double Bx)
     cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cfloat_wrapper Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bi, 
-        std::vector<(npy_cfloat_wrapper)> Bx)
+        int Bp, int Bi, npy_cfloat_wrapper Bx)
     cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cdouble_wrapper Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bi, 
-        std::vector<(npy_cdouble_wrapper)> Bx)
+        int Bp, int Bi, npy_cdouble_wrapper Bx)
     """
   return _sparsetools.cootocsc(*args)
 

Modified: trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx
===================================================================
--- trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx	2007-12-09 07:00:42 UTC (rev 3626)
+++ trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx	2007-12-10 20:46:04 UTC (rev 3627)
@@ -5534,9 +5534,9 @@
   int *arg3 ;
   int *arg4 ;
   signed char *arg5 ;
-  std::vector<int > *arg6 = (std::vector<int > *) 0 ;
-  std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<signed char > *arg8 = (std::vector<signed char > *) 0 ;
+  int *arg6 ;
+  int *arg7 ;
+  signed char *arg8 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -5547,28 +5547,19 @@
   int is_new_object4 ;
   PyArrayObject *array5 = NULL ;
   int is_new_object5 ;
-  std::vector<int > *tmp6 ;
-  std::vector<int > *tmp7 ;
-  std::vector<signed char > *tmp8 ;
+  PyArrayObject *temp6 = NULL ;
+  PyArrayObject *temp7 = NULL ;
+  PyArrayObject *temp8 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
   PyObject * obj4 = 0 ;
+  PyObject * obj5 = 0 ;
+  PyObject * obj6 = 0 ;
+  PyObject * obj7 = 0 ;
   
-  {
-    tmp6 = new std::vector<int>(); 
-    arg6 = tmp6; 
-  }
-  {
-    tmp7 = new std::vector<int>(); 
-    arg7 = tmp7; 
-  }
-  {
-    tmp8 = new std::vector<signed char>(); 
-    arg8 = tmp8; 
-  }
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'");
@@ -5609,29 +5600,23 @@
     
     arg5 = (signed char*) array5->data;
   }
-  csrtocsc<int,signed char >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6,arg7,arg8);
-  resultobj = SWIG_Py_Void();
   {
-    int length = (arg6)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length);	 
-    delete arg6; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp6 = obj_to_array_no_conversion(obj5,PyArray_INT);
+    if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
+    arg6 = (int*) array_data(temp6);
   }
   {
-    int length = (arg7)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length);	 
-    delete arg7; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp7 = obj_to_array_no_conversion(obj6,PyArray_INT);
+    if (!temp7  || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail;
+    arg7 = (int*) array_data(temp7);
   }
   {
-    int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(signed char)*length);	 
-    delete arg8; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp8 = obj_to_array_no_conversion(obj7,PyArray_BYTE);
+    if (!temp8  || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail;
+    arg8 = (signed char*) array_data(temp8);
   }
+  csrtocsc<int,signed char >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6,arg7,arg8);
+  resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
   }
@@ -5663,9 +5648,9 @@
   int *arg3 ;
   int *arg4 ;
   unsigned char *arg5 ;
-  std::vector<int > *arg6 = (std::vector<int > *) 0 ;
-  std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<unsigned char > *arg8 = (std::vector<unsigned char > *) 0 ;
+  int *arg6 ;
+  int *arg7 ;
+  unsigned char *arg8 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -5676,28 +5661,19 @@
   int is_new_object4 ;
   PyArrayObject *array5 = NULL ;
   int is_new_object5 ;
-  std::vector<int > *tmp6 ;
-  std::vector<int > *tmp7 ;
-  std::vector<unsigned char > *tmp8 ;
+  PyArrayObject *temp6 = NULL ;
+  PyArrayObject *temp7 = NULL ;
+  PyArrayObject *temp8 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
   PyObject * obj4 = 0 ;
+  PyObject * obj5 = 0 ;
+  PyObject * obj6 = 0 ;
+  PyObject * obj7 = 0 ;
   
-  {
-    tmp6 = new std::vector<int>(); 
-    arg6 = tmp6; 
-  }
-  {
-    tmp7 = new std::vector<int>(); 
-    arg7 = tmp7; 
-  }
-  {
-    tmp8 = new std::vector<unsigned char>(); 
-    arg8 = tmp8; 
-  }
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'");
@@ -5738,29 +5714,23 @@
     
     arg5 = (unsigned char*) array5->data;
   }
-  csrtocsc<int,unsigned char >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6,arg7,arg8);
-  resultobj = SWIG_Py_Void();
   {
-    int length = (arg6)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length);	 
-    delete arg6; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp6 = obj_to_array_no_conversion(obj5,PyArray_INT);
+    if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
+    arg6 = (int*) array_data(temp6);
   }
   {
-    int length = (arg7)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length);	 
-    delete arg7; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp7 = obj_to_array_no_conversion(obj6,PyArray_INT);
+    if (!temp7  || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail;
+    arg7 = (int*) array_data(temp7);
   }
   {
-    int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(unsigned char)*length);	 
-    delete arg8; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp8 = obj_to_array_no_conversion(obj7,PyArray_UBYTE);
+    if (!temp8  || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail;
+    arg8 = (unsigned char*) array_data(temp8);
   }
+  csrtocsc<int,unsigned char >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6,arg7,arg8);
+  resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
   }
@@ -5792,9 +5762,9 @@
   int *arg3 ;
   int *arg4 ;
   short *arg5 ;
-  std::vector<int > *arg6 = (std::vector<int > *) 0 ;
-  std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<short > *arg8 = (std::vector<short > *) 0 ;
+  int *arg6 ;
+  int *arg7 ;
+  short *arg8 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -5805,28 +5775,19 @@
   int is_new_object4 ;
   PyArrayObject *array5 = NULL ;
   int is_new_object5 ;
-  std::vector<int > *tmp6 ;
-  std::vector<int > *tmp7 ;
-  std::vector<short > *tmp8 ;
+  PyArrayObject *temp6 = NULL ;
+  PyArrayObject *temp7 = NULL ;
+  PyArrayObject *temp8 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
   PyObject * obj4 = 0 ;
+  PyObject * obj5 = 0 ;
+  PyObject * obj6 = 0 ;
+  PyObject * obj7 = 0 ;
   
-  {
-    tmp6 = new std::vector<int>(); 
-    arg6 = tmp6; 
-  }
-  {
-    tmp7 = new std::vector<int>(); 
-    arg7 = tmp7; 
-  }
-  {
-    tmp8 = new std::vector<short>(); 
-    arg8 = tmp8; 
-  }
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'");
@@ -5867,29 +5828,23 @@
     
     arg5 = (short*) array5->data;
   }
-  csrtocsc<int,short >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6,arg7,arg8);
-  resultobj = SWIG_Py_Void();
   {
-    int length = (arg6)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length);	 
-    delete arg6; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp6 = obj_to_array_no_conversion(obj5,PyArray_INT);
+    if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
+    arg6 = (int*) array_data(temp6);
   }
   {
-    int length = (arg7)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length);	 
-    delete arg7; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp7 = obj_to_array_no_conversion(obj6,PyArray_INT);
+    if (!temp7  || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail;
+    arg7 = (int*) array_data(temp7);
   }
   {
-    int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(short)*length);	 
-    delete arg8; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp8 = obj_to_array_no_conversion(obj7,PyArray_SHORT);
+    if (!temp8  || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail;
+    arg8 = (short*) array_data(temp8);
   }
+  csrtocsc<int,short >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6,arg7,arg8);
+  resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
   }
@@ -5921,9 +5876,9 @@
   int *arg3 ;
   int *arg4 ;
   int *arg5 ;
-  std::vector<int > *arg6 = (std::vector<int > *) 0 ;
-  std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<int > *arg8 = (std::vector<int > *) 0 ;
+  int *arg6 ;
+  int *arg7 ;
+  int *arg8 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -5934,28 +5889,19 @@
   int is_new_object4 ;
   PyArrayObject *array5 = NULL ;
   int is_new_object5 ;
-  std::vector<int > *tmp6 ;
-  std::vector<int > *tmp7 ;
-  std::vector<int > *tmp8 ;
+  PyArrayObject *temp6 = NULL ;
+  PyArrayObject *temp7 = NULL ;
+  PyArrayObject *temp8 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
   PyObject * obj4 = 0 ;
+  PyObject * obj5 = 0 ;
+  PyObject * obj6 = 0 ;
+  PyObject * obj7 = 0 ;
   
-  {
-    tmp6 = new std::vector<int>(); 
-    arg6 = tmp6; 
-  }
-  {
-    tmp7 = new std::vector<int>(); 
-    arg7 = tmp7; 
-  }
-  {
-    tmp8 = new std::vector<int>(); 
-    arg8 = tmp8; 
-  }
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'");
@@ -5996,29 +5942,23 @@
     
     arg5 = (int*) array5->data;
   }
-  csrtocsc<int,int >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6,arg7,arg8);
-  resultobj = SWIG_Py_Void();
   {
-    int length = (arg6)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length);	 
-    delete arg6; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp6 = obj_to_array_no_conversion(obj5,PyArray_INT);
+    if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
+    arg6 = (int*) array_data(temp6);
   }
   {
-    int length = (arg7)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length);	 
-    delete arg7; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp7 = obj_to_array_no_conversion(obj6,PyArray_INT);
+    if (!temp7  || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail;
+    arg7 = (int*) array_data(temp7);
   }
   {
-    int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(int)*length);	 
-    delete arg8; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp8 = obj_to_array_no_conversion(obj7,PyArray_INT);
+    if (!temp8  || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail;
+    arg8 = (int*) array_data(temp8);
   }
+  csrtocsc<int,int >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6,arg7,arg8);
+  resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
   }
@@ -6050,9 +5990,9 @@
   int *arg3 ;
   int *arg4 ;
   long long *arg5 ;
-  std::vector<int > *arg6 = (std::vector<int > *) 0 ;
-  std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<long long > *arg8 = (std::vector<long long > *) 0 ;
+  int *arg6 ;
+  int *arg7 ;
+  long long *arg8 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -6063,28 +6003,19 @@
   int is_new_object4 ;
   PyArrayObject *array5 = NULL ;
   int is_new_object5 ;
-  std::vector<int > *tmp6 ;
-  std::vector<int > *tmp7 ;
-  std::vector<long long > *tmp8 ;
+  PyArrayObject *temp6 = NULL ;
+  PyArrayObject *temp7 = NULL ;
+  PyArrayObject *temp8 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
   PyObject * obj4 = 0 ;
+  PyObject * obj5 = 0 ;
+  PyObject * obj6 = 0 ;
+  PyObject * obj7 = 0 ;
   
-  {
-    tmp6 = new std::vector<int>(); 
-    arg6 = tmp6; 
-  }
-  {
-    tmp7 = new std::vector<int>(); 
-    arg7 = tmp7; 
-  }
-  {
-    tmp8 = new std::vector<long long>(); 
-    arg8 = tmp8; 
-  }
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'");
@@ -6125,29 +6056,23 @@
     
     arg5 = (long long*) array5->data;
   }
-  csrtocsc<int,long long >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,arg6,arg7,arg8);
-  resultobj = SWIG_Py_Void();
   {
-    int length = (arg6)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length);	 
-    delete arg6; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp6 = obj_to_array_no_conversion(obj5,PyArray_INT);
+    if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
+    arg6 = (int*) array_data(temp6);
   }
   {
-    int length = (arg7)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length);	 
-    delete arg7; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp7 = obj_to_array_no_conversion(obj6,PyArray_INT);
+    if (!temp7  || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail;
+    arg7 = (int*) array_data(temp7);
   }
   {
-    int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(long long)*length);	 
-    delete arg8; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp8 = obj_to_array_no_conversion(obj7,PyArray_LONGLONG);
+    if (!temp8  || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail;
+    arg8 = (long long*) array_data(temp8);
   }
+  csrtocsc<int,long long >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,arg6,arg7,arg8);
+  resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
   }
@@ -6179,9 +6104,9 @@
   int *arg3 ;
   int *arg4 ;
   float *arg5 ;
-  std::vector<int > *arg6 = (std::vector<int > *) 0 ;
-  std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<float > *arg8 = (std::vector<float > *) 0 ;
+  int *arg6 ;
+  int *arg7 ;
+  float *arg8 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -6192,28 +6117,19 @@
   int is_new_object4 ;
   PyArrayObject *array5 = NULL ;
   int is_new_object5 ;
-  std::vector<int > *tmp6 ;
-  std::vector<int > *tmp7 ;
-  std::vector<float > *tmp8 ;
+  PyArrayObject *temp6 = NULL ;
+  PyArrayObject *temp7 = NULL ;
+  PyArrayObject *temp8 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
   PyObject * obj4 = 0 ;
+  PyObject * obj5 = 0 ;
+  PyObject * obj6 = 0 ;
+  PyObject * obj7 = 0 ;
   
-  {
-    tmp6 = new std::vector<int>(); 
-    arg6 = tmp6; 
-  }
-  {
-    tmp7 = new std::vector<int>(); 
-    arg7 = tmp7; 
-  }
-  {
-    tmp8 = new std::vector<float>(); 
-    arg8 = tmp8; 
-  }
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'");
@@ -6254,29 +6170,23 @@
     
     arg5 = (float*) array5->data;
   }
-  csrtocsc<int,float >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6,arg7,arg8);
-  resultobj = SWIG_Py_Void();
   {
-    int length = (arg6)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length);	 
-    delete arg6; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp6 = obj_to_array_no_conversion(obj5,PyArray_INT);
+    if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
+    arg6 = (int*) array_data(temp6);
   }
   {
-    int length = (arg7)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length);	 
-    delete arg7; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp7 = obj_to_array_no_conversion(obj6,PyArray_INT);
+    if (!temp7  || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail;
+    arg7 = (int*) array_data(temp7);
   }
   {
-    int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(float)*length);	 
-    delete arg8; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp8 = obj_to_array_no_conversion(obj7,PyArray_FLOAT);
+    if (!temp8  || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail;
+    arg8 = (float*) array_data(temp8);
   }
+  csrtocsc<int,float >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6,arg7,arg8);
+  resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
   }
@@ -6308,9 +6218,9 @@
   int *arg3 ;
   int *arg4 ;
   double *arg5 ;
-  std::vector<int > *arg6 = (std::vector<int > *) 0 ;
-  std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<double > *arg8 = (std::vector<double > *) 0 ;
+  int *arg6 ;
+  int *arg7 ;
+  double *arg8 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -6321,28 +6231,19 @@
   int is_new_object4 ;
   PyArrayObject *array5 = NULL ;
   int is_new_object5 ;
-  std::vector<int > *tmp6 ;
-  std::vector<int > *tmp7 ;
-  std::vector<double > *tmp8 ;
+  PyArrayObject *temp6 = NULL ;
+  PyArrayObject *temp7 = NULL ;
+  PyArrayObject *temp8 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
   PyObject * obj4 = 0 ;
+  PyObject * obj5 = 0 ;
+  PyObject * obj6 = 0 ;
+  PyObject * obj7 = 0 ;
   
-  {
-    tmp6 = new std::vector<int>(); 
-    arg6 = tmp6; 
-  }
-  {
-    tmp7 = new std::vector<int>(); 
-    arg7 = tmp7; 
-  }
-  {
-    tmp8 = new std::vector<double>(); 
-    arg8 = tmp8; 
-  }
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'");
@@ -6383,29 +6284,23 @@
     
     arg5 = (double*) array5->data;
   }
-  csrtocsc<int,double >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6,arg7,arg8);
-  resultobj = SWIG_Py_Void();
   {
-    int length = (arg6)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length);	 
-    delete arg6; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp6 = obj_to_array_no_conversion(obj5,PyArray_INT);
+    if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
+    arg6 = (int*) array_data(temp6);
   }
   {
-    int length = (arg7)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length);	 
-    delete arg7; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp7 = obj_to_array_no_conversion(obj6,PyArray_INT);
+    if (!temp7  || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail;
+    arg7 = (int*) array_data(temp7);
   }
   {
-    int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(double)*length);	 
-    delete arg8; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp8 = obj_to_array_no_conversion(obj7,PyArray_DOUBLE);
+    if (!temp8  || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail;
+    arg8 = (double*) array_data(temp8);
   }
+  csrtocsc<int,double >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6,arg7,arg8);
+  resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
   }
@@ -6437,9 +6332,9 @@
   int *arg3 ;
   int *arg4 ;
   npy_cfloat_wrapper *arg5 ;
-  std::vector<int > *arg6 = (std::vector<int > *) 0 ;
-  std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<npy_cfloat_wrapper > *arg8 = (std::vector<npy_cfloat_wrapper > *) 0 ;
+  int *arg6 ;
+  int *arg7 ;
+  npy_cfloat_wrapper *arg8 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -6450,28 +6345,19 @@
   int is_new_object4 ;
   PyArrayObject *array5 = NULL ;
   int is_new_object5 ;
-  std::vector<int > *tmp6 ;
-  std::vector<int > *tmp7 ;
-  std::vector<npy_cfloat_wrapper > *tmp8 ;
+  PyArrayObject *temp6 = NULL ;
+  PyArrayObject *temp7 = NULL ;
+  PyArrayObject *temp8 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
   PyObject * obj4 = 0 ;
+  PyObject * obj5 = 0 ;
+  PyObject * obj6 = 0 ;
+  PyObject * obj7 = 0 ;
   
-  {
-    tmp6 = new std::vector<int>(); 
-    arg6 = tmp6; 
-  }
-  {
-    tmp7 = new std::vector<int>(); 
-    arg7 = tmp7; 
-  }
-  {
-    tmp8 = new std::vector<npy_cfloat_wrapper>(); 
-    arg8 = tmp8; 
-  }
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'");
@@ -6512,29 +6398,23 @@
     
     arg5 = (npy_cfloat_wrapper*) array5->data;
   }
-  csrtocsc<int,npy_cfloat_wrapper >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,arg6,arg7,arg8);
-  resultobj = SWIG_Py_Void();
   {
-    int length = (arg6)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length);	 
-    delete arg6; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp6 = obj_to_array_no_conversion(obj5,PyArray_INT);
+    if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
+    arg6 = (int*) array_data(temp6);
   }
   {
-    int length = (arg7)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length);	 
-    delete arg7; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp7 = obj_to_array_no_conversion(obj6,PyArray_INT);
+    if (!temp7  || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail;
+    arg7 = (int*) array_data(temp7);
   }
   {
-    int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(npy_cfloat_wrapper)*length);	 
-    delete arg8; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp8 = obj_to_array_no_conversion(obj7,PyArray_CFLOAT);
+    if (!temp8  || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail;
+    arg8 = (npy_cfloat_wrapper*) array_data(temp8);
   }
+  csrtocsc<int,npy_cfloat_wrapper >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,arg6,arg7,arg8);
+  resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
   }
@@ -6566,9 +6446,9 @@
   int *arg3 ;
   int *arg4 ;
   npy_cdouble_wrapper *arg5 ;
-  std::vector<int > *arg6 = (std::vector<int > *) 0 ;
-  std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<npy_cdouble_wrapper > *arg8 = (std::vector<npy_cdouble_wrapper > *) 0 ;
+  int *arg6 ;
+  int *arg7 ;
+  npy_cdouble_wrapper *arg8 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -6579,28 +6459,19 @@
   int is_new_object4 ;
   PyArrayObject *array5 = NULL ;
   int is_new_object5 ;
-  std::vector<int > *tmp6 ;
-  std::vector<int > *tmp7 ;
-  std::vector<npy_cdouble_wrapper > *tmp8 ;
+  PyArrayObject *temp6 = NULL ;
+  PyArrayObject *temp7 = NULL ;
+  PyArrayObject *temp8 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
   PyObject * obj4 = 0 ;
+  PyObject * obj5 = 0 ;
+  PyObject * obj6 = 0 ;
+  PyObject * obj7 = 0 ;
   
-  {
-    tmp6 = new std::vector<int>(); 
-    arg6 = tmp6; 
-  }
-  {
-    tmp7 = new std::vector<int>(); 
-    arg7 = tmp7; 
-  }
-  {
-    tmp8 = new std::vector<npy_cdouble_wrapper>(); 
-    arg8 = tmp8; 
-  }
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'");
@@ -6641,29 +6512,23 @@
     
     arg5 = (npy_cdouble_wrapper*) array5->data;
   }
-  csrtocsc<int,npy_cdouble_wrapper >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,arg6,arg7,arg8);
-  resultobj = SWIG_Py_Void();
   {
-    int length = (arg6)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length);	 
-    delete arg6; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp6 = obj_to_array_no_conversion(obj5,PyArray_INT);
+    if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
+    arg6 = (int*) array_data(temp6);
   }
   {
-    int length = (arg7)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length);	 
-    delete arg7; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp7 = obj_to_array_no_conversion(obj6,PyArray_INT);
+    if (!temp7  || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail;
+    arg7 = (int*) array_data(temp7);
   }
   {
-    int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(npy_cdouble_wrapper)*length);	 
-    delete arg8; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp8 = obj_to_array_no_conversion(obj7,PyArray_CDOUBLE);
+    if (!temp8  || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail;
+    arg8 = (npy_cdouble_wrapper*) array_data(temp8);
   }
+  csrtocsc<int,npy_cdouble_wrapper >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,arg6,arg7,arg8);
+  resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
   }
@@ -6690,15 +6555,15 @@
 
 SWIGINTERN PyObject *_wrap_csrtocsc(PyObject *self, PyObject *args) {
   int argc;
-  PyObject *argv[6];
+  PyObject *argv[9];
   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 < 8); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
-  if (argc == 5) {
+  if (argc == 8) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -6722,14 +6587,29 @@
               _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_BYTE)) ? 1 : 0;
             }
             if (_v) {
-              return _wrap_csrtocsc__SWIG_1(self, args);
+              {
+                _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0;
+              }
+              if (_v) {
+                {
+                  _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0;
+                }
+                if (_v) {
+                  {
+                    _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_BYTE)) ? 1 : 0;
+                  }
+                  if (_v) {
+                    return _wrap_csrtocsc__SWIG_1(self, args);
+                  }
+                }
+              }
             }
           }
         }
       }
     }
   }
-  if (argc == 5) {
+  if (argc == 8) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -6753,14 +6633,29 @@
               _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_UBYTE)) ? 1 : 0;
             }
             if (_v) {
-              return _wrap_csrtocsc__SWIG_2(self, args);
+              {
+                _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0;
+              }
+              if (_v) {
+                {
+                  _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0;
+                }
+                if (_v) {
+                  {
+                    _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_UBYTE)) ? 1 : 0;
+                  }
+                  if (_v) {
+                    return _wrap_csrtocsc__SWIG_2(self, args);
+                  }
+                }
+              }
             }
           }
         }
       }
     }
   }
-  if (argc == 5) {
+  if (argc == 8) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -6784,14 +6679,29 @@
               _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_SHORT)) ? 1 : 0;
             }
             if (_v) {
-              return _wrap_csrtocsc__SWIG_3(self, args);
+              {
+                _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0;
+              }
+              if (_v) {
+                {
+                  _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0;
+                }
+                if (_v) {
+                  {
+                    _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_SHORT)) ? 1 : 0;
+                  }
+                  if (_v) {
+                    return _wrap_csrtocsc__SWIG_3(self, args);
+                  }
+                }
+              }
             }
           }
         }
       }
     }
   }
-  if (argc == 5) {
+  if (argc == 8) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -6815,14 +6725,29 @@
               _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0;
             }
             if (_v) {
-              return _wrap_csrtocsc__SWIG_4(self, args);
+              {
+                _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0;
+              }
+              if (_v) {
+                {
+                  _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0;
+                }
+                if (_v) {
+                  {
+                    _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0;
+                  }
+                  if (_v) {
+                    return _wrap_csrtocsc__SWIG_4(self, args);
+                  }
+                }
+              }
             }
           }
         }
       }
     }
   }
-  if (argc == 5) {
+  if (argc == 8) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -6846,14 +6771,29 @@
               _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_LONGLONG)) ? 1 : 0;
             }
             if (_v) {
-              return _wrap_csrtocsc__SWIG_5(self, args);
+              {
+                _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0;
+              }
+              if (_v) {
+                {
+                  _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0;
+                }
+                if (_v) {
+                  {
+                    _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_LONGLONG)) ? 1 : 0;
+                  }
+                  if (_v) {
+                    return _wrap_csrtocsc__SWIG_5(self, args);
+                  }
+                }
+              }
             }
           }
         }
       }
     }
   }
-  if (argc == 5) {
+  if (argc == 8) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -6877,14 +6817,29 @@
               _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0;
             }
             if (_v) {
-              return _wrap_csrtocsc__SWIG_6(self, args);
+              {
+                _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0;
+              }
+              if (_v) {
+                {
+                  _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0;
+                }
+                if (_v) {
+                  {
+                    _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_FLOAT)) ? 1 : 0;
+                  }
+                  if (_v) {
+                    return _wrap_csrtocsc__SWIG_6(self, args);
+                  }
+                }
+              }
             }
           }
         }
       }
     }
   }
-  if (argc == 5) {
+  if (argc == 8) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -6908,14 +6863,29 @@
               _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0;
             }
             if (_v) {
-              return _wrap_csrtocsc__SWIG_7(self, args);
+              {
+                _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0;
+              }
+              if (_v) {
+                {
+                  _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0;
+                }
+                if (_v) {
+                  {
+                    _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_DOUBLE)) ? 1 : 0;
+                  }
+                  if (_v) {
+                    return _wrap_csrtocsc__SWIG_7(self, args);
+                  }
+                }
+              }
             }
           }
         }
       }
     }
   }
-  if (argc == 5) {
+  if (argc == 8) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -6939,14 +6909,29 @@
               _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CFLOAT)) ? 1 : 0;
             }
             if (_v) {
-              return _wrap_csrtocsc__SWIG_8(self, args);
+              {
+                _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0;
+              }
+              if (_v) {
+                {
+                  _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0;
+                }
+                if (_v) {
+                  {
+                    _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CFLOAT)) ? 1 : 0;
+                  }
+                  if (_v) {
+                    return _wrap_csrtocsc__SWIG_8(self, args);
+                  }
+                }
+              }
             }
           }
         }
       }
     }
   }
-  if (argc == 5) {
+  if (argc == 8) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -6970,7 +6955,22 @@
               _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CDOUBLE)) ? 1 : 0;
             }
             if (_v) {
-              return _wrap_csrtocsc__SWIG_9(self, args);
+              {
+                _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0;
+              }
+              if (_v) {
+                {
+                  _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0;
+                }
+                if (_v) {
+                  {
+                    _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CDOUBLE)) ? 1 : 0;
+                  }
+                  if (_v) {
+                    return _wrap_csrtocsc__SWIG_9(self, args);
+                  }
+                }
+              }
             }
           }
         }
@@ -6979,7 +6979,7 @@
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csrtocsc'.\n  Possible C/C++ prototypes are:\n""    csrtocsc<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],std::vector<int > *,std::vector<int > *,std::vector<signed char > *)\n""    csrtocsc<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],std::vector<int > *,std::vector<int > *,std::vector<unsigned char > *)\n""    csrtocsc<(int,short)>(int const,int const,int const [],int const [],short const [],std::vector<int > *,std::vector<int > *,std::vector<short > *)\n""    csrtocsc<(int,int)>(int const,int const,int const [],int const [],int const [],std::vector<int > *,std::vector<int > *,std::vector<int > *)\n""    csrtocsc<(int,long long)>(int const,int const,int const [],int const [],long long const [],std::vector<int > *,std::vector<int > *,std::vector<long long > *)\n""    csrtocsc<(int,float)>(int const,int const,int const [],int const [],float const [],std::vector<int > *,std::vector<int > *,std::vector<float > *)\n""    csrtocsc<(int,double)>(int const,int const,int const [],int const [],double const [],std::vector<int > *,std::vector<int > *,std::vector<double > *)\n""    csrtocsc<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],std::vector<int > *,std::vector<int > *,std::vector<npy_cfloat_wrapper > *)\n""    csrtocsc<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],std::vector<int > *,std::vector<int > *,std::vector<npy_cdouble_wrapper > *)\n");
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csrtocsc'.\n  Possible C/C++ prototypes are:\n""    csrtocsc<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int [],int [],signed char [])\n""    csrtocsc<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n""    csrtocsc<(int,short)>(int const,int const,int const [],int const [],short const [],int [],int [],short [])\n""    csrtocsc<(int,int)>(int const,int const,int const [],int const [],int const [],int [],int [],int [])\n""    csrtocsc<(int,long long)>(int const,int const,int const [],int const [],long long const [],int [],int [],long long [])\n""    csrtocsc<(int,float)>(int const,int const,int const [],int const [],float const [],int [],int [],float [])\n""    csrtocsc<(int,double)>(int const,int const,int const [],int const [],double const [],int [],int [],double [])\n""    csrtocsc<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n""    csrtocsc<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n");
   return NULL;
 }
 
@@ -6991,9 +6991,9 @@
   int *arg3 ;
   int *arg4 ;
   signed char *arg5 ;
-  std::vector<int > *arg6 = (std::vector<int > *) 0 ;
-  std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<signed char > *arg8 = (std::vector<signed char > *) 0 ;
+  int *arg6 ;
+  int *arg7 ;
+  signed char *arg8 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -7004,28 +7004,19 @@
   int is_new_object4 ;
   PyArrayObject *array5 = NULL ;
   int is_new_object5 ;
-  std::vector<int > *tmp6 ;
-  std::vector<int > *tmp7 ;
-  std::vector<signed char > *tmp8 ;
+  PyArrayObject *temp6 = NULL ;
+  PyArrayObject *temp7 = NULL ;
+  PyArrayObject *temp8 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
   PyObject * obj4 = 0 ;
+  PyObject * obj5 = 0 ;
+  PyObject * obj6 = 0 ;
+  PyObject * obj7 = 0 ;
   
-  {
-    tmp6 = new std::vector<int>(); 
-    arg6 = tmp6; 
-  }
-  {
-    tmp7 = new std::vector<int>(); 
-    arg7 = tmp7; 
-  }
-  {
-    tmp8 = new std::vector<signed char>(); 
-    arg8 = tmp8; 
-  }
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'");
@@ -7066,29 +7057,23 @@
     
     arg5 = (signed char*) array5->data;
   }
-  csctocsr<int,signed char >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6,arg7,arg8);
-  resultobj = SWIG_Py_Void();
   {
-    int length = (arg6)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length);	 
-    delete arg6; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp6 = obj_to_array_no_conversion(obj5,PyArray_INT);
+    if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
+    arg6 = (int*) array_data(temp6);
   }
   {
-    int length = (arg7)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length);	 
-    delete arg7; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp7 = obj_to_array_no_conversion(obj6,PyArray_INT);
+    if (!temp7  || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail;
+    arg7 = (int*) array_data(temp7);
   }
   {
-    int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(signed char)*length);	 
-    delete arg8; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp8 = obj_to_array_no_conversion(obj7,PyArray_BYTE);
+    if (!temp8  || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail;
+    arg8 = (signed char*) array_data(temp8);
   }
+  csctocsr<int,signed char >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6,arg7,arg8);
+  resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
   }
@@ -7120,9 +7105,9 @@
   int *arg3 ;
   int *arg4 ;
   unsigned char *arg5 ;
-  std::vector<int > *arg6 = (std::vector<int > *) 0 ;
-  std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<unsigned char > *arg8 = (std::vector<unsigned char > *) 0 ;
+  int *arg6 ;
+  int *arg7 ;
+  unsigned char *arg8 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -7133,28 +7118,19 @@
   int is_new_object4 ;
   PyArrayObject *array5 = NULL ;
   int is_new_object5 ;
-  std::vector<int > *tmp6 ;
-  std::vector<int > *tmp7 ;
-  std::vector<unsigned char > *tmp8 ;
+  PyArrayObject *temp6 = NULL ;
+  PyArrayObject *temp7 = NULL ;
+  PyArrayObject *temp8 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
   PyObject * obj4 = 0 ;
+  PyObject * obj5 = 0 ;
+  PyObject * obj6 = 0 ;
+  PyObject * obj7 = 0 ;
   
-  {
-    tmp6 = new std::vector<int>(); 
-    arg6 = tmp6; 
-  }
-  {
-    tmp7 = new std::vector<int>(); 
-    arg7 = tmp7; 
-  }
-  {
-    tmp8 = new std::vector<unsigned char>(); 
-    arg8 = tmp8; 
-  }
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'");
@@ -7195,29 +7171,23 @@
     
     arg5 = (unsigned char*) array5->data;
   }
-  csctocsr<int,unsigned char >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6,arg7,arg8);
-  resultobj = SWIG_Py_Void();
   {
-    int length = (arg6)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length);	 
-    delete arg6; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp6 = obj_to_array_no_conversion(obj5,PyArray_INT);
+    if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
+    arg6 = (int*) array_data(temp6);
   }
   {
-    int length = (arg7)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length);	 
-    delete arg7; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp7 = obj_to_array_no_conversion(obj6,PyArray_INT);
+    if (!temp7  || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail;
+    arg7 = (int*) array_data(temp7);
   }
   {
-    int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(unsigned char)*length);	 
-    delete arg8; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp8 = obj_to_array_no_conversion(obj7,PyArray_UBYTE);
+    if (!temp8  || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail;
+    arg8 = (unsigned char*) array_data(temp8);
   }
+  csctocsr<int,unsigned char >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6,arg7,arg8);
+  resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
   }
@@ -7249,9 +7219,9 @@
   int *arg3 ;
   int *arg4 ;
   short *arg5 ;
-  std::vector<int > *arg6 = (std::vector<int > *) 0 ;
-  std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<short > *arg8 = (std::vector<short > *) 0 ;
+  int *arg6 ;
+  int *arg7 ;
+  short *arg8 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -7262,28 +7232,19 @@
   int is_new_object4 ;
   PyArrayObject *array5 = NULL ;
   int is_new_object5 ;
-  std::vector<int > *tmp6 ;
-  std::vector<int > *tmp7 ;
-  std::vector<short > *tmp8 ;
+  PyArrayObject *temp6 = NULL ;
+  PyArrayObject *temp7 = NULL ;
+  PyArrayObject *temp8 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
   PyObject * obj4 = 0 ;
+  PyObject * obj5 = 0 ;
+  PyObject * obj6 = 0 ;
+  PyObject * obj7 = 0 ;
   
-  {
-    tmp6 = new std::vector<int>(); 
-    arg6 = tmp6; 
-  }
-  {
-    tmp7 = new std::vector<int>(); 
-    arg7 = tmp7; 
-  }
-  {
-    tmp8 = new std::vector<short>(); 
-    arg8 = tmp8; 
-  }
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'");
@@ -7324,29 +7285,23 @@
     
     arg5 = (short*) array5->data;
   }
-  csctocsr<int,short >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6,arg7,arg8);
-  resultobj = SWIG_Py_Void();
   {
-    int length = (arg6)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length);	 
-    delete arg6; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp6 = obj_to_array_no_conversion(obj5,PyArray_INT);
+    if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
+    arg6 = (int*) array_data(temp6);
   }
   {
-    int length = (arg7)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length);	 
-    delete arg7; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp7 = obj_to_array_no_conversion(obj6,PyArray_INT);
+    if (!temp7  || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail;
+    arg7 = (int*) array_data(temp7);
   }
   {
-    int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(short)*length);	 
-    delete arg8; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp8 = obj_to_array_no_conversion(obj7,PyArray_SHORT);
+    if (!temp8  || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail;
+    arg8 = (short*) array_data(temp8);
   }
+  csctocsr<int,short >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6,arg7,arg8);
+  resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
   }
@@ -7378,9 +7333,9 @@
   int *arg3 ;
   int *arg4 ;
   int *arg5 ;
-  std::vector<int > *arg6 = (std::vector<int > *) 0 ;
-  std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<int > *arg8 = (std::vector<int > *) 0 ;
+  int *arg6 ;
+  int *arg7 ;
+  int *arg8 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -7391,28 +7346,19 @@
   int is_new_object4 ;
   PyArrayObject *array5 = NULL ;
   int is_new_object5 ;
-  std::vector<int > *tmp6 ;
-  std::vector<int > *tmp7 ;
-  std::vector<int > *tmp8 ;
+  PyArrayObject *temp6 = NULL ;
+  PyArrayObject *temp7 = NULL ;
+  PyArrayObject *temp8 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
   PyObject * obj4 = 0 ;
+  PyObject * obj5 = 0 ;
+  PyObject * obj6 = 0 ;
+  PyObject * obj7 = 0 ;
   
-  {
-    tmp6 = new std::vector<int>(); 
-    arg6 = tmp6; 
-  }
-  {
-    tmp7 = new std::vector<int>(); 
-    arg7 = tmp7; 
-  }
-  {
-    tmp8 = new std::vector<int>(); 
-    arg8 = tmp8; 
-  }
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'");
@@ -7453,29 +7399,23 @@
     
     arg5 = (int*) array5->data;
   }
-  csctocsr<int,int >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6,arg7,arg8);
-  resultobj = SWIG_Py_Void();
   {
-    int length = (arg6)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length);	 
-    delete arg6; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp6 = obj_to_array_no_conversion(obj5,PyArray_INT);
+    if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
+    arg6 = (int*) array_data(temp6);
   }
   {
-    int length = (arg7)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length);	 
-    delete arg7; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp7 = obj_to_array_no_conversion(obj6,PyArray_INT);
+    if (!temp7  || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail;
+    arg7 = (int*) array_data(temp7);
   }
   {
-    int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(int)*length);	 
-    delete arg8; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp8 = obj_to_array_no_conversion(obj7,PyArray_INT);
+    if (!temp8  || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail;
+    arg8 = (int*) array_data(temp8);
   }
+  csctocsr<int,int >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6,arg7,arg8);
+  resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
   }
@@ -7507,9 +7447,9 @@
   int *arg3 ;
   int *arg4 ;
   long long *arg5 ;
-  std::vector<int > *arg6 = (std::vector<int > *) 0 ;
-  std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<long long > *arg8 = (std::vector<long long > *) 0 ;
+  int *arg6 ;
+  int *arg7 ;
+  long long *arg8 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -7520,28 +7460,19 @@
   int is_new_object4 ;
   PyArrayObject *array5 = NULL ;
   int is_new_object5 ;
-  std::vector<int > *tmp6 ;
-  std::vector<int > *tmp7 ;
-  std::vector<long long > *tmp8 ;
+  PyArrayObject *temp6 = NULL ;
+  PyArrayObject *temp7 = NULL ;
+  PyArrayObject *temp8 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
   PyObject * obj4 = 0 ;
+  PyObject * obj5 = 0 ;
+  PyObject * obj6 = 0 ;
+  PyObject * obj7 = 0 ;
   
-  {
-    tmp6 = new std::vector<int>(); 
-    arg6 = tmp6; 
-  }
-  {
-    tmp7 = new std::vector<int>(); 
-    arg7 = tmp7; 
-  }
-  {
-    tmp8 = new std::vector<long long>(); 
-    arg8 = tmp8; 
-  }
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'");
@@ -7582,29 +7513,23 @@
     
     arg5 = (long long*) array5->data;
   }
-  csctocsr<int,long long >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,arg6,arg7,arg8);
-  resultobj = SWIG_Py_Void();
   {
-    int length = (arg6)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length);	 
-    delete arg6; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp6 = obj_to_array_no_conversion(obj5,PyArray_INT);
+    if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
+    arg6 = (int*) array_data(temp6);
   }
   {
-    int length = (arg7)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length);	 
-    delete arg7; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp7 = obj_to_array_no_conversion(obj6,PyArray_INT);
+    if (!temp7  || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail;
+    arg7 = (int*) array_data(temp7);
   }
   {
-    int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(long long)*length);	 
-    delete arg8; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp8 = obj_to_array_no_conversion(obj7,PyArray_LONGLONG);
+    if (!temp8  || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail;
+    arg8 = (long long*) array_data(temp8);
   }
+  csctocsr<int,long long >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,arg6,arg7,arg8);
+  resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
   }
@@ -7636,9 +7561,9 @@
   int *arg3 ;
   int *arg4 ;
   float *arg5 ;
-  std::vector<int > *arg6 = (std::vector<int > *) 0 ;
-  std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<float > *arg8 = (std::vector<float > *) 0 ;
+  int *arg6 ;
+  int *arg7 ;
+  float *arg8 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -7649,28 +7574,19 @@
   int is_new_object4 ;
   PyArrayObject *array5 = NULL ;
   int is_new_object5 ;
-  std::vector<int > *tmp6 ;
-  std::vector<int > *tmp7 ;
-  std::vector<float > *tmp8 ;
+  PyArrayObject *temp6 = NULL ;
+  PyArrayObject *temp7 = NULL ;
+  PyArrayObject *temp8 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
   PyObject * obj4 = 0 ;
+  PyObject * obj5 = 0 ;
+  PyObject * obj6 = 0 ;
+  PyObject * obj7 = 0 ;
   
-  {
-    tmp6 = new std::vector<int>(); 
-    arg6 = tmp6; 
-  }
-  {
-    tmp7 = new std::vector<int>(); 
-    arg7 = tmp7; 
-  }
-  {
-    tmp8 = new std::vector<float>(); 
-    arg8 = tmp8; 
-  }
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'");
@@ -7711,29 +7627,23 @@
     
     arg5 = (float*) array5->data;
   }
-  csctocsr<int,float >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6,arg7,arg8);
-  resultobj = SWIG_Py_Void();
   {
-    int length = (arg6)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length);	 
-    delete arg6; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp6 = obj_to_array_no_conversion(obj5,PyArray_INT);
+    if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
+    arg6 = (int*) array_data(temp6);
   }
   {
-    int length = (arg7)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length);	 
-    delete arg7; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp7 = obj_to_array_no_conversion(obj6,PyArray_INT);
+    if (!temp7  || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail;
+    arg7 = (int*) array_data(temp7);
   }
   {
-    int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(float)*length);	 
-    delete arg8; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp8 = obj_to_array_no_conversion(obj7,PyArray_FLOAT);
+    if (!temp8  || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail;
+    arg8 = (float*) array_data(temp8);
   }
+  csctocsr<int,float >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6,arg7,arg8);
+  resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
   }
@@ -7765,9 +7675,9 @@
   int *arg3 ;
   int *arg4 ;
   double *arg5 ;
-  std::vector<int > *arg6 = (std::vector<int > *) 0 ;
-  std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<double > *arg8 = (std::vector<double > *) 0 ;
+  int *arg6 ;
+  int *arg7 ;
+  double *arg8 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -7778,28 +7688,19 @@
   int is_new_object4 ;
   PyArrayObject *array5 = NULL ;
   int is_new_object5 ;
-  std::vector<int > *tmp6 ;
-  std::vector<int > *tmp7 ;
-  std::vector<double > *tmp8 ;
+  PyArrayObject *temp6 = NULL ;
+  PyArrayObject *temp7 = NULL ;
+  PyArrayObject *temp8 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
   PyObject * obj4 = 0 ;
+  PyObject * obj5 = 0 ;
+  PyObject * obj6 = 0 ;
+  PyObject * obj7 = 0 ;
   
-  {
-    tmp6 = new std::vector<int>(); 
-    arg6 = tmp6; 
-  }
-  {
-    tmp7 = new std::vector<int>(); 
-    arg7 = tmp7; 
-  }
-  {
-    tmp8 = new std::vector<double>(); 
-    arg8 = tmp8; 
-  }
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'");
@@ -7840,29 +7741,23 @@
     
     arg5 = (double*) array5->data;
   }
-  csctocsr<int,double >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6,arg7,arg8);
-  resultobj = SWIG_Py_Void();
   {
-    int length = (arg6)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length);	 
-    delete arg6; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp6 = obj_to_array_no_conversion(obj5,PyArray_INT);
+    if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
+    arg6 = (int*) array_data(temp6);
   }
   {
-    int length = (arg7)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length);	 
-    delete arg7; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp7 = obj_to_array_no_conversion(obj6,PyArray_INT);
+    if (!temp7  || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail;
+    arg7 = (int*) array_data(temp7);
   }
   {
-    int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(double)*length);	 
-    delete arg8; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp8 = obj_to_array_no_conversion(obj7,PyArray_DOUBLE);
+    if (!temp8  || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail;
+    arg8 = (double*) array_data(temp8);
   }
+  csctocsr<int,double >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6,arg7,arg8);
+  resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
   }
@@ -7894,9 +7789,9 @@
   int *arg3 ;
   int *arg4 ;
   npy_cfloat_wrapper *arg5 ;
-  std::vector<int > *arg6 = (std::vector<int > *) 0 ;
-  std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<npy_cfloat_wrapper > *arg8 = (std::vector<npy_cfloat_wrapper > *) 0 ;
+  int *arg6 ;
+  int *arg7 ;
+  npy_cfloat_wrapper *arg8 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -7907,28 +7802,19 @@
   int is_new_object4 ;
   PyArrayObject *array5 = NULL ;
   int is_new_object5 ;
-  std::vector<int > *tmp6 ;
-  std::vector<int > *tmp7 ;
-  std::vector<npy_cfloat_wrapper > *tmp8 ;
+  PyArrayObject *temp6 = NULL ;
+  PyArrayObject *temp7 = NULL ;
+  PyArrayObject *temp8 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
   PyObject * obj4 = 0 ;
+  PyObject * obj5 = 0 ;
+  PyObject * obj6 = 0 ;
+  PyObject * obj7 = 0 ;
   
-  {
-    tmp6 = new std::vector<int>(); 
-    arg6 = tmp6; 
-  }
-  {
-    tmp7 = new std::vector<int>(); 
-    arg7 = tmp7; 
-  }
-  {
-    tmp8 = new std::vector<npy_cfloat_wrapper>(); 
-    arg8 = tmp8; 
-  }
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'");
@@ -7969,29 +7855,23 @@
     
     arg5 = (npy_cfloat_wrapper*) array5->data;
   }
-  csctocsr<int,npy_cfloat_wrapper >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,arg6,arg7,arg8);
-  resultobj = SWIG_Py_Void();
   {
-    int length = (arg6)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length);	 
-    delete arg6; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp6 = obj_to_array_no_conversion(obj5,PyArray_INT);
+    if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
+    arg6 = (int*) array_data(temp6);
   }
   {
-    int length = (arg7)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length);	 
-    delete arg7; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp7 = obj_to_array_no_conversion(obj6,PyArray_INT);
+    if (!temp7  || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail;
+    arg7 = (int*) array_data(temp7);
   }
   {
-    int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(npy_cfloat_wrapper)*length);	 
-    delete arg8; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp8 = obj_to_array_no_conversion(obj7,PyArray_CFLOAT);
+    if (!temp8  || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail;
+    arg8 = (npy_cfloat_wrapper*) array_data(temp8);
   }
+  csctocsr<int,npy_cfloat_wrapper >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,arg6,arg7,arg8);
+  resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
   }
@@ -8023,9 +7903,9 @@
   int *arg3 ;
   int *arg4 ;
   npy_cdouble_wrapper *arg5 ;
-  std::vector<int > *arg6 = (std::vector<int > *) 0 ;
-  std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<npy_cdouble_wrapper > *arg8 = (std::vector<npy_cdouble_wrapper > *) 0 ;
+  int *arg6 ;
+  int *arg7 ;
+  npy_cdouble_wrapper *arg8 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -8036,28 +7916,19 @@
   int is_new_object4 ;
   PyArrayObject *array5 = NULL ;
   int is_new_object5 ;
-  std::vector<int > *tmp6 ;
-  std::vector<int > *tmp7 ;
-  std::vector<npy_cdouble_wrapper > *tmp8 ;
+  PyArrayObject *temp6 = NULL ;
+  PyArrayObject *temp7 = NULL ;
+  PyArrayObject *temp8 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
   PyObject * obj4 = 0 ;
+  PyObject * obj5 = 0 ;
+  PyObject * obj6 = 0 ;
+  PyObject * obj7 = 0 ;
   
-  {
-    tmp6 = new std::vector<int>(); 
-    arg6 = tmp6; 
-  }
-  {
-    tmp7 = new std::vector<int>(); 
-    arg7 = tmp7; 
-  }
-  {
-    tmp8 = new std::vector<npy_cdouble_wrapper>(); 
-    arg8 = tmp8; 
-  }
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'");
@@ -8098,29 +7969,23 @@
     
     arg5 = (npy_cdouble_wrapper*) array5->data;
   }
-  csctocsr<int,npy_cdouble_wrapper >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,arg6,arg7,arg8);
-  resultobj = SWIG_Py_Void();
   {
-    int length = (arg6)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length);	 
-    delete arg6; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp6 = obj_to_array_no_conversion(obj5,PyArray_INT);
+    if (!temp6  || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail;
+    arg6 = (int*) array_data(temp6);
   }
   {
-    int length = (arg7)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length);	 
-    delete arg7; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp7 = obj_to_array_no_conversion(obj6,PyArray_INT);
+    if (!temp7  || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail;
+    arg7 = (int*) array_data(temp7);
   }
   {
-    int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(npy_cdouble_wrapper)*length);	 
-    delete arg8; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    temp8 = obj_to_array_no_conversion(obj7,PyArray_CDOUBLE);
+    if (!temp8  || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail;
+    arg8 = (npy_cdouble_wrapper*) array_data(temp8);
   }
+  csctocsr<int,npy_cdouble_wrapper >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,arg6,arg7,arg8);
+  resultobj = SWIG_Py_Void();
   {
     if (is_new_object3 && array3) Py_DECREF(array3);
   }
@@ -8147,15 +8012,15 @@
 
 SWIGINTERN PyObject *_wrap_csctocsr(PyObject *self, PyObject *args) {
   int argc;
-  PyObject *argv[6];
+  PyObject *argv[9];
   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 < 8); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
-  if (argc == 5) {
+  if (argc == 8) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -8179,14 +8044,29 @@
               _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_BYTE)) ? 1 : 0;
             }
             if (_v) {
-              return _wrap_csctocsr__SWIG_1(self, args);
+              {
+                _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0;
+              }
+              if (_v) {
+                {
+                  _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0;
+                }
+                if (_v) {
+                  {
+                    _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_BYTE)) ? 1 : 0;
+                  }
+                  if (_v) {
+                    return _wrap_csctocsr__SWIG_1(self, args);
+                  }
+                }
+              }
             }
           }
         }
       }
     }
   }
-  if (argc == 5) {
+  if (argc == 8) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -8210,14 +8090,29 @@
               _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_UBYTE)) ? 1 : 0;
             }
             if (_v) {
-              return _wrap_csctocsr__SWIG_2(self, args);
+              {
+                _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0;
+              }
+              if (_v) {
+                {
+                  _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0;
+                }
+                if (_v) {
+                  {
+                    _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_UBYTE)) ? 1 : 0;
+                  }
+                  if (_v) {
+                    return _wrap_csctocsr__SWIG_2(self, args);
+                  }
+                }
+              }
             }
           }
         }
       }
     }
   }
-  if (argc == 5) {
+  if (argc == 8) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -8241,14 +8136,29 @@
               _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_SHORT)) ? 1 : 0;
             }
             if (_v) {
-              return _wrap_csctocsr__SWIG_3(self, args);
+              {
+                _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0;
+              }
+              if (_v) {
+                {
+                  _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0;
+                }
+                if (_v) {
+                  {
+                    _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_SHORT)) ? 1 : 0;
+                  }
+                  if (_v) {
+                    return _wrap_csctocsr__SWIG_3(self, args);
+                  }
+                }
+              }
             }
           }
         }
       }
     }
   }
-  if (argc == 5) {
+  if (argc == 8) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -8272,14 +8182,29 @@
               _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0;
             }
             if (_v) {
-              return _wrap_csctocsr__SWIG_4(self, args);
+              {
+                _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0;
+              }
+              if (_v) {
+                {
+                  _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0;
+                }
+                if (_v) {
+                  {
+                    _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0;
+                  }
+                  if (_v) {
+                    return _wrap_csctocsr__SWIG_4(self, args);
+                  }
+                }
+              }
             }
           }
         }
       }
     }
   }
-  if (argc == 5) {
+  if (argc == 8) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -8303,14 +8228,29 @@
               _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_LONGLONG)) ? 1 : 0;
             }
             if (_v) {
-              return _wrap_csctocsr__SWIG_5(self, args);
+              {
+                _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0;
+              }
+              if (_v) {
+                {
+                  _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0;
+                }
+                if (_v) {
+                  {
+                    _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_LONGLONG)) ? 1 : 0;
+                  }
+                  if (_v) {
+                    return _wrap_csctocsr__SWIG_5(self, args);
+                  }
+                }
+              }
             }
           }
         }
       }
     }
   }
-  if (argc == 5) {
+  if (argc == 8) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -8334,14 +8274,29 @@
               _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0;
             }
             if (_v) {
-              return _wrap_csctocsr__SWIG_6(self, args);
+              {
+                _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0;
+              }
+              if (_v) {
+                {
+                  _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0;
+                }
+                if (_v) {
+                  {
+                    _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_FLOAT)) ? 1 : 0;
+                  }
+                  if (_v) {
+                    return _wrap_csctocsr__SWIG_6(self, args);
+                  }
+                }
+              }
             }
           }
         }
       }
     }
   }
-  if (argc == 5) {
+  if (argc == 8) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -8365,14 +8320,29 @@
               _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0;
             }
             if (_v) {
-              return _wrap_csctocsr__SWIG_7(self, args);
+              {
+                _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0;
+              }
+              if (_v) {
+                {
+                  _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0;
+                }
+                if (_v) {
+                  {
+                    _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_DOUBLE)) ? 1 : 0;
+                  }
+                  if (_v) {
+                    return _wrap_csctocsr__SWIG_7(self, args);
+                  }
+                }
+              }
             }
           }
         }
       }
     }
   }
-  if (argc == 5) {
+  if (argc == 8) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -8396,14 +8366,29 @@
               _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CFLOAT)) ? 1 : 0;
             }
             if (_v) {
-              return _wrap_csctocsr__SWIG_8(self, args);
+              {
+                _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0;
+              }
+              if (_v) {
+                {
+                  _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0;
+                }
+                if (_v) {
+                  {
+                    _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CFLOAT)) ? 1 : 0;
+                  }
+                  if (_v) {
+                    return _wrap_csctocsr__SWIG_8(self, args);
+                  }
+                }
+              }
             }
           }
         }
       }
     }
   }
-  if (argc == 5) {
+  if (argc == 8) {
     int _v;
     {
       int res = SWIG_AsVal_int(argv[0], NULL);
@@ -8427,7 +8412,22 @@
               _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CDOUBLE)) ? 1 : 0;
             }
             if (_v) {
-              return _wrap_csctocsr__SWIG_9(self, args);
+              {
+                _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0;
+              }
+              if (_v) {
+                {
+                  _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0;
+                }
+                if (_v) {
+                  {
+                    _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CDOUBLE)) ? 1 : 0;
+                  }
+                  if (_v) {
+                    return _wrap_csctocsr__SWIG_9(self, args);
+                  }
+                }
+              }
             }
           }
         }
@@ -8436,2925 +8436,60 @@
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csctocsr'.\n  Possible C/C++ prototypes are:\n""    csctocsr<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],std::vector<int > *,std::vector<int > *,std::vector<signed char > *)\n""    csctocsr<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],std::vector<int > *,std::vector<int > *,std::vector<unsigned char > *)\n""    csctocsr<(int,short)>(int const,int const,int const [],int const [],short const [],std::vector<int > *,std::vector<int > *,std::vector<short > *)\n""    csctocsr<(int,int)>(int const,int const,int const [],int const [],int const [],std::vector<int > *,std::vector<int > *,std::vector<int > *)\n""    csctocsr<(int,long long)>(int const,int const,int const [],int const [],long long const [],std::vector<int > *,std::vector<int > *,std::vector<long long > *)\n""    csctocsr<(int,float)>(int const,int const,int const [],int const [],float const [],std::vector<int > *,std::vector<int > *,std::vector<float > *)\n""    csctocsr<(int,double)>(int const,int const,int const [],int const [],double const [],std::vector<int > *,std::vector<int > *,std::vector<double > *)\n""    csctocsr<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],std::vector<int > *,std::vector<int > *,std::vector<npy_cfloat_wrapper > *)\n""    csctocsr<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],std::vector<int > *,std::vector<int > *,std::vector<npy_cdouble_wrapper > *)\n");
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csctocsr'.\n  Possible C/C++ prototypes are:\n""    csctocsr<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int [],int [],signed char [])\n""    csctocsr<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n""    csctocsr<(int,short)>(int const,int const,int const [],int const [],short const [],int [],int [],short [])\n""    csctocsr<(int,int)>(int const,int const,int const [],int const [],int const [],int [],int [],int [])\n""    csctocsr<(int,long long)>(int const,int const,int const [],int const [],long long const [],int [],int [],long long [])\n""    csctocsr<(int,float)>(int const,int const,int const [],int const [],float const [],int [],int [],float [])\n""    csctocsr<(int,double)>(int const,int const,int const [],int const [],double const [],int [],int [],double [])\n""    csctocsr<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n""    csctocsr<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n");
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_csrtocoo__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_expandptr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
-  int arg2 ;
+  int *arg2 ;
   int *arg3 ;
-  int *arg4 ;
-  signed char *arg5 ;
-  std::vector<int > *arg6 = (std::vector<int > *) 0 ;
-  std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<signed char > *arg8 = (std::vector<signed char > *) 0 ;
   int val1 ;
   int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *array3 = NULL ;
-  int is_new_object3 ;
-  PyArrayObject *array4 = NULL ;
-  int is_new_object4 ;
-  PyArrayObject *array5 = NULL ;
-  int is_new_object5 ;
-  std::vector<int > *tmp6 ;
-  std::vector<int > *tmp7 ;
-  std::vector<signed char > *tmp8 ;
+  PyArrayObject *array2 = NULL ;
+  int is_new_object2 ;
+  PyArrayObject *temp3 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
   
-  {
-    tmp6 = new std::vector<int>(); 
-    arg6 = tmp6; 
-  }
-  {
-    tmp7 = new std::vector<int>(); 
-    arg7 = tmp7; 
-  }
-  {
-    tmp8 = new std::vector<signed char>(); 
-    arg8 = tmp8; 
-  }
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocoo",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOO:expandptr",&obj0,&obj1,&obj2)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocoo" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "expandptr" "', 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 '" "csrtocoo" "', 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;
-    
-    arg4 = (int*) array4->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);
   }
-  {
-    npy_intp size[1] = {
-      -1
-    };
-    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_BYTE, &is_new_object5);
-    if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1)
-      || !require_contiguous(array5)   || !require_native(array5)) SWIG_fail;
-    
-    arg5 = (signed char*) array5->data;
-  }
-  csrtocoo<int,signed char >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6,arg7,arg8);
+  expandptr<int >(arg1,(int const (*))arg2,arg3);
   resultobj = SWIG_Py_Void();
   {
-    int length = (arg6)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length);	 
-    delete arg6; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
+    if (is_new_object2 && array2) Py_DECREF(array2);
   }
-  {
-    int length = (arg7)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length);	 
-    delete arg7; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
-  }
-  {
-    int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(signed char)*length);	 
-    delete arg8; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
-  }
-  {
-    if (is_new_object3 && array3) Py_DECREF(array3);
-  }
-  {
-    if (is_new_object4 && array4) Py_DECREF(array4);
-  }
-  {
-    if (is_new_object5 && array5) Py_DECREF(array5);
-  }
   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_object5 && array5) Py_DECREF(array5);
-  }
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_csrtocoo__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  int arg1 ;
-  int arg2 ;
-  int *arg3 ;
-  int *arg4 ;
-  unsigned char *arg5 ;
-  std::vector<int > *arg6 = (std::vector<int > *) 0 ;
-  std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<unsigned char > *arg8 = (std::vector<unsigned char > *) 0 ;
-  int val1 ;
-  int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *array3 = NULL ;
-  int is_new_object3 ;
-  PyArrayObject *array4 = NULL ;
-  int is_new_object4 ;
-  PyArrayObject *array5 = NULL ;
-  int is_new_object5 ;
-  std::vector<int > *tmp6 ;
-  std::vector<int > *tmp7 ;
-  std::vector<unsigned char > *tmp8 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  PyObject * obj3 = 0 ;
-  PyObject * obj4 = 0 ;
-  
-  {
-    tmp6 = new std::vector<int>(); 
-    arg6 = tmp6; 
-  }
-  {
-    tmp7 = new std::vector<int>(); 
-    arg7 = tmp7; 
-  }
-  {
-    tmp8 = new std::vector<unsigned char>(); 
-    arg8 = tmp8; 
-  }
-  if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocoo",&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 '" "csrtocoo" "', 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 '" "csrtocoo" "', 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;
-  }
-  {
-    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;
-    
-    arg4 = (int*) array4->data;
-  }
-  {
-    npy_intp size[1] = {
-      -1
-    };
-    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_UBYTE, &is_new_object5);
-    if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1)
-      || !require_contiguous(array5)   || !require_native(array5)) SWIG_fail;
-    
-    arg5 = (unsigned char*) array5->data;
-  }
-  csrtocoo<int,unsigned char >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6,arg7,arg8);
-  resultobj = SWIG_Py_Void();
-  {
-    int length = (arg6)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length);	 
-    delete arg6; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
-  }
-  {
-    int length = (arg7)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); 
-    memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length);	 
-    delete arg7; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
-  }
-  {
-    int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(unsigned char)*length);	 
-    delete arg8; 
-    resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
-  }
-  {
-    if (is_new_object3 && array3) Py_DECREF(array3);
-  }
-  {
-    if (is_new_object4 && array4) Py_DECREF(array4);
-  }
-  {
-    if (is_new_object5 && array5) Py_DECREF(array5);
-  }
-  return resultobj;
-fail:
-  {
-    if (is_new_object3 && array3) Py_DECREF(array3);
-  }
-  {
-    if (is_new_object4 && array4) Py_DECREF(array4);
-  }
-  {
-    if (is_new_object5 && array5) Py_DECREF(array5);
-  }
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_csrtocoo__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  int arg1 ;
-  int arg2 ;
-  int *arg3 ;
-  int *arg4 ;
-  short *arg5 ;
-  std::vector<int > *arg6 = (std::vector<int > *) 0 ;
-  std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<short > *arg8 = (std::vector<short > *) 0 ;
-  int val1 ;
-  int ecode1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyArrayObject *array3 = NULL ;
-  int is_new_object3 ;
-  PyArrayObject *array4 = NULL ;
-  int is_new_object4 ;
-  PyArrayObject *array5 = NULL ;
-  int is_new_object5 ;
-  std::vector<int > *tmp6 ;
-  std::vector<int > *tmp7 ;
-  std::vector<short > *tmp8 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0