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

scipy-svn at scipy.org scipy-svn at scipy.org
Sat Oct 4 22:23:45 EDT 2008


Author: wnbell
Date: 2008-10-04 21:23:37 -0500 (Sat, 04 Oct 2008)
New Revision: 4772

Modified:
   trunk/scipy/sparse/dia.py
   trunk/scipy/sparse/sparsetools/coo.h
   trunk/scipy/sparse/sparsetools/coo.i
   trunk/scipy/sparse/sparsetools/coo.py
   trunk/scipy/sparse/sparsetools/coo_wrap.cxx
   trunk/scipy/sparse/sparsetools/csc.i
   trunk/scipy/sparse/sparsetools/csc.py
   trunk/scipy/sparse/sparsetools/csc_wrap.cxx
   trunk/scipy/sparse/sparsetools/csr.h
   trunk/scipy/sparse/sparsetools/csr.i
   trunk/scipy/sparse/sparsetools/csr.py
   trunk/scipy/sparse/sparsetools/csr_wrap.cxx
   trunk/scipy/sparse/sparsetools/dia.py
   trunk/scipy/sparse/sparsetools/dia_wrap.cxx
   trunk/scipy/sparse/sparsetools/sparsetools.i
Log:
minor additions to sparsetools


Modified: trunk/scipy/sparse/dia.py
===================================================================
--- trunk/scipy/sparse/dia.py	2008-10-05 01:54:59 UTC (rev 4771)
+++ trunk/scipy/sparse/dia.py	2008-10-05 02:23:37 UTC (rev 4772)
@@ -80,10 +80,10 @@
                     # Try interpreting it as (data, diags)
                     data, diags = arg1
                 except:
-                    raise ValueError, "unrecognized form for dia_matrix constructor"
+                    raise ValueError('unrecognized form for dia_matrix constructor')
                 else:
                     if shape is None:
-                        raise ValueError,'expected a shape argument'
+                        raise ValueError('expected a shape argument')
                     self.data  = atleast_2d(array(arg1[0],dtype=dtype,copy=copy))
                     self.diags = atleast_1d(array(arg1[1],dtype='i',copy=copy))
                     self.shape = shape
@@ -103,18 +103,18 @@
 
         #check format
         if self.diags.ndim != 1:
-            raise ValueError,'diags array must have rank 1'
+            raise ValueError('diags array must have rank 1')
 
         if self.data.ndim != 2:
-            raise ValueError,'data array must have rank 2'
+            raise ValueError('data array must have rank 2')
 
         if self.data.shape[0] != len(self.diags):
-            raise ValueError,'number of diagonals (%d) ' \
+            raise ValueError('number of diagonals (%d) ' \
                     'does not match the number of diags (%d)' \
-                    % (self.data.shape[0], len(self.diags))
+                    % (self.data.shape[0], len(self.diags)))
 
         if len(unique(self.diags)) != len(self.diags):
-            raise ValueError,'offset array contains duplicate values'
+            raise ValueError('offset array contains duplicate values')
 
     def __repr__(self):
         nnz = self.getnnz()

Modified: trunk/scipy/sparse/sparsetools/coo.h
===================================================================
--- trunk/scipy/sparse/sparsetools/coo.h	2008-10-05 01:54:59 UTC (rev 4771)
+++ trunk/scipy/sparse/sparsetools/coo.h	2008-10-05 02:23:37 UTC (rev 4772)
@@ -2,6 +2,7 @@
 #define __COO_H__
 
 #include <algorithm>
+#include <set>
 
 /*
  * Compute B = A for COO matrix A, CSR matrix B
@@ -149,4 +150,26 @@
     }
 }
 
+/*
+ * Count the number of occupied diagonals in COO matrix A
+ *
+ * Input Arguments:
+ *   I  nnz             - number of nonzeros in A
+ *   I  Ai[nnz(A)]      - row indices
+ *   I  Aj[nnz(A)]      - column indices
+ *
+ */
+template <class I>
+I coo_count_diagonals(const I nnz,
+                      const I Ai[],
+                      const I Aj[])
+{
+    std::set<I> diagonals;
+    for(I n = 0; n < nnz; n++){
+        diagonals.insert(Aj[n] - Ai[n]);
+    }
+    return diagonals.size();
+}
+
+
 #endif

Modified: trunk/scipy/sparse/sparsetools/coo.i
===================================================================
--- trunk/scipy/sparse/sparsetools/coo.i	2008-10-05 01:54:59 UTC (rev 4771)
+++ trunk/scipy/sparse/sparsetools/coo.i	2008-10-05 02:23:37 UTC (rev 4772)
@@ -14,4 +14,6 @@
 
 INSTANTIATE_ALL(coo_matvec)
 
+INSTANTIATE_INDEX(coo_count_diagonals)
 
+

Modified: trunk/scipy/sparse/sparsetools/coo.py
===================================================================
--- trunk/scipy/sparse/sparsetools/coo.py	2008-10-05 01:54:59 UTC (rev 4771)
+++ trunk/scipy/sparse/sparsetools/coo.py	2008-10-05 02:23:37 UTC (rev 4772)
@@ -1,5 +1,5 @@
 # This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.34
+# Version 1.3.36
 #
 # Don't modify this file, modify the SWIG interface instead.
 # This file is compatible with both classic and new-style classes.
@@ -49,7 +49,11 @@
 
 
 
+def coo_count_diagonals(*args):
+  """coo_count_diagonals(int nnz, int Ai, int Aj) -> int"""
+  return _coo.coo_count_diagonals(*args)
 
+
 def coo_tocsr(*args):
   """
     coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, signed char Ax, 

Modified: trunk/scipy/sparse/sparsetools/coo_wrap.cxx
===================================================================
--- trunk/scipy/sparse/sparsetools/coo_wrap.cxx	2008-10-05 01:54:59 UTC (rev 4771)
+++ trunk/scipy/sparse/sparsetools/coo_wrap.cxx	2008-10-05 02:23:37 UTC (rev 4772)
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.34
+ * Version 1.3.36
  * 
  * This file is not intended to be easily readable and contains a number of 
  * coding conventions designed to improve portability and efficiency. Do not make
@@ -73,6 +73,12 @@
 # endif
 #endif
 
+#ifndef SWIG_MSC_UNSUPPRESS_4505
+# if defined(_MSC_VER)
+#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
+# endif 
+#endif
+
 #ifndef SWIGUNUSEDPARM
 # ifdef __cplusplus
 #   define SWIGUNUSEDPARM(p)
@@ -2516,7 +2522,7 @@
 
 #define SWIG_name    "_coo"
 
-#define SWIGVERSION 0x010334 
+#define SWIGVERSION 0x010336 
 #define SWIG_VERSION SWIGVERSION
 
 
@@ -2544,7 +2550,9 @@
     
     PyObject_ptr(PyObject *obj, bool initial_ref = true) :_obj(obj)
     {
-      if (initial_ref) Py_XINCREF(_obj);
+      if (initial_ref) {
+        Py_XINCREF(_obj);
+      }
     }
     
     PyObject_ptr & operator=(const PyObject_ptr& item) 
@@ -3089,6 +3097,16 @@
   return res;
 }
 
+
+  #define SWIG_From_long   PyInt_FromLong 
+
+
+SWIGINTERNINLINE PyObject *
+SWIG_From_int  (int value)
+{    
+  return SWIG_From_long  (value);
+}
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -12950,6 +12968,76 @@
 }
 
 
+SWIGINTERN PyObject *_wrap_coo_count_diagonals(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  int arg1 ;
+  int *arg2 ;
+  int *arg3 ;
+  int val1 ;
+  int ecode1 = 0 ;
+  PyArrayObject *array2 = NULL ;
+  int is_new_object2 ;
+  PyArrayObject *array3 = NULL ;
+  int is_new_object3 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  int result;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:coo_count_diagonals",&obj0,&obj1,&obj2)) SWIG_fail;
+  ecode1 = SWIG_AsVal_int(obj0, &val1);
+  if (!SWIG_IsOK(ecode1)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "coo_count_diagonals" "', argument " "1"" of type '" "int""'");
+  } 
+  arg1 = static_cast< int >(val1);
+  {
+    npy_intp size[1] = {
+      -1
+    };
+    array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_INT, &is_new_object2);
+    if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1)
+      || !require_contiguous(array2)   || !require_native(array2)) SWIG_fail;
+    
+    arg2 = (int*) array2->data;
+  }
+  {
+    npy_intp size[1] = {
+      -1
+    };
+    array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3);
+    if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1)
+      || !require_contiguous(array3)   || !require_native(array3)) SWIG_fail;
+    
+    arg3 = (int*) array3->data;
+  }
+  result = (int)coo_count_diagonals< int >(arg1,(int const (*))arg2,(int const (*))arg3);
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  {
+    if (is_new_object2 && array2) {
+      Py_DECREF(array2); 
+    }
+  }
+  {
+    if (is_new_object3 && array3) {
+      Py_DECREF(array3); 
+    }
+  }
+  return resultobj;
+fail:
+  {
+    if (is_new_object2 && array2) {
+      Py_DECREF(array2); 
+    }
+  }
+  {
+    if (is_new_object3 && array3) {
+      Py_DECREF(array3); 
+    }
+  }
+  return NULL;
+}
+
+
 static PyMethodDef SwigMethods[] = {
 	 { (char *)"coo_tocsr", _wrap_coo_tocsr, METH_VARARGS, (char *)"\n"
 		"coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, signed char Ax, \n"
@@ -13067,6 +13155,7 @@
 		"coo_matvec(int nnz, int Ai, int Aj, npy_clongdouble_wrapper Ax, \n"
 		"    npy_clongdouble_wrapper Xx, npy_clongdouble_wrapper Yx)\n"
 		""},
+	 { (char *)"coo_count_diagonals", _wrap_coo_count_diagonals, METH_VARARGS, (char *)"coo_count_diagonals(int nnz, int Ai, int Aj) -> int"},
 	 { NULL, NULL, 0, NULL }
 };
 

Modified: trunk/scipy/sparse/sparsetools/csc.i
===================================================================
--- trunk/scipy/sparse/sparsetools/csc.i	2008-10-05 01:54:59 UTC (rev 4771)
+++ trunk/scipy/sparse/sparsetools/csc.i	2008-10-05 02:23:37 UTC (rev 4772)
@@ -8,7 +8,7 @@
 
 %include "csc.h" 
 
-%template(csc_matmat_pass1)   csc_matmat_pass1<int>;
+INSTANTIATE_INDEX(csc_matmat_pass1);
 
 INSTANTIATE_ALL(csc_diagonal)
 INSTANTIATE_ALL(csc_tocsr)

Modified: trunk/scipy/sparse/sparsetools/csc.py
===================================================================
--- trunk/scipy/sparse/sparsetools/csc.py	2008-10-05 01:54:59 UTC (rev 4771)
+++ trunk/scipy/sparse/sparsetools/csc.py	2008-10-05 02:23:37 UTC (rev 4772)
@@ -1,5 +1,5 @@
 # This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.34
+# Version 1.3.36
 #
 # Don't modify this file, modify the SWIG interface instead.
 # This file is compatible with both classic and new-style classes.

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

Modified: trunk/scipy/sparse/sparsetools/csr.h
===================================================================
--- trunk/scipy/sparse/sparsetools/csr.h	2008-10-05 01:54:59 UTC (rev 4771)
+++ trunk/scipy/sparse/sparsetools/csr.h	2008-10-05 02:23:37 UTC (rev 4772)
@@ -1,6 +1,7 @@
 #ifndef __CSR_H__
 #define __CSR_H__
 
+#include <set>
 #include <vector>
 #include <algorithm>
 #include <functional>
@@ -39,8 +40,8 @@
     const I N = std::min(n_row, n_col);
 
     for(I i = 0; i < N; i++){
-        I row_start = Ap[i];
-        I row_end   = Ap[i+1];
+        const I row_start = Ap[i];
+        const I row_end   = Ap[i+1];
 
         T diag = 0;
         for(I jj = row_start; jj < row_end; jj++){
@@ -742,6 +743,7 @@
  *   
  * Note:
  *   The column indicies within each row must be in sorted order.
+ *   Explicit zeros are retained.
  *   Ap, Aj, and Ax will be modified *inplace*
  *
  */
@@ -951,7 +953,29 @@
 }
 
 
+/*
+ * Count the number of occupied diagonals in CSR matrix A
+ *
+ * Input Arguments:
+ *   I  nnz             - number of nonzeros in A
+ *   I  Ai[nnz(A)]      - row indices
+ *   I  Aj[nnz(A)]      - column indices
+ *
+ */
+template <class I>
+I csr_count_diagonals(const I n_row,
+                      const I Ap[],
+                      const I Aj[])
+{
+    std::set<I> diagonals;
+    
+    for(I i = 0; i < n_row; i++){
+        for(I jj = Ap[i]; jj < Ap[i+1]; jj++){
+            diagonals.insert(Aj[jj] - i);
+        }
+    }
+    return diagonals.size();
+}
 
 
-
 #endif

Modified: trunk/scipy/sparse/sparsetools/csr.i
===================================================================
--- trunk/scipy/sparse/sparsetools/csr.i	2008-10-05 01:54:59 UTC (rev 4771)
+++ trunk/scipy/sparse/sparsetools/csr.i	2008-10-05 02:23:37 UTC (rev 4772)
@@ -9,12 +9,11 @@
 %include "csr.h" 
 
 
-%template(expandptr)   expandptr<int>;
-%template(csr_count_blocks)   csr_count_blocks<int>;
-%template(csr_matmat_pass1)   csr_matmat_pass1<int>;
-%template(csr_has_sorted_indices)   csr_has_sorted_indices<int>;
+INSTANTIATE_INDEX(expandptr)
+INSTANTIATE_INDEX(csr_matmat_pass1)
+INSTANTIATE_INDEX(csr_count_blocks)
+INSTANTIATE_INDEX(csr_has_sorted_indices)
 
-
 INSTANTIATE_ALL(csr_diagonal)
 INSTANTIATE_ALL(csr_scale_rows)
 INSTANTIATE_ALL(csr_scale_columns)

Modified: trunk/scipy/sparse/sparsetools/csr.py
===================================================================
--- trunk/scipy/sparse/sparsetools/csr.py	2008-10-05 01:54:59 UTC (rev 4771)
+++ trunk/scipy/sparse/sparsetools/csr.py	2008-10-05 02:23:37 UTC (rev 4772)
@@ -1,5 +1,5 @@
 # This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.34
+# Version 1.3.36
 #
 # Don't modify this file, modify the SWIG interface instead.
 # This file is compatible with both classic and new-style classes.
@@ -53,10 +53,6 @@
   """expandptr(int n_row, int Ap, int Bi)"""
   return _csr.expandptr(*args)
 
-def csr_count_blocks(*args):
-  """csr_count_blocks(int n_row, int n_col, int R, int C, int Ap, int Aj) -> int"""
-  return _csr.csr_count_blocks(*args)
-
 def csr_matmat_pass1(*args):
   """
     csr_matmat_pass1(int n_row, int n_col, int Ap, int Aj, int Bp, int Bj, 
@@ -64,6 +60,10 @@
     """
   return _csr.csr_matmat_pass1(*args)
 
+def csr_count_blocks(*args):
+  """csr_count_blocks(int n_row, int n_col, int R, int C, int Ap, int Aj) -> int"""
+  return _csr.csr_count_blocks(*args)
+
 def csr_has_sorted_indices(*args):
   """csr_has_sorted_indices(int n_row, int Ap, int Aj) -> bool"""
   return _csr.csr_has_sorted_indices(*args)

Modified: trunk/scipy/sparse/sparsetools/csr_wrap.cxx
===================================================================
--- trunk/scipy/sparse/sparsetools/csr_wrap.cxx	2008-10-05 01:54:59 UTC (rev 4771)
+++ trunk/scipy/sparse/sparsetools/csr_wrap.cxx	2008-10-05 02:23:37 UTC (rev 4772)
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.34
+ * Version 1.3.36
  * 
  * This file is not intended to be easily readable and contains a number of 
  * coding conventions designed to improve portability and efficiency. Do not make
@@ -73,6 +73,12 @@
 # endif
 #endif
 
+#ifndef SWIG_MSC_UNSUPPRESS_4505
+# if defined(_MSC_VER)
+#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
+# endif 
+#endif
+
 #ifndef SWIGUNUSEDPARM
 # ifdef __cplusplus
 #   define SWIGUNUSEDPARM(p)
@@ -2530,7 +2536,7 @@
 
 #define SWIG_name    "_csr"
 
-#define SWIGVERSION 0x010334 
+#define SWIGVERSION 0x010336 
 #define SWIG_VERSION SWIGVERSION
 
 
@@ -2558,7 +2564,9 @@
     
     PyObject_ptr(PyObject *obj, bool initial_ref = true) :_obj(obj)
     {
-      if (initial_ref) Py_XINCREF(_obj);
+      if (initial_ref) {
+        Py_XINCREF(_obj);
+      }
     }
     
     PyObject_ptr & operator=(const PyObject_ptr& item) 
@@ -3176,59 +3184,71 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_csr_count_blocks(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csr_matmat_pass1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
-  int arg3 ;
-  int arg4 ;
+  int *arg3 ;
+  int *arg4 ;
   int *arg5 ;
   int *arg6 ;
-  int result;
+  int *arg7 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
   int ecode2 = 0 ;
-  int val3 ;
-  int ecode3 = 0 ;
-  int val4 ;
-  int ecode4 = 0 ;
+  PyArrayObject *array3 = NULL ;
+  int is_new_object3 ;
+  PyArrayObject *array4 = NULL ;
+  int is_new_object4 ;
   PyArrayObject *array5 = NULL ;
   int is_new_object5 ;
   PyArrayObject *array6 = NULL ;
   int is_new_object6 ;
+  PyArrayObject *temp7 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
   PyObject * obj4 = 0 ;
   PyObject * obj5 = 0 ;
+  PyObject * obj6 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csr_count_blocks",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csr_matmat_pass1",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_count_blocks" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_matmat_pass1" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_count_blocks" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_matmat_pass1" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
-  ecode3 = SWIG_AsVal_int(obj2, &val3);
-  if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "csr_count_blocks" "', argument " "3"" of type '" "int""'");
-  } 
-  arg3 = static_cast< int >(val3);
-  ecode4 = SWIG_AsVal_int(obj3, &val4);
-  if (!SWIG_IsOK(ecode4)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "csr_count_blocks" "', argument " "4"" of type '" "int""'");
-  } 
-  arg4 = static_cast< int >(val4);
   {
     npy_intp size[1] = {
       -1
     };
+    array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3);
+    if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1)
+      || !require_contiguous(array3)   || !require_native(array3)) SWIG_fail;
+    
+    arg3 = (int*) array3->data;
+  }
+  {
+    npy_intp size[1] = {
+      -1
+    };
+    array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4);
+    if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1)
+      || !require_contiguous(array4)   || !require_native(array4)) SWIG_fail;
+    
+    arg4 = (int*) array4->data;
+  }
+  {
+    npy_intp size[1] = {
+      -1
+    };
     array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_INT, &is_new_object5);
     if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1)
       || !require_contiguous(array5)   || !require_native(array5)) SWIG_fail;
@@ -3245,9 +3265,24 @@
     
     arg6 = (int*) array6->data;
   }
-  result = (int)csr_count_blocks< int >(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6);
-  resultobj = SWIG_From_int(static_cast< int >(result));
   {
+    temp7 = obj_to_array_no_conversion(obj6,PyArray_INT);
+    if (!temp7  || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail;
+    arg7 = (int*) array_data(temp7);
+  }
+  csr_matmat_pass1< int >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,arg7);
+  resultobj = SWIG_Py_Void();
+  {
+    if (is_new_object3 && array3) {
+      Py_DECREF(array3); 
+    }
+  }
+  {
+    if (is_new_object4 && array4) {
+      Py_DECREF(array4); 
+    }
+  }
+  {
     if (is_new_object5 && array5) {
       Py_DECREF(array5); 
     }
@@ -3260,6 +3295,16 @@
   return resultobj;
 fail:
   {
+    if (is_new_object3 && array3) {
+      Py_DECREF(array3); 
+    }
+  }
+  {
+    if (is_new_object4 && array4) {
+      Py_DECREF(array4); 
+    }
+  }
+  {
     if (is_new_object5 && array5) {
       Py_DECREF(array5); 
     }
@@ -3273,71 +3318,59 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_csr_matmat_pass1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csr_count_blocks(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
-  int *arg3 ;
-  int *arg4 ;
+  int arg3 ;
+  int arg4 ;
   int *arg5 ;
   int *arg6 ;
-  int *arg7 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
   int ecode2 = 0 ;
-  PyArrayObject *array3 = NULL ;
-  int is_new_object3 ;
-  PyArrayObject *array4 = NULL ;
-  int is_new_object4 ;
+  int val3 ;
+  int ecode3 = 0 ;
+  int val4 ;
+  int ecode4 = 0 ;
   PyArrayObject *array5 = NULL ;
   int is_new_object5 ;
   PyArrayObject *array6 = NULL ;
   int is_new_object6 ;
-  PyArrayObject *temp7 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
   PyObject * obj4 = 0 ;
   PyObject * obj5 = 0 ;
-  PyObject * obj6 = 0 ;
+  int result;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csr_matmat_pass1",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csr_count_blocks",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_matmat_pass1" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_count_blocks" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_matmat_pass1" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_count_blocks" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
+  ecode3 = SWIG_AsVal_int(obj2, &val3);
+  if (!SWIG_IsOK(ecode3)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "csr_count_blocks" "', argument " "3"" of type '" "int""'");
+  } 
+  arg3 = static_cast< int >(val3);
+  ecode4 = SWIG_AsVal_int(obj3, &val4);
+  if (!SWIG_IsOK(ecode4)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "csr_count_blocks" "', argument " "4"" of type '" "int""'");
+  } 
+  arg4 = static_cast< int >(val4);
   {
     npy_intp size[1] = {
       -1
     };
-    array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3);
-    if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1)
-      || !require_contiguous(array3)   || !require_native(array3)) SWIG_fail;
-    
-    arg3 = (int*) array3->data;
-  }
-  {
-    npy_intp size[1] = {
-      -1
-    };
-    array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4);
-    if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1)
-      || !require_contiguous(array4)   || !require_native(array4)) SWIG_fail;
-    
-    arg4 = (int*) array4->data;
-  }
-  {
-    npy_intp size[1] = {
-      -1
-    };
     array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_INT, &is_new_object5);
     if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1)
       || !require_contiguous(array5)   || !require_native(array5)) SWIG_fail;
@@ -3354,24 +3387,9 @@
     
     arg6 = (int*) array6->data;
   }
+  result = (int)csr_count_blocks< int >(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6);
+  resultobj = SWIG_From_int(static_cast< int >(result));
   {
-    temp7 = obj_to_array_no_conversion(obj6,PyArray_INT);
-    if (!temp7  || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail;
-    arg7 = (int*) array_data(temp7);
-  }
-  csr_matmat_pass1< int >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,arg7);
-  resultobj = SWIG_Py_Void();
-  {
-    if (is_new_object3 && array3) {
-      Py_DECREF(array3); 
-    }
-  }
-  {
-    if (is_new_object4 && array4) {
-      Py_DECREF(array4); 
-    }
-  }
-  {
     if (is_new_object5 && array5) {
       Py_DECREF(array5); 
     }
@@ -3384,16 +3402,6 @@
   return resultobj;
 fail:
   {
-    if (is_new_object3 && array3) {
-      Py_DECREF(array3); 
-    }
-  }
-  {
-    if (is_new_object4 && array4) {
-      Py_DECREF(array4); 
-    }
-  }
-  {
     if (is_new_object5 && array5) {
       Py_DECREF(array5); 
     }
@@ -3412,7 +3420,6 @@
   int arg1 ;
   int *arg2 ;
   int *arg3 ;
-  bool result;
   int val1 ;
   int ecode1 = 0 ;
   PyArrayObject *array2 = NULL ;
@@ -3422,6 +3429,7 @@
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
+  bool result;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:csr_has_sorted_indices",&obj0,&obj1,&obj2)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
@@ -45431,11 +45439,11 @@
 
 static PyMethodDef SwigMethods[] = {
 	 { (char *)"expandptr", _wrap_expandptr, METH_VARARGS, (char *)"expandptr(int n_row, int Ap, int Bi)"},
-	 { (char *)"csr_count_blocks", _wrap_csr_count_blocks, METH_VARARGS, (char *)"csr_count_blocks(int n_row, int n_col, int R, int C, int Ap, int Aj) -> int"},
 	 { (char *)"csr_matmat_pass1", _wrap_csr_matmat_pass1, METH_VARARGS, (char *)"\n"
 		"csr_matmat_pass1(int n_row, int n_col, int Ap, int Aj, int Bp, int Bj, \n"
 		"    int Cp)\n"
 		""},
+	 { (char *)"csr_count_blocks", _wrap_csr_count_blocks, METH_VARARGS, (char *)"csr_count_blocks(int n_row, int n_col, int R, int C, int Ap, int Aj) -> int"},
 	 { (char *)"csr_has_sorted_indices", _wrap_csr_has_sorted_indices, METH_VARARGS, (char *)"csr_has_sorted_indices(int n_row, int Ap, int Aj) -> bool"},
 	 { (char *)"csr_diagonal", _wrap_csr_diagonal, METH_VARARGS, (char *)"\n"
 		"csr_diagonal(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n"

Modified: trunk/scipy/sparse/sparsetools/dia.py
===================================================================
--- trunk/scipy/sparse/sparsetools/dia.py	2008-10-05 01:54:59 UTC (rev 4771)
+++ trunk/scipy/sparse/sparsetools/dia.py	2008-10-05 02:23:37 UTC (rev 4772)
@@ -1,5 +1,5 @@
 # This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.34
+# Version 1.3.36
 #
 # Don't modify this file, modify the SWIG interface instead.
 # This file is compatible with both classic and new-style classes.

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

Modified: trunk/scipy/sparse/sparsetools/sparsetools.i
===================================================================
--- trunk/scipy/sparse/sparsetools/sparsetools.i	2008-10-05 01:54:59 UTC (rev 4771)
+++ trunk/scipy/sparse/sparsetools/sparsetools.i	2008-10-05 02:23:37 UTC (rev 4772)
@@ -189,3 +189,9 @@
 %enddef
 
 
+%define INSTANTIATE_INDEX( f_name )
+/* 32-bit indices */
+%template(f_name)   f_name<int>;
+/* 64-bit indices would go here */
+%enddef
+




More information about the Scipy-svn mailing list