[Scipy-svn] r2510 - trunk/Lib/sparse/sparsetools

scipy-svn at scipy.org scipy-svn at scipy.org
Tue Jan 9 05:36:51 CST 2007


Author: wnbell
Date: 2007-01-09 05:36:44 -0600 (Tue, 09 Jan 2007)
New Revision: 2510

Modified:
   trunk/Lib/sparse/sparsetools/numpy.i
   trunk/Lib/sparse/sparsetools/sparsetools.h
   trunk/Lib/sparse/sparsetools/sparsetools.i
   trunk/Lib/sparse/sparsetools/sparsetools.py
   trunk/Lib/sparse/sparsetools/sparsetools_wrap.cxx
Log:
Templated index types in sparsetools.h
Consolidated redundant code in sparsetools.i
regenerated SWIG wrappers



Modified: trunk/Lib/sparse/sparsetools/numpy.i
===================================================================
--- trunk/Lib/sparse/sparsetools/numpy.i	2007-01-09 05:49:05 UTC (rev 2509)
+++ trunk/Lib/sparse/sparsetools/numpy.i	2007-01-09 11:36:44 UTC (rev 2510)
@@ -41,11 +41,14 @@
 
 /* Given a Numeric typecode, return a string describing the type.
  */
-char* typecode_string(int typecode) {
-  char* type_names[20] = {"char","unsigned byte","byte","short",
-			  "unsigned short","int","unsigned int","long",
-			  "float","double","complex float","complex double",
-			  "object","ntype","unkown"};
+char* type_names[20] = {"char","unsigned byte","byte","short",
+			"unsigned short","int","unsigned int","long",
+			"float","double","complex float","complex double",
+			"object","ntype","unkown"};
+ char* typecode_string(int typecode) {
+  if(typecode < 0 || typecode > 19)
+    typecode = 19;
+
   return type_names[typecode];
 }
 
@@ -298,7 +301,7 @@
 /* Define concrete examples of the TYPEMAP_IN1 macros */
 TYPEMAP_IN1(char,          PyArray_CHAR  )
 TYPEMAP_IN1(unsigned char, PyArray_UBYTE )
-TYPEMAP_IN1(signed char,   PyArray_SBYTE )
+TYPEMAP_IN1(signed char,   PyArray_BYTE  )
 TYPEMAP_IN1(short,         PyArray_SHORT )
 TYPEMAP_IN1(int,           PyArray_INT   )
 TYPEMAP_IN1(long,          PyArray_LONG  )
@@ -310,7 +313,7 @@
 TYPEMAP_IN1(npy_clongdouble,    PyArray_CLONGDOUBLE)
 TYPEMAP_IN1(const char,          PyArray_CHAR  )
 TYPEMAP_IN1(const unsigned char, PyArray_UBYTE )
-TYPEMAP_IN1(const signed char,   PyArray_SBYTE )
+TYPEMAP_IN1(const signed char,   PyArray_BYTE  )
 TYPEMAP_IN1(const short,         PyArray_SHORT )
 TYPEMAP_IN1(const int,           PyArray_INT   )
 TYPEMAP_IN1(const long,          PyArray_LONG  )
@@ -344,7 +347,7 @@
 /* Define concrete examples of the TYPEMAP_IN2 macros */
 TYPEMAP_IN2(char,          PyArray_CHAR  )
 TYPEMAP_IN2(unsigned char, PyArray_UBYTE )
-TYPEMAP_IN2(signed char,   PyArray_SBYTE )
+TYPEMAP_IN2(signed char,   PyArray_BYTE  )
 TYPEMAP_IN2(short,         PyArray_SHORT )
 TYPEMAP_IN2(int,           PyArray_INT   )
 TYPEMAP_IN2(long,          PyArray_LONG  )
@@ -356,7 +359,7 @@
 TYPEMAP_IN2(npy_clongdouble,    PyArray_CLONGDOUBLE)
 TYPEMAP_IN2(const char,          PyArray_CHAR  )
 TYPEMAP_IN2(const unsigned char, PyArray_UBYTE )
-TYPEMAP_IN2(const signed char,   PyArray_SBYTE )
+TYPEMAP_IN2(const signed char,   PyArray_BYTE  )
 TYPEMAP_IN2(const short,         PyArray_SHORT )
 TYPEMAP_IN2(const int,           PyArray_INT   )
 TYPEMAP_IN2(const long,          PyArray_LONG  )
@@ -408,7 +411,7 @@
 /* Define concrete examples of the TYPEMAP_INPLACE1 macro */
 TYPEMAP_INPLACE1(char,          PyArray_CHAR  )
 TYPEMAP_INPLACE1(unsigned char, PyArray_UBYTE )
-TYPEMAP_INPLACE1(signed char,   PyArray_SBYTE )
+TYPEMAP_INPLACE1(signed char,   PyArray_BYTE  )
 TYPEMAP_INPLACE1(short,         PyArray_SHORT )
 TYPEMAP_INPLACE1(int,           PyArray_INT   )
 TYPEMAP_INPLACE1(long,          PyArray_LONG  )
@@ -420,7 +423,7 @@
 TYPEMAP_INPLACE1(npy_clongdouble,    PyArray_CLONGDOUBLE)
 TYPEMAP_INPLACE1(const char,          PyArray_CHAR  )
 TYPEMAP_INPLACE1(const unsigned char, PyArray_UBYTE )
-TYPEMAP_INPLACE1(const signed char,   PyArray_SBYTE )
+TYPEMAP_INPLACE1(const signed char,   PyArray_BYTE  )
 TYPEMAP_INPLACE1(const short,         PyArray_SHORT )
 TYPEMAP_INPLACE1(const int,           PyArray_INT   )
 TYPEMAP_INPLACE1(const long,          PyArray_LONG  )
@@ -450,7 +453,7 @@
 /* Define concrete examples of the TYPEMAP_INPLACE2 macro */
 TYPEMAP_INPLACE2(char,          PyArray_CHAR  )
 TYPEMAP_INPLACE2(unsigned char, PyArray_UBYTE )
-TYPEMAP_INPLACE2(signed char,   PyArray_SBYTE )
+TYPEMAP_INPLACE2(signed char,   PyArray_BYTE  )
 TYPEMAP_INPLACE2(short,         PyArray_SHORT )
 TYPEMAP_INPLACE2(int,           PyArray_INT   )
 TYPEMAP_INPLACE2(long,          PyArray_LONG  )
@@ -462,7 +465,7 @@
 TYPEMAP_INPLACE2(npy_clongdouble,    PyArray_CLONGDOUBLE)
 TYPEMAP_INPLACE2(const char,          PyArray_CHAR  )
 TYPEMAP_INPLACE2(const unsigned char, PyArray_UBYTE )
-TYPEMAP_INPLACE2(const signed char,   PyArray_SBYTE )
+TYPEMAP_INPLACE2(const signed char,   PyArray_BYTE  )
 TYPEMAP_INPLACE2(const short,         PyArray_SHORT )
 TYPEMAP_INPLACE2(const int,           PyArray_INT   )
 TYPEMAP_INPLACE2(const long,          PyArray_LONG  )
@@ -521,7 +524,7 @@
 /* Define concrete examples of the TYPEMAP_ARGOUT1 macro */
 TYPEMAP_ARGOUT1(char,          PyArray_CHAR  )
 TYPEMAP_ARGOUT1(unsigned char, PyArray_UBYTE )
-TYPEMAP_ARGOUT1(signed char,   PyArray_SBYTE )
+TYPEMAP_ARGOUT1(signed char,   PyArray_BYTE  )
 TYPEMAP_ARGOUT1(short,         PyArray_SHORT )
 TYPEMAP_ARGOUT1(int,           PyArray_INT   )
 TYPEMAP_ARGOUT1(long,          PyArray_LONG  )
@@ -549,7 +552,7 @@
 /* Define concrete examples of the TYPEMAP_ARGOUT2 macro */
 TYPEMAP_ARGOUT2(char,          PyArray_CHAR  )
 TYPEMAP_ARGOUT2(unsigned char, PyArray_UBYTE )
-TYPEMAP_ARGOUT2(signed char,   PyArray_SBYTE )
+TYPEMAP_ARGOUT2(signed char,   PyArray_BYTE  )
 TYPEMAP_ARGOUT2(short,         PyArray_SHORT )
 TYPEMAP_ARGOUT2(int,           PyArray_INT   )
 TYPEMAP_ARGOUT2(long,          PyArray_LONG  )

Modified: trunk/Lib/sparse/sparsetools/sparsetools.h
===================================================================
--- trunk/Lib/sparse/sparsetools/sparsetools.h	2007-01-09 05:49:05 UTC (rev 2509)
+++ trunk/Lib/sparse/sparsetools/sparsetools.h	2007-01-09 11:36:44 UTC (rev 2510)
@@ -10,6 +10,7 @@
  *    Nathan Bell
  *
  * Revisions:
+ *    01/09/2007 - index type is now templated
  *    01/06/2007 - initial inclusion into SciPy
  *
  */
@@ -25,6 +26,10 @@
 
 /*
  * Return zero of the appropriate type
+ *
+ *  this is a workaround for NumPy complex types 
+ *  where T x = 0; doesn't make sense.
+ *
  */
 template <class T> 
 T ZERO(){
@@ -43,16 +48,16 @@
  *   - convert CSC->CSR
  *
  * Input Arguments:
- *   int  n_row         - number of rows in A
- *   int  n_col         - number of columns in A
- *   int  Ap[n_row+1]   - row pointer
- *   int  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  Ap[n_row+1]   - row pointer
+ *   I  Aj[nnz(A)]    - column indices
+ *   T  Ax[nnz(A)]    - nonzeros
  *
  * Output Arguments:
- *   vec<int> Bp  - row pointer
- *   vec<int> Bj  - column indices
- *   vec<T>   Bx  - nonzeros
+ *   vec<I>  Bp  - row pointer
+ *   vec<I>  Bj  - column indices
+ *   vec<T>  Bx  - nonzeros
  *
  * Note:
  *   Output arrays Bp,Bj,Bx will be allocated within in the method
@@ -64,43 +69,43 @@
  *   Complexity: Linear.  Specifically O(nnz(A) + max(n_row,n_col))
  * 
  */
-template <class T>
-void csrtocsc(const int n_row,
-	      const int n_col, 
-	      const int Ap[], 
-	      const int Aj[], 
-	      const T   Ax[],
-	      std::vector<int>* Bp,
-	      std::vector<int>* Bi,
-	      std::vector<T>*   Bx)
+template <class I, class T>
+void csrtocsc(const I n_row,
+	      const I n_col, 
+	      const I Ap[], 
+	      const I Aj[], 
+	      const T Ax[],
+	      std::vector<I>* Bp,
+	      std::vector<I>* Bi,
+	      std::vector<T>* Bx)
 {  
-  int NNZ = Ap[n_row];
+  I NNZ = Ap[n_row];
   
-  *Bp = std::vector<int>(n_col+1);
-  *Bi = std::vector<int>(NNZ);
+  *Bp = std::vector<I>(n_col+1);
+  *Bi = std::vector<I>(NNZ);
   *Bx = std::vector<T>(NNZ);
  
-  std::vector<int> nnz_per_col(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 (int i = 0; i < NNZ; i++){            
+  for (I i = 0; i < NNZ; i++){            
     nnz_per_col[Aj[i]]++;
   }
         
   //cumsum the nnz_per_col to get Bp[]
-  for(int i = 0, cumsum = 0; i < n_col; i++){     
+  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)[n_col] = NNZ;
   
-  for(int i = 0; i < n_row; i++){
-    int row_start = Ap[i];
-    int row_end   = Ap[i+1];
-    for(int j = row_start; j < row_end; j++){
-      int col = Aj[j];
-      int k   = (*Bp)[col] + nnz_per_col[col];
+  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];
 
       (*Bi)[k] = i;
       (*Bx)[k] = Ax[j];
@@ -120,16 +125,16 @@
  *   - convert CSC->COO
  *
  * Input Arguments:
- *   int  n_row         - number of rows in A
- *   int  n_col         - number of columns in A
- *   int  Ap[n_row+1]   - row pointer
- *   int  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  Ap[n_row+1]   - row pointer
+ *   I  Aj[nnz(A)]    - column indices
+ *   T  Ax[nnz(A)]    - nonzeros
  *
  * Output Arguments:
- *   vec<int> Bi  - row indices
- *   vec<int> Bj  - column indices
- *   vec<T>   Bx  - nonzeros
+ *   vec<I> Bi  - row indices
+ *   vec<I> Bj  - column indices
+ *   vec<T> Bx  - nonzeros
  *
  * Note:
  *   Output arrays Bi,Bj,Bx will be allocated within in the method
@@ -138,20 +143,20 @@
  *   Complexity: Linear.
  * 
  */
-template<class T>
-void csrtocoo(const int n_row,
-	      const int n_col, 
-	      const int Ap [], 
-	      const int Aj[], 
-	      const T   Ax[],
-	      std::vector<int>*    Bi,
-	      std::vector<int>*    Bj,
+template <class I, class T>
+void csrtocoo(const I n_row,
+	      const I n_col, 
+	      const I Ap [], 
+	      const I Aj[], 
+	      const T Ax[],
+	      std::vector<I>* Bi,
+	      std::vector<I>* Bj,
 	      std::vector<T>* Bx)
 {
-  for(int i = 0; i < n_row; i++){
-    int row_start = Ap[i];
-    int row_end   = Ap[i+1];
-    for(int jj = row_start; jj < row_end; jj++){
+  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->push_back(i);
       Bj->push_back(Aj[jj]);
       Bx->push_back(Ax[jj]);
@@ -166,18 +171,18 @@
  *
  *
  * Input Arguments:
- *   int  n_row       - number of rows in A
- *   int  n_col       - number of columns in B (hence C is n_row by n_col)
- *   int  Ap[n_row+1] - row pointer
- *   int  Aj[nnz(A)]  - column indices
- *   T    Ax[nnz(A)]  - nonzeros
- *   int  Bp[?]       - row pointer
- *   int  Bj[nnz(B)]  - column indices
- *   T    Bx[nnz(B)]  - nonzeros
+ *   I  n_row       - number of rows in A
+ *   I  n_col       - number of columns in B (hence C is n_row by n_col)
+ *   I  Ap[n_row+1] - row pointer
+ *   I  Aj[nnz(A)]  - column indices
+ *   T  Ax[nnz(A)]  - nonzeros
+ *   I  Bp[?]       - row pointer
+ *   I  Bj[nnz(B)]  - column indices
+ *   T  Bx[nnz(B)]  - nonzeros
  * Output Arguments:
- *   vec<int> Cp - row pointer
- *   vec<int> Cj - column indices
- *   vec<T>   Cx - nonzeros
+ *   vec<I> Cp - row pointer
+ *   vec<I> Cj - column indices
+ *   vec<T> Cx - nonzeros
  *   
  * Note:
  *   Output arrays Cp,Cj, and Cx will be allocated within in the method
@@ -201,36 +206,34 @@
  *    http://www.mgnet.org/~douglas/ccd-codes.html
  *
  */
-template<class T>
-void csrmucsr(const int n_row,
-	      const int n_col, 
-	      const int Ap [], 
-	      const int Aj[], 
+template <class I, class T>
+void csrmucsr(const I n_row,
+	      const I n_col, 
+	      const I Ap[], 
+	      const I Aj[], 
 	      const T Ax[],
-	      const int Bp[],
-	      const int Bj[],
+	      const I Bp[],
+	      const I Bj[],
 	      const T Bx[],
-	      std::vector<int>* Cp,
-	      std::vector<int>* Cj,
+	      std::vector<I>* Cp,
+	      std::vector<I>* Cj,
 	      std::vector<T>* Cx)
 {
-  *Cp = std::vector<int>(n_row+1,0);
-  Cj->clear();        
-  Cx->clear();
+  *Cp = std::vector<I>(n_row+1,0);
   
   const T zero = ZERO<T>();
 
-  std::vector<int>    index(n_col,-1);
+  std::vector<I> index(n_col,-1);
   std::vector<T> sums(n_col,zero);
 
-  for(int i = 0; i < n_row; i++){
-    int istart = -1;
-    int length =  0;
+  for(I i = 0; i < n_row; i++){
+    I istart = -1;
+    I length =  0;
     
-    for(int jj = Ap[i]; jj < Ap[i+1]; jj++){
-      int j = Aj[jj];
-      for(int kk = Bp[j]; kk < Bp[j+1]; kk++){
-	int k = Bj[kk];
+    for(I jj = Ap[i]; jj < Ap[i+1]; jj++){
+      I j = Aj[jj];
+      for(I kk = Bp[j]; kk < Bp[j+1]; kk++){
+	I k = Bj[kk];
         
 	sums[k] += Ax[jj]*Bx[kk];
         
@@ -242,13 +245,13 @@
       }
     }         
 
-    for(int jj = 0; jj < length; jj++){
+    for(I jj = 0; jj < length; jj++){
       if(sums[istart] != zero){
 	Cj->push_back(istart);
 	Cx->push_back(sums[istart]);
       }
 	
-      int temp = istart;                
+      I temp = istart;                
       istart = index[istart];
       
       index[temp] = -1; //clear arrays
@@ -267,18 +270,18 @@
  *
  *
  * Input Arguments:
- *   int    n_row       - number of rows in A (and B)
- *   int    n_col       - number of columns in A (and B)
- *   int    Ap[n_row+1] - row pointer
- *   int    Aj[nnz(A)]  - column indices
- *   T      Ax[nnz(A)]  - nonzeros
- *   int    Bp[?]       - row pointer
- *   int    Bj[nnz(B)]  - column indices
- *   T      Bx[nnz(B)]  - nonzeros
+ *   I    n_row       - number of rows in A (and B)
+ *   I    n_col       - number of columns in A (and B)
+ *   I    Ap[n_row+1] - row pointer
+ *   I    Aj[nnz(A)]  - column indices
+ *   T    Ax[nnz(A)]  - nonzeros
+ *   I    Bp[?]       - row pointer
+ *   I    Bj[nnz(B)]  - column indices
+ *   T    Bx[nnz(B)]  - nonzeros
  * Output Arguments:
- *   vec<int> Cp  - row pointer
- *   vec<int> Cj  - column indices
- *   vec<T>   Cx  - nonzeros
+ *   vec<I> Cp  - row pointer
+ *   vec<I> Cj  - column indices
+ *   vec<T> Cx  - nonzeros
  *   
  * Note:
  *   Output arrays Cp,Cj, and Cx will be allocated within in the method
@@ -289,36 +292,34 @@
  *           Cx will not contain any zero entries
  *
  */
-template <class T>
-void csrplcsr(const int n_row,
-	      const int n_col, 
-	      const int Ap[], 
-	      const int Aj[], 
-	      const T   Ax[],
-	      const int Bp[],
-	      const int Bj[],
-	      const T   Bx[],
-	      std::vector<int>* Cp,
-	      std::vector<int>* Cj,
-	      std::vector<T>  * Cx)
+template <class I, class T>
+void csrplcsr(const I n_row,
+	      const I n_col, 
+	      const I Ap[], 
+	      const I Aj[], 
+	      const T Ax[],
+	      const I Bp[],
+	      const I Bj[],
+	      const T Bx[],
+	      std::vector<I>* Cp,
+	      std::vector<I>* Cj,
+	      std::vector<T>* Cx)
 {
 
-  *Cp = std::vector<int>(n_row+1,0);
-  Cj->clear();        
-  Cx->clear();
+  *Cp = std::vector<I>(n_row+1,0);
   
   const T zero = ZERO<T>();
 
-  std::vector<int> index(n_col,-1);
-  std::vector<T>   sums(n_col,zero);
+  std::vector<I> index(n_col,-1);
+  std::vector<T>  sums(n_col,zero);
 
-  for(int i = 0; i < n_row; i++){
-    int istart = -1;
-    int length =  0;
+  for(I i = 0; i < n_row; i++){
+    I istart = -1;
+    I length =  0;
     
     //add a row of A to sums
-    for(int jj = Ap[i]; jj < Ap[i+1]; jj++){
-      int j = Aj[jj];
+    for(I jj = Ap[i]; jj < Ap[i+1]; jj++){
+      I j = Aj[jj];
       sums[j] += Ax[jj];
               
       if(index[j] == -1){
@@ -329,8 +330,8 @@
     }
     
     //add a row of B to sums
-    for(int jj = Bp[i]; jj < Bp[i+1]; jj++){
-      int j = Bj[jj];
+    for(I jj = Bp[i]; jj < Bp[i+1]; jj++){
+      I j = Bj[jj];
       sums[j] += Bx[jj];
 
       if(index[j] == -1){
@@ -341,13 +342,13 @@
     }
 
 
-    for(int jj = 0; jj < length; jj++){
+    for(I jj = 0; jj < length; jj++){
       if(sums[istart] != zero){
 	Cj->push_back(istart);
 	Cx->push_back(sums[istart]);
       }
       
-      int temp = istart;                
+      I temp = istart;                
       istart = index[istart];
       
       index[temp] = -1;
@@ -364,18 +365,18 @@
  *   (elmul) - elementwise multiplication
  *
  * Input Arguments:
- *   int    n_row       - number of rows in A (and B)
- *   int    n_col       - number of columns in A (and B)
- *   int    Ap[n_row+1] - row pointer
- *   int    Aj[nnz(A)]  - column indices
- *   T      Ax[nnz(A)]  - nonzeros
- *   int    Bp[?]       - row pointer
- *   int    Bj[nnz(B)]  - column indices
- *   T      Bx[nnz(B)]  - nonzeros
+ *   I    n_row       - number of rows in A (and B)
+ *   I    n_col       - number of columns in A (and B)
+ *   I    Ap[n_row+1] - row pointer
+ *   I    Aj[nnz(A)]  - column indices
+ *   T    Ax[nnz(A)]  - nonzeros
+ *   I    Bp[?]       - row pointer
+ *   I    Bj[nnz(B)]  - column indices
+ *   T    Bx[nnz(B)]  - nonzeros
  * Output Arguments:
- *   vec<int> Cp  - row pointer
- *   vec<int> Cj  - column indices
- *   vec<T>   Cx  - nonzeros
+ *   vec<I> Cp  - row pointer
+ *   vec<I> Cj  - column indices
+ *   vec<T> Cx  - nonzeros
  *   
  * Note:
  *   Output arrays Cp,Cj, and Cx will be allocated within in the method
@@ -386,36 +387,34 @@
  *           Cx will not contain any zero entries
  *
  */
-template <class T>
-void csrelmulcsr(const int n_row,
-		 const int n_col, 
-		 const int Ap [], 
-		 const int Aj[], 
-		 const T   Ax[],
-		 const int Bp[],
-		 const int Bj[],
-		 const T   Bx[],
-		 std::vector<int>* Cp,
-		 std::vector<int>* Cj,
-		 std::vector<T>*   Cx)
+template <class I, class T>
+void csrelmulcsr(const I n_row,
+		 const I n_col, 
+		 const I Ap [], 
+		 const I Aj[], 
+		 const T Ax[],
+		 const I Bp[],
+		 const I Bj[],
+		 const T Bx[],
+		 std::vector<I>* Cp,
+		 std::vector<I>* Cj,
+		 std::vector<T>* Cx)
 {
-  *Cp = std::vector<int>(n_row+1,0);
-  Cj->clear();        
-  Cx->clear();
+  *Cp = std::vector<I>(n_row+1,0);
   
   const T zero = ZERO<T>();
 
-  std::vector<int>   index(n_col,-1);
+  std::vector<I>   index(n_col,-1);
   std::vector<T> A_row(n_col,zero);
   std::vector<T> B_row(n_col,zero);
 
-  for(int i = 0; i < n_row; i++){
-    int istart = -1;
-    int length =  0;
+  for(I i = 0; i < n_row; i++){
+    I istart = -1;
+    I length =  0;
     
     //add a row of A to A_row
-    for(int jj = Ap[i]; jj < Ap[i+1]; jj++){
-      int j = Aj[jj];
+    for(I jj = Ap[i]; jj < Ap[i+1]; jj++){
+      I j = Aj[jj];
 
       A_row[j] += Ax[jj];
       
@@ -427,8 +426,8 @@
     }
     
     //add a row of B to B_row
-    for(int jj = Bp[i]; jj < Bp[i+1]; jj++){
-      int j = Bj[jj];
+    for(I jj = Bp[i]; jj < Bp[i+1]; jj++){
+      I j = Bj[jj];
 
       B_row[j] += Bx[jj];
 
@@ -440,7 +439,7 @@
     }
 
 
-    for(int jj = 0; jj < length; jj++){
+    for(I jj = 0; jj < length; jj++){
       T prod = A_row[istart] * B_row[istart];
       
       if(prod != zero){
@@ -448,7 +447,7 @@
 	Cx->push_back(prod);
       }
       
-      int temp = istart;                
+      I temp = istart;                
       istart = index[istart];
       
       index[temp] = -1;
@@ -466,15 +465,15 @@
  *
  *
  * Input Arguments:
- *   int  n_row         - number of rows in A
- *   int  n_col         - number of columns in A
- *   int  Ai[nnz(A)]    - row indices
- *   int  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<int> Bp        - row pointer
- *   vec<int> Bj        - column indices
- *   vec<T>   Bx        - nonzeros
+ *   vec<I> Bp        - row pointer
+ *   vec<I> Bj        - column indices
+ *   vec<T> Bx        - nonzeros
  *
  * Note:
  *   Output arrays Bp,Bj,Bx will be allocated within in the method
@@ -488,28 +487,28 @@
  *   Complexity: Linear.  Specifically O(nnz(A) + max(n_row,n_col))
  * 
  */
-template<class T>
-void cootocsr(const int n_row,
-	      const int n_col,
-	      const int NNZ,
-	      const int Ai[],
-	      const int Aj[],
-	      const T   Ax[],
-	      std::vector<int>* Bp,
-	      std::vector<int>* Bj,
+template <class I, class T>
+void cootocsr(const I n_row,
+	      const I n_col,
+	      const I NNZ,
+	      const I Ai[],
+	      const I Aj[],
+	      const T Ax[],
+	      std::vector<I>* Bp,
+	      std::vector<I>* Bj,
 	      std::vector<T>* Bx)
 {
-  std::vector<int> tempBp(n_row+1,0);
-  std::vector<int> tempBj(NNZ);
-  std::vector<T>   tempBx(NNZ);
+  std::vector<I> tempBp(n_row+1,0);
+  std::vector<I> tempBj(NNZ);
+  std::vector<T> tempBx(NNZ);
 
-  std::vector<int> nnz_per_row(n_row,0); //temp array
+  std::vector<I> nnz_per_row(n_row,0); //temp array
 
   //compute nnz per row, then compute Bp
-  for(int i = 0; i < NNZ; i++){
+  for(I i = 0; i < NNZ; i++){
     nnz_per_row[Ai[i]]++;
   }
-  for(int i = 0, cumsum = 0; i < n_row; i++){
+  for(I i = 0, cumsum = 0; i < n_row; i++){
     tempBp[i]      = cumsum;
     cumsum        += nnz_per_row[i];
     nnz_per_row[i] = 0; //reset count
@@ -517,10 +516,10 @@
   tempBp[n_row] = NNZ;
 
 
-  //write Aj,Ax into tempBj,tempBx
-  for(int i = 0; i < NNZ; i++){
-    int row = Ai[i];
-    int n   = tempBp[row] + nnz_per_row[row];
+  //write Aj,Ax Io tempBj,tempBx
+  for(I i = 0; i < NNZ; i++){
+    I row = Ai[i];
+    I n   = tempBp[row] + nnz_per_row[row];
 
     tempBj[n] = Aj[i];
     tempBx[n] = Ax[i];
@@ -531,12 +530,12 @@
 
 
   //use (tempB + 0) to sum duplicates
-  std::vector<int> Xp(n_row+1,0); //row pointer for an empty matrix
+  std::vector<I> Xp(n_row+1,0); //row pointer for an empty matrix
 
-  csrplcsr<T>(n_row,n_col,
-	      &tempBp[0],&tempBj[0],&tempBx[0],
-	      &Xp[0],NULL,NULL,
-	      Bp,Bj,Bx);    	   
+  csrplcsr<I,T>(n_row,n_col,
+		&tempBp[0],&tempBj[0],&tempBx[0],
+		&Xp[0],NULL,NULL,
+		Bp,Bj,Bx);    	   
 }
 	    
 
@@ -548,12 +547,12 @@
  *
  *
  * Input Arguments:
- *   int  n_row         - number of rows in A
- *   int  n_col         - number of columns in A
- *   int  Ap[n_row+1]   - row pointer
- *   int  Aj[nnz(A)]    - column indices
- *   T    Ax[n_col]     - nonzeros
- *   T    Xx[n_col]     - nonzeros
+ *   I  n_row         - number of rows in A
+ *   I  n_col         - number of columns in A
+ *   I  Ap[n_row+1]   - row pointer
+ *   I  Aj[nnz(A)]    - column indices
+ *   T  Ax[n_col]     - nonzeros
+ *   T  Xx[n_col]     - nonzeros
  *
  * Output Arguments:
  *   vec<T> Yx - nonzeros (real part)
@@ -564,25 +563,25 @@
  *   Complexity: Linear.  Specifically O(nnz(A) + max(n_row,n_col))
  * 
  */
-template <class T>
-void csrmux(const int n_row,
-	    const int n_col, 
-	    const int Ap [], 
-	    const int Aj[], 
-	    const T   Ax[],
-	    const T   Xx[],
+template <class I, class T>
+void csrmux(const I n_row,
+	    const I n_col, 
+	    const I Ap [], 
+	    const I Aj[], 
+	    const T Ax[],
+	    const T Xx[],
 	    std::vector<T>*  Yx)
 {
   const T zero = ZERO<T>();
 
   *Yx = std::vector<T>(n_row,zero);
 
-  for(int i = 0; i < n_row; i++){
-    int row_start = Ap[i];
-    int row_end   = Ap[i+1];
+  for(I i = 0; i < n_row; i++){
+    I row_start = Ap[i];
+    I row_end   = Ap[i+1];
     
     T& Yx_i = (*Yx)[i];
-    for(int jj = row_start; jj < row_end; jj++){
+    for(I jj = row_start; jj < row_end; jj++){
       Yx_i += Ax[jj] * Xx[Aj[jj]];
     }
   }
@@ -595,10 +594,10 @@
  *
  *
  * Input Arguments:
- *   int  n_row         - number of rows in A
- *   int  n_col         - number of columns in A
- *   int  Ap[n_row+1]   - column pointer
- *   int  Ai[nnz(A)]    - row indices
+ *   I  n_row         - number of rows in A
+ *   I  n_col         - number of columns in A
+ *   I  Ap[n_row+1]   - column pointer
+ *   I  Ai[nnz(A)]    - row indices
  *   T    Ax[n_col]     - nonzeros (real part)
  *   T    Xx[n_col]     - nonzeros (real part)
  *   bool do_complex    - switch scalar/complex modes
@@ -612,25 +611,25 @@
  *   Complexity: Linear.  Specifically O(nnz(A) + max(n_row,n_col))
  * 
  */
-template <class T>
-void cscmux(const int n_row,
-	    const int n_col, 
-	    const int Ap[], 
-	    const int Ai[], 
-	    const T   Ax[],
-	    const T   Xx[],
+template <class I, class T>
+void cscmux(const I n_row,
+	    const I n_col, 
+	    const I Ap[], 
+	    const I Ai[], 
+	    const T Ax[],
+	    const T Xx[],
 	    std::vector<T>*  Yx)
 {
   const T zero = ZERO<T>();
 
   *Yx = std::vector<T>(n_row,zero);
   
-  for(int j = 0; j < n_col; j++){
-    int col_start = Ap[j];
-    int col_end   = Ap[j+1];
+  for(I j = 0; j < n_col; j++){
+    I col_start = Ap[j];
+    I col_end   = Ap[j+1];
     
-    for(int ii = col_start; ii < col_end; ii++){
-      int row  = Ai[ii];
+    for(I ii = col_start; ii < col_end; ii++){
+      I row  = Ai[ii];
       (*Yx)[row] += Ax[ii] * Xx[j];
     }
   }
@@ -643,16 +642,16 @@
  * Construct CSC matrix A from diagonals
  *
  * Input Arguments:
- *   int  n_row                            - number of rows in A
- *   int  n_col                            - number of columns in A
- *   int  n_diags                          - number of diagonals
- *   int  diags_indx[n_diags]              - where to place each diagonal 
- *   T    diags[n_diags][min(n_row,n_col)] - diagonals
+ *   I  n_row                            - number of rows in A
+ *   I  n_col                            - number of columns in A
+ *   I  n_diags                          - number of diagonals
+ *   I  diags_indx[n_diags]              - where to place each diagonal 
+ *   T  diags[n_diags][min(n_row,n_col)] - diagonals
  *
  * Output Arguments:
- *   vec<int> Ap  - row pointer
- *   vec<int> Aj  - column indices
- *   vec<T>   Ax  - nonzeros
+ *   vec<I> Ap  - row pointer
+ *   vec<I> Aj  - column indices
+ *   vec<T> Ax  - nonzeros
  *
  * Note:
  *   Output arrays Ap,Aj,Ax will be allocated within in the method
@@ -663,30 +662,30 @@
  *   Complexity: Linear
  * 
  */
-template<class T>
-void spdiags(const int n_row,
-	     const int n_col,
-	     const int n_diag,
-	     const int offsets[],
-	     const T   diags[],
-	     std::vector<int> * Ap,
-	     std::vector<int> * Ai,
-	     std::vector<T>   * Ax)
+template <class I, class T>
+void spdiags(const I n_row,
+	     const I n_col,
+	     const I n_diag,
+	     const I offsets[],
+	     const T diags[],
+	     std::vector<I> * Ap,
+	     std::vector<I> * Ai,
+	     std::vector<T> * Ax)
 {
-  const int diags_length = std::min(n_row,n_col);
+  const I diags_length = std::min(n_row,n_col);
   Ap->push_back(0);
 
-  for(int i = 0; i < n_col; i++){
-    for(int j = 0; j < n_diag; j++){
+  for(I i = 0; i < n_col; i++){
+    for(I j = 0; j < n_diag; j++){
       if(offsets[j] <= 0){              //sub-diagonal
-	int row = i - offsets[j];
+	I row = i - offsets[j];
 	if (row >= n_row){ continue; }
 	
 	Ai->push_back(row);
 	Ax->push_back(diags[j*diags_length + i]);
 
       } else {                          //super-diagonal
-	int row = i - offsets[j];
+	I row = i - offsets[j];
 	if (row < 0 || row >= n_row){ continue; }
 
 	Ai->push_back(row);
@@ -703,36 +702,36 @@
  * Compute M = A for CSR matrix A, dense matrix M
  *
  * Input Arguments:
- *   int  n_row           - number of rows in A
- *   int  n_col           - number of columns in A
- *   int  Ap[n_row+1]     - row pointer
- *   int  Aj[nnz(A)]      - column indices
+ *   I  n_row           - number of rows in A
+ *   I  n_col           - number of columns in A
+ *   I  Ap[n_row+1]     - row pointer
+ *   I  Aj[nnz(A)]      - column indices
  *   T    Ax[nnz(A)]      - nonzeros 
  *   T    Mx[n_row*n_col] - dense matrix
  *
  * Note:
- *   Output arrays Mx are assumed to be allocated and
+ *   Output array Mx is assumed to be allocated and
  *   initialized to 0 by the caller.
  *
  */
-template<class T>
-void csrtodense(const int  n_row,
-		const int  n_col,
-		const int  Ap[],
-		const int  Aj[],
-		const T    Ax[],
-		      T    Mx[])
+template <class I, class T>
+void csrtodense(const I  n_row,
+		const I  n_col,
+		const I  Ap[],
+		const I  Aj[],
+		const T  Ax[],
+		      T  Mx[])
 {
-  int row_base = 0;
-  for(int i = 0; i < n_row; i++){
-    int row_start = Ap[i];
-    int row_end   = Ap[i+1];
-    for(int jj = row_start; jj < row_end; jj++){
-      int j = Aj[jj];
+  I row_base = 0;
+  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++){
+      I j = Aj[jj];
 
       Mx[row_base + j] = Ax[jj];
     }	
-    row_base +=  n_col;
+    row_base += n_col;
   }
 }
 
@@ -742,31 +741,31 @@
  * Compute A = M for CSR matrix A, dense matrix M
  *
  * Input Arguments:
- *   int  n_row           - number of rows in A
- *   int  n_col           - number of columns in A
- *   T    Mx[n_row*n_col] - dense matrix
- *   int  Ap[n_row+1]     - row pointer
- *   int  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
+ *   T  Mx[n_row*n_col] - dense matrix
+ *   I  Ap[n_row+1]     - row pointer
+ *   I  Aj[nnz(A)]      - column indices
+ *   T  Ax[nnz(A)]      - nonzeros 
  *
  * Note:
  *    Output arrays Ap,Aj,Ax will be allocated within the method
  *
  */
-template<class T>
-void densetocsr(const int  n_row,
-		const int  n_col,
-		const T    Mx[],
-		std::vector<int>* Ap,
-		std::vector<int>* Aj,
-		std::vector<T>*   Ax)
+template <class I, class T>
+void densetocsr(const I n_row,
+		const I n_col,
+		const T Mx[],
+		std::vector<I>* Ap,
+		std::vector<I>* Aj,
+		std::vector<T>* Ax)
 {
-  const T zero = ZERO<T>();
+  const T  zero  = ZERO<T>();
   const T* x_ptr = Mx;
 
   Ap->push_back(0);
-  for(int i = 0; i < n_row; i++){
-    for(int j = 0; j < n_col; j++){
+  for(I i = 0; i < n_row; i++){
+    for(I j = 0; j < n_col; j++){
       if(*x_ptr != zero){
 	Aj->push_back(j);
 	Ax->push_back(*x_ptr);
@@ -782,81 +781,81 @@
 /*
  * Derived methods
  */
-template <class T>
-void csctocsr(const int n_row,
-	      const int n_col, 
-	      const int Ap[], 
-	      const int Ai[], 
-	      const T   Ax[],
-	      std::vector<int>* Bp,
-	      std::vector<int>* Bj,
-	      std::vector<T>*   Bx)
-{ csrtocsc<T>(n_col,n_row,Ap,Ai,Ax,Bp,Bj,Bx); }
+template <class I, class T>
+void csctocsr(const I n_row,
+	      const I n_col, 
+	      const I Ap[], 
+	      const I Ai[], 
+	      const T Ax[],
+	      std::vector<I>* Bp,
+	      std::vector<I>* Bj,
+	      std::vector<T>* Bx)
+{ csrtocsc<I,T>(n_col,n_row,Ap,Ai,Ax,Bp,Bj,Bx); }
 
-template<class T>
-void csctocoo(const int n_row,
-	      const int n_col, 
-	      const int Ap[], 
-	      const int Ai[], 
-	      const T   Ax[],
-	      std::vector<int>*    Bi,
-	      std::vector<int>*    Bj,
-	      std::vector<T>*      Bx)
-{ csrtocoo<T>(n_col,n_row,Ap,Ai,Ax,Bj,Bi,Bx); }
+template <class I, class T>
+void csctocoo(const I n_row,
+	      const I n_col, 
+	      const I Ap[], 
+	      const I Ai[], 
+	      const T Ax[],
+	      std::vector<I>* Bi,
+	      std::vector<I>* Bj,
+	      std::vector<T>* Bx)
+{ csrtocoo<I,T>(n_col,n_row,Ap,Ai,Ax,Bj,Bi,Bx); }
 
-template<class T>
-void cscmucsc(const int n_row,
-	      const int n_col, 
-	      const int Ap [], 
-	      const int Ai[], 
-	      const T   Ax[],
-	      const int Bp[],
-	      const int Bi[],
-	      const T   Bx[],
-	      std::vector<int>* Cp,
-	      std::vector<int>* Ci,
-	      std::vector<T>  * Cx)
-{ csrmucsr<T>(n_col,n_row,Bp,Bi,Bx,Ap,Ai,Ax,Cp,Ci,Cx); }
+template <class I, class T>
+void cscmucsc(const I n_row,
+	      const I n_col, 
+	      const I Ap[], 
+	      const I Ai[], 
+	      const T Ax[],
+	      const I Bp[],
+	      const I Bi[],
+	      const T Bx[],
+	      std::vector<I>* Cp,
+	      std::vector<I>* Ci,
+	      std::vector<T>* Cx)
+{ csrmucsr<I,T>(n_col,n_row,Bp,Bi,Bx,Ap,Ai,Ax,Cp,Ci,Cx); }
 
-template <class T>
-void cscplcsc(const int n_row,
-	      const int n_col, 
-	      const int Ap [], 
-	      const int Ai[], 
-	      const T   Ax[],
-	      const int Bp[],
-	      const int Bi[],
-	      const T   Bx[],
-	      std::vector<int>* Cp,
-	      std::vector<int>* Ci,
-	      std::vector<T>*   Cx)
-{ csrplcsr<T>(n_col,n_row,Ap,Ai,Ax,Bp,Bi,Bx,Cp,Ci,Cx); }
+template <class I, class T>
+void cscplcsc(const I n_row,
+	      const I n_col, 
+	      const I Ap[], 
+	      const I Ai[], 
+	      const T Ax[],
+	      const I Bp[],
+	      const I Bi[],
+	      const T Bx[],
+	      std::vector<I>* Cp,
+	      std::vector<I>* Ci,
+	      std::vector<T>* Cx)
+{ csrplcsr<I,T>(n_col,n_row,Ap,Ai,Ax,Bp,Bi,Bx,Cp,Ci,Cx); }
 
-template <class T>
-void cscelmulcsc(const int n_row,
-		 const int n_col, 
-		 const int Ap [], 
-		 const int Ai[], 
-		 const T   Ax[],
-		 const int Bp[],
-		 const int Bi[],
-		 const T   Bx[],
-		 std::vector<int>* Cp,
-		 std::vector<int>* Ci,
-		 std::vector<T>*   Cx)
-{ csrelmulcsr<T>(n_col,n_row,Ap,Ai,Ax,Bp,Bi,Bx,Cp,Ci,Cx); }
+template <class I, class T>
+void cscelmulcsc(const I n_row,
+		 const I n_col, 
+		 const I Ap[], 
+		 const I Ai[], 
+		 const T Ax[],
+		 const I Bp[],
+		 const I Bi[],
+		 const T Bx[],
+		 std::vector<I>* Cp,
+		 std::vector<I>* Ci,
+		 std::vector<T>* Cx)
+{ csrelmulcsr<I,T>(n_col,n_row,Ap,Ai,Ax,Bp,Bi,Bx,Cp,Ci,Cx); }
 
-template<class T>
-void cootocsc(const int n_row,
-	      const int n_col,
-	      const int NNZ,
-	      const int Ai[],
-	      const int Aj[],
-	      const T   Ax[],
-	      std::vector<int>* Bp,
-	      std::vector<int>* Bi,
-	      std::vector<T>*   Bx)
-{ cootocsr<T>(n_col,n_row,NNZ,Aj,Ai,Ax,Bp,Bi,Bx); }
+template<class I, class T>
+void cootocsc(const I n_row,
+	      const I n_col,
+	      const I NNZ,
+	      const I Ai[],
+	      const I Aj[],
+	      const T Ax[],
+	      std::vector<I>* Bp,
+	      std::vector<I>* Bi,
+	      std::vector<T>* Bx)
+{ cootocsr<I,T>(n_col,n_row,NNZ,Aj,Ai,Ax,Bp,Bi,Bx); }
 
 
 

Modified: trunk/Lib/sparse/sparsetools/sparsetools.i
===================================================================
--- trunk/Lib/sparse/sparsetools/sparsetools.i	2007-01-09 05:49:05 UTC (rev 2509)
+++ trunk/Lib/sparse/sparsetools/sparsetools.i	2007-01-09 11:36:44 UTC (rev 2510)
@@ -49,14 +49,10 @@
   }
   return where;
 }
+%} //end inline code
 
 
 
-
-%}
-
-
-
 /*
  * Use STL vectors for ARGOUTs
  */
@@ -76,366 +72,205 @@
 
 
 
-
+ /*
+  * make typechecks - used for overloading
+  */
 %include "typemaps.i"
 
-%typemap(typecheck) int *, const int *, int [], const int []
+%define NPY_TYPECHECK( ctype, atype )
+%typemap(typecheck) ctype *, const ctype *, ctype [], const ctype []
 {
-  $1 = (is_array($input) && PyArray_CanCastSafely(PyArray_TYPE($input),PyArray_INT)) ? 1 : 0;
+  $1 = (is_array($input) && PyArray_CanCastSafely(PyArray_TYPE($input),PyArray_##atype)) ? 1 : 0;
 };
+%enddef
 
-%typemap(typecheck) float *, const float *, float [], const float []
-{
-  $1 = (is_array($input) && PyArray_CanCastSafely(PyArray_TYPE($input),PyArray_FLOAT)) ? 1 : 0;
-};
+NPY_TYPECHECK(         int,      INT )
+NPY_TYPECHECK(        long,     LONG )
+NPY_TYPECHECK(       float,    FLOAT )
+NPY_TYPECHECK(      double,   DOUBLE )
+NPY_TYPECHECK(  npy_cfloat,   CFLOAT )
+NPY_TYPECHECK(  npy_cdouble, CDOUBLE )
 
-%typemap(typecheck) double *, const double *, double [], const double []
-{
-  $1 = (is_array($input) && PyArray_CanCastSafely(PyArray_TYPE($input),PyArray_DOUBLE)) ? 1 : 0;
-};
 
-%typemap(typecheck) long double *, const long double *, long double [], const long double []
-{
-  $1 = (is_array($input) && PyArray_CanCastSafely(PyArray_TYPE($input),PyArray_LONGDOUBLE)) ? 1 : 0;
-};
 
-%typemap(typecheck) npy_cfloat *, const npy_cfloat *, npy_cfloat [], const npy_cfloat []
-{
-  $1 = (is_array($input) && PyArray_CanCastSafely(PyArray_TYPE($input),PyArray_CFLOAT)) ? 1 : 0;
+ /*
+  * IN types
+  */
+%define I_IN_ARRAY1( ctype )
+%apply ctype * IN_ARRAY1 {
+    const ctype Ap [ ],
+    const ctype Ai [ ],
+    const ctype Aj [ ],
+    const ctype Bp [ ],
+    const ctype Bi [ ],	
+    const ctype Bj [ ],
+    const ctype offsets [ ]
 };
+%enddef
 
-%typemap(typecheck) npy_cdouble *, const npy_cdouble *, npy_cdouble [], const npy_cdouble []
-{
-  $1 = (is_array($input) && PyArray_CanCastSafely(PyArray_TYPE($input),PyArray_CDOUBLE)) ? 1 : 0;
+%define T_IN_ARRAY1( ctype )
+%apply ctype * IN_ARRAY1 {
+    const ctype Ax [ ],
+    const ctype Bx [ ],
+    const ctype Xx [ ],
+    const ctype Yx [ ]
 };
+%enddef
 
-%typemap(typecheck) npy_clongdouble *, const npy_clongdouble *, npy_clongdouble [], const npy_clongdouble []
-{
-  $1 = (is_array($input) && PyArray_CanCastSafely(PyArray_TYPE($input),PyArray_CLONGDOUBLE)) ? 1 : 0;
+%define T_IN_ARRAY2( ctype )
+%apply ctype * IN_ARRAY2 {
+  const ctype Mx    [ ],
+  const ctype diags [ ]
 };
+%enddef
 
 
+I_IN_ARRAY1( int  )
+I_IN_ARRAY1( long )
 
+T_IN_ARRAY1( int         )
+T_IN_ARRAY1( long        )
+T_IN_ARRAY1( float       )
+T_IN_ARRAY1( double      )
+T_IN_ARRAY1( npy_cfloat  )
+T_IN_ARRAY1( npy_cdouble )
 
+T_IN_ARRAY2( int         )
+T_IN_ARRAY2( long        )
+T_IN_ARRAY2( float       )
+T_IN_ARRAY2( double      )
+T_IN_ARRAY2( npy_cfloat  )
+T_IN_ARRAY2( npy_cdouble )
 
 
-/*
- * IN types
- */
-%apply int * IN_ARRAY1 {
-    const int Ap [ ],
-    const int Ai [ ],
-    const int Aj [ ],
-    const int Bp [ ],
-    const int Bi [ ],	
-    const int Bj [ ],
-    const int offsets [ ]
-};
 
-%apply float * IN_ARRAY1 {
-    const float Ax [ ],
-    const float Bx [ ],
-    const float Xx [ ],
-    const float Yx [ ]
+ /*
+  * OUT types
+  */
+%define I_ARRAY_ARGOUT( ctype, atype )
+VEC_ARRAY_ARGOUT( ctype, atype )
+%apply std::vector<ctype>* array_argout {
+    std::vector<ctype>* Ap,
+    std::vector<ctype>* Ai,
+    std::vector<ctype>* Aj,
+    std::vector<ctype>* Bp,
+    std::vector<ctype>* Bi,
+    std::vector<ctype>* Bj,
+    std::vector<ctype>* Cp,
+    std::vector<ctype>* Ci,
+    std::vector<ctype>* Cj
 };
+%enddef
 
-%apply double * IN_ARRAY1 {
-    const double Ax [ ],
-    const double Bx [ ],
-    const double Xx [ ],
-    const double Yx [ ]
+%define T_ARRAY_ARGOUT( ctype, atype )
+VEC_ARRAY_ARGOUT( ctype, atype )
+%apply std::vector<ctype>* array_argout {
+    std::vector<ctype>* Ax, 
+    std::vector<ctype>* Bx,
+    std::vector<ctype>* Cx, 
+    std::vector<ctype>* Xx,
+    std::vector<ctype>* Yx 
 };
+%enddef
 
-%apply long double * IN_ARRAY1 {
-    const long double Ax [ ],
-    const long double Bx [ ],
-    const long double Xx [ ],
-    const long double Yx [ ]
-};
 
-%apply npy_cfloat * IN_ARRAY1 {
-    const npy_cfloat Ax [ ],
-    const npy_cfloat Bx [ ],
-    const npy_cfloat Xx [ ],
-    const npy_cfloat Yx [ ]
-};
 
-%apply npy_cdouble * IN_ARRAY1 {
-    const npy_cdouble Ax [ ],
-    const npy_cdouble Bx [ ],
-    const npy_cdouble Xx [ ],
-    const npy_cdouble Yx [ ]
-};
+I_ARRAY_ARGOUT( int,   INT)
+I_ARRAY_ARGOUT( long, LONG)
 
-%apply npy_clongdouble * IN_ARRAY1 {
-    const npy_clongdouble Ax [ ],
-    const npy_clongdouble Bx [ ],
-    const npy_clongdouble Xx [ ],
-    const npy_clongdouble Yx [ ]
-};
+T_ARRAY_ARGOUT( int,         INT     )
+T_ARRAY_ARGOUT( long,        LONG    )
+T_ARRAY_ARGOUT( float,       FLOAT   )
+T_ARRAY_ARGOUT( double,      DOUBLE  )
+T_ARRAY_ARGOUT( npy_cfloat,  CFLOAT  )
+T_ARRAY_ARGOUT( npy_cdouble, CDOUBLE )
 
 
-%apply float * IN_ARRAY2 { const float Mx[] }
-%apply double * IN_ARRAY2 { const double Mx[] }
-%apply long double * IN_ARRAY2 { const long double Mx[] }
-%apply npy_cfloat * IN_ARRAY2 { const npy_cfloat Mx[] }
-%apply npy_cdouble * IN_ARRAY2 { const npy_cdouble Mx[] }
-%apply npy_clongdouble * IN_ARRAY2 { const npy_longdouble Mx[] }
 
-
-%apply float * IN_ARRAY2 { const float diags[] }
-%apply double * IN_ARRAY2 { const double diags[] }
-%apply long double * IN_ARRAY2 { const long double diags[] }
-%apply npy_cfloat * IN_ARRAY2 { const npy_cfloat diags[] }
-%apply npy_cdouble * IN_ARRAY2 { const npy_cdouble diags[] }
-%apply npy_clongdouble * IN_ARRAY2 { const npy_longdouble diags[] }
-
-
-
-/*
- * OUT types
- */
-VEC_ARRAY_ARGOUT( int, INT )
-%apply std::vector<int>* array_argout {
-    std::vector<int>* Ap,
-    std::vector<int>* Ai,
-    std::vector<int>* Aj,
-    std::vector<int>* Bp,
-    std::vector<int>* Bi,
-    std::vector<int>* Bj,
-    std::vector<int>* Cp,
-    std::vector<int>* Ci,
-    std::vector<int>* Cj
+ /*
+  * INOUT types
+  */
+%define T_INPLACE_ARRAY2( ctype )
+%apply ctype * INPLACE_ARRAY2 {
+  ctype Mx [ ]
 };
+%enddef
 
-VEC_ARRAY_ARGOUT( float, FLOAT )
-%apply std::vector<float>* array_argout {
-    std::vector<float>* Ax,
-    std::vector<float>* Bx,
-    std::vector<float>* Cx,
-    std::vector<float>* Xx,
-    std::vector<float>* Yx
-};
+T_INPLACE_ARRAY2( int         )
+T_INPLACE_ARRAY2( long        )
+T_INPLACE_ARRAY2( float       )
+T_INPLACE_ARRAY2( double      )
+T_INPLACE_ARRAY2( npy_cfloat  )
+T_INPLACE_ARRAY2( npy_cdouble )
 
-VEC_ARRAY_ARGOUT( double, DOUBLE )
-%apply std::vector<double>* array_argout {
-    std::vector<double>* Ax,
-    std::vector<double>* Bx,
-    std::vector<double>* Cx,
-    std::vector<double>* Xx,
-    std::vector<double>* Yx
-};
 
 
-VEC_ARRAY_ARGOUT( long double, LONGDOUBLE )
-%apply std::vector<long double>* array_argout {
-    std::vector<long double>* Ax,
-    std::vector<long double>* Bx,
-    std::vector<long double>* Cx,
-    std::vector<long double>* Xx,
-    std::vector<long double>* Yx
-};
 
-VEC_ARRAY_ARGOUT( npy_cfloat, CFLOAT )
-%apply std::vector<npy_cfloat>* array_argout {
-    std::vector<npy_cfloat>* Ax,
-    std::vector<npy_cfloat>* Bx,
-    std::vector<npy_cfloat>* Cx,
-    std::vector<npy_cfloat>* Xx,
-    std::vector<npy_cfloat>* Yx
-};
 
 
-VEC_ARRAY_ARGOUT( npy_cdouble, CDOUBLE )
-%apply std::vector<npy_cdouble>* array_argout {
-    std::vector<npy_cdouble>* Ax,
-    std::vector<npy_cdouble>* Bx,
-    std::vector<npy_cdouble>* Cx,
-    std::vector<npy_cdouble>* Xx,
-    std::vector<npy_cdouble>* Yx
-};
-
-
-VEC_ARRAY_ARGOUT( npy_clongdouble, CLONGDOUBLE )
-%apply std::vector<npy_clongdouble>* array_argout {
-    std::vector<npy_clongdouble>* Ax,
-    std::vector<npy_clongdouble>* Bx,
-    std::vector<npy_clongdouble>* Cx,
-    std::vector<npy_clongdouble>* Xx,
-    std::vector<npy_clongdouble>* Yx
-};
-
-
-
-/*
- * INOUT types
- */
-%apply float * INPLACE_ARRAY2 { float Mx [] }
-%apply double * INPLACE_ARRAY2 { double Mx [] }
-%apply long double * INPLACE_ARRAY2 { long double Mx[] }
-%apply npy_cfloat * INPLACE_ARRAY2 { npy_cfloat Mx[] }
-%apply npy_cdouble * INPLACE_ARRAY2 { npy_cdouble Mx[] }
-%apply npy_clongdouble * INPLACE_ARRAY2 { npy_longdouble Mx[] }
-
-
-
-
-
-
 %include "sparsetools.h"
+ /*
+  * Order may be important here, list float before npy_float64, scalar before complex
+  */
 
+%define INSTANTIATE_ALL( f_name )		     
+%template(f_name)   f_name<int,int>;
+%template(f_name)   f_name<int,long>;
+%template(f_name)   f_name<int,float>;
+%template(f_name)   f_name<int,double>;
+%template(f_name)   f_name<int,npy_cfloat>;
+%template(f_name)   f_name<int,npy_cdouble>;
+/* 64-bit indices would go here */
+%enddef
 
 
- /*
-  * Order may be important here, list float before double
-  */
 
 /*
  *  CSR->CSC or CSC->CSR or CSR = CSR^T or CSC = CSC^T
  */
-%template(csrtocsc)   csrtocsc<float>; 
-%template(csrtocsc)   csrtocsc<double>; 
-%template(csrtocsc)   csrtocsc<long double>; 
-%template(csrtocsc)   csrtocsc<npy_cfloat>; 
-%template(csrtocsc)   csrtocsc<npy_cdouble>; 
-%template(csrtocsc)   csrtocsc<npy_clongdouble>; 
+INSTANTIATE_ALL(csrtocsc)
+INSTANTIATE_ALL(csctocsr)
 
-%template(csctocsr)   csctocsr<float>; 
-%template(csctocsr)   csctocsr<double>; 
-%template(csctocsr)   csctocsr<long double>; 
-%template(csctocsr)   csctocsr<npy_cfloat>; 
-%template(csctocsr)   csctocsr<npy_cdouble>; 
-%template(csctocsr)   csctocsr<npy_clongdouble>; 
-
-
 /*
  * CSR<->COO and CSC<->COO
  */
-%template(csrtocoo)   csrtocoo<float>; 
-%template(csrtocoo)   csrtocoo<double>; 
-%template(csrtocoo)   csrtocoo<long double>; 
-%template(csrtocoo)   csrtocoo<npy_cfloat>; 
-%template(csrtocoo)   csrtocoo<npy_cdouble>; 
-%template(csrtocoo)   csrtocoo<npy_clongdouble>; 
+INSTANTIATE_ALL(csrtocoo)
+INSTANTIATE_ALL(csctocoo)
+INSTANTIATE_ALL(cootocsr)
+INSTANTIATE_ALL(cootocsc)
 
-%template(cootocsr)   cootocsr<float>; 
-%template(cootocsr)   cootocsr<double>; 
-%template(cootocsr)   cootocsr<long double>; 
-%template(cootocsr)   cootocsr<npy_cfloat>; 
-%template(cootocsr)   cootocsr<npy_cdouble>; 
-%template(cootocsr)   cootocsr<npy_clongdouble>; 
-
-%template(csctocoo)   csctocoo<float>; 
-%template(csctocoo)   csctocoo<double>; 
-%template(csctocoo)   csctocoo<long double>; 
-%template(csctocoo)   csctocoo<npy_cfloat>; 
-%template(csctocoo)   csctocoo<npy_cdouble>; 
-%template(csctocoo)   csctocoo<npy_clongdouble>; 
-
-%template(cootocsc)   cootocsc<float>; 
-%template(cootocsc)   cootocsc<double>; 
-%template(cootocsc)   cootocsc<long double>; 
-%template(cootocsc)   cootocsc<npy_cfloat>; 
-%template(cootocsc)   cootocsc<npy_cdouble>; 
-%template(cootocsc)   cootocsc<npy_clongdouble>; 
-
-
 /*
  * CSR+CSR and CSC+CSC
  */
-%template(csrplcsr)   csrplcsr<float>; 
-%template(csrplcsr)   csrplcsr<double>; 
-%template(csrplcsr)   csrplcsr<long double>; 
-%template(csrplcsr)   csrplcsr<npy_cfloat>; 
-%template(csrplcsr)   csrplcsr<npy_cdouble>; 
-%template(csrplcsr)   csrplcsr<npy_clongdouble>; 
+INSTANTIATE_ALL(csrplcsr)
+INSTANTIATE_ALL(cscplcsc)
 
-%template(cscplcsc)   cscplcsc<float>; 
-%template(cscplcsc)   cscplcsc<double>; 
-%template(cscplcsc)   cscplcsc<long double>; 
-%template(cscplcsc)   cscplcsc<npy_cfloat>; 
-%template(cscplcsc)   cscplcsc<npy_cdouble>; 
-%template(cscplcsc)   cscplcsc<npy_clongdouble>; 
-
-
-
 /*
  * CSR*CSR and CSC*CSC
  */
-%template(csrmucsr)   csrmucsr<float>; 
-%template(csrmucsr)   csrmucsr<double>; 
-%template(csrmucsr)   csrmucsr<long double>; 
-%template(csrmucsr)   csrmucsr<npy_cfloat>; 
-%template(csrmucsr)   csrmucsr<npy_cdouble>; 
-%template(csrmucsr)   csrmucsr<npy_clongdouble>; 
+INSTANTIATE_ALL(csrmucsr)
+INSTANTIATE_ALL(cscmucsc)
 
-%template(cscmucsc)   cscmucsc<float>; 
-%template(cscmucsc)   cscmucsc<double>; 
-%template(cscmucsc)   cscmucsc<long double>; 
-%template(cscmucsc)   cscmucsc<npy_cfloat>; 
-%template(cscmucsc)   cscmucsc<npy_cdouble>; 
-%template(cscmucsc)   cscmucsc<npy_clongdouble>; 
-
 /*
  * CSR*x and CSC*x
  */
-%template(csrmux)   csrmux<float>; 
-%template(csrmux)   csrmux<double>; 
-%template(csrmux)   csrmux<long double>; 
-%template(csrmux)   csrmux<npy_cfloat>; 
-%template(csrmux)   csrmux<npy_cdouble>; 
-%template(csrmux)   csrmux<npy_clongdouble>; 
+INSTANTIATE_ALL(csrmux)
+INSTANTIATE_ALL(cscmux)
 
-%template(cscmux)   cscmux<float>; 
-%template(cscmux)   cscmux<double>; 
-%template(cscmux)   cscmux<long double>; 
-%template(cscmux)   cscmux<npy_cfloat>; 
-%template(cscmux)   cscmux<npy_cdouble>; 
-%template(cscmux)   cscmux<npy_clongdouble>; 
-
-
 /*
  * CSR(elmul)CSR and CSC(elmul)CSC
  */
-%template(csrelmulcsr)   csrelmulcsr<float>; 
-%template(csrelmulcsr)   csrelmulcsr<double>; 
-%template(csrelmulcsr)   csrelmulcsr<long double>; 
-%template(csrelmulcsr)   csrelmulcsr<npy_cfloat>; 
-%template(csrelmulcsr)   csrelmulcsr<npy_cdouble>; 
-%template(csrelmulcsr)   csrelmulcsr<npy_clongdouble>; 
+INSTANTIATE_ALL(csrelmulcsr)
+INSTANTIATE_ALL(cscelmulcsc)
 
-%template(cscelmulcsc)   cscelmulcsc<float>; 
-%template(cscelmulcsc)   cscelmulcsc<double>; 
-%template(cscelmulcsc)   cscelmulcsc<long double>; 
-%template(cscelmulcsc)   cscelmulcsc<npy_cfloat>; 
-%template(cscelmulcsc)   cscelmulcsc<npy_cdouble>; 
-%template(cscelmulcsc)   cscelmulcsc<npy_clongdouble>; 
 
-
 /*
  * spdiags->CSC
  */
-%template(spdiags)   spdiags<float>; 
-%template(spdiags)   spdiags<double>; 
-%template(spdiags)   spdiags<long double>; 
-%template(spdiags)   spdiags<npy_cfloat>; 
-%template(spdiags)   spdiags<npy_cdouble>; 
-%template(spdiags)   spdiags<npy_clongdouble>; 
+INSTANTIATE_ALL(spdiags)
 
-
 /*
  * CSR<->Dense
  */
-%template(csrtodense)   csrtodense<float>; 
-%template(csrtodense)   csrtodense<double>; 
-%template(csrtodense)   csrtodense<long double>; 
-%template(csrtodense)   csrtodense<npy_cfloat>; 
-%template(csrtodense)   csrtodense<npy_cdouble>; 
-%template(csrtodense)   csrtodense<npy_clongdouble>; 
-
-%template(densetocsr)   densetocsr<float>; 
-%template(densetocsr)   densetocsr<double>; 
-%template(densetocsr)   densetocsr<long double>; 
-%template(densetocsr)   densetocsr<npy_cfloat>; 
-%template(densetocsr)   densetocsr<npy_cdouble>; 
-%template(densetocsr)   densetocsr<npy_clongdouble>; 
+INSTANTIATE_ALL(csrtodense)
+INSTANTIATE_ALL(densetocsr)

Modified: trunk/Lib/sparse/sparsetools/sparsetools.py
===================================================================
--- trunk/Lib/sparse/sparsetools/sparsetools.py	2007-01-09 05:49:05 UTC (rev 2509)
+++ trunk/Lib/sparse/sparsetools/sparsetools.py	2007-01-09 11:36:44 UTC (rev 2510)
@@ -52,358 +52,348 @@
 
 def csrtocsc(*args):
   """
+    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)
+    csrtocsc(int n_row, int n_col, int Ap, int Aj, long Ax, std::vector<(int)> Bp, 
+        std::vector<(int)> Bi, std::vector<(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)
-    csrtocsc(int n_row, int n_col, int Ap, int Aj, long double Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bi, 
-        std::vector<(long double)> Bx)
     csrtocsc(int n_row, int n_col, int Ap, int Aj, npy_cfloat Ax, 
         std::vector<(int)> Bp, std::vector<(int)> Bi, 
         std::vector<(npy_cfloat)> Bx)
     csrtocsc(int n_row, int n_col, int Ap, int Aj, npy_cdouble Ax, 
         std::vector<(int)> Bp, std::vector<(int)> Bi, 
         std::vector<(npy_cdouble)> Bx)
-    csrtocsc(int n_row, int n_col, int Ap, int Aj, npy_clongdouble Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bi, 
-        std::vector<(npy_clongdouble)> Bx)
     """
   return _sparsetools.csrtocsc(*args)
 
 def csctocsr(*args):
   """
+    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)
+    csctocsr(int n_row, int n_col, int Ap, int Ai, long Ax, std::vector<(int)> Bp, 
+        std::vector<(int)> Bj, std::vector<(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)
-    csctocsr(int n_row, int n_col, int Ap, int Ai, long double Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bj, 
-        std::vector<(long double)> Bx)
     csctocsr(int n_row, int n_col, int Ap, int Ai, npy_cfloat Ax, 
         std::vector<(int)> Bp, std::vector<(int)> Bj, 
         std::vector<(npy_cfloat)> Bx)
     csctocsr(int n_row, int n_col, int Ap, int Ai, npy_cdouble Ax, 
         std::vector<(int)> Bp, std::vector<(int)> Bj, 
         std::vector<(npy_cdouble)> Bx)
-    csctocsr(int n_row, int n_col, int Ap, int Ai, npy_clongdouble Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bj, 
-        std::vector<(npy_clongdouble)> Bx)
     """
   return _sparsetools.csctocsr(*args)
 
 def csrtocoo(*args):
   """
+    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 Ax, std::vector<(int)> Bi, 
+        std::vector<(int)> Bj, std::vector<(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, long double Ax, 
-        std::vector<(int)> Bi, std::vector<(int)> Bj, 
-        std::vector<(long double)> Bx)
     csrtocoo(int n_row, int n_col, int Ap, int Aj, npy_cfloat Ax, 
         std::vector<(int)> Bi, std::vector<(int)> Bj, 
         std::vector<(npy_cfloat)> Bx)
     csrtocoo(int n_row, int n_col, int Ap, int Aj, npy_cdouble Ax, 
         std::vector<(int)> Bi, std::vector<(int)> Bj, 
         std::vector<(npy_cdouble)> Bx)
-    csrtocoo(int n_row, int n_col, int Ap, int Aj, npy_clongdouble Ax, 
-        std::vector<(int)> Bi, std::vector<(int)> Bj, 
-        std::vector<(npy_clongdouble)> Bx)
     """
   return _sparsetools.csrtocoo(*args)
 
+def csctocoo(*args):
+  """
+    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 Ax, std::vector<(int)> Bi, 
+        std::vector<(int)> Bj, std::vector<(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 Ax, 
+        std::vector<(int)> Bi, std::vector<(int)> Bj, 
+        std::vector<(npy_cfloat)> Bx)
+    csctocoo(int n_row, int n_col, int Ap, int Ai, npy_cdouble Ax, 
+        std::vector<(int)> Bi, std::vector<(int)> Bj, 
+        std::vector<(npy_cdouble)> Bx)
+    """
+  return _sparsetools.csctocoo(*args)
+
 def cootocsr(*args):
   """
+    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)
+    cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, long Ax, 
+        std::vector<(int)> Bp, std::vector<(int)> Bj, 
+        std::vector<(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)
     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)
-    cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, long double Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bj, 
-        std::vector<(long double)> Bx)
     cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cfloat Ax, 
         std::vector<(int)> Bp, std::vector<(int)> Bj, 
         std::vector<(npy_cfloat)> Bx)
     cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cdouble Ax, 
         std::vector<(int)> Bp, std::vector<(int)> Bj, 
         std::vector<(npy_cdouble)> Bx)
-    cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_clongdouble Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bj, 
-        std::vector<(npy_clongdouble)> Bx)
     """
   return _sparsetools.cootocsr(*args)
 
-def csctocoo(*args):
-  """
-    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, long double Ax, 
-        std::vector<(int)> Bi, std::vector<(int)> Bj, 
-        std::vector<(long double)> Bx)
-    csctocoo(int n_row, int n_col, int Ap, int Ai, npy_cfloat Ax, 
-        std::vector<(int)> Bi, std::vector<(int)> Bj, 
-        std::vector<(npy_cfloat)> Bx)
-    csctocoo(int n_row, int n_col, int Ap, int Ai, npy_cdouble Ax, 
-        std::vector<(int)> Bi, std::vector<(int)> Bj, 
-        std::vector<(npy_cdouble)> Bx)
-    csctocoo(int n_row, int n_col, int Ap, int Ai, npy_clongdouble Ax, 
-        std::vector<(int)> Bi, std::vector<(int)> Bj, 
-        std::vector<(npy_clongdouble)> Bx)
-    """
-  return _sparsetools.csctocoo(*args)
-
 def cootocsc(*args):
   """
+    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)
+    cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, long Ax, 
+        std::vector<(int)> Bp, std::vector<(int)> Bi, 
+        std::vector<(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)
     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)
-    cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, long double Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bi, 
-        std::vector<(long double)> Bx)
     cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cfloat Ax, 
         std::vector<(int)> Bp, std::vector<(int)> Bi, 
         std::vector<(npy_cfloat)> Bx)
     cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cdouble Ax, 
         std::vector<(int)> Bp, std::vector<(int)> Bi, 
         std::vector<(npy_cdouble)> Bx)
-    cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_clongdouble Ax, 
-        std::vector<(int)> Bp, std::vector<(int)> Bi, 
-        std::vector<(npy_clongdouble)> Bx)
     """
   return _sparsetools.cootocsc(*args)
 
 def csrplcsr(*args):
   """
+    csrplcsr(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, 
+        int Bj, int Bx, std::vector<(int)> Cp, std::vector<(int)> Cj, 
+        std::vector<(int)> Cx)
+    csrplcsr(int n_row, int n_col, int Ap, int Aj, long Ax, int Bp, 
+        int Bj, long Bx, std::vector<(int)> Cp, std::vector<(int)> Cj, 
+        std::vector<(long)> Cx)
     csrplcsr(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, 
         int Bj, float Bx, std::vector<(int)> Cp, 
         std::vector<(int)> Cj, std::vector<(float)> Cx)
     csrplcsr(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, 
         int Bj, double Bx, std::vector<(int)> Cp, 
         std::vector<(int)> Cj, std::vector<(double)> Cx)
-    csrplcsr(int n_row, int n_col, int Ap, int Aj, long double Ax, 
-        int Bp, int Bj, long double Bx, std::vector<(int)> Cp, 
-        std::vector<(int)> Cj, std::vector<(long double)> Cx)
     csrplcsr(int n_row, int n_col, int Ap, int Aj, npy_cfloat Ax, 
         int Bp, int Bj, npy_cfloat Bx, std::vector<(int)> Cp, 
         std::vector<(int)> Cj, std::vector<(npy_cfloat)> Cx)
     csrplcsr(int n_row, int n_col, int Ap, int Aj, npy_cdouble Ax, 
         int Bp, int Bj, npy_cdouble Bx, std::vector<(int)> Cp, 
         std::vector<(int)> Cj, std::vector<(npy_cdouble)> Cx)
-    csrplcsr(int n_row, int n_col, int Ap, int Aj, npy_clongdouble Ax, 
-        int Bp, int Bj, npy_clongdouble Bx, std::vector<(int)> Cp, 
-        std::vector<(int)> Cj, std::vector<(npy_clongdouble)> Cx)
     """
   return _sparsetools.csrplcsr(*args)
 
 def cscplcsc(*args):
   """
+    cscplcsc(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, 
+        int Bi, int Bx, std::vector<(int)> Cp, std::vector<(int)> Ci, 
+        std::vector<(int)> Cx)
+    cscplcsc(int n_row, int n_col, int Ap, int Ai, long Ax, int Bp, 
+        int Bi, long Bx, std::vector<(int)> Cp, std::vector<(int)> Ci, 
+        std::vector<(long)> Cx)
     cscplcsc(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, 
         int Bi, float Bx, std::vector<(int)> Cp, 
         std::vector<(int)> Ci, std::vector<(float)> Cx)
     cscplcsc(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, 
         int Bi, double Bx, std::vector<(int)> Cp, 
         std::vector<(int)> Ci, std::vector<(double)> Cx)
-    cscplcsc(int n_row, int n_col, int Ap, int Ai, long double Ax, 
-        int Bp, int Bi, long double Bx, std::vector<(int)> Cp, 
-        std::vector<(int)> Ci, std::vector<(long double)> Cx)
     cscplcsc(int n_row, int n_col, int Ap, int Ai, npy_cfloat Ax, 
         int Bp, int Bi, npy_cfloat Bx, std::vector<(int)> Cp, 
         std::vector<(int)> Ci, std::vector<(npy_cfloat)> Cx)
     cscplcsc(int n_row, int n_col, int Ap, int Ai, npy_cdouble Ax, 
         int Bp, int Bi, npy_cdouble Bx, std::vector<(int)> Cp, 
         std::vector<(int)> Ci, std::vector<(npy_cdouble)> Cx)
-    cscplcsc(int n_row, int n_col, int Ap, int Ai, npy_clongdouble Ax, 
-        int Bp, int Bi, npy_clongdouble Bx, std::vector<(int)> Cp, 
-        std::vector<(int)> Ci, std::vector<(npy_clongdouble)> Cx)
     """
   return _sparsetools.cscplcsc(*args)
 
 def csrmucsr(*args):
   """
+    csrmucsr(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, 
+        int Bj, int Bx, std::vector<(int)> Cp, std::vector<(int)> Cj, 
+        std::vector<(int)> Cx)
+    csrmucsr(int n_row, int n_col, int Ap, int Aj, long Ax, int Bp, 
+        int Bj, long Bx, std::vector<(int)> Cp, std::vector<(int)> Cj, 
+        std::vector<(long)> Cx)
     csrmucsr(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, 
         int Bj, float Bx, std::vector<(int)> Cp, 
         std::vector<(int)> Cj, std::vector<(float)> Cx)
     csrmucsr(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, 
         int Bj, double Bx, std::vector<(int)> Cp, 
         std::vector<(int)> Cj, std::vector<(double)> Cx)
-    csrmucsr(int n_row, int n_col, int Ap, int Aj, long double Ax, 
-        int Bp, int Bj, long double Bx, std::vector<(int)> Cp, 
-        std::vector<(int)> Cj, std::vector<(long double)> Cx)
     csrmucsr(int n_row, int n_col, int Ap, int Aj, npy_cfloat Ax, 
         int Bp, int Bj, npy_cfloat Bx, std::vector<(int)> Cp, 
         std::vector<(int)> Cj, std::vector<(npy_cfloat)> Cx)
     csrmucsr(int n_row, int n_col, int Ap, int Aj, npy_cdouble Ax, 
         int Bp, int Bj, npy_cdouble Bx, std::vector<(int)> Cp, 
         std::vector<(int)> Cj, std::vector<(npy_cdouble)> Cx)
-    csrmucsr(int n_row, int n_col, int Ap, int Aj, npy_clongdouble Ax, 
-        int Bp, int Bj, npy_clongdouble Bx, std::vector<(int)> Cp, 
-        std::vector<(int)> Cj, std::vector<(npy_clongdouble)> Cx)
     """
   return _sparsetools.csrmucsr(*args)
 
 def cscmucsc(*args):
   """
+    cscmucsc(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, 
+        int Bi, int Bx, std::vector<(int)> Cp, std::vector<(int)> Ci, 
+        std::vector<(int)> Cx)
+    cscmucsc(int n_row, int n_col, int Ap, int Ai, long Ax, int Bp, 
+        int Bi, long Bx, std::vector<(int)> Cp, std::vector<(int)> Ci, 
+        std::vector<(long)> Cx)
     cscmucsc(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, 
         int Bi, float Bx, std::vector<(int)> Cp, 
         std::vector<(int)> Ci, std::vector<(float)> Cx)
     cscmucsc(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, 
         int Bi, double Bx, std::vector<(int)> Cp, 
         std::vector<(int)> Ci, std::vector<(double)> Cx)
-    cscmucsc(int n_row, int n_col, int Ap, int Ai, long double Ax, 
-        int Bp, int Bi, long double Bx, std::vector<(int)> Cp, 
-        std::vector<(int)> Ci, std::vector<(long double)> Cx)
     cscmucsc(int n_row, int n_col, int Ap, int Ai, npy_cfloat Ax, 
         int Bp, int Bi, npy_cfloat Bx, std::vector<(int)> Cp, 
         std::vector<(int)> Ci, std::vector<(npy_cfloat)> Cx)
     cscmucsc(int n_row, int n_col, int Ap, int Ai, npy_cdouble Ax, 
         int Bp, int Bi, npy_cdouble Bx, std::vector<(int)> Cp, 
         std::vector<(int)> Ci, std::vector<(npy_cdouble)> Cx)
-    cscmucsc(int n_row, int n_col, int Ap, int Ai, npy_clongdouble Ax, 
-        int Bp, int Bi, npy_clongdouble Bx, std::vector<(int)> Cp, 
-        std::vector<(int)> Ci, std::vector<(npy_clongdouble)> Cx)
     """
   return _sparsetools.cscmucsc(*args)
 
 def csrmux(*args):
   """
+    csrmux(int n_row, int n_col, int Ap, int Aj, int Ax, int Xx, 
+        std::vector<(int)> Yx)
+    csrmux(int n_row, int n_col, int Ap, int Aj, long Ax, long Xx, 
+        std::vector<(long)> Yx)
     csrmux(int n_row, int n_col, int Ap, int Aj, float Ax, float Xx, 
         std::vector<(float)> Yx)
     csrmux(int n_row, int n_col, int Ap, int Aj, double Ax, double Xx, 
         std::vector<(double)> Yx)
-    csrmux(int n_row, int n_col, int Ap, int Aj, long double Ax, 
-        long double Xx, std::vector<(long double)> Yx)
     csrmux(int n_row, int n_col, int Ap, int Aj, npy_cfloat Ax, 
         npy_cfloat Xx, std::vector<(npy_cfloat)> Yx)
     csrmux(int n_row, int n_col, int Ap, int Aj, npy_cdouble Ax, 
         npy_cdouble Xx, std::vector<(npy_cdouble)> Yx)
-    csrmux(int n_row, int n_col, int Ap, int Aj, npy_clongdouble Ax, 
-        npy_clongdouble Xx, std::vector<(npy_clongdouble)> Yx)
     """
   return _sparsetools.csrmux(*args)
 
 def cscmux(*args):
   """
+    cscmux(int n_row, int n_col, int Ap, int Ai, int Ax, int Xx, 
+        std::vector<(int)> Yx)
+    cscmux(int n_row, int n_col, int Ap, int Ai, long Ax, long Xx, 
+        std::vector<(long)> Yx)
     cscmux(int n_row, int n_col, int Ap, int Ai, float Ax, float Xx, 
         std::vector<(float)> Yx)
     cscmux(int n_row, int n_col, int Ap, int Ai, double Ax, double Xx, 
         std::vector<(double)> Yx)
-    cscmux(int n_row, int n_col, int Ap, int Ai, long double Ax, 
-        long double Xx, std::vector<(long double)> Yx)
     cscmux(int n_row, int n_col, int Ap, int Ai, npy_cfloat Ax, 
         npy_cfloat Xx, std::vector<(npy_cfloat)> Yx)
     cscmux(int n_row, int n_col, int Ap, int Ai, npy_cdouble Ax, 
         npy_cdouble Xx, std::vector<(npy_cdouble)> Yx)
-    cscmux(int n_row, int n_col, int Ap, int Ai, npy_clongdouble Ax, 
-        npy_clongdouble Xx, std::vector<(npy_clongdouble)> Yx)
     """
   return _sparsetools.cscmux(*args)
 
 def csrelmulcsr(*args):
   """
+    csrelmulcsr(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, 
+        int Bj, int Bx, std::vector<(int)> Cp, std::vector<(int)> Cj, 
+        std::vector<(int)> Cx)
+    csrelmulcsr(int n_row, int n_col, int Ap, int Aj, long Ax, int Bp, 
+        int Bj, long Bx, std::vector<(int)> Cp, std::vector<(int)> Cj, 
+        std::vector<(long)> Cx)
     csrelmulcsr(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, 
         int Bj, float Bx, std::vector<(int)> Cp, 
         std::vector<(int)> Cj, std::vector<(float)> Cx)
     csrelmulcsr(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, 
         int Bj, double Bx, std::vector<(int)> Cp, 
         std::vector<(int)> Cj, std::vector<(double)> Cx)
-    csrelmulcsr(int n_row, int n_col, int Ap, int Aj, long double Ax, 
-        int Bp, int Bj, long double Bx, std::vector<(int)> Cp, 
-        std::vector<(int)> Cj, std::vector<(long double)> Cx)
     csrelmulcsr(int n_row, int n_col, int Ap, int Aj, npy_cfloat Ax, 
         int Bp, int Bj, npy_cfloat Bx, std::vector<(int)> Cp, 
         std::vector<(int)> Cj, std::vector<(npy_cfloat)> Cx)
     csrelmulcsr(int n_row, int n_col, int Ap, int Aj, npy_cdouble Ax, 
         int Bp, int Bj, npy_cdouble Bx, std::vector<(int)> Cp, 
         std::vector<(int)> Cj, std::vector<(npy_cdouble)> Cx)
-    csrelmulcsr(int n_row, int n_col, int Ap, int Aj, npy_clongdouble Ax, 
-        int Bp, int Bj, npy_clongdouble Bx, std::vector<(int)> Cp, 
-        std::vector<(int)> Cj, std::vector<(npy_clongdouble)> Cx)
     """
   return _sparsetools.csrelmulcsr(*args)
 
 def cscelmulcsc(*args):
   """
+    cscelmulcsc(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, 
+        int Bi, int Bx, std::vector<(int)> Cp, std::vector<(int)> Ci, 
+        std::vector<(int)> Cx)
+    cscelmulcsc(int n_row, int n_col, int Ap, int Ai, long Ax, int Bp, 
+        int Bi, long Bx, std::vector<(int)> Cp, std::vector<(int)> Ci, 
+        std::vector<(long)> Cx)
     cscelmulcsc(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, 
         int Bi, float Bx, std::vector<(int)> Cp, 
         std::vector<(int)> Ci, std::vector<(float)> Cx)
     cscelmulcsc(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, 
         int Bi, double Bx, std::vector<(int)> Cp, 
         std::vector<(int)> Ci, std::vector<(double)> Cx)
-    cscelmulcsc(int n_row, int n_col, int Ap, int Ai, long double Ax, 
-        int Bp, int Bi, long double Bx, std::vector<(int)> Cp, 
-        std::vector<(int)> Ci, std::vector<(long double)> Cx)
     cscelmulcsc(int n_row, int n_col, int Ap, int Ai, npy_cfloat Ax, 
         int Bp, int Bi, npy_cfloat Bx, std::vector<(int)> Cp, 
         std::vector<(int)> Ci, std::vector<(npy_cfloat)> Cx)
     cscelmulcsc(int n_row, int n_col, int Ap, int Ai, npy_cdouble Ax, 
         int Bp, int Bi, npy_cdouble Bx, std::vector<(int)> Cp, 
         std::vector<(int)> Ci, std::vector<(npy_cdouble)> Cx)
-    cscelmulcsc(int n_row, int n_col, int Ap, int Ai, npy_clongdouble Ax, 
-        int Bp, int Bi, npy_clongdouble Bx, std::vector<(int)> Cp, 
-        std::vector<(int)> Ci, std::vector<(npy_clongdouble)> Cx)
     """
   return _sparsetools.cscelmulcsc(*args)
 
 def spdiags(*args):
   """
+    spdiags(int n_row, int n_col, int n_diag, int offsets, int diags, 
+        std::vector<(int)> Ap, std::vector<(int)> Ai, 
+        std::vector<(int)> Ax)
+    spdiags(int n_row, int n_col, int n_diag, int offsets, long diags, 
+        std::vector<(int)> Ap, std::vector<(int)> Ai, 
+        std::vector<(long)> Ax)
     spdiags(int n_row, int n_col, int n_diag, int offsets, float diags, 
         std::vector<(int)> Ap, std::vector<(int)> Ai, 
         std::vector<(float)> Ax)
     spdiags(int n_row, int n_col, int n_diag, int offsets, double diags, 
         std::vector<(int)> Ap, std::vector<(int)> Ai, 
         std::vector<(double)> Ax)
-    spdiags(int n_row, int n_col, int n_diag, int offsets, long double diags, 
-        std::vector<(int)> Ap, std::vector<(int)> Ai, 
-        std::vector<(long double)> Ax)
     spdiags(int n_row, int n_col, int n_diag, int offsets, npy_cfloat diags, 
         std::vector<(int)> Ap, std::vector<(int)> Ai, 
         std::vector<(npy_cfloat)> Ax)
     spdiags(int n_row, int n_col, int n_diag, int offsets, npy_cdouble diags, 
         std::vector<(int)> Ap, std::vector<(int)> Ai, 
         std::vector<(npy_cdouble)> Ax)
-    spdiags(int n_row, int n_col, int n_diag, int offsets, npy_clongdouble diags, 
-        std::vector<(int)> Ap, std::vector<(int)> Ai, 
-        std::vector<(npy_clongdouble)> Ax)
     """
   return _sparsetools.spdiags(*args)
 
 def csrtodense(*args):
   """
+    csrtodense(int n_row, int n_col, int Ap, int Aj, int Ax, int Mx)
+    csrtodense(int n_row, int n_col, int Ap, int Aj, long Ax, long Mx)
     csrtodense(int n_row, int n_col, int Ap, int Aj, float Ax, float Mx)
     csrtodense(int n_row, int n_col, int Ap, int Aj, double Ax, double Mx)
-    csrtodense(int n_row, int n_col, int Ap, int Aj, long double Ax, 
-        long double Mx)
     csrtodense(int n_row, int n_col, int Ap, int Aj, npy_cfloat Ax, 
         npy_cfloat Mx)
     csrtodense(int n_row, int n_col, int Ap, int Aj, npy_cdouble Ax, 
         npy_cdouble Mx)
-    csrtodense(int n_row, int n_col, int Ap, int Aj, npy_clongdouble Ax, 
-        npy_clongdouble Mx)
     """
   return _sparsetools.csrtodense(*args)
 
 def densetocsr(*args):
   """
+    densetocsr(int n_row, int n_col, int Mx, std::vector<(int)> Ap, 
+        std::vector<(int)> Aj, std::vector<(int)> Ax)
+    densetocsr(int n_row, int n_col, long Mx, std::vector<(int)> Ap, 
+        std::vector<(int)> Aj, std::vector<(long)> Ax)
     densetocsr(int n_row, int n_col, float Mx, std::vector<(int)> Ap, 
         std::vector<(int)> Aj, std::vector<(float)> Ax)
     densetocsr(int n_row, int n_col, double Mx, std::vector<(int)> Ap, 
         std::vector<(int)> Aj, std::vector<(double)> Ax)
-    densetocsr(int n_row, int n_col, long double Mx, std::vector<(int)> Ap, 
-        std::vector<(int)> Aj, std::vector<(long double)> Ax)
     densetocsr(int n_row, int n_col, npy_cfloat Mx, std::vector<(int)> Ap, 
         std::vector<(int)> Aj, std::vector<(npy_cfloat)> Ax)
     densetocsr(int n_row, int n_col, npy_cdouble Mx, std::vector<(int)> Ap, 
         std::vector<(int)> Aj, std::vector<(npy_cdouble)> Ax)
-    densetocsr(int n_row, int n_col, npy_clongdouble Mx, std::vector<(int)> Ap, 
-        std::vector<(int)> Aj, std::vector<(npy_clongdouble)> Ax)
     """
   return _sparsetools.densetocsr(*args)
 

Modified: trunk/Lib/sparse/sparsetools/sparsetools_wrap.cxx
===================================================================
--- trunk/Lib/sparse/sparsetools/sparsetools_wrap.cxx	2007-01-09 05:49:05 UTC (rev 2509)
+++ trunk/Lib/sparse/sparsetools/sparsetools_wrap.cxx	2007-01-09 11:36:44 UTC (rev 2510)
@@ -2466,16 +2466,14 @@
 /* -------- TYPES TABLE (BEGIN) -------- */
 
 #define SWIGTYPE_p_char swig_types[0]
-#define SWIGTYPE_p_npy_clongdouble swig_types[1]
-#define SWIGTYPE_p_std__vectorTdouble_t swig_types[2]
-#define SWIGTYPE_p_std__vectorTfloat_t swig_types[3]
-#define SWIGTYPE_p_std__vectorTint_t swig_types[4]
-#define SWIGTYPE_p_std__vectorTlong_double_t swig_types[5]
-#define SWIGTYPE_p_std__vectorTnpy_cdouble_t swig_types[6]
-#define SWIGTYPE_p_std__vectorTnpy_cfloat_t swig_types[7]
-#define SWIGTYPE_p_std__vectorTnpy_clongdouble_t swig_types[8]
-static swig_type_info *swig_types[10];
-static swig_module_info swig_module = {swig_types, 9, 0, 0, 0, 0};
+#define SWIGTYPE_p_std__vectorTdouble_t swig_types[1]
+#define SWIGTYPE_p_std__vectorTfloat_t swig_types[2]
+#define SWIGTYPE_p_std__vectorTint_t swig_types[3]
+#define SWIGTYPE_p_std__vectorTlong_t swig_types[4]
+#define SWIGTYPE_p_std__vectorTnpy_cdouble_t swig_types[5]
+#define SWIGTYPE_p_std__vectorTnpy_cfloat_t swig_types[6]
+static swig_type_info *swig_types[8];
+static swig_module_info swig_module = {swig_types, 7, 0, 0, 0, 0};
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
 
@@ -2613,11 +2611,14 @@
 
 /* Given a Numeric typecode, return a string describing the type.
  */
-char* typecode_string(int typecode) {
-  char* type_names[20] = {"char","unsigned byte","byte","short",
-			  "unsigned short","int","unsigned int","long",
-			  "float","double","complex float","complex double",
-			  "object","ntype","unkown"};
+char* type_names[20] = {"char","unsigned byte","byte","short",
+			"unsigned short","int","unsigned int","long",
+			"float","double","complex float","complex double",
+			"object","ntype","unkown"};
+ char* typecode_string(int typecode) {
+  if(typecode < 0 || typecode > 19)
+    typecode = 19;
+
   return type_names[typecode];
 }
 
@@ -2859,10 +2860,6 @@
 }
 
 
-
-
-
-
 #include <limits.h>
 #ifndef LLONG_MIN
 # define LLONG_MIN	LONG_LONG_MIN
@@ -3018,10 +3015,10 @@
   int arg2 ;
   int *arg3 ;
   int *arg4 ;
-  float *arg5 ;
+  int *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 ;
+  std::vector<int > *arg8 = (std::vector<int > *) 0 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -3034,7 +3031,7 @@
   int is_new_object5 ;
   std::vector<int > *tmp6 ;
   std::vector<int > *tmp7 ;
-  std::vector<float > *tmp8 ;
+  std::vector<int > *tmp8 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
@@ -3050,7 +3047,7 @@
     arg7 = tmp7; 
   }
   {
-    tmp8 = new std::vector<float>(); 
+    tmp8 = new std::vector<int>(); 
     arg8 = tmp8; 
   }
   if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
@@ -3084,11 +3081,11 @@
     npy_intp size[1] = {
       -1
     };
-    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_FLOAT, &is_new_object5);
+    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_INT, &is_new_object5);
     if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1)) SWIG_fail;
-    arg5 = (float*) array5->data;
+    arg5 = (int*) array5->data;
   }
-  csrtocsc<float >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6,arg7,arg8);
+  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(); 
@@ -3106,8 +3103,8 @@
   }
   {
     int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length, PyArray_FLOAT); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(float)*length);	 
+    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 ); 
   }
@@ -3141,10 +3138,10 @@
   int arg2 ;
   int *arg3 ;
   int *arg4 ;
-  double *arg5 ;
+  long *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 ;
+  std::vector<long > *arg8 = (std::vector<long > *) 0 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -3157,7 +3154,7 @@
   int is_new_object5 ;
   std::vector<int > *tmp6 ;
   std::vector<int > *tmp7 ;
-  std::vector<double > *tmp8 ;
+  std::vector<long > *tmp8 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
@@ -3173,7 +3170,7 @@
     arg7 = tmp7; 
   }
   {
-    tmp8 = new std::vector<double>(); 
+    tmp8 = new std::vector<long>(); 
     arg8 = tmp8; 
   }
   if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
@@ -3207,11 +3204,11 @@
     npy_intp size[1] = {
       -1
     };
-    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_DOUBLE, &is_new_object5);
+    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_LONG, &is_new_object5);
     if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1)) SWIG_fail;
-    arg5 = (double*) array5->data;
+    arg5 = (long*) array5->data;
   }
-  csrtocsc<double >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6,arg7,arg8);
+  csrtocsc<int,long >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long const (*))arg5,arg6,arg7,arg8);
   resultobj = SWIG_Py_Void();
   {
     int length = (arg6)->size(); 
@@ -3229,8 +3226,8 @@
   }
   {
     int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length, PyArray_DOUBLE); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(double)*length);	 
+    PyObject *obj = PyArray_FromDims(1, &length, PyArray_LONG); 
+    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(long)*length);	 
     delete arg8; 
     resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
   }
@@ -3264,10 +3261,10 @@
   int arg2 ;
   int *arg3 ;
   int *arg4 ;
-  long double *arg5 ;
+  float *arg5 ;
   std::vector<int > *arg6 = (std::vector<int > *) 0 ;
   std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<long double > *arg8 = (std::vector<long double > *) 0 ;
+  std::vector<float > *arg8 = (std::vector<float > *) 0 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -3280,7 +3277,7 @@
   int is_new_object5 ;
   std::vector<int > *tmp6 ;
   std::vector<int > *tmp7 ;
-  std::vector<long double > *tmp8 ;
+  std::vector<float > *tmp8 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
@@ -3296,7 +3293,7 @@
     arg7 = tmp7; 
   }
   {
-    tmp8 = new std::vector<long double>(); 
+    tmp8 = new std::vector<float>(); 
     arg8 = tmp8; 
   }
   if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
@@ -3330,11 +3327,11 @@
     npy_intp size[1] = {
       -1
     };
-    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_LONGDOUBLE, &is_new_object5);
+    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_FLOAT, &is_new_object5);
     if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1)) SWIG_fail;
-    arg5 = (long double*) array5->data;
+    arg5 = (float*) array5->data;
   }
-  csrtocsc<long double >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long double const (*))arg5,arg6,arg7,arg8);
+  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(); 
@@ -3352,8 +3349,8 @@
   }
   {
     int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length, PyArray_LONGDOUBLE); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(long double)*length);	 
+    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 ); 
   }
@@ -3387,10 +3384,10 @@
   int arg2 ;
   int *arg3 ;
   int *arg4 ;
-  npy_cfloat *arg5 ;
+  double *arg5 ;
   std::vector<int > *arg6 = (std::vector<int > *) 0 ;
   std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<npy_cfloat > *arg8 = (std::vector<npy_cfloat > *) 0 ;
+  std::vector<double > *arg8 = (std::vector<double > *) 0 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -3403,7 +3400,7 @@
   int is_new_object5 ;
   std::vector<int > *tmp6 ;
   std::vector<int > *tmp7 ;
-  std::vector<npy_cfloat > *tmp8 ;
+  std::vector<double > *tmp8 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
@@ -3419,7 +3416,7 @@
     arg7 = tmp7; 
   }
   {
-    tmp8 = new std::vector<npy_cfloat>(); 
+    tmp8 = new std::vector<double>(); 
     arg8 = tmp8; 
   }
   if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
@@ -3453,11 +3450,11 @@
     npy_intp size[1] = {
       -1
     };
-    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_CFLOAT, &is_new_object5);
+    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_DOUBLE, &is_new_object5);
     if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1)) SWIG_fail;
-    arg5 = (npy_cfloat*) array5->data;
+    arg5 = (double*) array5->data;
   }
-  csrtocsc<npy_cfloat >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat const (*))arg5,arg6,arg7,arg8);
+  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(); 
@@ -3475,8 +3472,8 @@
   }
   {
     int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length, PyArray_CFLOAT); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(npy_cfloat)*length);	 
+    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 ); 
   }
@@ -3510,10 +3507,10 @@
   int arg2 ;
   int *arg3 ;
   int *arg4 ;
-  npy_cdouble *arg5 ;
+  npy_cfloat *arg5 ;
   std::vector<int > *arg6 = (std::vector<int > *) 0 ;
   std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<npy_cdouble > *arg8 = (std::vector<npy_cdouble > *) 0 ;
+  std::vector<npy_cfloat > *arg8 = (std::vector<npy_cfloat > *) 0 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -3526,7 +3523,7 @@
   int is_new_object5 ;
   std::vector<int > *tmp6 ;
   std::vector<int > *tmp7 ;
-  std::vector<npy_cdouble > *tmp8 ;
+  std::vector<npy_cfloat > *tmp8 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
@@ -3542,7 +3539,7 @@
     arg7 = tmp7; 
   }
   {
-    tmp8 = new std::vector<npy_cdouble>(); 
+    tmp8 = new std::vector<npy_cfloat>(); 
     arg8 = tmp8; 
   }
   if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
@@ -3576,11 +3573,11 @@
     npy_intp size[1] = {
       -1
     };
-    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_CDOUBLE, &is_new_object5);
+    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_CFLOAT, &is_new_object5);
     if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1)) SWIG_fail;
-    arg5 = (npy_cdouble*) array5->data;
+    arg5 = (npy_cfloat*) array5->data;
   }
-  csrtocsc<npy_cdouble >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble const (*))arg5,arg6,arg7,arg8);
+  csrtocsc<int,npy_cfloat >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat const (*))arg5,arg6,arg7,arg8);
   resultobj = SWIG_Py_Void();
   {
     int length = (arg6)->size(); 
@@ -3598,8 +3595,8 @@
   }
   {
     int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length, PyArray_CDOUBLE); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(npy_cdouble)*length);	 
+    PyObject *obj = PyArray_FromDims(1, &length, PyArray_CFLOAT); 
+    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(npy_cfloat)*length);	 
     delete arg8; 
     resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
   }
@@ -3633,10 +3630,10 @@
   int arg2 ;
   int *arg3 ;
   int *arg4 ;
-  npy_clongdouble *arg5 ;
+  npy_cdouble *arg5 ;
   std::vector<int > *arg6 = (std::vector<int > *) 0 ;
   std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<npy_clongdouble > *arg8 = (std::vector<npy_clongdouble > *) 0 ;
+  std::vector<npy_cdouble > *arg8 = (std::vector<npy_cdouble > *) 0 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -3649,7 +3646,7 @@
   int is_new_object5 ;
   std::vector<int > *tmp6 ;
   std::vector<int > *tmp7 ;
-  std::vector<npy_clongdouble > *tmp8 ;
+  std::vector<npy_cdouble > *tmp8 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
@@ -3665,7 +3662,7 @@
     arg7 = tmp7; 
   }
   {
-    tmp8 = new std::vector<npy_clongdouble>(); 
+    tmp8 = new std::vector<npy_cdouble>(); 
     arg8 = tmp8; 
   }
   if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
@@ -3699,11 +3696,11 @@
     npy_intp size[1] = {
       -1
     };
-    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_CLONGDOUBLE, &is_new_object5);
+    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_CDOUBLE, &is_new_object5);
     if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1)) SWIG_fail;
-    arg5 = (npy_clongdouble*) array5->data;
+    arg5 = (npy_cdouble*) array5->data;
   }
-  csrtocsc<npy_clongdouble >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_clongdouble const (*))arg5,arg6,arg7,arg8);
+  csrtocsc<int,npy_cdouble >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble const (*))arg5,arg6,arg7,arg8);
   resultobj = SWIG_Py_Void();
   {
     int length = (arg6)->size(); 
@@ -3721,8 +3718,8 @@
   }
   {
     int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length, PyArray_CLONGDOUBLE); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(npy_clongdouble)*length);	 
+    PyObject *obj = PyArray_FromDims(1, &length, PyArray_CDOUBLE); 
+    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(npy_cdouble)*length);	 
     delete arg8; 
     resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
   }
@@ -3781,7 +3778,7 @@
           }
           if (_v) {
             {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0;
+              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0;
             }
             if (_v) {
               return _wrap_csrtocsc__SWIG_1(self, args);
@@ -3812,7 +3809,7 @@
           }
           if (_v) {
             {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0;
+              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_LONG)) ? 1 : 0;
             }
             if (_v) {
               return _wrap_csrtocsc__SWIG_2(self, args);
@@ -3843,7 +3840,7 @@
           }
           if (_v) {
             {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_LONGDOUBLE)) ? 1 : 0;
+              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0;
             }
             if (_v) {
               return _wrap_csrtocsc__SWIG_3(self, args);
@@ -3874,7 +3871,7 @@
           }
           if (_v) {
             {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CFLOAT)) ? 1 : 0;
+              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0;
             }
             if (_v) {
               return _wrap_csrtocsc__SWIG_4(self, args);
@@ -3905,7 +3902,7 @@
           }
           if (_v) {
             {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CDOUBLE)) ? 1 : 0;
+              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CFLOAT)) ? 1 : 0;
             }
             if (_v) {
               return _wrap_csrtocsc__SWIG_5(self, args);
@@ -3936,7 +3933,7 @@
           }
           if (_v) {
             {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CLONGDOUBLE)) ? 1 : 0;
+              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CDOUBLE)) ? 1 : 0;
             }
             if (_v) {
               return _wrap_csrtocsc__SWIG_6(self, args);
@@ -3948,7 +3945,7 @@
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csrtocsc'.\n  Possible C/C++ prototypes are:\n    csrtocsc<(float)>(int const,int const,int const [],int const [],float const [],std::vector<int > *,std::vector<int > *,std::vector<float > *)\n    csrtocsc<(double)>(int const,int const,int const [],int const [],double const [],std::vector<int > *,std::vector<int > *,std::vector<double > *)\n    csrtocsc<(long double)>(int const,int const,int const [],int const [],long double const [],std::vector<int > *,std::vector<int > *,std::vector<long double > *)\n    csrtocsc<(npy_cfloat)>(int const,int const,int const [],int const [],npy_cfloat const [],std::vector<int > *,std::vector<int > *,std::vector<npy_cfloat > *)\n    csrtocsc<(npy_cdouble)>(int const,int const,int const [],int const [],npy_cdouble const [],std::vector<int > *,std::vector<int > *,std::vector<npy_cdouble > *)\n    csrtocsc<(npy_clongdouble)>(int const,int const,int const [],int const [],npy_clongdouble const [],std::vector<int > *,std::vector<int > *,std::vector<npy_clongdouble > *)\n");
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csrtocsc'.\n  Possible C/C++ prototypes are:\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)>(int const,int const,int const [],int const [],long const [],std::vector<int > *,std::vector<int > *,std::vector<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)>(int const,int const,int const [],int const [],npy_cfloat const [],std::vector<int > *,std::vector<int > *,std::vector<npy_cfloat > *)\n    csrtocsc<(int,npy_cdouble)>(int const,int const,int const [],int const [],npy_cdouble const [],std::vector<int > *,std::vector<int > *,std::vector<npy_cdouble > *)\n");
   return NULL;
 }
 
@@ -3959,10 +3956,10 @@
   int arg2 ;
   int *arg3 ;
   int *arg4 ;
-  float *arg5 ;
+  int *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 ;
+  std::vector<int > *arg8 = (std::vector<int > *) 0 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -3975,7 +3972,7 @@
   int is_new_object5 ;
   std::vector<int > *tmp6 ;
   std::vector<int > *tmp7 ;
-  std::vector<float > *tmp8 ;
+  std::vector<int > *tmp8 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
@@ -3991,7 +3988,7 @@
     arg7 = tmp7; 
   }
   {
-    tmp8 = new std::vector<float>(); 
+    tmp8 = new std::vector<int>(); 
     arg8 = tmp8; 
   }
   if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
@@ -4025,11 +4022,11 @@
     npy_intp size[1] = {
       -1
     };
-    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_FLOAT, &is_new_object5);
+    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_INT, &is_new_object5);
     if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1)) SWIG_fail;
-    arg5 = (float*) array5->data;
+    arg5 = (int*) array5->data;
   }
-  csctocsr<float >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6,arg7,arg8);
+  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(); 
@@ -4047,8 +4044,8 @@
   }
   {
     int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length, PyArray_FLOAT); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(float)*length);	 
+    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 ); 
   }
@@ -4082,10 +4079,10 @@
   int arg2 ;
   int *arg3 ;
   int *arg4 ;
-  double *arg5 ;
+  long *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 ;
+  std::vector<long > *arg8 = (std::vector<long > *) 0 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -4098,7 +4095,7 @@
   int is_new_object5 ;
   std::vector<int > *tmp6 ;
   std::vector<int > *tmp7 ;
-  std::vector<double > *tmp8 ;
+  std::vector<long > *tmp8 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
@@ -4114,7 +4111,7 @@
     arg7 = tmp7; 
   }
   {
-    tmp8 = new std::vector<double>(); 
+    tmp8 = new std::vector<long>(); 
     arg8 = tmp8; 
   }
   if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
@@ -4148,11 +4145,11 @@
     npy_intp size[1] = {
       -1
     };
-    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_DOUBLE, &is_new_object5);
+    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_LONG, &is_new_object5);
     if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1)) SWIG_fail;
-    arg5 = (double*) array5->data;
+    arg5 = (long*) array5->data;
   }
-  csctocsr<double >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6,arg7,arg8);
+  csctocsr<int,long >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long const (*))arg5,arg6,arg7,arg8);
   resultobj = SWIG_Py_Void();
   {
     int length = (arg6)->size(); 
@@ -4170,8 +4167,8 @@
   }
   {
     int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length, PyArray_DOUBLE); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(double)*length);	 
+    PyObject *obj = PyArray_FromDims(1, &length, PyArray_LONG); 
+    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(long)*length);	 
     delete arg8; 
     resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
   }
@@ -4205,10 +4202,10 @@
   int arg2 ;
   int *arg3 ;
   int *arg4 ;
-  long double *arg5 ;
+  float *arg5 ;
   std::vector<int > *arg6 = (std::vector<int > *) 0 ;
   std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<long double > *arg8 = (std::vector<long double > *) 0 ;
+  std::vector<float > *arg8 = (std::vector<float > *) 0 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -4221,7 +4218,7 @@
   int is_new_object5 ;
   std::vector<int > *tmp6 ;
   std::vector<int > *tmp7 ;
-  std::vector<long double > *tmp8 ;
+  std::vector<float > *tmp8 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
@@ -4237,7 +4234,7 @@
     arg7 = tmp7; 
   }
   {
-    tmp8 = new std::vector<long double>(); 
+    tmp8 = new std::vector<float>(); 
     arg8 = tmp8; 
   }
   if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
@@ -4271,11 +4268,11 @@
     npy_intp size[1] = {
       -1
     };
-    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_LONGDOUBLE, &is_new_object5);
+    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_FLOAT, &is_new_object5);
     if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1)) SWIG_fail;
-    arg5 = (long double*) array5->data;
+    arg5 = (float*) array5->data;
   }
-  csctocsr<long double >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long double const (*))arg5,arg6,arg7,arg8);
+  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(); 
@@ -4293,8 +4290,8 @@
   }
   {
     int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length, PyArray_LONGDOUBLE); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(long double)*length);	 
+    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 ); 
   }
@@ -4328,10 +4325,10 @@
   int arg2 ;
   int *arg3 ;
   int *arg4 ;
-  npy_cfloat *arg5 ;
+  double *arg5 ;
   std::vector<int > *arg6 = (std::vector<int > *) 0 ;
   std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<npy_cfloat > *arg8 = (std::vector<npy_cfloat > *) 0 ;
+  std::vector<double > *arg8 = (std::vector<double > *) 0 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -4344,7 +4341,7 @@
   int is_new_object5 ;
   std::vector<int > *tmp6 ;
   std::vector<int > *tmp7 ;
-  std::vector<npy_cfloat > *tmp8 ;
+  std::vector<double > *tmp8 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
@@ -4360,7 +4357,7 @@
     arg7 = tmp7; 
   }
   {
-    tmp8 = new std::vector<npy_cfloat>(); 
+    tmp8 = new std::vector<double>(); 
     arg8 = tmp8; 
   }
   if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
@@ -4394,11 +4391,11 @@
     npy_intp size[1] = {
       -1
     };
-    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_CFLOAT, &is_new_object5);
+    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_DOUBLE, &is_new_object5);
     if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1)) SWIG_fail;
-    arg5 = (npy_cfloat*) array5->data;
+    arg5 = (double*) array5->data;
   }
-  csctocsr<npy_cfloat >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat const (*))arg5,arg6,arg7,arg8);
+  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(); 
@@ -4416,8 +4413,8 @@
   }
   {
     int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length, PyArray_CFLOAT); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(npy_cfloat)*length);	 
+    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 ); 
   }
@@ -4451,10 +4448,10 @@
   int arg2 ;
   int *arg3 ;
   int *arg4 ;
-  npy_cdouble *arg5 ;
+  npy_cfloat *arg5 ;
   std::vector<int > *arg6 = (std::vector<int > *) 0 ;
   std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<npy_cdouble > *arg8 = (std::vector<npy_cdouble > *) 0 ;
+  std::vector<npy_cfloat > *arg8 = (std::vector<npy_cfloat > *) 0 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -4467,7 +4464,7 @@
   int is_new_object5 ;
   std::vector<int > *tmp6 ;
   std::vector<int > *tmp7 ;
-  std::vector<npy_cdouble > *tmp8 ;
+  std::vector<npy_cfloat > *tmp8 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
@@ -4483,7 +4480,7 @@
     arg7 = tmp7; 
   }
   {
-    tmp8 = new std::vector<npy_cdouble>(); 
+    tmp8 = new std::vector<npy_cfloat>(); 
     arg8 = tmp8; 
   }
   if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
@@ -4517,11 +4514,11 @@
     npy_intp size[1] = {
       -1
     };
-    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_CDOUBLE, &is_new_object5);
+    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_CFLOAT, &is_new_object5);
     if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1)) SWIG_fail;
-    arg5 = (npy_cdouble*) array5->data;
+    arg5 = (npy_cfloat*) array5->data;
   }
-  csctocsr<npy_cdouble >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble const (*))arg5,arg6,arg7,arg8);
+  csctocsr<int,npy_cfloat >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat const (*))arg5,arg6,arg7,arg8);
   resultobj = SWIG_Py_Void();
   {
     int length = (arg6)->size(); 
@@ -4539,8 +4536,8 @@
   }
   {
     int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length, PyArray_CDOUBLE); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(npy_cdouble)*length);	 
+    PyObject *obj = PyArray_FromDims(1, &length, PyArray_CFLOAT); 
+    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(npy_cfloat)*length);	 
     delete arg8; 
     resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
   }
@@ -4574,10 +4571,10 @@
   int arg2 ;
   int *arg3 ;
   int *arg4 ;
-  npy_clongdouble *arg5 ;
+  npy_cdouble *arg5 ;
   std::vector<int > *arg6 = (std::vector<int > *) 0 ;
   std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<npy_clongdouble > *arg8 = (std::vector<npy_clongdouble > *) 0 ;
+  std::vector<npy_cdouble > *arg8 = (std::vector<npy_cdouble > *) 0 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -4590,7 +4587,7 @@
   int is_new_object5 ;
   std::vector<int > *tmp6 ;
   std::vector<int > *tmp7 ;
-  std::vector<npy_clongdouble > *tmp8 ;
+  std::vector<npy_cdouble > *tmp8 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
@@ -4606,7 +4603,7 @@
     arg7 = tmp7; 
   }
   {
-    tmp8 = new std::vector<npy_clongdouble>(); 
+    tmp8 = new std::vector<npy_cdouble>(); 
     arg8 = tmp8; 
   }
   if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
@@ -4640,11 +4637,11 @@
     npy_intp size[1] = {
       -1
     };
-    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_CLONGDOUBLE, &is_new_object5);
+    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_CDOUBLE, &is_new_object5);
     if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1)) SWIG_fail;
-    arg5 = (npy_clongdouble*) array5->data;
+    arg5 = (npy_cdouble*) array5->data;
   }
-  csctocsr<npy_clongdouble >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_clongdouble const (*))arg5,arg6,arg7,arg8);
+  csctocsr<int,npy_cdouble >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble const (*))arg5,arg6,arg7,arg8);
   resultobj = SWIG_Py_Void();
   {
     int length = (arg6)->size(); 
@@ -4662,8 +4659,8 @@
   }
   {
     int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length, PyArray_CLONGDOUBLE); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(npy_clongdouble)*length);	 
+    PyObject *obj = PyArray_FromDims(1, &length, PyArray_CDOUBLE); 
+    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(npy_cdouble)*length);	 
     delete arg8; 
     resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
   }
@@ -4722,7 +4719,7 @@
           }
           if (_v) {
             {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0;
+              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0;
             }
             if (_v) {
               return _wrap_csctocsr__SWIG_1(self, args);
@@ -4753,7 +4750,7 @@
           }
           if (_v) {
             {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0;
+              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_LONG)) ? 1 : 0;
             }
             if (_v) {
               return _wrap_csctocsr__SWIG_2(self, args);
@@ -4784,7 +4781,7 @@
           }
           if (_v) {
             {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_LONGDOUBLE)) ? 1 : 0;
+              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0;
             }
             if (_v) {
               return _wrap_csctocsr__SWIG_3(self, args);
@@ -4815,7 +4812,7 @@
           }
           if (_v) {
             {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CFLOAT)) ? 1 : 0;
+              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0;
             }
             if (_v) {
               return _wrap_csctocsr__SWIG_4(self, args);
@@ -4846,7 +4843,7 @@
           }
           if (_v) {
             {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CDOUBLE)) ? 1 : 0;
+              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CFLOAT)) ? 1 : 0;
             }
             if (_v) {
               return _wrap_csctocsr__SWIG_5(self, args);
@@ -4877,7 +4874,7 @@
           }
           if (_v) {
             {
-              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CLONGDOUBLE)) ? 1 : 0;
+              _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CDOUBLE)) ? 1 : 0;
             }
             if (_v) {
               return _wrap_csctocsr__SWIG_6(self, args);
@@ -4889,7 +4886,7 @@
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csctocsr'.\n  Possible C/C++ prototypes are:\n    csctocsr<(float)>(int const,int const,int const [],int const [],float const [],std::vector<int > *,std::vector<int > *,std::vector<float > *)\n    csctocsr<(double)>(int const,int const,int const [],int const [],double const [],std::vector<int > *,std::vector<int > *,std::vector<double > *)\n    csctocsr<(long double)>(int const,int const,int const [],int const [],long double const [],std::vector<int > *,std::vector<int > *,std::vector<long double > *)\n    csctocsr<(npy_cfloat)>(int const,int const,int const [],int const [],npy_cfloat const [],std::vector<int > *,std::vector<int > *,std::vector<npy_cfloat > *)\n    csctocsr<(npy_cdouble)>(int const,int const,int const [],int const [],npy_cdouble const [],std::vector<int > *,std::vector<int > *,std::vector<npy_cdouble > *)\n    csctocsr<(npy_clongdouble)>(int const,int const,int const [],int const [],npy_clongdouble const [],std::vector<int > *,std::vector<int > *,std::vector<npy_clongdouble > *)\n");
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csctocsr'.\n  Possible C/C++ prototypes are:\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)>(int const,int const,int const [],int const [],long const [],std::vector<int > *,std::vector<int > *,std::vector<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)>(int const,int const,int const [],int const [],npy_cfloat const [],std::vector<int > *,std::vector<int > *,std::vector<npy_cfloat > *)\n    csctocsr<(int,npy_cdouble)>(int const,int const,int const [],int const [],npy_cdouble const [],std::vector<int > *,std::vector<int > *,std::vector<npy_cdouble > *)\n");
   return NULL;
 }
 
@@ -4900,10 +4897,10 @@
   int arg2 ;
   int *arg3 ;
   int *arg4 ;
-  float *arg5 ;
+  int *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 ;
+  std::vector<int > *arg8 = (std::vector<int > *) 0 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -4916,7 +4913,7 @@
   int is_new_object5 ;
   std::vector<int > *tmp6 ;
   std::vector<int > *tmp7 ;
-  std::vector<float > *tmp8 ;
+  std::vector<int > *tmp8 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
@@ -4932,7 +4929,7 @@
     arg7 = tmp7; 
   }
   {
-    tmp8 = new std::vector<float>(); 
+    tmp8 = new std::vector<int>(); 
     arg8 = tmp8; 
   }
   if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocoo",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
@@ -4966,11 +4963,11 @@
     npy_intp size[1] = {
       -1
     };
-    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_FLOAT, &is_new_object5);
+    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_INT, &is_new_object5);
     if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1)) SWIG_fail;
-    arg5 = (float*) array5->data;
+    arg5 = (int*) array5->data;
   }
-  csrtocoo<float >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6,arg7,arg8);
+  csrtocoo<int,int >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6,arg7,arg8);
   resultobj = SWIG_Py_Void();
   {
     int length = (arg6)->size(); 
@@ -4988,8 +4985,8 @@
   }
   {
     int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length, PyArray_FLOAT); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(float)*length);	 
+    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 ); 
   }
@@ -5023,10 +5020,10 @@
   int arg2 ;
   int *arg3 ;
   int *arg4 ;
-  double *arg5 ;
+  long *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 ;
+  std::vector<long > *arg8 = (std::vector<long > *) 0 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -5039,7 +5036,7 @@
   int is_new_object5 ;
   std::vector<int > *tmp6 ;
   std::vector<int > *tmp7 ;
-  std::vector<double > *tmp8 ;
+  std::vector<long > *tmp8 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
@@ -5055,7 +5052,7 @@
     arg7 = tmp7; 
   }
   {
-    tmp8 = new std::vector<double>(); 
+    tmp8 = new std::vector<long>(); 
     arg8 = tmp8; 
   }
   if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocoo",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
@@ -5089,11 +5086,11 @@
     npy_intp size[1] = {
       -1
     };
-    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_DOUBLE, &is_new_object5);
+    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_LONG, &is_new_object5);
     if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1)) SWIG_fail;
-    arg5 = (double*) array5->data;
+    arg5 = (long*) array5->data;
   }
-  csrtocoo<double >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6,arg7,arg8);
+  csrtocoo<int,long >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long const (*))arg5,arg6,arg7,arg8);
   resultobj = SWIG_Py_Void();
   {
     int length = (arg6)->size(); 
@@ -5111,8 +5108,8 @@
   }
   {
     int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length, PyArray_DOUBLE); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(double)*length);	 
+    PyObject *obj = PyArray_FromDims(1, &length, PyArray_LONG); 
+    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(long)*length);	 
     delete arg8; 
     resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); 
   }
@@ -5146,10 +5143,10 @@
   int arg2 ;
   int *arg3 ;
   int *arg4 ;
-  long double *arg5 ;
+  float *arg5 ;
   std::vector<int > *arg6 = (std::vector<int > *) 0 ;
   std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<long double > *arg8 = (std::vector<long double > *) 0 ;
+  std::vector<float > *arg8 = (std::vector<float > *) 0 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -5162,7 +5159,7 @@
   int is_new_object5 ;
   std::vector<int > *tmp6 ;
   std::vector<int > *tmp7 ;
-  std::vector<long double > *tmp8 ;
+  std::vector<float > *tmp8 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
@@ -5178,7 +5175,7 @@
     arg7 = tmp7; 
   }
   {
-    tmp8 = new std::vector<long double>(); 
+    tmp8 = new std::vector<float>(); 
     arg8 = tmp8; 
   }
   if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocoo",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
@@ -5212,11 +5209,11 @@
     npy_intp size[1] = {
       -1
     };
-    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_LONGDOUBLE, &is_new_object5);
+    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_FLOAT, &is_new_object5);
     if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1)) SWIG_fail;
-    arg5 = (long double*) array5->data;
+    arg5 = (float*) array5->data;
   }
-  csrtocoo<long double >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long double const (*))arg5,arg6,arg7,arg8);
+  csrtocoo<int,float >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6,arg7,arg8);
   resultobj = SWIG_Py_Void();
   {
     int length = (arg6)->size(); 
@@ -5234,8 +5231,8 @@
   }
   {
     int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length, PyArray_LONGDOUBLE); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(long double)*length);	 
+    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 ); 
   }
@@ -5269,10 +5266,10 @@
   int arg2 ;
   int *arg3 ;
   int *arg4 ;
-  npy_cfloat *arg5 ;
+  double *arg5 ;
   std::vector<int > *arg6 = (std::vector<int > *) 0 ;
   std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<npy_cfloat > *arg8 = (std::vector<npy_cfloat > *) 0 ;
+  std::vector<double > *arg8 = (std::vector<double > *) 0 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -5285,7 +5282,7 @@
   int is_new_object5 ;
   std::vector<int > *tmp6 ;
   std::vector<int > *tmp7 ;
-  std::vector<npy_cfloat > *tmp8 ;
+  std::vector<double > *tmp8 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
@@ -5301,7 +5298,7 @@
     arg7 = tmp7; 
   }
   {
-    tmp8 = new std::vector<npy_cfloat>(); 
+    tmp8 = new std::vector<double>(); 
     arg8 = tmp8; 
   }
   if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocoo",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
@@ -5335,11 +5332,11 @@
     npy_intp size[1] = {
       -1
     };
-    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_CFLOAT, &is_new_object5);
+    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_DOUBLE, &is_new_object5);
     if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1)) SWIG_fail;
-    arg5 = (npy_cfloat*) array5->data;
+    arg5 = (double*) array5->data;
   }
-  csrtocoo<npy_cfloat >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat const (*))arg5,arg6,arg7,arg8);
+  csrtocoo<int,double >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6,arg7,arg8);
   resultobj = SWIG_Py_Void();
   {
     int length = (arg6)->size(); 
@@ -5357,8 +5354,8 @@
   }
   {
     int length = (arg8)->size(); 
-    PyObject *obj = PyArray_FromDims(1, &length, PyArray_CFLOAT); 
-    memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(npy_cfloat)*length);	 
+    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 ); 
   }
@@ -5392,10 +5389,10 @@
   int arg2 ;
   int *arg3 ;
   int *arg4 ;
-  npy_cdouble *arg5 ;
+  npy_cfloat *arg5 ;
   std::vector<int > *arg6 = (std::vector<int > *) 0 ;
   std::vector<int > *arg7 = (std::vector<int > *) 0 ;
-  std::vector<npy_cdouble > *arg8 = (std::vector<npy_cdouble > *) 0 ;
+  std::vector<npy_cfloat > *arg8 = (std::vector<npy_cfloat > *) 0 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -5408,7 +5405,7 @@
   int is_new_object5 ;
   std::vector<int > *tmp6 ;
   std::vector<int > *tmp7 ;
-  std::vector<npy_cdouble > *tmp8 ;
+  std::vector<npy_cfloat > *tmp8 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
@@ -5424,7 +5421,7 @@
     arg7 = tmp7; 
   }
   {
-    tmp8 = new std::vector<npy_cdouble>(); 
+    tmp8 = new std::vector<npy_cfloat>(); 
     arg8 = tmp8; 
   }
   if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocoo",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
@@ -5458,11 +5455,11 @@
     npy_intp size[1] = {
       -1
     };
-    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_CDOUBLE, &is_new_object5);
+    array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_CFLOAT, &is_new_object5);
     if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1)) SWIG_fail;
-    arg5 = (npy_cdouble*) array5->data;
+    arg5 = (npy_cfloat*) array5->data;
   }
-  csrtocoo<npy_cdouble >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble const (*))arg5,arg6,arg7,arg8);
+  csrtocoo<int,npy_cfloat >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat const (*))arg5,arg6,arg7,arg8);
   resultobj = SWIG_Py_Void();
   {
     int length = (arg6)->size(); 
@@ -5480,8 +5477,8 @@
   }
   {
     int length = (arg8