From scipy-svn at scipy.org Sun Dec 2 07:16:27 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 2 Dec 2007 06:16:27 -0600 (CST) Subject: [Scipy-svn] r3603 - trunk/scipy/sparse/sparsetools Message-ID: <20071202121627.4A8D139C1A7@new.scipy.org> Author: cdavid Date: 2007-12-02 06:16:23 -0600 (Sun, 02 Dec 2007) New Revision: 3603 Modified: trunk/scipy/sparse/sparsetools/sparsetools.h Log: include functional header for multiplies in sparsetools header Modified: trunk/scipy/sparse/sparsetools/sparsetools.h =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.h 2007-11-26 14:31:21 UTC (rev 3602) +++ trunk/scipy/sparse/sparsetools/sparsetools.h 2007-12-02 12:16:23 UTC (rev 3603) @@ -22,8 +22,8 @@ #include #include +#include - /* * Extract main diagonal of CSR matrix A * From scipy-svn at scipy.org Sun Dec 2 07:23:45 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 2 Dec 2007 06:23:45 -0600 (CST) Subject: [Scipy-svn] r3604 - in branches/scipy.scons: . scipy/linsolve/umfpack scipy/sparse/sparsetools Message-ID: <20071202122345.F225039C288@new.scipy.org> Author: cdavid Date: 2007-12-02 06:23:38 -0600 (Sun, 02 Dec 2007) New Revision: 3604 Modified: branches/scipy.scons/ branches/scipy.scons/scipy/linsolve/umfpack/info.py branches/scipy.scons/scipy/sparse/sparsetools/sparsetools.h Log: Merged revisions 3594-3603 via svnmerge from http://svn.scipy.org/svn/scipy/trunk ........ r3602 | rc | 2007-11-26 23:31:21 +0900 (Mon, 26 Nov 2007) | 2 lines improved module docstring ........ r3603 | cdavid | 2007-12-02 21:16:23 +0900 (Sun, 02 Dec 2007) | 1 line include functional header for multiplies in sparsetools header ........ Property changes on: branches/scipy.scons ___________________________________________________________________ Name: svnmerge-integrated - /trunk:1-3593 + /trunk:1-3603 Modified: branches/scipy.scons/scipy/linsolve/umfpack/info.py =================================================================== --- branches/scipy.scons/scipy/linsolve/umfpack/info.py 2007-12-02 12:16:23 UTC (rev 3603) +++ branches/scipy.scons/scipy/linsolve/umfpack/info.py 2007-12-02 12:23:38 UTC (rev 3604) @@ -1,6 +1,6 @@ """ -Interface to the UMFPACK library. -================================= +:Interface to the UMFPACK library: +================================== :Contains: UmfpackContext class @@ -21,6 +21,7 @@ Example site.cfg entry: + UMFPACK v4.4 in : [amd] @@ -44,8 +45,8 @@ library_dirs = /UFsparse/UMFPACK/Lib include_dirs = /UFsparse/UMFPACK/Include, /UFsparse/UFconfig umfpack_libs = umfpack + - :Examples: ---------- @@ -55,6 +56,7 @@ Righthand-side: rhs Solution: sol + # Contruct the solver. umfpack = um.UmfpackContext() # Use default 'di' family of UMFPACK routines. @@ -62,9 +64,11 @@ sol = umfpack( um.UMFPACK_A, mtx, rhs, autoTranspose = True ) # same as: sol = umfpack.linsolve( um.UMFPACK_A, mtx, rhs, autoTranspose = True ) + -or- + # Make LU decomposition. umfpack.numeric( mtx ) ... @@ -74,15 +78,17 @@ # same as: sol1 = umfpack.solve( um.UMFPACK_A, mtx, rhs1, autoTranspose = True ) sol2 = umfpack.solve( um.UMFPACK_A, mtx, rhs2, autoTranspose = True ) + -or- + # Make symbolic decomposition. umfpack.symbolic( mtx0 ) # Print statistics. umfpack.report_symbolic() -... +# ... # Make LU decomposition of mtx1 which has same structure as mtx0. umfpack.numeric( mtx1 ) @@ -92,7 +98,7 @@ # Use already LU-decomposed matrix. sol1 = umfpack( um.UMFPACK_A, mtx1, rhs1, autoTranspose = True ) -... +# ... # Make LU decomposition of mtx2 which has same structure as mtx0. umfpack.numeric( mtx2 ) @@ -100,37 +106,43 @@ # Print all statistics. umfpack.report_info() + -or- + # Get LU factors and permutation matrices of a matrix. L, U, P, Q, R, do_recip = umfpack.lu( mtx ) + -Then: - L - Lower triangular m-by-min(m,n) CSR matrix - U - Upper triangular min(m,n)-by-n CSC matrix - P - Vector of row permuations - Q - Vector of column permuations - R - Vector of diagonal row scalings - do_recip - boolean +:Returns: + - `L` : Lower triangular m-by-min(m,n) CSR matrix + - `U` : Upper triangular min(m,n)-by-n CSC matrix + - `P` : Vector of row permuations + - `Q` : Vector of column permuations + - `R` : Vector of diagonal row scalings + - `do_recip` : boolean - For a given matrix A, the decomposition satisfies: - LU = PRAQ when do_recip is true - LU = P(R^-1)AQ when do_recip is false +:Note: + For a given matrix A, the decomposition satisfies: + $LU = PRAQ$ when do_recip is true, + $LU = P(R^{-1})AQ$ when do_recip is false -:Arguments of UmfpackContext solution methods: ----------------------------------------------- -This holds for: umfpack(), umfpack.linsolve(), umfpack.solve() +:UmfpackContext solution methods: +--------------------------------- - sys - one of UMFPACK system description constants, like - UMFPACK_A, UMFPACK_At, see umfSys list and UMFPACK - docs - mtx - sparse matrix (CSR or CSC) - rhs - right hand side vector - autoTranspose - automatically changes 'sys' to the - transposed type, if 'mtx' is in CSR, since UMFPACK - assumes CSC internally +umfpack(), umfpack.linsolve(), umfpack.solve() +:Parameters: + - `sys` : constant, + one of UMFPACK system description constants, like + UMFPACK_A, UMFPACK_At, see umfSys list and UMFPACK docs + - `mtx` : sparse matrix (CSR or CSC) + - `rhs` : right hand side vector + - `autoTranspose` : bool + automatically changes 'sys' to the transposed type, if 'mtx' is in CSR, + since UMFPACK assumes CSC internally + :Setting control parameters: ---------------------------- @@ -143,8 +155,10 @@ functions). These attributes are in fact indices into the control array - to set the corresponding control array value, just do the following: + umfpack = um.UmfpackContext() umfpack.control[um.UMFPACK_PRL] = 4 # Let's be more verbose. + -- :Author: Robert Cimrman Modified: branches/scipy.scons/scipy/sparse/sparsetools/sparsetools.h =================================================================== --- branches/scipy.scons/scipy/sparse/sparsetools/sparsetools.h 2007-12-02 12:16:23 UTC (rev 3603) +++ branches/scipy.scons/scipy/sparse/sparsetools/sparsetools.h 2007-12-02 12:23:38 UTC (rev 3604) @@ -22,8 +22,8 @@ #include #include +#include - /* * Extract main diagonal of CSR matrix A * From scipy-svn at scipy.org Sun Dec 2 09:13:05 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 2 Dec 2007 08:13:05 -0600 (CST) Subject: [Scipy-svn] r3605 - trunk/scipy/sparse/sparsetools Message-ID: <20071202141305.DDFCF39C054@new.scipy.org> Author: wnbell Date: 2007-12-02 08:12:45 -0600 (Sun, 02 Dec 2007) New Revision: 3605 Added: trunk/scipy/sparse/sparsetools/README.txt Log: added SWIG README for sparsetools Added: trunk/scipy/sparse/sparsetools/README.txt =================================================================== --- trunk/scipy/sparse/sparsetools/README.txt 2007-12-02 12:23:38 UTC (rev 3604) +++ trunk/scipy/sparse/sparsetools/README.txt 2007-12-02 14:12:45 UTC (rev 3605) @@ -0,0 +1,8 @@ +Before regenerating sparsetools_wrap.cxx with SWIG, ensure that you +are using SWIG Version 1.3.33 (released on Nov. 23 2007) or newer. +You can check your version with: 'swig -version' + +The wrappers are generated with: + swig -c++ -python multigridtools.i + + From scipy-svn at scipy.org Sun Dec 2 12:03:36 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 2 Dec 2007 11:03:36 -0600 (CST) Subject: [Scipy-svn] r3606 - trunk/scipy/sparse Message-ID: <20071202170336.5E98139C240@new.scipy.org> Author: wnbell Date: 2007-12-02 11:03:18 -0600 (Sun, 02 Dec 2007) New Revision: 3606 Modified: trunk/scipy/sparse/sparse.py Log: refactoring of CSR/CSC matrix Modified: trunk/scipy/sparse/sparse.py =================================================================== --- trunk/scipy/sparse/sparse.py 2007-12-02 14:12:45 UTC (rev 3605) +++ trunk/scipy/sparse/sparse.py 2007-12-02 17:03:18 UTC (rev 3606) @@ -21,10 +21,7 @@ import numpy from scipy.sparse.sparsetools import cscmux, csrmux, \ cootocsr, csrtocoo, cootocsc, csctocoo, csctocsr, csrtocsc, \ - densetocsr, csrtodense, \ - csrmucsr, cscmucsc, \ - csr_plus_csr, csc_plus_csc, csr_minus_csr, csc_minus_csc, \ - csr_elmul_csr, csc_elmul_csc, csr_eldiv_csr, csc_eldiv_csc + densetocsr, csrtodense import sparsetools import itertools, operator, copy @@ -600,8 +597,6 @@ raise ValueError,'index pointer values must form a " \ "non-decreasing sequence' - - def astype(self, t): return self._with_data(self.data.astype(t)) @@ -633,7 +628,7 @@ def _imag(self): return self._with_data(numpy.imag(self.data)) - def _binopt(self, other, fn, in_shape=None, out_shape=None): + def _binopt(self, other, op, in_shape=None, out_shape=None): """apply the binary operation fn to two sparse matrices""" other = self._tothis(other) @@ -642,13 +637,16 @@ if out_shape is None: out_shape = self.shape + # e.g. csr_plus_csr, cscmucsc, etc. + fn = getattr(sparsetools, self.format + op + self.format) + indptr, ind, data = fn(in_shape[0], in_shape[1], \ self.indptr, self.indices, self.data, other.indptr, other.indices, other.data) return self.__class__((data, ind, indptr), dims=out_shape) - def __add__(self,other,fn): + def __add__(self,other): # First check if argument is a scalar if isscalarlike(other): # Now we would add this scalar to every element. @@ -657,7 +655,8 @@ elif isspmatrix(other): if (other.shape != self.shape): raise ValueError, "inconsistent shapes" - return self._binopt(other,fn) + + return self._binopt(other,'_plus_') elif isdense(other): # Convert this matrix to a dense matrix and add them return self.todense() + other @@ -667,7 +666,7 @@ def __radd__(self,other): return self.__add__(other) - def __sub__(self,other,fn): + def __sub__(self,other): # First check if argument is a scalar if isscalarlike(other): # Now we would add this scalar to every element. @@ -676,7 +675,8 @@ elif isspmatrix(other): if (other.shape != self.shape): raise ValueError, "inconsistent shapes" - return self._binopt(other,fn) + + return self._binopt(other,'_minus_') elif isdense(other): # Convert this matrix to a dense matrix and subtract them return self.todense() - other @@ -726,14 +726,14 @@ def __neg__(self): return self._with_data(-self.data) - def __truediv__(self,other,fn): + def __truediv__(self,other): if isscalarlike(other): return self * (1./other) elif isspmatrix(other): - other = self._tothis(other) if (other.shape != self.shape): raise ValueError, "inconsistent shapes" - return self._binopt(other,fn) + + return self._binopt(other,'_eldiv_') else: raise NotImplementedError @@ -745,26 +745,30 @@ else: raise NotImplementedError - def __pow__(self, other, fn): + def __pow__(self, other): """ Element-by-element power (unless other is a scalar, in which case return the matrix power.) """ if isscalarlike(other): return self._with_data(self.data**other) elif isspmatrix(other): - return self._binopt(other,fn) + if (other.shape != self.shape): + raise ValueError, "inconsistent shapes" + + return self._binopt(other,'_elmul_') else: raise NotImplementedError - def _matmat(self, other, fn): + def matmat(self, other): if isspmatrix(other): M, K1 = self.shape K2, N = other.shape if (K1 != K2): raise ValueError, "shape mismatch error" other = self._tothis(other) - return self._binopt(other,fn,in_shape=(M,N),out_shape=(M,N)) + + return self._binopt(other,'mu',in_shape=(M,N),out_shape=(M,N)) elif isdense(other): # TODO make sparse * dense matrix multiplication more efficient @@ -773,12 +777,15 @@ else: raise TypeError, "need a dense or sparse matrix" - def _matvec(self, other, fn): + def matvec(self, other): if isdense(other): if other.size != self.shape[1] or \ (other.ndim == 2 and self.shape[1] != other.shape[0]): raise ValueError, "dimension mismatch" + # csrmux, cscmux + fn = getattr(sparsetools,self.format + 'mux') + y = fn(self.shape[0], self.shape[1], \ self.indptr, self.indices, self.data, numpy.ravel(other)) @@ -806,9 +813,30 @@ def getdata(self, ind): return self.data[ind] - def _tocoo(self, fn): +# def _other_format(self): +# if self.format == 'csr': +# return 'csc' +# elif self.format == 'csc': +# return 'csr' +# else: +# raise TypeError,'unrecognized type' +# +# def _other__class__(self): +# if self.format == 'csr': +# return csc_matrix +# elif self.format == 'csc': +# return csr_matrix +# else: +# raise TypeError,'unrecognized type' + + def tocoo(self): + #TODO implement with arange(N).repeat(diff(indptr)) + + fn = getattr(sparsetools, self.format + 'tocoo') + rows, cols, data = fn(self.shape[0], self.shape[1], \ self.indptr, self.indices, self.data) + return coo_matrix((data, (rows, cols)), self.shape) @@ -853,7 +881,6 @@ M, N = self.shape return cls((self.data,self.indices,self.indptr),(N,M),copy=copy) - def conj(self, copy=False): return self._with_data(self.data.conj(),copy=copy) @@ -1031,30 +1058,9 @@ for r in xrange(self.shape[0]): yield csr[r,:] - def __add__(self, other): - return _cs_matrix.__add__(self, other, csc_plus_csc) - - def __sub__(self, other): - return _cs_matrix.__sub__(self, other, csc_minus_csc) - - def __truediv__(self,other): - return _cs_matrix.__truediv__(self,other, csc_eldiv_csc) - - def __pow__(self, other): - return _cs_matrix.__pow__(self, other, csc_elmul_csc) - def transpose(self, copy=False): return _cs_matrix._transpose(self, csr_matrix, copy) - def conj(self, copy=False): - return _cs_matrix.conj(self, copy) - - def matvec(self, other): - return _cs_matrix._matvec(self, other, cscmux) - - def matmat(self, other): - return _cs_matrix._matmat(self, other, cscmucsc) - def __getitem__(self, key): if isinstance(key, tuple): row = key[0] @@ -1152,21 +1158,18 @@ def tocsc(self, copy=False): return self.toself(copy) + + def _toother(self): + return self.tocsr() - def tocoo(self): - return _cs_matrix._tocoo(self, csctocoo) + def _tothis(self, other): + return other.tocsc() def tocsr(self): indptr, colind, data = csctocsr(self.shape[0], self.shape[1], \ self.indptr, self.indices, self.data) return csr_matrix((data, colind, indptr), self.shape) - def _toother(self): - return self.tocsr() - - def _tothis(self, other): - return other.tocsc() - def toarray(self): return self.tocsr().toarray() @@ -1309,30 +1312,9 @@ else: return _cs_matrix.__getattr__(self, attr) - def __add__(self, other): - return _cs_matrix.__add__(self, other, csr_plus_csr) - - def __sub__(self, other): - return _cs_matrix.__sub__(self, other, csr_minus_csr) - - def __truediv__(self,other): - return _cs_matrix.__truediv__(self,other, csr_eldiv_csr) - - def __pow__(self, other): - return _cs_matrix.__pow__(self, other, csr_elmul_csr) - def transpose(self, copy=False): return _cs_matrix._transpose(self, csc_matrix, copy) - def conj(self, copy=False): - return _cs_matrix.conj(self, copy) - - def matvec(self, other): - return _cs_matrix._matvec(self, other, csrmux) - - def matmat(self, other): - return _cs_matrix._matmat(self, other, csrmucsr) - def __getitem__(self, key): if isinstance(key, tuple): row = key[0] @@ -1427,9 +1409,6 @@ def tocsr(self, copy=False): return self.toself(copy) - def tocoo(self): - return _cs_matrix._tocoo(self, csrtocoo) - def tocsc(self): indptr, rowind, data = csrtocsc(self.shape[0], self.shape[1], \ self.indptr, self.indices, self.data) From scipy-svn at scipy.org Sun Dec 2 16:59:07 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 2 Dec 2007 15:59:07 -0600 (CST) Subject: [Scipy-svn] r3608 - in trunk/scipy/sparse: . tests Message-ID: <20071202215907.93ABE39C04F@new.scipy.org> Author: wnbell Date: 2007-12-02 15:59:04 -0600 (Sun, 02 Dec 2007) New Revision: 3608 Modified: trunk/scipy/sparse/sparse.py trunk/scipy/sparse/tests/test_sparse.py Log: make spkron work for mixed types Modified: trunk/scipy/sparse/sparse.py =================================================================== --- trunk/scipy/sparse/sparse.py 2007-12-02 21:53:53 UTC (rev 3607) +++ trunk/scipy/sparse/sparse.py 2007-12-02 21:59:04 UTC (rev 3608) @@ -2761,8 +2761,7 @@ row,col = row.reshape(-1),col.reshape(-1) # compute block entries - data = data.reshape(-1,b.nnz) - data *= b.data + data = data.reshape(-1,b.nnz) * b.data data = data.reshape(-1) return coo_matrix((data,(row,col)), dims=output_shape) Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-02 21:53:53 UTC (rev 3607) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-02 21:59:04 UTC (rev 3608) @@ -1171,7 +1171,8 @@ cases.append(array([[5,4],[0,0],[6,0]])) cases.append(array([[5,4,4],[1,0,0],[6,0,8]])) cases.append(array([[0,1,0,2,0,5,8]])) - + cases.append(array([[0.5,0.125,0,3.25],[0,2.5,0,0]])) + for a in cases: for b in cases: result = spkron(csr_matrix(a),csr_matrix(b)).todense() From scipy-svn at scipy.org Sun Dec 2 22:02:55 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 2 Dec 2007 21:02:55 -0600 (CST) Subject: [Scipy-svn] r3609 - trunk/scipy/sparse/tests Message-ID: <20071203030255.B99B039C036@new.scipy.org> Author: wnbell Date: 2007-12-02 21:02:53 -0600 (Sun, 02 Dec 2007) New Revision: 3609 Modified: trunk/scipy/sparse/tests/test_sparse.py Log: added basic sparse matvec benchmarking Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-02 21:59:04 UTC (rev 3608) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-03 03:02:53 UTC (rev 3609) @@ -22,7 +22,8 @@ from numpy.testing import * set_package_path() from scipy.sparse import csc_matrix, csr_matrix, dok_matrix, coo_matrix, \ - spidentity, speye, spkron, extract_diagonal, lil_matrix, lil_eye, lil_diags + spidentity, speye, spkron, extract_diagonal, lil_matrix, lil_eye, \ + lil_diags, spdiags from scipy.linsolve import splu restore_path() @@ -1221,6 +1222,61 @@ coo = coo_matrix(mat) assert_array_equal(mat,coo.todense()) +def poisson2d(N,epsilon=1.0): + """ + Return a sparse CSR matrix for the 2d poisson problem + with standard 5-point finite difference stencil on a + square N-by-N grid. + """ + D = (2 + 2*epsilon)*ones(N*N) + T = -epsilon * ones(N*N) + O = -ones(N*N) + T[N-1::N] = 0 + return spdiags([D,O,T,T,O],[0,-N,-1,1,N],N*N,N*N).tocoo().tocsr() #eliminate explicit zeros + + +import time +class TestSparseTools(NumpyTestCase): + def setUp(self): + self.matrices = [] + + self.matrices.append(('Identity',spidentity(10**5))) + self.matrices.append(('Poisson2d', poisson2d(250))) + self.matrices.append(('Poisson2d', poisson2d(500))) + self.matrices.append(('Poisson2d', poisson2d(1000))) + + def bench_matvec(self,level=5): + print + print ' Sparse Matrix Vector Product' + print '==================================================================' + print ' type | name | shape | nnz | MFLOPs ' + print '------------------------------------------------------------------' + fmt = ' %3s | %12s | %20s | %8d | %6.1f ' + + for name,A in self.matrices: + A = A.tocsr() + + x = ones(A.shape[1],dtype=A.dtype) + + y = A*x #warmup + + start = time.clock() + iter = 0 + while iter < 5 or time.clock() < start + 1: + y = A*x + iter += 1 + end = time.clock() + + name = name.center(12) + shape = ("%s" % (A.shape,)).center(20) + MFLOPs = (2*A.nnz*iter/(end-start))/float(1e6) + + print fmt % (A.format,name,shape,A.nnz,MFLOPs) + + + + + if __name__ == "__main__": NumpyTest().run() From scipy-svn at scipy.org Sun Dec 2 22:31:46 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 2 Dec 2007 21:31:46 -0600 (CST) Subject: [Scipy-svn] r3610 - in trunk/scipy/sparse: . tests Message-ID: <20071203033146.2047139C036@new.scipy.org> Author: wnbell Date: 2007-12-02 21:31:42 -0600 (Sun, 02 Dec 2007) New Revision: 3610 Modified: trunk/scipy/sparse/sparse.py trunk/scipy/sparse/tests/test_sparse.py Log: fixed CSR/CSC infer shape from data Modified: trunk/scipy/sparse/sparse.py =================================================================== --- trunk/scipy/sparse/sparse.py 2007-12-03 03:02:53 UTC (rev 3609) +++ trunk/scipy/sparse/sparse.py 2007-12-03 03:31:42 UTC (rev 3610) @@ -542,9 +542,9 @@ self.data = zeros((nzmax,), self.dtype) self.indices = zeros((nzmax,), intc) if self.format[-1] == 'r': - self.indptr = zeros(M+1, intc) + self.indptr = zeros(M+1, dtype='intc') else: - self.indptr = zeros(N+1,intc) + self.indptr = zeros(N+1, dtype='intc') else: try: # Try interpreting it as (data, ij) @@ -578,11 +578,17 @@ if self.shape is None: # shape not already set, try to infer dimensions try: - M = len(self.indptr) - 1 - N = self.indices.max() + 1 - self.shape = (M,N) + first_dim = len(self.indptr) - 1 + second_dim = self.indices.max() + 1 except: raise ValueError,'unable to infer matrix dimensions' + else: + if self.format[-1] == 'r': + # row oriented matrix + self.shape = (first_dim,second_dim) + else: + # column oriented matrix + self.shape = (second_dim,first_dim) self.check_format(full_check=False) Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-03 03:02:53 UTC (rev 3609) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-03 03:31:42 UTC (rev 3610) @@ -701,7 +701,7 @@ ## assert_equal(a.indices.dtype,numpy.dtype('int64')) ## assert_array_equal(a.todense(),b) - def check_constructor5(self): + def check_constructor4(self): """using (data, ij) format""" row = numpy.array([2, 3, 1, 3, 0, 1, 3, 0, 2, 1, 2]) col = numpy.array([0, 1, 0, 0, 1, 1, 2, 2, 2, 2, 1]) @@ -712,7 +712,14 @@ csr = csr_matrix((data,ij),(4,3)) assert_array_equal(arange(12).reshape(4,3),csr.todense()) - + def check_constructor5(self): + """infer dimensions from arrays""" + indptr = array([0,1,3,3]) + indices = array([0,5,1,2]) + data = array([1,2,3,4]) + csr = csr_matrix((data, indices, indptr)) + assert_array_equal(csr.shape,(3,6)) + def check_empty(self): """Test manipulating empty matrices. Fails in SciPy SVN <= r1768 """ @@ -788,7 +795,7 @@ assert_array_equal(bsp.indices,[0,2]) assert_array_equal(bsp.indptr,[0,1,2]) - def check_constructor5(self): + def check_constructor4(self): """using (data, ij) format""" row = numpy.array([2, 3, 1, 3, 0, 1, 3, 0, 2, 1, 2]) col = numpy.array([0, 1, 0, 0, 1, 1, 2, 2, 2, 2, 1]) @@ -799,6 +806,14 @@ csc = csc_matrix((data,ij),(4,3)) assert_array_equal(arange(12).reshape(4,3),csc.todense()) + def check_constructor5(self): + """infer dimensions from arrays""" + indptr = array([0,1,3,3]) + indices = array([0,5,1,2]) + data = array([1,2,3,4]) + csc = csc_matrix((data, indices, indptr)) + assert_array_equal(csc.shape,(6,3)) + def check_empty(self): """Test manipulating empty matrices. Fails in SciPy SVN <= r1768 """ From scipy-svn at scipy.org Mon Dec 3 16:15:10 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 3 Dec 2007 15:15:10 -0600 (CST) Subject: [Scipy-svn] r3611 - in trunk/scipy/io: . tests Message-ID: <20071203211510.A41FE39C23C@new.scipy.org> Author: wnbell Date: 2007-12-03 15:14:51 -0600 (Mon, 03 Dec 2007) New Revision: 3611 Modified: trunk/scipy/io/mmio.py trunk/scipy/io/tests/test_mmio.py Log: made sparse matrix market reading faster added more comprehensive unittests for sparse format Modified: trunk/scipy/io/mmio.py =================================================================== --- trunk/scipy/io/mmio.py 2007-12-03 03:31:42 UTC (rev 3610) +++ trunk/scipy/io/mmio.py 2007-12-03 21:14:51 UTC (rev 3611) @@ -1,5 +1,3 @@ -## Automatically adapted for scipy Oct 19, 2005 by convertcode.py - """ Matrix Market I/O in Python. """ @@ -10,10 +8,10 @@ # References: # http://math.nist.gov/MatrixMarket/ # -# TODO: support for sparse matrices, need spmatrix.tocoo(). import os -from numpy import asarray, real, imag, conj, zeros, ndarray +from numpy import asarray, real, imag, conj, zeros, ndarray, \ + empty, concatenate, ones from itertools import izip __all__ = ['mminfo','mmread','mmwrite'] @@ -184,38 +182,46 @@ assert k==entries,`k,entries` elif rep=='coordinate': - k = 0 - data,row,col = [],[],[] - row_append = row.append - col_append = col.append - data_append = data.append - line = '%' - while line: - if not line.startswith('%'): - l = line.split() - i = int(l[0])-1 - j = int(l[1])-1 - if is_pattern: - aij = 1.0 #use 1.0 for pattern matrices - elif is_complex: - aij = complex(*map(float,l[2:])) - else: - aij = float(l[2]) - row_append(i) - col_append(j) - data_append(aij) - if has_symmetry and i!=j: - if is_skew: - aij = -aij - elif is_herm: - aij = conj(aij) - row_append(j) - col_append(i) - data_append(aij) - k += 1 - line = source.readline() - assert k==entries,`k,entries` - a = coo_matrix((data, (row, col)), dims=(rows, cols), dtype=dtype) + from numpy import fromfile + flat_data = fromfile(source,sep=' ') + if is_pattern: + flat_data = flat_data.reshape(-1,2) + I = flat_data[:,0].astype('i') + J = flat_data[:,1].astype('i') + V = ones(len(I)) + elif is_complex: + flat_data = flat_data.reshape(-1,4) + I = flat_data[:,0].astype('i') + J = flat_data[:,1].astype('i') + V = empty(len(I),dtype='complex') + V.real = flat_data[:,2] + V.imag = flat_data[:,3] + else: + flat_data = flat_data.reshape(-1,3) + I = flat_data[:,0].astype('i') + J = flat_data[:,1].astype('i') + V = flat_data[:,2].copy() + + I -= 1 #adjust indices (base 1 -> base 0) + J -= 1 + + if has_symmetry: + mask = (I != J) #off diagonal mask + od_I = I[mask] + od_J = J[mask] + od_V = V[mask] + + I = concatenate((I,od_J)) + J = concatenate((J,od_I)) + + if is_skew: + od_V *= -1 + elif is_herm: + od_V = od_V.conjugate() + + V = concatenate((V,od_V)) + + a = coo_matrix((V, (I, J)), dims=(rows, cols), dtype=dtype) else: raise NotImplementedError,`rep` Modified: trunk/scipy/io/tests/test_mmio.py =================================================================== --- trunk/scipy/io/tests/test_mmio.py 2007-12-03 03:31:42 UTC (rev 3610) +++ trunk/scipy/io/tests/test_mmio.py 2007-12-03 21:14:51 UTC (rev 3611) @@ -102,7 +102,7 @@ b = mmread(fn) assert_array_almost_equal(a,b) -_exmpl_mtx = '''\ +_general_example = '''\ %%MatrixMarket matrix coordinate real general %================================================================================= % @@ -136,12 +136,60 @@ 5 5 1.200e+01 ''' +_hermitian_example = '''\ +%%MatrixMarket matrix coordinate complex hermitian + 5 5 7 + 1 1 1.0 0 + 2 2 10.5 0 + 4 2 250.5 22.22 + 3 3 1.5e-2 0 + 4 4 -2.8e2 0 + 5 5 12. 0 + 5 4 0 33.32 +''' + +_skew_example = '''\ +%%MatrixMarket matrix coordinate real skew-symmetric + 5 5 7 + 1 1 1.0 + 2 2 10.5 + 4 2 250.5 + 3 3 1.5e-2 + 4 4 -2.8e2 + 5 5 12. + 5 4 0 +''' + +_symmetric_example = '''\ +%%MatrixMarket matrix coordinate real symmetric + 5 5 7 + 1 1 1.0 + 2 2 10.5 + 4 2 250.5 + 3 3 1.5e-2 + 4 4 -2.8e2 + 5 5 12. + 5 4 8 +''' + +_symmetric_pattern_example = '''\ +%%MatrixMarket matrix coordinate pattern symmetric + 5 5 7 + 1 1 + 2 2 + 4 2 + 3 3 + 4 4 + 5 5 + 5 4 +''' + class TestMMIOCoordinate(NumpyTestCase): - - def check_simple_todense(self): + def check_read_geneal(self): + """read a general matrix""" fn = mktemp() f = open(fn,'w') - f.write(_exmpl_mtx) + f.write(_general_example) f.close() assert_equal(mminfo(fn),(5,5,8,'coordinate','real','general')) a = [[1, 0, 0, 6, 0], @@ -152,6 +200,67 @@ b = mmread(fn).todense() assert_array_almost_equal(a,b) + def check_read_hermitian(self): + """read a hermitian matrix""" + fn = mktemp() + f = open(fn,'w') + f.write(_hermitian_example) + f.close() + assert_equal(mminfo(fn),(5,5,7,'coordinate','complex','hermitian')) + a = [[1, 0, 0, 0, 0], + [0, 10.5, 0, 250.5 - 22.22j, 0], + [0, 0, .015, 0, 0], + [0, 250.5 + 22.22j, 0, -280, -33.32j], + [0, 0, 0, 33.32j, 12]] + b = mmread(fn).todense() + assert_array_almost_equal(a,b) + + def check_read_skew(self): + """read a skew-symmetric matrix""" + fn = mktemp() + f = open(fn,'w') + f.write(_skew_example) + f.close() + assert_equal(mminfo(fn),(5,5,7,'coordinate','real','skew-symmetric')) + a = [[1, 0, 0, 0, 0], + [0, 10.5, 0, -250.5, 0], + [0, 0, .015, 0, 0], + [0, 250.5, 0, -280, 0], + [0, 0, 0, 0, 12]] + b = mmread(fn).todense() + assert_array_almost_equal(a,b) + + def check_read_symmetric(self): + """read a symmetric matrix""" + fn = mktemp() + f = open(fn,'w') + f.write(_symmetric_example) + f.close() + assert_equal(mminfo(fn),(5,5,7,'coordinate','real','symmetric')) + a = [[1, 0, 0, 0, 0], + [0, 10.5, 0, 250.5, 0], + [0, 0, .015, 0, 0], + [0, 250.5, 0, -280, 8], + [0, 0, 0, 8, 12]] + b = mmread(fn).todense() + assert_array_almost_equal(a,b) + + def check_read_symmetric(self): + """read a symmetric pattern matrix""" + fn = mktemp() + f = open(fn,'w') + f.write(_symmetric_pattern_example) + f.close() + assert_equal(mminfo(fn),(5,5,7,'coordinate','pattern','symmetric')) + a = [[1, 0, 0, 0, 0], + [0, 1, 0, 1, 0], + [0, 0, 1, 0, 0], + [0, 1, 0, 1, 1], + [0, 0, 0, 1, 1]] + b = mmread(fn).todense() + assert_array_almost_equal(a,b) + + def check_real_write_read(self): I = array([0, 0, 1, 2, 3, 3, 3, 4]) J = array([0, 3, 1, 2, 1, 3, 4, 4]) From scipy-svn at scipy.org Mon Dec 3 17:01:46 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 3 Dec 2007 16:01:46 -0600 (CST) Subject: [Scipy-svn] r3612 - trunk/scipy/io Message-ID: <20071203220146.959B439C087@new.scipy.org> Author: wnbell Date: 2007-12-03 16:01:43 -0600 (Mon, 03 Dec 2007) New Revision: 3612 Modified: trunk/scipy/io/mmio.py Log: make new sparse MatrixMarket reader work for file-like objects Modified: trunk/scipy/io/mmio.py =================================================================== --- trunk/scipy/io/mmio.py 2007-12-03 21:14:51 UTC (rev 3611) +++ trunk/scipy/io/mmio.py 2007-12-03 22:01:43 UTC (rev 3612) @@ -182,8 +182,17 @@ assert k==entries,`k,entries` elif rep=='coordinate': - from numpy import fromfile - flat_data = fromfile(source,sep=' ') + from numpy import fromfile,fromstring + try: + # fromfile works for normal files + flat_data = fromfile(source,sep=' ') + except: + # fallback - fromfile fails for some file-like objects + flat_data = fromstring(source.read(),sep=' ') + + # TODO use iterator (e.g. xreadlines) to avoid reading + # the whole file into memory + if is_pattern: flat_data = flat_data.reshape(-1,2) I = flat_data[:,0].astype('i') @@ -222,6 +231,39 @@ V = concatenate((V,od_V)) a = coo_matrix((V, (I, J)), dims=(rows, cols), dtype=dtype) + +# k = 0 +# data,row,col = [],[],[] +# row_append = row.append +# col_append = col.append +# data_append = data.append +# line = '%' +# while line: +# if not line.startswith('%'): +# l = line.split() +# i = int(l[0])-1 +# j = int(l[1])-1 +# if is_pattern: +# aij = 1.0 #use 1.0 for pattern matrices +# elif is_complex: +# aij = complex(*map(float,l[2:])) +# else: +# aij = float(l[2]) +# row_append(i) +# col_append(j) +# data_append(aij) +# if has_symmetry and i!=j: +# if is_skew: +# aij = -aij +# elif is_herm: +# aij = conj(aij) +# row_append(j) +# col_append(i) +# data_append(aij) +# k += 1 +# line = source.readline() +# assert k==entries,`k,entries` +# a = coo_matrix((data, (row, col)), dims=(rows, cols), dtype=dtype) else: raise NotImplementedError,`rep` From scipy-svn at scipy.org Mon Dec 3 18:30:08 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 3 Dec 2007 17:30:08 -0600 (CST) Subject: [Scipy-svn] r3613 - trunk/scipy/sandbox/multigrid/multigridtools Message-ID: <20071203233008.4A0FB39C18F@new.scipy.org> Author: wnbell Date: 2007-12-03 17:30:01 -0600 (Mon, 03 Dec 2007) New Revision: 3613 Modified: trunk/scipy/sandbox/multigrid/multigridtools/multigridtools.i trunk/scipy/sandbox/multigrid/multigridtools/multigridtools.py trunk/scipy/sandbox/multigrid/multigridtools/multigridtools_wrap.cxx trunk/scipy/sandbox/multigrid/multigridtools/ruge_stuben.h trunk/scipy/sandbox/multigrid/multigridtools/smoothed_aggregation.h Log: templated multigridtools index types removed 64-bit indices Modified: trunk/scipy/sandbox/multigrid/multigridtools/multigridtools.i =================================================================== --- trunk/scipy/sandbox/multigrid/multigridtools/multigridtools.i 2007-12-03 22:01:43 UTC (rev 3612) +++ trunk/scipy/sandbox/multigrid/multigridtools/multigridtools.i 2007-12-03 23:30:01 UTC (rev 3613) @@ -61,13 +61,7 @@ %enddef -I_IN_ARRAY1( int ) -I_IN_ARRAY1( long long ) -T_IN_ARRAY1( float ) -T_IN_ARRAY1( double ) - - /* * OUT types */ @@ -103,13 +97,8 @@ }; %enddef -I_ARRAY_ARGOUT( int ) -I_ARRAY_ARGOUT( long long ) -T_ARRAY_ARGOUT( float ) -T_ARRAY_ARGOUT( double ) - /* * INPLACE types */ @@ -126,12 +115,32 @@ }; %enddef -I_INPLACE_ARRAY1( int ) -I_INPLACE_ARRAY1( long long ) -T_INPLACE_ARRAY1( float ) -T_INPLACE_ARRAY1( double ) +/* + * Macros to instantiate index types and data types + */ +%define DECLARE_INDEX_TYPE( ctype ) +I_IN_ARRAY1( ctype ) +I_ARRAY_ARGOUT( ctype ) +I_INPLACE_ARRAY1( ctype ) +%enddef + +%define DECLARE_DATA_TYPE( ctype ) +T_IN_ARRAY1( ctype ) +T_ARRAY_ARGOUT( ctype ) +T_INPLACE_ARRAY1( ctype ) +%enddef + +/* + * Create all desired index and data types here + */ +DECLARE_INDEX_TYPE( int ) + +DECLARE_DATA_TYPE( float ) +DECLARE_DATA_TYPE( double ) + + %include "ruge_stuben.h" %include "smoothed_aggregation.h" %include "relaxation.h" @@ -143,14 +152,11 @@ %define INSTANTIATE_BOTH( f_name ) %template(f_name) f_name; %template(f_name) f_name; -%template(f_name) f_name; -%template(f_name) f_name; /* 64-bit indices would go here */ %enddef %define INSTANTIATE_INDEX( f_name ) %template(f_name) f_name; -%template(f_name) f_name; %enddef %define INSTANTIATE_DATA( f_name ) @@ -159,14 +165,11 @@ %enddef +INSTANTIATE_INDEX(sa_get_aggregates) -INSTANTIATE_DATA(rs_strong_connections) -INSTANTIATE_DATA(rs_interpolation) - -INSTANTIATE_DATA(sa_strong_connections) -INSTANTIATE_DATA(sa_smoother) -/*INSTANTIATE_INDEX(sa_get_aggregates)*/ - +INSTANTIATE_BOTH(rs_strong_connections) +INSTANTIATE_BOTH(rs_interpolation) +INSTANTIATE_BOTH(sa_strong_connections) INSTANTIATE_BOTH(gauss_seidel) INSTANTIATE_BOTH(jacobi) Modified: trunk/scipy/sandbox/multigrid/multigridtools/multigridtools.py =================================================================== --- trunk/scipy/sandbox/multigrid/multigridtools/multigridtools.py 2007-12-03 22:01:43 UTC (rev 3612) +++ trunk/scipy/sandbox/multigrid/multigridtools/multigridtools.py 2007-12-03 23:30:01 UTC (rev 3613) @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.32 +# Version 1.3.34 # # Don't modify this file, modify the SWIG interface instead. # This file is compatible with both classic and new-style classes. @@ -53,84 +53,60 @@ F_NODE = _multigridtools.F_NODE def sa_get_aggregates(*args): - """sa_get_aggregates(int n_row, int Ap, int Aj, std::vector<(int)> Bj)""" - return _multigridtools.sa_get_aggregates(*args) + """sa_get_aggregates(int n_row, int Ap, int Aj, std::vector<(int)> Bj)""" + return _multigridtools.sa_get_aggregates(*args) def rs_strong_connections(*args): + """ + rs_strong_connections(int n_row, float theta, int Ap, int Aj, float Ax, std::vector<(int)> Sp, + std::vector<(int)> Sj, + std::vector<(float)> Sx) + rs_strong_connections(int n_row, double theta, int Ap, int Aj, double Ax, + std::vector<(int)> Sp, std::vector<(int)> Sj, + std::vector<(double)> Sx) """ - rs_strong_connections(int n_row, float theta, int Ap, int Aj, float Ax, std::vector<(int)> Sp, - std::vector<(int)> Sj, - std::vector<(float)> Sx) - rs_strong_connections(int n_row, double theta, int Ap, int Aj, double Ax, - std::vector<(int)> Sp, std::vector<(int)> Sj, - std::vector<(double)> Sx) - """ - return _multigridtools.rs_strong_connections(*args) + return _multigridtools.rs_strong_connections(*args) def rs_interpolation(*args): + """ + rs_interpolation(int n_nodes, int Ap, int Aj, float Ax, int Sp, int Sj, + float Sx, int Tp, int Tj, float Tx, std::vector<(int)> Bp, + std::vector<(int)> Bj, std::vector<(float)> Bx) + rs_interpolation(int n_nodes, int Ap, int Aj, double Ax, int Sp, int Sj, + double Sx, int Tp, int Tj, double Tx, std::vector<(int)> Bp, + std::vector<(int)> Bj, std::vector<(double)> Bx) """ - rs_interpolation(int n_nodes, int Ap, int Aj, float Ax, int Sp, int Sj, - float Sx, int Tp, int Tj, float Tx, std::vector<(int)> Bp, - std::vector<(int)> Bj, std::vector<(float)> Bx) - rs_interpolation(int n_nodes, int Ap, int Aj, double Ax, int Sp, int Sj, - double Sx, int Tp, int Tj, double Tx, std::vector<(int)> Bp, - std::vector<(int)> Bj, std::vector<(double)> Bx) - """ - return _multigridtools.rs_interpolation(*args) + return _multigridtools.rs_interpolation(*args) def sa_strong_connections(*args): + """ + sa_strong_connections(int n_row, float epsilon, int Ap, int Aj, float Ax, + std::vector<(int)> Sp, std::vector<(int)> Sj, + std::vector<(float)> Sx) + sa_strong_connections(int n_row, double epsilon, int Ap, int Aj, double Ax, + std::vector<(int)> Sp, std::vector<(int)> Sj, + std::vector<(double)> Sx) """ - sa_strong_connections(int n_row, float epsilon, int Ap, int Aj, float Ax, - std::vector<(int)> Sp, std::vector<(int)> Sj, - std::vector<(float)> Sx) - sa_strong_connections(int n_row, double epsilon, int Ap, int Aj, double Ax, - std::vector<(int)> Sp, std::vector<(int)> Sj, - std::vector<(double)> Sx) - """ - return _multigridtools.sa_strong_connections(*args) + return _multigridtools.sa_strong_connections(*args) -def sa_smoother(*args): - """ - sa_smoother(int n_row, float omega, int Ap, int Aj, float Ax, int Sp, - int Sj, float Sx, std::vector<(int)> Bp, - std::vector<(int)> Bj, std::vector<(float)> Bx) - sa_smoother(int n_row, double omega, int Ap, int Aj, double Ax, - int Sp, int Sj, double Sx, std::vector<(int)> Bp, - std::vector<(int)> Bj, std::vector<(double)> Bx) - """ - return _multigridtools.sa_smoother(*args) - def gauss_seidel(*args): + """ + gauss_seidel(int n_row, int Ap, int Aj, float Ax, float x, float b, + int row_start, int row_stop, int row_step) + gauss_seidel(int n_row, int Ap, int Aj, double Ax, double x, double b, + int row_start, int row_stop, int row_step) """ - gauss_seidel(int n_row, int Ap, int Aj, float Ax, float x, float b, - int row_start, int row_stop, int row_step) - gauss_seidel(int n_row, int Ap, int Aj, double Ax, double x, double b, - int row_start, int row_stop, int row_step) - gauss_seidel(long long n_row, long long Ap, long long Aj, float Ax, - float x, float b, long long row_start, long long row_stop, - long long row_step) - gauss_seidel(long long n_row, long long Ap, long long Aj, double Ax, - double x, double b, long long row_start, - long long row_stop, long long row_step) - """ - return _multigridtools.gauss_seidel(*args) + return _multigridtools.gauss_seidel(*args) def jacobi(*args): + """ + jacobi(int n_row, int Ap, int Aj, float Ax, float x, float b, + float temp, int row_start, int row_stop, + int row_step, float omega) + jacobi(int n_row, int Ap, int Aj, double Ax, double x, double b, + double temp, int row_start, int row_stop, + int row_step, double omega) """ - jacobi(int n_row, int Ap, int Aj, float Ax, float x, float b, - float temp, int row_start, int row_stop, - int row_step, float omega) - jacobi(int n_row, int Ap, int Aj, double Ax, double x, double b, - double temp, int row_start, int row_stop, - int row_step, double omega) - jacobi(long long n_row, long long Ap, long long Aj, float Ax, - float x, float b, float temp, long long row_start, - long long row_stop, long long row_step, - float omega) - jacobi(long long n_row, long long Ap, long long Aj, double Ax, - double x, double b, double temp, long long row_start, - long long row_stop, long long row_step, - double omega) - """ - return _multigridtools.jacobi(*args) + return _multigridtools.jacobi(*args) + Modified: trunk/scipy/sandbox/multigrid/multigridtools/multigridtools_wrap.cxx =================================================================== --- trunk/scipy/sandbox/multigrid/multigridtools/multigridtools_wrap.cxx 2007-12-03 22:01:43 UTC (rev 3612) +++ trunk/scipy/sandbox/multigrid/multigridtools/multigridtools_wrap.cxx 2007-12-03 23:30:01 UTC (rev 3613) @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.32 + * Version 1.3.34 * * 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 @@ -1124,7 +1124,7 @@ return 1; } else { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", - name, (min == max ? "" : "at least "), min); + name, (min == max ? "" : "at least "), (int)min); return 0; } } @@ -1135,11 +1135,11 @@ register Py_ssize_t l = PyTuple_GET_SIZE(args); if (l < min) { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", - name, (min == max ? "" : "at least "), min, l); + name, (min == max ? "" : "at least "), (int)min, (int)l); return 0; } else if (l > max) { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", - name, (min == max ? "" : "at most "), max, l); + name, (min == max ? "" : "at most "), (int)max, (int)l); return 0; } else { register int i; @@ -2501,7 +2501,7 @@ #define SWIG_name "_multigridtools" -#define SWIGVERSION 0x010332 +#define SWIGVERSION 0x010334 #define SWIG_VERSION SWIGVERSION @@ -3099,43 +3099,6 @@ return res; } - -SWIGINTERN int -SWIG_AsVal_long_SS_long (PyObject *obj, long long *val) -{ - int res = SWIG_TypeError; - if (PyLong_Check(obj)) { - long long v = PyLong_AsLongLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_OK; - } else { - PyErr_Clear(); - } - } else { - long v; - res = SWIG_AsVal_long (obj,&v); - if (SWIG_IsOK(res)) { - if (val) *val = v; - return res; - } - } -#ifdef SWIG_PYTHON_CAST_MODE - { - const double mant_max = 1LL << DBL_MANT_DIG; - const double mant_min = -mant_max; - double d; - res = SWIG_AsVal_double (obj,&d); - if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, mant_min, mant_max)) { - if (val) *val = (long long)(d); - return SWIG_AddCast(res); - } - res = SWIG_TypeError; - } -#endif - return res; -} - #ifdef __cplusplus extern "C" { #endif @@ -3186,7 +3149,7 @@ arg3 = (int*) array3->data; } - sa_get_aggregates(arg1,(int const (*))arg2,(int const (*))arg3,arg4); + sa_get_aggregates(arg1,(int const (*))arg2,(int const (*))arg3,arg4); resultobj = SWIG_Py_Void(); { int length = (arg4)->size(); @@ -3295,7 +3258,7 @@ arg5 = (float*) array5->data; } - rs_strong_connections(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6,arg7,arg8); + rs_strong_connections(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6,arg7,arg8); resultobj = SWIG_Py_Void(); { int length = (arg6)->size(); @@ -3424,7 +3387,7 @@ arg5 = (double*) array5->data; } - rs_strong_connections(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6,arg7,arg8); + rs_strong_connections(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6,arg7,arg8); resultobj = SWIG_Py_Void(); { int length = (arg6)->size(); @@ -3545,7 +3508,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'rs_strong_connections'.\n Possible C/C++ prototypes are:\n"" rs_strong_connections<(float)>(int const,float const,int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" rs_strong_connections<(double)>(int const,double const,int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'rs_strong_connections'.\n Possible C/C++ prototypes are:\n"" rs_strong_connections<(int,float)>(int const,float const,int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" rs_strong_connections<(int,double)>(int const,double const,int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"); return NULL; } @@ -3707,7 +3670,7 @@ arg10 = (float*) array10->data; } - rs_interpolation(arg1,(int const (*))arg2,(int const (*))arg3,(float const (*))arg4,(int const (*))arg5,(int const (*))arg6,(float const (*))arg7,(int const (*))arg8,(int const (*))arg9,(float const (*))arg10,arg11,arg12,arg13); + rs_interpolation(arg1,(int const (*))arg2,(int const (*))arg3,(float const (*))arg4,(int const (*))arg5,(int const (*))arg6,(float const (*))arg7,(int const (*))arg8,(int const (*))arg9,(float const (*))arg10,arg11,arg12,arg13); resultobj = SWIG_Py_Void(); { int length = (arg11)->size(); @@ -3947,7 +3910,7 @@ arg10 = (double*) array10->data; } - rs_interpolation(arg1,(int const (*))arg2,(int const (*))arg3,(double const (*))arg4,(int const (*))arg5,(int const (*))arg6,(double const (*))arg7,(int const (*))arg8,(int const (*))arg9,(double const (*))arg10,arg11,arg12,arg13); + rs_interpolation(arg1,(int const (*))arg2,(int const (*))arg3,(double const (*))arg4,(int const (*))arg5,(int const (*))arg6,(double const (*))arg7,(int const (*))arg8,(int const (*))arg9,(double const (*))arg10,arg11,arg12,arg13); resultobj = SWIG_Py_Void(); { int length = (arg11)->size(); @@ -4152,7 +4115,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'rs_interpolation'.\n Possible C/C++ prototypes are:\n"" rs_interpolation<(float)>(int const,int const [],int const [],float const [],int const [],int const [],float const [],int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" rs_interpolation<(double)>(int const,int const [],int const [],double const [],int const [],int const [],double const [],int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'rs_interpolation'.\n Possible C/C++ prototypes are:\n"" rs_interpolation<(int,float)>(int const,int const [],int const [],float const [],int const [],int const [],float const [],int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" rs_interpolation<(int,double)>(int const,int const [],int const [],double const [],int const [],int const [],double const [],int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"); return NULL; } @@ -4239,7 +4202,7 @@ arg5 = (float*) array5->data; } - sa_strong_connections(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6,arg7,arg8); + sa_strong_connections(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6,arg7,arg8); resultobj = SWIG_Py_Void(); { int length = (arg6)->size(); @@ -4368,7 +4331,7 @@ arg5 = (double*) array5->data; } - sa_strong_connections(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6,arg7,arg8); + sa_strong_connections(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6,arg7,arg8); resultobj = SWIG_Py_Void(); { int length = (arg6)->size(); @@ -4489,498 +4452,11 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'sa_strong_connections'.\n Possible C/C++ prototypes are:\n"" sa_strong_connections<(float)>(int const,float const,int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" sa_strong_connections<(double)>(int const,double const,int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'sa_strong_connections'.\n Possible C/C++ prototypes are:\n"" sa_strong_connections<(int,float)>(int const,float const,int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" sa_strong_connections<(int,double)>(int const,double const,int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"); return NULL; } -SWIGINTERN PyObject *_wrap_sa_smoother__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - float arg2 ; - int *arg3 ; - int *arg4 ; - float *arg5 ; - int *arg6 ; - int *arg7 ; - float *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - float val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - PyArrayObject *array6 = NULL ; - int is_new_object6 ; - PyArrayObject *array7 = NULL ; - int is_new_object7 ; - PyArrayObject *array8 = NULL ; - int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - PyObject * obj5 = 0 ; - PyObject * obj6 = 0 ; - PyObject * obj7 = 0 ; - - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:sa_smoother",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sa_smoother" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_float(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sa_smoother" "', argument " "2"" of type '" "float""'"); - } - arg2 = static_cast< float >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_FLOAT, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (float*) array5->data; - } - { - npy_intp size[1] = { - -1 - }; - array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); - if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) - || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; - - arg6 = (int*) array6->data; - } - { - npy_intp size[1] = { - -1 - }; - array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_INT, &is_new_object7); - if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) - || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; - - arg7 = (int*) array7->data; - } - { - npy_intp size[1] = { - -1 - }; - array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_FLOAT, &is_new_object8); - if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) - || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; - - arg8 = (float*) array8->data; - } - sa_smoother(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(int const (*))arg6,(int const (*))arg7,(float const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); - { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(float)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - { - if (is_new_object6 && array6) Py_DECREF(array6); - } - { - if (is_new_object7 && array7) Py_DECREF(array7); - } - { - if (is_new_object8 && array8) Py_DECREF(array8); - } - 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); - } - { - if (is_new_object6 && array6) Py_DECREF(array6); - } - { - if (is_new_object7 && array7) Py_DECREF(array7); - } - { - if (is_new_object8 && array8) Py_DECREF(array8); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_sa_smoother__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double arg2 ; - int *arg3 ; - int *arg4 ; - double *arg5 ; - int *arg6 ; - int *arg7 ; - double *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - double val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - PyArrayObject *array6 = NULL ; - int is_new_object6 ; - PyArrayObject *array7 = NULL ; - int is_new_object7 ; - PyArrayObject *array8 = NULL ; - int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - PyObject * obj5 = 0 ; - PyObject * obj6 = 0 ; - PyObject * obj7 = 0 ; - - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:sa_smoother",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sa_smoother" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_double(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sa_smoother" "', argument " "2"" of type '" "double""'"); - } - arg2 = static_cast< double >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_DOUBLE, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (double*) array5->data; - } - { - npy_intp size[1] = { - -1 - }; - array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); - if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) - || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; - - arg6 = (int*) array6->data; - } - { - npy_intp size[1] = { - -1 - }; - array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_INT, &is_new_object7); - if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) - || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; - - arg7 = (int*) array7->data; - } - { - npy_intp size[1] = { - -1 - }; - array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_DOUBLE, &is_new_object8); - if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) - || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; - - arg8 = (double*) array8->data; - } - sa_smoother(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(int const (*))arg6,(int const (*))arg7,(double const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); - { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(double)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - { - if (is_new_object6 && array6) Py_DECREF(array6); - } - { - if (is_new_object7 && array7) Py_DECREF(array7); - } - { - if (is_new_object8 && array8) Py_DECREF(array8); - } - 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); - } - { - if (is_new_object6 && array6) Py_DECREF(array6); - } - { - if (is_new_object7 && array7) Py_DECREF(array7); - } - { - if (is_new_object8 && array8) Py_DECREF(array8); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_sa_smoother(PyObject *self, PyObject *args) { - int argc; - PyObject *argv[9]; - int ii; - - if (!PyTuple_Check(args)) SWIG_fail; - argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 8); ii++) { - argv[ii] = PyTuple_GET_ITEM(args,ii); - } - if (argc == 8) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_float(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_FLOAT)) ? 1 : 0; - } - if (_v) { - return _wrap_sa_smoother__SWIG_1(self, args); - } - } - } - } - } - } - } - } - } - if (argc == 8) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_double(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_DOUBLE)) ? 1 : 0; - } - if (_v) { - return _wrap_sa_smoother__SWIG_2(self, args); - } - } - } - } - } - } - } - } - } - -fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'sa_smoother'.\n Possible C/C++ prototypes are:\n"" sa_smoother<(float)>(int const,float const,int const [],int const [],float const [],int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" sa_smoother<(double)>(int const,double const,int const [],int const [],double const [],int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"); - return NULL; -} - - SWIGINTERN PyObject *_wrap_gauss_seidel__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; @@ -5253,278 +4729,6 @@ } -SWIGINTERN PyObject *_wrap_gauss_seidel__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - long long arg1 ; - long long *arg2 ; - long long *arg3 ; - float *arg4 ; - float *arg5 ; - float *arg6 ; - long long arg7 ; - long long arg8 ; - long long arg9 ; - long long val1 ; - int ecode1 = 0 ; - PyArrayObject *array2 = NULL ; - int is_new_object2 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *temp5 = NULL ; - PyArrayObject *array6 = NULL ; - int is_new_object6 ; - long long val7 ; - int ecode7 = 0 ; - long long val8 ; - int ecode8 = 0 ; - long long val9 ; - int ecode9 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - PyObject * obj5 = 0 ; - PyObject * obj6 = 0 ; - PyObject * obj7 = 0 ; - PyObject * obj8 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:gauss_seidel",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; - ecode1 = SWIG_AsVal_long_SS_long(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gauss_seidel" "', argument " "1"" of type '" "long long""'"); - } - arg1 = static_cast< long long >(val1); - { - npy_intp size[1] = { - -1 - }; - array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_LONGLONG, &is_new_object2); - if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1) - || !require_contiguous(array2) || !require_native(array2)) SWIG_fail; - - arg2 = (long long*) array2->data; - } - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_LONGLONG, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (long long*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_FLOAT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (float*) array4->data; - } - { - temp5 = obj_to_array_no_conversion(obj4,PyArray_FLOAT); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (float*) array_data(temp5); - } - { - npy_intp size[1] = { - -1 - }; - array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_FLOAT, &is_new_object6); - if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) - || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; - - arg6 = (float*) array6->data; - } - ecode7 = SWIG_AsVal_long_SS_long(obj6, &val7); - if (!SWIG_IsOK(ecode7)) { - SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "gauss_seidel" "', argument " "7"" of type '" "long long""'"); - } - arg7 = static_cast< long long >(val7); - ecode8 = SWIG_AsVal_long_SS_long(obj7, &val8); - if (!SWIG_IsOK(ecode8)) { - SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "gauss_seidel" "', argument " "8"" of type '" "long long""'"); - } - arg8 = static_cast< long long >(val8); - ecode9 = SWIG_AsVal_long_SS_long(obj8, &val9); - if (!SWIG_IsOK(ecode9)) { - SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "gauss_seidel" "', argument " "9"" of type '" "long long""'"); - } - arg9 = static_cast< long long >(val9); - gauss_seidel(arg1,(long long const (*))arg2,(long long const (*))arg3,(float const (*))arg4,arg5,(float const (*))arg6,arg7,arg8,arg9); - resultobj = SWIG_Py_Void(); - { - if (is_new_object2 && array2) Py_DECREF(array2); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object6 && array6) Py_DECREF(array6); - } - return resultobj; -fail: - { - if (is_new_object2 && array2) Py_DECREF(array2); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object6 && array6) Py_DECREF(array6); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gauss_seidel__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - long long arg1 ; - long long *arg2 ; - long long *arg3 ; - double *arg4 ; - double *arg5 ; - double *arg6 ; - long long arg7 ; - long long arg8 ; - long long arg9 ; - long long val1 ; - int ecode1 = 0 ; - PyArrayObject *array2 = NULL ; - int is_new_object2 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *temp5 = NULL ; - PyArrayObject *array6 = NULL ; - int is_new_object6 ; - long long val7 ; - int ecode7 = 0 ; - long long val8 ; - int ecode8 = 0 ; - long long val9 ; - int ecode9 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - PyObject * obj5 = 0 ; - PyObject * obj6 = 0 ; - PyObject * obj7 = 0 ; - PyObject * obj8 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:gauss_seidel",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; - ecode1 = SWIG_AsVal_long_SS_long(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gauss_seidel" "', argument " "1"" of type '" "long long""'"); - } - arg1 = static_cast< long long >(val1); - { - npy_intp size[1] = { - -1 - }; - array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_LONGLONG, &is_new_object2); - if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1) - || !require_contiguous(array2) || !require_native(array2)) SWIG_fail; - - arg2 = (long long*) array2->data; - } - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_LONGLONG, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (long long*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_DOUBLE, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (double*) array4->data; - } - { - temp5 = obj_to_array_no_conversion(obj4,PyArray_DOUBLE); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (double*) array_data(temp5); - } - { - npy_intp size[1] = { - -1 - }; - array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_DOUBLE, &is_new_object6); - if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) - || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; - - arg6 = (double*) array6->data; - } - ecode7 = SWIG_AsVal_long_SS_long(obj6, &val7); - if (!SWIG_IsOK(ecode7)) { - SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "gauss_seidel" "', argument " "7"" of type '" "long long""'"); - } - arg7 = static_cast< long long >(val7); - ecode8 = SWIG_AsVal_long_SS_long(obj7, &val8); - if (!SWIG_IsOK(ecode8)) { - SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "gauss_seidel" "', argument " "8"" of type '" "long long""'"); - } - arg8 = static_cast< long long >(val8); - ecode9 = SWIG_AsVal_long_SS_long(obj8, &val9); - if (!SWIG_IsOK(ecode9)) { - SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "gauss_seidel" "', argument " "9"" of type '" "long long""'"); - } - arg9 = static_cast< long long >(val9); - gauss_seidel(arg1,(long long const (*))arg2,(long long const (*))arg3,(double const (*))arg4,arg5,(double const (*))arg6,arg7,arg8,arg9); - resultobj = SWIG_Py_Void(); - { - if (is_new_object2 && array2) Py_DECREF(array2); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object6 && array6) Py_DECREF(array6); - } - return resultobj; -fail: - { - if (is_new_object2 && array2) Py_DECREF(array2); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object6 && array6) Py_DECREF(array6); - } - return NULL; -} - - SWIGINTERN PyObject *_wrap_gauss_seidel(PyObject *self, PyObject *args) { int argc; PyObject *argv[10]; @@ -5641,115 +4845,9 @@ } } } - if (argc == 9) { - int _v; - { - int res = SWIG_AsVal_long_SS_long(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[1]) && PyArray_CanCastSafely(PyArray_TYPE(argv[1]),PyArray_LONGLONG)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_LONGLONG)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_FLOAT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_FLOAT)) ? 1 : 0; - } - if (_v) { - { - int res = SWIG_AsVal_long_SS_long(argv[6], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_long_SS_long(argv[7], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_long_SS_long(argv[8], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_gauss_seidel__SWIG_3(self, args); - } - } - } - } - } - } - } - } - } - } - if (argc == 9) { - int _v; - { - int res = SWIG_AsVal_long_SS_long(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[1]) && PyArray_CanCastSafely(PyArray_TYPE(argv[1]),PyArray_LONGLONG)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_LONGLONG)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_DOUBLE)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_DOUBLE)) ? 1 : 0; - } - if (_v) { - { - int res = SWIG_AsVal_long_SS_long(argv[6], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_long_SS_long(argv[7], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_long_SS_long(argv[8], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_gauss_seidel__SWIG_4(self, args); - } - } - } - } - } - } - } - } - } - } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'gauss_seidel'.\n Possible C/C++ prototypes are:\n"" gauss_seidel<(int,float)>(int const,int const [],int const [],float const [],float [],float const [],int const,int const,int const)\n"" gauss_seidel<(int,double)>(int const,int const [],int const [],double const [],double [],double const [],int const,int const,int const)\n"" gauss_seidel<(long long,float)>(long long const,long long const [],long long const [],float const [],float [],float const [],long long const,long long const,long long const)\n"" gauss_seidel<(long long,double)>(long long const,long long const [],long long const [],double const [],double [],double const [],long long const,long long const,long long const)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'gauss_seidel'.\n Possible C/C++ prototypes are:\n"" gauss_seidel<(int,float)>(int const,int const [],int const [],float const [],float [],float const [],int const,int const,int const)\n"" gauss_seidel<(int,double)>(int const,int const [],int const [],double const [],double [],double const [],int const,int const,int const)\n"); return NULL; } @@ -6060,312 +5158,6 @@ } -SWIGINTERN PyObject *_wrap_jacobi__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - long long arg1 ; - long long *arg2 ; - long long *arg3 ; - float *arg4 ; - float *arg5 ; - float *arg6 ; - float *arg7 ; - long long arg8 ; - long long arg9 ; - long long arg10 ; - float arg11 ; - long long val1 ; - int ecode1 = 0 ; - PyArrayObject *array2 = NULL ; - int is_new_object2 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *temp5 = NULL ; - PyArrayObject *array6 = NULL ; - int is_new_object6 ; - PyArrayObject *temp7 = NULL ; - long long val8 ; - int ecode8 = 0 ; - long long val9 ; - int ecode9 = 0 ; - long long val10 ; - int ecode10 = 0 ; - float val11 ; - int ecode11 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - PyObject * obj5 = 0 ; - PyObject * obj6 = 0 ; - PyObject * obj7 = 0 ; - PyObject * obj8 = 0 ; - PyObject * obj9 = 0 ; - PyObject * obj10 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:jacobi",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; - ecode1 = SWIG_AsVal_long_SS_long(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "jacobi" "', argument " "1"" of type '" "long long""'"); - } - arg1 = static_cast< long long >(val1); - { - npy_intp size[1] = { - -1 - }; - array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_LONGLONG, &is_new_object2); - if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1) - || !require_contiguous(array2) || !require_native(array2)) SWIG_fail; - - arg2 = (long long*) array2->data; - } - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_LONGLONG, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (long long*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_FLOAT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (float*) array4->data; - } - { - temp5 = obj_to_array_no_conversion(obj4,PyArray_FLOAT); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (float*) array_data(temp5); - } - { - npy_intp size[1] = { - -1 - }; - array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_FLOAT, &is_new_object6); - if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) - || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; - - arg6 = (float*) array6->data; - } - { - temp7 = obj_to_array_no_conversion(obj6,PyArray_FLOAT); - if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; - arg7 = (float*) array_data(temp7); - } - ecode8 = SWIG_AsVal_long_SS_long(obj7, &val8); - if (!SWIG_IsOK(ecode8)) { - SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "jacobi" "', argument " "8"" of type '" "long long""'"); - } - arg8 = static_cast< long long >(val8); - ecode9 = SWIG_AsVal_long_SS_long(obj8, &val9); - if (!SWIG_IsOK(ecode9)) { - SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "jacobi" "', argument " "9"" of type '" "long long""'"); - } - arg9 = static_cast< long long >(val9); - ecode10 = SWIG_AsVal_long_SS_long(obj9, &val10); - if (!SWIG_IsOK(ecode10)) { - SWIG_exception_fail(SWIG_ArgError(ecode10), "in method '" "jacobi" "', argument " "10"" of type '" "long long""'"); - } - arg10 = static_cast< long long >(val10); - ecode11 = SWIG_AsVal_float(obj10, &val11); - if (!SWIG_IsOK(ecode11)) { - SWIG_exception_fail(SWIG_ArgError(ecode11), "in method '" "jacobi" "', argument " "11"" of type '" "float""'"); - } - arg11 = static_cast< float >(val11); - jacobi(arg1,(long long const (*))arg2,(long long const (*))arg3,(float const (*))arg4,arg5,(float const (*))arg6,arg7,arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); - { - if (is_new_object2 && array2) Py_DECREF(array2); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object6 && array6) Py_DECREF(array6); - } - return resultobj; -fail: - { - if (is_new_object2 && array2) Py_DECREF(array2); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object6 && array6) Py_DECREF(array6); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_jacobi__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - long long arg1 ; - long long *arg2 ; - long long *arg3 ; - double *arg4 ; - double *arg5 ; - double *arg6 ; - double *arg7 ; - long long arg8 ; - long long arg9 ; - long long arg10 ; - double arg11 ; - long long val1 ; - int ecode1 = 0 ; - PyArrayObject *array2 = NULL ; - int is_new_object2 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *temp5 = NULL ; - PyArrayObject *array6 = NULL ; - int is_new_object6 ; - PyArrayObject *temp7 = NULL ; - long long val8 ; - int ecode8 = 0 ; - long long val9 ; - int ecode9 = 0 ; - long long val10 ; - int ecode10 = 0 ; - double val11 ; - int ecode11 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - PyObject * obj5 = 0 ; - PyObject * obj6 = 0 ; - PyObject * obj7 = 0 ; - PyObject * obj8 = 0 ; - PyObject * obj9 = 0 ; - PyObject * obj10 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:jacobi",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; - ecode1 = SWIG_AsVal_long_SS_long(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "jacobi" "', argument " "1"" of type '" "long long""'"); - } - arg1 = static_cast< long long >(val1); - { - npy_intp size[1] = { - -1 - }; - array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_LONGLONG, &is_new_object2); - if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1) - || !require_contiguous(array2) || !require_native(array2)) SWIG_fail; - - arg2 = (long long*) array2->data; - } - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_LONGLONG, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (long long*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_DOUBLE, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (double*) array4->data; - } - { - temp5 = obj_to_array_no_conversion(obj4,PyArray_DOUBLE); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (double*) array_data(temp5); - } - { - npy_intp size[1] = { - -1 - }; - array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_DOUBLE, &is_new_object6); - if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) - || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; - - arg6 = (double*) array6->data; - } - { - temp7 = obj_to_array_no_conversion(obj6,PyArray_DOUBLE); - if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; - arg7 = (double*) array_data(temp7); - } - ecode8 = SWIG_AsVal_long_SS_long(obj7, &val8); - if (!SWIG_IsOK(ecode8)) { - SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "jacobi" "', argument " "8"" of type '" "long long""'"); - } - arg8 = static_cast< long long >(val8); - ecode9 = SWIG_AsVal_long_SS_long(obj8, &val9); - if (!SWIG_IsOK(ecode9)) { - SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "jacobi" "', argument " "9"" of type '" "long long""'"); - } - arg9 = static_cast< long long >(val9); - ecode10 = SWIG_AsVal_long_SS_long(obj9, &val10); - if (!SWIG_IsOK(ecode10)) { - SWIG_exception_fail(SWIG_ArgError(ecode10), "in method '" "jacobi" "', argument " "10"" of type '" "long long""'"); - } - arg10 = static_cast< long long >(val10); - ecode11 = SWIG_AsVal_double(obj10, &val11); - if (!SWIG_IsOK(ecode11)) { - SWIG_exception_fail(SWIG_ArgError(ecode11), "in method '" "jacobi" "', argument " "11"" of type '" "double""'"); - } - arg11 = static_cast< double >(val11); - jacobi(arg1,(long long const (*))arg2,(long long const (*))arg3,(double const (*))arg4,arg5,(double const (*))arg6,arg7,arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); - { - if (is_new_object2 && array2) Py_DECREF(array2); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object6 && array6) Py_DECREF(array6); - } - return resultobj; -fail: - { - if (is_new_object2 && array2) Py_DECREF(array2); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object6 && array6) Py_DECREF(array6); - } - return NULL; -} - - SWIGINTERN PyObject *_wrap_jacobi(PyObject *self, PyObject *args) { int argc; PyObject *argv[12]; @@ -6504,137 +5296,9 @@ } } } - if (argc == 11) { - int _v; - { - int res = SWIG_AsVal_long_SS_long(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[1]) && PyArray_CanCastSafely(PyArray_TYPE(argv[1]),PyArray_LONGLONG)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_LONGLONG)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_FLOAT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_FLOAT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_FLOAT)) ? 1 : 0; - } - if (_v) { - { - int res = SWIG_AsVal_long_SS_long(argv[7], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_long_SS_long(argv[8], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_long_SS_long(argv[9], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_float(argv[10], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_jacobi__SWIG_3(self, args); - } - } - } - } - } - } - } - } - } - } - } - } - if (argc == 11) { - int _v; - { - int res = SWIG_AsVal_long_SS_long(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[1]) && PyArray_CanCastSafely(PyArray_TYPE(argv[1]),PyArray_LONGLONG)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_LONGLONG)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_DOUBLE)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_DOUBLE)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_DOUBLE)) ? 1 : 0; - } - if (_v) { - { - int res = SWIG_AsVal_long_SS_long(argv[7], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_long_SS_long(argv[8], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_long_SS_long(argv[9], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_double(argv[10], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_jacobi__SWIG_4(self, args); - } - } - } - } - } - } - } - } - } - } - } - } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'jacobi'.\n Possible C/C++ prototypes are:\n"" jacobi<(int,float)>(int const,int const [],int const [],float const [],float [],float const [],float [],int const,int const,int const,float const)\n"" jacobi<(int,double)>(int const,int const [],int const [],double const [],double [],double const [],double [],int const,int const,int const,double const)\n"" jacobi<(long long,float)>(long long const,long long const [],long long const [],float const [],float [],float const [],float [],long long const,long long const,long long const,float const)\n"" jacobi<(long long,double)>(long long const,long long const [],long long const [],double const [],double [],double const [],double [],long long const,long long const,long long const,double const)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'jacobi'.\n Possible C/C++ prototypes are:\n"" jacobi<(int,float)>(int const,int const [],int const [],float const [],float [],float const [],float [],int const,int const,int const,float const)\n"" jacobi<(int,double)>(int const,int const [],int const [],double const [],double [],double const [],double [],int const,int const,int const,double const)\n"); return NULL; } @@ -6665,25 +5329,11 @@ " std::vector<(int)> Sp, std::vector<(int)> Sj, \n" " std::vector<(double)> Sx)\n" ""}, - { (char *)"sa_smoother", _wrap_sa_smoother, METH_VARARGS, (char *)"\n" - "sa_smoother(int n_row, float omega, int Ap, int Aj, float Ax, int Sp, \n" - " int Sj, float Sx, std::vector<(int)> Bp, \n" - " std::vector<(int)> Bj, std::vector<(float)> Bx)\n" - "sa_smoother(int n_row, double omega, int Ap, int Aj, double Ax, \n" - " int Sp, int Sj, double Sx, std::vector<(int)> Bp, \n" - " std::vector<(int)> Bj, std::vector<(double)> Bx)\n" - ""}, { (char *)"gauss_seidel", _wrap_gauss_seidel, METH_VARARGS, (char *)"\n" "gauss_seidel(int n_row, int Ap, int Aj, float Ax, float x, float b, \n" " int row_start, int row_stop, int row_step)\n" "gauss_seidel(int n_row, int Ap, int Aj, double Ax, double x, double b, \n" " int row_start, int row_stop, int row_step)\n" - "gauss_seidel(long long n_row, long long Ap, long long Aj, float Ax, \n" - " float x, float b, long long row_start, long long row_stop, \n" - " long long row_step)\n" - "gauss_seidel(long long n_row, long long Ap, long long Aj, double Ax, \n" - " double x, double b, long long row_start, \n" - " long long row_stop, long long row_step)\n" ""}, { (char *)"jacobi", _wrap_jacobi, METH_VARARGS, (char *)"\n" "jacobi(int n_row, int Ap, int Aj, float Ax, float x, float b, \n" @@ -6692,14 +5342,6 @@ "jacobi(int n_row, int Ap, int Aj, double Ax, double x, double b, \n" " double temp, int row_start, int row_stop, \n" " int row_step, double omega)\n" - "jacobi(long long n_row, long long Ap, long long Aj, float Ax, \n" - " float x, float b, float temp, long long row_start, \n" - " long long row_stop, long long row_step, \n" - " float omega)\n" - "jacobi(long long n_row, long long Ap, long long Aj, double Ax, \n" - " double x, double b, double temp, long long row_start, \n" - " long long row_stop, long long row_step, \n" - " double omega)\n" ""}, { NULL, NULL, 0, NULL } }; Modified: trunk/scipy/sandbox/multigrid/multigridtools/ruge_stuben.h =================================================================== --- trunk/scipy/sandbox/multigrid/multigridtools/ruge_stuben.h 2007-12-03 22:01:43 UTC (rev 3612) +++ trunk/scipy/sandbox/multigrid/multigridtools/ruge_stuben.h 2007-12-03 23:30:01 UTC (rev 3613) @@ -13,30 +13,31 @@ enum NodeType {U_NODE, C_NODE, F_NODE}; -template -void rs_strong_connections(const int n_row, - const T theta, - const int Ap[], const int Aj[], const T Ax[], - std::vector * Sp, std::vector * Sj, std::vector * Sx){ +template +void rs_strong_connections(const I n_row, + const T theta, + const I Ap[], const I Aj[], const T Ax[], + std::vector * Sp, std::vector * Sj, std::vector * Sx){ + //Sp,Sj form a CSR representation where the i-th row contains //the indices of all the strong connections from node i Sp->push_back(0); //Compute lambdas for each node - for(int i = 0; i < n_row; i++){ + for(I i = 0; i < n_row; i++){ T min_offdiagonal = 0.0; - int row_start = Ap[i]; - int row_end = Ap[i+1]; - for(int jj = row_start; jj < row_end; jj++){ + I row_start = Ap[i]; + I row_end = Ap[i+1]; + for(I jj = row_start; jj < row_end; jj++){ min_offdiagonal = std::min(min_offdiagonal,Ax[jj]); //assumes diagonal is positive! } T threshold = theta*min_offdiagonal; - for(int jj = row_start; jj < row_end; jj++){ + for(I jj = row_start; jj < row_end; jj++){ if(Ax[jj] < threshold){ - Sj->push_back(Aj[jj]); - Sx->push_back(Ax[jj]); + Sj->push_back(Aj[jj]); + Sx->push_back(Ax[jj]); } } @@ -47,341 +48,339 @@ -template -void rs_interpolation(const int n_nodes, - const int Ap[], const int Aj[], const T Ax[], - const int Sp[], const int Sj[], const T Sx[], - const int Tp[], const int Tj[], const T Tx[], - std::vector * Bp, std::vector * Bj, std::vector * Bx){ - - std::vector lambda(n_nodes,0); +template +void rs_interpolation(const I n_nodes, + const I Ap[], const I Aj[], const T Ax[], + const I Sp[], const I Sj[], const T Sx[], + const I Tp[], const I Tj[], const T Tx[], + std::vector * Bp, std::vector * Bj, std::vector * Bx){ - //compute lambdas - for(int i = 0; i < n_nodes; i++){ - lambda[i] = Tp[i+1] - Tp[i]; - } + std::vector lambda(n_nodes,0); + //compute lambdas + for(I i = 0; i < n_nodes; i++){ + lambda[i] = Tp[i+1] - Tp[i]; + } - //for each value of lambda, create an interval of nodes with that value - // ptr - is the first index of the interval - // count - is the number of indices in that interval - // index to node - the node located at a given index - // node to index - the index of a given node - std::vector interval_ptr(n_nodes,0); - std::vector interval_count(n_nodes,0); - std::vector index_to_node(n_nodes); - std::vector node_to_index(n_nodes); - for(int i = 0; i < n_nodes; i++){ - interval_count[lambda[i]]++; - } - for(int i = 0, cumsum = 0; i < n_nodes; i++){ - interval_ptr[i] = cumsum; - cumsum += interval_count[i]; - interval_count[i] = 0; - } - for(int i = 0; i < n_nodes; i++){ - int lambda_i = lambda[i]; - int index = interval_ptr[lambda_i]+interval_count[lambda_i]; - index_to_node[index] = i; - node_to_index[i] = index; - interval_count[lambda_i]++; - } + //for each value of lambda, create an interval of nodes with that value + // ptr - is the first index of the interval + // count - is the number of indices in that interval + // index to node - the node located at a given index + // node to index - the index of a given node + std::vector interval_ptr(n_nodes,0); + std::vector interval_count(n_nodes,0); + std::vector index_to_node(n_nodes); + std::vector node_to_index(n_nodes); + for(I i = 0; i < n_nodes; i++){ + interval_count[lambda[i]]++; + } + for(I i = 0, cumsum = 0; i < n_nodes; i++){ + interval_ptr[i] = cumsum; + cumsum += interval_count[i]; + interval_count[i] = 0; + } + for(I i = 0; i < n_nodes; i++){ + I lambda_i = lambda[i]; + I index = interval_ptr[lambda_i]+interval_count[lambda_i]; + index_to_node[index] = i; + node_to_index[i] = index; + interval_count[lambda_i]++; + } - - std::vector NodeSets(n_nodes,U_NODE); - //Now add elements to C and F, in decending order of lambda - for(int top_index = n_nodes - 1; top_index > -1; top_index--){ - int i = index_to_node[top_index]; - int lambda_i = lambda[i]; + + std::vector NodeSets(n_nodes,U_NODE); + + //Now add elements to C and F, in decending order of lambda + for(I top_index = n_nodes - 1; top_index > -1; top_index--){ + I i = index_to_node[top_index]; + I lambda_i = lambda[i]; #ifdef DEBUG - { + { #ifdef DEBUG_PRINT - std::cout << "top_index " << top_index << std::endl; - std::cout << "i " << i << std::endl; - std::cout << "lambda_i " << lambda_i << std::endl; + std::cout << "top_index " << top_index << std::endl; + std::cout << "i " << i << std::endl; + std::cout << "lambda_i " << lambda_i << std::endl; - for(int i = 0; i < n_nodes; i++){ - std::cout << i << "="; - if(NodeSets[i] == U_NODE) - std::cout << "U"; - else if(NodeSets[i] == F_NODE) - std::cout << "F"; - else - std::cout << "C"; - std::cout << " "; - } - std::cout << std::endl; + for(I i = 0; i < n_nodes; i++){ + std::cout << i << "="; + if(NodeSets[i] == U_NODE) + std::cout << "U"; + else if(NodeSets[i] == F_NODE) + std::cout << "F"; + else + std::cout << "C"; + std::cout << " "; + } + std::cout << std::endl; - std::cout << "node_to_index" << std::endl; - for(int i = 0; i < n_nodes; i++){ - std::cout << i << "->" << node_to_index[i] << " "; - } - std::cout << std::endl; - std::cout << "index_to_node" << std::endl; - for(int i = 0; i < n_nodes; i++){ - std::cout << i << "->" << index_to_node[i] << " "; - } - std::cout << std::endl; + std::cout << "node_to_index" << std::endl; + for(I i = 0; i < n_nodes; i++){ + std::cout << i << "->" << node_to_index[i] << " "; + } + std::cout << std::endl; + std::cout << "index_to_node" << std::endl; + for(I i = 0; i < n_nodes; i++){ + std::cout << i << "->" << index_to_node[i] << " "; + } + std::cout << std::endl; - std::cout << "interval_count "; - for(int i = 0; i < n_nodes; i++){ - std::cout << interval_count[i] << " "; - } - std::cout << std::endl; + std::cout << "interval_count "; + for(I i = 0; i < n_nodes; i++){ + std::cout << interval_count[i] << " "; + } + std::cout << std::endl; #endif - //make sure arrays are correct - for(int n = 0; n < n_nodes; n++){ - assert(index_to_node[node_to_index[n]] == n); - } + //make sure arrays are correct + for(I n = 0; n < n_nodes; n++){ + assert(index_to_node[node_to_index[n]] == n); + } - //make sure intervals are reasonable - int sum_intervals = 0; - for(int n = 0; n < n_nodes; n++){ - assert(interval_count[n] >= 0); - if(interval_count[n] > 0){ - assert(interval_ptr[n] == sum_intervals); - } - sum_intervals += interval_count[n]; - } - assert(sum_intervals == top_index+1); + //make sure intervals are reasonable + I sum_intervals = 0; + for(I n = 0; n < n_nodes; n++){ + assert(interval_count[n] >= 0); + if(interval_count[n] > 0){ + assert(interval_ptr[n] == sum_intervals); + } + sum_intervals += interval_count[n]; + } + assert(sum_intervals == top_index+1); - - if(interval_count[lambda_i] <= 0){ - std::cout << "top_index " << top_index << std::endl; - std::cout << "lambda_i " << lambda_i << std::endl; - std::cout << "interval_count[lambda_i] " << interval_count[lambda_i] << std::endl; - std::cout << "top_index " << top_index << std::endl; - std::cout << "i " << i << std::endl; - std::cout << "lambda_i " << lambda_i << std::endl; - } - - - for(int n = 0; n <= top_index; n++){ - assert(NodeSets[index_to_node[n]] != C_NODE); - } - } - assert(node_to_index[i] == top_index); - assert(interval_ptr[lambda_i] + interval_count[lambda_i] - 1 == top_index); - //max interval should have at least one element - assert(interval_count[lambda_i] > 0); + + if(interval_count[lambda_i] <= 0){ + std::cout << "top_index " << top_index << std::endl; + std::cout << "lambda_i " << lambda_i << std::endl; + std::cout << "interval_count[lambda_i] " << interval_count[lambda_i] << std::endl; + std::cout << "top_index " << top_index << std::endl; + std::cout << "i " << i << std::endl; + std::cout << "lambda_i " << lambda_i << std::endl; + } + + + for(I n = 0; n <= top_index; n++){ + assert(NodeSets[index_to_node[n]] != C_NODE); + } + } + assert(node_to_index[i] == top_index); + assert(interval_ptr[lambda_i] + interval_count[lambda_i] - 1 == top_index); + //max interval should have at least one element + assert(interval_count[lambda_i] > 0); #endif - //remove i from its interval - interval_count[lambda_i]--; - + //remove i from its interval + interval_count[lambda_i]--; - if(NodeSets[i] == F_NODE){ - continue; - } else { - assert(NodeSets[i] == U_NODE); - NodeSets[i] = C_NODE; + if(NodeSets[i] == F_NODE){ + continue; + } else { + assert(NodeSets[i] == U_NODE); - //For each j in S^T_i /\ U - for(int jj = Tp[i]; jj < Tp[i+1]; jj++){ - int j = Tj[jj]; + NodeSets[i] = C_NODE; - if(NodeSets[j] == U_NODE){ - NodeSets[j] = F_NODE; - - //For each k in S_j /\ U - for(int kk = Sp[j]; kk < Sp[j+1]; kk++){ - int k = Sj[kk]; + //For each j in S^T_i /\ U + for(I jj = Tp[i]; jj < Tp[i+1]; jj++){ + I j = Tj[jj]; - if(NodeSets[k] == U_NODE){ - //move k to the end of its current interval - assert(lambda[j] < n_nodes - 1);//this would cause problems! + if(NodeSets[j] == U_NODE){ + NodeSets[j] = F_NODE; - int lambda_k = lambda[k]; - int old_pos = node_to_index[k]; - int new_pos = interval_ptr[lambda_k] + interval_count[lambda_k] - 1; + //For each k in S_j /\ U + for(I kk = Sp[j]; kk < Sp[j+1]; kk++){ + I k = Sj[kk]; - node_to_index[index_to_node[old_pos]] = new_pos; - node_to_index[index_to_node[new_pos]] = old_pos; - std::swap(index_to_node[old_pos],index_to_node[new_pos]); - - //update intervals - interval_count[lambda_k] -= 1; - interval_count[lambda_k+1] += 1; - interval_ptr[lambda_k+1] = new_pos; + if(NodeSets[k] == U_NODE){ + //move k to the end of its current interval + assert(lambda[j] < n_nodes - 1);//this would cause problems! - //increment lambda_k - lambda[k]++; + I lambda_k = lambda[k]; + I old_pos = node_to_index[k]; + I new_pos = interval_ptr[lambda_k] + interval_count[lambda_k] - 1; + node_to_index[index_to_node[old_pos]] = new_pos; + node_to_index[index_to_node[new_pos]] = old_pos; + std::swap(index_to_node[old_pos],index_to_node[new_pos]); + + //update intervals + interval_count[lambda_k] -= 1; + interval_count[lambda_k+1] += 1; + interval_ptr[lambda_k+1] = new_pos; + + //increment lambda_k + lambda[k]++; + #ifdef DEBUG - assert(interval_count[lambda_k] >= 0); - assert(interval_count[lambda_k+1] > 0); - assert(interval_ptr[lambda[k]] <= node_to_index[k]); - assert(node_to_index[k] < interval_ptr[lambda[k]] + interval_count[lambda[k]]); + assert(interval_count[lambda_k] >= 0); + assert(interval_count[lambda_k+1] > 0); + assert(interval_ptr[lambda[k]] <= node_to_index[k]); + assert(node_to_index[k] < interval_ptr[lambda[k]] + interval_count[lambda[k]]); #endif - } - } - } - } + } + } + } + } - //For each j in S_i /\ U - for(int jj = Sp[i]; jj < Sp[i+1]; jj++){ - int j = Sj[jj]; - if(NodeSets[j] == U_NODE){ //decrement lambda for node j - assert(lambda[j] > 0);//this would cause problems! + //For each j in S_i /\ U + for(I jj = Sp[i]; jj < Sp[i+1]; jj++){ + I j = Sj[jj]; + if(NodeSets[j] == U_NODE){ //decrement lambda for node j + assert(lambda[j] > 0);//this would cause problems! - //move j to the beginning of its current interval - int lambda_j = lambda[j]; - int old_pos = node_to_index[j]; - int new_pos = interval_ptr[lambda_j]; - - node_to_index[index_to_node[old_pos]] = new_pos; - node_to_index[index_to_node[new_pos]] = old_pos; - std::swap(index_to_node[old_pos],index_to_node[new_pos]); - - //update intervals - interval_count[lambda_j] -= 1; - interval_count[lambda_j-1] += 1; - interval_ptr[lambda_j] += 1; - interval_ptr[lambda_j-1] = interval_ptr[lambda_j] - interval_count[lambda_j-1]; + //move j to the beginning of its current interval + I lambda_j = lambda[j]; + I old_pos = node_to_index[j]; + I new_pos = interval_ptr[lambda_j]; - //decrement lambda_j - lambda[j]--; + node_to_index[index_to_node[old_pos]] = new_pos; + node_to_index[index_to_node[new_pos]] = old_pos; + std::swap(index_to_node[old_pos],index_to_node[new_pos]); + //update intervals + interval_count[lambda_j] -= 1; + interval_count[lambda_j-1] += 1; + interval_ptr[lambda_j] += 1; + interval_ptr[lambda_j-1] = interval_ptr[lambda_j] - interval_count[lambda_j-1]; + + //decrement lambda_j + lambda[j]--; + #ifdef DEBUG - assert(interval_count[lambda_j] >= 0); - assert(interval_count[lambda_j-1] > 0); - assert(interval_ptr[lambda[j]] <= node_to_index[j]); - assert(node_to_index[j] < interval_ptr[lambda[j]] + interval_count[lambda[j]]); + assert(interval_count[lambda_j] >= 0); + assert(interval_count[lambda_j-1] > 0); + assert(interval_ptr[lambda[j]] <= node_to_index[j]); + assert(node_to_index[j] < interval_ptr[lambda[j]] + interval_count[lambda[j]]); #endif - } - } + } + } + } } - } #ifdef DEBUG - //make sure each f-node has at least one strong c-node neighbor - for(int i = 0; i < n_nodes; i++){ - if(NodeSets[i] == F_NODE){ - int row_start = Sp[i]; - int row_end = Sp[i+1]; - bool has_c_neighbor = false; - for(int jj = row_start; jj < row_end; jj++){ - if(NodeSets[Sj[jj]] == C_NODE){ - has_c_neighbor = true; - break; - } - } - assert(has_c_neighbor); - } - } + //make sure each f-node has at least one strong c-node neighbor + for(I i = 0; i < n_nodes; i++){ + if(NodeSets[i] == F_NODE){ + I row_start = Sp[i]; + I row_end = Sp[i+1]; + bool has_c_neighbor = false; + for(I jj = row_start; jj < row_end; jj++){ + if(NodeSets[Sj[jj]] == C_NODE){ + has_c_neighbor = true; + break; + } + } + assert(has_c_neighbor); + } + } #endif - //Now construct interpolation operator - std::vector d_k(n_nodes,0); - std::vector C_i(n_nodes,0); - Bp->push_back(0); - for(int i = 0; i < n_nodes; i++){ - if(NodeSets[i] == C_NODE){ - //interpolate directly - Bj->push_back(i); - Bx->push_back(1); - Bp->push_back(Bj->size()); - } else { - //F_NODE - - //Step 4 - T d_i = 0; //denominator for this row - for(int jj = Ap[i]; jj < Ap[i+1]; jj++){ d_i += Ax[jj]; } - for(int jj = Sp[i]; jj < Sp[i+1]; jj++){ d_i -= Sx[jj]; } - - //Create C_i, initialize d_k - for(int jj = Sp[i]; jj < Sp[i+1]; jj++){ - int j = Sj[jj]; - if(NodeSets[j] == C_NODE){ - C_i[j] = true; - d_k[j] = Sx[jj]; - } - } + //Now construct interpolation operator + std::vector d_k(n_nodes,0); + std::vector C_i(n_nodes,0); + Bp->push_back(0); + for(I i = 0; i < n_nodes; i++){ + if(NodeSets[i] == C_NODE){ + //interpolate directly + Bj->push_back(i); + Bx->push_back(1); + Bp->push_back(Bj->size()); + } else { + //F_NODE - bool Sj_intersects_Ci = true; //in the case that i has no F-neighbors - for(int jj = Sp[i]; jj < Sp[i+1]; jj++){ //for j in D^s_i - int j = Sj[jj]; - T a_ij = Sx[jj]; - T a_jl = 0; + //Step 4 + T d_i = 0; //denominator for this row + for(I jj = Ap[i]; jj < Ap[i+1]; jj++){ d_i += Ax[jj]; } + for(I jj = Sp[i]; jj < Sp[i+1]; jj++){ d_i -= Sx[jj]; } - if(NodeSets[j] != F_NODE){continue;} + //Create C_i, initialize d_k + for(I jj = Sp[i]; jj < Sp[i+1]; jj++){ + I j = Sj[jj]; + if(NodeSets[j] == C_NODE){ + C_i[j] = true; + d_k[j] = Sx[jj]; + } + } - //Step 5 - Sj_intersects_Ci = false; + bool Sj_intersects_Ci = true; //in the case that i has no F-neighbors + for(I jj = Sp[i]; jj < Sp[i+1]; jj++){ //for j in D^s_i + I j = Sj[jj]; + T a_ij = Sx[jj]; + T a_jl = 0; - //compute sum a_jl - for(int ll = Sp[j]; ll < Sp[j+1]; ll++){ - if(C_i[Sj[ll]]){ - Sj_intersects_Ci = true; - a_jl += Sx[ll]; - } - } + if(NodeSets[j] != F_NODE){continue;} - if(!Sj_intersects_Ci){ break; } + //Step 5 + Sj_intersects_Ci = false; - for(int kk = Sp[j]; kk < Sp[j+1]; kk++){ - int k = Sj[kk]; - T a_jk = Sx[kk]; - if(C_i[k]){ - d_k[k] += a_ij*a_jk / a_jl; - } - } - } + //compute sum a_jl + for(I ll = Sp[j]; ll < Sp[j+1]; ll++){ + if(C_i[Sj[ll]]){ + Sj_intersects_Ci = true; + a_jl += Sx[ll]; + } + } - //Step 6 - if(Sj_intersects_Ci){ - for(int jj = Sp[i]; jj < Sp[i+1]; jj++){ - int j = Sj[jj]; - if(NodeSets[j] == C_NODE){ - Bj->push_back(j); - Bx->push_back(-d_k[j]/d_i); - } - } - Bp->push_back(Bj->size()); - } else { //make i a C_NODE - NodeSets[i] = C_NODE; - Bj->push_back(i); - Bx->push_back(1); - Bp->push_back(Bj->size()); - } - + if(!Sj_intersects_Ci){ break; } - //Clear C_i,d_k - for(int jj = Sp[i]; jj < Sp[i+1]; jj++){ - int j = Sj[jj]; - C_i[j] = false; - d_k[j] = 0; - } + for(I kk = Sp[j]; kk < Sp[j+1]; kk++){ + I k = Sj[kk]; + T a_jk = Sx[kk]; + if(C_i[k]){ + d_k[k] += a_ij*a_jk / a_jl; + } + } + } - } - - } + //Step 6 + if(Sj_intersects_Ci){ + for(I jj = Sp[i]; jj < Sp[i+1]; jj++){ + I j = Sj[jj]; + if(NodeSets[j] == C_NODE){ + Bj->push_back(j); + Bx->push_back(-d_k[j]/d_i); + } + } + Bp->push_back(Bj->size()); + } else { //make i a C_NODE + NodeSets[i] = C_NODE; + Bj->push_back(i); + Bx->push_back(1); + Bp->push_back(Bj->size()); + } - //for each c-node, determine its index in the coarser lvl - std::vector cnode_index(n_nodes,-1); - int n_cnodes = 0; - for(int i = 0; i < n_nodes; i++){ - if(NodeSets[i] == C_NODE) - cnode_index[i] = n_cnodes++; - } - //map old C indices to coarse indices - for(std::vector::iterator i = Bj->begin(); i != Bj->end(); i++){ - *i = cnode_index[*i]; - } - - + //Clear C_i,d_k + for(I jj = Sp[i]; jj < Sp[i+1]; jj++){ + I j = Sj[jj]; + C_i[j] = false; + d_k[j] = 0; + } + + } + + } + + //for each c-node, determine its index in the coarser lvl + std::vector cnode_index(n_nodes,-1); + I n_cnodes = 0; + for(I i = 0; i < n_nodes; i++){ + if(NodeSets[i] == C_NODE){ + cnode_index[i] = n_cnodes++; + } + } + //map old C indices to coarse indices + for(typename std::vector::iterator iter = Bj->begin(); iter != Bj->end(); iter++){ + *iter = cnode_index[*iter]; + } } #endif Modified: trunk/scipy/sandbox/multigrid/multigridtools/smoothed_aggregation.h =================================================================== --- trunk/scipy/sandbox/multigrid/multigridtools/smoothed_aggregation.h 2007-12-03 22:01:43 UTC (rev 3612) +++ trunk/scipy/sandbox/multigrid/multigridtools/smoothed_aggregation.h 2007-12-03 23:30:01 UTC (rev 3613) @@ -10,196 +10,196 @@ //#define DEBUG -template -void sa_strong_connections(const int n_row, - const T epsilon, - const int Ap[], const int Aj[], const T Ax[], - std::vector * Sp, std::vector * Sj, std::vector * Sx){ - //Sp,Sj form a CSR representation where the i-th row contains - //the indices of all the strong connections from node i - Sp->push_back(0); +template +void sa_strong_connections(const I n_row, + const T epsilon, + const I Ap[], const I Aj[], const T Ax[], + std::vector * Sp, std::vector * Sj, std::vector * Sx){ + //Sp,Sj form a CSR representation where the i-th row contains + //the indices of all the strong connections from node i + Sp->push_back(0); - //compute diagonal values - std::vector diags(n_row,T(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++){ - if(Aj[jj] == i){ - diags[i] = Ax[jj]; - break; - } - } - } + //compute diagonal values + std::vector diags(n_row,T(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++){ + if(Aj[jj] == i){ + diags[i] = Ax[jj]; + break; + } + } + } #ifdef DEBUG - for(int i = 0; i < n_row; i++){ assert(diags[i] > 0); } + for(I i = 0; i < n_row; i++){ assert(diags[i] > 0); } #endif - 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 eps_Aii = epsilon*epsilon*diags[i]; + T eps_Aii = epsilon*epsilon*diags[i]; - T weak_sum = 0.0; + T weak_sum = 0.0; - for(int jj = row_start; jj < row_end; jj++){ - const int j = Aj[jj]; - const T Aij = Ax[jj]; + for(I jj = row_start; jj < row_end; jj++){ + const I j = Aj[jj]; + const T Aij = Ax[jj]; - if(i == j){continue;} //skip diagonal until end of row + if(i == j){continue;} //skip diagonal until end of row - // |A(i,j)| < epsilon * sqrt(|A(i,i)|*|A(j,j)|) - if(Aij*Aij >= std::abs(eps_Aii * diags[j])){ - Sj->push_back(j); - Sx->push_back(Aij); - } else { - weak_sum += Aij; - } + // |A(i,j)| < epsilon * sqrt(|A(i,i)|*|A(j,j)|) + if(Aij*Aij >= std::abs(eps_Aii * diags[j])){ + Sj->push_back(j); + Sx->push_back(Aij); + } else { + weak_sum += Aij; + } + } + //Add modified diagonal entry + Sj->push_back(i); + Sx->push_back(diags[i] + weak_sum); //filtered matrix + + Sp->push_back(Sj->size()); } - //Add modified diagonal entry - Sj->push_back(i); - Sx->push_back(diags[i] + weak_sum); //filtered matrix - - Sp->push_back(Sj->size()); - } } - -void sa_get_aggregates(const int n_row, - const int Ap[], const int Aj[], - std::vector * Bj) + template +void sa_get_aggregates(const I n_row, + const I Ap[], const I Aj[], + std::vector * Bj) { - std::vector aggregates(n_row,-1); + std::vector aggregates(n_row,-1); - int num_aggregates = 0; + I num_aggregates = 0; - //Pass #1 - for(int i = 0; i < n_row; i++){ - if(aggregates[i] >= 0){ continue; } //already marked + //Pass #1 + for(I i = 0; i < n_row; i++){ + if(aggregates[i] >= 0){ continue; } //already marked - const int row_start = Ap[i]; - const int row_end = Ap[i+1]; - - //Determine whether all neighbors of this node are free (not already aggregates) - bool free_neighborhood = true; - for(int jj = row_start; jj < row_end; jj++){ - if(aggregates[Aj[jj]] >= 0){ - free_neighborhood = false; - break; - } - } - if(!free_neighborhood){ continue; } //bail out + const I row_start = Ap[i]; + const I row_end = Ap[i+1]; - //Make an aggregate out of this node and its strong neigbors - aggregates[i] = num_aggregates; - for(int jj = row_start; jj < row_end; jj++){ - aggregates[Aj[jj]] = num_aggregates; + //Determine whether all neighbors of this node are free (not already aggregates) + bool free_neighborhood = true; + for(I jj = row_start; jj < row_end; jj++){ + if(aggregates[Aj[jj]] >= 0){ + free_neighborhood = false; + break; + } + } + if(!free_neighborhood){ continue; } //bail out + + //Make an aggregate out of this node and its strong neigbors + aggregates[i] = num_aggregates; + for(I jj = row_start; jj < row_end; jj++){ + aggregates[Aj[jj]] = num_aggregates; + } + num_aggregates++; } - num_aggregates++; - } - //Pass #2 - std::vector aggregates_copy(aggregates); - for(int i = 0; i < n_row; i++){ - if(aggregates[i] >= 0){ continue; } //already marked + //Pass #2 + std::vector aggregates_copy(aggregates); + for(I i = 0; i < n_row; i++){ + if(aggregates[i] >= 0){ continue; } //already marked - const int row_start = Ap[i]; - const int row_end = Ap[i+1]; - - for(int jj = row_start; jj < row_end; jj++){ - const int j = Aj[jj]; + const I row_start = Ap[i]; + const I row_end = Ap[i+1]; - if(aggregates_copy[j] >= 0){ - aggregates[i] = aggregates_copy[j]; - break; - } - } - } + for(I jj = row_start; jj < row_end; jj++){ + const I j = Aj[jj]; + if(aggregates_copy[j] >= 0){ + aggregates[i] = aggregates_copy[j]; + break; + } + } + } - //Pass #3 - for(int i = 0; i < n_row; i++){ - if(aggregates[i] >= 0){ continue; } //already marked - - const int row_start = Ap[i]; - const int row_end = Ap[i+1]; - - aggregates[i] = num_aggregates; - for(int jj = row_start; jj < row_end; jj++){ - const int j = Aj[jj]; + //Pass #3 + for(I i = 0; i < n_row; i++){ + if(aggregates[i] >= 0){ continue; } //already marked - if(aggregates[j] < 0){ //unmarked neighbors - aggregates[j] = num_aggregates; - } - } - num_aggregates++; - } + const I row_start = Ap[i]; + const I row_end = Ap[i+1]; -#ifdef DEBUG - for(int i = 0; i < n_row; i++){ assert(aggregates[i] >= 0 && aggregates[i] < num_aggregates); } -#endif - - aggregates.swap(*Bj); -} + aggregates[i] = num_aggregates; + for(I jj = row_start; jj < row_end; jj++){ + const I j = Aj[jj]; + if(aggregates[j] < 0){ //unmarked neighbors + aggregates[j] = num_aggregates; + } + } + num_aggregates++; + } +#ifdef DEBUG + for(I i = 0; i < n_row; i++){ assert(aggregates[i] >= 0 && aggregates[i] < num_aggregates); } +#endif + aggregates.swap(*Bj); +} -template -void sa_smoother(const int n_row, - const T omega, - const int Ap[], const int Aj[], const T Ax[], - const int Sp[], const int Sj[], const T Sx[], - std::vector * Bp, std::vector * Bj, std::vector * Bx){ - //compute filtered diagonal - std::vector diags(n_row,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++){ - diags[i] += Ax[jj]; - } - } - for(int i = 0; i < n_row; i++){ - int row_start = Sp[i]; - int row_end = Sp[i+1]; - for(int jj = row_start; jj < row_end; jj++){ - diags[i] -= Sx[jj]; - } - } - -#ifdef DEBUG - for(int i = 0; i < n_row; i++){ assert(diags[i] > 0); } -#endif - //compute omega Jacobi smoother - Bp->push_back(0); - for(int i = 0; i < n_row; i++){ - int row_start = Sp[i]; - int row_end = Sp[i+1]; - const T row_scale = -omega/diags[i]; +//template +//void sa_smoother(const int n_row, +// const T omega, +// const int Ap[], const int Aj[], const T Ax[], +// const int Sp[], const int Sj[], const T Sx[], +// std::vector * Bp, std::vector * Bj, std::vector * Bx){ +// +// +// //compute filtered diagonal +// std::vector diags(n_row,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++){ +// diags[i] += Ax[jj]; +// } +// } +// for(int i = 0; i < n_row; i++){ +// int row_start = Sp[i]; +// int row_end = Sp[i+1]; +// for(int jj = row_start; jj < row_end; jj++){ +// diags[i] -= Sx[jj]; +// } +// } +// +//#ifdef DEBUG +// for(int i = 0; i < n_row; i++){ assert(diags[i] > 0); } +//#endif +// +// +// //compute omega Jacobi smoother +// Bp->push_back(0); +// for(int i = 0; i < n_row; i++){ +// int row_start = Sp[i]; +// int row_end = Sp[i+1]; +// const T row_scale = -omega/diags[i]; +// +// Bx->push_back(1.0); +// Bj->push_back( i ); +// +// for(int jj = row_start; jj < row_end; jj++){ +// Bx->push_back(row_scale*Sx[jj]); +// Bj->push_back(Sj[jj]); +// } +// Bp->push_back(Bj->size()); +// } +//} - Bx->push_back(1.0); - Bj->push_back( i ); - - for(int jj = row_start; jj < row_end; jj++){ - Bx->push_back(row_scale*Sx[jj]); - Bj->push_back(Sj[jj]); - } - Bp->push_back(Bj->size()); - } -} - #endif From scipy-svn at scipy.org Tue Dec 4 01:51:54 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 4 Dec 2007 00:51:54 -0600 (CST) Subject: [Scipy-svn] r3614 - branches/scipy.scons/scipy/fftpack Message-ID: <20071204065154.956EC39C2D5@new.scipy.org> Author: cdavid Date: 2007-12-04 00:51:50 -0600 (Tue, 04 Dec 2007) New Revision: 3614 Modified: branches/scipy.scons/scipy/fftpack/SConstruct Log: Use fft checker for fftpack scons build Modified: branches/scipy.scons/scipy/fftpack/SConstruct =================================================================== --- branches/scipy.scons/scipy/fftpack/SConstruct 2007-12-03 23:30:01 UTC (rev 3613) +++ branches/scipy.scons/scipy/fftpack/SConstruct 2007-12-04 06:51:50 UTC (rev 3614) @@ -1,18 +1,32 @@ -# Last Change: Mon Nov 26 03:00 PM 2007 J +# Last Change: Tue Dec 04 03:00 PM 2007 J # vim:syntax=python from os.path import join as pjoin from numpy.distutils.misc_util import get_numpy_include_dirs from numpy.distutils.scons import GetNumpyEnvironment +from numpy.distutils.scons import IsMKL, IsFFTW3, IsFFTW2, CheckFFT env = GetNumpyEnvironment(ARGUMENTS) env.AppendUnique(CPPPATH = get_numpy_include_dirs()) env.AppendUnique(CPPPATH = env['F2PYINCLUDEDIR']) -# XXX: implement fft checkers ... +# Check fft implementation +config = env.NumpyConfigure(custom_tests = {'CheckFFT': CheckFFT}) +st = config.CheckFFT() +config.Finish() +if st: + if IsMKL(env, 'fft'): + env.Append(CPPDEFINES = "SCIPY_MKL_H") + elif IsFFTW3(env, 'fft'): + env.Append(CPPDEFINES = "SCIPY_FFTW3_H") + elif IsFFTW2(env, 'fft'): + env.Append(CPPDEFINES = "SCIPY_FFTW2_H") + else: + pass + # Build dfftpack src = env.NumpyGlob(pjoin('dfftpack', '*.f')) dfftpack = env.NumpyStaticExtLibrary('dfftpack', source = src) From scipy-svn at scipy.org Tue Dec 4 03:15:46 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 4 Dec 2007 02:15:46 -0600 (CST) Subject: [Scipy-svn] r3615 - branches/scipy.scons/scipy/fftpack Message-ID: <20071204081546.64F80C7C00D@new.scipy.org> Author: cdavid Date: 2007-12-04 02:15:37 -0600 (Tue, 04 Dec 2007) New Revision: 3615 Modified: branches/scipy.scons/scipy/fftpack/SConstruct Log: Update config info for fftpack with scons build Modified: branches/scipy.scons/scipy/fftpack/SConstruct =================================================================== --- branches/scipy.scons/scipy/fftpack/SConstruct 2007-12-04 06:51:50 UTC (rev 3614) +++ branches/scipy.scons/scipy/fftpack/SConstruct 2007-12-04 08:15:37 UTC (rev 3615) @@ -1,4 +1,4 @@ -# Last Change: Tue Dec 04 03:00 PM 2007 J +# Last Change: Tue Dec 04 04:00 PM 2007 J # vim:syntax=python from os.path import join as pjoin @@ -6,6 +6,7 @@ from numpy.distutils.misc_util import get_numpy_include_dirs from numpy.distutils.scons import GetNumpyEnvironment from numpy.distutils.scons import IsMKL, IsFFTW3, IsFFTW2, CheckFFT +from numpy.distutils.scons.configuration import write_info env = GetNumpyEnvironment(ARGUMENTS) @@ -16,7 +17,9 @@ config = env.NumpyConfigure(custom_tests = {'CheckFFT': CheckFFT}) st = config.CheckFFT() config.Finish() +write_info(env) +# Tweak defineds depending on the fft used if st: if IsMKL(env, 'fft'): env.Append(CPPDEFINES = "SCIPY_MKL_H") From scipy-svn at scipy.org Wed Dec 5 02:23:38 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 5 Dec 2007 01:23:38 -0600 (CST) Subject: [Scipy-svn] r3616 - trunk/scipy/sandbox/timeseries/lib Message-ID: <20071205072338.5985639C100@new.scipy.org> Author: pierregm Date: 2007-12-05 01:23:34 -0600 (Wed, 05 Dec 2007) New Revision: 3616 Modified: trunk/scipy/sandbox/timeseries/lib/moving_funcs.py Log: moving_funcs : disabled mov_covar and mov_corr for serious flaw in the approach... Modified: trunk/scipy/sandbox/timeseries/lib/moving_funcs.py =================================================================== --- trunk/scipy/sandbox/timeseries/lib/moving_funcs.py 2007-12-04 08:15:37 UTC (rev 3615) +++ trunk/scipy/sandbox/timeseries/lib/moving_funcs.py 2007-12-05 07:23:34 UTC (rev 3616) @@ -13,7 +13,8 @@ __all__ = ['mov_sum', 'mov_median', 'mov_min', 'mov_max', 'mov_average', 'mov_mean', 'mov_average_expw', - 'mov_stddev', 'mov_var', 'mov_covar', 'mov_corr', + 'mov_stddev', 'mov_var', +# 'mov_covar', 'mov_corr', 'cmov_average', 'cmov_mean', 'cmov_window' ] @@ -179,39 +180,39 @@ return _mov_var_stddev(data=data, span=span, is_variance=0, bias=int(bias), dtype=dtype) #............................................................................... -def mov_covar(x, y, span, bias=False, dtype=None): - """Calculates the moving covariance of two 1-D arrays. - -*Parameters*: - $$x$$ - $$y$$ - $$span$$ - $$bias$$ - $$dtype$$""" - - result = x - mov_average(x, span, dtype=dtype) - result = result * (y - mov_average(y, span, dtype=dtype)) - - if bias: denom = span - else: denom = span - 1 - - return result/denom +#def mov_covar(x, y, span, bias=False, dtype=None): +# """Calculates the moving covariance of two 1-D arrays. +# +#*Parameters*: +# $$x$$ +# $$y$$ +# $$span$$ +# $$bias$$ +# $$dtype$$""" +# +# result = x - mov_average(x, span, dtype=dtype) +# result = result * (y - mov_average(y, span, dtype=dtype)) +# +# if bias: denom = span +# else: denom = span - 1 +# +# return result/denom +##............................................................................... +#def mov_corr(x, y, span, dtype=None): +# """Calculates the moving correlation of two 1-D arrays. +# +#*Parameters*: +# $$x$$ +# $$y$$ +# $$span$$ +# $$dtype$$""" +# +# result = mov_covar(x, y, span, bias=True, dtype=dtype) +# result = result / mov_stddev(x, span, bias=True, dtype=dtype) +# result = result / mov_stddev(y, span, bias=True, dtype=dtype) +# +# return result #............................................................................... -def mov_corr(x, y, span, dtype=None): - """Calculates the moving correlation of two 1-D arrays. - -*Parameters*: - $$x$$ - $$y$$ - $$span$$ - $$dtype$$""" - - result = mov_covar(x, y, span, bias=True, dtype=dtype) - result = result / mov_stddev(x, span, bias=True, dtype=dtype) - result = result / mov_stddev(y, span, bias=True, dtype=dtype) - - return result -#............................................................................... def mov_average_expw(data, span, tol=1e-6): """Calculates the exponentially weighted moving average of a series. From scipy-svn at scipy.org Wed Dec 5 14:12:46 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 5 Dec 2007 13:12:46 -0600 (CST) Subject: [Scipy-svn] r3617 - trunk/scipy/sandbox/multigrid Message-ID: <20071205191246.0613339C0A2@new.scipy.org> Author: wnbell Date: 2007-12-05 13:12:44 -0600 (Wed, 05 Dec 2007) New Revision: 3617 Modified: trunk/scipy/sandbox/multigrid/utils.py Log: removed use of ARPACK changed diagonal scaling Modified: trunk/scipy/sandbox/multigrid/utils.py =================================================================== --- trunk/scipy/sandbox/multigrid/utils.py 2007-12-05 07:23:34 UTC (rev 3616) +++ trunk/scipy/sandbox/multigrid/utils.py 2007-12-05 19:12:44 UTC (rev 3617) @@ -3,21 +3,50 @@ import numpy import scipy -from numpy import ravel,arange,concatenate,tile,asarray,sqrt,diff -from scipy.linalg import norm +from scipy import ravel,arange,concatenate,tile,asarray,sqrt,diff, \ + rand,zeros,empty,asmatrix,dot +from scipy.linalg import norm,eig from scipy.sparse import isspmatrix,isspmatrix_csr,isspmatrix_csc, \ csr_matrix,csc_matrix,extract_diagonal, \ coo_matrix -def approximate_spectral_radius(A,tol=0.1,maxiter=None): +def approximate_spectral_radius(A,tol=0.1,maxiter=8): """ - Approximate the spectral radius of a symmetric matrix using ARPACK + Approximate the spectral radius of a matrix """ - from scipy.sandbox.arpack import eigen - return norm(eigen(A, k=1, ncv=10, which='LM', maxiter=maxiter, tol=tol, return_eigenvectors=False)) + #from scipy.sandbox.arpack import eigen + #return norm(eigen(A, k=1, ncv=10, which='LM', maxiter=maxiter, tol=tol, return_eigenvectors=False)) + + numpy.random.seed(0) #make results deterministic + #TODO profile vs V -> V.T + #TODO make algorithm adaptive + if not isspmatrix(A): + #convert dense arrays to matrix type + A = asmatrix(A) + + v0 = rand(A.shape[0]) + H = zeros((maxiter+1,maxiter)) + V = zeros((A.shape[0],maxiter+1)) + + V[:,0]= v0/norm(v0) + for j in range(maxiter): + w = A * V[:,j] + for i in range(j+1): + H[i,j] = dot(w,V[:,i]) + w -= H[i,j]*V[:,i] + H[j+1,j] = norm(w) + if (H[j+1,j] < 1e-12): break + V[:,j+1] = (1.0/H[j+1,j]) * w + # end + m=j + Heig,tmp = eig(H[0:m,0:m]) + return max( [norm(x) for x in Heig] ) + + + def infinity_norm(A): """ Infinity norm of a sparse matrix (maximum absolute row sum). This serves @@ -55,10 +84,10 @@ raise ValueError,'expected square matrix' D = diag_sparse(A) - mask = D <= 0 + mask = D == 0 - D[mask] = 0 - D_sqrt = sqrt(D) + #D[mask] = 0 + D_sqrt = sqrt(abs(D)) D_sqrt_inv = 1.0/D_sqrt D_sqrt_inv[mask] = 0 From scipy-svn at scipy.org Fri Dec 7 16:38:02 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 7 Dec 2007 15:38:02 -0600 (CST) Subject: [Scipy-svn] r3618 - in trunk/scipy/sandbox/multigrid: . tests Message-ID: <20071207213802.210DC39C019@new.scipy.org> Author: wnbell Date: 2007-12-07 15:37:58 -0600 (Fri, 07 Dec 2007) New Revision: 3618 Modified: trunk/scipy/sandbox/multigrid/tests/test_utils.py trunk/scipy/sandbox/multigrid/utils.py Log: improved approximate_spectral_radius added unittests Modified: trunk/scipy/sandbox/multigrid/tests/test_utils.py =================================================================== --- trunk/scipy/sandbox/multigrid/tests/test_utils.py 2007-12-05 19:12:44 UTC (rev 3617) +++ trunk/scipy/sandbox/multigrid/tests/test_utils.py 2007-12-07 21:37:58 UTC (rev 3618) @@ -3,17 +3,41 @@ import numpy import scipy from numpy import matrix,array,diag,zeros,sqrt +from scipy import rand from scipy.sparse import csr_matrix +from scipy.linalg import norm - set_package_path() -from scipy.sandbox.multigrid.utils import infinity_norm, diag_sparse, \ +from scipy.sandbox.multigrid.utils import approximate_spectral_radius, \ + infinity_norm, diag_sparse, \ symmetric_rescaling, \ expand_into_blocks restore_path() class TestUtils(NumpyTestCase): + def check_approximate_spectral_radius(self): + cases = [] + + cases.append( matrix([[-4]]) ) + cases.append( array([[-4]]) ) + + cases.append( array([[2,0],[0,1]]) ) + cases.append( array([[-2,0],[0,1]]) ) + + cases.append( array([[100,0,0],[0,101,0],[0,0,99]]) ) + + for i in range(1,5): + cases.append( rand(i,i) ) + + # method should be almost exact for small matrices + for A in cases: + Asp = csr_matrix(A) + assert_almost_equal( approximate_spectral_radius(A), norm(A,2) ) + assert_almost_equal( approximate_spectral_radius(Asp), norm(A,2) ) + + #TODO test larger matrices + def check_infinity_norm(self): A = matrix([[-4]]) assert_equal(infinity_norm(csr_matrix(A)),4) Modified: trunk/scipy/sandbox/multigrid/utils.py =================================================================== --- trunk/scipy/sandbox/multigrid/utils.py 2007-12-05 19:12:44 UTC (rev 3617) +++ trunk/scipy/sandbox/multigrid/utils.py 2007-12-07 21:37:58 UTC (rev 3618) @@ -5,48 +5,105 @@ import scipy from scipy import ravel,arange,concatenate,tile,asarray,sqrt,diff, \ rand,zeros,empty,asmatrix,dot -from scipy.linalg import norm,eig +from scipy.linalg import norm,eigvals from scipy.sparse import isspmatrix,isspmatrix_csr,isspmatrix_csc, \ csr_matrix,csc_matrix,extract_diagonal, \ coo_matrix -def approximate_spectral_radius(A,tol=0.1,maxiter=8): +def approximate_spectral_radius(A,tol=0.1,maxiter=10,symmetric=None): + """approximate the spectral radius of a matrix + + *Parameters*: + A : dense or sparse matrix + E.g. csr_matrix, csc_matrix, ndarray, etc. + + tol : {scalar} + Tolerance of approximation + + maxiter : {integer} + Maximum number of iterations to perform + + symmetric : {None,boolean} + True - if A is symmetric + Lanczos iteration is used (more efficient) + False - if A is non-symmetric + Arnoldi iteration is used (less efficient) + None - symmetry of A unknown + Method chosen automatically (default) + *Returns*: + An approximation to the spectral radius of A (scalar value) + """ - Approximate the spectral radius of a matrix - """ #from scipy.sandbox.arpack import eigen #return norm(eigen(A, k=1, ncv=10, which='LM', maxiter=maxiter, tol=tol, return_eigenvectors=False)) + if not isspmatrix(A): + A = asmatrix(A) #convert dense arrays to matrix type + + if A.shape[0] != A.shape[1]: + raise ValueError,'expected square matrix' + + #TODO make method adaptive + numpy.random.seed(0) #make results deterministic - #TODO profile vs V -> V.T - #TODO make algorithm adaptive + v0 = rand(A.shape[1],1) + v0 /= norm(v0) - if not isspmatrix(A): - #convert dense arrays to matrix type - A = asmatrix(A) + H = zeros((maxiter+1,maxiter)) + V = [v0] - v0 = rand(A.shape[0]) - H = zeros((maxiter+1,maxiter)) - V = zeros((A.shape[0],maxiter+1)) - - V[:,0]= v0/norm(v0) + #save past estimates + #estimates = [] + for j in range(maxiter): - w = A * V[:,j] - for i in range(j+1): - H[i,j] = dot(w,V[:,i]) - w -= H[i,j]*V[:,i] - H[j+1,j] = norm(w) - if (H[j+1,j] < 1e-12): break - V[:,j+1] = (1.0/H[j+1,j]) * w - # end - m=j - Heig,tmp = eig(H[0:m,0:m]) - return max( [norm(x) for x in Heig] ) + w = A * V[-1] + + if symmetric: + if j >= 1: + H[j-1,j] = beta + w -= beta * V[-2] + alpha = dot(ravel(w),ravel(V[-1])) + H[j,j] = alpha + w -= alpha * V[-1] + + beta = norm(w) + if (H[j+1,j] < 1e-10): break + + w /= beta + H[j+1,j] = beta + V.append(w) + V = V[-2:] #retain only last two vectors + else: + #orthogonalize against Vs + for i,v in enumerate(V): + H[i,j] = dot(ravel(w),ravel(v)) + w -= H[i,j]*v + H[j+1,j] = norm(w) + if (H[j+1,j] < 1e-10): break + + w /= H[j+1,j] + V.append(w) + + # if upper 2x2 block of Hessenberg matrix H is almost symmetric, + # and the user has not explicitly specified symmetric=False, + # then switch to symmetric Lanczos algorithm + if symmetric is not False and j == 1: + if abs(H[1,0] - H[0,1]) < 1e-12: + symmetric = True + V = V[1:] + H[1,0] = H[0,1] + beta = H[2,1] + + #estimates.append( max( [norm(x) for x in eigvals(H[:j+1,:j+1])] ) ) + return norm(H[:j+1,:j+1],2) + + + def infinity_norm(A): """ Infinity norm of a sparse matrix (maximum absolute row sum). This serves From scipy-svn at scipy.org Fri Dec 7 17:53:00 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 7 Dec 2007 16:53:00 -0600 (CST) Subject: [Scipy-svn] r3619 - in trunk/scipy/sparse: . tests Message-ID: <20071207225300.6D07939C208@new.scipy.org> Author: wnbell Date: 2007-12-07 16:52:56 -0600 (Fri, 07 Dec 2007) New Revision: 3619 Modified: trunk/scipy/sparse/sparse.py trunk/scipy/sparse/tests/test_sparse.py Log: use CSR as fallback sparse format Modified: trunk/scipy/sparse/sparse.py =================================================================== --- trunk/scipy/sparse/sparse.py 2007-12-07 21:37:58 UTC (rev 3618) +++ trunk/scipy/sparse/sparse.py 2007-12-07 22:52:56 UTC (rev 3619) @@ -117,8 +117,7 @@ raise NotImplementedError def astype(self, t): - csc = self.tocsc() - return csc.astype(t) + return self.tocsr().astype(t) def asfptype(self): """Upcast matrix to a floating point format (if necessary)""" @@ -219,9 +218,9 @@ " or shape[0]" def asformat(self, format): - # default converter goes through the CSC format - csc = self.tocsc() - return eval('%s_matrix' % format)(csc) + # default converter goes through the CSR format + csr = self.tocsr() + return eval('%s_matrix' % format)(csr) # default operations use the CSC format as a base # and operations return in csc format @@ -229,40 +228,32 @@ # a tocsc method def __abs__(self): - csc = self.tocsc() - return abs(csc) + return abs(self.tocsr()) def __add__(self, other): # self + other - csc = self.tocsc() - return csc.__add__(other) + return self.tocsr().__add__(other) def __radd__(self, other): # other + self - csc = self.tocsc() - return csc.__radd__(other) + return self.tocsr().__radd__(other) def __sub__(self, other): # self - other #note: this can't be replaced by self + (-other) for unsigned types - csc = self.tocsc() - return csc.__sub__(other) + return self.tocsr().__sub__(other) def __rsub__(self, other): # other - self - csc = self.tocsc() - return csc.__rsub__(other) + return self.tocsr().__rsub__(other) def __mul__(self, other): - csc = self.tocsc() - return csc.__mul__(other) + return self.tocsr().__mul__(other) def __rmul__(self, other): - csc = self.tocsc() - return csc.__rmul__(other) + return self.tocsr().__rmul__(other) def __truediv__(self, other): if isscalarlike(other): return self * (1./other) else: - csc = self.tocsc() - return csc.__truediv__(other) + return self.tocsr().__truediv__(other) def __div__(self, other): # Always do true division @@ -308,28 +299,23 @@ raise AttributeError, attr + " not found" def transpose(self): - csc = self.tocsc() - return csc.transpose() + return self.tocsr().transpose() def conj(self): - csc = self.tocsc() - return csc.conj() + return self.tocsr().conj() def conjugate(self): - csc = self.tocsc() - return csc.conj() + return self.tocsr().conj() # Renamed conjtranspose() -> getH() for compatibility with dense matrices def getH(self): return self.transpose().conj() def _real(self): - csc = self.tocsc() - return csc._real() + return self.tocsr()._real() def _imag(self): - csc = self.tocsc() - return csc._imag() + return self.tocsr()._imag() def getcol(self, j): """Returns a copy of column j of the matrix, as an (m x 1) sparse @@ -377,15 +363,13 @@ def matmat(self, other): - csc = self.tocsc() - return csc.matmat(other) + return self.tocsr().matmat(other) def matvec(self, other): """Multiplies the sparse matrix by the vector 'other', returning a dense vector as a result. """ - csc = self.tocsc() - return csc.matvec(other) + return self.tocsr().matvec(other) def rmatvec(self, other, conjugate=True): """Multiplies the vector 'other' by the sparse matrix, returning a @@ -396,8 +380,7 @@ Otherwise: returns A.transpose() * other. """ - csc = self.tocsc() - return csc.rmatvec(other, conjugate=conjugate) + return self.tocsr().rmatvec(other, conjugate=conjugate) #def rmatmat(self, other, conjugate=True): # """ If 'conjugate' is True: @@ -419,8 +402,7 @@ return csr.toarray() def tocoo(self): - csc = self.tocsc() - return csc.tocoo() + return self.tocsr().tocoo() def tolil(self): return lil_matrix(self.tocsr()) @@ -433,8 +415,7 @@ return new def copy(self): - csc = self.tocsc() - return csc.copy() + return self.tocsr().copy() def sum(self, axis=None): """Sum the matrix over the given axis. If the axis is None, sum Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-07 21:37:58 UTC (rev 3618) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-07 22:52:56 UTC (rev 3619) @@ -1257,9 +1257,9 @@ self.matrices = [] self.matrices.append(('Identity',spidentity(10**5))) - self.matrices.append(('Poisson2d', poisson2d(250))) - self.matrices.append(('Poisson2d', poisson2d(500))) - self.matrices.append(('Poisson2d', poisson2d(1000))) + self.matrices.append(('Poisson5pt', poisson2d(250))) + self.matrices.append(('Poisson5pt', poisson2d(500))) + self.matrices.append(('Poisson5pt', poisson2d(1000))) def bench_matvec(self,level=5): print From scipy-svn at scipy.org Fri Dec 7 21:55:20 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 7 Dec 2007 20:55:20 -0600 (CST) Subject: [Scipy-svn] r3620 - in trunk/scipy/sparse: . tests Message-ID: <20071208025520.B0BA339C181@new.scipy.org> Author: wnbell Date: 2007-12-07 20:54:55 -0600 (Fri, 07 Dec 2007) New Revision: 3620 Modified: trunk/scipy/sparse/sparse.py trunk/scipy/sparse/tests/test_sparse.py Log: added sparse conversion benchmark made CSR/CSC.dtype a property Modified: trunk/scipy/sparse/sparse.py =================================================================== --- trunk/scipy/sparse/sparse.py 2007-12-07 22:52:56 UTC (rev 3619) +++ trunk/scipy/sparse/sparse.py 2007-12-08 02:54:55 UTC (rev 3620) @@ -497,7 +497,6 @@ spmatrix.__init__(self) if isdense(arg1): - self.dtype = getdtype(dtype, arg1) # Convert the dense array or matrix arg1 to sparse format if rank(arg1) == 1: # Convert to a row vector @@ -519,8 +518,7 @@ # create empty matrix self.shape = arg1 #spmatrix checks for errors here M, N = self.shape - self.dtype = getdtype(dtype, default=float) - self.data = zeros((nzmax,), self.dtype) + self.data = zeros((nzmax,), getdtype(dtype, default=float)) self.indices = zeros((nzmax,), intc) if self.format[-1] == 'r': self.indptr = zeros(M+1, dtype='intc') @@ -539,8 +537,7 @@ except: raise ValueError, "unrecognized form for csr_matrix constructor" else: - self.dtype = getdtype(dtype, data) - self.data = array(data, copy=copy, dtype=self.dtype) + self.data = array(data, copy=copy, dtype=getdtype(dtype, data)) self.indices = array(indices, copy=copy) self.indptr = array(indptr, copy=copy) else: @@ -583,9 +580,14 @@ self.indices = other.indices self.indptr = other.indptr self.shape = other.shape - self.dtype = other.data.dtype + def _get_dtype(self): + return self.data.dtype + def _set_dtype(self,newtype): + self.data.dtype = newtype + dtype = property(fget=_get_dtype,fset=_set_dtype) + def _check_format(self, full_check): self.shape = tuple([int(x) for x in self.shape]) # for floats etc. @@ -612,9 +614,6 @@ self.indices = self.indices.astype('intc') self.data = to_native(self.data) - # set the data type - self.dtype = self.data.dtype - # check array shapes if (rank(self.data) != 1) or (rank(self.indices) != 1) or \ (rank(self.indptr) != 1): Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-07 22:52:56 UTC (rev 3619) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-08 02:54:55 UTC (rev 3620) @@ -1290,8 +1290,50 @@ print fmt % (A.format,name,shape,A.nnz,MFLOPs) + def bench_conversion(self,level=5): + A = poisson2d(30).todense() + formats = ['csr','csc','coo','lil','dok'] + + print + print ' Sparse Matrix Conversion' + print '====================================================================' + print ' format | tocsr() | tocsc() | tocoo() | tolil() | todok() ' + print '--------------------------------------------------------------------' + fmt = ' %3s | %5.2fs | %5.2fs | %5.2fs | %5.2fs | %5.2fs | %5.2fs ' + + for fromfmt in formats: + #base = getattr(A,'to' + fromfmt)() + base = eval(fromfmt + '_matrix')(A) + + times = [] + for tofmt in formats: + try: + fn = getattr(base,'to' + tofmt) + except: + times.append(None) + else: + start = time.clock() + iter = 0 + while time.clock() < start + 0.1: + x = fn() + iter += 1 + end = time.clock() + + times.append( (end - start)/float(iter)) + output = " %3s " % fromfmt + for t in times: + if t is None: + output += '| n/a ' + else: + output += '| %9.6f ' % t + print output + + + + + if __name__ == "__main__": NumpyTest().run() From scipy-svn at scipy.org Sat Dec 8 11:12:05 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 8 Dec 2007 10:12:05 -0600 (CST) Subject: [Scipy-svn] r3621 - trunk/scipy/sparse Message-ID: <20071208161205.16FA239C20E@new.scipy.org> Author: wnbell Date: 2007-12-08 10:11:42 -0600 (Sat, 08 Dec 2007) New Revision: 3621 Modified: trunk/scipy/sparse/sparse.py Log: added lil_matrix.tolil() Modified: trunk/scipy/sparse/sparse.py =================================================================== --- trunk/scipy/sparse/sparse.py 2007-12-08 02:54:55 UTC (rev 3620) +++ trunk/scipy/sparse/sparse.py 2007-12-08 16:11:42 UTC (rev 3621) @@ -1316,6 +1316,10 @@ row = searchsorted(self.indptr, ind+1)-1 return (row, col) + +# def tolil(self): +# pass + def tocsr(self, copy=False): return self.toself(copy) @@ -2513,13 +2517,18 @@ # csr -> csc conversion return self.tocsr().transpose() - def tocsr(self, nzmax=None): + def tolil(self, copy=False): + if copy: + return self.copy() + else: + return self + + def tocsr(self): """ Return Compressed Sparse Row format arrays for this matrix. """ nnz = self.getnnz() - nzmax = max(nnz, nzmax) - data = zeros(nzmax, dtype=self.dtype) - colind = zeros(nzmax, dtype=intc) + data = zeros(nnz, dtype=self.dtype) + colind = zeros(nnz, dtype=intc) row_ptr = empty(self.shape[0]+1, dtype=intc) row_ptr[:] = nnz k = 0 @@ -2530,12 +2539,12 @@ k += len(row) row_ptr[-1] = nnz # last row number + 1 - return csr_matrix((data, colind, row_ptr), dims=self.shape, nzmax=nzmax) + return csr_matrix((data, colind, row_ptr), dims=self.shape) - def tocsc(self, nzmax=None): + def tocsc(self): """ Return Compressed Sparse Column format arrays for this matrix. """ - return self.tocsr(nzmax).tocsc() + return self.tocsr().tocsc() From scipy-svn at scipy.org Sat Dec 8 12:31:46 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 8 Dec 2007 11:31:46 -0600 (CST) Subject: [Scipy-svn] r3622 - in trunk/scipy/sparse: . tests Message-ID: <20071208173146.3686539C1B8@new.scipy.org> Author: wnbell Date: 2007-12-08 11:31:07 -0600 (Sat, 08 Dec 2007) New Revision: 3622 Modified: trunk/scipy/sparse/sparse.py trunk/scipy/sparse/tests/test_sparse.py Log: improvements to tolil() Modified: trunk/scipy/sparse/sparse.py =================================================================== --- trunk/scipy/sparse/sparse.py 2007-12-08 16:11:42 UTC (rev 3621) +++ trunk/scipy/sparse/sparse.py 2007-12-08 17:31:07 UTC (rev 3622) @@ -17,7 +17,9 @@ from numpy import zeros, isscalar, real, imag, asarray, asmatrix, matrix, \ ndarray, amax, amin, rank, conj, searchsorted, ndarray, \ less, where, greater, array, transpose, empty, ones, \ - arange, shape, intc, clip, prod, unravel_index, hstack + arange, shape, intc, clip, prod, unravel_index, hstack, \ + array_split + import numpy from scipy.sparse.sparsetools import csrtodense, \ cootocsr, csrtocoo, cootocsc, csctocoo, csctocsr, csrtocsc @@ -405,7 +407,7 @@ return self.tocsr().tocoo() def tolil(self): - return lil_matrix(self.tocsr()) + return self.tocsr().tolil() def toself(self, copy=False): if copy: @@ -1317,9 +1319,27 @@ return (row, col) -# def tolil(self): -# pass + def tolil(self): + lil = lil_matrix(self.shape,dtype=self.dtype) + + #TODO make this more efficient + csr = self.ensure_sorted_indices() + + rows,data = lil.rows,lil.data + ptr,ind,dat = csr.indptr,csr.indices,csr.data + for n in xrange(self.shape[0]): + start = ptr[n] + end = ptr[n+1] + rows[n] = ind[start:end].tolist() + data[n] = dat[start:end].tolist() + + lil.rows = rows + lil.data = data + #lil.shape = self.shape + + return lil + def tocsr(self, copy=False): return self.toself(copy) @@ -2147,7 +2167,7 @@ (self.data) of lists of these elements. """ - def __init__(self, A=None, shape=None, dtype=None): + def __init__(self, A=None, shape=None, dtype=None, copy=False): """ Create a new list-of-lists sparse matrix. An optional argument A is accepted, which initializes the lil_matrix with it. This can be a tuple of dimensions (M, N) or a dense array / @@ -2163,50 +2183,42 @@ if not isshape(shape): raise TypeError, "need a valid shape" M, N = shape + self.shape = (M,N) + self.rows = numpy.empty((M,), dtype=object) + self.data = numpy.empty((M,), dtype=object) + for i in range(M): + self.rows[i] = [] + self.data[i] = [] else: if isshape(A): M, N = A - A = None + self.shape = (M,N) + self.rows = numpy.empty((M,), dtype=object) + self.data = numpy.empty((M,), dtype=object) + for i in range(M): + self.rows[i] = [] + self.data[i] = [] else: - if not isdense(A): - # A is not dense. If it's a spmatrix, ensure it's a - # csr_matrix or lil_matrix, which are the only types that - # support row slices. - if isinstance(A, spmatrix): - if not isinstance(A, lil_matrix) and \ - not isinstance(A, csr_matrix): - raise TypeError, "unsupported matrix type" - - # Otherwise, try converting to a matrix. So if it's - # a list (rank 1), it will become a row vector + if isspmatrix(A): + if isspmatrix_lil(A) and copy: + A = A.copy() else: - try: - A = asmatrix(A) - except TypeError: - raise TypeError, "unsupported matrix type" - elif rank(A) == 1: - # Construct a row vector - A = asmatrix(A) - if rank(A) != 2: - raise ValueError, "can only initialize with a rank 1 or" \ - " 2 array" - if shape is None: - shape = (None, None) # simplifies max() operation - M = max(shape[0], A.shape[0]) - N = max(shape[1], A.shape[1]) - self.shape = (M, N) + A = A.tolil() + else: + #assume A is dense + try: + A = asmatrix(A) + except TypeError: + raise TypeError, "unsupported matrix type" + else: + A = csr_matrix(A).tolil() + + #A is a lil matrix + self.shape = A.shape + self.dtype = A.dtype + self.rows = A.rows + self.data = A.data - # Pluck out all non-zeros from the dense array/matrix A - self.rows = numpy.empty((M,), dtype=object) - self.data = numpy.empty((M,), dtype=object) - for i in range(M): - self.rows[i] = [] - self.data[i] = [] - - if A is not None: - for i in xrange(A.shape[0]): - self[i, :] = A[i, :] - def __iadd__(self,other): self[:,:] = self + other return self Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-08 16:11:42 UTC (rev 3621) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-08 17:31:07 UTC (rev 3622) @@ -280,6 +280,10 @@ a = self.datsp.tocoo() assert_array_almost_equal(a.todense(), self.dat) + def check_tolil(self): + a = self.datsp.tolil() + assert_array_almost_equal(a.todense(), self.dat) + def check_tocsc(self): a = self.datsp.tocsc() assert_array_almost_equal(a.todense(), self.dat) @@ -1332,8 +1336,5 @@ print output - - - if __name__ == "__main__": NumpyTest().run() From scipy-svn at scipy.org Sat Dec 8 16:06:53 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 8 Dec 2007 15:06:53 -0600 (CST) Subject: [Scipy-svn] r3623 - in trunk/scipy/sparse: . tests Message-ID: <20071208210653.E140C39C04D@new.scipy.org> Author: wnbell Date: 2007-12-08 15:06:07 -0600 (Sat, 08 Dec 2007) New Revision: 3623 Modified: trunk/scipy/sparse/sparse.py trunk/scipy/sparse/tests/test_sparse.py Log: improved lil_matrix.tocsr() added construction benchmark Modified: trunk/scipy/sparse/sparse.py =================================================================== --- trunk/scipy/sparse/sparse.py 2007-12-08 17:31:07 UTC (rev 3622) +++ trunk/scipy/sparse/sparse.py 2007-12-08 21:06:07 UTC (rev 3623) @@ -18,7 +18,7 @@ ndarray, amax, amin, rank, conj, searchsorted, ndarray, \ less, where, greater, array, transpose, empty, ones, \ arange, shape, intc, clip, prod, unravel_index, hstack, \ - array_split + array_split, concatenate, cumsum import numpy from scipy.sparse.sparsetools import csrtodense, \ @@ -1922,6 +1922,10 @@ else: raise TypeError, "need a dense vector" +# def tocoo(self): +# """ Return a copy of this matrix in COOrdinate format""" + + def tocsr(self, nzmax=None): """ Return Compressed Sparse Row format arrays for this matrix """ @@ -2538,21 +2542,24 @@ def tocsr(self): """ Return Compressed Sparse Row format arrays for this matrix. """ - nnz = self.getnnz() - data = zeros(nnz, dtype=self.dtype) - colind = zeros(nnz, dtype=intc) - row_ptr = empty(self.shape[0]+1, dtype=intc) - row_ptr[:] = nnz - k = 0 - for i, row in enumerate(self.rows): - data[k : k+len(row)] = self.data[i] - colind[k : k+len(row)] = self.rows[i] - row_ptr[i] = k - k += len(row) + + indptr = asarray([len(x) for x in self.rows], dtype=intc) + indptr = concatenate( ( array([0],dtype=intc), cumsum(indptr) ) ) + + nnz = indptr[-1] + + indices = [] + for x in self.rows: + indices.extend(x) + indices = asarray(indices,dtype=intc) - row_ptr[-1] = nnz # last row number + 1 - return csr_matrix((data, colind, row_ptr), dims=self.shape) + data = [] + for x in self.data: + data.extend(x) + data = asarray(data,dtype=self.dtype) + return csr_matrix((data, indices, indptr), dims=self.shape) + def tocsc(self): """ Return Compressed Sparse Column format arrays for this matrix. """ Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-08 17:31:07 UTC (rev 3622) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-08 21:06:07 UTC (rev 3623) @@ -1257,15 +1257,15 @@ import time class TestSparseTools(NumpyTestCase): - def setUp(self): - self.matrices = [] + """Simple benchmarks for sparse matrix module""" - self.matrices.append(('Identity',spidentity(10**5))) - self.matrices.append(('Poisson5pt', poisson2d(250))) - self.matrices.append(('Poisson5pt', poisson2d(500))) - self.matrices.append(('Poisson5pt', poisson2d(1000))) + def bench_matvec(self,level=5): + matrices = [] + matrices.append(('Identity',spidentity(10**5))) + matrices.append(('Poisson5pt', poisson2d(250))) + matrices.append(('Poisson5pt', poisson2d(500))) + matrices.append(('Poisson5pt', poisson2d(1000))) - def bench_matvec(self,level=5): print print ' Sparse Matrix Vector Product' print '==================================================================' @@ -1273,7 +1273,7 @@ print '------------------------------------------------------------------' fmt = ' %3s | %12s | %20s | %8d | %6.1f ' - for name,A in self.matrices: + for name,A in matrices: A = A.tocsr() x = ones(A.shape[1],dtype=A.dtype) @@ -1293,7 +1293,41 @@ print fmt % (A.format,name,shape,A.nnz,MFLOPs) - + def bench_matvec(self,level=5): + """build matrices by inserting single values""" + matrices = [] + matrices.append( ('Empty',csr_matrix((10000,10000))) ) + matrices.append( ('Identity',spidentity(10000)) ) + matrices.append( ('Poisson5pt', poisson2d(100)) ) + + print + print ' Sparse Matrix Construction' + print '====================================================================' + print ' type | name | shape | nnz | time (sec) ' + print '--------------------------------------------------------------------' + fmt = ' %3s | %12s | %20s | %8d | %6.4f ' + + for name,A in matrices: + A = A.tocoo() + + for format in ['lil','dok']: + + start = time.clock() + + iter = 0 + while time.clock() < start + 0.1: + T = eval(format + '_matrix')(A.shape) + for i,j,v in zip(A.row,A.col,A.data): + T[i,j] = v + iter += 1 + end = time.clock() + + name = name.center(12) + shape = ("%s" % (A.shape,)).center(20) + + print fmt % (format,name,shape,A.nnz,(end-start)/float(iter)) + + def bench_conversion(self,level=5): A = poisson2d(30).todense() From scipy-svn at scipy.org Sat Dec 8 16:23:38 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 8 Dec 2007 15:23:38 -0600 (CST) Subject: [Scipy-svn] r3624 - trunk/scipy/sparse Message-ID: <20071208212338.0A6E639C0AA@new.scipy.org> Author: wnbell Date: 2007-12-08 15:23:31 -0600 (Sat, 08 Dec 2007) New Revision: 3624 Modified: trunk/scipy/sparse/sparse.py Log: improved dok_matrix.tocoo() ( and tocsr(), tocsc() ) Modified: trunk/scipy/sparse/sparse.py =================================================================== --- trunk/scipy/sparse/sparse.py 2007-12-08 21:06:07 UTC (rev 3623) +++ trunk/scipy/sparse/sparse.py 2007-12-08 21:23:31 UTC (rev 3624) @@ -1922,69 +1922,22 @@ else: raise TypeError, "need a dense vector" -# def tocoo(self): -# """ Return a copy of this matrix in COOrdinate format""" + def tocoo(self): + """ Return a copy of this matrix in COOrdinate format""" + data = asarray(self.values(),dtype=self.dtype) + indices = asarray(self.keys(),dtype=intc).T + return coo_matrix((data,indices),dims=self.shape,dtype=self.dtype) - def tocsr(self, nzmax=None): - """ Return Compressed Sparse Row format arrays for this matrix - """ - keys = self.keys() - keys.sort() + def tocsr(self): + """ Return a copy of this matrix in Compressed Sparse Row format""" + return self.tocoo().tocsr() - nnz = len(keys) - nzmax = max(nnz, nzmax) - data = zeros(nzmax, dtype=self.dtype) - colind = zeros(nzmax, dtype=intc) - # Empty rows will leave row_ptr dangling. We assign row_ptr[i] - # for each empty row i to point off the end. Is this sufficient?? - row_ptr = empty(self.shape[0]+1, dtype=intc) - row_ptr[:] = nnz - current_row = -1 - k = 0 - for key in keys: - ikey0 = int(key[0]) - ikey1 = int(key[1]) - if ikey0 != current_row: - row_ptr[current_row+1:ikey0+1] = k - current_row = ikey0 - data[k] = dict.__getitem__(self, key) - colind[k] = ikey1 - k += 1 - data = array(data) - colind = array(colind) - row_ptr = array(row_ptr) - return csr_matrix((data, colind, row_ptr), dims=self.shape, nzmax=nzmax) - - def tocsc(self, nzmax=None): - """ Return Compressed Sparse Column format arrays for this matrix - """ + def tocsc(self): + """ Return a copy of this matrix in Compressed Sparse Column format""" # Fast sort on columns using the Schwartzian transform - keys = [(k[1], k[0]) for k in self.keys()] - keys.sort() - keys = [(k[1], k[0]) for k in keys] + return self.tocoo().tocsc() - nnz = len(keys) - nzmax = max(nnz, nzmax) - data = zeros(nzmax, dtype=self.dtype) - rowind = zeros(nzmax, dtype=intc) - # Empty columns will leave col_ptr dangling. We assign col_ptr[j] - # for each empty column j to point off the end. Is this sufficient?? - col_ptr = empty(self.shape[1]+1, dtype=intc) - col_ptr[:] = nnz - current_col = -1 - k = 0 - for key in keys: - ikey0 = int(key[0]) - ikey1 = int(key[1]) - if ikey1 != current_col: - col_ptr[current_col+1:ikey1+1] = k - current_col = ikey1 - data[k] = self[key] - rowind[k] = ikey0 - k += 1 - return csc_matrix((data, rowind, col_ptr), dims=self.shape, nzmax=nzmax) - def toarray(self): new = zeros(self.shape, dtype=self.dtype) for key in self.keys(): From scipy-svn at scipy.org Sat Dec 8 16:58:02 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 8 Dec 2007 15:58:02 -0600 (CST) Subject: [Scipy-svn] r3625 - in trunk/scipy/sparse: . tests Message-ID: <20071208215802.07EB639C1B8@new.scipy.org> Author: wnbell Date: 2007-12-08 15:57:23 -0600 (Sat, 08 Dec 2007) New Revision: 3625 Modified: trunk/scipy/sparse/sparse.py trunk/scipy/sparse/tests/test_sparse.py Log: added todok() Modified: trunk/scipy/sparse/sparse.py =================================================================== --- trunk/scipy/sparse/sparse.py 2007-12-08 21:23:31 UTC (rev 3624) +++ trunk/scipy/sparse/sparse.py 2007-12-08 21:57:23 UTC (rev 3625) @@ -403,6 +403,9 @@ csr = self.tocsr() return csr.toarray() + def todok(self): + return self.tocoo().todok() + def tocoo(self): return self.tocsr().tocoo() @@ -1404,7 +1407,7 @@ structure for constructing sparse matrices for conversion to other sparse matrix types. """ - def __init__(self, A=None, shape=None, dtype=None): + def __init__(self, A=None, shape=None, dtype=None, copy=False): """ Create a new dictionary-of-keys sparse matrix. An optional argument A is accepted, which initializes the dok_matrix with it. This can be a tuple of dimensions (M, N) or a (dense) array @@ -1423,21 +1426,17 @@ elif isspmatrix(A): # For sparse matrices, this is too inefficient; we need # something else. - raise NotImplementedError, "initializing a dok_matrix with " \ - "a sparse matrix is not yet supported" + if isspmatrix_dok(A) and copy: + A = A.copy() + else: + A = A.todok() + self.update( A ) + self.shape = A.shape + self.dtype = A.dtype elif isdense(A): - # Convert to a (1 x n) row vector - if rank(A) == 1: - A = A.reshape(1, len(A)) - if rank(A) == 2: - M, N = A.shape - self.shape = (M, N) - for i in xrange(M): - for j in xrange(N): - if A[i, j] != 0: - self[i, j] = A[i, j] - else: - raise ValueError, "dense array must have rank 1 or 2" + self.update( coo_matrix(A).todok() ) + self.shape = A.shape + self.dtype = A.dtype else: raise TypeError, "argument should be a tuple of dimensions " \ "or a sparse or dense matrix" @@ -1928,6 +1927,11 @@ indices = asarray(self.keys(),dtype=intc).T return coo_matrix((data,indices),dims=self.shape,dtype=self.dtype) + def todok(self,copy=False): + if copy: + return self.copy() + else: + return self def tocsr(self): """ Return a copy of this matrix in Compressed Sparse Row format""" @@ -2115,7 +2119,12 @@ def tocoo(self, copy=False): return self.toself(copy) + def todok(self): + dok = dok_matrix((self.shape),dtype=self.dtype) + dok.update( zip(zip(self.row,self.col),self.data) ) + return dok + class lil_matrix(spmatrix): """Row-based linked list matrix, by Ed Schofield. Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-08 21:23:31 UTC (rev 3624) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-08 21:57:23 UTC (rev 3625) @@ -284,6 +284,10 @@ a = self.datsp.tolil() assert_array_almost_equal(a.todense(), self.dat) + def check_todok(self): + a = self.datsp.todok() + assert_array_almost_equal(a.todense(), self.dat) + def check_tocsc(self): a = self.datsp.tocsc() assert_array_almost_equal(a.todense(), self.dat) @@ -1338,7 +1342,6 @@ print '====================================================================' print ' format | tocsr() | tocsc() | tocoo() | tolil() | todok() ' print '--------------------------------------------------------------------' - fmt = ' %3s | %5.2fs | %5.2fs | %5.2fs | %5.2fs | %5.2fs | %5.2fs ' for fromfmt in formats: #base = getattr(A,'to' + fromfmt)() @@ -1366,7 +1369,7 @@ if t is None: output += '| n/a ' else: - output += '| %9.6f ' % t + output += '| %9.7f ' % t print output From scipy-svn at scipy.org Sun Dec 9 02:01:06 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 9 Dec 2007 01:01:06 -0600 (CST) Subject: [Scipy-svn] r3626 - trunk/scipy/sparse/tests Message-ID: <20071209070106.936D739C04F@new.scipy.org> Author: wnbell Date: 2007-12-09 01:00:42 -0600 (Sun, 09 Dec 2007) New Revision: 3626 Modified: trunk/scipy/sparse/tests/test_sparse.py Log: revised unittest benchmark Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-08 21:57:23 UTC (rev 3625) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-09 07:00:42 UTC (rev 3626) @@ -1297,7 +1297,7 @@ print fmt % (A.format,name,shape,A.nnz,MFLOPs) - def bench_matvec(self,level=5): + def bench_construction(self,level=5): """build matrices by inserting single values""" matrices = [] matrices.append( ('Empty',csr_matrix((10000,10000))) ) @@ -1333,19 +1333,18 @@ def bench_conversion(self,level=5): - A = poisson2d(30).todense() + A = poisson2d(80) formats = ['csr','csc','coo','lil','dok'] print - print ' Sparse Matrix Conversion' - print '====================================================================' - print ' format | tocsr() | tocsc() | tocoo() | tolil() | todok() ' - print '--------------------------------------------------------------------' + print ' Sparse Matrix Conversion' + print '==========================================================' + print ' format | tocsr() | tocsc() | tocoo() | tolil() | todok() ' + print '----------------------------------------------------------' for fromfmt in formats: - #base = getattr(A,'to' + fromfmt)() - base = eval(fromfmt + '_matrix')(A) + base = getattr(A,'to' + fromfmt)() times = [] @@ -1357,7 +1356,7 @@ else: start = time.clock() iter = 0 - while time.clock() < start + 0.1: + while time.clock() < start + 0.2: x = fn() iter += 1 end = time.clock() @@ -1369,7 +1368,7 @@ if t is None: output += '| n/a ' else: - output += '| %9.7f ' % t + output += '| %7.5f ' % t print output From scipy-svn at scipy.org Mon Dec 10 15:47:44 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 10 Dec 2007 14:47:44 -0600 (CST) Subject: [Scipy-svn] r3627 - in trunk/scipy/sparse: . sparsetools tests Message-ID: <20071210204744.B1EE139C261@new.scipy.org> Author: wnbell Date: 2007-12-10 14:46:04 -0600 (Mon, 10 Dec 2007) New Revision: 3627 Modified: trunk/scipy/sparse/sparse.py trunk/scipy/sparse/sparsetools/sparsetools.h trunk/scipy/sparse/sparsetools/sparsetools.i trunk/scipy/sparse/sparsetools/sparsetools.py trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx trunk/scipy/sparse/tests/test_sparse.py Log: anged sparsetools to use preallocated storage Modified: trunk/scipy/sparse/sparse.py =================================================================== --- trunk/scipy/sparse/sparse.py 2007-12-09 07:00:42 UTC (rev 3626) +++ trunk/scipy/sparse/sparse.py 2007-12-10 20:46:04 UTC (rev 3627) @@ -18,11 +18,11 @@ ndarray, amax, amin, rank, conj, searchsorted, ndarray, \ less, where, greater, array, transpose, empty, ones, \ arange, shape, intc, clip, prod, unravel_index, hstack, \ - array_split, concatenate, cumsum + array_split, concatenate, cumsum, diff, empty_like import numpy from scipy.sparse.sparsetools import csrtodense, \ - cootocsr, csrtocoo, cootocsc, csctocoo, csctocsr, csrtocsc + cootocsr, cootocsc, csctocsr, csrtocsc import sparsetools import itertools, operator, copy @@ -888,17 +888,8 @@ # else: # raise TypeError,'unrecognized type' - def tocoo(self): - #TODO implement with arange(N).repeat(diff(indptr)) - fn = getattr(sparsetools, self.format + 'tocoo') - - rows, cols, data = fn(self.shape[0], self.shape[1], \ - self.indptr, self.indices, self.data) - return coo_matrix((data, (rows, cols)), self.shape) - - def sum(self, axis=None): """Sum the matrix over the given axis. If the axis is None, sum over both rows and columns, returning a scalar. @@ -1150,12 +1141,38 @@ def _tothis(self, other): return other.tocsc() - + def tocsr(self): - indptr, colind, data = csctocsr(self.shape[0], self.shape[1], \ - self.indptr, self.indices, self.data) - return csr_matrix((data, colind, indptr), self.shape) + indptr = empty(self.shape[0] + 1, dtype=intc) + indices = empty(self.nnz, dtype=intc) + data = empty(self.nnz, dtype=self.dtype) + csctocsr(self.shape[0], self.shape[1], \ + self.indptr, self.indices, self.data, \ + indptr, indices, data) + + return csr_matrix((data, indices, indptr), self.shape) + + + def tocoo(self,copy=True): + """Return a COOrdinate representation of this matrix + + When copy=False the index and data arrays are not copied. + """ + M,N = self.shape + + data = self.data[:self.nnz].copy() + row = self.indices[:self.nnz].copy() + + if copy: + data = data.copy() + row = row.copy() + + col = empty_like(row) + sparsetools.expandptr(N,self.indptr,col) + + return coo_matrix((data,(row,col)), self.shape) + def toarray(self): return self.tocsr().toarray() @@ -1347,10 +1364,36 @@ return self.toself(copy) def tocsc(self): - indptr, rowind, data = csrtocsc(self.shape[0], self.shape[1], \ - self.indptr, self.indices, self.data) - return csc_matrix((data, rowind, indptr), self.shape) + indptr = empty(self.shape[1] + 1, dtype=intc) + indices = empty(self.nnz, dtype=intc) + data = empty(self.nnz, self.dtype) + csrtocsc(self.shape[0], self.shape[1], \ + self.indptr, self.indices, self.data, \ + indptr, indices, data) + + return csc_matrix((data, indices, indptr), self.shape) + + def tocoo(self,copy=True): + """Return a COOrdinate representation of this matrix + + When copy=False the index and data arrays are not copied. + """ + M,N = self.shape + + data = self.data[:self.nnz].copy() + col = self.indices[:self.nnz].copy() + + if copy: + data = data.copy() + col = col.copy() + + row = empty_like(col) + sparsetools.expandptr(M,self.indptr,row) + + return coo_matrix((data,(row,col)), self.shape) + + def _toother(self): return self.tocsc() @@ -2101,21 +2144,31 @@ if self.nnz == 0: return csc_matrix(self.shape, dtype=self.dtype) else: - indptr, rowind, data = cootocsc(self.shape[0], self.shape[1], \ - self.nnz, self.row, self.col, \ - self.data) - return csc_matrix((data, rowind, indptr), self.shape) + indptr = empty(self.shape[1] + 1,dtype=intc) + indices = empty(self.nnz, dtype=intc) + data = empty(self.nnz, dtype=self.dtype) + cootocsc(self.shape[0], self.shape[1], self.nnz, \ + self.row, self.col, self.data, \ + indptr, indices, data) + return csc_matrix((data, indices, indptr), self.shape) + + def tocsr(self): if self.nnz == 0: return csr_matrix(self.shape, dtype=self.dtype) else: - indptr, colind, data = cootocsr(self.shape[0], self.shape[1], \ - self.nnz, self.row, self.col, \ - self.data) - return csr_matrix((data, colind, indptr), self.shape) + indptr = empty(self.shape[0] + 1,dtype=intc) + indices = empty(self.nnz, dtype=intc) + data = empty(self.nnz, dtype=self.dtype) + cootocsr(self.shape[0], self.shape[1], self.nnz, \ + self.row, self.col, self.data, \ + indptr, indices, data) + + return csr_matrix((data, indices, indptr), self.shape) + def tocoo(self, copy=False): return self.toself(copy) Modified: trunk/scipy/sparse/sparsetools/sparsetools.h =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.h 2007-12-09 07:00:42 UTC (rev 3626) +++ trunk/scipy/sparse/sparsetools/sparsetools.h 2007-12-10 20:46:04 UTC (rev 3627) @@ -72,6 +72,38 @@ /* + * Expand a compressed row pointer into a row array + * + * Input Arguments: + * I n_row - number of rows in A + * I Ap[n_row+1] - row pointer + * + * Output Arguments: + * Bi - row indices + * + * Note: + * Output array Bi needs to be preallocated + * + * Note: + * Complexity: Linear. + * + */ +template +void expandptr(const I n_row, + const I Ap[], + I Bi[]) +{ + for(I i = 0; i < n_row; i++){ + I row_start = Ap[i]; + I row_end = Ap[i+1]; + for(I jj = row_start; jj < row_end; jj++){ + Bi[jj] = i; + } + } +} + + +/* * Compute B = A for CSR matrix A, CSC matrix B * * Also, with the appropriate arguments can also be used to: @@ -87,12 +119,12 @@ * T Ax[nnz(A)] - nonzeros * * Output Arguments: - * vec Bp - row pointer - * vec Bj - column indices - * vec Bx - nonzeros + * I Bp[n_col+1] - column pointer + * I Bj[nnz(A)] - row indices + * T Bx[nnz(A)] - nonzeros * * Note: - * Output arrays Bp,Bj,Bx will be allocated within in the method + * Output arrays Bp,Bj,Bx should be preallocated * * Note: * Input: column indices *are not* assumed to be in sorted order @@ -107,42 +139,39 @@ const I Ap[], const I Aj[], const T Ax[], - std::vector* Bp, - std::vector* Bi, - std::vector* Bx) + I Bp[], + I Bi[], + T Bx[]) { I NNZ = Ap[n_row]; - Bp->resize(n_col+1); - Bi->resize(NNZ); - Bx->resize(NNZ); + std::vector temp(n_col,0); //temp array - std::vector nnz_per_col(n_col,0); //temp array - //compute number of non-zero entries per column of A for (I i = 0; i < NNZ; i++){ - nnz_per_col[Aj[i]]++; + temp[Aj[i]]++; } - //cumsum the nnz_per_col to get Bp[] + //cumsum the nnz per column to get Bp[] for(I i = 0, cumsum = 0; i < n_col; i++){ - (*Bp)[i] = cumsum; - cumsum += nnz_per_col[i]; - nnz_per_col[i] = 0; //reset count + Bp[i] = cumsum; + cumsum += temp[i]; } - (*Bp)[n_col] = NNZ; + Bp[n_col] = NNZ; + std::copy(Bp, Bp + n_col, temp.begin()); + for(I i = 0; i < n_row; i++){ I row_start = Ap[i]; I row_end = Ap[i+1]; for(I j = row_start; j < row_end; j++){ I col = Aj[j]; - I k = (*Bp)[col] + nnz_per_col[col]; + I k = temp[col]; - (*Bi)[k] = i; - (*Bx)[k] = Ax[j]; + Bi[k] = i; + Bx[k] = Ax[j]; - nnz_per_col[col]++; + temp[col]++; } } } @@ -510,24 +539,25 @@ * * * Input Arguments: - * I n_row - number of rows in A - * I n_col - number of columns in A - * I Ai[nnz(A)] - row indices - * I Aj[nnz(A)] - column indices - * T Ax[nnz(A)] - nonzeros + * I n_row - number of rows in A + * I n_col - number of columns in A + * I Ai[nnz(A)] - row indices + * I Aj[nnz(A)] - column indices + * T Ax[nnz(A)] - nonzeros * Output Arguments: - * vec Bp - row pointer - * vec Bj - column indices - * vec Bx - nonzeros + * I Bp - row pointer + * I Bj - column indices + * T Bx - nonzeros * * Note: - * Output arrays Bp,Bj,Bx will be allocated within in the method + * Output arrays Bp,Bj,Bx should be preallocated * * Note: * Input: row and column indices *are not* assumed to be ordered * duplicate (i,j) entries will be summed together - * + * * Output: CSR column indices *will be* in sorted order + * Bp[n_row] will store the number of nonzeros * * Complexity: Linear. Specifically O(nnz(A) + max(n_row,n_col)) * @@ -539,45 +569,37 @@ const I Ai[], const I Aj[], const T Ax[], - std::vector* Bp, - std::vector* Bj, - std::vector* Bx) + I Bp[], + I Bj[], + T Bx[]) { - Bp->resize(n_row+1,0); - Bj->resize(NNZ); - Bx->resize(NNZ); - - std::vector nnz_per_row(n_row,0); //temp array + std::vector temp(n_row,0); //compute nnz per row, then compute Bp for(I i = 0; i < NNZ; i++){ - nnz_per_row[Ai[i]]++; + temp[Ai[i]]++; } - for(I i = 0, cumsum = 0; i < n_row; i++){ - (*Bp)[i] = cumsum; - cumsum += nnz_per_row[i]; - nnz_per_row[i] = 0; //reset count + //cumsum the nnz per row to get Bp[] + for(I i = 0, cumsum = 0; i < n_row; i++){ + Bp[i] = cumsum; + cumsum += temp[i]; } - (*Bp)[n_row] = NNZ; + Bp[n_row] = NNZ; + std::copy(Bp, Bp + n_row, temp.begin()); - - //write Aj,Ax Io tempBj,tempBx + //write Aj,Ax into Bj,Bx for(I i = 0; i < NNZ; i++){ I row = Ai[i]; - I n = (*Bp)[row] + nnz_per_row[row]; + I n = temp[row]; - (*Bj)[n] = Aj[i]; - (*Bx)[n] = Ax[i]; + Bj[n] = Aj[i]; + Bx[n] = Ax[i]; - nnz_per_row[row]++; + temp[row]++; } - //now tempBp,tempBj,tempBx form a CSR representation (with duplicates) + //now Bp,Bj,Bx form a CSR representation (with duplicates) - sum_csr_duplicates(n_row,n_col,&(*Bp)[0],&(*Bj)[0],&(*Bx)[0]); - - //trim unused space at the end - Bj->resize(Bp->back()); - Bx->resize(Bp->back()); + sum_csr_duplicates(n_row,n_col,Bp,Bj,Bx); } @@ -933,9 +955,9 @@ const I Ap[], const I Ai[], const T Ax[], - std::vector* Bp, - std::vector* Bj, - std::vector* Bx) + I Bp[], + I Bj[], + T Bx[]) { csrtocsc(n_col,n_row,Ap,Ai,Ax,Bp,Bj,Bx); } template @@ -970,9 +992,9 @@ const I Ai[], const I Aj[], const T Ax[], - std::vector* Bp, - std::vector* Bi, - std::vector* Bx) + I Bp[], + I Bi[], + T Bx[]) { cootocsr(n_col,n_row,NNZ,Aj,Ai,Ax,Bp,Bi,Bx); } Modified: trunk/scipy/sparse/sparsetools/sparsetools.i =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.i 2007-12-09 07:00:42 UTC (rev 3626) +++ trunk/scipy/sparse/sparsetools/sparsetools.i 2007-12-10 20:46:04 UTC (rev 3627) @@ -90,13 +90,17 @@ %define I_INPLACE_ARRAY1( ctype ) %apply ctype * INPLACE_ARRAY { ctype Ap [ ], - ctype Aj [ ] + ctype Aj [ ], + ctype Bp [ ], + ctype Bi [ ], + ctype Bj [ ] }; %enddef %define T_INPLACE_ARRAY1( ctype ) %apply ctype * INPLACE_ARRAY { - ctype Ax [ ] + ctype Ax [ ], + ctype Bx [ ] }; %enddef @@ -164,6 +168,8 @@ %enddef + + /* * diag(CSR) and diag(CSC) */ @@ -180,8 +186,9 @@ /* * CSR<->COO and CSC<->COO */ -INSTANTIATE_ALL(csrtocoo) -INSTANTIATE_ALL(csctocoo) +%template(expandptr) expandptr; +/*INSTANTIATE_ALL(csrtocoo)*/ +/*INSTANTIATE_ALL(csctocoo)*/ INSTANTIATE_ALL(cootocsr) INSTANTIATE_ALL(cootocsc) Modified: trunk/scipy/sparse/sparsetools/sparsetools.py =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.py 2007-12-09 07:00:42 UTC (rev 3626) +++ trunk/scipy/sparse/sparsetools/sparsetools.py 2007-12-10 20:46:04 UTC (rev 3627) @@ -49,7 +49,11 @@ +def expandptr(*args): + """expandptr(int n_row, int Ap, int Bi)""" + return _sparsetools.expandptr(*args) + def extract_csr_diagonal(*args): """ extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, signed char Ax, @@ -91,176 +95,92 @@ def csrtocsc(*args): """ csrtocsc(int n_row, int n_col, int Ap, int Aj, signed char Ax, - std::vector<(int)> Bp, std::vector<(int)> Bi, - std::vector<(signed char)> Bx) + int Bp, int Bi, signed char Bx) csrtocsc(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, - std::vector<(int)> Bp, std::vector<(int)> Bi, - std::vector<(unsigned char)> Bx) - csrtocsc(int n_row, int n_col, int Ap, int Aj, short Ax, std::vector<(int)> Bp, - std::vector<(int)> Bi, std::vector<(short)> Bx) - csrtocsc(int n_row, int n_col, int Ap, int Aj, int Ax, std::vector<(int)> Bp, - std::vector<(int)> Bi, std::vector<(int)> Bx) + int Bp, int Bi, unsigned char Bx) + csrtocsc(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, + int Bi, short Bx) + csrtocsc(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, + int Bi, int Bx) csrtocsc(int n_row, int n_col, int Ap, int Aj, long long Ax, - std::vector<(int)> Bp, std::vector<(int)> Bi, - std::vector<(long long)> Bx) - csrtocsc(int n_row, int n_col, int Ap, int Aj, float Ax, std::vector<(int)> Bp, - std::vector<(int)> Bi, std::vector<(float)> Bx) - csrtocsc(int n_row, int n_col, int Ap, int Aj, double Ax, std::vector<(int)> Bp, - std::vector<(int)> Bi, std::vector<(double)> Bx) + int Bp, int Bi, long long Bx) + csrtocsc(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, + int Bi, float Bx) + csrtocsc(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, + int Bi, double Bx) csrtocsc(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, - std::vector<(int)> Bp, std::vector<(int)> Bi, - std::vector<(npy_cfloat_wrapper)> Bx) + int Bp, int Bi, npy_cfloat_wrapper Bx) csrtocsc(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, - std::vector<(int)> Bp, std::vector<(int)> Bi, - std::vector<(npy_cdouble_wrapper)> Bx) + int Bp, int Bi, npy_cdouble_wrapper Bx) """ return _sparsetools.csrtocsc(*args) def csctocsr(*args): """ csctocsr(int n_row, int n_col, int Ap, int Ai, signed char Ax, - std::vector<(int)> Bp, std::vector<(int)> Bj, - std::vector<(signed char)> Bx) + int Bp, int Bj, signed char Bx) csctocsr(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, - std::vector<(int)> Bp, std::vector<(int)> Bj, - std::vector<(unsigned char)> Bx) - csctocsr(int n_row, int n_col, int Ap, int Ai, short Ax, std::vector<(int)> Bp, - std::vector<(int)> Bj, std::vector<(short)> Bx) - csctocsr(int n_row, int n_col, int Ap, int Ai, int Ax, std::vector<(int)> Bp, - std::vector<(int)> Bj, std::vector<(int)> Bx) + int Bp, int Bj, unsigned char Bx) + csctocsr(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, + int Bj, short Bx) + csctocsr(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, + int Bj, int Bx) csctocsr(int n_row, int n_col, int Ap, int Ai, long long Ax, - std::vector<(int)> Bp, std::vector<(int)> Bj, - std::vector<(long long)> Bx) - csctocsr(int n_row, int n_col, int Ap, int Ai, float Ax, std::vector<(int)> Bp, - std::vector<(int)> Bj, std::vector<(float)> Bx) - csctocsr(int n_row, int n_col, int Ap, int Ai, double Ax, std::vector<(int)> Bp, - std::vector<(int)> Bj, std::vector<(double)> Bx) + int Bp, int Bj, long long Bx) + csctocsr(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, + int Bj, float Bx) + csctocsr(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, + int Bj, double Bx) csctocsr(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, - std::vector<(int)> Bp, std::vector<(int)> Bj, - std::vector<(npy_cfloat_wrapper)> Bx) + int Bp, int Bj, npy_cfloat_wrapper Bx) csctocsr(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, - std::vector<(int)> Bp, std::vector<(int)> Bj, - std::vector<(npy_cdouble_wrapper)> Bx) + int Bp, int Bj, npy_cdouble_wrapper Bx) """ return _sparsetools.csctocsr(*args) -def csrtocoo(*args): - """ - csrtocoo(int n_row, int n_col, int Ap, int Aj, signed char Ax, - std::vector<(int)> Bi, std::vector<(int)> Bj, - std::vector<(signed char)> Bx) - csrtocoo(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, - std::vector<(int)> Bi, std::vector<(int)> Bj, - std::vector<(unsigned char)> Bx) - csrtocoo(int n_row, int n_col, int Ap, int Aj, short Ax, std::vector<(int)> Bi, - std::vector<(int)> Bj, std::vector<(short)> Bx) - csrtocoo(int n_row, int n_col, int Ap, int Aj, int Ax, std::vector<(int)> Bi, - std::vector<(int)> Bj, std::vector<(int)> Bx) - csrtocoo(int n_row, int n_col, int Ap, int Aj, long long Ax, - std::vector<(int)> Bi, std::vector<(int)> Bj, - std::vector<(long long)> Bx) - csrtocoo(int n_row, int n_col, int Ap, int Aj, float Ax, std::vector<(int)> Bi, - std::vector<(int)> Bj, std::vector<(float)> Bx) - csrtocoo(int n_row, int n_col, int Ap, int Aj, double Ax, std::vector<(int)> Bi, - std::vector<(int)> Bj, std::vector<(double)> Bx) - csrtocoo(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, - std::vector<(int)> Bi, std::vector<(int)> Bj, - std::vector<(npy_cfloat_wrapper)> Bx) - csrtocoo(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, - std::vector<(int)> Bi, std::vector<(int)> Bj, - std::vector<(npy_cdouble_wrapper)> Bx) - """ - return _sparsetools.csrtocoo(*args) - -def csctocoo(*args): - """ - csctocoo(int n_row, int n_col, int Ap, int Ai, signed char Ax, - std::vector<(int)> Bi, std::vector<(int)> Bj, - std::vector<(signed char)> Bx) - csctocoo(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, - std::vector<(int)> Bi, std::vector<(int)> Bj, - std::vector<(unsigned char)> Bx) - csctocoo(int n_row, int n_col, int Ap, int Ai, short Ax, std::vector<(int)> Bi, - std::vector<(int)> Bj, std::vector<(short)> Bx) - csctocoo(int n_row, int n_col, int Ap, int Ai, int Ax, std::vector<(int)> Bi, - std::vector<(int)> Bj, std::vector<(int)> Bx) - csctocoo(int n_row, int n_col, int Ap, int Ai, long long Ax, - std::vector<(int)> Bi, std::vector<(int)> Bj, - std::vector<(long long)> Bx) - csctocoo(int n_row, int n_col, int Ap, int Ai, float Ax, std::vector<(int)> Bi, - std::vector<(int)> Bj, std::vector<(float)> Bx) - csctocoo(int n_row, int n_col, int Ap, int Ai, double Ax, std::vector<(int)> Bi, - std::vector<(int)> Bj, std::vector<(double)> Bx) - csctocoo(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, - std::vector<(int)> Bi, std::vector<(int)> Bj, - std::vector<(npy_cfloat_wrapper)> Bx) - csctocoo(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, - std::vector<(int)> Bi, std::vector<(int)> Bj, - std::vector<(npy_cdouble_wrapper)> Bx) - """ - return _sparsetools.csctocoo(*args) - def cootocsr(*args): """ cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, signed char Ax, - std::vector<(int)> Bp, std::vector<(int)> Bj, - std::vector<(signed char)> Bx) + int Bp, int Bj, signed char Bx) cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, unsigned char Ax, - std::vector<(int)> Bp, std::vector<(int)> Bj, - std::vector<(unsigned char)> Bx) + int Bp, int Bj, unsigned char Bx) cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, short Ax, - std::vector<(int)> Bp, std::vector<(int)> Bj, - std::vector<(short)> Bx) + int Bp, int Bj, short Bx) cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, int Ax, - std::vector<(int)> Bp, std::vector<(int)> Bj, - std::vector<(int)> Bx) + int Bp, int Bj, int Bx) cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, long long Ax, - std::vector<(int)> Bp, std::vector<(int)> Bj, - std::vector<(long long)> Bx) + int Bp, int Bj, long long Bx) cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, float Ax, - std::vector<(int)> Bp, std::vector<(int)> Bj, - std::vector<(float)> Bx) + int Bp, int Bj, float Bx) cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, double Ax, - std::vector<(int)> Bp, std::vector<(int)> Bj, - std::vector<(double)> Bx) + int Bp, int Bj, double Bx) cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cfloat_wrapper Ax, - std::vector<(int)> Bp, std::vector<(int)> Bj, - std::vector<(npy_cfloat_wrapper)> Bx) + int Bp, int Bj, npy_cfloat_wrapper Bx) cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cdouble_wrapper Ax, - std::vector<(int)> Bp, std::vector<(int)> Bj, - std::vector<(npy_cdouble_wrapper)> Bx) + int Bp, int Bj, npy_cdouble_wrapper Bx) """ return _sparsetools.cootocsr(*args) def cootocsc(*args): """ cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, signed char Ax, - std::vector<(int)> Bp, std::vector<(int)> Bi, - std::vector<(signed char)> Bx) + int Bp, int Bi, signed char Bx) cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, unsigned char Ax, - std::vector<(int)> Bp, std::vector<(int)> Bi, - std::vector<(unsigned char)> Bx) + int Bp, int Bi, unsigned char Bx) cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, short Ax, - std::vector<(int)> Bp, std::vector<(int)> Bi, - std::vector<(short)> Bx) + int Bp, int Bi, short Bx) cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, int Ax, - std::vector<(int)> Bp, std::vector<(int)> Bi, - std::vector<(int)> Bx) + int Bp, int Bi, int Bx) cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, long long Ax, - std::vector<(int)> Bp, std::vector<(int)> Bi, - std::vector<(long long)> Bx) + int Bp, int Bi, long long Bx) cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, float Ax, - std::vector<(int)> Bp, std::vector<(int)> Bi, - std::vector<(float)> Bx) + int Bp, int Bi, float Bx) cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, double Ax, - std::vector<(int)> Bp, std::vector<(int)> Bi, - std::vector<(double)> Bx) + int Bp, int Bi, double Bx) cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cfloat_wrapper Ax, - std::vector<(int)> Bp, std::vector<(int)> Bi, - std::vector<(npy_cfloat_wrapper)> Bx) + int Bp, int Bi, npy_cfloat_wrapper Bx) cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cdouble_wrapper Ax, - std::vector<(int)> Bp, std::vector<(int)> Bi, - std::vector<(npy_cdouble_wrapper)> Bx) + int Bp, int Bi, npy_cdouble_wrapper Bx) """ return _sparsetools.cootocsc(*args) Modified: trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx 2007-12-09 07:00:42 UTC (rev 3626) +++ trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx 2007-12-10 20:46:04 UTC (rev 3627) @@ -5534,9 +5534,9 @@ int *arg3 ; int *arg4 ; signed char *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; + int *arg6 ; + int *arg7 ; + signed char *arg8 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -5547,28 +5547,19 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; + PyArrayObject *temp6 = NULL ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'"); @@ -5609,29 +5600,23 @@ arg5 = (signed char*) array5->data; } - csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp6 = obj_to_array_no_conversion(obj5,PyArray_INT); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (int*) array_data(temp6); } { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(signed char)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_BYTE); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (signed char*) array_data(temp8); } + csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6,arg7,arg8); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -5663,9 +5648,9 @@ int *arg3 ; int *arg4 ; unsigned char *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; + int *arg6 ; + int *arg7 ; + unsigned char *arg8 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -5676,28 +5661,19 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; + PyArrayObject *temp6 = NULL ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'"); @@ -5738,29 +5714,23 @@ arg5 = (unsigned char*) array5->data; } - csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp6 = obj_to_array_no_conversion(obj5,PyArray_INT); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (int*) array_data(temp6); } { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(unsigned char)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_UBYTE); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (unsigned char*) array_data(temp8); } + csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6,arg7,arg8); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -5792,9 +5762,9 @@ int *arg3 ; int *arg4 ; short *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; + int *arg6 ; + int *arg7 ; + short *arg8 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -5805,28 +5775,19 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; + PyArrayObject *temp6 = NULL ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'"); @@ -5867,29 +5828,23 @@ arg5 = (short*) array5->data; } - csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp6 = obj_to_array_no_conversion(obj5,PyArray_INT); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (int*) array_data(temp6); } { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(short)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_SHORT); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (short*) array_data(temp8); } + csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6,arg7,arg8); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -5921,9 +5876,9 @@ int *arg3 ; int *arg4 ; int *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; + int *arg6 ; + int *arg7 ; + int *arg8 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -5934,28 +5889,19 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; + PyArrayObject *temp6 = NULL ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'"); @@ -5996,29 +5942,23 @@ arg5 = (int*) array5->data; } - csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp6 = obj_to_array_no_conversion(obj5,PyArray_INT); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (int*) array_data(temp6); } { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(int)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_INT); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (int*) array_data(temp8); } + csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6,arg7,arg8); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -6050,9 +5990,9 @@ int *arg3 ; int *arg4 ; long long *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; + int *arg6 ; + int *arg7 ; + long long *arg8 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -6063,28 +6003,19 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; + PyArrayObject *temp6 = NULL ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'"); @@ -6125,29 +6056,23 @@ arg5 = (long long*) array5->data; } - csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp6 = obj_to_array_no_conversion(obj5,PyArray_INT); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (int*) array_data(temp6); } { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(long long)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_LONGLONG); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (long long*) array_data(temp8); } + csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,arg6,arg7,arg8); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -6179,9 +6104,9 @@ int *arg3 ; int *arg4 ; float *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; + int *arg6 ; + int *arg7 ; + float *arg8 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -6192,28 +6117,19 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; + PyArrayObject *temp6 = NULL ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'"); @@ -6254,29 +6170,23 @@ arg5 = (float*) array5->data; } - csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp6 = obj_to_array_no_conversion(obj5,PyArray_INT); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (int*) array_data(temp6); } { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(float)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_FLOAT); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (float*) array_data(temp8); } + csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6,arg7,arg8); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -6308,9 +6218,9 @@ int *arg3 ; int *arg4 ; double *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; + int *arg6 ; + int *arg7 ; + double *arg8 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -6321,28 +6231,19 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; + PyArrayObject *temp6 = NULL ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'"); @@ -6383,29 +6284,23 @@ arg5 = (double*) array5->data; } - csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp6 = obj_to_array_no_conversion(obj5,PyArray_INT); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (int*) array_data(temp6); } { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(double)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_DOUBLE); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (double*) array_data(temp8); } + csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6,arg7,arg8); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -6437,9 +6332,9 @@ int *arg3 ; int *arg4 ; npy_cfloat_wrapper *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; + int *arg6 ; + int *arg7 ; + npy_cfloat_wrapper *arg8 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -6450,28 +6345,19 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; + PyArrayObject *temp6 = NULL ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'"); @@ -6512,29 +6398,23 @@ arg5 = (npy_cfloat_wrapper*) array5->data; } - csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp6 = obj_to_array_no_conversion(obj5,PyArray_INT); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (int*) array_data(temp6); } { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(npy_cfloat_wrapper)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_CFLOAT); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (npy_cfloat_wrapper*) array_data(temp8); } + csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,arg6,arg7,arg8); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -6566,9 +6446,9 @@ int *arg3 ; int *arg4 ; npy_cdouble_wrapper *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; + int *arg6 ; + int *arg7 ; + npy_cdouble_wrapper *arg8 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -6579,28 +6459,19 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; + PyArrayObject *temp6 = NULL ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'"); @@ -6641,29 +6512,23 @@ arg5 = (npy_cdouble_wrapper*) array5->data; } - csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp6 = obj_to_array_no_conversion(obj5,PyArray_INT); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (int*) array_data(temp6); } { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(npy_cdouble_wrapper)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_CDOUBLE); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (npy_cdouble_wrapper*) array_data(temp8); } + csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,arg6,arg7,arg8); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -6690,15 +6555,15 @@ SWIGINTERN PyObject *_wrap_csrtocsc(PyObject *self, PyObject *args) { int argc; - PyObject *argv[6]; + PyObject *argv[9]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 5); ii++) { + for (ii = 0; (ii < argc) && (ii < 8); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } - if (argc == 5) { + if (argc == 8) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -6722,14 +6587,29 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_csrtocsc__SWIG_1(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_csrtocsc__SWIG_1(self, args); + } + } + } } } } } } } - if (argc == 5) { + if (argc == 8) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -6753,14 +6633,29 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_csrtocsc__SWIG_2(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_csrtocsc__SWIG_2(self, args); + } + } + } } } } } } } - if (argc == 5) { + if (argc == 8) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -6784,14 +6679,29 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_csrtocsc__SWIG_3(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_csrtocsc__SWIG_3(self, args); + } + } + } } } } } } } - if (argc == 5) { + if (argc == 8) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -6815,14 +6725,29 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_csrtocsc__SWIG_4(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_csrtocsc__SWIG_4(self, args); + } + } + } } } } } } } - if (argc == 5) { + if (argc == 8) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -6846,14 +6771,29 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_csrtocsc__SWIG_5(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_csrtocsc__SWIG_5(self, args); + } + } + } } } } } } } - if (argc == 5) { + if (argc == 8) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -6877,14 +6817,29 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csrtocsc__SWIG_6(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_csrtocsc__SWIG_6(self, args); + } + } + } } } } } } } - if (argc == 5) { + if (argc == 8) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -6908,14 +6863,29 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csrtocsc__SWIG_7(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_csrtocsc__SWIG_7(self, args); + } + } + } } } } } } } - if (argc == 5) { + if (argc == 8) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -6939,14 +6909,29 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csrtocsc__SWIG_8(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_csrtocsc__SWIG_8(self, args); + } + } + } } } } } } } - if (argc == 5) { + if (argc == 8) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -6970,7 +6955,22 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csrtocsc__SWIG_9(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_csrtocsc__SWIG_9(self, args); + } + } + } } } } @@ -6979,7 +6979,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csrtocsc'.\n Possible C/C++ prototypes are:\n"" csrtocsc<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],std::vector *,std::vector *,std::vector *)\n"" csrtocsc<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],std::vector *,std::vector *,std::vector *)\n"" csrtocsc<(int,short)>(int const,int const,int const [],int const [],short const [],std::vector *,std::vector *,std::vector *)\n"" csrtocsc<(int,int)>(int const,int const,int const [],int const [],int const [],std::vector *,std::vector *,std::vector *)\n"" csrtocsc<(int,long long)>(int const,int const,int const [],int const [],long long const [],std::vector *,std::vector *,std::vector *)\n"" csrtocsc<(int,float)>(int const,int const,int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" csrtocsc<(int,double)>(int const,int const,int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"" csrtocsc<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],std::vector *,std::vector *,std::vector *)\n"" csrtocsc<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],std::vector *,std::vector *,std::vector *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csrtocsc'.\n Possible C/C++ prototypes are:\n"" csrtocsc<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int [],int [],signed char [])\n"" csrtocsc<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" csrtocsc<(int,short)>(int const,int const,int const [],int const [],short const [],int [],int [],short [])\n"" csrtocsc<(int,int)>(int const,int const,int const [],int const [],int const [],int [],int [],int [])\n"" csrtocsc<(int,long long)>(int const,int const,int const [],int const [],long long const [],int [],int [],long long [])\n"" csrtocsc<(int,float)>(int const,int const,int const [],int const [],float const [],int [],int [],float [])\n"" csrtocsc<(int,double)>(int const,int const,int const [],int const [],double const [],int [],int [],double [])\n"" csrtocsc<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" csrtocsc<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); return NULL; } @@ -6991,9 +6991,9 @@ int *arg3 ; int *arg4 ; signed char *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; + int *arg6 ; + int *arg7 ; + signed char *arg8 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -7004,28 +7004,19 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; + PyArrayObject *temp6 = NULL ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'"); @@ -7066,29 +7057,23 @@ arg5 = (signed char*) array5->data; } - csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp6 = obj_to_array_no_conversion(obj5,PyArray_INT); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (int*) array_data(temp6); } { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(signed char)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_BYTE); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (signed char*) array_data(temp8); } + csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6,arg7,arg8); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -7120,9 +7105,9 @@ int *arg3 ; int *arg4 ; unsigned char *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; + int *arg6 ; + int *arg7 ; + unsigned char *arg8 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -7133,28 +7118,19 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; + PyArrayObject *temp6 = NULL ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'"); @@ -7195,29 +7171,23 @@ arg5 = (unsigned char*) array5->data; } - csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp6 = obj_to_array_no_conversion(obj5,PyArray_INT); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (int*) array_data(temp6); } { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(unsigned char)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_UBYTE); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (unsigned char*) array_data(temp8); } + csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6,arg7,arg8); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -7249,9 +7219,9 @@ int *arg3 ; int *arg4 ; short *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; + int *arg6 ; + int *arg7 ; + short *arg8 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -7262,28 +7232,19 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; + PyArrayObject *temp6 = NULL ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'"); @@ -7324,29 +7285,23 @@ arg5 = (short*) array5->data; } - csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp6 = obj_to_array_no_conversion(obj5,PyArray_INT); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (int*) array_data(temp6); } { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(short)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_SHORT); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (short*) array_data(temp8); } + csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6,arg7,arg8); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -7378,9 +7333,9 @@ int *arg3 ; int *arg4 ; int *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; + int *arg6 ; + int *arg7 ; + int *arg8 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -7391,28 +7346,19 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; + PyArrayObject *temp6 = NULL ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'"); @@ -7453,29 +7399,23 @@ arg5 = (int*) array5->data; } - csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp6 = obj_to_array_no_conversion(obj5,PyArray_INT); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (int*) array_data(temp6); } { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(int)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_INT); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (int*) array_data(temp8); } + csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6,arg7,arg8); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -7507,9 +7447,9 @@ int *arg3 ; int *arg4 ; long long *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; + int *arg6 ; + int *arg7 ; + long long *arg8 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -7520,28 +7460,19 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; + PyArrayObject *temp6 = NULL ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'"); @@ -7582,29 +7513,23 @@ arg5 = (long long*) array5->data; } - csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp6 = obj_to_array_no_conversion(obj5,PyArray_INT); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (int*) array_data(temp6); } { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(long long)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_LONGLONG); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (long long*) array_data(temp8); } + csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,arg6,arg7,arg8); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -7636,9 +7561,9 @@ int *arg3 ; int *arg4 ; float *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; + int *arg6 ; + int *arg7 ; + float *arg8 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -7649,28 +7574,19 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; + PyArrayObject *temp6 = NULL ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'"); @@ -7711,29 +7627,23 @@ arg5 = (float*) array5->data; } - csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp6 = obj_to_array_no_conversion(obj5,PyArray_INT); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (int*) array_data(temp6); } { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(float)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_FLOAT); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (float*) array_data(temp8); } + csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6,arg7,arg8); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -7765,9 +7675,9 @@ int *arg3 ; int *arg4 ; double *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; + int *arg6 ; + int *arg7 ; + double *arg8 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -7778,28 +7688,19 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; + PyArrayObject *temp6 = NULL ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'"); @@ -7840,29 +7741,23 @@ arg5 = (double*) array5->data; } - csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp6 = obj_to_array_no_conversion(obj5,PyArray_INT); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (int*) array_data(temp6); } { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(double)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_DOUBLE); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (double*) array_data(temp8); } + csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6,arg7,arg8); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -7894,9 +7789,9 @@ int *arg3 ; int *arg4 ; npy_cfloat_wrapper *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; + int *arg6 ; + int *arg7 ; + npy_cfloat_wrapper *arg8 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -7907,28 +7802,19 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; + PyArrayObject *temp6 = NULL ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'"); @@ -7969,29 +7855,23 @@ arg5 = (npy_cfloat_wrapper*) array5->data; } - csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp6 = obj_to_array_no_conversion(obj5,PyArray_INT); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (int*) array_data(temp6); } { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(npy_cfloat_wrapper)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_CFLOAT); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (npy_cfloat_wrapper*) array_data(temp8); } + csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,arg6,arg7,arg8); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -8023,9 +7903,9 @@ int *arg3 ; int *arg4 ; npy_cdouble_wrapper *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; + int *arg6 ; + int *arg7 ; + npy_cdouble_wrapper *arg8 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -8036,28 +7916,19 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; + PyArrayObject *temp6 = NULL ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'"); @@ -8098,29 +7969,23 @@ arg5 = (npy_cdouble_wrapper*) array5->data; } - csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp6 = obj_to_array_no_conversion(obj5,PyArray_INT); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (int*) array_data(temp6); } { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(npy_cdouble_wrapper)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_CDOUBLE); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (npy_cdouble_wrapper*) array_data(temp8); } + csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,arg6,arg7,arg8); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -8147,15 +8012,15 @@ SWIGINTERN PyObject *_wrap_csctocsr(PyObject *self, PyObject *args) { int argc; - PyObject *argv[6]; + PyObject *argv[9]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 5); ii++) { + for (ii = 0; (ii < argc) && (ii < 8); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } - if (argc == 5) { + if (argc == 8) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -8179,14 +8044,29 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_csctocsr__SWIG_1(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_csctocsr__SWIG_1(self, args); + } + } + } } } } } } } - if (argc == 5) { + if (argc == 8) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -8210,14 +8090,29 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_csctocsr__SWIG_2(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_csctocsr__SWIG_2(self, args); + } + } + } } } } } } } - if (argc == 5) { + if (argc == 8) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -8241,14 +8136,29 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_csctocsr__SWIG_3(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_csctocsr__SWIG_3(self, args); + } + } + } } } } } } } - if (argc == 5) { + if (argc == 8) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -8272,14 +8182,29 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_csctocsr__SWIG_4(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_csctocsr__SWIG_4(self, args); + } + } + } } } } } } } - if (argc == 5) { + if (argc == 8) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -8303,14 +8228,29 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_csctocsr__SWIG_5(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_csctocsr__SWIG_5(self, args); + } + } + } } } } } } } - if (argc == 5) { + if (argc == 8) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -8334,14 +8274,29 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csctocsr__SWIG_6(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_csctocsr__SWIG_6(self, args); + } + } + } } } } } } } - if (argc == 5) { + if (argc == 8) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -8365,14 +8320,29 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csctocsr__SWIG_7(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_csctocsr__SWIG_7(self, args); + } + } + } } } } } } } - if (argc == 5) { + if (argc == 8) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -8396,14 +8366,29 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csctocsr__SWIG_8(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_csctocsr__SWIG_8(self, args); + } + } + } } } } } } } - if (argc == 5) { + if (argc == 8) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -8427,7 +8412,22 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csctocsr__SWIG_9(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_csctocsr__SWIG_9(self, args); + } + } + } } } } @@ -8436,2925 +8436,60 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csctocsr'.\n Possible C/C++ prototypes are:\n"" csctocsr<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],std::vector *,std::vector *,std::vector *)\n"" csctocsr<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],std::vector *,std::vector *,std::vector *)\n"" csctocsr<(int,short)>(int const,int const,int const [],int const [],short const [],std::vector *,std::vector *,std::vector *)\n"" csctocsr<(int,int)>(int const,int const,int const [],int const [],int const [],std::vector *,std::vector *,std::vector *)\n"" csctocsr<(int,long long)>(int const,int const,int const [],int const [],long long const [],std::vector *,std::vector *,std::vector *)\n"" csctocsr<(int,float)>(int const,int const,int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" csctocsr<(int,double)>(int const,int const,int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"" csctocsr<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],std::vector *,std::vector *,std::vector *)\n"" csctocsr<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],std::vector *,std::vector *,std::vector *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csctocsr'.\n Possible C/C++ prototypes are:\n"" csctocsr<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int [],int [],signed char [])\n"" csctocsr<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" csctocsr<(int,short)>(int const,int const,int const [],int const [],short const [],int [],int [],short [])\n"" csctocsr<(int,int)>(int const,int const,int const [],int const [],int const [],int [],int [],int [])\n"" csctocsr<(int,long long)>(int const,int const,int const [],int const [],long long const [],int [],int [],long long [])\n"" csctocsr<(int,float)>(int const,int const,int const [],int const [],float const [],int [],int [],float [])\n"" csctocsr<(int,double)>(int const,int const,int const [],int const [],double const [],int [],int [],double [])\n"" csctocsr<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" csctocsr<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); return NULL; } -SWIGINTERN PyObject *_wrap_csrtocoo__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_expandptr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; - int arg2 ; + int *arg2 ; int *arg3 ; - int *arg4 ; - signed char *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; int val1 ; int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; + PyArrayObject *array2 = NULL ; + int is_new_object2 ; + PyArrayObject *temp3 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocoo",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOO:expandptr",&obj0,&obj1,&obj2)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocoo" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "expandptr" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csrtocoo" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); { npy_intp size[1] = { -1 }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; + array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_INT, &is_new_object2); + if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1) + || !require_contiguous(array2) || !require_native(array2)) SWIG_fail; - arg3 = (int*) array3->data; + arg2 = (int*) array2->data; } { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; + temp3 = obj_to_array_no_conversion(obj2,PyArray_INT); + if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; + arg3 = (int*) array_data(temp3); } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_BYTE, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (signed char*) array5->data; - } - csrtocoo(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6,arg7,arg8); + expandptr(arg1,(int const (*))arg2,arg3); resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + if (is_new_object2 && array2) Py_DECREF(array2); } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(signed char)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } return resultobj; fail: { - if (is_new_object3 && array3) Py_DECREF(array3); + if (is_new_object2 && array2) Py_DECREF(array2); } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } return NULL; } -SWIGINTERN PyObject *_wrap_csrtocoo__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - unsigned char *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocoo",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocoo" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csrtocoo" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_UBYTE, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (unsigned char*) array5->data; - } - csrtocoo(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(unsigned char)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csrtocoo__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - short *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocoo",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocoo" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csrtocoo" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_SHORT, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (short*) array5->data; - } - csrtocoo(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(short)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csrtocoo__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - int *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocoo",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocoo" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csrtocoo" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_INT, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (int*) array5->data; - } - csrtocoo(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(int)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csrtocoo__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - long long *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocoo",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocoo" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csrtocoo" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_LONGLONG, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (long long*) array5->data; - } - csrtocoo(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(long long)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csrtocoo__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - float *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocoo",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocoo" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csrtocoo" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_FLOAT, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (float*) array5->data; - } - csrtocoo(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(float)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csrtocoo__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - double *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocoo",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocoo" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csrtocoo" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_DOUBLE, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (double*) array5->data; - } - csrtocoo(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(double)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csrtocoo__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - npy_cfloat_wrapper *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocoo",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocoo" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csrtocoo" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_CFLOAT, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (npy_cfloat_wrapper*) array5->data; - } - csrtocoo(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(npy_cfloat_wrapper)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csrtocoo__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - npy_cdouble_wrapper *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csrtocoo",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocoo" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csrtocoo" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_CDOUBLE, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (npy_cdouble_wrapper*) array5->data; - } - csrtocoo(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(npy_cdouble_wrapper)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csrtocoo(PyObject *self, PyObject *args) { - int argc; - PyObject *argv[6]; - int ii; - - if (!PyTuple_Check(args)) SWIG_fail; - argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 5); ii++) { - argv[ii] = PyTuple_GET_ITEM(args,ii); - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_BYTE)) ? 1 : 0; - } - if (_v) { - return _wrap_csrtocoo__SWIG_1(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_UBYTE)) ? 1 : 0; - } - if (_v) { - return _wrap_csrtocoo__SWIG_2(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_SHORT)) ? 1 : 0; - } - if (_v) { - return _wrap_csrtocoo__SWIG_3(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - return _wrap_csrtocoo__SWIG_4(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_LONGLONG)) ? 1 : 0; - } - if (_v) { - return _wrap_csrtocoo__SWIG_5(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0; - } - if (_v) { - return _wrap_csrtocoo__SWIG_6(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0; - } - if (_v) { - return _wrap_csrtocoo__SWIG_7(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CFLOAT)) ? 1 : 0; - } - if (_v) { - return _wrap_csrtocoo__SWIG_8(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CDOUBLE)) ? 1 : 0; - } - if (_v) { - return _wrap_csrtocoo__SWIG_9(self, args); - } - } - } - } - } - } - -fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csrtocoo'.\n Possible C/C++ prototypes are:\n"" csrtocoo<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],std::vector *,std::vector *,std::vector *)\n"" csrtocoo<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],std::vector *,std::vector *,std::vector *)\n"" csrtocoo<(int,short)>(int const,int const,int const [],int const [],short const [],std::vector *,std::vector *,std::vector *)\n"" csrtocoo<(int,int)>(int const,int const,int const [],int const [],int const [],std::vector *,std::vector *,std::vector *)\n"" csrtocoo<(int,long long)>(int const,int const,int const [],int const [],long long const [],std::vector *,std::vector *,std::vector *)\n"" csrtocoo<(int,float)>(int const,int const,int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" csrtocoo<(int,double)>(int const,int const,int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"" csrtocoo<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],std::vector *,std::vector *,std::vector *)\n"" csrtocoo<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],std::vector *,std::vector *,std::vector *)\n"); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csctocoo__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - signed char *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocoo",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocoo" "', 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 '" "csctocoo" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_BYTE, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (signed char*) array5->data; - } - csctocoo(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(signed char)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csctocoo__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - unsigned char *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocoo",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocoo" "', 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 '" "csctocoo" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_UBYTE, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (unsigned char*) array5->data; - } - csctocoo(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(unsigned char)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csctocoo__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - short *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocoo",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocoo" "', 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 '" "csctocoo" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_SHORT, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (short*) array5->data; - } - csctocoo(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(short)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csctocoo__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - int *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocoo",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocoo" "', 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 '" "csctocoo" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_INT, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (int*) array5->data; - } - csctocoo(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(int)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csctocoo__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - long long *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocoo",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocoo" "', 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 '" "csctocoo" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_LONGLONG, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (long long*) array5->data; - } - csctocoo(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(long long)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csctocoo__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - float *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocoo",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocoo" "', 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 '" "csctocoo" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_FLOAT, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (float*) array5->data; - } - csctocoo(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(float)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csctocoo__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - double *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocoo",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocoo" "', 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 '" "csctocoo" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_DOUBLE, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (double*) array5->data; - } - csctocoo(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(double)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csctocoo__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - npy_cfloat_wrapper *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocoo",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocoo" "', 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 '" "csctocoo" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_CFLOAT, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (npy_cfloat_wrapper*) array5->data; - } - csctocoo(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(npy_cfloat_wrapper)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csctocoo__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - npy_cdouble_wrapper *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csctocoo",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocoo" "', 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 '" "csctocoo" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_CDOUBLE, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (npy_cdouble_wrapper*) array5->data; - } - csctocoo(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(npy_cdouble_wrapper)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csctocoo(PyObject *self, PyObject *args) { - int argc; - PyObject *argv[6]; - int ii; - - if (!PyTuple_Check(args)) SWIG_fail; - argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 5); ii++) { - argv[ii] = PyTuple_GET_ITEM(args,ii); - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_BYTE)) ? 1 : 0; - } - if (_v) { - return _wrap_csctocoo__SWIG_1(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_UBYTE)) ? 1 : 0; - } - if (_v) { - return _wrap_csctocoo__SWIG_2(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_SHORT)) ? 1 : 0; - } - if (_v) { - return _wrap_csctocoo__SWIG_3(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - return _wrap_csctocoo__SWIG_4(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_LONGLONG)) ? 1 : 0; - } - if (_v) { - return _wrap_csctocoo__SWIG_5(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0; - } - if (_v) { - return _wrap_csctocoo__SWIG_6(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0; - } - if (_v) { - return _wrap_csctocoo__SWIG_7(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CFLOAT)) ? 1 : 0; - } - if (_v) { - return _wrap_csctocoo__SWIG_8(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CDOUBLE)) ? 1 : 0; - } - if (_v) { - return _wrap_csctocoo__SWIG_9(self, args); - } - } - } - } - } - } - -fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csctocoo'.\n Possible C/C++ prototypes are:\n"" csctocoo<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],std::vector *,std::vector *,std::vector *)\n"" csctocoo<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],std::vector *,std::vector *,std::vector *)\n"" csctocoo<(int,short)>(int const,int const,int const [],int const [],short const [],std::vector *,std::vector *,std::vector *)\n"" csctocoo<(int,int)>(int const,int const,int const [],int const [],int const [],std::vector *,std::vector *,std::vector *)\n"" csctocoo<(int,long long)>(int const,int const,int const [],int const [],long long const [],std::vector *,std::vector *,std::vector *)\n"" csctocoo<(int,float)>(int const,int const,int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" csctocoo<(int,double)>(int const,int const,int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"" csctocoo<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],std::vector *,std::vector *,std::vector *)\n"" csctocoo<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],std::vector *,std::vector *,std::vector *)\n"); - return NULL; -} - - SWIGINTERN PyObject *_wrap_cootocsr__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; @@ -11363,9 +8498,9 @@ int *arg4 ; int *arg5 ; signed char *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - std::vector *arg9 = (std::vector *) 0 ; + int *arg7 ; + int *arg8 ; + signed char *arg9 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -11378,29 +8513,20 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - std::vector *tmp9 ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; + PyArrayObject *temp9 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsr" "', argument " "1"" of type '" "int""'"); @@ -11446,29 +8572,23 @@ arg6 = (signed char*) array6->data; } - cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(signed char const (*))arg6,arg7,arg8,arg9); - resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(int)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_INT); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (int*) array_data(temp8); } { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(signed char)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_BYTE); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (signed char*) array_data(temp9); } + cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(signed char const (*))arg6,arg7,arg8,arg9); + resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); } @@ -11501,9 +8621,9 @@ int *arg4 ; int *arg5 ; unsigned char *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - std::vector *arg9 = (std::vector *) 0 ; + int *arg7 ; + int *arg8 ; + unsigned char *arg9 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -11516,29 +8636,20 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - std::vector *tmp9 ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; + PyArrayObject *temp9 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsr" "', argument " "1"" of type '" "int""'"); @@ -11584,29 +8695,23 @@ arg6 = (unsigned char*) array6->data; } - cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(unsigned char const (*))arg6,arg7,arg8,arg9); - resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(int)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_INT); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (int*) array_data(temp8); } { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(unsigned char)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_UBYTE); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (unsigned char*) array_data(temp9); } + cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(unsigned char const (*))arg6,arg7,arg8,arg9); + resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); } @@ -11639,9 +8744,9 @@ int *arg4 ; int *arg5 ; short *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - std::vector *arg9 = (std::vector *) 0 ; + int *arg7 ; + int *arg8 ; + short *arg9 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -11654,29 +8759,20 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - std::vector *tmp9 ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; + PyArrayObject *temp9 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsr" "', argument " "1"" of type '" "int""'"); @@ -11722,29 +8818,23 @@ arg6 = (short*) array6->data; } - cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(short const (*))arg6,arg7,arg8,arg9); - resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(int)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_INT); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (int*) array_data(temp8); } { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(short)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_SHORT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (short*) array_data(temp9); } + cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(short const (*))arg6,arg7,arg8,arg9); + resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); } @@ -11777,9 +8867,9 @@ int *arg4 ; int *arg5 ; int *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - std::vector *arg9 = (std::vector *) 0 ; + int *arg7 ; + int *arg8 ; + int *arg9 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -11792,29 +8882,20 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - std::vector *tmp9 ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; + PyArrayObject *temp9 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsr" "', argument " "1"" of type '" "int""'"); @@ -11860,29 +8941,23 @@ arg6 = (int*) array6->data; } - cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,arg7,arg8,arg9); - resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(int)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_INT); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (int*) array_data(temp8); } { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } + cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,arg7,arg8,arg9); + resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); } @@ -11915,9 +8990,9 @@ int *arg4 ; int *arg5 ; long long *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - std::vector *arg9 = (std::vector *) 0 ; + int *arg7 ; + int *arg8 ; + long long *arg9 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -11930,29 +9005,20 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - std::vector *tmp9 ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; + PyArrayObject *temp9 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsr" "', argument " "1"" of type '" "int""'"); @@ -11998,29 +9064,23 @@ arg6 = (long long*) array6->data; } - cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(long long const (*))arg6,arg7,arg8,arg9); - resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(int)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_INT); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (int*) array_data(temp8); } { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(long long)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_LONGLONG); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (long long*) array_data(temp9); } + cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(long long const (*))arg6,arg7,arg8,arg9); + resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); } @@ -12053,9 +9113,9 @@ int *arg4 ; int *arg5 ; float *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - std::vector *arg9 = (std::vector *) 0 ; + int *arg7 ; + int *arg8 ; + float *arg9 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -12068,29 +9128,20 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - std::vector *tmp9 ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; + PyArrayObject *temp9 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsr" "', argument " "1"" of type '" "int""'"); @@ -12136,29 +9187,23 @@ arg6 = (float*) array6->data; } - cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(float const (*))arg6,arg7,arg8,arg9); - resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(int)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_INT); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (int*) array_data(temp8); } { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(float)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_FLOAT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (float*) array_data(temp9); } + cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(float const (*))arg6,arg7,arg8,arg9); + resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); } @@ -12191,9 +9236,9 @@ int *arg4 ; int *arg5 ; double *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - std::vector *arg9 = (std::vector *) 0 ; + int *arg7 ; + int *arg8 ; + double *arg9 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -12206,29 +9251,20 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - std::vector *tmp9 ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; + PyArrayObject *temp9 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsr" "', argument " "1"" of type '" "int""'"); @@ -12274,29 +9310,23 @@ arg6 = (double*) array6->data; } - cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(double const (*))arg6,arg7,arg8,arg9); - resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(int)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_INT); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (int*) array_data(temp8); } { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(double)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_DOUBLE); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (double*) array_data(temp9); } + cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(double const (*))arg6,arg7,arg8,arg9); + resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); } @@ -12329,9 +9359,9 @@ int *arg4 ; int *arg5 ; npy_cfloat_wrapper *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - std::vector *arg9 = (std::vector *) 0 ; + int *arg7 ; + int *arg8 ; + npy_cfloat_wrapper *arg9 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -12344,29 +9374,20 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - std::vector *tmp9 ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; + PyArrayObject *temp9 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsr" "', argument " "1"" of type '" "int""'"); @@ -12412,29 +9433,23 @@ arg6 = (npy_cfloat_wrapper*) array6->data; } - cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(npy_cfloat_wrapper const (*))arg6,arg7,arg8,arg9); - resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(int)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_INT); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (int*) array_data(temp8); } { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(npy_cfloat_wrapper)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_CFLOAT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (npy_cfloat_wrapper*) array_data(temp9); } + cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(npy_cfloat_wrapper const (*))arg6,arg7,arg8,arg9); + resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); } @@ -12467,9 +9482,9 @@ int *arg4 ; int *arg5 ; npy_cdouble_wrapper *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - std::vector *arg9 = (std::vector *) 0 ; + int *arg7 ; + int *arg8 ; + npy_cdouble_wrapper *arg9 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -12482,29 +9497,20 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - std::vector *tmp9 ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; + PyArrayObject *temp9 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsr" "', argument " "1"" of type '" "int""'"); @@ -12550,29 +9556,23 @@ arg6 = (npy_cdouble_wrapper*) array6->data; } - cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(npy_cdouble_wrapper const (*))arg6,arg7,arg8,arg9); - resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(int)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_INT); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (int*) array_data(temp8); } { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(npy_cdouble_wrapper)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_CDOUBLE); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (npy_cdouble_wrapper*) array_data(temp9); } + cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(npy_cdouble_wrapper const (*))arg6,arg7,arg8,arg9); + resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); } @@ -12599,15 +9599,15 @@ SWIGINTERN PyObject *_wrap_cootocsr(PyObject *self, PyObject *args) { int argc; - PyObject *argv[7]; + PyObject *argv[10]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 6); ii++) { + for (ii = 0; (ii < argc) && (ii < 9); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } - if (argc == 6) { + if (argc == 9) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -12636,7 +9636,22 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_cootocsr__SWIG_1(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_cootocsr__SWIG_1(self, args); + } + } + } } } } @@ -12644,7 +9659,7 @@ } } } - if (argc == 6) { + if (argc == 9) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -12673,7 +9688,22 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_cootocsr__SWIG_2(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_cootocsr__SWIG_2(self, args); + } + } + } } } } @@ -12681,7 +9711,7 @@ } } } - if (argc == 6) { + if (argc == 9) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -12710,7 +9740,22 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_cootocsr__SWIG_3(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_cootocsr__SWIG_3(self, args); + } + } + } } } } @@ -12718,7 +9763,7 @@ } } } - if (argc == 6) { + if (argc == 9) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -12747,7 +9792,22 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_cootocsr__SWIG_4(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_cootocsr__SWIG_4(self, args); + } + } + } } } } @@ -12755,7 +9815,7 @@ } } } - if (argc == 6) { + if (argc == 9) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -12784,7 +9844,22 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_cootocsr__SWIG_5(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_cootocsr__SWIG_5(self, args); + } + } + } } } } @@ -12792,7 +9867,7 @@ } } } - if (argc == 6) { + if (argc == 9) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -12821,7 +9896,22 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_cootocsr__SWIG_6(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_cootocsr__SWIG_6(self, args); + } + } + } } } } @@ -12829,7 +9919,7 @@ } } } - if (argc == 6) { + if (argc == 9) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -12858,7 +9948,22 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_cootocsr__SWIG_7(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_cootocsr__SWIG_7(self, args); + } + } + } } } } @@ -12866,7 +9971,7 @@ } } } - if (argc == 6) { + if (argc == 9) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -12895,7 +10000,22 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_cootocsr__SWIG_8(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_cootocsr__SWIG_8(self, args); + } + } + } } } } @@ -12903,7 +10023,7 @@ } } } - if (argc == 6) { + if (argc == 9) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -12932,7 +10052,22 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_cootocsr__SWIG_9(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_cootocsr__SWIG_9(self, args); + } + } + } } } } @@ -12942,7 +10077,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'cootocsr'.\n Possible C/C++ prototypes are:\n"" cootocsr<(int,signed char)>(int const,int const,int const,int const [],int const [],signed char const [],std::vector *,std::vector *,std::vector *)\n"" cootocsr<(int,unsigned char)>(int const,int const,int const,int const [],int const [],unsigned char const [],std::vector *,std::vector *,std::vector *)\n"" cootocsr<(int,short)>(int const,int const,int const,int const [],int const [],short const [],std::vector *,std::vector *,std::vector *)\n"" cootocsr<(int,int)>(int const,int const,int const,int const [],int const [],int const [],std::vector *,std::vector *,std::vector *)\n"" cootocsr<(int,long long)>(int const,int const,int const,int const [],int const [],long long const [],std::vector *,std::vector *,std::vector *)\n"" cootocsr<(int,float)>(int const,int const,int const,int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" cootocsr<(int,double)>(int const,int const,int const,int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"" cootocsr<(int,npy_cfloat_wrapper)>(int const,int const,int const,int const [],int const [],npy_cfloat_wrapper const [],std::vector *,std::vector *,std::vector *)\n"" cootocsr<(int,npy_cdouble_wrapper)>(int const,int const,int const,int const [],int const [],npy_cdouble_wrapper const [],std::vector *,std::vector *,std::vector *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'cootocsr'.\n Possible C/C++ prototypes are:\n"" cootocsr<(int,signed char)>(int const,int const,int const,int const [],int const [],signed char const [],int [],int [],signed char [])\n"" cootocsr<(int,unsigned char)>(int const,int const,int const,int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" cootocsr<(int,short)>(int const,int const,int const,int const [],int const [],short const [],int [],int [],short [])\n"" cootocsr<(int,int)>(int const,int const,int const,int const [],int const [],int const [],int [],int [],int [])\n"" cootocsr<(int,long long)>(int const,int const,int const,int const [],int const [],long long const [],int [],int [],long long [])\n"" cootocsr<(int,float)>(int const,int const,int const,int const [],int const [],float const [],int [],int [],float [])\n"" cootocsr<(int,double)>(int const,int const,int const,int const [],int const [],double const [],int [],int [],double [])\n"" cootocsr<(int,npy_cfloat_wrapper)>(int const,int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" cootocsr<(int,npy_cdouble_wrapper)>(int const,int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); return NULL; } @@ -12955,9 +10090,9 @@ int *arg4 ; int *arg5 ; signed char *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - std::vector *arg9 = (std::vector *) 0 ; + int *arg7 ; + int *arg8 ; + signed char *arg9 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -12970,29 +10105,20 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - std::vector *tmp9 ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; + PyArrayObject *temp9 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsc" "', argument " "1"" of type '" "int""'"); @@ -13038,29 +10164,23 @@ arg6 = (signed char*) array6->data; } - cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(signed char const (*))arg6,arg7,arg8,arg9); - resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(int)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_INT); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (int*) array_data(temp8); } { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(signed char)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_BYTE); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (signed char*) array_data(temp9); } + cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(signed char const (*))arg6,arg7,arg8,arg9); + resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); } @@ -13093,9 +10213,9 @@ int *arg4 ; int *arg5 ; unsigned char *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - std::vector *arg9 = (std::vector *) 0 ; + int *arg7 ; + int *arg8 ; + unsigned char *arg9 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -13108,29 +10228,20 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - std::vector *tmp9 ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; + PyArrayObject *temp9 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsc" "', argument " "1"" of type '" "int""'"); @@ -13176,29 +10287,23 @@ arg6 = (unsigned char*) array6->data; } - cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(unsigned char const (*))arg6,arg7,arg8,arg9); - resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(int)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_INT); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (int*) array_data(temp8); } { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(unsigned char)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_UBYTE); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (unsigned char*) array_data(temp9); } + cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(unsigned char const (*))arg6,arg7,arg8,arg9); + resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); } @@ -13231,9 +10336,9 @@ int *arg4 ; int *arg5 ; short *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - std::vector *arg9 = (std::vector *) 0 ; + int *arg7 ; + int *arg8 ; + short *arg9 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -13246,29 +10351,20 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - std::vector *tmp9 ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; + PyArrayObject *temp9 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsc" "', argument " "1"" of type '" "int""'"); @@ -13314,29 +10410,23 @@ arg6 = (short*) array6->data; } - cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(short const (*))arg6,arg7,arg8,arg9); - resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(int)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_INT); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (int*) array_data(temp8); } { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(short)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_SHORT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (short*) array_data(temp9); } + cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(short const (*))arg6,arg7,arg8,arg9); + resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); } @@ -13369,9 +10459,9 @@ int *arg4 ; int *arg5 ; int *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - std::vector *arg9 = (std::vector *) 0 ; + int *arg7 ; + int *arg8 ; + int *arg9 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -13384,29 +10474,20 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - std::vector *tmp9 ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; + PyArrayObject *temp9 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsc" "', argument " "1"" of type '" "int""'"); @@ -13452,29 +10533,23 @@ arg6 = (int*) array6->data; } - cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,arg7,arg8,arg9); - resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(int)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_INT); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (int*) array_data(temp8); } { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } + cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,arg7,arg8,arg9); + resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); } @@ -13507,9 +10582,9 @@ int *arg4 ; int *arg5 ; long long *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - std::vector *arg9 = (std::vector *) 0 ; + int *arg7 ; + int *arg8 ; + long long *arg9 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -13522,29 +10597,20 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - std::vector *tmp9 ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; + PyArrayObject *temp9 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsc" "', argument " "1"" of type '" "int""'"); @@ -13590,29 +10656,23 @@ arg6 = (long long*) array6->data; } - cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(long long const (*))arg6,arg7,arg8,arg9); - resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(int)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_INT); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (int*) array_data(temp8); } { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(long long)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_LONGLONG); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (long long*) array_data(temp9); } + cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(long long const (*))arg6,arg7,arg8,arg9); + resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); } @@ -13645,9 +10705,9 @@ int *arg4 ; int *arg5 ; float *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - std::vector *arg9 = (std::vector *) 0 ; + int *arg7 ; + int *arg8 ; + float *arg9 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -13660,29 +10720,20 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - std::vector *tmp9 ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; + PyArrayObject *temp9 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsc" "', argument " "1"" of type '" "int""'"); @@ -13728,29 +10779,23 @@ arg6 = (float*) array6->data; } - cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(float const (*))arg6,arg7,arg8,arg9); - resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(int)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_INT); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (int*) array_data(temp8); } { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(float)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_FLOAT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (float*) array_data(temp9); } + cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(float const (*))arg6,arg7,arg8,arg9); + resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); } @@ -13783,9 +10828,9 @@ int *arg4 ; int *arg5 ; double *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - std::vector *arg9 = (std::vector *) 0 ; + int *arg7 ; + int *arg8 ; + double *arg9 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -13798,29 +10843,20 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - std::vector *tmp9 ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; + PyArrayObject *temp9 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsc" "', argument " "1"" of type '" "int""'"); @@ -13866,29 +10902,23 @@ arg6 = (double*) array6->data; } - cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(double const (*))arg6,arg7,arg8,arg9); - resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(int)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_INT); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (int*) array_data(temp8); } { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(double)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_DOUBLE); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (double*) array_data(temp9); } + cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(double const (*))arg6,arg7,arg8,arg9); + resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); } @@ -13921,9 +10951,9 @@ int *arg4 ; int *arg5 ; npy_cfloat_wrapper *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - std::vector *arg9 = (std::vector *) 0 ; + int *arg7 ; + int *arg8 ; + npy_cfloat_wrapper *arg9 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -13936,29 +10966,20 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - std::vector *tmp9 ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; + PyArrayObject *temp9 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsc" "', argument " "1"" of type '" "int""'"); @@ -14004,29 +11025,23 @@ arg6 = (npy_cfloat_wrapper*) array6->data; } - cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(npy_cfloat_wrapper const (*))arg6,arg7,arg8,arg9); - resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(int)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_INT); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (int*) array_data(temp8); } { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(npy_cfloat_wrapper)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_CFLOAT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (npy_cfloat_wrapper*) array_data(temp9); } + cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(npy_cfloat_wrapper const (*))arg6,arg7,arg8,arg9); + resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); } @@ -14059,9 +11074,9 @@ int *arg4 ; int *arg5 ; npy_cdouble_wrapper *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - std::vector *arg9 = (std::vector *) 0 ; + int *arg7 ; + int *arg8 ; + npy_cdouble_wrapper *arg9 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -14074,29 +11089,20 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - std::vector *tmp9 ; + PyArrayObject *temp7 = NULL ; + PyArrayObject *temp8 = NULL ; + PyArrayObject *temp9 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsc" "', argument " "1"" of type '" "int""'"); @@ -14142,29 +11148,23 @@ arg6 = (npy_cdouble_wrapper*) array6->data; } - cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(npy_cdouble_wrapper const (*))arg6,arg7,arg8,arg9); - resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); } { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(int)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp8 = obj_to_array_no_conversion(obj7,PyArray_INT); + if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; + arg8 = (int*) array_data(temp8); } { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(npy_cdouble_wrapper)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_CDOUBLE); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (npy_cdouble_wrapper*) array_data(temp9); } + cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(npy_cdouble_wrapper const (*))arg6,arg7,arg8,arg9); + resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); } @@ -14191,15 +11191,15 @@ SWIGINTERN PyObject *_wrap_cootocsc(PyObject *self, PyObject *args) { int argc; - PyObject *argv[7]; + PyObject *argv[10]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 6); ii++) { + for (ii = 0; (ii < argc) && (ii < 9); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } - if (argc == 6) { + if (argc == 9) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -14228,7 +11228,22 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_cootocsc__SWIG_1(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_cootocsc__SWIG_1(self, args); + } + } + } } } } @@ -14236,7 +11251,7 @@ } } } - if (argc == 6) { + if (argc == 9) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -14265,7 +11280,22 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_cootocsc__SWIG_2(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_cootocsc__SWIG_2(self, args); + } + } + } } } } @@ -14273,7 +11303,7 @@ } } } - if (argc == 6) { + if (argc == 9) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -14302,7 +11332,22 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_cootocsc__SWIG_3(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_cootocsc__SWIG_3(self, args); + } + } + } } } } @@ -14310,7 +11355,7 @@ } } } - if (argc == 6) { + if (argc == 9) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -14339,7 +11384,22 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_cootocsc__SWIG_4(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_cootocsc__SWIG_4(self, args); + } + } + } } } } @@ -14347,7 +11407,7 @@ } } } - if (argc == 6) { + if (argc == 9) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -14376,7 +11436,22 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_cootocsc__SWIG_5(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_cootocsc__SWIG_5(self, args); + } + } + } } } } @@ -14384,7 +11459,7 @@ } } } - if (argc == 6) { + if (argc == 9) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -14413,7 +11488,22 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_cootocsc__SWIG_6(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_cootocsc__SWIG_6(self, args); + } + } + } } } } @@ -14421,7 +11511,7 @@ } } } - if (argc == 6) { + if (argc == 9) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -14450,7 +11540,22 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_cootocsc__SWIG_7(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_cootocsc__SWIG_7(self, args); + } + } + } } } } @@ -14458,7 +11563,7 @@ } } } - if (argc == 6) { + if (argc == 9) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -14487,7 +11592,22 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_cootocsc__SWIG_8(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_cootocsc__SWIG_8(self, args); + } + } + } } } } @@ -14495,7 +11615,7 @@ } } } - if (argc == 6) { + if (argc == 9) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -14524,7 +11644,22 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_cootocsc__SWIG_9(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_cootocsc__SWIG_9(self, args); + } + } + } } } } @@ -14534,7 +11669,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'cootocsc'.\n Possible C/C++ prototypes are:\n"" cootocsc<(int,signed char)>(int const,int const,int const,int const [],int const [],signed char const [],std::vector *,std::vector *,std::vector *)\n"" cootocsc<(int,unsigned char)>(int const,int const,int const,int const [],int const [],unsigned char const [],std::vector *,std::vector *,std::vector *)\n"" cootocsc<(int,short)>(int const,int const,int const,int const [],int const [],short const [],std::vector *,std::vector *,std::vector *)\n"" cootocsc<(int,int)>(int const,int const,int const,int const [],int const [],int const [],std::vector *,std::vector *,std::vector *)\n"" cootocsc<(int,long long)>(int const,int const,int const,int const [],int const [],long long const [],std::vector *,std::vector *,std::vector *)\n"" cootocsc<(int,float)>(int const,int const,int const,int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" cootocsc<(int,double)>(int const,int const,int const,int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"" cootocsc<(int,npy_cfloat_wrapper)>(int const,int const,int const,int const [],int const [],npy_cfloat_wrapper const [],std::vector *,std::vector *,std::vector *)\n"" cootocsc<(int,npy_cdouble_wrapper)>(int const,int const,int const,int const [],int const [],npy_cdouble_wrapper const [],std::vector *,std::vector *,std::vector *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'cootocsc'.\n Possible C/C++ prototypes are:\n"" cootocsc<(int,signed char)>(int const,int const,int const,int const [],int const [],signed char const [],int [],int [],signed char [])\n"" cootocsc<(int,unsigned char)>(int const,int const,int const,int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" cootocsc<(int,short)>(int const,int const,int const,int const [],int const [],short const [],int [],int [],short [])\n"" cootocsc<(int,int)>(int const,int const,int const,int const [],int const [],int const [],int [],int [],int [])\n"" cootocsc<(int,long long)>(int const,int const,int const,int const [],int const [],long long const [],int [],int [],long long [])\n"" cootocsc<(int,float)>(int const,int const,int const,int const [],int const [],float const [],int [],int [],float [])\n"" cootocsc<(int,double)>(int const,int const,int const,int const [],int const [],double const [],int [],int [],double [])\n"" cootocsc<(int,npy_cfloat_wrapper)>(int const,int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" cootocsc<(int,npy_cdouble_wrapper)>(int const,int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); return NULL; } @@ -46730,161 +43865,84 @@ ""}, { (char *)"csrtocsc", _wrap_csrtocsc, METH_VARARGS, (char *)"\n" "csrtocsc(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bi, \n" - " std::vector<(signed char)> Bx)\n" + " int Bp, int Bi, signed char Bx)\n" "csrtocsc(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bi, \n" - " std::vector<(unsigned char)> Bx)\n" - "csrtocsc(int n_row, int n_col, int Ap, int Aj, short Ax, std::vector<(int)> Bp, \n" - " std::vector<(int)> Bi, std::vector<(short)> Bx)\n" - "csrtocsc(int n_row, int n_col, int Ap, int Aj, int Ax, std::vector<(int)> Bp, \n" - " std::vector<(int)> Bi, std::vector<(int)> Bx)\n" + " int Bp, int Bi, unsigned char Bx)\n" + "csrtocsc(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, \n" + " int Bi, short Bx)\n" + "csrtocsc(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, \n" + " int Bi, int Bx)\n" "csrtocsc(int n_row, int n_col, int Ap, int Aj, long long Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bi, \n" - " std::vector<(long long)> Bx)\n" - "csrtocsc(int n_row, int n_col, int Ap, int Aj, float Ax, std::vector<(int)> Bp, \n" - " std::vector<(int)> Bi, std::vector<(float)> Bx)\n" - "csrtocsc(int n_row, int n_col, int Ap, int Aj, double Ax, std::vector<(int)> Bp, \n" - " std::vector<(int)> Bi, std::vector<(double)> Bx)\n" + " int Bp, int Bi, long long Bx)\n" + "csrtocsc(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, \n" + " int Bi, float Bx)\n" + "csrtocsc(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, \n" + " int Bi, double Bx)\n" "csrtocsc(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bi, \n" - " std::vector<(npy_cfloat_wrapper)> Bx)\n" + " int Bp, int Bi, npy_cfloat_wrapper Bx)\n" "csrtocsc(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bi, \n" - " std::vector<(npy_cdouble_wrapper)> Bx)\n" + " int Bp, int Bi, npy_cdouble_wrapper Bx)\n" ""}, { (char *)"csctocsr", _wrap_csctocsr, METH_VARARGS, (char *)"\n" "csctocsr(int n_row, int n_col, int Ap, int Ai, signed char Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bj, \n" - " std::vector<(signed char)> Bx)\n" + " int Bp, int Bj, signed char Bx)\n" "csctocsr(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bj, \n" - " std::vector<(unsigned char)> Bx)\n" - "csctocsr(int n_row, int n_col, int Ap, int Ai, short Ax, std::vector<(int)> Bp, \n" - " std::vector<(int)> Bj, std::vector<(short)> Bx)\n" - "csctocsr(int n_row, int n_col, int Ap, int Ai, int Ax, std::vector<(int)> Bp, \n" - " std::vector<(int)> Bj, std::vector<(int)> Bx)\n" + " int Bp, int Bj, unsigned char Bx)\n" + "csctocsr(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, \n" + " int Bj, short Bx)\n" + "csctocsr(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, \n" + " int Bj, int Bx)\n" "csctocsr(int n_row, int n_col, int Ap, int Ai, long long Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bj, \n" - " std::vector<(long long)> Bx)\n" - "csctocsr(int n_row, int n_col, int Ap, int Ai, float Ax, std::vector<(int)> Bp, \n" - " std::vector<(int)> Bj, std::vector<(float)> Bx)\n" - "csctocsr(int n_row, int n_col, int Ap, int Ai, double Ax, std::vector<(int)> Bp, \n" - " std::vector<(int)> Bj, std::vector<(double)> Bx)\n" + " int Bp, int Bj, long long Bx)\n" + "csctocsr(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, \n" + " int Bj, float Bx)\n" + "csctocsr(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, \n" + " int Bj, double Bx)\n" "csctocsr(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bj, \n" - " std::vector<(npy_cfloat_wrapper)> Bx)\n" + " int Bp, int Bj, npy_cfloat_wrapper Bx)\n" "csctocsr(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bj, \n" - " std::vector<(npy_cdouble_wrapper)> Bx)\n" + " int Bp, int Bj, npy_cdouble_wrapper Bx)\n" ""}, - { (char *)"csrtocoo", _wrap_csrtocoo, METH_VARARGS, (char *)"\n" - "csrtocoo(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n" - " std::vector<(int)> Bi, std::vector<(int)> Bj, \n" - " std::vector<(signed char)> Bx)\n" - "csrtocoo(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, \n" - " std::vector<(int)> Bi, std::vector<(int)> Bj, \n" - " std::vector<(unsigned char)> Bx)\n" - "csrtocoo(int n_row, int n_col, int Ap, int Aj, short Ax, std::vector<(int)> Bi, \n" - " std::vector<(int)> Bj, std::vector<(short)> Bx)\n" - "csrtocoo(int n_row, int n_col, int Ap, int Aj, int Ax, std::vector<(int)> Bi, \n" - " std::vector<(int)> Bj, std::vector<(int)> Bx)\n" - "csrtocoo(int n_row, int n_col, int Ap, int Aj, long long Ax, \n" - " std::vector<(int)> Bi, std::vector<(int)> Bj, \n" - " std::vector<(long long)> Bx)\n" - "csrtocoo(int n_row, int n_col, int Ap, int Aj, float Ax, std::vector<(int)> Bi, \n" - " std::vector<(int)> Bj, std::vector<(float)> Bx)\n" - "csrtocoo(int n_row, int n_col, int Ap, int Aj, double Ax, std::vector<(int)> Bi, \n" - " std::vector<(int)> Bj, std::vector<(double)> Bx)\n" - "csrtocoo(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, \n" - " std::vector<(int)> Bi, std::vector<(int)> Bj, \n" - " std::vector<(npy_cfloat_wrapper)> Bx)\n" - "csrtocoo(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, \n" - " std::vector<(int)> Bi, std::vector<(int)> Bj, \n" - " std::vector<(npy_cdouble_wrapper)> Bx)\n" - ""}, - { (char *)"csctocoo", _wrap_csctocoo, METH_VARARGS, (char *)"\n" - "csctocoo(int n_row, int n_col, int Ap, int Ai, signed char Ax, \n" - " std::vector<(int)> Bi, std::vector<(int)> Bj, \n" - " std::vector<(signed char)> Bx)\n" - "csctocoo(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, \n" - " std::vector<(int)> Bi, std::vector<(int)> Bj, \n" - " std::vector<(unsigned char)> Bx)\n" - "csctocoo(int n_row, int n_col, int Ap, int Ai, short Ax, std::vector<(int)> Bi, \n" - " std::vector<(int)> Bj, std::vector<(short)> Bx)\n" - "csctocoo(int n_row, int n_col, int Ap, int Ai, int Ax, std::vector<(int)> Bi, \n" - " std::vector<(int)> Bj, std::vector<(int)> Bx)\n" - "csctocoo(int n_row, int n_col, int Ap, int Ai, long long Ax, \n" - " std::vector<(int)> Bi, std::vector<(int)> Bj, \n" - " std::vector<(long long)> Bx)\n" - "csctocoo(int n_row, int n_col, int Ap, int Ai, float Ax, std::vector<(int)> Bi, \n" - " std::vector<(int)> Bj, std::vector<(float)> Bx)\n" - "csctocoo(int n_row, int n_col, int Ap, int Ai, double Ax, std::vector<(int)> Bi, \n" - " std::vector<(int)> Bj, std::vector<(double)> Bx)\n" - "csctocoo(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, \n" - " std::vector<(int)> Bi, std::vector<(int)> Bj, \n" - " std::vector<(npy_cfloat_wrapper)> Bx)\n" - "csctocoo(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, \n" - " std::vector<(int)> Bi, std::vector<(int)> Bj, \n" - " std::vector<(npy_cdouble_wrapper)> Bx)\n" - ""}, + { (char *)"expandptr", _wrap_expandptr, METH_VARARGS, (char *)"expandptr(int n_row, int Ap, int Bi)"}, { (char *)"cootocsr", _wrap_cootocsr, METH_VARARGS, (char *)"\n" "cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, signed char Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bj, \n" - " std::vector<(signed char)> Bx)\n" + " int Bp, int Bj, signed char Bx)\n" "cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, unsigned char Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bj, \n" - " std::vector<(unsigned char)> Bx)\n" + " int Bp, int Bj, unsigned char Bx)\n" "cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, short Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bj, \n" - " std::vector<(short)> Bx)\n" + " int Bp, int Bj, short Bx)\n" "cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, int Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bj, \n" - " std::vector<(int)> Bx)\n" + " int Bp, int Bj, int Bx)\n" "cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, long long Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bj, \n" - " std::vector<(long long)> Bx)\n" + " int Bp, int Bj, long long Bx)\n" "cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, float Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bj, \n" - " std::vector<(float)> Bx)\n" + " int Bp, int Bj, float Bx)\n" "cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, double Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bj, \n" - " std::vector<(double)> Bx)\n" + " int Bp, int Bj, double Bx)\n" "cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cfloat_wrapper Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bj, \n" - " std::vector<(npy_cfloat_wrapper)> Bx)\n" + " int Bp, int Bj, npy_cfloat_wrapper Bx)\n" "cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cdouble_wrapper Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bj, \n" - " std::vector<(npy_cdouble_wrapper)> Bx)\n" + " int Bp, int Bj, npy_cdouble_wrapper Bx)\n" ""}, { (char *)"cootocsc", _wrap_cootocsc, METH_VARARGS, (char *)"\n" "cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, signed char Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bi, \n" - " std::vector<(signed char)> Bx)\n" + " int Bp, int Bi, signed char Bx)\n" "cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, unsigned char Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bi, \n" - " std::vector<(unsigned char)> Bx)\n" + " int Bp, int Bi, unsigned char Bx)\n" "cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, short Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bi, \n" - " std::vector<(short)> Bx)\n" + " int Bp, int Bi, short Bx)\n" "cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, int Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bi, \n" - " std::vector<(int)> Bx)\n" + " int Bp, int Bi, int Bx)\n" "cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, long long Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bi, \n" - " std::vector<(long long)> Bx)\n" + " int Bp, int Bi, long long Bx)\n" "cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, float Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bi, \n" - " std::vector<(float)> Bx)\n" + " int Bp, int Bi, float Bx)\n" "cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, double Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bi, \n" - " std::vector<(double)> Bx)\n" + " int Bp, int Bi, double Bx)\n" "cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cfloat_wrapper Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bi, \n" - " std::vector<(npy_cfloat_wrapper)> Bx)\n" + " int Bp, int Bi, npy_cfloat_wrapper Bx)\n" "cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cdouble_wrapper Ax, \n" - " std::vector<(int)> Bp, std::vector<(int)> Bi, \n" - " std::vector<(npy_cdouble_wrapper)> Bx)\n" + " int Bp, int Bi, npy_cdouble_wrapper Bx)\n" ""}, { (char *)"csrmucsr", _wrap_csrmucsr, METH_VARARGS, (char *)"\n" "csrmucsr(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n" Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-09 07:00:42 UTC (rev 3626) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-10 20:46:04 UTC (rev 3627) @@ -1326,6 +1326,7 @@ iter += 1 end = time.clock() + del T name = name.center(12) shape = ("%s" % (A.shape,)).center(20) @@ -1333,7 +1334,7 @@ def bench_conversion(self,level=5): - A = poisson2d(80) + A = poisson2d(100) formats = ['csr','csc','coo','lil','dok'] @@ -1354,13 +1355,14 @@ except: times.append(None) else: + x = fn() #warmup start = time.clock() iter = 0 while time.clock() < start + 0.2: x = fn() iter += 1 end = time.clock() - + del x times.append( (end - start)/float(iter)) output = " %3s " % fromfmt @@ -1368,7 +1370,7 @@ if t is None: output += '| n/a ' else: - output += '| %7.5f ' % t + output += '| %5.1fms ' % (1000*t) print output From scipy-svn at scipy.org Mon Dec 10 16:34:54 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 10 Dec 2007 15:34:54 -0600 (CST) Subject: [Scipy-svn] r3628 - trunk/scipy/sparse Message-ID: <20071210213454.A769839C034@new.scipy.org> Author: wnbell Date: 2007-12-10 15:34:27 -0600 (Mon, 10 Dec 2007) New Revision: 3628 Modified: trunk/scipy/sparse/sparse.py Log: made coo_matrix.dtype a property Modified: trunk/scipy/sparse/sparse.py =================================================================== --- trunk/scipy/sparse/sparse.py 2007-12-10 20:46:04 UTC (rev 3627) +++ trunk/scipy/sparse/sparse.py 2007-12-10 21:34:27 UTC (rev 3628) @@ -2057,7 +2057,6 @@ self.row = asarray(ij[0]) self.col = asarray(ij[1]) self.data = asarray(obj) - self.dtype = self.data.dtype if dims is None: if len(self.row) == 0 or len(self.col) == 0: @@ -2076,8 +2075,7 @@ if not isinstance(dims, tuple) or not isintlike(dims[0]): raise TypeError, "dimensions not understood" self.shape = dims - self.dtype = getdtype(dtype, default=float) - self.data = array([]) + self.data = array([],getdtype(dtype, default=float)) self.row = array([],dtype=intc) self.col = array([],dtype=intc) else: @@ -2090,12 +2088,16 @@ if len(M.shape) != 2: raise TypeError, "expected rank 2 array or matrix" self.shape = M.shape - self.dtype = M.dtype self.row,self.col = (M != 0).nonzero() self.data = M[self.row,self.col] self._check() + def _get_dtype(self): + return self.data.dtype + def _set_dtype(self,newtype): + self.data.dtype = newtype + dtype = property(fget=_get_dtype,fset=_set_dtype) def _check(self): """ Checks for consistency and stores the number of non-zeros as @@ -2154,7 +2156,6 @@ return csc_matrix((data, indices, indptr), self.shape) - def tocsr(self): if self.nnz == 0: return csr_matrix(self.shape, dtype=self.dtype) From scipy-svn at scipy.org Mon Dec 10 17:36:50 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 10 Dec 2007 16:36:50 -0600 (CST) Subject: [Scipy-svn] r3629 - trunk/scipy/io Message-ID: <20071210223650.A4EE6C7C092@new.scipy.org> Author: wnbell Date: 2007-12-10 16:36:31 -0600 (Mon, 10 Dec 2007) New Revision: 3629 Modified: trunk/scipy/io/mio4.py trunk/scipy/io/mio5.py trunk/scipy/io/mmio.py Log: made matlab return appropriate sparse format Modified: trunk/scipy/io/mio4.py =================================================================== --- trunk/scipy/io/mio4.py 2007-12-10 21:34:27 UTC (rev 3628) +++ trunk/scipy/io/mio4.py 2007-12-10 22:36:31 UTC (rev 3629) @@ -166,13 +166,18 @@ res = self.read_array() tmp = res[:-1,:] dims = res[-1,0:2] - ij = N.transpose(tmp[:,0:2]).astype('i') - 1 # for 1-based indexing - vals = tmp[:,2] - if res.shape[1] == 4: - vals = vals + res[:-1,3] * 1j + I = N.ascontiguousarray(tmp[:,0],dtype='intc') #fixes byte order also + J = N.ascontiguousarray(tmp[:,1],dtype='intc') + I -= 1 # for 1-based indexing + J -= 1 + if res.shape[1] == 3: + V = N.ascontiguousarray(tmp[:,2],dtype='float') + else: + V = N.ascontiguousarray(tmp[:,2],dtype='complex') + V.imag = tmp[:,3] if have_sparse: - return scipy.sparse.csc_matrix((vals,ij), dims) - return (dims, ij, vals) + return scipy.sparse.coo_matrix((V,(I,J)), dims) + return (dims, I, J, V) class MatFile4Reader(MatFileReader): Modified: trunk/scipy/io/mio5.py =================================================================== --- trunk/scipy/io/mio5.py 2007-12-10 21:34:27 UTC (rev 3628) +++ trunk/scipy/io/mio5.py 2007-12-10 22:36:31 UTC (rev 3629) @@ -348,41 +348,32 @@ class Mat5SparseMatrixGetter(Mat5MatrixGetter): def get_raw_array(self): - rowind = self.read_element() - colind = self.read_element() + rowind = self.read_element() + indptr = self.read_element() if self.header['is_complex']: # avoid array copy to save memory - res = self.read_element(copy=False) - res_j = self.read_element(copy=False) - res = res + (res_j * 1j) + data = self.read_element(copy=False) + data_j = self.read_element(copy=False) + data = data + (data_j * 1j) else: - res = self.read_element() + data = self.read_element() ''' From the matlab (TM) API documentation, last found here: http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/ rowind are simply the row indices for all the (res) non-zero entries in the sparse array. rowind has nzmax entries, so may well have more entries than len(res), the actual number of non-zero entries, but rowind[len(res):] can be discarded - and should be 0. colind has length (number of columns + 1), + and should be 0. indptr has length (number of columns + 1), and is such that, if D = diff(colind), D[j] gives the number of non-zero entries in column j. Because rowind values are stored in column order, this gives the column corresponding to each rowind ''' - cols = N.empty((len(res)), dtype=rowind.dtype) - col_counts = N.diff(colind) - start_row = 0 - for i in N.where(col_counts)[0]: - end_row = start_row + col_counts[i] - cols[start_row:end_row] = i - start_row = end_row - ij = N.vstack((rowind[:len(res)], cols)) if have_sparse: - result = scipy.sparse.csc_matrix((res,ij), - self.header['dims']) + dims = self.header['dims'] + return scipy.sparse.csc_matrix((data,rowind,indptr), dims) else: - result = (dims, ij, res) - return result + return (dims, data, rowind, indptr) class Mat5CharMatrixGetter(Mat5MatrixGetter): Modified: trunk/scipy/io/mmio.py =================================================================== --- trunk/scipy/io/mmio.py 2007-12-10 21:34:27 UTC (rev 3628) +++ trunk/scipy/io/mmio.py 2007-12-10 22:36:31 UTC (rev 3629) @@ -11,7 +11,7 @@ import os from numpy import asarray, real, imag, conj, zeros, ndarray, \ - empty, concatenate, ones + empty, concatenate, ones, ascontiguousarray from itertools import izip __all__ = ['mminfo','mmread','mmwrite'] @@ -195,21 +195,20 @@ if is_pattern: flat_data = flat_data.reshape(-1,2) - I = flat_data[:,0].astype('i') - J = flat_data[:,1].astype('i') + I = ascontiguousarray(flat_data[:,0], dtype='intc') + J = ascontiguousarray(flat_data[:,1], dtype='intc') V = ones(len(I)) elif is_complex: flat_data = flat_data.reshape(-1,4) - I = flat_data[:,0].astype('i') - J = flat_data[:,1].astype('i') - V = empty(len(I),dtype='complex') - V.real = flat_data[:,2] + I = ascontiguousarray(flat_data[:,0], dtype='intc') + J = ascontiguousarray(flat_data[:,1], dtype='intc') + V = ascontiguousarray(flat_data[:,2], dtype='complex') V.imag = flat_data[:,3] else: flat_data = flat_data.reshape(-1,3) - I = flat_data[:,0].astype('i') - J = flat_data[:,1].astype('i') - V = flat_data[:,2].copy() + I = ascontiguousarray(flat_data[:,0], dtype='intc') + J = ascontiguousarray(flat_data[:,1], dtype='intc') + V = ascontiguousarray(flat_data[:,2], dtype='float') I -= 1 #adjust indices (base 1 -> base 0) J -= 1 @@ -231,39 +230,6 @@ V = concatenate((V,od_V)) a = coo_matrix((V, (I, J)), dims=(rows, cols), dtype=dtype) - -# k = 0 -# data,row,col = [],[],[] -# row_append = row.append -# col_append = col.append -# data_append = data.append -# line = '%' -# while line: -# if not line.startswith('%'): -# l = line.split() -# i = int(l[0])-1 -# j = int(l[1])-1 -# if is_pattern: -# aij = 1.0 #use 1.0 for pattern matrices -# elif is_complex: -# aij = complex(*map(float,l[2:])) -# else: -# aij = float(l[2]) -# row_append(i) -# col_append(j) -# data_append(aij) -# if has_symmetry and i!=j: -# if is_skew: -# aij = -aij -# elif is_herm: -# aij = conj(aij) -# row_append(j) -# col_append(i) -# data_append(aij) -# k += 1 -# line = source.readline() -# assert k==entries,`k,entries` -# a = coo_matrix((data, (row, col)), dims=(rows, cols), dtype=dtype) else: raise NotImplementedError,`rep` From scipy-svn at scipy.org Mon Dec 10 18:26:06 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 10 Dec 2007 17:26:06 -0600 (CST) Subject: [Scipy-svn] r3630 - in trunk/scipy: linsolve/umfpack sparse sparse/sparsetools sparse/tests Message-ID: <20071210232606.9418BC7C00B@new.scipy.org> Author: wnbell Date: 2007-12-10 17:25:35 -0600 (Mon, 10 Dec 2007) New Revision: 3630 Modified: trunk/scipy/linsolve/umfpack/umfpack.py trunk/scipy/sparse/sparse.py trunk/scipy/sparse/sparsetools/sparsetools.i trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx trunk/scipy/sparse/tests/test_sparse.py Log: ensure_sorted_indices -> sort_indices and sorted_indices Modified: trunk/scipy/linsolve/umfpack/umfpack.py =================================================================== --- trunk/scipy/linsolve/umfpack/umfpack.py 2007-12-10 22:36:31 UTC (rev 3629) +++ trunk/scipy/linsolve/umfpack/umfpack.py 2007-12-10 23:25:35 UTC (rev 3630) @@ -355,7 +355,7 @@ if not assumeSortedIndices: # row/column indices cannot be assumed to be sorted - mtx.ensure_sorted_indices( inplace = True ) + mtx.sort_indices() indx = self._getIndx( mtx ) if self.isReal: Modified: trunk/scipy/sparse/sparse.py =================================================================== --- trunk/scipy/sparse/sparse.py 2007-12-10 22:36:31 UTC (rev 3629) +++ trunk/scipy/sparse/sparse.py 2007-12-10 23:25:35 UTC (rev 3630) @@ -934,15 +934,36 @@ def conj(self, copy=False): return self._with_data(self.data.conj(),copy=copy) - def _ensure_sorted_indices(self, shape0, shape1, inplace=False): - """Return a copy of this matrix where the row indices are sorted + def sorted_indices(self): + """Return a copy of this matrix with sorted indices """ + A = self.copy() + A.sort_indices() + return A + + # an alternative that has linear complexity is the following + # typically the previous option is faster + #return self._toother()._toother() + + def sort_indices(self): + """Sort the indices of this matrix *in place* + """ + fn = getattr(sparsetools,'sort_' + self.format + '_indices') + + M,N = self.shape + fn( M, N, self.indptr, self.indices, self.data) + + def ensure_sorted_indices(self, inplace=False): + """Return a copy of this matrix where the column indices are sorted + """ + warnings.warn('ensure_sorted_indices is deprecated, ' \ + 'use sorted_indices() or sort_indices() instead', \ + DeprecationWarning) + if inplace: - sparsetools.sort_csr_indices(shape0, shape1, - self.indptr, self.indices, - self.data ) + self.sort_indices() else: - return self._toother()._toother() + return self.sorted_indices() def _get_submatrix( self, shape0, shape1, slice0, slice1 ): """Return a submatrix of this matrix (new matrix is created).""" @@ -1189,11 +1210,6 @@ self.indices = self.indices[:nnz] self.nzmax = nnz - def ensure_sorted_indices(self, inplace=False): - """Return a copy of this matrix where the row indices are sorted - """ - return _cs_matrix._ensure_sorted_indices(self, self.shape[1], self.shape[0], inplace) - def get_submatrix( self, slice0, slice1 ): """Return a submatrix of this matrix (new matrix is created). Rows and columns can be selected using slice instances, tuples, @@ -1342,8 +1358,7 @@ def tolil(self): lil = lil_matrix(self.shape,dtype=self.dtype) - #TODO make this more efficient - csr = self.ensure_sorted_indices() + csr = self.sorted_indices() rows,data = lil.rows,lil.data ptr,ind,dat = csr.indptr,csr.indices,csr.data @@ -1419,11 +1434,6 @@ self.indices = self.indices[:nnz] self.nzmax = nnz - def ensure_sorted_indices(self, inplace=False): - """Return a copy of this matrix where the column indices are sorted - """ - return _cs_matrix._ensure_sorted_indices(self, self.shape[0], self.shape[1], inplace) - def get_submatrix( self, slice0, slice1 ): """Return a submatrix of this matrix (new matrix is created).. Rows and columns can be selected using slice instances, tuples, Modified: trunk/scipy/sparse/sparsetools/sparsetools.i =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.i 2007-12-10 22:36:31 UTC (rev 3629) +++ trunk/scipy/sparse/sparsetools/sparsetools.i 2007-12-10 23:25:35 UTC (rev 3630) @@ -90,6 +90,7 @@ %define I_INPLACE_ARRAY1( ctype ) %apply ctype * INPLACE_ARRAY { ctype Ap [ ], + ctype Ai [ ], ctype Aj [ ], ctype Bp [ ], ctype Bi [ ], Modified: trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx 2007-12-10 22:36:31 UTC (rev 3629) +++ trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx 2007-12-10 23:25:35 UTC (rev 3630) @@ -2478,18 +2478,17 @@ /* -------- TYPES TABLE (BEGIN) -------- */ #define SWIGTYPE_p_char swig_types[0] -#define SWIGTYPE_p_int 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_long_t swig_types[5] -#define SWIGTYPE_p_std__vectorTnpy_cdouble_wrapper_t swig_types[6] -#define SWIGTYPE_p_std__vectorTnpy_cfloat_wrapper_t swig_types[7] -#define SWIGTYPE_p_std__vectorTshort_t swig_types[8] -#define SWIGTYPE_p_std__vectorTsigned_char_t swig_types[9] -#define SWIGTYPE_p_std__vectorTunsigned_char_t swig_types[10] -static swig_type_info *swig_types[12]; -static swig_module_info swig_module = {swig_types, 11, 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_long_t swig_types[4] +#define SWIGTYPE_p_std__vectorTnpy_cdouble_wrapper_t swig_types[5] +#define SWIGTYPE_p_std__vectorTnpy_cfloat_wrapper_t swig_types[6] +#define SWIGTYPE_p_std__vectorTshort_t swig_types[7] +#define SWIGTYPE_p_std__vectorTsigned_char_t swig_types[8] +#define SWIGTYPE_p_std__vectorTunsigned_char_t swig_types[9] +static swig_type_info *swig_types[11]; +static swig_module_info swig_module = {swig_types, 10, 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) @@ -39374,8 +39373,7 @@ int ecode2 = 0 ; PyArrayObject *array3 = NULL ; int is_new_object3 ; - void *argp4 = 0 ; - int res4 = 0 ; + PyArrayObject *temp4 = NULL ; PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; @@ -39404,12 +39402,12 @@ arg3 = (int*) array3->data; } - res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "sort_csc_indices" "', argument " "4"" of type '" "int []""'"); - } - arg4 = reinterpret_cast< int * >(argp4); { + temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); + if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; + arg4 = (int*) array_data(temp4); + } + { temp5 = obj_to_array_no_conversion(obj4,PyArray_BYTE); if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (signed char*) array_data(temp5); @@ -39441,8 +39439,7 @@ int ecode2 = 0 ; PyArrayObject *array3 = NULL ; int is_new_object3 ; - void *argp4 = 0 ; - int res4 = 0 ; + PyArrayObject *temp4 = NULL ; PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; @@ -39471,12 +39468,12 @@ arg3 = (int*) array3->data; } - res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "sort_csc_indices" "', argument " "4"" of type '" "int []""'"); - } - arg4 = reinterpret_cast< int * >(argp4); { + temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); + if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; + arg4 = (int*) array_data(temp4); + } + { temp5 = obj_to_array_no_conversion(obj4,PyArray_UBYTE); if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (unsigned char*) array_data(temp5); @@ -39508,8 +39505,7 @@ int ecode2 = 0 ; PyArrayObject *array3 = NULL ; int is_new_object3 ; - void *argp4 = 0 ; - int res4 = 0 ; + PyArrayObject *temp4 = NULL ; PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; @@ -39538,12 +39534,12 @@ arg3 = (int*) array3->data; } - res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "sort_csc_indices" "', argument " "4"" of type '" "int []""'"); - } - arg4 = reinterpret_cast< int * >(argp4); { + temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); + if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; + arg4 = (int*) array_data(temp4); + } + { temp5 = obj_to_array_no_conversion(obj4,PyArray_SHORT); if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (short*) array_data(temp5); @@ -39575,8 +39571,7 @@ int ecode2 = 0 ; PyArrayObject *array3 = NULL ; int is_new_object3 ; - void *argp4 = 0 ; - int res4 = 0 ; + PyArrayObject *temp4 = NULL ; PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; @@ -39605,12 +39600,12 @@ arg3 = (int*) array3->data; } - res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "sort_csc_indices" "', argument " "4"" of type '" "int []""'"); - } - arg4 = reinterpret_cast< int * >(argp4); { + temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); + if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; + arg4 = (int*) array_data(temp4); + } + { temp5 = obj_to_array_no_conversion(obj4,PyArray_INT); if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (int*) array_data(temp5); @@ -39642,8 +39637,7 @@ int ecode2 = 0 ; PyArrayObject *array3 = NULL ; int is_new_object3 ; - void *argp4 = 0 ; - int res4 = 0 ; + PyArrayObject *temp4 = NULL ; PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; @@ -39672,12 +39666,12 @@ arg3 = (int*) array3->data; } - res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "sort_csc_indices" "', argument " "4"" of type '" "int []""'"); - } - arg4 = reinterpret_cast< int * >(argp4); { + temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); + if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; + arg4 = (int*) array_data(temp4); + } + { temp5 = obj_to_array_no_conversion(obj4,PyArray_LONGLONG); if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (long long*) array_data(temp5); @@ -39709,8 +39703,7 @@ int ecode2 = 0 ; PyArrayObject *array3 = NULL ; int is_new_object3 ; - void *argp4 = 0 ; - int res4 = 0 ; + PyArrayObject *temp4 = NULL ; PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; @@ -39739,12 +39732,12 @@ arg3 = (int*) array3->data; } - res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "sort_csc_indices" "', argument " "4"" of type '" "int []""'"); - } - arg4 = reinterpret_cast< int * >(argp4); { + temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); + if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; + arg4 = (int*) array_data(temp4); + } + { temp5 = obj_to_array_no_conversion(obj4,PyArray_FLOAT); if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (float*) array_data(temp5); @@ -39776,8 +39769,7 @@ int ecode2 = 0 ; PyArrayObject *array3 = NULL ; int is_new_object3 ; - void *argp4 = 0 ; - int res4 = 0 ; + PyArrayObject *temp4 = NULL ; PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; @@ -39806,12 +39798,12 @@ arg3 = (int*) array3->data; } - res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "sort_csc_indices" "', argument " "4"" of type '" "int []""'"); - } - arg4 = reinterpret_cast< int * >(argp4); { + temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); + if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; + arg4 = (int*) array_data(temp4); + } + { temp5 = obj_to_array_no_conversion(obj4,PyArray_DOUBLE); if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (double*) array_data(temp5); @@ -39843,8 +39835,7 @@ int ecode2 = 0 ; PyArrayObject *array3 = NULL ; int is_new_object3 ; - void *argp4 = 0 ; - int res4 = 0 ; + PyArrayObject *temp4 = NULL ; PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; @@ -39873,12 +39864,12 @@ arg3 = (int*) array3->data; } - res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "sort_csc_indices" "', argument " "4"" of type '" "int []""'"); - } - arg4 = reinterpret_cast< int * >(argp4); { + temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); + if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; + arg4 = (int*) array_data(temp4); + } + { temp5 = obj_to_array_no_conversion(obj4,PyArray_CFLOAT); if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (npy_cfloat_wrapper*) array_data(temp5); @@ -39910,8 +39901,7 @@ int ecode2 = 0 ; PyArrayObject *array3 = NULL ; int is_new_object3 ; - void *argp4 = 0 ; - int res4 = 0 ; + PyArrayObject *temp4 = NULL ; PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; @@ -39940,12 +39930,12 @@ arg3 = (int*) array3->data; } - res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "sort_csc_indices" "', argument " "4"" of type '" "int []""'"); - } - arg4 = reinterpret_cast< int * >(argp4); { + temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); + if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; + arg4 = (int*) array_data(temp4); + } + { temp5 = obj_to_array_no_conversion(obj4,PyArray_CDOUBLE); if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (npy_cdouble_wrapper*) array_data(temp5); @@ -41054,8 +41044,7 @@ int val2 ; int ecode2 = 0 ; PyArrayObject *temp3 = NULL ; - void *argp4 = 0 ; - int res4 = 0 ; + PyArrayObject *temp4 = NULL ; PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; @@ -41079,12 +41068,12 @@ if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; arg3 = (int*) array_data(temp3); } - res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "sum_csc_duplicates" "', argument " "4"" of type '" "int []""'"); - } - arg4 = reinterpret_cast< int * >(argp4); { + temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); + if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; + arg4 = (int*) array_data(temp4); + } + { temp5 = obj_to_array_no_conversion(obj4,PyArray_BYTE); if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (signed char*) array_data(temp5); @@ -41109,8 +41098,7 @@ int val2 ; int ecode2 = 0 ; PyArrayObject *temp3 = NULL ; - void *argp4 = 0 ; - int res4 = 0 ; + PyArrayObject *temp4 = NULL ; PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; @@ -41134,12 +41122,12 @@ if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; arg3 = (int*) array_data(temp3); } - res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "sum_csc_duplicates" "', argument " "4"" of type '" "int []""'"); - } - arg4 = reinterpret_cast< int * >(argp4); { + temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); + if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; + arg4 = (int*) array_data(temp4); + } + { temp5 = obj_to_array_no_conversion(obj4,PyArray_UBYTE); if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (unsigned char*) array_data(temp5); @@ -41164,8 +41152,7 @@ int val2 ; int ecode2 = 0 ; PyArrayObject *temp3 = NULL ; - void *argp4 = 0 ; - int res4 = 0 ; + PyArrayObject *temp4 = NULL ; PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; @@ -41189,12 +41176,12 @@ if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; arg3 = (int*) array_data(temp3); } - res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "sum_csc_duplicates" "', argument " "4"" of type '" "int []""'"); - } - arg4 = reinterpret_cast< int * >(argp4); { + temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); + if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; + arg4 = (int*) array_data(temp4); + } + { temp5 = obj_to_array_no_conversion(obj4,PyArray_SHORT); if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (short*) array_data(temp5); @@ -41219,8 +41206,7 @@ int val2 ; int ecode2 = 0 ; PyArrayObject *temp3 = NULL ; - void *argp4 = 0 ; - int res4 = 0 ; + PyArrayObject *temp4 = NULL ; PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; @@ -41244,12 +41230,12 @@ if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; arg3 = (int*) array_data(temp3); } - res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "sum_csc_duplicates" "', argument " "4"" of type '" "int []""'"); - } - arg4 = reinterpret_cast< int * >(argp4); { + temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); + if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; + arg4 = (int*) array_data(temp4); + } + { temp5 = obj_to_array_no_conversion(obj4,PyArray_INT); if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (int*) array_data(temp5); @@ -41274,8 +41260,7 @@ int val2 ; int ecode2 = 0 ; PyArrayObject *temp3 = NULL ; - void *argp4 = 0 ; - int res4 = 0 ; + PyArrayObject *temp4 = NULL ; PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; @@ -41299,12 +41284,12 @@ if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; arg3 = (int*) array_data(temp3); } - res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "sum_csc_duplicates" "', argument " "4"" of type '" "int []""'"); - } - arg4 = reinterpret_cast< int * >(argp4); { + temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); + if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; + arg4 = (int*) array_data(temp4); + } + { temp5 = obj_to_array_no_conversion(obj4,PyArray_LONGLONG); if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (long long*) array_data(temp5); @@ -41329,8 +41314,7 @@ int val2 ; int ecode2 = 0 ; PyArrayObject *temp3 = NULL ; - void *argp4 = 0 ; - int res4 = 0 ; + PyArrayObject *temp4 = NULL ; PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; @@ -41354,12 +41338,12 @@ if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; arg3 = (int*) array_data(temp3); } - res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "sum_csc_duplicates" "', argument " "4"" of type '" "int []""'"); - } - arg4 = reinterpret_cast< int * >(argp4); { + temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); + if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; + arg4 = (int*) array_data(temp4); + } + { temp5 = obj_to_array_no_conversion(obj4,PyArray_FLOAT); if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (float*) array_data(temp5); @@ -41384,8 +41368,7 @@ int val2 ; int ecode2 = 0 ; PyArrayObject *temp3 = NULL ; - void *argp4 = 0 ; - int res4 = 0 ; + PyArrayObject *temp4 = NULL ; PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; @@ -41409,12 +41392,12 @@ if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; arg3 = (int*) array_data(temp3); } - res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "sum_csc_duplicates" "', argument " "4"" of type '" "int []""'"); - } - arg4 = reinterpret_cast< int * >(argp4); { + temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); + if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; + arg4 = (int*) array_data(temp4); + } + { temp5 = obj_to_array_no_conversion(obj4,PyArray_DOUBLE); if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (double*) array_data(temp5); @@ -41439,8 +41422,7 @@ int val2 ; int ecode2 = 0 ; PyArrayObject *temp3 = NULL ; - void *argp4 = 0 ; - int res4 = 0 ; + PyArrayObject *temp4 = NULL ; PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; @@ -41464,12 +41446,12 @@ if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; arg3 = (int*) array_data(temp3); } - res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "sum_csc_duplicates" "', argument " "4"" of type '" "int []""'"); - } - arg4 = reinterpret_cast< int * >(argp4); { + temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); + if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; + arg4 = (int*) array_data(temp4); + } + { temp5 = obj_to_array_no_conversion(obj4,PyArray_CFLOAT); if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (npy_cfloat_wrapper*) array_data(temp5); @@ -41494,8 +41476,7 @@ int val2 ; int ecode2 = 0 ; PyArrayObject *temp3 = NULL ; - void *argp4 = 0 ; - int res4 = 0 ; + PyArrayObject *temp4 = NULL ; PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; @@ -41519,12 +41500,12 @@ if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; arg3 = (int*) array_data(temp3); } - res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "sum_csc_duplicates" "', argument " "4"" of type '" "int []""'"); - } - arg4 = reinterpret_cast< int * >(argp4); { + temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); + if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; + arg4 = (int*) array_data(temp4); + } + { temp5 = obj_to_array_no_conversion(obj4,PyArray_CDOUBLE); if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (npy_cdouble_wrapper*) array_data(temp5); @@ -44421,7 +44402,6 @@ /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_int = {"_p_int", "int *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_std__vectorTdouble_t = {"_p_std__vectorTdouble_t", "std::vector *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_std__vectorTfloat_t = {"_p_std__vectorTfloat_t", "std::vector *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_std__vectorTint_t = {"_p_std__vectorTint_t", "std::vector *", 0, 0, (void*)0, 0}; @@ -44434,7 +44414,6 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_char, - &_swigt__p_int, &_swigt__p_std__vectorTdouble_t, &_swigt__p_std__vectorTfloat_t, &_swigt__p_std__vectorTint_t, @@ -44447,7 +44426,6 @@ }; static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_std__vectorTdouble_t[] = { {&_swigt__p_std__vectorTdouble_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_std__vectorTfloat_t[] = { {&_swigt__p_std__vectorTfloat_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_std__vectorTint_t[] = { {&_swigt__p_std__vectorTint_t, 0, 0, 0},{0, 0, 0, 0}}; @@ -44460,7 +44438,6 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_char, - _swigc__p_int, _swigc__p_std__vectorTdouble_t, _swigc__p_std__vectorTfloat_t, _swigc__p_std__vectorTint_t, Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-10 22:36:31 UTC (rev 3629) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-10 23:25:35 UTC (rev 3630) @@ -746,16 +746,13 @@ assert_equal(e.dtype,mytype) assert_equal(e.A.dtype,mytype) - def check_ensure_sorted_indices(self): - #print 'sorting CSR indices' - data = arange( 5 ) - col = array( [7, 2, 1, 5, 4] ) - ptr = [0, 3, 5] - asp = csr_matrix( (data, col, ptr), dims = (2,10) ) + def check_sort_indices(self): + data = arange( 5 ) + indices = array( [7, 2, 1, 5, 4] ) + indptr = array( [0, 3, 5] ) + asp = csr_matrix( (data, indices, indptr), dims = (2,10) ) bsp = asp.copy() - #print 'in\n', asp - asp.ensure_sorted_indices( inplace = True ) - #print 'out\n', asp + asp.sort_indices( ) assert_array_equal(asp.indices,[1, 2, 7, 4, 5]) for ir in range( asp.shape[0] ): for ic in range( asp.shape[1] ): @@ -839,16 +836,13 @@ assert_equal(e.dtype, mytype) assert_equal(e.A.dtype, mytype) - def check_ensure_sorted_indices(self): - #print 'sorting CSC indices' + def check_sort_indices(self): data = arange( 5 ) row = array( [7, 2, 1, 5, 4] ) ptr = [0, 3, 5] asp = csc_matrix( (data, row, ptr), dims = (10,2) ) bsp = asp.copy() - #print 'in\n', asp - asp.ensure_sorted_indices( inplace = True ) - #print 'out\n', asp + asp.sort_indices() assert_array_equal(asp.indices,[1, 2, 7, 4, 5]) for ir in range( asp.shape[0] ): for ic in range( asp.shape[1] ): From scipy-svn at scipy.org Mon Dec 10 22:45:17 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 10 Dec 2007 21:45:17 -0600 (CST) Subject: [Scipy-svn] r3631 - trunk/scipy/sandbox/multigrid Message-ID: <20071211034517.B30E539C1CB@new.scipy.org> Author: wnbell Date: 2007-12-10 21:45:14 -0600 (Mon, 10 Dec 2007) New Revision: 3631 Modified: trunk/scipy/sandbox/multigrid/utils.py Log: make symmetric_rescaling work for general csr mats Modified: trunk/scipy/sandbox/multigrid/utils.py =================================================================== --- trunk/scipy/sandbox/multigrid/utils.py 2007-12-10 23:25:35 UTC (rev 3630) +++ trunk/scipy/sandbox/multigrid/utils.py 2007-12-11 03:45:14 UTC (rev 3631) @@ -148,11 +148,11 @@ D_sqrt_inv = 1.0/D_sqrt D_sqrt_inv[mask] = 0 - #TODO time this against simple implementation - data = A.data * D_sqrt_inv[A.indices] - data *= D_sqrt_inv[arange(A.shape[0]).repeat(diff(A.indptr))] + Acoo = A.tocoo(copy=False) + data = A.data[:A.nnz] * D_sqrt_inv[Acoo.row] + data *= D_sqrt_inv[Acoo.col] - DAD = A.__class__((data,A.indices,A.indptr),dims=A.shape) + DAD = A.__class__((data,A.indices[:A.nnz],A.indptr),dims=A.shape) return D_sqrt,D_sqrt_inv,DAD From scipy-svn at scipy.org Mon Dec 10 23:50:35 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 10 Dec 2007 22:50:35 -0600 (CST) Subject: [Scipy-svn] r3632 - trunk/scipy/sparse Message-ID: <20071211045035.6B0D139C0CF@new.scipy.org> Author: wnbell Date: 2007-12-10 22:50:31 -0600 (Mon, 10 Dec 2007) New Revision: 3632 Modified: trunk/scipy/sparse/sparse.py Log: refactoring of CSR/CSC removed use of (otherwise unused) attribute nzmax Modified: trunk/scipy/sparse/sparse.py =================================================================== --- trunk/scipy/sparse/sparse.py 2007-12-11 03:45:14 UTC (rev 3631) +++ trunk/scipy/sparse/sparse.py 2007-12-11 04:50:31 UTC (rev 3632) @@ -160,16 +160,6 @@ except AttributeError: raise AttributeError, "nnz not defined" - def getnzmax(self): - try: - nzmax = self.nzmax - except AttributeError: - try: - nzmax = self.nnz - except AttributeError: - nzmax = 0 - return nzmax - def getformat(self): try: format = self.format @@ -498,7 +488,7 @@ class _cs_matrix(spmatrix): """base matrix class for compressed row and column oriented matrices""" - def __init__(self, arg1, dims=None, nzmax=NZMAX, dtype=None, copy=False): + def __init__(self, arg1, dims=None, dtype=None, copy=False): spmatrix.__init__(self) if isdense(arg1): @@ -523,12 +513,9 @@ # create empty matrix self.shape = arg1 #spmatrix checks for errors here M, N = self.shape - self.data = zeros((nzmax,), getdtype(dtype, default=float)) - self.indices = zeros((nzmax,), intc) - if self.format[-1] == 'r': - self.indptr = zeros(M+1, dtype='intc') - else: - self.indptr = zeros(N+1, dtype='intc') + self.data = zeros(0, getdtype(dtype, default=float)) + self.indices = zeros(0, intc) + self.indptr = zeros(self._swap(self.shape)[0] + 1, dtype='intc') else: try: # Try interpreting it as (data, ij) @@ -561,20 +548,25 @@ if self.shape is None: # shape not already set, try to infer dimensions try: - first_dim = len(self.indptr) - 1 - second_dim = self.indices.max() + 1 + major_dim = len(self.indptr) - 1 + minor_dim = self.indices.max() + 1 except: raise ValueError,'unable to infer matrix dimensions' else: - if self.format[-1] == 'r': - # row oriented matrix - self.shape = (first_dim,second_dim) - else: - # column oriented matrix - self.shape = (second_dim,first_dim) + self.shape = self._swap((major_dim,minor_dim)) self.check_format(full_check=False) + def getnnz(self): + return self.indptr[-1] + nnz = property(fget=getnnz) + + def _get_dtype(self): + return self.data.dtype + def _set_dtype(self,newtype): + self.data.dtype = newtype + dtype = property(fget=_get_dtype,fset=_set_dtype) + def _set_self(self, other, copy=False): """take the member variables of other and assign them to self""" @@ -585,26 +577,13 @@ self.indices = other.indices self.indptr = other.indptr self.shape = other.shape - - - def _get_dtype(self): - return self.data.dtype - def _set_dtype(self,newtype): - self.data.dtype = newtype - dtype = property(fget=_get_dtype,fset=_set_dtype) def _check_format(self, full_check): self.shape = tuple([int(x) for x in self.shape]) # for floats etc. - assert(self.format in ['csr','csc']) - if self.format[-1] == 'r': - primary,secondary = 'row','column' - indptr_size = self.shape[0] + 1 - indices_bound = self.shape[1] - else: - primary,secondary = 'column','row' - indptr_size = self.shape[1] + 1 - indices_bound = self.shape[0] + #use _swap to determine proper bounds + major_name,minor_name = self._swap(('row','column')) + major_dim,minor_dim = self._swap(self.shape) # index arrays should have integer data types if self.indptr.dtype.kind != 'i': @@ -625,10 +604,10 @@ raise ValueError,"data, indices, and indptr should be rank 1" # check index pointer - if (len(self.indptr) != indptr_size ): + if (len(self.indptr) != major_dim + 1 ): raise ValueError, \ "index pointer size (%d) should be (%d)" % \ - (len(self.indptr), indptr_size) + (len(self.indptr), major_dim + 1) if (self.indptr[0] != 0): raise ValueError,"index pointer should start with 0" @@ -640,32 +619,24 @@ "Last value of index pointer should be less than "\ "the size of index and data arrays" - self.nnz = self.indptr[-1] - self.nzmax = len(self.indices) + self.prune() if full_check: #check format validity (more expensive) if self.nnz > 0: - if amax(self.indices[:self.nnz]) >= indices_bound: + if amax(self.indices) >= minor_dim: raise ValueError, "%s index values must be < %d" % \ - (secondary,indices_bound) - if amin(self.indices[:self.nnz]) < 0: + (minor_name,minor_dim) + if amin(self.indices) < 0: raise ValueError, "%s index values must be >= 0" % \ - secondary - if numpy.diff(self.indptr).min() < 0: - raise ValueError,'index pointer values must form a " \ - "non-decreasing sequence' + minor_name + if numpy.diff(self.indptr).min() < 0: + raise ValueError,'index pointer values must form a " \ + "non-decreasing sequence' def astype(self, t): return self._with_data(self.data.astype(t)) - def __repr__(self): - format = self.getformat() - return "<%dx%d sparse matrix of type '%s'\n\twith %d stored "\ - "elements (space for %d)\n\tin %s format>" % \ - (self.shape + (self.dtype.type, self.getnnz(), self.nzmax, \ - _formats[format][1])) - def _with_data(self,data,copy=True): """Returns a matrix with the same sparsity structure as self, but with different data. By default the structure arrays @@ -1019,12 +990,11 @@ - csc_matrix(s) with another sparse matrix s (sugar for .tocsc()) - - csc_matrix((M, N), [nzmax, dtype]) + - csc_matrix((M, N), [dtype]) to construct a container, where (M, N) are dimensions and - nzmax, dtype are optional, defaulting to nzmax=sparse.NZMAX - and dtype='d'. + dtype is optional, defaulting to dtype='d'. - - csc_matrix((data, ij), [(M, N), nzmax]) + - csc_matrix((data, ij), [(M, N)]) where data, ij satisfy: a[ij[0, k], ij[1, k]] = data[k] @@ -1115,14 +1085,12 @@ indxs = numpy.where(row == self.indices[self.indptr[col]:self.indptr[col+1]]) if len(indxs[0]) == 0: #value not present - nzmax = self.nzmax - if (nzmax < self.nnz+1): # need more room - alloc = max(1, self.allocsize) - self.data = resize1d(self.data, nzmax + alloc) - self.indices = resize1d(self.indices, nzmax + alloc) + #TODO handle this with concatenation + self.data = resize1d(self.data, self.nnz + 1) + self.indices = resize1d(self.indices, self.nnz + 1) newindex = self.indptr[col] - self.data[newindex+1:] = self.data[newindex:-1] + self.data[newindex+1:] = self.data[newindex:-1] self.indices[newindex+1:] = self.indices[newindex:-1] self.data[newindex] = val @@ -1154,15 +1122,10 @@ col = searchsorted(self.indptr, ind+1)-1 return (row, col) + def tocsc(self, copy=False): return self.toself(copy) - def _toother(self): - return self.tocsr() - - def _tothis(self, other): - return other.tocsc() - def tocsr(self): indptr = empty(self.shape[0] + 1, dtype=intc) indices = empty(self.nnz, dtype=intc) @@ -1174,7 +1137,6 @@ return csr_matrix((data, indices, indptr), self.shape) - def tocoo(self,copy=True): """Return a COOrdinate representation of this matrix @@ -1200,15 +1162,15 @@ def prune(self): """ Remove empty space after all non-zero elements. """ - nnz = self.indptr[-1] - if self.nzmax <= nnz: - if self.nzmax < nnz: - raise RuntimeError, "should never have nnz > nzmax" - return - self.nnz = nnz - self.data = self.data[:nnz] - self.indices = self.indices[:nnz] - self.nzmax = nnz + if len(self.indptr) != self.shape[1] + 1: + raise ValueError, "index pointer has invalid length" + if len(self.indices) < self.nnz: + raise ValueError, "indices array has fewer than nnz elements" + if len(self.data) < self.nnz: + raise ValueError, "data array has fewer than nnz elements" + + self.data = self.data[:self.nnz] + self.indices = self.indices[:self.nnz] def get_submatrix( self, slice0, slice1 ): """Return a submatrix of this matrix (new matrix is created). @@ -1218,7 +1180,20 @@ slice1, slice0 ) nr, nc = aux[3:] return self.__class__( aux[:3], dims = (nc, nr) ) + + # these functions are used by the parent class (_cs_matrix) + # to remove redudancy between csc_matrix and csr_matrix + def _swap(self,x): + """swap the members of x if this is a column-oriented matrix + """ + return (x[1],x[0]) + def _toother(self): + return self.tocsr() + + def _tothis(self, other): + return other.tocsc() + class csr_matrix(_cs_matrix): """ Compressed sparse row matrix This can be instantiated in several ways: @@ -1228,12 +1203,11 @@ - csr_matrix(s) with another sparse matrix s (sugar for .tocsr()) - - csr_matrix((M, N), [nzmax, dtype]) + - csr_matrix((M, N), [dtype]) to construct a container, where (M, N) are dimensions and - nzmax, dtype are optional, defaulting to nzmax=sparse.NZMAX - and dtype='d'. + dtype is optional, defaulting to dtype='d'. - - csr_matrix((data, ij), [dims=(M, N), nzmax=nzmax]) + - csr_matrix((data, ij), [dims=(M, N)]) where data, ij satisfy: a[ij[0, k], ij[1, k]] = data[k] @@ -1324,11 +1298,8 @@ indxs = numpy.where(col == self.indices[self.indptr[row]:self.indptr[row+1]]) if len(indxs[0]) == 0: #value not present - nzmax = self.nzmax - if (nzmax < self.nnz+1): # need more room - alloc = max(1, self.allocsize) - self.data = resize1d(self.data, nzmax + alloc) - self.indices = resize1d(self.indices, nzmax + alloc) + self.data = resize1d(self.data, self.nnz + 1) + self.indices = resize1d(self.indices, self.nnz + 1) newindex = self.indptr[row] self.data[newindex+1:] = self.data[newindex:-1] @@ -1358,7 +1329,7 @@ def tolil(self): lil = lil_matrix(self.shape,dtype=self.dtype) - csr = self.sorted_indices() + csr = self.sorted_indices() #lil_matrix needs sorted rows rows,data = lil.rows,lil.data ptr,ind,dat = csr.indptr,csr.indices,csr.data @@ -1369,10 +1340,6 @@ rows[n] = ind[start:end].tolist() data[n] = dat[start:end].tolist() - lil.rows = rows - lil.data = data - #lil.shape = self.shape - return lil def tocsr(self, copy=False): @@ -1408,31 +1375,24 @@ return coo_matrix((data,(row,col)), self.shape) - - def _toother(self): - return self.tocsc() - - def _tothis(self, other): - return other.tocsr() - def toarray(self): data = numpy.zeros(self.shape, self.data.dtype) csrtodense(self.shape[0], self.shape[1], self.indptr, self.indices, self.data, data) return data - + def prune(self): - """ Eliminate non-zero entries, leaving space for at least - newnzmax elements. + """ Remove empty space after all non-zero elements. """ - nnz = self.indptr[-1] - if self.nzmax <= nnz: - if self.nzmax < nnz: - raise RuntimeError, "should never have nnz > nzmax" - return - self.data = self.data[:nnz] - self.indices = self.indices[:nnz] - self.nzmax = nnz + if len(self.indptr) != self.shape[0] + 1: + raise ValueError, "index pointer has invalid length" + if len(self.indices) < self.nnz: + raise ValueError, "indices array has fewer than nnz elements" + if len(self.data) < self.nnz: + raise ValueError, "data array has fewer than nnz elements" + + self.data = self.data[:self.nnz] + self.indices = self.indices[:self.nnz] def get_submatrix( self, slice0, slice1 ): """Return a submatrix of this matrix (new matrix is created).. @@ -1443,17 +1403,20 @@ nr, nc = aux[3:] return self.__class__( aux[:3], dims = (nr, nc) ) -# This function was for sorting dictionary keys by the second tuple element. -# (We now use the Schwartzian transform instead for efficiency.) -# def csc_cmp(x, y): -# if (x == y): return 0 -# elif (x[1] == y[1]): -# if (x[0] > y[0]): return 1 -# elif (x[0] == y[0]): return 0 -# else: return -1 -# elif (x[1] > y[1]): return 1 -# else: return -1 + # these functions are used by the parent class (_cs_matrix) + # to remove redudancy between csc_matrix and csr_matrix + def _swap(self,x): + """swap the members of x if this is a column-oriented matrix + """ + return (x[0],x[1]) + def _toother(self): + return self.tocsc() + + def _tothis(self, other): + return other.tocsr() + + # dictionary of keys based matrix class dok_matrix(spmatrix, dict): """ A dictionary of keys based matrix. This is an efficient From scipy-svn at scipy.org Tue Dec 11 00:03:16 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 10 Dec 2007 23:03:16 -0600 (CST) Subject: [Scipy-svn] r3633 - trunk/scipy/sparse Message-ID: <20071211050316.6659439C131@new.scipy.org> Author: wnbell Date: 2007-12-10 23:03:14 -0600 (Mon, 10 Dec 2007) New Revision: 3633 Modified: trunk/scipy/sparse/sparse.py Log: further refactoring of CSR/CSC Modified: trunk/scipy/sparse/sparse.py =================================================================== --- trunk/scipy/sparse/sparse.py 2007-12-11 04:50:31 UTC (rev 3632) +++ trunk/scipy/sparse/sparse.py 2007-12-11 05:03:14 UTC (rev 3633) @@ -901,7 +901,28 @@ def _transpose(self, cls, copy=False): M, N = self.shape return cls((self.data,self.indices,self.indptr),(N,M),copy=copy) + + def tocoo(self,copy=True): + """Return a COOrdinate representation of this matrix + When copy=False the index and data arrays are not copied. + """ + major_dim,minor_dim = self._swap(self.shape) + + data = self.data + minor_indices = self.indices + + if copy: + data = data.copy() + minor_indices = minor_indices.copy() + + major_indices = empty_like(minor_indices) + + sparsetools.expandptr(major_dim,self.indptr,major_indices) + + row,col = self._swap((major_indices,minor_indices)) + return coo_matrix((data,(row,col)), self.shape) + def conj(self, copy=False): return self._with_data(self.data.conj(),copy=copy) @@ -935,7 +956,22 @@ self.sort_indices() else: return self.sorted_indices() + + def prune(self): + """ Remove empty space after all non-zero elements. + """ + major_dim = self._swap(self.shape)[0] + if len(self.indptr) != major_dim + 1: + raise ValueError, "index pointer has invalid length" + if len(self.indices) < self.nnz: + raise ValueError, "indices array has fewer than nnz elements" + if len(self.data) < self.nnz: + raise ValueError, "data array has fewer than nnz elements" + + self.data = self.data[:self.nnz] + self.indices = self.indices[:self.nnz] + def _get_submatrix( self, shape0, shape1, slice0, slice1 ): """Return a submatrix of this matrix (new matrix is created).""" def _process_slice( sl, num ): @@ -1137,41 +1173,9 @@ return csr_matrix((data, indices, indptr), self.shape) - def tocoo(self,copy=True): - """Return a COOrdinate representation of this matrix - - When copy=False the index and data arrays are not copied. - """ - M,N = self.shape - - data = self.data[:self.nnz].copy() - row = self.indices[:self.nnz].copy() - - if copy: - data = data.copy() - row = row.copy() - - col = empty_like(row) - sparsetools.expandptr(N,self.indptr,col) - - return coo_matrix((data,(row,col)), self.shape) - def toarray(self): return self.tocsr().toarray() - def prune(self): - """ Remove empty space after all non-zero elements. - """ - if len(self.indptr) != self.shape[1] + 1: - raise ValueError, "index pointer has invalid length" - if len(self.indices) < self.nnz: - raise ValueError, "indices array has fewer than nnz elements" - if len(self.data) < self.nnz: - raise ValueError, "data array has fewer than nnz elements" - - self.data = self.data[:self.nnz] - self.indices = self.indices[:self.nnz] - def get_submatrix( self, slice0, slice1 ): """Return a submatrix of this matrix (new matrix is created). Rows and columns can be selected using slice instances, tuples, @@ -1356,44 +1360,12 @@ return csc_matrix((data, indices, indptr), self.shape) - def tocoo(self,copy=True): - """Return a COOrdinate representation of this matrix - - When copy=False the index and data arrays are not copied. - """ - M,N = self.shape - - data = self.data[:self.nnz].copy() - col = self.indices[:self.nnz].copy() - - if copy: - data = data.copy() - col = col.copy() - - row = empty_like(col) - sparsetools.expandptr(M,self.indptr,row) - - return coo_matrix((data,(row,col)), self.shape) - def toarray(self): data = numpy.zeros(self.shape, self.data.dtype) csrtodense(self.shape[0], self.shape[1], self.indptr, self.indices, self.data, data) return data - def prune(self): - """ Remove empty space after all non-zero elements. - """ - if len(self.indptr) != self.shape[0] + 1: - raise ValueError, "index pointer has invalid length" - if len(self.indices) < self.nnz: - raise ValueError, "indices array has fewer than nnz elements" - if len(self.data) < self.nnz: - raise ValueError, "data array has fewer than nnz elements" - - self.data = self.data[:self.nnz] - self.indices = self.indices[:self.nnz] - def get_submatrix( self, slice0, slice1 ): """Return a submatrix of this matrix (new matrix is created).. Rows and columns can be selected using slice instances, tuples, From scipy-svn at scipy.org Tue Dec 11 00:15:08 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 10 Dec 2007 23:15:08 -0600 (CST) Subject: [Scipy-svn] r3634 - trunk/scipy/sparse Message-ID: <20071211051508.688CA39C249@new.scipy.org> Author: wnbell Date: 2007-12-10 23:15:05 -0600 (Mon, 10 Dec 2007) New Revision: 3634 Modified: trunk/scipy/sparse/sparse.py Log: small edit Modified: trunk/scipy/sparse/sparse.py =================================================================== --- trunk/scipy/sparse/sparse.py 2007-12-11 05:03:14 UTC (rev 3633) +++ trunk/scipy/sparse/sparse.py 2007-12-11 05:15:05 UTC (rev 3634) @@ -35,8 +35,6 @@ return new MAXPRINT = 50 -ALLOCSIZE = 1000 -NZMAX = 100 #TODO handle this in SWIG def to_native(A): @@ -79,14 +77,13 @@ __array_priority__ = 10.1 ndim = 2 - def __init__(self, maxprint=MAXPRINT, allocsize=ALLOCSIZE): + def __init__(self, maxprint=MAXPRINT): self.format = self.__class__.__name__[:3] self._shape = None if self.format == 'spm': raise ValueError, "This class is not intended" \ " to be instantiated directly." self.maxprint = maxprint - self.allocsize = allocsize def set_shape(self,shape): shape = tuple(shape) @@ -1067,6 +1064,7 @@ def __getitem__(self, key): if isinstance(key, tuple): + #TODO use _swap() to unify this in _cs_matrix row = key[0] col = key[1] if isinstance(col, slice): @@ -1119,6 +1117,7 @@ self.shape = (M, N) indxs = numpy.where(row == self.indices[self.indptr[col]:self.indptr[col+1]]) + if len(indxs[0]) == 0: #value not present #TODO handle this with concatenation @@ -1243,6 +1242,7 @@ def __getitem__(self, key): if isinstance(key, tuple): + #TODO use _swap() to unify this in _cs_matrix row = key[0] col = key[1] if isinstance(row, slice): From scipy-svn at scipy.org Tue Dec 11 02:46:51 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 11 Dec 2007 01:46:51 -0600 (CST) Subject: [Scipy-svn] r3635 - trunk/scipy/sparse Message-ID: <20071211074651.E81D139C033@new.scipy.org> Author: wnbell Date: 2007-12-11 01:46:48 -0600 (Tue, 11 Dec 2007) New Revision: 3635 Modified: trunk/scipy/sparse/sparse.py Log: change to coo_matrix.todok() should fix ticket #555 Modified: trunk/scipy/sparse/sparse.py =================================================================== --- trunk/scipy/sparse/sparse.py 2007-12-11 05:15:05 UTC (rev 3634) +++ trunk/scipy/sparse/sparse.py 2007-12-11 07:46:48 UTC (rev 3635) @@ -1412,8 +1412,6 @@ " integers" self.shape = A elif isspmatrix(A): - # For sparse matrices, this is too inefficient; we need - # something else. if isspmatrix_dok(A) and copy: A = A.copy() else: @@ -2120,7 +2118,15 @@ def todok(self): dok = dok_matrix((self.shape),dtype=self.dtype) - dok.update( zip(zip(self.row,self.col),self.data) ) + + try: + izip = itertools.izip + dok.update( izip(izip(self.row,self.col),self.data) ) + except AttributeError: + # the dict() call is for Python 2.3 compatibility + # ideally dok_matrix would accept an iterator + dok.update( dict( zip(zip(self.row,self.col),self.data) ) ) + return dok From scipy-svn at scipy.org Tue Dec 11 16:16:05 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 11 Dec 2007 15:16:05 -0600 (CST) Subject: [Scipy-svn] r3636 - trunk Message-ID: <20071211211605.A3183C7C024@new.scipy.org> Author: chris.burns Date: 2007-12-11 15:15:53 -0600 (Tue, 11 Dec 2007) New Revision: 3636 Modified: trunk/README.txt Log: Fixed ReST warning in ReadMe Modified: trunk/README.txt =================================================================== --- trunk/README.txt 2007-12-11 07:46:48 UTC (rev 3635) +++ trunk/README.txt 2007-12-11 21:15:53 UTC (rev 3636) @@ -1,4 +1,5 @@ .. -*- rest -*- + ================================================= Developing SciPy ================================================= From scipy-svn at scipy.org Tue Dec 11 23:04:28 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 11 Dec 2007 22:04:28 -0600 (CST) Subject: [Scipy-svn] r3637 - in trunk/scipy/sparse: . sparsetools Message-ID: <20071212040428.9DE0339C00C@new.scipy.org> Author: wnbell Date: 2007-12-11 22:04:17 -0600 (Tue, 11 Dec 2007) New Revision: 3637 Modified: trunk/scipy/sparse/sparse.py trunk/scipy/sparse/sparsetools/sparsetools.h trunk/scipy/sparse/sparsetools/sparsetools.i trunk/scipy/sparse/sparsetools/sparsetools.py trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx Log: csc/csr_matrix.matvec() use preallocated storage now extract_csr_diagonal does also Modified: trunk/scipy/sparse/sparse.py =================================================================== --- trunk/scipy/sparse/sparse.py 2007-12-11 21:15:53 UTC (rev 3636) +++ trunk/scipy/sparse/sparse.py 2007-12-12 04:04:17 UTC (rev 3637) @@ -36,6 +36,45 @@ MAXPRINT = 50 + +# keep this list syncronized with sparsetools +supported_dtypes = ['int8','uint8','int16','int32','int64', + 'float32','float64','complex64','complex128'] +supported_dtypes = [ numpy.typeDict[x] for x in supported_dtypes] + +def upcast(*args): + """Returns the nearest supported sparse dtype for the + combination of one or more types. + + upcast(t0, t1, ..., tn) -> T where T is a supported dtype + + *Example* + ------- + + >>> upcast('int32') + + >>> upcast('bool') + + >>> upcast('int32','float32') + + >>> upcast('bool',complex,float) + + + """ + sample = array([0],dtype=args[0]) + for t in args[1:]: + sample = sample + array([0],dtype=t) + + upcast = sample.dtype + + for t in supported_dtypes: + if upcast <= t: + return t + + raise TypeError,'no supported conversion for types: %s' % args + + + #TODO handle this in SWIG def to_native(A): if not A.dtype.isnative: @@ -812,9 +851,12 @@ # csrmux, cscmux fn = getattr(sparsetools,self.format + 'mux') + + #output array + y = empty( self.shape[0], dtype=upcast(self.dtype,other.dtype) ) - y = fn(self.shape[0], self.shape[1], \ - self.indptr, self.indices, self.data, numpy.ravel(other)) + fn(self.shape[0], self.shape[1], \ + self.indptr, self.indices, self.data, numpy.ravel(other), y) if isinstance(other, matrix): y = asmatrix(y) @@ -913,7 +955,7 @@ data = data.copy() minor_indices = minor_indices.copy() - major_indices = empty_like(minor_indices) + major_indices = empty(len(minor_indices),dtype=intc) sparsetools.expandptr(major_dim,self.indptr,major_indices) @@ -1164,7 +1206,7 @@ def tocsr(self): indptr = empty(self.shape[0] + 1, dtype=intc) indices = empty(self.nnz, dtype=intc) - data = empty(self.nnz, dtype=self.dtype) + data = empty(self.nnz, dtype=upcast(self.dtype)) csctocsr(self.shape[0], self.shape[1], \ self.indptr, self.indices, self.data, \ @@ -1352,7 +1394,7 @@ def tocsc(self): indptr = empty(self.shape[1] + 1, dtype=intc) indices = empty(self.nnz, dtype=intc) - data = empty(self.nnz, self.dtype) + data = empty(self.nnz, dtype=upcast(self.dtype)) csrtocsc(self.shape[0], self.shape[1], \ self.indptr, self.indices, self.data, \ @@ -1361,7 +1403,7 @@ return csc_matrix((data, indices, indptr), self.shape) def toarray(self): - data = numpy.zeros(self.shape, self.data.dtype) + data = numpy.zeros(self.shape, dtype=upcast(self.data.dtype)) csrtodense(self.shape[0], self.shape[1], self.indptr, self.indices, self.data, data) return data @@ -2091,7 +2133,7 @@ else: indptr = empty(self.shape[1] + 1,dtype=intc) indices = empty(self.nnz, dtype=intc) - data = empty(self.nnz, dtype=self.dtype) + data = empty(self.nnz, dtype=upcast(self.dtype)) cootocsc(self.shape[0], self.shape[1], self.nnz, \ self.row, self.col, self.data, \ @@ -2105,7 +2147,7 @@ else: indptr = empty(self.shape[0] + 1,dtype=intc) indices = empty(self.nnz, dtype=intc) - data = empty(self.nnz, dtype=self.dtype) + data = empty(self.nnz, dtype=upcast(self.dtype)) cootocsr(self.shape[0], self.shape[1], self.nnz, \ self.row, self.col, self.data, \ @@ -2662,12 +2704,12 @@ """ extract_diagonal(A) returns the main diagonal of A. """ - if isspmatrix_csr(A): - return sparsetools.extract_csr_diagonal(A.shape[0],A.shape[1], - A.indptr,A.indices,A.data) - elif isspmatrix_csc(A): - return sparsetools.extract_csc_diagonal(A.shape[0],A.shape[1], - A.indptr,A.indices,A.data) + #TODO extract k-th diagonal + if isspmatrix_csr(A) or isspmatrix_csc(A): + fn = getattr(sparsetools, "extract_" + A.format + "_diagonal") + y = empty( min(A.shape), dtype=upcast(A.dtype) ) + fn(A.shape[0],A.shape[1],A.indptr,A.indices,A.data,y) + return y elif isspmatrix(A): return extract_diagonal(A.tocsr()) else: Modified: trunk/scipy/sparse/sparsetools/sparsetools.h =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.h 2007-12-11 21:15:53 UTC (rev 3636) +++ trunk/scipy/sparse/sparsetools/sparsetools.h 2007-12-12 04:04:17 UTC (rev 3637) @@ -35,10 +35,10 @@ * T Ax[n_col] - nonzeros * * Output Arguments: - * vec Yx - diagonal entries + * T Yx[min(n_row,n_col)] - diagonal entries * * Note: - * Output array Yx will be allocated within in the method + * Output array Yx should be preallocated * Duplicate entries will be summed. * * Complexity: Linear. Specifically O(nnz(A) + min(n_row,n_col)) @@ -50,12 +50,10 @@ const I Ap[], const I Aj[], const T Ax[], - std::vector* Yx) + T Yx[]) { const I N = std::min(n_row, n_col); - Yx->resize(N); - for(I i = 0; i < N; i++){ I row_start = Ap[i]; I row_end = Ap[i+1]; @@ -66,7 +64,7 @@ diag += Ax[jj]; } - (*Yx)[i] = diag; + Yx[i] = diag; } } @@ -634,10 +632,8 @@ const I Aj[], const T Ax[], const T Xx[], - std::vector* Yx) + T Yx[]) { - Yx->resize(n_row); - for(I i = 0; i < n_row; i++){ I row_start = Ap[i]; I row_end = Ap[i+1]; @@ -646,7 +642,7 @@ for(I jj = row_start; jj < row_end; jj++){ sum += Ax[jj] * Xx[Aj[jj]]; } - (*Yx)[i] = sum; + Yx[i] = sum; } } @@ -662,14 +658,15 @@ * I Ap[n_row+1] - column pointer * I Ai[nnz(A)] - row indices * T Ax[n_col] - nonzeros - * T Xx[n_col] - nonzeros + * T Xx[n_col] - input vector * * Output Arguments: - * vec Yx - nonzeros + * T Yx[n_row] - output vector * * Note: - * Output arrays Xx will be allocated within in the method + * Output arrays Xx should be be preallocated * + * * Complexity: Linear. Specifically O(nnz(A) + max(n_row,n_col)) * */ @@ -680,17 +677,19 @@ const I Ai[], const T Ax[], const T Xx[], - std::vector* Yx) -{ - Yx->resize(n_row,0); - + T Yx[]) +{ + for(I i = 0; i < n_row; i++){ + Yx[i] = 0; + } + for(I j = 0; j < n_col; j++){ I col_start = Ap[j]; I col_end = Ap[j+1]; for(I ii = col_start; ii < col_end; ii++){ I row = Ai[ii]; - (*Yx)[row] += Ax[ii] * Xx[j]; + Yx[row] += Ax[ii] * Xx[j]; } } } @@ -944,9 +943,8 @@ const I Ap[], const I Aj[], const T Ax[], - std::vector* Yx){ - extract_csr_diagonal(n_col, n_row, Ap, Aj, Ax, Yx); -} + T Yx[]) +{ extract_csr_diagonal(n_col, n_row, Ap, Aj, Ax, Yx); } template Modified: trunk/scipy/sparse/sparsetools/sparsetools.i =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.i 2007-12-11 21:15:53 UTC (rev 3636) +++ trunk/scipy/sparse/sparsetools/sparsetools.i 2007-12-12 04:04:17 UTC (rev 3637) @@ -101,7 +101,8 @@ %define T_INPLACE_ARRAY1( ctype ) %apply ctype * INPLACE_ARRAY { ctype Ax [ ], - ctype Bx [ ] + ctype Bx [ ], + ctype Yx [ ] }; %enddef Modified: trunk/scipy/sparse/sparsetools/sparsetools.py =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.py 2007-12-11 21:15:53 UTC (rev 3636) +++ trunk/scipy/sparse/sparsetools/sparsetools.py 2007-12-12 04:04:17 UTC (rev 3637) @@ -57,38 +57,38 @@ def extract_csr_diagonal(*args): """ extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, signed char Ax, - std::vector<(signed char)> Yx) + signed char Yx) extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, - std::vector<(unsigned char)> Yx) - extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, short Ax, std::vector<(short)> Yx) - extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, int Ax, std::vector<(int)> Yx) + unsigned char Yx) + extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, short Ax, short Yx) + extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, int Ax, int Yx) extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, long long Ax, - std::vector<(long long)> Yx) - extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, float Ax, std::vector<(float)> Yx) - extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, double Ax, std::vector<(double)> Yx) + long long Yx) + extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, float Ax, float Yx) + extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, double Ax, double Yx) extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, - std::vector<(npy_cfloat_wrapper)> Yx) + npy_cfloat_wrapper Yx) extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, - std::vector<(npy_cdouble_wrapper)> Yx) + npy_cdouble_wrapper Yx) """ return _sparsetools.extract_csr_diagonal(*args) def extract_csc_diagonal(*args): """ extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, signed char Ax, - std::vector<(signed char)> Yx) + signed char Yx) extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, - std::vector<(unsigned char)> Yx) - extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, short Ax, std::vector<(short)> Yx) - extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, int Ax, std::vector<(int)> Yx) + unsigned char Yx) + extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, short Ax, short Yx) + extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, int Ax, int Yx) extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, long long Ax, - std::vector<(long long)> Yx) - extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, float Ax, std::vector<(float)> Yx) - extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, double Ax, std::vector<(double)> Yx) + long long Yx) + extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, float Ax, float Yx) + extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, double Ax, double Yx) extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, - std::vector<(npy_cfloat_wrapper)> Yx) + npy_cfloat_wrapper Yx) extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, - std::vector<(npy_cdouble_wrapper)> Yx) + npy_cdouble_wrapper Yx) """ return _sparsetools.extract_csc_diagonal(*args) @@ -255,46 +255,46 @@ def csrmux(*args): """ csrmux(int n_row, int n_col, int Ap, int Aj, signed char Ax, - signed char Xx, std::vector<(signed char)> Yx) + signed char Xx, signed char Yx) csrmux(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, - unsigned char Xx, std::vector<(unsigned char)> Yx) + unsigned char Xx, unsigned char Yx) csrmux(int n_row, int n_col, int Ap, int Aj, short Ax, short Xx, - std::vector<(short)> Yx) + short Yx) csrmux(int n_row, int n_col, int Ap, int Aj, int Ax, int Xx, - std::vector<(int)> Yx) + int Yx) csrmux(int n_row, int n_col, int Ap, int Aj, long long Ax, - long long Xx, std::vector<(long long)> Yx) + long long Xx, long long Yx) csrmux(int n_row, int n_col, int Ap, int Aj, float Ax, float Xx, - std::vector<(float)> Yx) + float Yx) csrmux(int n_row, int n_col, int Ap, int Aj, double Ax, double Xx, - std::vector<(double)> Yx) + double Yx) csrmux(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, - npy_cfloat_wrapper Xx, std::vector<(npy_cfloat_wrapper)> Yx) + npy_cfloat_wrapper Xx, npy_cfloat_wrapper Yx) csrmux(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, - npy_cdouble_wrapper Xx, std::vector<(npy_cdouble_wrapper)> Yx) + npy_cdouble_wrapper Xx, npy_cdouble_wrapper Yx) """ return _sparsetools.csrmux(*args) def cscmux(*args): """ cscmux(int n_row, int n_col, int Ap, int Ai, signed char Ax, - signed char Xx, std::vector<(signed char)> Yx) + signed char Xx, signed char Yx) cscmux(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, - unsigned char Xx, std::vector<(unsigned char)> Yx) + unsigned char Xx, unsigned char Yx) cscmux(int n_row, int n_col, int Ap, int Ai, short Ax, short Xx, - std::vector<(short)> Yx) + short Yx) cscmux(int n_row, int n_col, int Ap, int Ai, int Ax, int Xx, - std::vector<(int)> Yx) + int Yx) cscmux(int n_row, int n_col, int Ap, int Ai, long long Ax, - long long Xx, std::vector<(long long)> Yx) + long long Xx, long long Yx) cscmux(int n_row, int n_col, int Ap, int Ai, float Ax, float Xx, - std::vector<(float)> Yx) + float Yx) cscmux(int n_row, int n_col, int Ap, int Ai, double Ax, double Xx, - std::vector<(double)> Yx) + double Yx) cscmux(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, - npy_cfloat_wrapper Xx, std::vector<(npy_cfloat_wrapper)> Yx) + npy_cfloat_wrapper Xx, npy_cfloat_wrapper Yx) cscmux(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, - npy_cdouble_wrapper Xx, std::vector<(npy_cdouble_wrapper)> Yx) + npy_cdouble_wrapper Xx, npy_cdouble_wrapper Yx) """ return _sparsetools.cscmux(*args) Modified: trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx 2007-12-11 21:15:53 UTC (rev 3636) +++ trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx 2007-12-12 04:04:17 UTC (rev 3637) @@ -3087,7 +3087,7 @@ int *arg3 ; int *arg4 ; signed char *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; + signed char *arg6 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -3098,18 +3098,15 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; + PyArrayObject *temp6 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'"); @@ -3150,16 +3147,14 @@ arg5 = (signed char*) array5->data; } + { + temp6 = obj_to_array_no_conversion(obj5,PyArray_BYTE); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (signed char*) array_data(temp6); + } extract_csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(signed char)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -3190,7 +3185,7 @@ int *arg3 ; int *arg4 ; unsigned char *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; + unsigned char *arg6 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -3201,18 +3196,15 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; + PyArrayObject *temp6 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'"); @@ -3253,16 +3245,14 @@ arg5 = (unsigned char*) array5->data; } + { + temp6 = obj_to_array_no_conversion(obj5,PyArray_UBYTE); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (unsigned char*) array_data(temp6); + } extract_csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(unsigned char)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -3293,7 +3283,7 @@ int *arg3 ; int *arg4 ; short *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; + short *arg6 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -3304,18 +3294,15 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; + PyArrayObject *temp6 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'"); @@ -3356,16 +3343,14 @@ arg5 = (short*) array5->data; } + { + temp6 = obj_to_array_no_conversion(obj5,PyArray_SHORT); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (short*) array_data(temp6); + } extract_csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(short)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -3396,7 +3381,7 @@ int *arg3 ; int *arg4 ; int *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; + int *arg6 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -3407,18 +3392,15 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; + PyArrayObject *temp6 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'"); @@ -3459,16 +3441,14 @@ arg5 = (int*) array5->data; } + { + temp6 = obj_to_array_no_conversion(obj5,PyArray_INT); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (int*) array_data(temp6); + } extract_csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -3499,7 +3479,7 @@ int *arg3 ; int *arg4 ; long long *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; + long long *arg6 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -3510,18 +3490,15 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; + PyArrayObject *temp6 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'"); @@ -3562,16 +3539,14 @@ arg5 = (long long*) array5->data; } + { + temp6 = obj_to_array_no_conversion(obj5,PyArray_LONGLONG); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (long long*) array_data(temp6); + } extract_csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(long long)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -3602,7 +3577,7 @@ int *arg3 ; int *arg4 ; float *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; + float *arg6 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -3613,18 +3588,15 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; + PyArrayObject *temp6 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'"); @@ -3665,16 +3637,14 @@ arg5 = (float*) array5->data; } + { + temp6 = obj_to_array_no_conversion(obj5,PyArray_FLOAT); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (float*) array_data(temp6); + } extract_csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(float)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -3705,7 +3675,7 @@ int *arg3 ; int *arg4 ; double *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; + double *arg6 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -3716,18 +3686,15 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; + PyArrayObject *temp6 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'"); @@ -3768,16 +3735,14 @@ arg5 = (double*) array5->data; } + { + temp6 = obj_to_array_no_conversion(obj5,PyArray_DOUBLE); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (double*) array_data(temp6); + } extract_csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(double)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -3808,7 +3773,7 @@ int *arg3 ; int *arg4 ; npy_cfloat_wrapper *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; + npy_cfloat_wrapper *arg6 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -3819,18 +3784,15 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; + PyArrayObject *temp6 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'"); @@ -3871,16 +3833,14 @@ arg5 = (npy_cfloat_wrapper*) array5->data; } + { + temp6 = obj_to_array_no_conversion(obj5,PyArray_CFLOAT); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (npy_cfloat_wrapper*) array_data(temp6); + } extract_csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(npy_cfloat_wrapper)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -3911,7 +3871,7 @@ int *arg3 ; int *arg4 ; npy_cdouble_wrapper *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; + npy_cdouble_wrapper *arg6 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -3922,18 +3882,15 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; + PyArrayObject *temp6 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'"); @@ -3974,16 +3931,14 @@ arg5 = (npy_cdouble_wrapper*) array5->data; } + { + temp6 = obj_to_array_no_conversion(obj5,PyArray_CDOUBLE); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (npy_cdouble_wrapper*) array_data(temp6); + } extract_csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(npy_cdouble_wrapper)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -4009,15 +3964,15 @@ SWIGINTERN PyObject *_wrap_extract_csr_diagonal(PyObject *self, PyObject *args) { int argc; - PyObject *argv[6]; + PyObject *argv[7]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 5); ii++) { + for (ii = 0; (ii < argc) && (ii < 6); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } - if (argc == 5) { + if (argc == 6) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -4041,14 +3996,19 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_extract_csr_diagonal__SWIG_1(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_extract_csr_diagonal__SWIG_1(self, args); + } } } } } } } - if (argc == 5) { + if (argc == 6) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -4072,14 +4032,19 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_extract_csr_diagonal__SWIG_2(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_extract_csr_diagonal__SWIG_2(self, args); + } } } } } } } - if (argc == 5) { + if (argc == 6) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -4103,14 +4068,19 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_extract_csr_diagonal__SWIG_3(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_extract_csr_diagonal__SWIG_3(self, args); + } } } } } } } - if (argc == 5) { + if (argc == 6) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -4134,14 +4104,19 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_extract_csr_diagonal__SWIG_4(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_extract_csr_diagonal__SWIG_4(self, args); + } } } } } } } - if (argc == 5) { + if (argc == 6) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -4165,14 +4140,19 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_extract_csr_diagonal__SWIG_5(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_extract_csr_diagonal__SWIG_5(self, args); + } } } } } } } - if (argc == 5) { + if (argc == 6) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -4196,14 +4176,19 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_extract_csr_diagonal__SWIG_6(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_extract_csr_diagonal__SWIG_6(self, args); + } } } } } } } - if (argc == 5) { + if (argc == 6) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -4227,14 +4212,19 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_extract_csr_diagonal__SWIG_7(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_extract_csr_diagonal__SWIG_7(self, args); + } } } } } } } - if (argc == 5) { + if (argc == 6) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -4258,14 +4248,19 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_extract_csr_diagonal__SWIG_8(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_extract_csr_diagonal__SWIG_8(self, args); + } } } } } } } - if (argc == 5) { + if (argc == 6) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -4289,7 +4284,12 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_extract_csr_diagonal__SWIG_9(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_extract_csr_diagonal__SWIG_9(self, args); + } } } } @@ -4298,7 +4298,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'extract_csr_diagonal'.\n Possible C/C++ prototypes are:\n"" extract_csr_diagonal<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],std::vector *)\n"" extract_csr_diagonal<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],std::vector *)\n"" extract_csr_diagonal<(int,short)>(int const,int const,int const [],int const [],short const [],std::vector *)\n"" extract_csr_diagonal<(int,int)>(int const,int const,int const [],int const [],int const [],std::vector *)\n"" extract_csr_diagonal<(int,long long)>(int const,int const,int const [],int const [],long long const [],std::vector *)\n"" extract_csr_diagonal<(int,float)>(int const,int const,int const [],int const [],float const [],std::vector *)\n"" extract_csr_diagonal<(int,double)>(int const,int const,int const [],int const [],double const [],std::vector *)\n"" extract_csr_diagonal<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],std::vector *)\n"" extract_csr_diagonal<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],std::vector *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'extract_csr_diagonal'.\n Possible C/C++ prototypes are:\n"" extract_csr_diagonal<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],signed char [])\n"" extract_csr_diagonal<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],unsigned char [])\n"" extract_csr_diagonal<(int,short)>(int const,int const,int const [],int const [],short const [],short [])\n"" extract_csr_diagonal<(int,int)>(int const,int const,int const [],int const [],int const [],int [])\n"" extract_csr_diagonal<(int,long long)>(int const,int const,int const [],int const [],long long const [],long long [])\n"" extract_csr_diagonal<(int,float)>(int const,int const,int const [],int const [],float const [],float [])\n"" extract_csr_diagonal<(int,double)>(int const,int const,int const [],int const [],double const [],double [])\n"" extract_csr_diagonal<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper [])\n"" extract_csr_diagonal<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper [])\n"); return NULL; } @@ -4310,7 +4310,7 @@ int *arg3 ; int *arg4 ; signed char *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; + signed char *arg6 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -4321,18 +4321,15 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; + PyArrayObject *temp6 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'"); @@ -4373,16 +4370,14 @@ arg5 = (signed char*) array5->data; } + { + temp6 = obj_to_array_no_conversion(obj5,PyArray_BYTE); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (signed char*) array_data(temp6); + } extract_csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(signed char)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -4413,7 +4408,7 @@ int *arg3 ; int *arg4 ; unsigned char *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; + unsigned char *arg6 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -4424,18 +4419,15 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; + PyArrayObject *temp6 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'"); @@ -4476,16 +4468,14 @@ arg5 = (unsigned char*) array5->data; } + { + temp6 = obj_to_array_no_conversion(obj5,PyArray_UBYTE); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (unsigned char*) array_data(temp6); + } extract_csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(unsigned char)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -4516,7 +4506,7 @@ int *arg3 ; int *arg4 ; short *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; + short *arg6 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -4527,18 +4517,15 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; + PyArrayObject *temp6 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'"); @@ -4579,16 +4566,14 @@ arg5 = (short*) array5->data; } + { + temp6 = obj_to_array_no_conversion(obj5,PyArray_SHORT); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (short*) array_data(temp6); + } extract_csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(short)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -4619,7 +4604,7 @@ int *arg3 ; int *arg4 ; int *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; + int *arg6 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -4630,18 +4615,15 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; + PyArrayObject *temp6 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'"); @@ -4682,16 +4664,14 @@ arg5 = (int*) array5->data; } + { + temp6 = obj_to_array_no_conversion(obj5,PyArray_INT); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (int*) array_data(temp6); + } extract_csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -4722,7 +4702,7 @@ int *arg3 ; int *arg4 ; long long *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; + long long *arg6 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -4733,18 +4713,15 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; + PyArrayObject *temp6 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'"); @@ -4785,16 +4762,14 @@ arg5 = (long long*) array5->data; } + { + temp6 = obj_to_array_no_conversion(obj5,PyArray_LONGLONG); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (long long*) array_data(temp6); + } extract_csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(long long)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -4825,7 +4800,7 @@ int *arg3 ; int *arg4 ; float *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; + float *arg6 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -4836,18 +4811,15 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; + PyArrayObject *temp6 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'"); @@ -4888,16 +4860,14 @@ arg5 = (float*) array5->data; } + { + temp6 = obj_to_array_no_conversion(obj5,PyArray_FLOAT); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (float*) array_data(temp6); + } extract_csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(float)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -4928,7 +4898,7 @@ int *arg3 ; int *arg4 ; double *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; + double *arg6 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -4939,18 +4909,15 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; + PyArrayObject *temp6 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'"); @@ -4991,16 +4958,14 @@ arg5 = (double*) array5->data; } + { + temp6 = obj_to_array_no_conversion(obj5,PyArray_DOUBLE); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (double*) array_data(temp6); + } extract_csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(double)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -5031,7 +4996,7 @@ int *arg3 ; int *arg4 ; npy_cfloat_wrapper *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; + npy_cfloat_wrapper *arg6 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -5042,18 +5007,15 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; + PyArrayObject *temp6 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'"); @@ -5094,16 +5056,14 @@ arg5 = (npy_cfloat_wrapper*) array5->data; } + { + temp6 = obj_to_array_no_conversion(obj5,PyArray_CFLOAT); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (npy_cfloat_wrapper*) array_data(temp6); + } extract_csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(npy_cfloat_wrapper)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -5134,7 +5094,7 @@ int *arg3 ; int *arg4 ; npy_cdouble_wrapper *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; + npy_cdouble_wrapper *arg6 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -5145,18 +5105,15 @@ int is_new_object4 ; PyArrayObject *array5 = NULL ; int is_new_object5 ; - std::vector *tmp6 ; + PyArrayObject *temp6 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'"); @@ -5197,16 +5154,14 @@ arg5 = (npy_cdouble_wrapper*) array5->data; } + { + temp6 = obj_to_array_no_conversion(obj5,PyArray_CDOUBLE); + if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; + arg6 = (npy_cdouble_wrapper*) array_data(temp6); + } extract_csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(npy_cdouble_wrapper)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -5232,15 +5187,15 @@ SWIGINTERN PyObject *_wrap_extract_csc_diagonal(PyObject *self, PyObject *args) { int argc; - PyObject *argv[6]; + PyObject *argv[7]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 5); ii++) { + for (ii = 0; (ii < argc) && (ii < 6); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } - if (argc == 5) { + if (argc == 6) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -5264,14 +5219,19 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_extract_csc_diagonal__SWIG_1(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_extract_csc_diagonal__SWIG_1(self, args); + } } } } } } } - if (argc == 5) { + if (argc == 6) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -5295,14 +5255,19 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_extract_csc_diagonal__SWIG_2(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_extract_csc_diagonal__SWIG_2(self, args); + } } } } } } } - if (argc == 5) { + if (argc == 6) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -5326,14 +5291,19 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_extract_csc_diagonal__SWIG_3(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_extract_csc_diagonal__SWIG_3(self, args); + } } } } } } } - if (argc == 5) { + if (argc == 6) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -5357,14 +5327,19 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_extract_csc_diagonal__SWIG_4(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_extract_csc_diagonal__SWIG_4(self, args); + } } } } } } } - if (argc == 5) { + if (argc == 6) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -5388,14 +5363,19 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_extract_csc_diagonal__SWIG_5(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_extract_csc_diagonal__SWIG_5(self, args); + } } } } } } } - if (argc == 5) { + if (argc == 6) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -5419,14 +5399,19 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_extract_csc_diagonal__SWIG_6(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_extract_csc_diagonal__SWIG_6(self, args); + } } } } } } } - if (argc == 5) { + if (argc == 6) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -5450,14 +5435,19 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_extract_csc_diagonal__SWIG_7(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_extract_csc_diagonal__SWIG_7(self, args); + } } } } } } } - if (argc == 5) { + if (argc == 6) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -5481,14 +5471,19 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_extract_csc_diagonal__SWIG_8(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_extract_csc_diagonal__SWIG_8(self, args); + } } } } } } } - if (argc == 5) { + if (argc == 6) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -5512,7 +5507,12 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_extract_csc_diagonal__SWIG_9(self, args); + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_extract_csc_diagonal__SWIG_9(self, args); + } } } } @@ -5521,7 +5521,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'extract_csc_diagonal'.\n Possible C/C++ prototypes are:\n"" extract_csc_diagonal<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],std::vector *)\n"" extract_csc_diagonal<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],std::vector *)\n"" extract_csc_diagonal<(int,short)>(int const,int const,int const [],int const [],short const [],std::vector *)\n"" extract_csc_diagonal<(int,int)>(int const,int const,int const [],int const [],int const [],std::vector *)\n"" extract_csc_diagonal<(int,long long)>(int const,int const,int const [],int const [],long long const [],std::vector *)\n"" extract_csc_diagonal<(int,float)>(int const,int const,int const [],int const [],float const [],std::vector *)\n"" extract_csc_diagonal<(int,double)>(int const,int const,int const [],int const [],double const [],std::vector *)\n"" extract_csc_diagonal<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],std::vector *)\n"" extract_csc_diagonal<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],std::vector *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'extract_csc_diagonal'.\n Possible C/C++ prototypes are:\n"" extract_csc_diagonal<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],signed char [])\n"" extract_csc_diagonal<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],unsigned char [])\n"" extract_csc_diagonal<(int,short)>(int const,int const,int const [],int const [],short const [],short [])\n"" extract_csc_diagonal<(int,int)>(int const,int const,int const [],int const [],int const [],int [])\n"" extract_csc_diagonal<(int,long long)>(int const,int const,int const [],int const [],long long const [],long long [])\n"" extract_csc_diagonal<(int,float)>(int const,int const,int const [],int const [],float const [],float [])\n"" extract_csc_diagonal<(int,double)>(int const,int const,int const [],int const [],double const [],double [])\n"" extract_csc_diagonal<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper [])\n"" extract_csc_diagonal<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper [])\n"); return NULL; } @@ -15945,7 +15945,7 @@ int *arg4 ; signed char *arg5 ; signed char *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; + signed char *arg7 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -15958,19 +15958,16 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; + PyArrayObject *temp7 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csrmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csrmux",&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 '" "csrmux" "', argument " "1"" of type '" "int""'"); @@ -16021,16 +16018,14 @@ arg6 = (signed char*) array6->data; } + { + temp7 = obj_to_array_no_conversion(obj6,PyArray_BYTE); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (signed char*) array_data(temp7); + } csrmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,(signed char const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(signed char)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -16068,7 +16063,7 @@ int *arg4 ; unsigned char *arg5 ; unsigned char *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; + unsigned char *arg7 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -16081,19 +16076,16 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; + PyArrayObject *temp7 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csrmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csrmux",&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 '" "csrmux" "', argument " "1"" of type '" "int""'"); @@ -16144,16 +16136,14 @@ arg6 = (unsigned char*) array6->data; } + { + temp7 = obj_to_array_no_conversion(obj6,PyArray_UBYTE); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (unsigned char*) array_data(temp7); + } csrmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,(unsigned char const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(unsigned char)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -16191,7 +16181,7 @@ int *arg4 ; short *arg5 ; short *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; + short *arg7 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -16204,19 +16194,16 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; + PyArrayObject *temp7 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csrmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csrmux",&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 '" "csrmux" "', argument " "1"" of type '" "int""'"); @@ -16267,16 +16254,14 @@ arg6 = (short*) array6->data; } + { + temp7 = obj_to_array_no_conversion(obj6,PyArray_SHORT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (short*) array_data(temp7); + } csrmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,(short const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(short)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -16314,7 +16299,7 @@ int *arg4 ; int *arg5 ; int *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; + int *arg7 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -16327,19 +16312,16 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; + PyArrayObject *temp7 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csrmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csrmux",&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 '" "csrmux" "', argument " "1"" of type '" "int""'"); @@ -16390,16 +16372,14 @@ arg6 = (int*) array6->data; } + { + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); + } csrmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -16437,7 +16417,7 @@ int *arg4 ; long long *arg5 ; long long *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; + long long *arg7 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -16450,19 +16430,16 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; + PyArrayObject *temp7 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csrmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csrmux",&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 '" "csrmux" "', argument " "1"" of type '" "int""'"); @@ -16513,16 +16490,14 @@ arg6 = (long long*) array6->data; } + { + temp7 = obj_to_array_no_conversion(obj6,PyArray_LONGLONG); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (long long*) array_data(temp7); + } csrmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,(long long const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(long long)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -16560,7 +16535,7 @@ int *arg4 ; float *arg5 ; float *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; + float *arg7 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -16573,19 +16548,16 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; + PyArrayObject *temp7 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csrmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csrmux",&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 '" "csrmux" "', argument " "1"" of type '" "int""'"); @@ -16636,16 +16608,14 @@ arg6 = (float*) array6->data; } + { + temp7 = obj_to_array_no_conversion(obj6,PyArray_FLOAT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (float*) array_data(temp7); + } csrmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(float const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(float)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -16683,7 +16653,7 @@ int *arg4 ; double *arg5 ; double *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; + double *arg7 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -16696,19 +16666,16 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; + PyArrayObject *temp7 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csrmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csrmux",&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 '" "csrmux" "', argument " "1"" of type '" "int""'"); @@ -16759,16 +16726,14 @@ arg6 = (double*) array6->data; } + { + temp7 = obj_to_array_no_conversion(obj6,PyArray_DOUBLE); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (double*) array_data(temp7); + } csrmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(double const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(double)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -16806,7 +16771,7 @@ int *arg4 ; npy_cfloat_wrapper *arg5 ; npy_cfloat_wrapper *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; + npy_cfloat_wrapper *arg7 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -16819,19 +16784,16 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; + PyArrayObject *temp7 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csrmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csrmux",&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 '" "csrmux" "', argument " "1"" of type '" "int""'"); @@ -16882,16 +16844,14 @@ arg6 = (npy_cfloat_wrapper*) array6->data; } + { + temp7 = obj_to_array_no_conversion(obj6,PyArray_CFLOAT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (npy_cfloat_wrapper*) array_data(temp7); + } csrmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,(npy_cfloat_wrapper const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(npy_cfloat_wrapper)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -16929,7 +16889,7 @@ int *arg4 ; npy_cdouble_wrapper *arg5 ; npy_cdouble_wrapper *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; + npy_cdouble_wrapper *arg7 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -16942,19 +16902,16 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; + PyArrayObject *temp7 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csrmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csrmux",&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 '" "csrmux" "', argument " "1"" of type '" "int""'"); @@ -17005,16 +16962,14 @@ arg6 = (npy_cdouble_wrapper*) array6->data; } + { + temp7 = obj_to_array_no_conversion(obj6,PyArray_CDOUBLE); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (npy_cdouble_wrapper*) array_data(temp7); + } csrmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,(npy_cdouble_wrapper const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(npy_cdouble_wrapper)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -17046,15 +17001,15 @@ SWIGINTERN PyObject *_wrap_csrmux(PyObject *self, PyObject *args) { int argc; - PyObject *argv[7]; + PyObject *argv[8]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 6); ii++) { + for (ii = 0; (ii < argc) && (ii < 7); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } - if (argc == 6) { + if (argc == 7) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -17082,7 +17037,12 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_csrmux__SWIG_1(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_csrmux__SWIG_1(self, args); + } } } } @@ -17090,7 +17050,7 @@ } } } - if (argc == 6) { + if (argc == 7) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -17118,7 +17078,12 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_csrmux__SWIG_2(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_csrmux__SWIG_2(self, args); + } } } } @@ -17126,7 +17091,7 @@ } } } - if (argc == 6) { + if (argc == 7) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -17154,7 +17119,12 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_csrmux__SWIG_3(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_csrmux__SWIG_3(self, args); + } } } } @@ -17162,7 +17132,7 @@ } } } - if (argc == 6) { + if (argc == 7) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -17190,7 +17160,12 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_csrmux__SWIG_4(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_csrmux__SWIG_4(self, args); + } } } } @@ -17198,7 +17173,7 @@ } } } - if (argc == 6) { + if (argc == 7) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -17226,7 +17201,12 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_csrmux__SWIG_5(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_csrmux__SWIG_5(self, args); + } } } } @@ -17234,7 +17214,7 @@ } } } - if (argc == 6) { + if (argc == 7) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -17262,7 +17242,12 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csrmux__SWIG_6(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_csrmux__SWIG_6(self, args); + } } } } @@ -17270,7 +17255,7 @@ } } } - if (argc == 6) { + if (argc == 7) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -17298,7 +17283,12 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csrmux__SWIG_7(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_csrmux__SWIG_7(self, args); + } } } } @@ -17306,7 +17296,7 @@ } } } - if (argc == 6) { + if (argc == 7) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -17334,7 +17324,12 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csrmux__SWIG_8(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_csrmux__SWIG_8(self, args); + } } } } @@ -17342,7 +17337,7 @@ } } } - if (argc == 6) { + if (argc == 7) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -17370,7 +17365,12 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csrmux__SWIG_9(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_csrmux__SWIG_9(self, args); + } } } } @@ -17380,7 +17380,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csrmux'.\n Possible C/C++ prototypes are:\n"" csrmux<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],signed char const [],std::vector *)\n"" csrmux<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],unsigned char const [],std::vector *)\n"" csrmux<(int,short)>(int const,int const,int const [],int const [],short const [],short const [],std::vector *)\n"" csrmux<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],std::vector *)\n"" csrmux<(int,long long)>(int const,int const,int const [],int const [],long long const [],long long const [],std::vector *)\n"" csrmux<(int,float)>(int const,int const,int const [],int const [],float const [],float const [],std::vector *)\n"" csrmux<(int,double)>(int const,int const,int const [],int const [],double const [],double const [],std::vector *)\n"" csrmux<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper const [],std::vector *)\n"" csrmux<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper const [],std::vector *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csrmux'.\n Possible C/C++ prototypes are:\n"" csrmux<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],signed char const [],signed char [])\n"" csrmux<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],unsigned char const [],unsigned char [])\n"" csrmux<(int,short)>(int const,int const,int const [],int const [],short const [],short const [],short [])\n"" csrmux<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],int [])\n"" csrmux<(int,long long)>(int const,int const,int const [],int const [],long long const [],long long const [],long long [])\n"" csrmux<(int,float)>(int const,int const,int const [],int const [],float const [],float const [],float [])\n"" csrmux<(int,double)>(int const,int const,int const [],int const [],double const [],double const [],double [])\n"" csrmux<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper [])\n"" csrmux<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper [])\n"); return NULL; } @@ -17393,7 +17393,7 @@ int *arg4 ; signed char *arg5 ; signed char *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; + signed char *arg7 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -17406,19 +17406,16 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; + PyArrayObject *temp7 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cscmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:cscmux",&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 '" "cscmux" "', argument " "1"" of type '" "int""'"); @@ -17469,16 +17466,14 @@ arg6 = (signed char*) array6->data; } + { + temp7 = obj_to_array_no_conversion(obj6,PyArray_BYTE); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (signed char*) array_data(temp7); + } cscmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,(signed char const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(signed char)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -17516,7 +17511,7 @@ int *arg4 ; unsigned char *arg5 ; unsigned char *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; + unsigned char *arg7 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -17529,19 +17524,16 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; + PyArrayObject *temp7 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cscmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:cscmux",&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 '" "cscmux" "', argument " "1"" of type '" "int""'"); @@ -17592,16 +17584,14 @@ arg6 = (unsigned char*) array6->data; } + { + temp7 = obj_to_array_no_conversion(obj6,PyArray_UBYTE); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (unsigned char*) array_data(temp7); + } cscmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,(unsigned char const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(unsigned char)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -17639,7 +17629,7 @@ int *arg4 ; short *arg5 ; short *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; + short *arg7 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -17652,19 +17642,16 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; + PyArrayObject *temp7 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cscmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:cscmux",&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 '" "cscmux" "', argument " "1"" of type '" "int""'"); @@ -17715,16 +17702,14 @@ arg6 = (short*) array6->data; } + { + temp7 = obj_to_array_no_conversion(obj6,PyArray_SHORT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (short*) array_data(temp7); + } cscmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,(short const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(short)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -17762,7 +17747,7 @@ int *arg4 ; int *arg5 ; int *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; + int *arg7 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -17775,19 +17760,16 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; + PyArrayObject *temp7 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cscmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:cscmux",&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 '" "cscmux" "', argument " "1"" of type '" "int""'"); @@ -17838,16 +17820,14 @@ arg6 = (int*) array6->data; } + { + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); + } cscmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -17885,7 +17865,7 @@ int *arg4 ; long long *arg5 ; long long *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; + long long *arg7 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -17898,19 +17878,16 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; + PyArrayObject *temp7 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cscmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:cscmux",&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 '" "cscmux" "', argument " "1"" of type '" "int""'"); @@ -17961,16 +17938,14 @@ arg6 = (long long*) array6->data; } + { + temp7 = obj_to_array_no_conversion(obj6,PyArray_LONGLONG); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (long long*) array_data(temp7); + } cscmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,(long long const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(long long)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -18008,7 +17983,7 @@ int *arg4 ; float *arg5 ; float *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; + float *arg7 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -18021,19 +17996,16 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; + PyArrayObject *temp7 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cscmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:cscmux",&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 '" "cscmux" "', argument " "1"" of type '" "int""'"); @@ -18084,16 +18056,14 @@ arg6 = (float*) array6->data; } + { + temp7 = obj_to_array_no_conversion(obj6,PyArray_FLOAT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (float*) array_data(temp7); + } cscmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(float const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(float)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -18131,7 +18101,7 @@ int *arg4 ; double *arg5 ; double *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; + double *arg7 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -18144,19 +18114,16 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; + PyArrayObject *temp7 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cscmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:cscmux",&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 '" "cscmux" "', argument " "1"" of type '" "int""'"); @@ -18207,16 +18174,14 @@ arg6 = (double*) array6->data; } + { + temp7 = obj_to_array_no_conversion(obj6,PyArray_DOUBLE); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (double*) array_data(temp7); + } cscmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(double const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(double)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -18254,7 +18219,7 @@ int *arg4 ; npy_cfloat_wrapper *arg5 ; npy_cfloat_wrapper *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; + npy_cfloat_wrapper *arg7 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -18267,19 +18232,16 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; + PyArrayObject *temp7 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cscmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:cscmux",&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 '" "cscmux" "', argument " "1"" of type '" "int""'"); @@ -18330,16 +18292,14 @@ arg6 = (npy_cfloat_wrapper*) array6->data; } + { + temp7 = obj_to_array_no_conversion(obj6,PyArray_CFLOAT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (npy_cfloat_wrapper*) array_data(temp7); + } cscmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,(npy_cfloat_wrapper const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(npy_cfloat_wrapper)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -18377,7 +18337,7 @@ int *arg4 ; npy_cdouble_wrapper *arg5 ; npy_cdouble_wrapper *arg6 ; - std::vector *arg7 = (std::vector *) 0 ; + npy_cdouble_wrapper *arg7 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -18390,19 +18350,16 @@ int is_new_object5 ; PyArrayObject *array6 = NULL ; int is_new_object6 ; - std::vector *tmp7 ; + PyArrayObject *temp7 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:cscmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:cscmux",&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 '" "cscmux" "', argument " "1"" of type '" "int""'"); @@ -18453,16 +18410,14 @@ arg6 = (npy_cdouble_wrapper*) array6->data; } + { + temp7 = obj_to_array_no_conversion(obj6,PyArray_CDOUBLE); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (npy_cdouble_wrapper*) array_data(temp7); + } cscmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,(npy_cdouble_wrapper const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(npy_cdouble_wrapper)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { if (is_new_object3 && array3) Py_DECREF(array3); } { @@ -18494,15 +18449,15 @@ SWIGINTERN PyObject *_wrap_cscmux(PyObject *self, PyObject *args) { int argc; - PyObject *argv[7]; + PyObject *argv[8]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 6); ii++) { + for (ii = 0; (ii < argc) && (ii < 7); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } - if (argc == 6) { + if (argc == 7) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -18530,7 +18485,12 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_cscmux__SWIG_1(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_cscmux__SWIG_1(self, args); + } } } } @@ -18538,7 +18498,7 @@ } } } - if (argc == 6) { + if (argc == 7) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -18566,7 +18526,12 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_cscmux__SWIG_2(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_cscmux__SWIG_2(self, args); + } } } } @@ -18574,7 +18539,7 @@ } } } - if (argc == 6) { + if (argc == 7) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -18602,7 +18567,12 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_cscmux__SWIG_3(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_cscmux__SWIG_3(self, args); + } } } } @@ -18610,7 +18580,7 @@ } } } - if (argc == 6) { + if (argc == 7) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -18638,7 +18608,12 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_cscmux__SWIG_4(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_cscmux__SWIG_4(self, args); + } } } } @@ -18646,7 +18621,7 @@ } } } - if (argc == 6) { + if (argc == 7) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -18674,7 +18649,12 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_cscmux__SWIG_5(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_cscmux__SWIG_5(self, args); + } } } } @@ -18682,7 +18662,7 @@ } } } - if (argc == 6) { + if (argc == 7) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -18710,7 +18690,12 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_cscmux__SWIG_6(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_cscmux__SWIG_6(self, args); + } } } } @@ -18718,7 +18703,7 @@ } } } - if (argc == 6) { + if (argc == 7) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -18746,7 +18731,12 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_cscmux__SWIG_7(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_cscmux__SWIG_7(self, args); + } } } } @@ -18754,7 +18744,7 @@ } } } - if (argc == 6) { + if (argc == 7) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -18782,7 +18772,12 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_cscmux__SWIG_8(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_cscmux__SWIG_8(self, args); + } } } } @@ -18790,7 +18785,7 @@ } } } - if (argc == 6) { + if (argc == 7) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -18818,7 +18813,12 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_cscmux__SWIG_9(self, args); + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_cscmux__SWIG_9(self, args); + } } } } @@ -18828,7 +18828,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'cscmux'.\n Possible C/C++ prototypes are:\n"" cscmux<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],signed char const [],std::vector *)\n"" cscmux<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],unsigned char const [],std::vector *)\n"" cscmux<(int,short)>(int const,int const,int const [],int const [],short const [],short const [],std::vector *)\n"" cscmux<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],std::vector *)\n"" cscmux<(int,long long)>(int const,int const,int const [],int const [],long long const [],long long const [],std::vector *)\n"" cscmux<(int,float)>(int const,int const,int const [],int const [],float const [],float const [],std::vector *)\n"" cscmux<(int,double)>(int const,int const,int const [],int const [],double const [],double const [],std::vector *)\n"" cscmux<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper const [],std::vector *)\n"" cscmux<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper const [],std::vector *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'cscmux'.\n Possible C/C++ prototypes are:\n"" cscmux<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],signed char const [],signed char [])\n"" cscmux<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],unsigned char const [],unsigned char [])\n"" cscmux<(int,short)>(int const,int const,int const [],int const [],short const [],short const [],short [])\n"" cscmux<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],int [])\n"" cscmux<(int,long long)>(int const,int const,int const [],int const [],long long const [],long long const [],long long [])\n"" cscmux<(int,float)>(int const,int const,int const [],int const [],float const [],float const [],float [])\n"" cscmux<(int,double)>(int const,int const,int const [],int const [],double const [],double const [],double [])\n"" cscmux<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper [])\n"" cscmux<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper [])\n"); return NULL; } @@ -43814,35 +43814,35 @@ static PyMethodDef SwigMethods[] = { { (char *)"extract_csr_diagonal", _wrap_extract_csr_diagonal, METH_VARARGS, (char *)"\n" "extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n" - " std::vector<(signed char)> Yx)\n" + " signed char Yx)\n" "extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, \n" - " std::vector<(unsigned char)> Yx)\n" - "extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, short Ax, std::vector<(short)> Yx)\n" - "extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, int Ax, std::vector<(int)> Yx)\n" + " unsigned char Yx)\n" + "extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, short Ax, short Yx)\n" + "extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, int Ax, int Yx)\n" "extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, long long Ax, \n" - " std::vector<(long long)> Yx)\n" - "extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, float Ax, std::vector<(float)> Yx)\n" - "extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, double Ax, std::vector<(double)> Yx)\n" + " long long Yx)\n" + "extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, float Ax, float Yx)\n" + "extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, double Ax, double Yx)\n" "extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, \n" - " std::vector<(npy_cfloat_wrapper)> Yx)\n" + " npy_cfloat_wrapper Yx)\n" "extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, \n" - " std::vector<(npy_cdouble_wrapper)> Yx)\n" + " npy_cdouble_wrapper Yx)\n" ""}, { (char *)"extract_csc_diagonal", _wrap_extract_csc_diagonal, METH_VARARGS, (char *)"\n" "extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n" - " std::vector<(signed char)> Yx)\n" + " signed char Yx)\n" "extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, \n" - " std::vector<(unsigned char)> Yx)\n" - "extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, short Ax, std::vector<(short)> Yx)\n" - "extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, int Ax, std::vector<(int)> Yx)\n" + " unsigned char Yx)\n" + "extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, short Ax, short Yx)\n" + "extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, int Ax, int Yx)\n" "extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, long long Ax, \n" - " std::vector<(long long)> Yx)\n" - "extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, float Ax, std::vector<(float)> Yx)\n" - "extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, double Ax, std::vector<(double)> Yx)\n" + " long long Yx)\n" + "extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, float Ax, float Yx)\n" + "extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, double Ax, double Yx)\n" "extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, \n" - " std::vector<(npy_cfloat_wrapper)> Yx)\n" + " npy_cfloat_wrapper Yx)\n" "extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, \n" - " std::vector<(npy_cdouble_wrapper)> Yx)\n" + " npy_cdouble_wrapper Yx)\n" ""}, { (char *)"csrtocsc", _wrap_csrtocsc, METH_VARARGS, (char *)"\n" "csrtocsc(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n" @@ -43989,43 +43989,43 @@ ""}, { (char *)"csrmux", _wrap_csrmux, METH_VARARGS, (char *)"\n" "csrmux(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n" - " signed char Xx, std::vector<(signed char)> Yx)\n" + " signed char Xx, signed char Yx)\n" "csrmux(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, \n" - " unsigned char Xx, std::vector<(unsigned char)> Yx)\n" + " unsigned char Xx, unsigned char Yx)\n" "csrmux(int n_row, int n_col, int Ap, int Aj, short Ax, short Xx, \n" - " std::vector<(short)> Yx)\n" + " short Yx)\n" "csrmux(int n_row, int n_col, int Ap, int Aj, int Ax, int Xx, \n" - " std::vector<(int)> Yx)\n" + " int Yx)\n" "csrmux(int n_row, int n_col, int Ap, int Aj, long long Ax, \n" - " long long Xx, std::vector<(long long)> Yx)\n" + " long long Xx, long long Yx)\n" "csrmux(int n_row, int n_col, int Ap, int Aj, float Ax, float Xx, \n" - " std::vector<(float)> Yx)\n" + " float Yx)\n" "csrmux(int n_row, int n_col, int Ap, int Aj, double Ax, double Xx, \n" - " std::vector<(double)> Yx)\n" + " double Yx)\n" "csrmux(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, \n" - " npy_cfloat_wrapper Xx, std::vector<(npy_cfloat_wrapper)> Yx)\n" + " npy_cfloat_wrapper Xx, npy_cfloat_wrapper Yx)\n" "csrmux(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, \n" - " npy_cdouble_wrapper Xx, std::vector<(npy_cdouble_wrapper)> Yx)\n" + " npy_cdouble_wrapper Xx, npy_cdouble_wrapper Yx)\n" ""}, { (char *)"cscmux", _wrap_cscmux, METH_VARARGS, (char *)"\n" "cscmux(int n_row, int n_col, int Ap, int Ai, signed char Ax, \n" - " signed char Xx, std::vector<(signed char)> Yx)\n" + " signed char Xx, signed char Yx)\n" "cscmux(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, \n" - " unsigned char Xx, std::vector<(unsigned char)> Yx)\n" + " unsigned char Xx, unsigned char Yx)\n" "cscmux(int n_row, int n_col, int Ap, int Ai, short Ax, short Xx, \n" - " std::vector<(short)> Yx)\n" + " short Yx)\n" "cscmux(int n_row, int n_col, int Ap, int Ai, int Ax, int Xx, \n" - " std::vector<(int)> Yx)\n" + " int Yx)\n" "cscmux(int n_row, int n_col, int Ap, int Ai, long long Ax, \n" - " long long Xx, std::vector<(long long)> Yx)\n" + " long long Xx, long long Yx)\n" "cscmux(int n_row, int n_col, int Ap, int Ai, float Ax, float Xx, \n" - " std::vector<(float)> Yx)\n" + " float Yx)\n" "cscmux(int n_row, int n_col, int Ap, int Ai, double Ax, double Xx, \n" - " std::vector<(double)> Yx)\n" + " double Yx)\n" "cscmux(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, \n" - " npy_cfloat_wrapper Xx, std::vector<(npy_cfloat_wrapper)> Yx)\n" + " npy_cfloat_wrapper Xx, npy_cfloat_wrapper Yx)\n" "cscmux(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, \n" - " npy_cdouble_wrapper Xx, std::vector<(npy_cdouble_wrapper)> Yx)\n" + " npy_cdouble_wrapper Xx, npy_cdouble_wrapper Yx)\n" ""}, { (char *)"csr_elmul_csr", _wrap_csr_elmul_csr, METH_VARARGS, (char *)"\n" "csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n" From scipy-svn at scipy.org Tue Dec 11 23:48:03 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 11 Dec 2007 22:48:03 -0600 (CST) Subject: [Scipy-svn] r3638 - in trunk/scipy/sparse: . tests Message-ID: <20071212044803.714FB39C01C@new.scipy.org> Author: wnbell Date: 2007-12-11 22:47:56 -0600 (Tue, 11 Dec 2007) New Revision: 3638 Modified: trunk/scipy/sparse/sparse.py trunk/scipy/sparse/tests/test_sparse.py Log: unified format for empty sparse matrices fixed bug in dok_matrix.toarray() moved empty unittest to _TestCS Modified: trunk/scipy/sparse/sparse.py =================================================================== --- trunk/scipy/sparse/sparse.py 2007-12-12 04:04:17 UTC (rev 3637) +++ trunk/scipy/sparse/sparse.py 2007-12-12 04:47:56 UTC (rev 3638) @@ -1951,9 +1951,12 @@ def tocoo(self): """ Return a copy of this matrix in COOrdinate format""" - data = asarray(self.values(),dtype=self.dtype) - indices = asarray(self.keys(),dtype=intc).T - return coo_matrix((data,indices),dims=self.shape,dtype=self.dtype) + if self.getnnz() == 0: + return coo_matrix(self.shape,dtype=self.dtype) + else: + data = asarray(self.values(), dtype=self.dtype) + indices = asarray(self.keys(), dtype=intc).T + return coo_matrix((data,indices),dims=self.shape,dtype=self.dtype) def todok(self,copy=False): if copy: @@ -1967,18 +1970,10 @@ def tocsc(self): """ Return a copy of this matrix in Compressed Sparse Column format""" - # Fast sort on columns using the Schwartzian transform return self.tocoo().tocsc() def toarray(self): - new = zeros(self.shape, dtype=self.dtype) - for key in self.keys(): - ikey0 = int(key[0]) - ikey1 = int(key[1]) - new[ikey0, ikey1] = self[key] - if abs(new.imag).max() == 0: - new = new.real - return new + return self.tocsr().toarray() def resize(self, shape): """ Resize the matrix to dimensions given by 'shape', removing any @@ -2002,7 +1997,7 @@ """ A sparse matrix in coordinate list format. COO matrices are created either as: - A = coo_matrix(None, dims=(m, n), [dtype]) + A = coo_matrix( (m, n), [dtype]) for a zero matrix, or as: A = coo_matrix(M) where M is a dense matrix or rank 2 ndarray, or as: @@ -2028,37 +2023,46 @@ def __init__(self, arg1, dims=None, dtype=None): spmatrix.__init__(self) if isinstance(arg1, tuple): - try: - obj, ij = arg1 - except: - raise TypeError, "invalid input format" + if isshape(arg1): + M, N = arg1 + self.shape = (M,N) + self.row = array([], dtype=intc) + self.col = array([], dtype=intc) + self.data = array([],getdtype(dtype, default=float)) + else: + try: + obj, ij = arg1 + except: + raise TypeError, "invalid input format" - try: - if len(ij) != 2: - raise TypeError - except TypeError: - raise TypeError, "invalid input format" + try: + if len(ij) != 2: + raise TypeError + except TypeError: + raise TypeError, "invalid input format" - self.row = asarray(ij[0]) - self.col = asarray(ij[1]) - self.data = asarray(obj) + self.row = asarray(ij[0]) + self.col = asarray(ij[1]) + self.data = asarray(obj) - if dims is None: - if len(self.row) == 0 or len(self.col) == 0: - raise ValueError, "cannot infer dimensions from zero sized index arrays" - M = self.row.max() + 1 - N = self.col.max() + 1 - self.shape = (M, N) - else: - # Use 2 steps to ensure dims has length 2. - M, N = dims - self.shape = (M, N) + if dims is None: + if len(self.row) == 0 or len(self.col) == 0: + raise ValueError, "cannot infer dimensions from zero sized index arrays" + M = self.row.max() + 1 + N = self.col.max() + 1 + self.shape = (M, N) + else: + # Use 2 steps to ensure dims has length 2. + M, N = dims + self.shape = (M, N) - elif arg1 is None: # clumsy! We should make ALL arguments - # keyword arguments instead! + elif arg1 is None: # Initialize an empty matrix. if not isinstance(dims, tuple) or not isintlike(dims[0]): raise TypeError, "dimensions not understood" + warnings.warn('coo_matrix(None, dims=(M,N)) is deprecated, ' \ + 'use coo_matrix( (M,N) ) instead', \ + DeprecationWarning) self.shape = dims self.data = array([],getdtype(dtype, default=float)) self.row = array([],dtype=intc) @@ -2766,7 +2770,7 @@ if a.nnz == 0 or b.nnz == 0: # kronecker product is the zero matrix - return coo_matrix(None, dims=output_shape) + return coo_matrix( output_shape ) # expand entries of a into blocks Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-12 04:04:17 UTC (rev 3637) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-12 04:47:56 UTC (rev 3638) @@ -37,6 +37,23 @@ assert_equal(self.datsp[0,1],0) assert_equal(self.datsp[1,0],3) assert_equal(self.datsp[2,1],2) + + def check_empty(self): + """Test manipulating empty matrices. Fails in SciPy SVN <= r1768 + """ + shape = (5, 5) + for mytype in ['int32', 'float32', 'float64', 'complex64', 'complex128']: + a = self.spmatrix(shape, dtype=mytype) + b = a + a + c = 2 * a + d = a * a.tocsc() + e = a * a.tocsr() + f = a * a.tocoo() + for m in [a,b,c,d,e,f]: + assert_equal(m.A, a.A*a.A) + # These fail in all revisions <= r1768: + assert_equal(m.dtype,mytype) + assert_equal(m.A.dtype,mytype) def check_abs(self): A = matrix([[-1, 0, 17],[0, -5, 0],[1, -4, 0],[0,0,0]],'d') @@ -728,23 +745,6 @@ csr = csr_matrix((data, indices, indptr)) assert_array_equal(csr.shape,(3,6)) - def check_empty(self): - """Test manipulating empty matrices. Fails in SciPy SVN <= r1768 - """ - # This test should be made global (in _TestCS), but first we - # need a uniform argument order / syntax for constructing an - # empty sparse matrix. (coo_matrix is currently different). - shape = (5, 5) - for mytype in ['int32', 'float32', 'float64', 'complex64', 'complex128']: - a = self.spmatrix(shape, dtype=mytype) - b = a + a - c = 2 * a - d = a + a.tocsc() - e = a * a.tocoo() - assert_equal(e.A, a.A*a.A) - # These fail in all revisions <= r1768: - assert_equal(e.dtype,mytype) - assert_equal(e.A.dtype,mytype) def check_sort_indices(self): data = arange( 5 ) @@ -819,23 +819,6 @@ csc = csc_matrix((data, indices, indptr)) assert_array_equal(csc.shape,(6,3)) - def check_empty(self): - """Test manipulating empty matrices. Fails in SciPy SVN <= r1768 - """ - # This test should be made global (in _TestCS), but first we - # need a uniform argument order / syntax for constructing an - # empty sparse matrix. (coo_matrix is currently different). - shape = (5, 5) - for mytype in ['int32', 'float32', 'float64', 'complex64', 'complex128']: - a = self.spmatrix(shape, dtype=mytype) - b = a + a - c = 2 * a - d = a + a.tocsc() - e = a * a.tocoo() - assert_equal(e.A, a.A*a.A) - assert_equal(e.dtype, mytype) - assert_equal(e.A.dtype, mytype) - def check_sort_indices(self): data = arange( 5 ) row = array( [7, 2, 1, 5, 4] ) @@ -1223,7 +1206,7 @@ def check_constructor3(self): """empty matrix""" - coo = coo_matrix(None,dims=(4,3)) + coo = coo_matrix( (4,3) ) assert_array_equal(coo.shape,(4,3)) assert_array_equal(coo.row,[]) From scipy-svn at scipy.org Wed Dec 12 22:39:25 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 12 Dec 2007 21:39:25 -0600 (CST) Subject: [Scipy-svn] r3639 - trunk/scipy/sandbox/maskedarray Message-ID: <20071213033925.594FA39C13F@new.scipy.org> Author: pierregm Date: 2007-12-12 21:39:17 -0600 (Wed, 12 Dec 2007) New Revision: 3639 Modified: trunk/scipy/sandbox/maskedarray/core.py Log: core: fix_invalid : changed the default to copy=True Modified: trunk/scipy/sandbox/maskedarray/core.py =================================================================== --- trunk/scipy/sandbox/maskedarray/core.py 2007-12-12 04:47:56 UTC (rev 3638) +++ trunk/scipy/sandbox/maskedarray/core.py 2007-12-13 03:39:17 UTC (rev 3639) @@ -269,10 +269,11 @@ return data getdata = get_data -def fix_invalid(a, copy=False, fill_value=None): +def fix_invalid(a, copy=True, fill_value=None): """Returns (a copy of) a where invalid data (nan/inf) are masked and replaced by fill_value. - +Note that a copy is performed by default (just in case...). + *Parameters*: a : {ndarray} A (subclass of) ndarray. From scipy-svn at scipy.org Thu Dec 13 11:47:12 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 13 Dec 2007 10:47:12 -0600 (CST) Subject: [Scipy-svn] r3640 - branches Message-ID: <20071213164712.103F139C0F7@new.scipy.org> Author: matthew.brett at gmail.com Date: 2007-12-13 10:45:21 -0600 (Thu, 13 Dec 2007) New Revision: 3640 Added: branches/cbu_models_branch/ Log: Creating private branch of models code Copied: branches/cbu_models_branch (from rev 3639, trunk/scipy/stats/models) From scipy-svn at scipy.org Thu Dec 13 15:25:45 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 13 Dec 2007 14:25:45 -0600 (CST) Subject: [Scipy-svn] r3641 - trunk/scipy/sparse Message-ID: <20071213202545.D830FC7C037@new.scipy.org> Author: wnbell Date: 2007-12-13 14:25:41 -0600 (Thu, 13 Dec 2007) New Revision: 3641 Added: trunk/scipy/sparse/construct.py trunk/scipy/sparse/spfuncs.py Modified: trunk/scipy/sparse/__init__.py trunk/scipy/sparse/info.py trunk/scipy/sparse/sparse.py Log: intial split of sparse module into different files Modified: trunk/scipy/sparse/__init__.py =================================================================== --- trunk/scipy/sparse/__init__.py 2007-12-13 16:45:21 UTC (rev 3640) +++ trunk/scipy/sparse/__init__.py 2007-12-13 20:25:41 UTC (rev 3641) @@ -3,6 +3,8 @@ from info import __doc__ from sparse import * +from construct import * +from spfuncs import * __all__ = filter(lambda s:not s.startswith('_'),dir()) from numpy.testing import NumpyTest Added: trunk/scipy/sparse/construct.py =================================================================== --- trunk/scipy/sparse/construct.py 2007-12-13 16:45:21 UTC (rev 3640) +++ trunk/scipy/sparse/construct.py 2007-12-13 20:25:41 UTC (rev 3641) @@ -0,0 +1,186 @@ +""" Functions to construct sparse matrices +""" + + +__all__ = [ 'spdiags','speye','spidentity','spkron', 'lil_eye', 'lil_diags' ] + +import itertools + +import numpy +from numpy import ones, clip, array, arange, intc + +from sparse import csr_matrix, csc_matrix, coo_matrix, \ + dok_matrix, lil_matrix +from sparse import isspmatrix, isspmatrix_csr, isspmatrix_csc +import sparsetools + +def _spdiags_tosub(diag_num, a, b): + part1 = where(less(diag_num, a), abs(diag_num-a), 0) + part2 = where(greater(diag_num, b), abs(diag_num-b), 0) + return part1+part2 + +# Note: sparsetools only offers diagonal -> CSC matrix conversion functions, +# not to CSR +def spdiags(diags, offsets, M, N): + """Return a sparse matrix in CSC format given its diagonals. + + B = spdiags(diags, offsets, M, N) + + Inputs: + diags -- rows contain diagonal values + offsets -- diagonals to set (0 is main) + M, N -- sparse matrix returned is M X N + """ + # diags = array(transpose(diags), copy=True) + diags = array(diags, copy = True) + if diags.dtype.char not in 'fdFD': + diags = diags.astype('d') + if not hasattr(offsets, '__len__' ): + offsets = (offsets,) + offsets = array(offsets, copy=False, dtype=intc) + assert(len(offsets) == diags.shape[0]) + indptr, rowind, data = sparsetools.spdiags(M, N, len(offsets), offsets, diags) + return csc_matrix((data, rowind, indptr), (M, N)) + + + +def spidentity(n, dtype='d'): + """ + spidentity( n ) returns the identity matrix of shape (n, n) stored + in CSC sparse matrix format. + """ + return csc_matrix((ones(n,dtype=dtype),arange(n),arange(n+1)),(n,n)) + + +def speye(n, m, k = 0, dtype = 'd'): + """ + speye(n, m) returns a (n x m) matrix stored + in CSC sparse matrix format, where the k-th diagonal is all ones, + and everything else is zeros. + """ + diags = ones((1, n), dtype = dtype) + return spdiags(diags, k, n, m) + +def spkron(a,b): + """kronecker product of sparse matrices a and b + + *Parameters*: + a,b : sparse matrices + E.g. csr_matrix, csc_matrix, coo_matrix, etc. + + *Returns*: + coo_matrix + kronecker product in COOrdinate format + + *Example*: + ------- + + >>> a = csr_matrix(array([[0,2],[5,0]])) + >>> b = csr_matrix(array([[1,2],[3,4]])) + >>> spkron(a,b).todense() + matrix([[ 0., 0., 2., 4.], + [ 0., 0., 6., 8.], + [ 5., 10., 0., 0.], + [ 15., 20., 0., 0.]]) + + """ + if not isspmatrix(a) and isspmatrix(b): + raise ValueError,'expected sparse matrix' + + a,b = a.tocoo(),b.tocoo() + output_shape = (a.shape[0]*b.shape[0],a.shape[1]*b.shape[1]) + + if a.nnz == 0 or b.nnz == 0: + # kronecker product is the zero matrix + return coo_matrix( output_shape ) + + + # expand entries of a into blocks + row = a.row.repeat(b.nnz) + col = a.col.repeat(b.nnz) + data = a.data.repeat(b.nnz) + + row *= b.shape[0] + col *= b.shape[1] + + # increment block indices + row,col = row.reshape(-1,b.nnz),col.reshape(-1,b.nnz) + row += b.row + col += b.col + row,col = row.reshape(-1),col.reshape(-1) + + # compute block entries + data = data.reshape(-1,b.nnz) * b.data + data = data.reshape(-1) + + return coo_matrix((data,(row,col)), dims=output_shape) + + + + +def lil_eye((r,c), k=0, dtype=float): + """Generate a lil_matrix of dimensions (r,c) with the k-th + diagonal set to 1. + + :Parameters: + r,c : int + Row and column-dimensions of the output. + k : int + Diagonal offset. In the output matrix, + out[m,m+k] == 1 for all m. + dtype : dtype + Data-type of the output array. + + """ + out = lil_matrix((r,c),dtype=dtype) + for c in xrange(clip(k,0,c),clip(r+k,0,c)): + out.rows[c-k].append(c) + out.data[c-k].append(1) + return out + +def lil_diags(diags,offsets,(m,n),dtype=float): + """Generate a lil_matrix with the given diagonals. + + :Parameters: + diags : list of list of values e.g. [[1,2,3],[4,5]] + Values to be placed on each indicated diagonal. + offsets : list of ints + Diagonal offsets. This indicates the diagonal on which + the given values should be placed. + (r,c) : tuple of ints + Row and column dimensions of the output. + dtype : dtype + Output data-type. + + Example: + ------- + + >>> lil_diags([[1,2,3],[4,5],[6]],[0,1,2],(3,3)).todense() + matrix([[ 1., 4., 6.], + [ 0., 2., 5.], + [ 0., 0., 3.]]) + + """ + offsets_unsorted = list(offsets) + diags_unsorted = list(diags) + if len(diags) != len(offsets): + raise ValueError("Number of diagonals provided should " + "agree with offsets.") + + sort_indices = numpy.argsort(offsets_unsorted) + diags = [diags_unsorted[k] for k in sort_indices] + offsets = [offsets_unsorted[k] for k in sort_indices] + + for i,k in enumerate(offsets): + if len(diags[i]) < m-abs(k): + raise ValueError("Not enough values specified to fill " + "diagonal %s." % k) + + out = lil_matrix((m,n),dtype=dtype) + for k,diag in itertools.izip(offsets,diags): + for ix,c in enumerate(xrange(clip(k,0,n),clip(m+k,0,n))): + out.rows[c-k].append(c) + out.data[c-k].append(diag[ix]) + return out + + Modified: trunk/scipy/sparse/info.py =================================================================== --- trunk/scipy/sparse/info.py 2007-12-13 16:45:21 UTC (rev 3640) +++ trunk/scipy/sparse/info.py 2007-12-13 20:25:41 UTC (rev 3641) @@ -12,7 +12,7 @@ (2) csr_matrix: Compressed Sparse Row format (3) lil_matrix: List of Lists format (4) dok_matrix: Dictionary of Keys format - (5) coo_matrix: COOrdinate format (IJV triplets) + (5) coo_matrix: COOrdinate format (aka IJV, triplet format) To construct a matrix efficiently, use either lil_matrix (recommended) or dok_matrix. The lil_matrix class supports basic slicing and fancy @@ -74,10 +74,11 @@ Further Details: CSR column indices are not necessarily sorted. Likewise for CSC row - indices. Use the .ensure_sorted_indices() method when sorted indices - are necessary. Note that there is no expectation for sorted indices - in the sparsetools module. Furthermore some sparsetools functions - produce matrices with unsorted indices even when sorted input is given. + indices. Use the .sorted_indices() and .sort_indices() methods when + sorted indices are necessary. Note that there is no expectation for + sorted indices in the sparsetools module. Furthermore some sparsetools + functions produce matrices with unsorted indices even when sorted + input is given. """ postpone_import = 1 Modified: trunk/scipy/sparse/sparse.py =================================================================== --- trunk/scipy/sparse/sparse.py 2007-12-13 16:45:21 UTC (rev 3640) +++ trunk/scipy/sparse/sparse.py 2007-12-13 20:25:41 UTC (rev 3641) @@ -6,11 +6,9 @@ __all__ = ['spmatrix','csc_matrix','csr_matrix','coo_matrix', - 'lil_matrix','dok_matrix', - 'spdiags','speye','spidentity','spkron','extract_diagonal', - 'isspmatrix','issparse','isspmatrix_csc','isspmatrix_csr', - 'isspmatrix_lil','isspmatrix_dok', 'isspmatrix_coo', - 'lil_eye', 'lil_diags' ] + 'lil_matrix','dok_matrix' ] +__all__ += [ 'isspmatrix','issparse','isspmatrix_csc','isspmatrix_csr', + 'isspmatrix_lil','isspmatrix_dok', 'isspmatrix_coo' ] import warnings @@ -24,6 +22,7 @@ from scipy.sparse.sparsetools import csrtodense, \ cootocsr, cootocsc, csctocsr, csrtocsc + import sparsetools import itertools, operator, copy from bisect import bisect_left @@ -2593,6 +2592,9 @@ # unsymmetric sparse skyline # variable block row + + + def _isinstance(x, _class): ## # This makes scipy.sparse.sparse.csc_matrix == __main__.csc_matrix. @@ -2653,6 +2655,10 @@ else: return True +def issequence(t): + return isinstance(t, (list, tuple))\ + or (isinstance(t, ndarray) and (t.ndim == 1)) + def getdtype(dtype, a=None, default=None): """Function used to simplify argument processing. If 'dtype' is not specified (is None), returns a.dtype; otherwise returns a numpy.dtype @@ -2676,191 +2682,3 @@ return newdtype -def _spdiags_tosub(diag_num, a, b): - part1 = where(less(diag_num, a), abs(diag_num-a), 0) - part2 = where(greater(diag_num, b), abs(diag_num-b), 0) - return part1+part2 - -# Note: sparsetools only offers diagonal -> CSC matrix conversion functions, -# not to CSR -def spdiags(diags, offsets, M, N): - """Return a sparse matrix in CSC format given its diagonals. - - B = spdiags(diags, offsets, M, N) - - Inputs: - diags -- rows contain diagonal values - offsets -- diagonals to set (0 is main) - M, N -- sparse matrix returned is M X N - """ - # diags = array(transpose(diags), copy=True) - diags = numpy.array(diags, copy = True) - if diags.dtype.char not in 'fdFD': - diags = diags.astype('d') - if not hasattr(offsets, '__len__' ): - offsets = (offsets,) - offsets = array(offsets, copy=False, dtype=numpy.intc) - assert(len(offsets) == diags.shape[0]) - indptr, rowind, data = sparsetools.spdiags(M, N, len(offsets), offsets, diags) - return csc_matrix((data, rowind, indptr), (M, N)) - -def extract_diagonal(A): - """ - extract_diagonal(A) returns the main diagonal of A. - """ - #TODO extract k-th diagonal - if isspmatrix_csr(A) or isspmatrix_csc(A): - fn = getattr(sparsetools, "extract_" + A.format + "_diagonal") - y = empty( min(A.shape), dtype=upcast(A.dtype) ) - fn(A.shape[0],A.shape[1],A.indptr,A.indices,A.data,y) - return y - elif isspmatrix(A): - return extract_diagonal(A.tocsr()) - else: - raise ValueError,'expected sparse matrix' - - - - -def spidentity(n, dtype='d'): - """ - spidentity( n ) returns the identity matrix of shape (n, n) stored - in CSC sparse matrix format. - """ - return csc_matrix((ones(n,dtype=dtype),arange(n),arange(n+1)),(n,n)) - - -def speye(n, m, k = 0, dtype = 'd'): - """ - speye(n, m) returns a (n x m) matrix stored - in CSC sparse matrix format, where the k-th diagonal is all ones, - and everything else is zeros. - """ - diags = ones((1, n), dtype = dtype) - return spdiags(diags, k, n, m) - -def spkron(a,b): - """kronecker product of sparse matrices a and b - - *Parameters*: - a,b : sparse matrices - E.g. csr_matrix, csc_matrix, coo_matrix, etc. - - *Returns*: - coo_matrix - kronecker product in COOrdinate format - - *Example*: - ------- - - >>> a = csr_matrix(array([[0,2],[5,0]])) - >>> b = csr_matrix(array([[1,2],[3,4]])) - >>> spkron(a,b).todense() - matrix([[ 0., 0., 2., 4.], - [ 0., 0., 6., 8.], - [ 5., 10., 0., 0.], - [ 15., 20., 0., 0.]]) - - """ - if not isspmatrix(a) and isspmatrix(b): - raise ValueError,'expected sparse matrix' - - a,b = a.tocoo(),b.tocoo() - output_shape = (a.shape[0]*b.shape[0],a.shape[1]*b.shape[1]) - - if a.nnz == 0 or b.nnz == 0: - # kronecker product is the zero matrix - return coo_matrix( output_shape ) - - - # expand entries of a into blocks - row = a.row.repeat(b.nnz) - col = a.col.repeat(b.nnz) - data = a.data.repeat(b.nnz) - - row *= b.shape[0] - col *= b.shape[1] - - # increment block indices - row,col = row.reshape(-1,b.nnz),col.reshape(-1,b.nnz) - row += b.row - col += b.col - row,col = row.reshape(-1),col.reshape(-1) - - # compute block entries - data = data.reshape(-1,b.nnz) * b.data - data = data.reshape(-1) - - return coo_matrix((data,(row,col)), dims=output_shape) - - - - -def lil_eye((r,c), k=0, dtype=float): - """Generate a lil_matrix of dimensions (r,c) with the k-th - diagonal set to 1. - - :Parameters: - r,c : int - Row and column-dimensions of the output. - k : int - Diagonal offset. In the output matrix, - out[m,m+k] == 1 for all m. - dtype : dtype - Data-type of the output array. - - """ - out = lil_matrix((r,c),dtype=dtype) - for c in xrange(clip(k,0,c),clip(r+k,0,c)): - out.rows[c-k].append(c) - out.data[c-k].append(1) - return out - -def lil_diags(diags,offsets,(m,n),dtype=float): - """Generate a lil_matrix with the given diagonals. - - :Parameters: - diags : list of list of values e.g. [[1,2,3],[4,5]] - Values to be placed on each indicated diagonal. - offsets : list of ints - Diagonal offsets. This indicates the diagonal on which - the given values should be placed. - (r,c) : tuple of ints - Row and column dimensions of the output. - dtype : dtype - Output data-type. - - Example: - ------- - - >>> lil_diags([[1,2,3],[4,5],[6]],[0,1,2],(3,3)).todense() - matrix([[ 1., 4., 6.], - [ 0., 2., 5.], - [ 0., 0., 3.]]) - - """ - offsets_unsorted = list(offsets) - diags_unsorted = list(diags) - if len(diags) != len(offsets): - raise ValueError("Number of diagonals provided should " - "agree with offsets.") - - sort_indices = numpy.argsort(offsets_unsorted) - diags = [diags_unsorted[k] for k in sort_indices] - offsets = [offsets_unsorted[k] for k in sort_indices] - - for i,k in enumerate(offsets): - if len(diags[i]) < m-abs(k): - raise ValueError("Not enough values specified to fill " - "diagonal %s." % k) - - out = lil_matrix((m,n),dtype=dtype) - for k,diag in itertools.izip(offsets,diags): - for ix,c in enumerate(xrange(clip(k,0,n),clip(m+k,0,n))): - out.rows[c-k].append(c) - out.data[c-k].append(diag[ix]) - return out - -def issequence(t): - return isinstance(t, (list, tuple))\ - or (isinstance(t, ndarray) and (t.ndim == 1)) Added: trunk/scipy/sparse/spfuncs.py =================================================================== --- trunk/scipy/sparse/spfuncs.py 2007-12-13 16:45:21 UTC (rev 3640) +++ trunk/scipy/sparse/spfuncs.py 2007-12-13 20:25:41 UTC (rev 3641) @@ -0,0 +1,27 @@ +""" Functions that operate on sparse matrices +""" + +from numpy import empty + +from sparse import isspmatrix_csr, isspmatrix_csc, isspmatrix +from sparse import upcast + +import sparsetools + +def extract_diagonal(A): + """ + extract_diagonal(A) returns the main diagonal of A. + """ + #TODO extract k-th diagonal + if isspmatrix_csr(A) or isspmatrix_csc(A): + fn = getattr(sparsetools, "extract_" + A.format + "_diagonal") + y = empty( min(A.shape), dtype=upcast(A.dtype) ) + fn(A.shape[0],A.shape[1],A.indptr,A.indices,A.data,y) + return y + elif isspmatrix(A): + return extract_diagonal(A.tocsr()) + else: + raise ValueError,'expected sparse matrix' + + + From scipy-svn at scipy.org Thu Dec 13 17:52:00 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 13 Dec 2007 16:52:00 -0600 (CST) Subject: [Scipy-svn] r3642 - in trunk/scipy: sandbox/multigrid sparse sparse/tests Message-ID: <20071213225200.2B39939C0CC@new.scipy.org> Author: wnbell Date: 2007-12-13 16:51:45 -0600 (Thu, 13 Dec 2007) New Revision: 3642 Modified: trunk/scipy/sandbox/multigrid/sa.py trunk/scipy/sparse/construct.py trunk/scipy/sparse/sparse.py trunk/scipy/sparse/tests/test_sparse.py Log: added format parameter to construction functions Modified: trunk/scipy/sandbox/multigrid/sa.py =================================================================== --- trunk/scipy/sandbox/multigrid/sa.py 2007-12-13 20:25:41 UTC (rev 3641) +++ trunk/scipy/sandbox/multigrid/sa.py 2007-12-13 22:51:45 UTC (rev 3642) @@ -2,7 +2,7 @@ import numpy from numpy import array,arange,ones,zeros,sqrt,isinf,asarray,empty,diff,\ ascontiguousarray -from scipy.sparse import csr_matrix,isspmatrix_csr,spidentity +from scipy.sparse import csr_matrix,isspmatrix_csr from utils import diag_sparse, approximate_spectral_radius, \ symmetric_rescaling, expand_into_blocks Modified: trunk/scipy/sparse/construct.py =================================================================== --- trunk/scipy/sparse/construct.py 2007-12-13 20:25:41 UTC (rev 3641) +++ trunk/scipy/sparse/construct.py 2007-12-13 22:51:45 UTC (rev 3642) @@ -5,6 +5,7 @@ __all__ = [ 'spdiags','speye','spidentity','spkron', 'lil_eye', 'lil_diags' ] import itertools +import warnings import numpy from numpy import ones, clip, array, arange, intc @@ -14,58 +15,78 @@ from sparse import isspmatrix, isspmatrix_csr, isspmatrix_csc import sparsetools -def _spdiags_tosub(diag_num, a, b): - part1 = where(less(diag_num, a), abs(diag_num-a), 0) - part2 = where(greater(diag_num, b), abs(diag_num-b), 0) - return part1+part2 -# Note: sparsetools only offers diagonal -> CSC matrix conversion functions, -# not to CSR -def spdiags(diags, offsets, M, N): - """Return a sparse matrix in CSC format given its diagonals. +def spdiags(diags, offsets, m, n, format=None): + """Return a sparse matrix given its diagonals. - B = spdiags(diags, offsets, M, N) + B = spdiags(diags, offsets, m, n) - Inputs: - diags -- rows contain diagonal values - offsets -- diagonals to set (0 is main) - M, N -- sparse matrix returned is M X N - """ - # diags = array(transpose(diags), copy=True) - diags = array(diags, copy = True) - if diags.dtype.char not in 'fdFD': - diags = diags.astype('d') - if not hasattr(offsets, '__len__' ): - offsets = (offsets,) - offsets = array(offsets, copy=False, dtype=intc) - assert(len(offsets) == diags.shape[0]) - indptr, rowind, data = sparsetools.spdiags(M, N, len(offsets), offsets, diags) - return csc_matrix((data, rowind, indptr), (M, N)) + *Parameters*: + diags : matrix whose rows contain the diagonal values + offsets : diagonals to set + k = 0 - the main diagonal + k > 0 - the k-th upper diagonal + k < 0 - the k-th lower diagonal + m, n : dimensions of the result + format : format of the result (e.g. "csr") + By default (format=None) an appropriate sparse matrix + format is returned. This choice is subject to change. + *Example* + ------- + >>> diags = array([[1,2,3],[4,5,6],[7,8,9]]) + >>> offsets = array([0,-1,2]) + >>> spdiags( diags, offsets, 3, 5).todense() + matrix([[ 1., 0., 7., 0., 0.], + [ 4., 2., 0., 8., 0.], + [ 0., 5., 3., 0., 9.]]) -def spidentity(n, dtype='d'): """ - spidentity( n ) returns the identity matrix of shape (n, n) stored - in CSC sparse matrix format. - """ - return csc_matrix((ones(n,dtype=dtype),arange(n),arange(n+1)),(n,n)) + #TODO update this example + + if format == 'csc': + diags = array(diags, copy = True) + if diags.dtype.char not in 'fdFD': + diags = diags.astype('d') + if not hasattr(offsets, '__len__' ): + offsets = (offsets,) + offsets = array(offsets, copy=False, dtype=intc) + assert(len(offsets) == diags.shape[0]) + indptr, rowind, data = sparsetools.spdiags(m, n, len(offsets), offsets, diags) + return csc_matrix((data, rowind, indptr), (m, n)) + else: + return spdiags( diags, offsets, m, n, format='csc').asformat(format) +def spidentity(n, dtype='d', format=None): + """spidentity(n) returns an (n x n) identity matrix""" + if format in ['csr','csc']: + indptr = arange(n+1, dtype=intc) + indices = arange(n, dtype=intc) + data = ones(n, dtype=dtype) + cls = eval('%s_matrix' % format) + return cls((data,indices,indptr),(n,n)) + elif format == 'coo': + row = arange(n, dtype=intc) + col = arange(n, dtype=intc) + data = ones(n, dtype=dtype) + cls = eval('%s_matrix' % format) + return coo_matrix((data,(row,col)),(n,n)) + else: + return spidentity( n, dtype=dtype, format='csr').asformat(format) -def speye(n, m, k = 0, dtype = 'd'): +def speye(m, n, k=0, dtype='d', format=None): + """speye(m, n) returns an (m x n) matrix where the k-th diagonal + is all ones and everything else is zeros. """ - speye(n, m) returns a (n x m) matrix stored - in CSC sparse matrix format, where the k-th diagonal is all ones, - and everything else is zeros. - """ - diags = ones((1, n), dtype = dtype) - return spdiags(diags, k, n, m) + diags = ones((1, m), dtype = dtype) + return spdiags(diags, k, m, n).asformat(format) -def spkron(a,b): - """kronecker product of sparse matrices a and b +def spkron(A, B, format=None): + """kronecker product of sparse matrices A and B *Parameters*: - a,b : sparse matrices + A,B : sparse matrices E.g. csr_matrix, csc_matrix, coo_matrix, etc. *Returns*: @@ -75,50 +96,49 @@ *Example*: ------- - >>> a = csr_matrix(array([[0,2],[5,0]])) - >>> b = csr_matrix(array([[1,2],[3,4]])) - >>> spkron(a,b).todense() + >>> A = csr_matrix(array([[0,2],[5,0]])) + >>> B = csr_matrix(array([[1,2],[3,4]])) + >>> spkron(A,B).todense() matrix([[ 0., 0., 2., 4.], [ 0., 0., 6., 8.], [ 5., 10., 0., 0.], [ 15., 20., 0., 0.]]) """ - if not isspmatrix(a) and isspmatrix(b): + if not isspmatrix(A) and isspmatrix(B): raise ValueError,'expected sparse matrix' - a,b = a.tocoo(),b.tocoo() - output_shape = (a.shape[0]*b.shape[0],a.shape[1]*b.shape[1]) + A,B = A.tocoo(),B.tocoo() + output_shape = (A.shape[0]*B.shape[0],A.shape[1]*B.shape[1]) - if a.nnz == 0 or b.nnz == 0: + if A.nnz == 0 or B.nnz == 0: # kronecker product is the zero matrix return coo_matrix( output_shape ) - # expand entries of a into blocks - row = a.row.repeat(b.nnz) - col = a.col.repeat(b.nnz) - data = a.data.repeat(b.nnz) + row = A.row.repeat(B.nnz) + col = A.col.repeat(B.nnz) + data = A.data.repeat(B.nnz) - row *= b.shape[0] - col *= b.shape[1] + row *= B.shape[0] + col *= B.shape[1] # increment block indices - row,col = row.reshape(-1,b.nnz),col.reshape(-1,b.nnz) - row += b.row - col += b.col + row,col = row.reshape(-1,B.nnz),col.reshape(-1,B.nnz) + row += B.row + col += B.col row,col = row.reshape(-1),col.reshape(-1) # compute block entries - data = data.reshape(-1,b.nnz) * b.data + data = data.reshape(-1,B.nnz) * B.data data = data.reshape(-1) - return coo_matrix((data,(row,col)), dims=output_shape) + return coo_matrix((data,(row,col)), dims=output_shape).asformat(format) -def lil_eye((r,c), k=0, dtype=float): +def lil_eye((r,c), k=0, dtype='d'): """Generate a lil_matrix of dimensions (r,c) with the k-th diagonal set to 1. @@ -132,13 +152,14 @@ Data-type of the output array. """ - out = lil_matrix((r,c),dtype=dtype) - for c in xrange(clip(k,0,c),clip(r+k,0,c)): - out.rows[c-k].append(c) - out.data[c-k].append(1) - return out + warnings.warn("lil_eye is deprecated. use speye(... , format='lil') instead", \ + DeprecationWarning) + return speye(r,c,k,dtype=dtype,format='lil') -def lil_diags(diags,offsets,(m,n),dtype=float): + + +#TODO remove this function +def lil_diags(diags,offsets,(m,n),dtype='d'): """Generate a lil_matrix with the given diagonals. :Parameters: Modified: trunk/scipy/sparse/sparse.py =================================================================== --- trunk/scipy/sparse/sparse.py 2007-12-13 20:25:41 UTC (rev 3641) +++ trunk/scipy/sparse/sparse.py 2007-12-13 22:51:45 UTC (rev 3642) @@ -245,14 +245,26 @@ " or shape[0]" def asformat(self, format): - # default converter goes through the CSR format - csr = self.tocsr() - return eval('%s_matrix' % format)(csr) + """Return this matrix in a given sparse format - # default operations use the CSC format as a base - # and operations return in csc format + *Parameters*: + format : desired sparse matrix format + If format is None then no conversion is performed + Other possible values include: + "csr" for csr_matrix format + "csc" for csc_matrix format + "dok" for dok_matrix format and so on + """ + + if format is None or format == self.format: + return self + else: + return eval('%s_matrix' % format)(self) + + # default operations use the CSR format as a base + # and operations return in csr format # thus, a new sparse matrix format just needs to define - # a tocsc method + # a tocsr method def __abs__(self): return abs(self.tocsr()) Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-13 20:25:41 UTC (rev 3641) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-13 22:51:45 UTC (rev 3642) @@ -1041,7 +1041,7 @@ def check_lil_sequence_assignement(self): A = lil_matrix((4,3)) - B = lil_eye((3,4)) + B = speye(3,4,format='lil') i0 = [0,1,2] i1 = (0,1,2) @@ -1095,12 +1095,6 @@ [0,0,9], [0,16,0]]) - def check_lil_eye(self): - for dim in [(3,5),(5,3)]: - for k in range(-5,5): - r,c = dim - assert_array_equal(lil_eye(dim,k).todense(), - speye(r,c,k).todense()) def check_lil_diags(self): assert_array_equal(lil_diags([[1,2,3],[4,5],[6]], From scipy-svn at scipy.org Thu Dec 13 21:58:43 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 13 Dec 2007 20:58:43 -0600 (CST) Subject: [Scipy-svn] r3643 - trunk/scipy/sparse Message-ID: <20071214025843.796D539C133@new.scipy.org> Author: wnbell Date: 2007-12-13 20:58:33 -0600 (Thu, 13 Dec 2007) New Revision: 3643 Added: trunk/scipy/sparse/base.py trunk/scipy/sparse/compressed.py trunk/scipy/sparse/coo.py trunk/scipy/sparse/dok.py trunk/scipy/sparse/lil.py trunk/scipy/sparse/sputils.py Removed: trunk/scipy/sparse/sparse.py Modified: trunk/scipy/sparse/__init__.py trunk/scipy/sparse/construct.py trunk/scipy/sparse/spfuncs.py Log: split sparse matrix classes and functions into separate files Modified: trunk/scipy/sparse/__init__.py =================================================================== --- trunk/scipy/sparse/__init__.py 2007-12-13 22:51:45 UTC (rev 3642) +++ trunk/scipy/sparse/__init__.py 2007-12-14 02:58:33 UTC (rev 3643) @@ -2,7 +2,12 @@ from info import __doc__ -from sparse import * +from base import * +from compressed import * +from lil import * +from dok import * +from coo import * + from construct import * from spfuncs import * Added: trunk/scipy/sparse/base.py =================================================================== --- trunk/scipy/sparse/base.py 2007-12-13 22:51:45 UTC (rev 3642) +++ trunk/scipy/sparse/base.py 2007-12-14 02:58:33 UTC (rev 3643) @@ -0,0 +1,469 @@ +"""Base class for sparse matrices""" + +__all__ = ['spmatrix','isspmatrix','issparse'] + +from numpy import asarray, asmatrix, ones + +from sputils import isdense + + +# The formats that we might potentially understand. +_formats = {'csc':[0, "Compressed Sparse Column"], + 'csr':[1, "Compressed Sparse Row"], + 'dok':[2, "Dictionary Of Keys"], + 'lil':[3, "LInked List"], + 'dod':[4, "Dictionary of Dictionaries"], + 'sss':[5, "Symmetric Sparse Skyline"], + 'coo':[6, "COOrdinate"], + 'lba':[7, "Linpack BAnded"], + 'egd':[8, "Ellpack-itpack Generalized Diagonal"], + 'dia':[9, "DIAgonal"], + 'bsr':[10, "Block Sparse Row"], + 'msr':[11, "Modified compressed Sparse Row"], + 'bsc':[12, "Block Sparse Column"], + 'msc':[13, "Modified compressed Sparse Column"], + 'ssk':[14, "Symmetric SKyline"], + 'nsk':[15, "Nonsymmetric SKyline"], + 'jad':[16, "JAgged Diagonal"], + 'uss':[17, "Unsymmetric Sparse Skyline"], + 'vbr':[18, "Variable Block Row"], + 'und':[19, "Undefined"] + } + + +MAXPRINT = 50 + +class spmatrix(object): + """ This class provides a base class for all sparse matrices. It + cannot be instantiated. Most of the work is provided by subclasses. + """ + + __array_priority__ = 10.1 + ndim = 2 + def __init__(self, maxprint=MAXPRINT): + self.format = self.__class__.__name__[:3] + self._shape = None + if self.format == 'spm': + raise ValueError, "This class is not intended" \ + " to be instantiated directly." + self.maxprint = maxprint + + def set_shape(self,shape): + shape = tuple(shape) + + if len(shape) != 2: + raise ValueError("Only two-dimensional sparse arrays " + "are supported.") + try: + shape = int(shape[0]),int(shape[1]) #floats, other weirdness + except: + raise TypeError,'invalid shape' + + if not (shape[0] >= 1 and shape[1] >= 1): + raise TypeError,'invalid shape' + + if (self._shape != shape) and (self._shape is not None): + try: + self = self.reshape(shape) + except NotImplementedError: + raise NotImplementedError("Reshaping not implemented for %s." % + self.__class__.__name__) + self._shape = shape + + def get_shape(self): + return self._shape + + shape = property(fget=get_shape, fset=set_shape) + + def reshape(self,shape): + raise NotImplementedError + + def astype(self, t): + return self.tocsr().astype(t) + + def asfptype(self): + """Upcast matrix to a floating point format (if necessary)""" + + fp_types = ['f','d','F','D'] + + if self.dtype.char in fp_types: + return self + else: + for fp_type in fp_types: + if self.dtype <= numpy.dtype(fp_type): + return self.astype(fp_type) + + raise TypeError,'cannot upcast [%s] to a floating \ + point format' % self.dtype.name + + def __iter__(self): + for r in xrange(self.shape[0]): + yield self[r,:] + + def getmaxprint(self): + try: + maxprint = self.maxprint + except AttributeError: + maxprint = MAXPRINT + return maxprint + + #def typecode(self): + # try: + # typ = self.dtype.char + # except AttributeError: + # typ = None + # return typ + + def getnnz(self): + try: + return self.nnz + except AttributeError: + raise AttributeError, "nnz not defined" + + def getformat(self): + try: + format = self.format + except AttributeError: + format = 'und' + return format + + def rowcol(self, num): + return (None, None) + + def getdata(self, num): + return None + + def listprint(self, start, stop): + """Provides a way to print over a single index. + """ + return '\n'.join([' %s\t%s' % (self.rowcol(ind), self.getdata(ind)) + for ind in xrange(start,stop)]) + '\n' + + def __repr__(self): + nnz = self.getnnz() + format = self.getformat() + return "<%dx%d sparse matrix of type '%s'\n" \ + "\twith %d stored elements in %s format>" % \ + (self.shape + (self.dtype.type, nnz, _formats[format][1])) + + def __str__(self): + nnz = self.getnnz() + maxprint = self.getmaxprint() + val = '' + if nnz > maxprint: + val = val + self.listprint(0, maxprint/2) + val = val + " :\t:\n" + val = val + self.listprint(nnz-maxprint//2, nnz) + else: + val = val + self.listprint(0, nnz) + return val[:-1] + + def __nonzero__(self): # Simple -- other ideas? + return self.getnnz() > 0 + + # What should len(sparse) return? For consistency with dense matrices, + # perhaps it should be the number of rows? But for some uses the number of + # non-zeros is more important. For now, raise an exception! + def __len__(self): + # return self.getnnz() + raise TypeError, "sparse matrix length is ambiguous; use getnnz()" \ + " or shape[0]" + + def asformat(self, format): + """Return this matrix in a given sparse format + + *Parameters*: + format : desired sparse matrix format + If format is None then no conversion is performed + Other possible values include: + "csr" for csr_matrix format + "csc" for csc_matrix format + "dok" for dok_matrix format and so on + """ + + if format is None or format == self.format: + return self + else: + return getattr(self,'to' + format)() + + # default operations use the CSR format as a base + # and operations return in csr format + # thus, a new sparse matrix format just needs to define + # a tocsr method + + def __abs__(self): + return abs(self.tocsr()) + + def __add__(self, other): # self + other + return self.tocsr().__add__(other) + + def __radd__(self, other): # other + self + return self.tocsr().__radd__(other) + + def __sub__(self, other): # self - other + #note: this can't be replaced by self + (-other) for unsigned types + return self.tocsr().__sub__(other) + + def __rsub__(self, other): # other - self + return self.tocsr().__rsub__(other) + + def __mul__(self, other): + return self.tocsr().__mul__(other) + + def __rmul__(self, other): + return self.tocsr().__rmul__(other) + + def __truediv__(self, other): + if isscalarlike(other): + return self * (1./other) + else: + return self.tocsr().__truediv__(other) + + def __div__(self, other): + # Always do true division + return self.__truediv__(other) + + def __pow__(self, other): + csc = self.tocsc() + return csc ** other + + def __neg__(self): + csc = self.tocsc() + return -csc + + def __iadd__(self, other): + raise NotImplementedError + + def __isub__(self, other): + raise NotImplementedError + + def __imul__(self, other): + raise NotImplementedError + + def __idiv__(self, other): + return self.__itruediv__(other) + + def __itruediv__(self, other): + raise NotImplementedError + + def __getattr__(self, attr): + if attr == 'A': + return self.toarray() + elif attr == 'T': + return self.transpose() + elif attr == 'H': + return self.getH() + elif attr == 'real': + return self._real() + elif attr == 'imag': + return self._imag() + elif attr == 'size': + return self.getnnz() + else: + raise AttributeError, attr + " not found" + + def transpose(self): + return self.tocsr().transpose() + + def conj(self): + return self.tocsr().conj() + + def conjugate(self): + return self.tocsr().conj() + + # Renamed conjtranspose() -> getH() for compatibility with dense matrices + def getH(self): + return self.transpose().conj() + + def _real(self): + return self.tocsr()._real() + + def _imag(self): + return self.tocsr()._imag() + + def getcol(self, j): + """Returns a copy of column j of the matrix, as an (m x 1) sparse + matrix (column vector). + """ + # Spmatrix subclasses should override this method for efficiency. + # Post-multiply by a (n x 1) column vector 'a' containing all zeros + # except for a_j = 1 + n = self.shape[1] + a = csc_matrix((n, 1), dtype=self.dtype) + a[j, 0] = 1 + return self * a + + def getrow(self, i): + """Returns a copy of row i of the matrix, as a (1 x n) sparse + matrix (row vector). + """ + # Spmatrix subclasses should override this method for efficiency. + # Pre-multiply by a (1 x m) row vector 'a' containing all zeros + # except for a_i = 1 + m = self.shape[0] + a = csr_matrix((1, m), dtype=self.dtype) + a[0, i] = 1 + return a * self + + def dot(self, other): + """ A generic interface for matrix-matrix or matrix-vector + multiplication. + """ + + try: + other.shape + except AttributeError: + # If it's a list or whatever, treat it like a matrix + other = asmatrix(other) + + if isdense(other) and asarray(other).squeeze().ndim <= 1: + # it's a dense row or column vector + return self.matvec(other) + elif len(other.shape) == 2: + # it's a 2d dense array, dense matrix, or sparse matrix + return self.matmat(other) + else: + raise ValueError, "could not interpret dimensions" + + + def matmat(self, other): + return self.tocsr().matmat(other) + + def matvec(self, other): + """Multiplies the sparse matrix by the vector 'other', returning a + dense vector as a result. + """ + return self.tocsr().matvec(other) + + def rmatvec(self, other, conjugate=True): + """Multiplies the vector 'other' by the sparse matrix, returning a + dense vector as a result. + + If 'conjugate' is True: + returns A.transpose().conj() * other + Otherwise: + returns A.transpose() * other. + """ + return self.tocsr().rmatvec(other, conjugate=conjugate) + + #def rmatmat(self, other, conjugate=True): + # """ If 'conjugate' is True: + # returns other * A.transpose().conj(), + # where 'other' is a matrix. Otherwise: + # returns other * A.transpose(). + # """ + # other = csc_matrix(other) + # if conjugate: + # return other.matmat(self.transpose()).conj() + # else: + # return other.matmat(self.transpose()) + + def todense(self): + return asmatrix(self.toarray()) + + def toarray(self): + csr = self.tocsr() + return csr.toarray() + + def todok(self): + return self.tocoo().todok() + + def tocoo(self): + return self.tocsr().tocoo() + + def tolil(self): + return self.tocsr().tolil() + + def toself(self, copy=False): + if copy: + new = self.copy() + else: + new = self + return new + + def copy(self): + return self.tocsr().copy() + + def sum(self, axis=None): + """Sum the matrix over the given axis. If the axis is None, sum + over both rows and columns, returning a scalar. + """ + # We use multiplication by an array of ones to achieve this. + # For some sparse matrix formats more efficient methods are + # possible -- these should override this function. + m, n = self.shape + if axis == 0: + # sum over columns + return asmatrix(ones((1, m), dtype=self.dtype)) * self + elif axis == 1: + # sum over rows + return self * asmatrix(ones((n, 1), dtype=self.dtype)) + elif axis is None: + # sum over rows and columns + return ( self * asmatrix(ones((n, 1), dtype=self.dtype)) ).sum() + else: + raise ValueError, "axis out of bounds" + + def mean(self, axis=None): + """Average the matrix over the given axis. If the axis is None, + average over both rows and columns, returning a scalar. + """ + if axis == 0: + mean = self.sum(0) + mean *= 1.0 / self.shape[0] + return mean + elif axis == 1: + mean = self.sum(1) + mean *= 1.0 / self.shape[1] + return mean + elif axis is None: + return self.sum(None) * 1.0 / (self.shape[0]*self.shape[1]) + else: + raise ValueError, "axis out of bounds" + + def setdiag(self, values, k=0): + """Fills the diagonal elements {a_ii} with the values from the + given sequence. If k != 0, fills the off-diagonal elements + {a_{i,i+k}} instead. + + values may have any length. If the diagonal is longer than values, + then the remaining diagonal entries will not be set. If values if + longer than the diagonal, then the remaining values are ignored. + """ + M, N = self.shape + if (k > 0 and k >= N) or (k < 0 and -k >= M): + raise ValueError, "k exceedes matrix dimensions" + if k < 0: + max_index = min(M+k, N, len(values)) + for i,v in enumerate(values[:max_index]): + self[i - k, i] = v + else: + max_index = min(M, N-k, len(values)) + for i,v in enumerate(values[:max_index]): + self[i, i + k] = v + + + def save(self, file_name, format = '%d %d %f\n'): + #TODO deprecate, use io.mmwrite or mio instead + + try: + fd = open(file_name, 'w') + except Exception, e: + raise e, file_name + + fd.write('%d %d\n' % self.shape) + fd.write('%d\n' % self.size) + for ii in xrange(self.size): + ir, ic = self.rowcol(ii) + data = self.getdata(ii) + fd.write(format % (ir, ic, data)) + fd.close() + + +from sputils import _isinstance + +def isspmatrix(x): + return _isinstance(x, spmatrix) + +issparse = isspmatrix + Added: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-13 22:51:45 UTC (rev 3642) +++ trunk/scipy/sparse/compressed.py 2007-12-14 02:58:33 UTC (rev 3643) @@ -0,0 +1,951 @@ +"""Sparse matrix classes using compressed storage +""" + + +__all__ = ['csr_matrix', 'csc_matrix', 'isspmatrix_csr', 'isspmatrix_csc' ] + +import numpy +from numpy import array, matrix, asarray, asmatrix, zeros, rank, intc, \ + empty, hstack, isscalar, ndarray, shape, searchsorted + +from base import spmatrix,isspmatrix +import sparsetools +from sparsetools import csrtodense, cootocsr, cootocsc, csctocsr, csrtocsc +from sputils import upcast, to_native, isdense, isshape, getdtype, \ + isscalarlike + + + +def resize1d(arr, newlen): + old = len(arr) + new = zeros((newlen,), arr.dtype) + new[:old] = arr + return new + + + + +class _cs_matrix(spmatrix): + """base matrix class for compressed row and column oriented matrices""" + + def __init__(self, arg1, dims=None, dtype=None, copy=False): + spmatrix.__init__(self) + + if isdense(arg1): + # Convert the dense array or matrix arg1 to sparse format + if rank(arg1) == 1: + # Convert to a row vector + arg1 = arg1.reshape(1, arg1.shape[0]) + if rank(arg1) == 2: + from coo import coo_matrix + self.shape = arg1.shape + self._set_self( self._tothis(coo_matrix(arg1)) ) + else: + raise ValueError, "dense array must have rank 1 or 2" + + elif isspmatrix(arg1): + if copy: + arg1 = arg1.copy() + self._set_self( self._tothis(arg1) ) + + elif isinstance(arg1, tuple): + if isshape(arg1): + # It's a tuple of matrix dimensions (M, N) + # create empty matrix + self.shape = arg1 #spmatrix checks for errors here + M, N = self.shape + self.data = zeros(0, getdtype(dtype, default=float)) + self.indices = zeros(0, intc) + self.indptr = zeros(self._swap(self.shape)[0] + 1, dtype='intc') + else: + try: + # Try interpreting it as (data, ij) + (data, ij) = arg1 + assert isinstance(ij, ndarray) and (rank(ij) == 2) \ + and (shape(ij) == (2, len(data))) + except (AssertionError, TypeError, ValueError, AttributeError): + try: + # Try interpreting it as (data, indices, indptr) + (data, indices, indptr) = arg1 + except: + raise ValueError, "unrecognized form for csr_matrix constructor" + else: + self.data = array(data, copy=copy, dtype=getdtype(dtype, data)) + self.indices = array(indices, copy=copy) + self.indptr = array(indptr, copy=copy) + else: + # (data, ij) format + from coo import coo_matrix + other = coo_matrix((data, ij), dims=dims ) + other = self._tothis(other) + self._set_self( other ) + + else: + raise ValueError, "unrecognized form for csr_matrix constructor" + + # Read matrix dimensions given, if any + if dims is not None: + self.shape = dims # spmatrix will check for errors + else: + if self.shape is None: + # shape not already set, try to infer dimensions + try: + major_dim = len(self.indptr) - 1 + minor_dim = self.indices.max() + 1 + except: + raise ValueError,'unable to infer matrix dimensions' + else: + self.shape = self._swap((major_dim,minor_dim)) + + self.check_format(full_check=False) + + def getnnz(self): + return self.indptr[-1] + nnz = property(fget=getnnz) + + def _get_dtype(self): + return self.data.dtype + def _set_dtype(self,newtype): + self.data.dtype = newtype + dtype = property(fget=_get_dtype,fset=_set_dtype) + + def _set_self(self, other, copy=False): + """take the member variables of other and assign them to self""" + + if copy: + other = other.copy() + + self.data = other.data + self.indices = other.indices + self.indptr = other.indptr + self.shape = other.shape + + def _check_format(self, full_check): + self.shape = tuple([int(x) for x in self.shape]) # for floats etc. + + #use _swap to determine proper bounds + major_name,minor_name = self._swap(('row','column')) + major_dim,minor_dim = self._swap(self.shape) + + # index arrays should have integer data types + if self.indptr.dtype.kind != 'i': + warnings.warn("indptr array has non-integer dtype (%s)" \ + % self.indptr.dtype.name ) + if self.indices.dtype.kind != 'i': + warnings.warn("indices array has non-integer dtype (%s)" \ + % self.indices.dtype.name ) + + # only support 32-bit ints for now + self.indptr = self.indptr.astype('intc') + self.indices = self.indices.astype('intc') + self.data = to_native(self.data) + + # check array shapes + if (rank(self.data) != 1) or (rank(self.indices) != 1) or \ + (rank(self.indptr) != 1): + raise ValueError,"data, indices, and indptr should be rank 1" + + # check index pointer + if (len(self.indptr) != major_dim + 1 ): + raise ValueError, \ + "index pointer size (%d) should be (%d)" % \ + (len(self.indptr), major_dim + 1) + if (self.indptr[0] != 0): + raise ValueError,"index pointer should start with 0" + + # check index and data arrays + if (len(self.indices) != len(self.data)): + raise ValueError,"indices and data should have the same size" + if (self.indptr[-1] > len(self.indices)): + raise ValueError, \ + "Last value of index pointer should be less than "\ + "the size of index and data arrays" + + self.prune() + + if full_check: + #check format validity (more expensive) + if self.nnz > 0: + if amax(self.indices) >= minor_dim: + raise ValueError, "%s index values must be < %d" % \ + (minor_name,minor_dim) + if amin(self.indices) < 0: + raise ValueError, "%s index values must be >= 0" % \ + minor_name + if numpy.diff(self.indptr).min() < 0: + raise ValueError,'index pointer values must form a " \ + "non-decreasing sequence' + + def astype(self, t): + return self._with_data(self.data.astype(t)) + + def _with_data(self,data,copy=True): + """Returns a matrix with the same sparsity structure as self, + but with different data. By default the structure arrays + (i.e. .indptr and .indices) are copied. + """ + if copy: + return self.__class__((data,self.indices.copy(),self.indptr.copy()), \ + dims=self.shape,dtype=data.dtype) + else: + return self.__class__((data,self.indices,self.indptr), \ + dims=self.shape,dtype=data.dtype) + + def __abs__(self): + return self._with_data(abs(self.data)) + + def _real(self): + return self._with_data(numpy.real(self.data)) + + def _imag(self): + return self._with_data(numpy.imag(self.data)) + + def _binopt(self, other, op, in_shape=None, out_shape=None): + """apply the binary operation fn to two sparse matrices""" + other = self._tothis(other) + + if in_shape is None: + in_shape = self.shape + if out_shape is None: + out_shape = self.shape + + # e.g. csr_plus_csr, cscmucsc, etc. + fn = getattr(sparsetools, self.format + op + self.format) + + indptr, ind, data = fn(in_shape[0], in_shape[1], \ + self.indptr, self.indices, self.data, + other.indptr, other.indices, other.data) + return self.__class__((data, ind, indptr), dims=out_shape) + + + def __add__(self,other): + # First check if argument is a scalar + if isscalarlike(other): + # Now we would add this scalar to every element. + raise NotImplementedError, 'adding a scalar to a CSC or CSR ' \ + 'matrix is not supported' + elif isspmatrix(other): + if (other.shape != self.shape): + raise ValueError, "inconsistent shapes" + + return self._binopt(other,'_plus_') + elif isdense(other): + # Convert this matrix to a dense matrix and add them + return self.todense() + other + else: + raise NotImplementedError + + def __radd__(self,other): + return self.__add__(other) + + def __sub__(self,other): + # First check if argument is a scalar + if isscalarlike(other): + # Now we would add this scalar to every element. + raise NotImplementedError, 'adding a scalar to a CSC or CSR ' \ + 'matrix is not supported' + elif isspmatrix(other): + if (other.shape != self.shape): + raise ValueError, "inconsistent shapes" + + return self._binopt(other,'_minus_') + elif isdense(other): + # Convert this matrix to a dense matrix and subtract them + return self.todense() - other + else: + raise NotImplementedError + + def __rsub__(self,other): # other - self + #note: this can't be replaced by other + (-self) for unsigned types + if isscalarlike(other): + # Now we would add this scalar to every element. + raise NotImplementedError, 'adding a scalar to a CSC or CSR ' \ + 'matrix is not supported' + elif isdense(other): + # Convert this matrix to a dense matrix and subtract them + return other - self.todense() + else: + raise NotImplementedError + + + def __mul__(self, other): # self * other + """ Scalar, vector, or matrix multiplication + """ + if isscalarlike(other): + return self._with_data(self.data * other) + else: + return self.dot(other) + + + def __rmul__(self, other): # other * self + if isscalarlike(other): + return self.__mul__(other) + else: + # Don't use asarray unless we have to + try: + tr = other.transpose() + except AttributeError: + tr = asarray(other).transpose() + return self.transpose().dot(tr).transpose() + + def __imul__(self, other): #self *= other + if isscalarlike(other): + self.data *= other + return self + else: + raise NotImplementedError + + def __neg__(self): + return self._with_data(-self.data) + + def __truediv__(self,other): + if isscalarlike(other): + return self * (1./other) + elif isspmatrix(other): + if (other.shape != self.shape): + raise ValueError, "inconsistent shapes" + + return self._binopt(other,'_eldiv_') + else: + raise NotImplementedError + + def __itruediv__(self, other): #self *= other + if isscalarlike(other): + recip = 1.0 / other + self.data *= recip + return self + else: + raise NotImplementedError + + def __pow__(self, other): + """ Element-by-element power (unless other is a scalar, in which + case return the matrix power.) + """ + if isscalarlike(other): + return self._with_data(self.data**other) + elif isspmatrix(other): + if (other.shape != self.shape): + raise ValueError, "inconsistent shapes" + + return self._binopt(other,'_elmul_') + else: + raise NotImplementedError + + + def matmat(self, other): + if isspmatrix(other): + M, K1 = self.shape + K2, N = other.shape + if (K1 != K2): + raise ValueError, "shape mismatch error" + other = self._tothis(other) + + return self._binopt(other,'mu',in_shape=(M,N),out_shape=(M,N)) + elif isdense(other): + # TODO make sparse * dense matrix multiplication more efficient + + # matvec each column of other + return hstack( [ self * col.reshape(-1,1) for col in other.T ] ) + else: + raise TypeError, "need a dense or sparse matrix" + + def matvec(self, other): + if isdense(other): + if other.size != self.shape[1] or \ + (other.ndim == 2 and self.shape[1] != other.shape[0]): + raise ValueError, "dimension mismatch" + + # csrmux, cscmux + fn = getattr(sparsetools,self.format + 'mux') + + #output array + y = empty( self.shape[0], dtype=upcast(self.dtype,other.dtype) ) + + fn(self.shape[0], self.shape[1], \ + self.indptr, self.indices, self.data, numpy.ravel(other), y) + + if isinstance(other, matrix): + y = asmatrix(y) + + if other.ndim == 2 and other.shape[1] == 1: + # If 'other' was an (nx1) column vector, reshape the result + y = y.reshape(-1,1) + + return y + + elif isspmatrix(other): + raise TypeError, "use matmat() for sparse * sparse" + + else: + raise TypeError, "need a dense vector" + + def rmatvec(self, other, conjugate=True): + if conjugate: + return self.transpose().conj() * other + else: + return self.transpose() * other + + def getdata(self, ind): + return self.data[ind] + +# def _other_format(self): +# if self.format == 'csr': +# return 'csc' +# elif self.format == 'csc': +# return 'csr' +# else: +# raise TypeError,'unrecognized type' +# +# def _other__class__(self): +# if self.format == 'csr': +# return csc_matrix +# elif self.format == 'csc': +# return csr_matrix +# else: +# raise TypeError,'unrecognized type' + + + + def sum(self, axis=None): + """Sum the matrix over the given axis. If the axis is None, sum + over both rows and columns, returning a scalar. + """ + # The spmatrix base class already does axis=0 and axis=1 efficiently + # so we only do the case axis=None here + if axis is None: + return self.data[:self.indptr[-1]].sum() + else: + return spmatrix.sum(self,axis) + raise ValueError, "axis out of bounds" + + + def copy(self): + return self._with_data(self.data.copy(),copy=True) + + def _get_slice(self, i, start, stop, stride, dims): + """Returns a view of the elements [i, myslice.start:myslice.stop]. + """ + if stride != 1: + raise ValueError, "slicing with step != 1 not supported" + if stop <= start: + raise ValueError, "slice width must be >= 1" + + indices = [] + + for ind in xrange(self.indptr[i], self.indptr[i+1]): + if self.indices[ind] >= start and self.indices[ind] < stop: + indices.append(ind) + + index = self.indices[indices] - start + data = self.data[indices] + indptr = numpy.array([0, len(indices)]) + return self.__class__((data, index, indptr), dims=dims, \ + dtype=self.dtype) + + + def _transpose(self, cls, copy=False): + M, N = self.shape + return cls((self.data,self.indices,self.indptr),(N,M),copy=copy) + + def tocoo(self,copy=True): + """Return a COOrdinate representation of this matrix + + When copy=False the index and data arrays are not copied. + """ + major_dim,minor_dim = self._swap(self.shape) + + data = self.data + minor_indices = self.indices + + if copy: + data = data.copy() + minor_indices = minor_indices.copy() + + major_indices = empty(len(minor_indices),dtype=intc) + + sparsetools.expandptr(major_dim,self.indptr,major_indices) + + row,col = self._swap((major_indices,minor_indices)) + + from coo import coo_matrix + return coo_matrix((data,(row,col)), self.shape) + + def conj(self, copy=False): + return self._with_data(self.data.conj(),copy=copy) + + def sorted_indices(self): + """Return a copy of this matrix with sorted indices + """ + A = self.copy() + A.sort_indices() + return A + + # an alternative that has linear complexity is the following + # typically the previous option is faster + #return self._toother()._toother() + + def sort_indices(self): + """Sort the indices of this matrix *in place* + """ + fn = getattr(sparsetools,'sort_' + self.format + '_indices') + + M,N = self.shape + fn( M, N, self.indptr, self.indices, self.data) + + def ensure_sorted_indices(self, inplace=False): + """Return a copy of this matrix where the column indices are sorted + """ + warnings.warn('ensure_sorted_indices is deprecated, ' \ + 'use sorted_indices() or sort_indices() instead', \ + DeprecationWarning) + + if inplace: + self.sort_indices() + else: + return self.sorted_indices() + + def prune(self): + """ Remove empty space after all non-zero elements. + """ + major_dim = self._swap(self.shape)[0] + + if len(self.indptr) != major_dim + 1: + raise ValueError, "index pointer has invalid length" + if len(self.indices) < self.nnz: + raise ValueError, "indices array has fewer than nnz elements" + if len(self.data) < self.nnz: + raise ValueError, "data array has fewer than nnz elements" + + self.data = self.data[:self.nnz] + self.indices = self.indices[:self.nnz] + + def _get_submatrix( self, shape0, shape1, slice0, slice1 ): + """Return a submatrix of this matrix (new matrix is created).""" + def _process_slice( sl, num ): + if isinstance( sl, slice ): + i0, i1 = sl.start, sl.stop + if i0 is None: + i0 = 0 + elif i0 < 0: + i0 = num + i0 + + if i1 is None: + i1 = num + elif i1 < 0: + i1 = num + i1 + + return i0, i1 + + elif isscalar( sl ): + if sl < 0: + sl += num + + return sl, sl + 1 + + else: + return sl[0], sl[1] + + def _in_bounds( i0, i1, num ): + if not (0<=i0= N): + self.indptr = resize1d(self.indptr, col+2) + self.indptr[N+1:] = self.indptr[N] + N = col+1 + if (row >= M): + M = row+1 + self.shape = (M, N) + + indxs = numpy.where(row == self.indices[self.indptr[col]:self.indptr[col+1]]) + + if len(indxs[0]) == 0: + #value not present + #TODO handle this with concatenation + self.data = resize1d(self.data, self.nnz + 1) + self.indices = resize1d(self.indices, self.nnz + 1) + + newindex = self.indptr[col] + self.data[newindex+1:] = self.data[newindex:-1] + self.indices[newindex+1:] = self.indices[newindex:-1] + + self.data[newindex] = val + self.indices[newindex] = row + self.indptr[col+1:] += 1 + + elif len(indxs[0]) == 1: + #value already present + self.data[self.indptr[col]:self.indptr[col+1]][indxs[0]] = val + else: + raise IndexError, "row index occurs more than once" + + self.check_format(full_check=False) + else: + # We should allow slices here! + raise IndexError, "invalid index" + + def _getslice(self, i, myslice): + return self._getcolslice(i, myslice) + + def _getcolslice(self, myslice, j): + """Returns a view of the elements [myslice.start:myslice.stop, j]. + """ + start, stop, stride = myslice.indices(self.shape[0]) + return _cs_matrix._get_slice(self, j, start, stop, stride, (stop - start, 1)) + + def rowcol(self, ind): + row = self.indices[ind] + col = searchsorted(self.indptr, ind+1)-1 + return (row, col) + + + def tocsc(self, copy=False): + return self.toself(copy) + + def tocsr(self): + indptr = empty(self.shape[0] + 1, dtype=intc) + indices = empty(self.nnz, dtype=intc) + data = empty(self.nnz, dtype=upcast(self.dtype)) + + csctocsr(self.shape[0], self.shape[1], \ + self.indptr, self.indices, self.data, \ + indptr, indices, data) + + return csr_matrix((data, indices, indptr), self.shape) + + def toarray(self): + return self.tocsr().toarray() + + def get_submatrix( self, slice0, slice1 ): + """Return a submatrix of this matrix (new matrix is created). + Rows and columns can be selected using slice instances, tuples, + or scalars.""" + aux = _cs_matrix._get_submatrix( self, self.shape[1], self.shape[0], + slice1, slice0 ) + nr, nc = aux[3:] + return self.__class__( aux[:3], dims = (nc, nr) ) + + # these functions are used by the parent class (_cs_matrix) + # to remove redudancy between csc_matrix and csr_matrix + def _swap(self,x): + """swap the members of x if this is a column-oriented matrix + """ + return (x[1],x[0]) + + def _toother(self): + return self.tocsr() + + def _tothis(self, other): + return other.tocsc() + +class csr_matrix(_cs_matrix): + """ Compressed sparse row matrix + This can be instantiated in several ways: + - csr_matrix(d) + with a dense matrix d + + - csr_matrix(s) + with another sparse matrix s (sugar for .tocsr()) + + - csr_matrix((M, N), [dtype]) + to construct a container, where (M, N) are dimensions and + dtype is optional, defaulting to dtype='d'. + + - csr_matrix((data, ij), [dims=(M, N)]) + where data, ij satisfy: + a[ij[0, k], ij[1, k]] = data[k] + + - csr_matrix((data, col, ptr), [dims=(M, N)]) + standard CSR representation + """ + + def check_format(self,full_check=True): + """check whether matrix is in valid CSR format + + *Parameters*: + full_check: + True - perform rigorous checking - default + False - perform basic format check + + """ + _cs_matrix._check_format(self,full_check) + + def __getattr__(self, attr): + if attr == 'colind': + warnings.warn("colind attribute no longer in use. Use .indices instead", + DeprecationWarning) + return self.indices + else: + return _cs_matrix.__getattr__(self, attr) + + def transpose(self, copy=False): + return _cs_matrix._transpose(self, csc_matrix, copy) + + def __getitem__(self, key): + if isinstance(key, tuple): + #TODO use _swap() to unify this in _cs_matrix + row = key[0] + col = key[1] + if isinstance(row, slice): + # Returns a new matrix! + return self.get_submatrix( row, col ) + elif isinstance(col, slice): + return self._getslice(row, col) + M, N = self.shape + if (row < 0): + row = M + row + if (col < 0): + col = N + col + if not (0<=row= M): + self.indptr = resize1d(self.indptr, row+2) + self.indptr[M+1:] = self.indptr[M] + M = row+1 + if (col >= N): + N = col+1 + self.shape = (M, N) + + indxs = numpy.where(col == self.indices[self.indptr[row]:self.indptr[row+1]]) + if len(indxs[0]) == 0: + #value not present + self.data = resize1d(self.data, self.nnz + 1) + self.indices = resize1d(self.indices, self.nnz + 1) + + newindex = self.indptr[row] + self.data[newindex+1:] = self.data[newindex:-1] + self.indices[newindex+1:] = self.indices[newindex:-1] + + self.data[newindex] = val + self.indices[newindex] = col + self.indptr[row+1:] += 1 + + elif len(indxs[0]) == 1: + #value already present + self.data[self.indptr[row]:self.indptr[row+1]][indxs[0]] = val + else: + raise IndexError, "row index occurs more than once" + + self.check_format(full_check=False) + else: + # We should allow slices here! + raise IndexError, "invalid index" + + def rowcol(self, ind): + col = self.indices[ind] + row = searchsorted(self.indptr, ind+1)-1 + return (row, col) + + + def tolil(self): + from lil import lil_matrix + lil = lil_matrix(self.shape,dtype=self.dtype) + + csr = self.sorted_indices() #lil_matrix needs sorted rows + + rows,data = lil.rows,lil.data + ptr,ind,dat = csr.indptr,csr.indices,csr.data + + for n in xrange(self.shape[0]): + start = ptr[n] + end = ptr[n+1] + rows[n] = ind[start:end].tolist() + data[n] = dat[start:end].tolist() + + return lil + + def tocsr(self, copy=False): + return self.toself(copy) + + def tocsc(self): + indptr = empty(self.shape[1] + 1, dtype=intc) + indices = empty(self.nnz, dtype=intc) + data = empty(self.nnz, dtype=upcast(self.dtype)) + + csrtocsc(self.shape[0], self.shape[1], \ + self.indptr, self.indices, self.data, \ + indptr, indices, data) + + return csc_matrix((data, indices, indptr), self.shape) + + def toarray(self): + data = numpy.zeros(self.shape, dtype=upcast(self.data.dtype)) + csrtodense(self.shape[0], self.shape[1], self.indptr, self.indices, + self.data, data) + return data + + def get_submatrix( self, slice0, slice1 ): + """Return a submatrix of this matrix (new matrix is created).. + Rows and columns can be selected using slice instances, tuples, + or scalars.""" + aux = _cs_matrix._get_submatrix( self, self.shape[0], self.shape[1], + slice0, slice1 ) + nr, nc = aux[3:] + return self.__class__( aux[:3], dims = (nr, nc) ) + + # these functions are used by the parent class (_cs_matrix) + # to remove redudancy between csc_matrix and csr_matrix + def _swap(self,x): + """swap the members of x if this is a column-oriented matrix + """ + return (x[0],x[1]) + + def _toother(self): + return self.tocsc() + + def _tothis(self, other): + return other.tocsr() + + +from sputils import _isinstance + +def isspmatrix_csr(x): + return _isinstance(x, csr_matrix) + +def isspmatrix_csc(x): + return _isinstance(x, csc_matrix) + + Modified: trunk/scipy/sparse/construct.py =================================================================== --- trunk/scipy/sparse/construct.py 2007-12-13 22:51:45 UTC (rev 3642) +++ trunk/scipy/sparse/construct.py 2007-12-14 02:58:33 UTC (rev 3643) @@ -10,12 +10,14 @@ import numpy from numpy import ones, clip, array, arange, intc -from sparse import csr_matrix, csc_matrix, coo_matrix, \ - dok_matrix, lil_matrix -from sparse import isspmatrix, isspmatrix_csr, isspmatrix_csc +from compressed import csr_matrix, csc_matrix, isspmatrix_csr, isspmatrix_csc +from coo import coo_matrix +from dok import dok_matrix +from lil import lil_matrix +from base import isspmatrix + import sparsetools - def spdiags(diags, offsets, m, n, format=None): """Return a sparse matrix given its diagonals. Added: trunk/scipy/sparse/coo.py =================================================================== --- trunk/scipy/sparse/coo.py 2007-12-13 22:51:45 UTC (rev 3642) +++ trunk/scipy/sparse/coo.py 2007-12-14 02:58:33 UTC (rev 3643) @@ -0,0 +1,204 @@ +""" A sparse matrix in COOrdinate format """ + +__all__ = ['coo_matrix', 'isspmatrix_coo'] + +from itertools import izip + +from numpy import array, asarray, empty, intc + +from sparsetools import cootocsr, cootocsc +from base import spmatrix +from sputils import upcast, to_native, isshape, getdtype + +class coo_matrix(spmatrix): + """ A sparse matrix in coordinate list format. + + COO matrices are created either as: + A = coo_matrix( (m, n), [dtype]) + for a zero matrix, or as: + A = coo_matrix(M) + where M is a dense matrix or rank 2 ndarray, or as: + A = coo_matrix((obj, ij), [dims]) + where the dimensions are optional. If supplied, we set (M, N) = dims. + If not supplied, we infer these from the index arrays: + ij[0][:] and ij[1][:] + + The arguments 'obj' and 'ij' represent three arrays: + 1. obj[:] the entries of the matrix, in any order + 2. ij[0][:] the row indices of the matrix entries + 3. ij[1][:] the column indices of the matrix entries + + So the following holds: + A[ij[0][k], ij[1][k] = obj[k] + + Note: + When converting to CSR or CSC format, duplicate (i,j) entries + will be summed together. This facilitates efficient construction + of finite element matrices and the like. + + """ + def __init__(self, arg1, dims=None, dtype=None): + spmatrix.__init__(self) + if isinstance(arg1, tuple): + if isshape(arg1): + M, N = arg1 + self.shape = (M,N) + self.row = array([], dtype=intc) + self.col = array([], dtype=intc) + self.data = array([], getdtype(dtype, default=float)) + else: + try: + obj, ij = arg1 + except: + raise TypeError, "invalid input format" + + try: + if len(ij) != 2: + raise TypeError + except TypeError: + raise TypeError, "invalid input format" + + self.row = asarray(ij[0]) + self.col = asarray(ij[1]) + self.data = asarray(obj) + + if dims is None: + if len(self.row) == 0 or len(self.col) == 0: + raise ValueError, "cannot infer dimensions from zero sized index arrays" + M = self.row.max() + 1 + N = self.col.max() + 1 + self.shape = (M, N) + else: + # Use 2 steps to ensure dims has length 2. + M, N = dims + self.shape = (M, N) + + elif arg1 is None: + # Initialize an empty matrix. + if not isinstance(dims, tuple) or not isintlike(dims[0]): + raise TypeError, "dimensions not understood" + warnings.warn('coo_matrix(None, dims=(M,N)) is deprecated, ' \ + 'use coo_matrix( (M,N) ) instead', \ + DeprecationWarning) + self.shape = dims + self.data = array([],getdtype(dtype, default=float)) + self.row = array([],dtype=intc) + self.col = array([],dtype=intc) + else: + #dense argument + try: + M = asarray(arg1) + except: + raise TypeError, "invalid input format" + + if len(M.shape) != 2: + raise TypeError, "expected rank 2 array or matrix" + self.shape = M.shape + self.row,self.col = (M != 0).nonzero() + self.data = M[self.row,self.col] + + self._check() + + def _get_dtype(self): + return self.data.dtype + def _set_dtype(self,newtype): + self.data.dtype = newtype + dtype = property(fget=_get_dtype,fset=_set_dtype) + + def _check(self): + """ Checks for consistency and stores the number of non-zeros as + self.nnz. + """ + nnz = len(self.data) + if (nnz != len(self.row)) or (nnz != len(self.col)): + raise ValueError, "row, column, and data array must all be "\ + "the same length" + + # index arrays should have integer data types + if self.row.dtype.kind != 'i': + warnings.warn("row index array has non-integer dtype (%s) " \ + % self.row.dtype.name ) + if self.col.dtype.kind != 'i': + warnings.warn("col index array has non-integer dtype (%s) " \ + % self.col.dtype.name ) + + # only support 32-bit ints for now + self.row = self.row.astype('intc') + self.col = self.col.astype('intc') + self.data = to_native(self.data) + + if nnz > 0: + if(self.row.max() >= self.shape[0]): + raise ValueError, "row index exceedes matrix dimensions" + if(self.col.max() >= self.shape[1]): + raise ValueError, "column index exceedes matrix dimensions" + if(self.row.min() < 0): + raise ValueError, "negative row index found" + if(self.col.min() < 0): + raise ValueError, "negative column index found" + + # some functions pass floats + self.shape = tuple([int(x) for x in self.shape]) + self.nnz = nnz + + + def rowcol(self, num): + return (self.row[num], self.col[num]) + + def getdata(self, num): + return self.data[num] + + def tocsc(self): + from compressed import csc_matrix + if self.nnz == 0: + return csc_matrix(self.shape, dtype=self.dtype) + else: + indptr = empty(self.shape[1] + 1,dtype=intc) + indices = empty(self.nnz, dtype=intc) + data = empty(self.nnz, dtype=upcast(self.dtype)) + + cootocsc(self.shape[0], self.shape[1], self.nnz, \ + self.row, self.col, self.data, \ + indptr, indices, data) + + return csc_matrix((data, indices, indptr), self.shape) + + def tocsr(self): + from compressed import csr_matrix + if self.nnz == 0: + return csr_matrix(self.shape, dtype=self.dtype) + else: + indptr = empty(self.shape[0] + 1,dtype=intc) + indices = empty(self.nnz, dtype=intc) + data = empty(self.nnz, dtype=upcast(self.dtype)) + + cootocsr(self.shape[0], self.shape[1], self.nnz, \ + self.row, self.col, self.data, \ + indptr, indices, data) + + return csr_matrix((data, indices, indptr), self.shape) + + def tocoo(self, copy=False): + return self.toself(copy) + + def todok(self): + from dok import dok_matrix + + dok = dok_matrix((self.shape),dtype=self.dtype) + + try: + dok.update( izip(izip(self.row,self.col),self.data) ) + except AttributeError: + # the dict() call is for Python 2.3 compatibility + # ideally dok_matrix would accept an iterator + dok.update( dict( izip(izip(self.row,self.col),self.data) ) ) + + return dok + + + +from sputils import _isinstance + +def isspmatrix_coo( x ): + return _isinstance(x, coo_matrix) + Added: trunk/scipy/sparse/dok.py =================================================================== --- trunk/scipy/sparse/dok.py 2007-12-13 22:51:45 UTC (rev 3642) +++ trunk/scipy/sparse/dok.py 2007-12-14 02:58:33 UTC (rev 3643) @@ -0,0 +1,579 @@ +"""Dictionary Of Keys based matrix""" + +__all__ = ['dok_matrix', 'isspmatrix_dok'] + +import operator +from itertools import izip + +from numpy import asarray, asmatrix, intc, isscalar, array, matrix + +from base import spmatrix,isspmatrix +from sputils import isdense, getdtype, isshape, isintlike, isscalarlike + +class dok_matrix(spmatrix, dict): + """Dictionary Of Keys based matrix. This is an efficient + structure for constructing sparse matrices + """ + def __init__(self, A=None, shape=None, dtype=None, copy=False): + """ Create a new dictionary-of-keys sparse matrix. An optional + argument A is accepted, which initializes the dok_matrix with it. + This can be a tuple of dimensions (M, N) or a (dense) array + to copy. + """ + dict.__init__(self) + spmatrix.__init__(self,shape) + self.dtype = getdtype(dtype, A, default=float) + if A is not None: + if isinstance(A, tuple): + # Interpret as dimensions + if not isshape(A): + raise TypeError, "dimensions must be a 2-tuple of positive"\ + " integers" + self.shape = A + elif isspmatrix(A): + if isspmatrix_dok(A) and copy: + A = A.copy() + else: + A = A.todok() + self.update( A ) + self.shape = A.shape + self.dtype = A.dtype + elif isdense(A): + from coo import coo_matrix + self.update( coo_matrix(A).todok() ) + self.shape = A.shape + self.dtype = A.dtype + else: + raise TypeError, "argument should be a tuple of dimensions " \ + "or a sparse or dense matrix" + + def getnnz(self): + return dict.__len__(self) + + def __len__(self): + return dict.__len__(self) + + def __str__(self): + val = '' + nnz = self.getnnz() + keys = self.keys() + keys.sort() + if nnz > self.maxprint: + for k in xrange(self.maxprint / 2): + key = keys[k] + val += " %s\t%s\n" % (str(key), str(self[key])) + val = val + " : \t :\n" + for k in xrange(nnz-self.maxprint/2, nnz): + key = keys[k] + val += " %s\t%s\n" % (str(key), str(self[key])) + else: + for k in xrange(nnz): + key = keys[k] + val += " %s\t%s\n" % (str(key), str(self[key])) + return val[:-1] + + def get(self, key, default=0.): + """This overrides the dict.get method, providing type checking + but otherwise equivalent functionality. + """ + try: + i, j = key + assert isintlike(i) and isintlike(j) + except (AssertionError, TypeError, ValueError): + raise IndexError, "index must be a pair of integers" + try: + assert not (i < 0 or i >= self.shape[0] or j < 0 or + j >= self.shape[1]) + except AssertionError: + raise IndexError, "index out of bounds" + return dict.get(self, key, default) + + def __getitem__(self, key): + """If key=(i,j) is a pair of integers, return the corresponding + element. If either i or j is a slice or sequence, return a new sparse + matrix with just these elements. + """ + try: + i, j = key + except (ValueError, TypeError): + raise TypeError, "index must be a pair of integers or slices" + + + # Bounds checking + if isintlike(i): + if i < 0: + i += self.shape[0] + if i < 0 or i >= self.shape[0]: + raise IndexError, "index out of bounds" + if isintlike(j): + if j < 0: + j += self.shape[1] + if j < 0 or j >= self.shape[1]: + raise IndexError, "index out of bounds" + + # First deal with the case where both i and j are integers + if isintlike(i) and isintlike(j): + return dict.get(self, key, 0.) + else: + # Either i or j is a slice, sequence, or invalid. If i is a slice + # or sequence, unfold it first and call __getitem__ recursively. + + if isinstance(i, slice): + # Is there an easier way to do this? + seq = xrange(i.start or 0, i.stop or self.shape[0], i.step or 1) + elif operator.isSequenceType(i): + seq = i + else: + # Make sure i is an integer. (But allow it to be a subclass of int). + if not isintlike(i): + raise TypeError, "index must be a pair of integers or slices" + seq = None + if seq is not None: + # i is a seq + if isintlike(j): + # Create a new matrix of the correct dimensions + first = seq[0] + last = seq[-1] + if first < 0 or first >= self.shape[0] or last < 0 \ + or last >= self.shape[0]: + raise IndexError, "index out of bounds" + newshape = (last-first+1, 1) + new = dok_matrix(newshape) + # ** This uses linear time in the size m of dimension 0: + # new[0:seq[-1]-seq[0]+1, 0] = \ + # [self.get((element, j), 0) for element in seq] + # ** Instead just add the non-zero elements. This uses + # ** linear time in the number of non-zeros: + for (ii, jj) in self.keys(): + if jj == j and ii >= first and ii <= last: + dict.__setitem__(new, (ii-first, 0), \ + dict.__getitem__(self, (ii,jj))) + else: + ################################### + # We should reshape the new matrix here! + ################################### + raise NotImplementedError, "fancy indexing supported over" \ + " one axis only" + return new + + # Below here, j is a sequence, but i is an integer + if isinstance(j, slice): + # Is there an easier way to do this? + seq = xrange(j.start or 0, j.stop or self.shape[1], j.step or 1) + elif operator.isSequenceType(j): + seq = j + else: + # j is not an integer + raise TypeError, "index must be a pair of integers or slices" + + # Create a new matrix of the correct dimensions + first = seq[0] + last = seq[-1] + if first < 0 or first >= self.shape[1] or last < 0 \ + or last >= self.shape[1]: + raise IndexError, "index out of bounds" + newshape = (1, last-first+1) + new = dok_matrix(newshape) + # ** This uses linear time in the size n of dimension 1: + # new[0, 0:seq[-1]-seq[0]+1] = \ + # [self.get((i, element), 0) for element in seq] + # ** Instead loop over the non-zero elements. This is slower + # ** if there are many non-zeros + for (ii, jj) in self.keys(): + if ii == i and jj >= first and jj <= last: + dict.__setitem__(new, (0, jj-first), \ + dict.__getitem__(self, (ii,jj))) + return new + + + def __setitem__(self, key, value): + try: + assert len(key) == 2 + except (AssertionError, TypeError): + raise TypeError, "index must be a pair of integers, slices, or" \ + " sequences" + i, j = key + + + # First deal with the case where both i and j are integers + if isintlike(i) and isintlike(j): + if i < 0: + i += self.shape[0] + if j < 0: + j += self.shape[1] + + if i < 0 or i >= self.shape[0] or j < 0 or j >= self.shape[1]: + raise IndexError, "index out of bounds" + if isintlike(value) and value == 0: + if key in self.keys(): # get rid of it something already there + del self[key] + else: + # Ensure value is a single element, not a sequence + if isinstance(value, float) or isintlike(value) or \ + isinstance(value, complex): + dict.__setitem__(self, key, self.dtype.type(value)) + newrows = max(self.shape[0], int(key[0])+1) + newcols = max(self.shape[1], int(key[1])+1) + self.shape = (newrows, newcols) + else: + raise TypeError, "cannot set matrix element to non-scalar" + return # done + else: + # Either i or j is a slice, sequence, or invalid. If i is a slice + # or sequence, unfold it first and call __setitem__ recursively. + if isinstance(i, slice): + # Is there an easier way to do this? + seq = xrange(i.start or 0, i.stop or self.shape[0], i.step or 1) + elif operator.isSequenceType(i): + seq = i + else: + # Make sure i is an integer. (But allow it to be a subclass of int). + if not isintlike(i): + raise TypeError, "index must be a pair of integers or slices" + seq = None + if seq is not None: + # First see if 'value' is another dok_matrix of the appropriate + # dimensions + if isinstance(value, dok_matrix): + if value.shape[1] == 1: + for element in seq: + self[element, j] = value[element, 0] + else: + raise NotImplementedError, "setting a 2-d slice of" \ + " a dok_matrix is not yet supported" + elif isscalar(value): + for element in seq: + self[element, j] = value + else: + # See if value is a sequence + try: + if len(seq) != len(value): + raise ValueError, "index and value ranges must" \ + " have the same length" + except TypeError: + # Not a sequence + raise TypeError, "unsupported type for" \ + " dok_matrix.__setitem__" + + # Value is a sequence + for element, val in izip(seq, value): + self[element, j] = val # don't use dict.__setitem__ + # here, since we still want to be able to delete + # 0-valued keys, do type checking on 'val' (e.g. if + # it's a rank-1 dense array), etc. + else: + # Process j + if isinstance(j, slice): + seq = xrange(j.start or 0, j.stop or self.shape[1], j.step or 1) + elif operator.isSequenceType(j): + seq = j + else: + # j is not an integer + raise TypeError, "index must be a pair of integers or slices" + + # First see if 'value' is another dok_matrix of the appropriate + # dimensions + if isinstance(value, dok_matrix): + if value.shape[0] == 1: + for element in seq: + self[i, element] = value[0, element] + else: + raise NotImplementedError, "setting a 2-d slice of" \ + " a dok_matrix is not yet supported" + elif isscalar(value): + for element in seq: + self[i, element] = value + else: + # See if value is a sequence + try: + if len(seq) != len(value): + raise ValueError, "index and value ranges must have" \ + " the same length" + except TypeError: + # Not a sequence + raise TypeError, "unsupported type for dok_matrix.__setitem__" + else: + for element, val in izip(seq, value): + self[i, element] = val + + + def __add__(self, other): + # First check if argument is a scalar + if isscalarlike(other): + new = dok_matrix(self.shape, dtype=self.dtype) + # Add this scalar to every element. + M, N = self.shape + for i in xrange(M): + for j in xrange(N): + aij = self.get((i, j), 0) + other + if aij != 0: + new[i, j] = aij + #new.dtype.char = self.dtype.char + elif isinstance(other, dok_matrix): + if other.shape != self.shape: + raise ValueError, "matrix dimensions are not equal" + # We could alternatively set the dimensions to the the largest of + # the two matrices to be summed. Would this be a good idea? + new = dok_matrix(self.shape, dtype=self.dtype) + new.update(self) + for key in other.keys(): + new[key] += other[key] + elif isspmatrix(other): + csc = self.tocsc() + new = csc + other + elif isdense(other): + new = self.todense() + other + else: + raise TypeError, "data type not understood" + return new + + def __radd__(self, other): + # First check if argument is a scalar + if isscalarlike(other): + new = dok_matrix(self.shape, dtype=self.dtype) + # Add this scalar to every element. + M, N = self.shape + for i in xrange(M): + for j in xrange(N): + aij = self.get((i, j), 0) + other + if aij != 0: + new[i, j] = aij + elif isinstance(other, dok_matrix): + if other.shape != self.shape: + raise ValueError, "matrix dimensions are not equal" + new = dok_matrix(self.shape, dtype=self.dtype) + new.update(self) + for key in other: + new[key] += other[key] + elif isspmatrix(other): + csc = self.tocsc() + new = csc + other + elif isdense(other): + new = other + self.todense() + else: + raise TypeError, "data type not understood" + return new + + def __neg__(self): + new = dok_matrix(self.shape, dtype=self.dtype) + for key in self.keys(): + new[key] = -self[key] + return new + + def __mul__(self, other): # self * other + if isscalarlike(other): + new = dok_matrix(self.shape, dtype=self.dtype) + # Multiply this scalar by every element. + for (key, val) in self.iteritems(): + new[key] = val * other + #new.dtype.char = self.dtype.char + return new + else: + return self.dot(other) + + def __imul__(self, other): # self * other + if isscalarlike(other): + # Multiply this scalar by every element. + for (key, val) in self.iteritems(): + self[key] = val * other + #new.dtype.char = self.dtype.char + return self + else: + return NotImplementedError + + def __rmul__(self, other): # other * self + if isscalarlike(other): + new = dok_matrix(self.shape, dtype=self.dtype) + # Multiply this scalar by every element. + for (key, val) in self.iteritems(): + new[key] = other * val + #new.dtype.char = self.dtype.char + return new + else: + # Don't use asarray unless we have to + try: + tr = other.transpose() + except AttributeError: + tr = asarray(other).transpose() + return self.transpose().dot(tr).transpose() + + def __truediv__(self, other): # self * other + if isscalarlike(other): + new = dok_matrix(self.shape, dtype=self.dtype) + # Multiply this scalar by every element. + for (key, val) in self.iteritems(): + new[key] = val / other + #new.dtype.char = self.dtype.char + return new + else: + return self.tocsr() / other + + + def __itruediv__(self, other): # self * other + if isscalarlike(other): + # Multiply this scalar by every element. + for (key, val) in self.iteritems(): + self[key] = val / other + return self + else: + return NotImplementedError + + # What should len(sparse) return? For consistency with dense matrices, + # perhaps it should be the number of rows? For now it returns the number + # of non-zeros. + + def transpose(self): + """ Return the transpose + """ + M, N = self.shape + new = dok_matrix((N, M), dtype=self.dtype) + for key, value in self.iteritems(): + new[key[1], key[0]] = value + return new + + def conjtransp(self): + """ Return the conjugate transpose + """ + M, N = self.shape + new = dok_matrix((N, M), dtype=self.dtype) + for key, value in self.iteritems(): + new[key[1], key[0]] = conj(value) + return new + + def copy(self): + new = dok_matrix(self.shape, dtype=self.dtype) + new.update(self) + new.shape = self.shape + return new + + def take(self, cols_or_rows, columns=1): + # Extract columns or rows as indictated from matrix + # assume cols_or_rows is sorted + new = dok_matrix(dtype=self.dtype) # what should the dimensions be ?! + indx = int((columns == 1)) + N = len(cols_or_rows) + if indx: # columns + for key in self.keys(): + num = searchsorted(cols_or_rows, key[1]) + if num < N: + newkey = (key[0], num) + new[newkey] = self[key] + else: + for key in self.keys(): + num = searchsorted(cols_or_rows, key[0]) + if num < N: + newkey = (num, key[1]) + new[newkey] = self[key] + return new + + def split(self, cols_or_rows, columns=1): + # Similar to take but returns two arrays, the extracted columns plus + # the resulting array. Assumes cols_or_rows is sorted + base = dok_matrix() + ext = dok_matrix() + indx = int((columns == 1)) + if indx: + for key in self.keys(): + num = searchsorted(cols_or_rows, key[1]) + if cols_or_rows[num] == key[1]: + newkey = (key[0], num) + ext[newkey] = self[key] + else: + newkey = (key[0], key[1]-num) + base[newkey] = self[key] + else: + for key in self.keys(): + num = searchsorted(cols_or_rows, key[0]) + if cols_or_rows[num] == key[0]: + newkey = (num, key[1]) + ext[newkey] = self[key] + else: + newkey = (key[0]-num, key[1]) + base[newkey] = self[key] + return base, ext + + + def matvec(self, other): + if isdense(other): + if other.shape[0] != self.shape[1]: + raise ValueError, "dimensions do not match" + new = [0] * self.shape[0] + for key in self.keys(): + new[int(key[0])] += self[key] * other[int(key[1]), ...] + new = array(new) + if isinstance(other, matrix): + new = asmatrix(new) + # Do we need to return the transpose? + if other.shape[1] == 1: + new = new.T + return new + else: + raise TypeError, "need a dense vector" + + def rmatvec(self, other, conjugate=True): + if isdense(other): + if other.shape[-1] != self.shape[0]: + raise ValueError, "dimensions do not match" + new = [0] * self.shape[1] + for key in self.keys(): + new[int(key[1])] += other[..., int(key[0])] * conj(self[key]) + new = array(new) + if isinstance(other, matrix): + new = asmatrix(new) + # Do we need to return the transpose? + if other.shape[1] == 1: + new = new.T + return new + else: + raise TypeError, "need a dense vector" + + def tocoo(self): + """ Return a copy of this matrix in COOrdinate format""" + from coo import coo_matrix + if self.getnnz() == 0: + return coo_matrix(self.shape, dtype=self.dtype) + else: + data = asarray(self.values(), dtype=self.dtype) + indices = asarray(self.keys(), dtype=intc).T + return coo_matrix((data,indices),dims=self.shape,dtype=self.dtype) + + def todok(self,copy=False): + if copy: + return self.copy() + else: + return self + + def tocsr(self): + """ Return a copy of this matrix in Compressed Sparse Row format""" + return self.tocoo().tocsr() + + def tocsc(self): + """ Return a copy of this matrix in Compressed Sparse Column format""" + return self.tocoo().tocsc() + + def toarray(self): + return self.tocsr().toarray() + + def resize(self, shape): + """ Resize the matrix to dimensions given by 'shape', removing any + non-zero elements that lie outside. + """ + if not isshape(shape): + raise TypeError, "dimensions must be a 2-tuple of positive"\ + " integers" + newM, newN = shape + M, N = self.shape + if newM < M or newN < N: + # Remove all elements outside new dimensions + for (i, j) in self.keys(): + if i >= newM or j >= newN: + del self[i, j] + self.shape = shape + + + +from sputils import _isinstance + +def isspmatrix_dok(x): + return _isinstance(x, dok_matrix) + Added: trunk/scipy/sparse/lil.py =================================================================== --- trunk/scipy/sparse/lil.py 2007-12-13 22:51:45 UTC (rev 3642) +++ trunk/scipy/sparse/lil.py 2007-12-14 02:58:33 UTC (rev 3643) @@ -0,0 +1,425 @@ +"""LInked List sparse matrix class + +Original code by Ed Schofield. +""" + +import copy +from bisect import bisect_left + +import numpy +from numpy import isscalar, asmatrix, asarray, intc, concatenate, array, \ + cumsum, zeros, unravel_index + +from base import spmatrix, isspmatrix +from sputils import getdtype,isshape,issequence,isscalarlike + +class lil_matrix(spmatrix): + """Row-based linked list matrix, + + This contains a list (self.rows) of rows, each of which is a sorted + list of column indices of non-zero elements. It also contains a list + (self.data) of lists of these elements. + """ + + def __init__(self, A=None, shape=None, dtype=None, copy=False): + """ Create a new list-of-lists sparse matrix. An optional + argument A is accepted, which initializes the lil_matrix with it. + This can be a tuple of dimensions (M, N) or a dense array / + matrix to copy, or a sparse matrix of the following types: + - csr_matrix + - lil_matrix + """ + spmatrix.__init__(self) + self.dtype = getdtype(dtype, A, default=float) + + # First get the shape + if A is None: + if not isshape(shape): + raise TypeError, "need a valid shape" + M, N = shape + self.shape = (M,N) + self.rows = numpy.empty((M,), dtype=object) + self.data = numpy.empty((M,), dtype=object) + for i in range(M): + self.rows[i] = [] + self.data[i] = [] + else: + if isshape(A): + M, N = A + self.shape = (M,N) + self.rows = numpy.empty((M,), dtype=object) + self.data = numpy.empty((M,), dtype=object) + for i in range(M): + self.rows[i] = [] + self.data[i] = [] + else: + if isspmatrix(A): + if isspmatrix_lil(A) and copy: + A = A.copy() + else: + A = A.tolil() + else: + #assume A is dense + try: + A = asmatrix(A) + except TypeError: + raise TypeError, "unsupported matrix type" + else: + from compressed import csr_matrix + A = csr_matrix(A).tolil() + + #A is a lil matrix + self.shape = A.shape + self.dtype = A.dtype + self.rows = A.rows + self.data = A.data + + def __iadd__(self,other): + self[:,:] = self + other + return self + + def __isub__(self,other): + self[:,:] = self - other + return self + + def __imul__(self,other): + if isscalarlike(other): + self[:,:] = self * other + return self + else: + raise NotImplementedError + + def __itruediv__(self,other): + if isscalarlike(other): + self[:,:] = self / other + return self + else: + raise NotImplementedError + + # Whenever the dimensions change, empty lists should be created for each + # row + + def getnnz(self): + return sum([len(rowvals) for rowvals in self.data]) + + def __str__(self): + val = '' + for i, row in enumerate(self.rows): + for pos, j in enumerate(row): + val += " %s\t%s\n" % (str((i, j)), str(self.data[i][pos])) + return val[:-1] + + #def __repr__(self): + # format = self.getformat() + # return "<%dx%d sparse matrix with %d stored "\ + # "elements in %s format>" % \ + # (self.shape + (self.getnnz(), _formats[format][1])) + + def getrowview(self, i): + """Returns a view of the 'i'th row (without copying). + """ + new = lil_matrix((1, self.shape[1]), dtype=self.dtype) + new.rows[0] = self.rows[i] + new.data[0] = self.data[i] + return new + + def getrow(self, i): + """Returns a copy of the 'i'th row. + """ + new = lil_matrix((1, self.shape[1]), dtype=self.dtype) + new.rows[0] = self.rows[i][:] + new.data[0] = self.data[i][:] + return new + + def _get1(self, i, j): + row = self.rows[i] + data = self.data[i] + + if j < 0: + j += self.shape[1] + + if j < 0 or j > self.shape[1]: + raise IndexError,'column index out of bounds' + + pos = bisect_left(row, j) + if pos != len(data) and row[pos] == j: + return data[pos] + else: + return 0 + + def _slicetoseq(self, j, shape): + if j.start is not None and j.start < 0: + start = shape + j.start + elif j.start is None: + start = 0 + else: + start = j.start + if j.stop is not None and j.stop < 0: + stop = shape + j.stop + elif j.stop is None: + stop = shape + else: + stop = j.stop + j = range(start, stop, j.step or 1) + return j + + + def __getitem__(self, index): + """Return the element(s) index=(i, j), where j may be a slice. + This always returns a copy for consistency, since slices into + Python lists return copies. + """ + try: + i, j = index + except (AssertionError, TypeError): + raise IndexError, "invalid index" + + if isscalar(i): + if isscalar(j): + return self._get1(i, j) + if isinstance(j, slice): + j = self._slicetoseq(j, self.shape[1]) + if issequence(j): + return self.__class__([[self._get1(i, jj) for jj in j]]) + elif issequence(i) and issequence(j): + return self.__class__([[self._get1(ii, jj) for (ii, jj) in zip(i, j)]]) + elif issequence(i) or isinstance(i, slice): + if isinstance(i, slice): + i = self._slicetoseq(i, self.shape[0]) + if isscalar(j): + return self.__class__([[self._get1(ii, j)] for ii in i]) + if isinstance(j, slice): + j = self._slicetoseq(j, self.shape[1]) + if issequence(j): + return self.__class__([[self._get1(ii, jj) for jj in j] for ii in i]) + else: + raise IndexError + + + def _insertat(self, i, j, x): + """ helper for __setitem__: insert a value at (i,j) where i, j and x + are all scalars """ + row = self.rows[i] + data = self.data[i] + self._insertat2(row, data, j, x) + + def _insertat2(self, row, data, j, x): + """ helper for __setitem__: insert a value in the given row/data at + column j. """ + + if j < 0: #handle negative column indices + j += self.shape[1] + + if j < 0 or j >= self.shape[1]: + raise IndexError,'column index out of bounds' + + pos = bisect_left(row, j) + if x != 0: + if pos == len(row): + row.append(j) + data.append(x) + elif row[pos] != j: + row.insert(pos, j) + data.insert(pos, x) + else: + data[pos] = x + else: + if pos < len(row) and row[pos] == j: + del row[pos] + del data[pos] + + + def _insertat3(self, row, data, j, x): + """ helper for __setitem__ """ + if isinstance(j, slice): + j = self._slicetoseq(j, self.shape[1]) + if issequence(j): + if isinstance(x, spmatrix): + x = x.todense() + x = numpy.asarray(x).squeeze() + if isscalar(x) or x.size == 1: + for jj in j: + self._insertat2(row, data, jj, x) + else: + # x must be one D. maybe check these things out + for jj, xx in zip(j, x): + self._insertat2(row, data, jj, xx) + elif isscalar(j): + self._insertat2(row, data, j, x) + else: + raise ValueError, "invalid column value: %s" % str(j) + + + def __setitem__(self, index, x): + if isscalar(x): + x = self.dtype.type(x) + elif not isinstance(x, spmatrix): + x = numpy.asarray(x, dtype=self.dtype) + + try: + i, j = index + except (ValueError, TypeError): + raise IndexError, "invalid index" + + if isscalar(i): + row = self.rows[i] + data = self.data[i] + self._insertat3(row, data, j, x) + elif issequence(i) and issequence(j): + if isscalar(x): + for ii, jj in zip(i, j): + self._insertat(ii, jj, x) + else: + for ii, jj, xx in zip(i, j, x): + self._insertat(ii, jj, xx) + elif isinstance(i, slice) or issequence(i): + rows = self.rows[i] + datas = self.data[i] + if isscalar(x): + for row, data in zip(rows, datas): + self._insertat3(row, data, j, x) + else: + for row, data, xx in zip(rows, datas, x): + self._insertat3(row, data, j, xx) + else: + raise ValueError, "invalid index value: %s" % str((i, j)) + + def __mul__(self, other): # self * other + if isscalarlike(other): + if other == 0: + # Multiply by zero: return the zero matrix + new = lil_matrix(shape=self.shape, dtype=self.dtype) + else: + new = self.copy() + # Multiply this scalar by every element. + new.data = numpy.array([[val*other for val in rowvals] for + rowvals in new.data], dtype=object) + return new + else: + return self.dot(other) + + def __truediv__(self, other): # self / other + if isscalarlike(other): + new = self.copy() + # Divide every element by this scalar + new.data = numpy.array([[val/other for val in rowvals] for + rowvals in new.data], dtype=object) + return new + else: + return self.tocsr() / other + + def multiply(self, other): + """Point-wise multiplication by another lil_matrix. + + """ + if isscalar(other): + return self.__mul__(other) + + if isspmatrix_lil(other): + reference,target = self,other + + if reference.shape != target.shape: + raise ValueError("Dimensions do not match.") + + if len(reference.data) > len(target.data): + reference,target = target,reference + + new = lil_matrix(reference.shape) + for r,row in enumerate(reference.rows): + tr = target.rows[r] + td = target.data[r] + rd = reference.data[r] + L = len(tr) + for c,column in enumerate(row): + ix = bisect_left(tr,column) + if ix < L and tr[ix] == column: + new.rows[r].append(column) + new.data[r].append(rd[c] * td[ix]) + return new + else: + raise ValueError("Point-wise multiplication only allowed " + "with another lil_matrix.") + + def copy(self): + new = lil_matrix(self.shape, dtype=self.dtype) + new.data = copy.deepcopy(self.data) + new.rows = copy.deepcopy(self.rows) + return new + + def reshape(self,shape): + new = lil_matrix(shape,dtype=self.dtype) + j_max = self.shape[1] + for i,row in enumerate(self.rows): + for col,j in enumerate(row): + new_r,new_c = unravel_index(i*j_max + j,shape) + new[new_r,new_c] = self[i,j] + return new + + def __add__(self, other): + if isscalar(other) and other != 0: + raise ValueError("Refusing to destroy sparsity. " + "Use x.todense() + c instead.") + else: + return spmatrix.__add__(self, other) + + def __rmul__(self, other): # other * self + if isscalarlike(other): + # Multiplication by a scalar is symmetric + return self.__mul__(other) + else: + return spmatrix.__rmul__(self, other) + + + def toarray(self): + d = zeros(self.shape, dtype=self.dtype) + for i, row in enumerate(self.rows): + for pos, j in enumerate(row): + d[i, j] = self.data[i][pos] + return d + + def transpose(self): + """ Return the transpose as a csc_matrix. + """ + # Overriding the spmatrix.transpose method here prevents an unnecessary + # csr -> csc conversion + return self.tocsr().transpose() + + def tolil(self, copy=False): + if copy: + return self.copy() + else: + return self + + def tocsr(self): + """ Return Compressed Sparse Row format arrays for this matrix. + """ + + indptr = asarray([len(x) for x in self.rows], dtype=intc) + indptr = concatenate( ( array([0],dtype=intc), cumsum(indptr) ) ) + + nnz = indptr[-1] + + indices = [] + for x in self.rows: + indices.extend(x) + indices = asarray(indices,dtype=intc) + + data = [] + for x in self.data: + data.extend(x) + data = asarray(data,dtype=self.dtype) + + from compressed import csr_matrix + return csr_matrix((data, indices, indptr), dims=self.shape) + + def tocsc(self): + """ Return Compressed Sparse Column format arrays for this matrix. + """ + return self.tocsr().tocsc() + + +from sputils import _isinstance + +def isspmatrix_lil( x ): + return _isinstance(x, lil_matrix) + Deleted: trunk/scipy/sparse/sparse.py =================================================================== --- trunk/scipy/sparse/sparse.py 2007-12-13 22:51:45 UTC (rev 3642) +++ trunk/scipy/sparse/sparse.py 2007-12-14 02:58:33 UTC (rev 3643) @@ -1,2696 +0,0 @@ -""" Scipy 2D sparse matrix module. - -Original code by Travis Oliphant. -Modified and extended by Ed Schofield, Robert Cimrman, and Nathan Bell -""" - - -__all__ = ['spmatrix','csc_matrix','csr_matrix','coo_matrix', - 'lil_matrix','dok_matrix' ] -__all__ += [ 'isspmatrix','issparse','isspmatrix_csc','isspmatrix_csr', - 'isspmatrix_lil','isspmatrix_dok', 'isspmatrix_coo' ] - -import warnings - -from numpy import zeros, isscalar, real, imag, asarray, asmatrix, matrix, \ - ndarray, amax, amin, rank, conj, searchsorted, ndarray, \ - less, where, greater, array, transpose, empty, ones, \ - arange, shape, intc, clip, prod, unravel_index, hstack, \ - array_split, concatenate, cumsum, diff, empty_like - -import numpy -from scipy.sparse.sparsetools import csrtodense, \ - cootocsr, cootocsc, csctocsr, csrtocsc - - -import sparsetools -import itertools, operator, copy -from bisect import bisect_left - -def resize1d(arr, newlen): - old = len(arr) - new = zeros((newlen,), arr.dtype) - new[:old] = arr - return new - -MAXPRINT = 50 - - -# keep this list syncronized with sparsetools -supported_dtypes = ['int8','uint8','int16','int32','int64', - 'float32','float64','complex64','complex128'] -supported_dtypes = [ numpy.typeDict[x] for x in supported_dtypes] - -def upcast(*args): - """Returns the nearest supported sparse dtype for the - combination of one or more types. - - upcast(t0, t1, ..., tn) -> T where T is a supported dtype - - *Example* - ------- - - >>> upcast('int32') - - >>> upcast('bool') - - >>> upcast('int32','float32') - - >>> upcast('bool',complex,float) - - - """ - sample = array([0],dtype=args[0]) - for t in args[1:]: - sample = sample + array([0],dtype=t) - - upcast = sample.dtype - - for t in supported_dtypes: - if upcast <= t: - return t - - raise TypeError,'no supported conversion for types: %s' % args - - - -#TODO handle this in SWIG -def to_native(A): - if not A.dtype.isnative: - return A.astype(A.dtype.newbyteorder('native')) - else: - return A - -# The formats that we might potentially understand. -_formats = {'csc':[0, "Compressed Sparse Column"], - 'csr':[1, "Compressed Sparse Row"], - 'dok':[2, "Dictionary Of Keys"], - 'lil':[3, "LInked List"], - 'dod':[4, "Dictionary of Dictionaries"], - 'sss':[5, "Symmetric Sparse Skyline"], - 'coo':[6, "COOrdinate"], - 'lba':[7, "Linpack BAnded"], - 'egd':[8, "Ellpack-itpack Generalized Diagonal"], - 'dia':[9, "DIAgonal"], - 'bsr':[10, "Block Sparse Row"], - 'msr':[11, "Modified compressed Sparse Row"], - 'bsc':[12, "Block Sparse Column"], - 'msc':[13, "Modified compressed Sparse Column"], - 'ssk':[14, "Symmetric SKyline"], - 'nsk':[15, "Nonsymmetric SKyline"], - 'jad':[16, "JAgged Diagonal"], - 'uss':[17, "Unsymmetric Sparse Skyline"], - 'vbr':[18, "Variable Block Row"], - 'und':[19, "Undefined"] - } - - - - - -class spmatrix(object): - """ This class provides a base class for all sparse matrices. It - cannot be instantiated. Most of the work is provided by subclasses. - """ - - __array_priority__ = 10.1 - ndim = 2 - def __init__(self, maxprint=MAXPRINT): - self.format = self.__class__.__name__[:3] - self._shape = None - if self.format == 'spm': - raise ValueError, "This class is not intended" \ - " to be instantiated directly." - self.maxprint = maxprint - - def set_shape(self,shape): - shape = tuple(shape) - - if len(shape) != 2: - raise ValueError("Only two-dimensional sparse arrays " - "are supported.") - try: - shape = int(shape[0]),int(shape[1]) #floats, other weirdness - except: - raise TypeError,'invalid shape' - - if not (shape[0] >= 1 and shape[1] >= 1): - raise TypeError,'invalid shape' - - if (self._shape != shape) and (self._shape is not None): - try: - self = self.reshape(shape) - except NotImplementedError: - raise NotImplementedError("Reshaping not implemented for %s." % - self.__class__.__name__) - self._shape = shape - - def get_shape(self): - return self._shape - - shape = property(fget=get_shape, fset=set_shape) - - def reshape(self,shape): - raise NotImplementedError - - def astype(self, t): - return self.tocsr().astype(t) - - def asfptype(self): - """Upcast matrix to a floating point format (if necessary)""" - - fp_types = ['f','d','F','D'] - - if self.dtype.char in fp_types: - return self - else: - for fp_type in fp_types: - if self.dtype <= numpy.dtype(fp_type): - return self.astype(fp_type) - - raise TypeError,'cannot upcast [%s] to a floating \ - point format' % self.dtype.name - - def __iter__(self): - for r in xrange(self.shape[0]): - yield self[r,:] - - def getmaxprint(self): - try: - maxprint = self.maxprint - except AttributeError: - maxprint = MAXPRINT - return maxprint - - #def typecode(self): - # try: - # typ = self.dtype.char - # except AttributeError: - # typ = None - # return typ - - def getnnz(self): - try: - return self.nnz - except AttributeError: - raise AttributeError, "nnz not defined" - - def getformat(self): - try: - format = self.format - except AttributeError: - format = 'und' - return format - - def rowcol(self, num): - return (None, None) - - def getdata(self, num): - return None - - def listprint(self, start, stop): - """Provides a way to print over a single index. - """ - return '\n'.join([' %s\t%s' % (self.rowcol(ind), self.getdata(ind)) - for ind in xrange(start,stop)]) + '\n' - - def __repr__(self): - nnz = self.getnnz() - format = self.getformat() - return "<%dx%d sparse matrix of type '%s'\n" \ - "\twith %d stored elements in %s format>" % \ - (self.shape + (self.dtype.type, nnz, _formats[format][1])) - - def __str__(self): - nnz = self.getnnz() - maxprint = self.getmaxprint() - val = '' - if nnz > maxprint: - val = val + self.listprint(0, maxprint/2) - val = val + " :\t:\n" - val = val + self.listprint(nnz-maxprint//2, nnz) - else: - val = val + self.listprint(0, nnz) - return val[:-1] - - def __nonzero__(self): # Simple -- other ideas? - return self.getnnz() > 0 - - # What should len(sparse) return? For consistency with dense matrices, - # perhaps it should be the number of rows? But for some uses the number of - # non-zeros is more important. For now, raise an exception! - def __len__(self): - # return self.getnnz() - raise TypeError, "sparse matrix length is ambiguous; use getnnz()" \ - " or shape[0]" - - def asformat(self, format): - """Return this matrix in a given sparse format - - *Parameters*: - format : desired sparse matrix format - If format is None then no conversion is performed - Other possible values include: - "csr" for csr_matrix format - "csc" for csc_matrix format - "dok" for dok_matrix format and so on - """ - - if format is None or format == self.format: - return self - else: - return eval('%s_matrix' % format)(self) - - # default operations use the CSR format as a base - # and operations return in csr format - # thus, a new sparse matrix format just needs to define - # a tocsr method - - def __abs__(self): - return abs(self.tocsr()) - - def __add__(self, other): # self + other - return self.tocsr().__add__(other) - - def __radd__(self, other): # other + self - return self.tocsr().__radd__(other) - - def __sub__(self, other): # self - other - #note: this can't be replaced by self + (-other) for unsigned types - return self.tocsr().__sub__(other) - - def __rsub__(self, other): # other - self - return self.tocsr().__rsub__(other) - - def __mul__(self, other): - return self.tocsr().__mul__(other) - - def __rmul__(self, other): - return self.tocsr().__rmul__(other) - - def __truediv__(self, other): - if isscalarlike(other): - return self * (1./other) - else: - return self.tocsr().__truediv__(other) - - def __div__(self, other): - # Always do true division - return self.__truediv__(other) - - def __pow__(self, other): - csc = self.tocsc() - return csc ** other - - def __neg__(self): - csc = self.tocsc() - return -csc - - def __iadd__(self, other): - raise NotImplementedError - - def __isub__(self, other): - raise NotImplementedError - - def __imul__(self, other): - raise NotImplementedError - - def __idiv__(self, other): - return self.__itruediv__(other) - - def __itruediv__(self, other): - raise NotImplementedError - - def __getattr__(self, attr): - if attr == 'A': - return self.toarray() - elif attr == 'T': - return self.transpose() - elif attr == 'H': - return self.getH() - elif attr == 'real': - return self._real() - elif attr == 'imag': - return self._imag() - elif attr == 'size': - return self.getnnz() - else: - raise AttributeError, attr + " not found" - - def transpose(self): - return self.tocsr().transpose() - - def conj(self): - return self.tocsr().conj() - - def conjugate(self): - return self.tocsr().conj() - - # Renamed conjtranspose() -> getH() for compatibility with dense matrices - def getH(self): - return self.transpose().conj() - - def _real(self): - return self.tocsr()._real() - - def _imag(self): - return self.tocsr()._imag() - - def getcol(self, j): - """Returns a copy of column j of the matrix, as an (m x 1) sparse - matrix (column vector). - """ - # Spmatrix subclasses should override this method for efficiency. - # Post-multiply by a (n x 1) column vector 'a' containing all zeros - # except for a_j = 1 - n = self.shape[1] - a = csc_matrix((n, 1), dtype=self.dtype) - a[j, 0] = 1 - return self * a - - def getrow(self, i): - """Returns a copy of row i of the matrix, as a (1 x n) sparse - matrix (row vector). - """ - # Spmatrix subclasses should override this method for efficiency. - # Pre-multiply by a (1 x m) row vector 'a' containing all zeros - # except for a_i = 1 - m = self.shape[0] - a = csr_matrix((1, m), dtype=self.dtype) - a[0, i] = 1 - return a * self - - def dot(self, other): - """ A generic interface for matrix-matrix or matrix-vector - multiplication. - """ - - try: - other.shape - except AttributeError: - # If it's a list or whatever, treat it like a matrix - other = asmatrix(other) - - if isdense(other) and asarray(other).squeeze().ndim <= 1: - # it's a dense row or column vector - return self.matvec(other) - elif len(other.shape) == 2: - # it's a 2d dense array, dense matrix, or sparse matrix - return self.matmat(other) - else: - raise ValueError, "could not interpret dimensions" - - - def matmat(self, other): - return self.tocsr().matmat(other) - - def matvec(self, other): - """Multiplies the sparse matrix by the vector 'other', returning a - dense vector as a result. - """ - return self.tocsr().matvec(other) - - def rmatvec(self, other, conjugate=True): - """Multiplies the vector 'other' by the sparse matrix, returning a - dense vector as a result. - - If 'conjugate' is True: - returns A.transpose().conj() * other - Otherwise: - returns A.transpose() * other. - """ - return self.tocsr().rmatvec(other, conjugate=conjugate) - - #def rmatmat(self, other, conjugate=True): - # """ If 'conjugate' is True: - # returns other * A.transpose().conj(), - # where 'other' is a matrix. Otherwise: - # returns other * A.transpose(). - # """ - # other = csc_matrix(other) - # if conjugate: - # return other.matmat(self.transpose()).conj() - # else: - # return other.matmat(self.transpose()) - - def todense(self): - return asmatrix(self.toarray()) - - def toarray(self): - csr = self.tocsr() - return csr.toarray() - - def todok(self): - return self.tocoo().todok() - - def tocoo(self): - return self.tocsr().tocoo() - - def tolil(self): - return self.tocsr().tolil() - - def toself(self, copy=False): - if copy: - new = self.copy() - else: - new = self - return new - - def copy(self): - return self.tocsr().copy() - - def sum(self, axis=None): - """Sum the matrix over the given axis. If the axis is None, sum - over both rows and columns, returning a scalar. - """ - # We use multiplication by an array of ones to achieve this. - # For some sparse matrix formats more efficient methods are - # possible -- these should override this function. - m, n = self.shape - if axis == 0: - # sum over columns - return asmatrix(ones((1, m), dtype=self.dtype)) * self - elif axis == 1: - # sum over rows - return self * asmatrix(ones((n, 1), dtype=self.dtype)) - elif axis is None: - # sum over rows and columns - return ( self * asmatrix(ones((n, 1), dtype=self.dtype)) ).sum() - else: - raise ValueError, "axis out of bounds" - - def mean(self, axis=None): - """Average the matrix over the given axis. If the axis is None, - average over both rows and columns, returning a scalar. - """ - if axis == 0: - mean = self.sum(0) - mean *= 1.0 / self.shape[0] - return mean - elif axis == 1: - mean = self.sum(1) - mean *= 1.0 / self.shape[1] - return mean - elif axis is None: - return self.sum(None) * 1.0 / (self.shape[0]*self.shape[1]) - else: - raise ValueError, "axis out of bounds" - - def setdiag(self, values, k=0): - """Fills the diagonal elements {a_ii} with the values from the - given sequence. If k != 0, fills the off-diagonal elements - {a_{i,i+k}} instead. - - values may have any length. If the diagonal is longer than values, - then the remaining diagonal entries will not be set. If values if - longer than the diagonal, then the remaining values are ignored. - """ - M, N = self.shape - if (k > 0 and k >= N) or (k < 0 and -k >= M): - raise ValueError, "k exceedes matrix dimensions" - if k < 0: - max_index = min(M+k, N, len(values)) - for i,v in enumerate(values[:max_index]): - self[i - k, i] = v - else: - max_index = min(M, N-k, len(values)) - for i,v in enumerate(values[:max_index]): - self[i, i + k] = v - - - def save(self, file_name, format = '%d %d %f\n'): - try: - fd = open(file_name, 'w') - except Exception, e: - raise e, file_name - - fd.write('%d %d\n' % self.shape) - fd.write('%d\n' % self.size) - for ii in xrange(self.size): - ir, ic = self.rowcol(ii) - data = self.getdata(ii) - fd.write(format % (ir, ic, data)) - fd.close() - -class _cs_matrix(spmatrix): - """base matrix class for compressed row and column oriented matrices""" - - def __init__(self, arg1, dims=None, dtype=None, copy=False): - spmatrix.__init__(self) - - if isdense(arg1): - # Convert the dense array or matrix arg1 to sparse format - if rank(arg1) == 1: - # Convert to a row vector - arg1 = arg1.reshape(1, arg1.shape[0]) - if rank(arg1) == 2: - self.shape = arg1.shape - self._set_self( self._tothis(coo_matrix(arg1)) ) - else: - raise ValueError, "dense array must have rank 1 or 2" - - elif isspmatrix(arg1): - if copy: - arg1 = arg1.copy() - self._set_self( self._tothis(arg1) ) - - elif isinstance(arg1, tuple): - if isshape(arg1): - # It's a tuple of matrix dimensions (M, N) - # create empty matrix - self.shape = arg1 #spmatrix checks for errors here - M, N = self.shape - self.data = zeros(0, getdtype(dtype, default=float)) - self.indices = zeros(0, intc) - self.indptr = zeros(self._swap(self.shape)[0] + 1, dtype='intc') - else: - try: - # Try interpreting it as (data, ij) - (data, ij) = arg1 - assert isinstance(ij, ndarray) and (rank(ij) == 2) \ - and (shape(ij) == (2, len(data))) - except (AssertionError, TypeError, ValueError, AttributeError): - try: - # Try interpreting it as (data, indices, indptr) - (data, indices, indptr) = arg1 - except: - raise ValueError, "unrecognized form for csr_matrix constructor" - else: - self.data = array(data, copy=copy, dtype=getdtype(dtype, data)) - self.indices = array(indices, copy=copy) - self.indptr = array(indptr, copy=copy) - else: - # (data, ij) format - other = coo_matrix((data, ij), dims=dims ) - other = self._tothis(other) - self._set_self( other ) - - else: - raise ValueError, "unrecognized form for csr_matrix constructor" - - # Read matrix dimensions given, if any - if dims is not None: - self.shape = dims # spmatrix will check for errors - else: - if self.shape is None: - # shape not already set, try to infer dimensions - try: - major_dim = len(self.indptr) - 1 - minor_dim = self.indices.max() + 1 - except: - raise ValueError,'unable to infer matrix dimensions' - else: - self.shape = self._swap((major_dim,minor_dim)) - - self.check_format(full_check=False) - - def getnnz(self): - return self.indptr[-1] - nnz = property(fget=getnnz) - - def _get_dtype(self): - return self.data.dtype - def _set_dtype(self,newtype): - self.data.dtype = newtype - dtype = property(fget=_get_dtype,fset=_set_dtype) - - def _set_self(self, other, copy=False): - """take the member variables of other and assign them to self""" - - if copy: - other = other.copy() - - self.data = other.data - self.indices = other.indices - self.indptr = other.indptr - self.shape = other.shape - - def _check_format(self, full_check): - self.shape = tuple([int(x) for x in self.shape]) # for floats etc. - - #use _swap to determine proper bounds - major_name,minor_name = self._swap(('row','column')) - major_dim,minor_dim = self._swap(self.shape) - - # index arrays should have integer data types - if self.indptr.dtype.kind != 'i': - warnings.warn("indptr array has non-integer dtype (%s)" \ - % self.indptr.dtype.name ) - if self.indices.dtype.kind != 'i': - warnings.warn("indices array has non-integer dtype (%s)" \ - % self.indices.dtype.name ) - - # only support 32-bit ints for now - self.indptr = self.indptr.astype('intc') - self.indices = self.indices.astype('intc') - self.data = to_native(self.data) - - # check array shapes - if (rank(self.data) != 1) or (rank(self.indices) != 1) or \ - (rank(self.indptr) != 1): - raise ValueError,"data, indices, and indptr should be rank 1" - - # check index pointer - if (len(self.indptr) != major_dim + 1 ): - raise ValueError, \ - "index pointer size (%d) should be (%d)" % \ - (len(self.indptr), major_dim + 1) - if (self.indptr[0] != 0): - raise ValueError,"index pointer should start with 0" - - # check index and data arrays - if (len(self.indices) != len(self.data)): - raise ValueError,"indices and data should have the same size" - if (self.indptr[-1] > len(self.indices)): - raise ValueError, \ - "Last value of index pointer should be less than "\ - "the size of index and data arrays" - - self.prune() - - if full_check: - #check format validity (more expensive) - if self.nnz > 0: - if amax(self.indices) >= minor_dim: - raise ValueError, "%s index values must be < %d" % \ - (minor_name,minor_dim) - if amin(self.indices) < 0: - raise ValueError, "%s index values must be >= 0" % \ - minor_name - if numpy.diff(self.indptr).min() < 0: - raise ValueError,'index pointer values must form a " \ - "non-decreasing sequence' - - def astype(self, t): - return self._with_data(self.data.astype(t)) - - def _with_data(self,data,copy=True): - """Returns a matrix with the same sparsity structure as self, - but with different data. By default the structure arrays - (i.e. .indptr and .indices) are copied. - """ - if copy: - return self.__class__((data,self.indices.copy(),self.indptr.copy()), \ - dims=self.shape,dtype=data.dtype) - else: - return self.__class__((data,self.indices,self.indptr), \ - dims=self.shape,dtype=data.dtype) - - def __abs__(self): - return self._with_data(abs(self.data)) - - def _real(self): - return self._with_data(numpy.real(self.data)) - - def _imag(self): - return self._with_data(numpy.imag(self.data)) - - def _binopt(self, other, op, in_shape=None, out_shape=None): - """apply the binary operation fn to two sparse matrices""" - other = self._tothis(other) - - if in_shape is None: - in_shape = self.shape - if out_shape is None: - out_shape = self.shape - - # e.g. csr_plus_csr, cscmucsc, etc. - fn = getattr(sparsetools, self.format + op + self.format) - - indptr, ind, data = fn(in_shape[0], in_shape[1], \ - self.indptr, self.indices, self.data, - other.indptr, other.indices, other.data) - return self.__class__((data, ind, indptr), dims=out_shape) - - - def __add__(self,other): - # First check if argument is a scalar - if isscalarlike(other): - # Now we would add this scalar to every element. - raise NotImplementedError, 'adding a scalar to a CSC or CSR ' \ - 'matrix is not supported' - elif isspmatrix(other): - if (other.shape != self.shape): - raise ValueError, "inconsistent shapes" - - return self._binopt(other,'_plus_') - elif isdense(other): - # Convert this matrix to a dense matrix and add them - return self.todense() + other - else: - raise NotImplementedError - - def __radd__(self,other): - return self.__add__(other) - - def __sub__(self,other): - # First check if argument is a scalar - if isscalarlike(other): - # Now we would add this scalar to every element. - raise NotImplementedError, 'adding a scalar to a CSC or CSR ' \ - 'matrix is not supported' - elif isspmatrix(other): - if (other.shape != self.shape): - raise ValueError, "inconsistent shapes" - - return self._binopt(other,'_minus_') - elif isdense(other): - # Convert this matrix to a dense matrix and subtract them - return self.todense() - other - else: - raise NotImplementedError - - def __rsub__(self,other): # other - self - #note: this can't be replaced by other + (-self) for unsigned types - if isscalarlike(other): - # Now we would add this scalar to every element. - raise NotImplementedError, 'adding a scalar to a CSC or CSR ' \ - 'matrix is not supported' - elif isdense(other): - # Convert this matrix to a dense matrix and subtract them - return other - self.todense() - else: - raise NotImplementedError - - - def __mul__(self, other): # self * other - """ Scalar, vector, or matrix multiplication - """ - if isscalarlike(other): - return self._with_data(self.data * other) - else: - return self.dot(other) - - - def __rmul__(self, other): # other * self - if isscalarlike(other): - return self.__mul__(other) - else: - # Don't use asarray unless we have to - try: - tr = other.transpose() - except AttributeError: - tr = asarray(other).transpose() - return self.transpose().dot(tr).transpose() - - def __imul__(self, other): #self *= other - if isscalarlike(other): - self.data *= other - return self - else: - raise NotImplementedError - - def __neg__(self): - return self._with_data(-self.data) - - def __truediv__(self,other): - if isscalarlike(other): - return self * (1./other) - elif isspmatrix(other): - if (other.shape != self.shape): - raise ValueError, "inconsistent shapes" - - return self._binopt(other,'_eldiv_') - else: - raise NotImplementedError - - def __itruediv__(self, other): #self *= other - if isscalarlike(other): - recip = 1.0 / other - self.data *= recip - return self - else: - raise NotImplementedError - - def __pow__(self, other): - """ Element-by-element power (unless other is a scalar, in which - case return the matrix power.) - """ - if isscalarlike(other): - return self._with_data(self.data**other) - elif isspmatrix(other): - if (other.shape != self.shape): - raise ValueError, "inconsistent shapes" - - return self._binopt(other,'_elmul_') - else: - raise NotImplementedError - - - def matmat(self, other): - if isspmatrix(other): - M, K1 = self.shape - K2, N = other.shape - if (K1 != K2): - raise ValueError, "shape mismatch error" - other = self._tothis(other) - - return self._binopt(other,'mu',in_shape=(M,N),out_shape=(M,N)) - elif isdense(other): - # TODO make sparse * dense matrix multiplication more efficient - - # matvec each column of other - return hstack( [ self * col.reshape(-1,1) for col in other.T ] ) - else: - raise TypeError, "need a dense or sparse matrix" - - def matvec(self, other): - if isdense(other): - if other.size != self.shape[1] or \ - (other.ndim == 2 and self.shape[1] != other.shape[0]): - raise ValueError, "dimension mismatch" - - # csrmux, cscmux - fn = getattr(sparsetools,self.format + 'mux') - - #output array - y = empty( self.shape[0], dtype=upcast(self.dtype,other.dtype) ) - - fn(self.shape[0], self.shape[1], \ - self.indptr, self.indices, self.data, numpy.ravel(other), y) - - if isinstance(other, matrix): - y = asmatrix(y) - - if other.ndim == 2 and other.shape[1] == 1: - # If 'other' was an (nx1) column vector, reshape the result - y = y.reshape(-1,1) - - return y - - elif isspmatrix(other): - raise TypeError, "use matmat() for sparse * sparse" - - else: - raise TypeError, "need a dense vector" - - def rmatvec(self, other, conjugate=True): - if conjugate: - return self.transpose().conj() * other - else: - return self.transpose() * other - - def getdata(self, ind): - return self.data[ind] - -# def _other_format(self): -# if self.format == 'csr': -# return 'csc' -# elif self.format == 'csc': -# return 'csr' -# else: -# raise TypeError,'unrecognized type' -# -# def _other__class__(self): -# if self.format == 'csr': -# return csc_matrix -# elif self.format == 'csc': -# return csr_matrix -# else: -# raise TypeError,'unrecognized type' - - - - def sum(self, axis=None): - """Sum the matrix over the given axis. If the axis is None, sum - over both rows and columns, returning a scalar. - """ - # The spmatrix base class already does axis=0 and axis=1 efficiently - # so we only do the case axis=None here - if axis is None: - return self.data[:self.indptr[-1]].sum() - else: - return spmatrix.sum(self,axis) - raise ValueError, "axis out of bounds" - - - def copy(self): - return self._with_data(self.data.copy(),copy=True) - - def _get_slice(self, i, start, stop, stride, dims): - """Returns a view of the elements [i, myslice.start:myslice.stop]. - """ - if stride != 1: - raise ValueError, "slicing with step != 1 not supported" - if stop <= start: - raise ValueError, "slice width must be >= 1" - - indices = [] - - for ind in xrange(self.indptr[i], self.indptr[i+1]): - if self.indices[ind] >= start and self.indices[ind] < stop: - indices.append(ind) - - index = self.indices[indices] - start - data = self.data[indices] - indptr = numpy.array([0, len(indices)]) - return self.__class__((data, index, indptr), dims=dims, \ - dtype=self.dtype) - - - def _transpose(self, cls, copy=False): - M, N = self.shape - return cls((self.data,self.indices,self.indptr),(N,M),copy=copy) - - def tocoo(self,copy=True): - """Return a COOrdinate representation of this matrix - - When copy=False the index and data arrays are not copied. - """ - major_dim,minor_dim = self._swap(self.shape) - - data = self.data - minor_indices = self.indices - - if copy: - data = data.copy() - minor_indices = minor_indices.copy() - - major_indices = empty(len(minor_indices),dtype=intc) - - sparsetools.expandptr(major_dim,self.indptr,major_indices) - - row,col = self._swap((major_indices,minor_indices)) - return coo_matrix((data,(row,col)), self.shape) - - def conj(self, copy=False): - return self._with_data(self.data.conj(),copy=copy) - - def sorted_indices(self): - """Return a copy of this matrix with sorted indices - """ - A = self.copy() - A.sort_indices() - return A - - # an alternative that has linear complexity is the following - # typically the previous option is faster - #return self._toother()._toother() - - def sort_indices(self): - """Sort the indices of this matrix *in place* - """ - fn = getattr(sparsetools,'sort_' + self.format + '_indices') - - M,N = self.shape - fn( M, N, self.indptr, self.indices, self.data) - - def ensure_sorted_indices(self, inplace=False): - """Return a copy of this matrix where the column indices are sorted - """ - warnings.warn('ensure_sorted_indices is deprecated, ' \ - 'use sorted_indices() or sort_indices() instead', \ - DeprecationWarning) - - if inplace: - self.sort_indices() - else: - return self.sorted_indices() - - def prune(self): - """ Remove empty space after all non-zero elements. - """ - major_dim = self._swap(self.shape)[0] - - if len(self.indptr) != major_dim + 1: - raise ValueError, "index pointer has invalid length" - if len(self.indices) < self.nnz: - raise ValueError, "indices array has fewer than nnz elements" - if len(self.data) < self.nnz: - raise ValueError, "data array has fewer than nnz elements" - - self.data = self.data[:self.nnz] - self.indices = self.indices[:self.nnz] - - def _get_submatrix( self, shape0, shape1, slice0, slice1 ): - """Return a submatrix of this matrix (new matrix is created).""" - def _process_slice( sl, num ): - if isinstance( sl, slice ): - i0, i1 = sl.start, sl.stop - if i0 is None: - i0 = 0 - elif i0 < 0: - i0 = num + i0 - - if i1 is None: - i1 = num - elif i1 < 0: - i1 = num + i1 - - return i0, i1 - - elif isscalar( sl ): - if sl < 0: - sl += num - - return sl, sl + 1 - - else: - return sl[0], sl[1] - - def _in_bounds( i0, i1, num ): - if not (0<=i0= N): - self.indptr = resize1d(self.indptr, col+2) - self.indptr[N+1:] = self.indptr[N] - N = col+1 - if (row >= M): - M = row+1 - self.shape = (M, N) - - indxs = numpy.where(row == self.indices[self.indptr[col]:self.indptr[col+1]]) - - if len(indxs[0]) == 0: - #value not present - #TODO handle this with concatenation - self.data = resize1d(self.data, self.nnz + 1) - self.indices = resize1d(self.indices, self.nnz + 1) - - newindex = self.indptr[col] - self.data[newindex+1:] = self.data[newindex:-1] - self.indices[newindex+1:] = self.indices[newindex:-1] - - self.data[newindex] = val - self.indices[newindex] = row - self.indptr[col+1:] += 1 - - elif len(indxs[0]) == 1: - #value already present - self.data[self.indptr[col]:self.indptr[col+1]][indxs[0]] = val - else: - raise IndexError, "row index occurs more than once" - - self.check_format(full_check=False) - else: - # We should allow slices here! - raise IndexError, "invalid index" - - def _getslice(self, i, myslice): - return self._getcolslice(i, myslice) - - def _getcolslice(self, myslice, j): - """Returns a view of the elements [myslice.start:myslice.stop, j]. - """ - start, stop, stride = myslice.indices(self.shape[0]) - return _cs_matrix._get_slice(self, j, start, stop, stride, (stop - start, 1)) - - def rowcol(self, ind): - row = self.indices[ind] - col = searchsorted(self.indptr, ind+1)-1 - return (row, col) - - - def tocsc(self, copy=False): - return self.toself(copy) - - def tocsr(self): - indptr = empty(self.shape[0] + 1, dtype=intc) - indices = empty(self.nnz, dtype=intc) - data = empty(self.nnz, dtype=upcast(self.dtype)) - - csctocsr(self.shape[0], self.shape[1], \ - self.indptr, self.indices, self.data, \ - indptr, indices, data) - - return csr_matrix((data, indices, indptr), self.shape) - - def toarray(self): - return self.tocsr().toarray() - - def get_submatrix( self, slice0, slice1 ): - """Return a submatrix of this matrix (new matrix is created). - Rows and columns can be selected using slice instances, tuples, - or scalars.""" - aux = _cs_matrix._get_submatrix( self, self.shape[1], self.shape[0], - slice1, slice0 ) - nr, nc = aux[3:] - return self.__class__( aux[:3], dims = (nc, nr) ) - - # these functions are used by the parent class (_cs_matrix) - # to remove redudancy between csc_matrix and csr_matrix - def _swap(self,x): - """swap the members of x if this is a column-oriented matrix - """ - return (x[1],x[0]) - - def _toother(self): - return self.tocsr() - - def _tothis(self, other): - return other.tocsc() - -class csr_matrix(_cs_matrix): - """ Compressed sparse row matrix - This can be instantiated in several ways: - - csr_matrix(d) - with a dense matrix d - - - csr_matrix(s) - with another sparse matrix s (sugar for .tocsr()) - - - csr_matrix((M, N), [dtype]) - to construct a container, where (M, N) are dimensions and - dtype is optional, defaulting to dtype='d'. - - - csr_matrix((data, ij), [dims=(M, N)]) - where data, ij satisfy: - a[ij[0, k], ij[1, k]] = data[k] - - - csr_matrix((data, col, ptr), [dims=(M, N)]) - standard CSR representation - """ - - def check_format(self,full_check=True): - """check whether matrix is in valid CSR format - - *Parameters*: - full_check: - True - perform rigorous checking - default - False - perform basic format check - - """ - _cs_matrix._check_format(self,full_check) - - def __getattr__(self, attr): - if attr == 'colind': - warnings.warn("colind attribute no longer in use. Use .indices instead", - DeprecationWarning) - return self.indices - else: - return _cs_matrix.__getattr__(self, attr) - - def transpose(self, copy=False): - return _cs_matrix._transpose(self, csc_matrix, copy) - - def __getitem__(self, key): - if isinstance(key, tuple): - #TODO use _swap() to unify this in _cs_matrix - row = key[0] - col = key[1] - if isinstance(row, slice): - # Returns a new matrix! - return self.get_submatrix( row, col ) - elif isinstance(col, slice): - return self._getslice(row, col) - M, N = self.shape - if (row < 0): - row = M + row - if (col < 0): - col = N + col - if not (0<=row= M): - self.indptr = resize1d(self.indptr, row+2) - self.indptr[M+1:] = self.indptr[M] - M = row+1 - if (col >= N): - N = col+1 - self.shape = (M, N) - - indxs = numpy.where(col == self.indices[self.indptr[row]:self.indptr[row+1]]) - if len(indxs[0]) == 0: - #value not present - self.data = resize1d(self.data, self.nnz + 1) - self.indices = resize1d(self.indices, self.nnz + 1) - - newindex = self.indptr[row] - self.data[newindex+1:] = self.data[newindex:-1] - self.indices[newindex+1:] = self.indices[newindex:-1] - - self.data[newindex] = val - self.indices[newindex] = col - self.indptr[row+1:] += 1 - - elif len(indxs[0]) == 1: - #value already present - self.data[self.indptr[row]:self.indptr[row+1]][indxs[0]] = val - else: - raise IndexError, "row index occurs more than once" - - self.check_format(full_check=False) - else: - # We should allow slices here! - raise IndexError, "invalid index" - - def rowcol(self, ind): - col = self.indices[ind] - row = searchsorted(self.indptr, ind+1)-1 - return (row, col) - - - def tolil(self): - lil = lil_matrix(self.shape,dtype=self.dtype) - - csr = self.sorted_indices() #lil_matrix needs sorted rows - - rows,data = lil.rows,lil.data - ptr,ind,dat = csr.indptr,csr.indices,csr.data - - for n in xrange(self.shape[0]): - start = ptr[n] - end = ptr[n+1] - rows[n] = ind[start:end].tolist() - data[n] = dat[start:end].tolist() - - return lil - - def tocsr(self, copy=False): - return self.toself(copy) - - def tocsc(self): - indptr = empty(self.shape[1] + 1, dtype=intc) - indices = empty(self.nnz, dtype=intc) - data = empty(self.nnz, dtype=upcast(self.dtype)) - - csrtocsc(self.shape[0], self.shape[1], \ - self.indptr, self.indices, self.data, \ - indptr, indices, data) - - return csc_matrix((data, indices, indptr), self.shape) - - def toarray(self): - data = numpy.zeros(self.shape, dtype=upcast(self.data.dtype)) - csrtodense(self.shape[0], self.shape[1], self.indptr, self.indices, - self.data, data) - return data - - def get_submatrix( self, slice0, slice1 ): - """Return a submatrix of this matrix (new matrix is created).. - Rows and columns can be selected using slice instances, tuples, - or scalars.""" - aux = _cs_matrix._get_submatrix( self, self.shape[0], self.shape[1], - slice0, slice1 ) - nr, nc = aux[3:] - return self.__class__( aux[:3], dims = (nr, nc) ) - - # these functions are used by the parent class (_cs_matrix) - # to remove redudancy between csc_matrix and csr_matrix - def _swap(self,x): - """swap the members of x if this is a column-oriented matrix - """ - return (x[0],x[1]) - - def _toother(self): - return self.tocsc() - - def _tothis(self, other): - return other.tocsr() - - -# dictionary of keys based matrix -class dok_matrix(spmatrix, dict): - """ A dictionary of keys based matrix. This is an efficient - structure for constructing sparse matrices for conversion to other - sparse matrix types. - """ - def __init__(self, A=None, shape=None, dtype=None, copy=False): - """ Create a new dictionary-of-keys sparse matrix. An optional - argument A is accepted, which initializes the dok_matrix with it. - This can be a tuple of dimensions (M, N) or a (dense) array - to copy. - """ - dict.__init__(self) - spmatrix.__init__(self,shape) - self.dtype = getdtype(dtype, A, default=float) - if A is not None: - if isinstance(A, tuple): - # Interpret as dimensions - if not isshape(A): - raise TypeError, "dimensions must be a 2-tuple of positive"\ - " integers" - self.shape = A - elif isspmatrix(A): - if isspmatrix_dok(A) and copy: - A = A.copy() - else: - A = A.todok() - self.update( A ) - self.shape = A.shape - self.dtype = A.dtype - elif isdense(A): - self.update( coo_matrix(A).todok() ) - self.shape = A.shape - self.dtype = A.dtype - else: - raise TypeError, "argument should be a tuple of dimensions " \ - "or a sparse or dense matrix" - - def getnnz(self): - return dict.__len__(self) - - def __len__(self): - return dict.__len__(self) - - def __str__(self): - val = '' - nnz = self.getnnz() - keys = self.keys() - keys.sort() - if nnz > self.maxprint: - for k in xrange(self.maxprint / 2): - key = keys[k] - val += " %s\t%s\n" % (str(key), str(self[key])) - val = val + " : \t :\n" - for k in xrange(nnz-self.maxprint/2, nnz): - key = keys[k] - val += " %s\t%s\n" % (str(key), str(self[key])) - else: - for k in xrange(nnz): - key = keys[k] - val += " %s\t%s\n" % (str(key), str(self[key])) - return val[:-1] - - def get(self, key, default=0.): - """This overrides the dict.get method, providing type checking - but otherwise equivalent functionality. - """ - try: - i, j = key - assert isintlike(i) and isintlike(j) - except (AssertionError, TypeError, ValueError): - raise IndexError, "index must be a pair of integers" - try: - assert not (i < 0 or i >= self.shape[0] or j < 0 or - j >= self.shape[1]) - except AssertionError: - raise IndexError, "index out of bounds" - return dict.get(self, key, default) - - def __getitem__(self, key): - """If key=(i,j) is a pair of integers, return the corresponding - element. If either i or j is a slice or sequence, return a new sparse - matrix with just these elements. - """ - try: - i, j = key - except (ValueError, TypeError): - raise TypeError, "index must be a pair of integers or slices" - - - # Bounds checking - if isintlike(i): - if i < 0: - i += self.shape[0] - if i < 0 or i >= self.shape[0]: - raise IndexError, "index out of bounds" - if isintlike(j): - if j < 0: - j += self.shape[1] - if j < 0 or j >= self.shape[1]: - raise IndexError, "index out of bounds" - - # First deal with the case where both i and j are integers - if isintlike(i) and isintlike(j): - return dict.get(self, key, 0.) - else: - # Either i or j is a slice, sequence, or invalid. If i is a slice - # or sequence, unfold it first and call __getitem__ recursively. - - if isinstance(i, slice): - # Is there an easier way to do this? - seq = xrange(i.start or 0, i.stop or self.shape[0], i.step or 1) - elif operator.isSequenceType(i): - seq = i - else: - # Make sure i is an integer. (But allow it to be a subclass of int). - if not isintlike(i): - raise TypeError, "index must be a pair of integers or slices" - seq = None - if seq is not None: - # i is a seq - if isintlike(j): - # Create a new matrix of the correct dimensions - first = seq[0] - last = seq[-1] - if first < 0 or first >= self.shape[0] or last < 0 \ - or last >= self.shape[0]: - raise IndexError, "index out of bounds" - newshape = (last-first+1, 1) - new = dok_matrix(newshape) - # ** This uses linear time in the size m of dimension 0: - # new[0:seq[-1]-seq[0]+1, 0] = \ - # [self.get((element, j), 0) for element in seq] - # ** Instead just add the non-zero elements. This uses - # ** linear time in the number of non-zeros: - for (ii, jj) in self.keys(): - if jj == j and ii >= first and ii <= last: - dict.__setitem__(new, (ii-first, 0), \ - dict.__getitem__(self, (ii,jj))) - else: - ################################### - # We should reshape the new matrix here! - ################################### - raise NotImplementedError, "fancy indexing supported over" \ - " one axis only" - return new - - # Below here, j is a sequence, but i is an integer - if isinstance(j, slice): - # Is there an easier way to do this? - seq = xrange(j.start or 0, j.stop or self.shape[1], j.step or 1) - elif operator.isSequenceType(j): - seq = j - else: - # j is not an integer - raise TypeError, "index must be a pair of integers or slices" - - # Create a new matrix of the correct dimensions - first = seq[0] - last = seq[-1] - if first < 0 or first >= self.shape[1] or last < 0 \ - or last >= self.shape[1]: - raise IndexError, "index out of bounds" - newshape = (1, last-first+1) - new = dok_matrix(newshape) - # ** This uses linear time in the size n of dimension 1: - # new[0, 0:seq[-1]-seq[0]+1] = \ - # [self.get((i, element), 0) for element in seq] - # ** Instead loop over the non-zero elements. This is slower - # ** if there are many non-zeros - for (ii, jj) in self.keys(): - if ii == i and jj >= first and jj <= last: - dict.__setitem__(new, (0, jj-first), \ - dict.__getitem__(self, (ii,jj))) - return new - - - def __setitem__(self, key, value): - try: - assert len(key) == 2 - except (AssertionError, TypeError): - raise TypeError, "index must be a pair of integers, slices, or" \ - " sequences" - i, j = key - - - # First deal with the case where both i and j are integers - if isintlike(i) and isintlike(j): - if i < 0: - i += self.shape[0] - if j < 0: - j += self.shape[1] - - if i < 0 or i >= self.shape[0] or j < 0 or j >= self.shape[1]: - raise IndexError, "index out of bounds" - if isintlike(value) and value == 0: - if key in self.keys(): # get rid of it something already there - del self[key] - else: - # Ensure value is a single element, not a sequence - if isinstance(value, float) or isintlike(value) or \ - isinstance(value, complex): - dict.__setitem__(self, key, self.dtype.type(value)) - newrows = max(self.shape[0], int(key[0])+1) - newcols = max(self.shape[1], int(key[1])+1) - self.shape = (newrows, newcols) - else: - raise TypeError, "cannot set matrix element to non-scalar" - return # done - else: - # Either i or j is a slice, sequence, or invalid. If i is a slice - # or sequence, unfold it first and call __setitem__ recursively. - if isinstance(i, slice): - # Is there an easier way to do this? - seq = xrange(i.start or 0, i.stop or self.shape[0], i.step or 1) - elif operator.isSequenceType(i): - seq = i - else: - # Make sure i is an integer. (But allow it to be a subclass of int). - if not isintlike(i): - raise TypeError, "index must be a pair of integers or slices" - seq = None - if seq is not None: - # First see if 'value' is another dok_matrix of the appropriate - # dimensions - if isinstance(value, dok_matrix): - if value.shape[1] == 1: - for element in seq: - self[element, j] = value[element, 0] - else: - raise NotImplementedError, "setting a 2-d slice of" \ - " a dok_matrix is not yet supported" - elif isscalar(value): - for element in seq: - self[element, j] = value - else: - # See if value is a sequence - try: - if len(seq) != len(value): - raise ValueError, "index and value ranges must" \ - " have the same length" - except TypeError: - # Not a sequence - raise TypeError, "unsupported type for" \ - " dok_matrix.__setitem__" - - # Value is a sequence - for element, val in itertools.izip(seq, value): - self[element, j] = val # don't use dict.__setitem__ - # here, since we still want to be able to delete - # 0-valued keys, do type checking on 'val' (e.g. if - # it's a rank-1 dense array), etc. - else: - # Process j - if isinstance(j, slice): - seq = xrange(j.start or 0, j.stop or self.shape[1], j.step or 1) - elif operator.isSequenceType(j): - seq = j - else: - # j is not an integer - raise TypeError, "index must be a pair of integers or slices" - - # First see if 'value' is another dok_matrix of the appropriate - # dimensions - if isinstance(value, dok_matrix): - if value.shape[0] == 1: - for element in seq: - self[i, element] = value[0, element] - else: - raise NotImplementedError, "setting a 2-d slice of" \ - " a dok_matrix is not yet supported" - elif isscalar(value): - for element in seq: - self[i, element] = value - else: - # See if value is a sequence - try: - if len(seq) != len(value): - raise ValueError, "index and value ranges must have" \ - " the same length" - except TypeError: - # Not a sequence - raise TypeError, "unsupported type for dok_matrix.__setitem__" - else: - for element, val in itertools.izip(seq, value): - self[i, element] = val - - - def __add__(self, other): - # First check if argument is a scalar - if isscalarlike(other): - new = dok_matrix(self.shape, dtype=self.dtype) - # Add this scalar to every element. - M, N = self.shape - for i in xrange(M): - for j in xrange(N): - aij = self.get((i, j), 0) + other - if aij != 0: - new[i, j] = aij - #new.dtype.char = self.dtype.char - elif isinstance(other, dok_matrix): - if other.shape != self.shape: - raise ValueError, "matrix dimensions are not equal" - # We could alternatively set the dimensions to the the largest of - # the two matrices to be summed. Would this be a good idea? - new = dok_matrix(self.shape, dtype=self.dtype) - new.update(self) - for key in other.keys(): - new[key] += other[key] - elif isspmatrix(other): - csc = self.tocsc() - new = csc + other - elif isdense(other): - new = self.todense() + other - else: - raise TypeError, "data type not understood" - return new - - def __radd__(self, other): - # First check if argument is a scalar - if isscalarlike(other): - new = dok_matrix(self.shape, dtype=self.dtype) - # Add this scalar to every element. - M, N = self.shape - for i in xrange(M): - for j in xrange(N): - aij = self.get((i, j), 0) + other - if aij != 0: - new[i, j] = aij - elif isinstance(other, dok_matrix): - if other.shape != self.shape: - raise ValueError, "matrix dimensions are not equal" - new = dok_matrix(self.shape, dtype=self.dtype) - new.update(self) - for key in other: - new[key] += other[key] - elif isspmatrix(other): - csc = self.tocsc() - new = csc + other - elif isdense(other): - new = other + self.todense() - else: - raise TypeError, "data type not understood" - return new - - def __neg__(self): - new = dok_matrix(self.shape, dtype=self.dtype) - for key in self.keys(): - new[key] = -self[key] - return new - - def __mul__(self, other): # self * other - if isscalarlike(other): - new = dok_matrix(self.shape, dtype=self.dtype) - # Multiply this scalar by every element. - for (key, val) in self.iteritems(): - new[key] = val * other - #new.dtype.char = self.dtype.char - return new - else: - return self.dot(other) - - def __imul__(self, other): # self * other - if isscalarlike(other): - # Multiply this scalar by every element. - for (key, val) in self.iteritems(): - self[key] = val * other - #new.dtype.char = self.dtype.char - return self - else: - return NotImplementedError - - def __rmul__(self, other): # other * self - if isscalarlike(other): - new = dok_matrix(self.shape, dtype=self.dtype) - # Multiply this scalar by every element. - for (key, val) in self.iteritems(): - new[key] = other * val - #new.dtype.char = self.dtype.char - return new - else: - # Don't use asarray unless we have to - try: - tr = other.transpose() - except AttributeError: - tr = asarray(other).transpose() - return self.transpose().dot(tr).transpose() - - def __truediv__(self, other): # self * other - if isscalarlike(other): - new = dok_matrix(self.shape, dtype=self.dtype) - # Multiply this scalar by every element. - for (key, val) in self.iteritems(): - new[key] = val / other - #new.dtype.char = self.dtype.char - return new - else: - return self.tocsr() / other - - - def __itruediv__(self, other): # self * other - if isscalarlike(other): - # Multiply this scalar by every element. - for (key, val) in self.iteritems(): - self[key] = val / other - return self - else: - return NotImplementedError - - # What should len(sparse) return? For consistency with dense matrices, - # perhaps it should be the number of rows? For now it returns the number - # of non-zeros. - - def transpose(self): - """ Return the transpose - """ - M, N = self.shape - new = dok_matrix((N, M), dtype=self.dtype) - for key, value in self.iteritems(): - new[key[1], key[0]] = value - return new - - def conjtransp(self): - """ Return the conjugate transpose - """ - M, N = self.shape - new = dok_matrix((N, M), dtype=self.dtype) - for key, value in self.iteritems(): - new[key[1], key[0]] = conj(value) - return new - - def copy(self): - new = dok_matrix(self.shape, dtype=self.dtype) - new.update(self) - new.shape = self.shape - return new - - def take(self, cols_or_rows, columns=1): - # Extract columns or rows as indictated from matrix - # assume cols_or_rows is sorted - new = dok_matrix(dtype=self.dtype) # what should the dimensions be ?! - indx = int((columns == 1)) - N = len(cols_or_rows) - if indx: # columns - for key in self.keys(): - num = searchsorted(cols_or_rows, key[1]) - if num < N: - newkey = (key[0], num) - new[newkey] = self[key] - else: - for key in self.keys(): - num = searchsorted(cols_or_rows, key[0]) - if num < N: - newkey = (num, key[1]) - new[newkey] = self[key] - return new - - def split(self, cols_or_rows, columns=1): - # Similar to take but returns two arrays, the extracted columns plus - # the resulting array. Assumes cols_or_rows is sorted - base = dok_matrix() - ext = dok_matrix() - indx = int((columns == 1)) - if indx: - for key in self.keys(): - num = searchsorted(cols_or_rows, key[1]) - if cols_or_rows[num] == key[1]: - newkey = (key[0], num) - ext[newkey] = self[key] - else: - newkey = (key[0], key[1]-num) - base[newkey] = self[key] - else: - for key in self.keys(): - num = searchsorted(cols_or_rows, key[0]) - if cols_or_rows[num] == key[0]: - newkey = (num, key[1]) - ext[newkey] = self[key] - else: - newkey = (key[0]-num, key[1]) - base[newkey] = self[key] - return base, ext - - - def matvec(self, other): - if isdense(other): - if other.shape[0] != self.shape[1]: - raise ValueError, "dimensions do not match" - new = [0] * self.shape[0] - for key in self.keys(): - new[int(key[0])] += self[key] * other[int(key[1]), ...] - new = array(new) - if isinstance(other, matrix): - new = asmatrix(new) - # Do we need to return the transpose? - if other.shape[1] == 1: - new = new.T - return new - else: - raise TypeError, "need a dense vector" - - def rmatvec(self, other, conjugate=True): - if isdense(other): - if other.shape[-1] != self.shape[0]: - raise ValueError, "dimensions do not match" - new = [0] * self.shape[1] - for key in self.keys(): - new[int(key[1])] += other[..., int(key[0])] * conj(self[key]) - new = array(new) - if isinstance(other, matrix): - new = asmatrix(new) - # Do we need to return the transpose? - if other.shape[1] == 1: - new = new.T - return new - else: - raise TypeError, "need a dense vector" - - def tocoo(self): - """ Return a copy of this matrix in COOrdinate format""" - if self.getnnz() == 0: - return coo_matrix(self.shape,dtype=self.dtype) - else: - data = asarray(self.values(), dtype=self.dtype) - indices = asarray(self.keys(), dtype=intc).T - return coo_matrix((data,indices),dims=self.shape,dtype=self.dtype) - - def todok(self,copy=False): - if copy: - return self.copy() - else: - return self - - def tocsr(self): - """ Return a copy of this matrix in Compressed Sparse Row format""" - return self.tocoo().tocsr() - - def tocsc(self): - """ Return a copy of this matrix in Compressed Sparse Column format""" - return self.tocoo().tocsc() - - def toarray(self): - return self.tocsr().toarray() - - def resize(self, shape): - """ Resize the matrix to dimensions given by 'shape', removing any - non-zero elements that lie outside. - """ - if not isshape(shape): - raise TypeError, "dimensions must be a 2-tuple of positive"\ - " integers" - newM, newN = shape - M, N = self.shape - if newM < M or newN < N: - # Remove all elements outside new dimensions - for (i, j) in self.keys(): - if i >= newM or j >= newN: - del self[i, j] - self.shape = shape - - - -class coo_matrix(spmatrix): - """ A sparse matrix in coordinate list format. - - COO matrices are created either as: - A = coo_matrix( (m, n), [dtype]) - for a zero matrix, or as: - A = coo_matrix(M) - where M is a dense matrix or rank 2 ndarray, or as: - A = coo_matrix((obj, ij), [dims]) - where the dimensions are optional. If supplied, we set (M, N) = dims. - If not supplied, we infer these from the index arrays: - ij[0][:] and ij[1][:] - - The arguments 'obj' and 'ij' represent three arrays: - 1. obj[:] the entries of the matrix, in any order - 2. ij[0][:] the row indices of the matrix entries - 3. ij[1][:] the column indices of the matrix entries - - So the following holds: - A[ij[0][k], ij[1][k] = obj[k] - - Note: - When converting to CSR or CSC format, duplicate (i,j) entries - will be summed together. This facilitates efficient construction - of finite element matrices and the like. - - """ - def __init__(self, arg1, dims=None, dtype=None): - spmatrix.__init__(self) - if isinstance(arg1, tuple): - if isshape(arg1): - M, N = arg1 - self.shape = (M,N) - self.row = array([], dtype=intc) - self.col = array([], dtype=intc) - self.data = array([],getdtype(dtype, default=float)) - else: - try: - obj, ij = arg1 - except: - raise TypeError, "invalid input format" - - try: - if len(ij) != 2: - raise TypeError - except TypeError: - raise TypeError, "invalid input format" - - self.row = asarray(ij[0]) - self.col = asarray(ij[1]) - self.data = asarray(obj) - - if dims is None: - if len(self.row) == 0 or len(self.col) == 0: - raise ValueError, "cannot infer dimensions from zero sized index arrays" - M = self.row.max() + 1 - N = self.col.max() + 1 - self.shape = (M, N) - else: - # Use 2 steps to ensure dims has length 2. - M, N = dims - self.shape = (M, N) - - elif arg1 is None: - # Initialize an empty matrix. - if not isinstance(dims, tuple) or not isintlike(dims[0]): - raise TypeError, "dimensions not understood" - warnings.warn('coo_matrix(None, dims=(M,N)) is deprecated, ' \ - 'use coo_matrix( (M,N) ) instead', \ - DeprecationWarning) - self.shape = dims - self.data = array([],getdtype(dtype, default=float)) - self.row = array([],dtype=intc) - self.col = array([],dtype=intc) - else: - #dense argument - try: - M = asarray(arg1) - except: - raise TypeError, "invalid input format" - - if len(M.shape) != 2: - raise TypeError, "expected rank 2 array or matrix" - self.shape = M.shape - self.row,self.col = (M != 0).nonzero() - self.data = M[self.row,self.col] - - self._check() - - def _get_dtype(self): - return self.data.dtype - def _set_dtype(self,newtype): - self.data.dtype = newtype - dtype = property(fget=_get_dtype,fset=_set_dtype) - - def _check(self): - """ Checks for consistency and stores the number of non-zeros as - self.nnz. - """ - nnz = len(self.data) - if (nnz != len(self.row)) or (nnz != len(self.col)): - raise ValueError, "row, column, and data array must all be "\ - "the same length" - - # index arrays should have integer data types - if self.row.dtype.kind != 'i': - warnings.warn("row index array has non-integer dtype (%s) " \ - % self.row.dtype.name ) - if self.col.dtype.kind != 'i': - warnings.warn("col index array has non-integer dtype (%s) " \ - % self.col.dtype.name ) - - # only support 32-bit ints for now - self.row = self.row.astype('intc') - self.col = self.col.astype('intc') - self.data = to_native(self.data) - - if nnz > 0: - if(amax(self.row) >= self.shape[0]): - raise ValueError, "row index exceedes matrix dimensions" - if(amax(self.col) >= self.shape[1]): - raise ValueError, "column index exceedes matrix dimensions" - if(amin(self.row) < 0): - raise ValueError, "negative row index found" - if(amin(self.col) < 0): - raise ValueError, "negative column index found" - - # some functions pass floats - self.shape = tuple([int(x) for x in self.shape]) - self.nnz = nnz - - - def rowcol(self, num): - return (self.row[num], self.col[num]) - - def getdata(self, num): - return self.data[num] - - def tocsc(self): - if self.nnz == 0: - return csc_matrix(self.shape, dtype=self.dtype) - else: - indptr = empty(self.shape[1] + 1,dtype=intc) - indices = empty(self.nnz, dtype=intc) - data = empty(self.nnz, dtype=upcast(self.dtype)) - - cootocsc(self.shape[0], self.shape[1], self.nnz, \ - self.row, self.col, self.data, \ - indptr, indices, data) - - return csc_matrix((data, indices, indptr), self.shape) - - def tocsr(self): - if self.nnz == 0: - return csr_matrix(self.shape, dtype=self.dtype) - else: - indptr = empty(self.shape[0] + 1,dtype=intc) - indices = empty(self.nnz, dtype=intc) - data = empty(self.nnz, dtype=upcast(self.dtype)) - - cootocsr(self.shape[0], self.shape[1], self.nnz, \ - self.row, self.col, self.data, \ - indptr, indices, data) - - return csr_matrix((data, indices, indptr), self.shape) - - def tocoo(self, copy=False): - return self.toself(copy) - - def todok(self): - dok = dok_matrix((self.shape),dtype=self.dtype) - - try: - izip = itertools.izip - dok.update( izip(izip(self.row,self.col),self.data) ) - except AttributeError: - # the dict() call is for Python 2.3 compatibility - # ideally dok_matrix would accept an iterator - dok.update( dict( zip(zip(self.row,self.col),self.data) ) ) - - return dok - - -class lil_matrix(spmatrix): - """Row-based linked list matrix, by Ed Schofield. - - This contains a list (self.rows) of rows, each of which is a sorted - list of column indices of non-zero elements. It also contains a list - (self.data) of lists of these elements. - """ - - def __init__(self, A=None, shape=None, dtype=None, copy=False): - """ Create a new list-of-lists sparse matrix. An optional - argument A is accepted, which initializes the lil_matrix with it. - This can be a tuple of dimensions (M, N) or a dense array / - matrix to copy, or a sparse matrix of the following types: - - csr_matrix - - lil_matrix - """ - spmatrix.__init__(self) - self.dtype = getdtype(dtype, A, default=float) - - # First get the shape - if A is None: - if not isshape(shape): - raise TypeError, "need a valid shape" - M, N = shape - self.shape = (M,N) - self.rows = numpy.empty((M,), dtype=object) - self.data = numpy.empty((M,), dtype=object) - for i in range(M): - self.rows[i] = [] - self.data[i] = [] - else: - if isshape(A): - M, N = A - self.shape = (M,N) - self.rows = numpy.empty((M,), dtype=object) - self.data = numpy.empty((M,), dtype=object) - for i in range(M): - self.rows[i] = [] - self.data[i] = [] - else: - if isspmatrix(A): - if isspmatrix_lil(A) and copy: - A = A.copy() - else: - A = A.tolil() - else: - #assume A is dense - try: - A = asmatrix(A) - except TypeError: - raise TypeError, "unsupported matrix type" - else: - A = csr_matrix(A).tolil() - - #A is a lil matrix - self.shape = A.shape - self.dtype = A.dtype - self.rows = A.rows - self.data = A.data - - def __iadd__(self,other): - self[:,:] = self + other - return self - - def __isub__(self,other): - self[:,:] = self - other - return self - - def __imul__(self,other): - if isscalarlike(other): - self[:,:] = self * other - return self - else: - raise NotImplementedError - - def __itruediv__(self,other): - if isscalarlike(other): - self[:,:] = self / other - return self - else: - raise NotImplementedError - - # Whenever the dimensions change, empty lists should be created for each - # row - - def getnnz(self): - return sum([len(rowvals) for rowvals in self.data]) - - def __str__(self): - val = '' - for i, row in enumerate(self.rows): - for pos, j in enumerate(row): - val += " %s\t%s\n" % (str((i, j)), str(self.data[i][pos])) - return val[:-1] - - #def __repr__(self): - # format = self.getformat() - # return "<%dx%d sparse matrix with %d stored "\ - # "elements in %s format>" % \ - # (self.shape + (self.getnnz(), _formats[format][1])) - - def getrowview(self, i): - """Returns a view of the 'i'th row (without copying). - """ - new = lil_matrix((1, self.shape[1]), dtype=self.dtype) - new.rows[0] = self.rows[i] - new.data[0] = self.data[i] - return new - - def getrow(self, i): - """Returns a copy of the 'i'th row. - """ - new = lil_matrix((1, self.shape[1]), dtype=self.dtype) - new.rows[0] = self.rows[i][:] - new.data[0] = self.data[i][:] - return new - - def _get1(self, i, j): - row = self.rows[i] - data = self.data[i] - - if j < 0: - j += self.shape[1] - - if j < 0 or j > self.shape[1]: - raise IndexError,'column index out of bounds' - - pos = bisect_left(row, j) - if pos != len(data) and row[pos] == j: - return data[pos] - else: - return 0 - - def _slicetoseq(self, j, shape): - if j.start is not None and j.start < 0: - start = shape + j.start - elif j.start is None: - start = 0 - else: - start = j.start - if j.stop is not None and j.stop < 0: - stop = shape + j.stop - elif j.stop is None: - stop = shape - else: - stop = j.stop - j = range(start, stop, j.step or 1) - return j - - - def __getitem__(self, index): - """Return the element(s) index=(i, j), where j may be a slice. - This always returns a copy for consistency, since slices into - Python lists return copies. - """ - try: - i, j = index - except (AssertionError, TypeError): - raise IndexError, "invalid index" - - if isscalar(i): - if isscalar(j): - return self._get1(i, j) - if isinstance(j, slice): - j = self._slicetoseq(j, self.shape[1]) - if issequence(j): - return self.__class__([[self._get1(i, jj) for jj in j]]) - elif issequence(i) and issequence(j): - return self.__class__([[self._get1(ii, jj) for (ii, jj) in zip(i, j)]]) - elif issequence(i) or isinstance(i, slice): - if isinstance(i, slice): - i = self._slicetoseq(i, self.shape[0]) - if isscalar(j): - return self.__class__([[self._get1(ii, j)] for ii in i]) - if isinstance(j, slice): - j = self._slicetoseq(j, self.shape[1]) - if issequence(j): - return self.__class__([[self._get1(ii, jj) for jj in j] for ii in i]) - else: - raise IndexError - - - def _insertat(self, i, j, x): - """ helper for __setitem__: insert a value at (i,j) where i, j and x - are all scalars """ - row = self.rows[i] - data = self.data[i] - self._insertat2(row, data, j, x) - - def _insertat2(self, row, data, j, x): - """ helper for __setitem__: insert a value in the given row/data at - column j. """ - - if j < 0: #handle negative column indices - j += self.shape[1] - - if j < 0 or j >= self.shape[1]: - raise IndexError,'column index out of bounds' - - pos = bisect_left(row, j) - if x != 0: - if pos == len(row): - row.append(j) - data.append(x) - elif row[pos] != j: - row.insert(pos, j) - data.insert(pos, x) - else: - data[pos] = x - else: - if pos < len(row) and row[pos] == j: - del row[pos] - del data[pos] - - - def _insertat3(self, row, data, j, x): - """ helper for __setitem__ """ - if isinstance(j, slice): - j = self._slicetoseq(j, self.shape[1]) - if issequence(j): - if isinstance(x, spmatrix): - x = x.todense() - x = numpy.asarray(x).squeeze() - if isscalar(x) or x.size == 1: - for jj in j: - self._insertat2(row, data, jj, x) - else: - # x must be one D. maybe check these things out - for jj, xx in zip(j, x): - self._insertat2(row, data, jj, xx) - elif isscalar(j): - self._insertat2(row, data, j, x) - else: - raise ValueError, "invalid column value: %s" % str(j) - - - def __setitem__(self, index, x): - if isscalar(x): - x = self.dtype.type(x) - elif not isinstance(x, spmatrix): - x = numpy.asarray(x, dtype=self.dtype) - - try: - i, j = index - except (ValueError, TypeError): - raise IndexError, "invalid index" - - if isscalar(i): - row = self.rows[i] - data = self.data[i] - self._insertat3(row, data, j, x) - elif issequence(i) and issequence(j): - if isscalar(x): - for ii, jj in zip(i, j): - self._insertat(ii, jj, x) - else: - for ii, jj, xx in zip(i, j, x): - self._insertat(ii, jj, xx) - elif isinstance(i, slice) or issequence(i): - rows = self.rows[i] - datas = self.data[i] - if isscalar(x): - for row, data in zip(rows, datas): - self._insertat3(row, data, j, x) - else: - for row, data, xx in zip(rows, datas, x): - self._insertat3(row, data, j, xx) - else: - raise ValueError, "invalid index value: %s" % str((i, j)) - - def __mul__(self, other): # self * other - if isscalarlike(other): - if other == 0: - # Multiply by zero: return the zero matrix - new = lil_matrix(shape=self.shape, dtype=self.dtype) - else: - new = self.copy() - # Multiply this scalar by every element. - new.data = numpy.array([[val*other for val in rowvals] for - rowvals in new.data], dtype=object) - return new - else: - return self.dot(other) - - def __truediv__(self, other): # self / other - if isscalarlike(other): - new = self.copy() - # Divide every element by this scalar - new.data = numpy.array([[val/other for val in rowvals] for - rowvals in new.data], dtype=object) - return new - else: - return self.tocsr() / other - - def multiply(self, other): - """Point-wise multiplication by another lil_matrix. - - """ - if isscalar(other): - return self.__mul__(other) - - if isspmatrix_lil(other): - reference,target = self,other - - if reference.shape != target.shape: - raise ValueError("Dimensions do not match.") - - if len(reference.data) > len(target.data): - reference,target = target,reference - - new = lil_matrix(reference.shape) - for r,row in enumerate(reference.rows): - tr = target.rows[r] - td = target.data[r] - rd = reference.data[r] - L = len(tr) - for c,column in enumerate(row): - ix = bisect_left(tr,column) - if ix < L and tr[ix] == column: - new.rows[r].append(column) - new.data[r].append(rd[c] * td[ix]) - return new - else: - raise ValueError("Point-wise multiplication only allowed " - "with another lil_matrix.") - - def copy(self): - new = lil_matrix(self.shape, dtype=self.dtype) - new.data = copy.deepcopy(self.data) - new.rows = copy.deepcopy(self.rows) - return new - - def reshape(self,shape): - new = lil_matrix(shape,dtype=self.dtype) - j_max = self.shape[1] - for i,row in enumerate(self.rows): - for col,j in enumerate(row): - new_r,new_c = unravel_index(i*j_max + j,shape) - new[new_r,new_c] = self[i,j] - return new - - def __add__(self, other): - if isscalar(other) and other != 0: - raise ValueError("Refusing to destroy sparsity. " - "Use x.todense() + c instead.") - else: - return spmatrix.__add__(self, other) - - def __rmul__(self, other): # other * self - if isscalarlike(other): - # Multiplication by a scalar is symmetric - return self.__mul__(other) - else: - return spmatrix.__rmul__(self, other) - - - def toarray(self): - d = zeros(self.shape, dtype=self.dtype) - for i, row in enumerate(self.rows): - for pos, j in enumerate(row): - d[i, j] = self.data[i][pos] - return d - - def transpose(self): - """ Return the transpose as a csc_matrix. - """ - # Overriding the spmatrix.transpose method here prevents an unnecessary - # csr -> csc conversion - return self.tocsr().transpose() - - def tolil(self, copy=False): - if copy: - return self.copy() - else: - return self - - def tocsr(self): - """ Return Compressed Sparse Row format arrays for this matrix. - """ - - indptr = asarray([len(x) for x in self.rows], dtype=intc) - indptr = concatenate( ( array([0],dtype=intc), cumsum(indptr) ) ) - - nnz = indptr[-1] - - indices = [] - for x in self.rows: - indices.extend(x) - indices = asarray(indices,dtype=intc) - - data = [] - for x in self.data: - data.extend(x) - data = asarray(data,dtype=self.dtype) - - return csr_matrix((data, indices, indptr), dims=self.shape) - - def tocsc(self): - """ Return Compressed Sparse Column format arrays for this matrix. - """ - return self.tocsr().tocsc() - - - -# symmetric sparse skyline -# diagonal (banded) matrix -# ellpack-itpack generalized diagonal -# block sparse row -# modified compressed sparse row -# block sparse column -# modified compressed sparse column -# symmetric skyline -# nonsymmetric skyline -# jagged diagonal -# unsymmetric sparse skyline -# variable block row - - - - -def _isinstance(x, _class): - ## - # This makes scipy.sparse.sparse.csc_matrix == __main__.csc_matrix. - c1 = ('%s' % x.__class__).split( '.' ) - c2 = ('%s' % _class).split( '.' ) - aux = c1[-1] == c2[-1] - return isinstance(x, _class) or aux - -def isspmatrix(x): - return _isinstance(x, spmatrix) - -issparse = isspmatrix - -def isspmatrix_csr(x): - return _isinstance(x, csr_matrix) - -def isspmatrix_csc(x): - return _isinstance(x, csc_matrix) - -def isspmatrix_dok(x): - return _isinstance(x, dok_matrix) - -def isspmatrix_lil( x ): - return _isinstance(x, lil_matrix) - -def isspmatrix_coo( x ): - return _isinstance(x, coo_matrix) - -def isdense(x): - return _isinstance(x, ndarray) - -def isscalarlike(x): - """Is x either a scalar, an array scalar, or a 0-dim array?""" - return isscalar(x) or (isdense(x) and x.ndim == 0) - -def isintlike(x): - """Is x appropriate as an index into a sparse matrix? Returns True - if it can be cast safely to a machine int. - """ - try: - if int(x) == x: - return True - else: - return False - except TypeError: - return False - -def isshape(x): - """Is x a valid 2-tuple of dimensions? - """ - try: - # Assume it's a tuple of matrix dimensions (M, N) - (M, N) = x - assert isintlike(M) and isintlike(N) # raises TypeError unless integers - assert M > 0 and N > 0 - except (ValueError, TypeError, AssertionError): - return False - else: - return True - -def issequence(t): - return isinstance(t, (list, tuple))\ - or (isinstance(t, ndarray) and (t.ndim == 1)) - -def getdtype(dtype, a=None, default=None): - """Function used to simplify argument processing. If 'dtype' is not - specified (is None), returns a.dtype; otherwise returns a numpy.dtype - object created from the specified dtype argument. If 'dtype' and 'a' - are both None, construct a data type out of the 'default' parameter. - Furthermore, 'dtype' must be in 'allowed' set. - """ - canCast = True - if dtype is None: - try: - newdtype = a.dtype - except AttributeError: - if default is not None: - newdtype = numpy.dtype(default) - canCast = False - else: - raise TypeError, "could not interpret data type" - else: - newdtype = numpy.dtype(dtype) - - return newdtype - - Modified: trunk/scipy/sparse/spfuncs.py =================================================================== --- trunk/scipy/sparse/spfuncs.py 2007-12-13 22:51:45 UTC (rev 3642) +++ trunk/scipy/sparse/spfuncs.py 2007-12-14 02:58:33 UTC (rev 3643) @@ -3,8 +3,9 @@ from numpy import empty -from sparse import isspmatrix_csr, isspmatrix_csc, isspmatrix -from sparse import upcast +from base import isspmatrix +from compressed import isspmatrix_csr, isspmatrix_csc +from sputils import upcast import sparsetools Added: trunk/scipy/sparse/sputils.py =================================================================== --- trunk/scipy/sparse/sputils.py 2007-12-13 22:51:45 UTC (rev 3642) +++ trunk/scipy/sparse/sputils.py 2007-12-14 02:58:33 UTC (rev 3643) @@ -0,0 +1,120 @@ +""" Utility functions for sparse matrix module +""" + +__all__ = ['getdtype','isscalarlike','isintlike', + 'isshape','issequence','isdense'] + +import numpy + +# keep this list syncronized with sparsetools +supported_dtypes = ['int8','uint8','int16','int32','int64', + 'float32','float64','complex64','complex128'] +supported_dtypes = [ numpy.typeDict[x] for x in supported_dtypes] + +def upcast(*args): + """Returns the nearest supported sparse dtype for the + combination of one or more types. + + upcast(t0, t1, ..., tn) -> T where T is a supported dtype + + *Example* + ------- + + >>> upcast('int32') + + >>> upcast('bool') + + >>> upcast('int32','float32') + + >>> upcast('bool',complex,float) + + + """ + sample = numpy.array([0],dtype=args[0]) + for t in args[1:]: + sample = sample + numpy.array([0],dtype=t) + + upcast = sample.dtype + + for t in supported_dtypes: + if upcast <= t: + return t + + raise TypeError,'no supported conversion for types: %s' % args + + +#TODO handle this in SWIG +def to_native(A): + if not A.dtype.isnative: + return A.astype(A.dtype.newbyteorder('native')) + else: + return A + + +def getdtype(dtype, a=None, default=None): + """Function used to simplify argument processing. If 'dtype' is not + specified (is None), returns a.dtype; otherwise returns a numpy.dtype + object created from the specified dtype argument. If 'dtype' and 'a' + are both None, construct a data type out of the 'default' parameter. + Furthermore, 'dtype' must be in 'allowed' set. + """ + canCast = True + if dtype is None: + try: + newdtype = a.dtype + except AttributeError: + if default is not None: + newdtype = numpy.dtype(default) + canCast = False + else: + raise TypeError, "could not interpret data type" + else: + newdtype = numpy.dtype(dtype) + + return newdtype + +def isscalarlike(x): + """Is x either a scalar, an array scalar, or a 0-dim array?""" + return numpy.isscalar(x) or (isdense(x) and x.ndim == 0) + +def isintlike(x): + """Is x appropriate as an index into a sparse matrix? Returns True + if it can be cast safely to a machine int. + """ + try: + if int(x) == x: + return True + else: + return False + except TypeError: + return False + +def isshape(x): + """Is x a valid 2-tuple of dimensions? + """ + try: + # Assume it's a tuple of matrix dimensions (M, N) + (M, N) = x + assert isintlike(M) and isintlike(N) # raises TypeError unless integers + assert M > 0 and N > 0 + except (ValueError, TypeError, AssertionError): + return False + else: + return True + +def issequence(t): + return isinstance(t, (list, tuple))\ + or (isinstance(t, numpy.ndarray) and (t.ndim == 1)) + + +def _isinstance(x, _class): + ## + # This makes scipy.sparse.sparse.csc_matrix == __main__.csc_matrix. + c1 = ('%s' % x.__class__).split( '.' ) + c2 = ('%s' % _class).split( '.' ) + aux = c1[-1] == c2[-1] + return isinstance(x, _class) or aux + +def isdense(x): + return _isinstance(x, numpy.ndarray) + From scipy-svn at scipy.org Thu Dec 13 22:45:19 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 13 Dec 2007 21:45:19 -0600 (CST) Subject: [Scipy-svn] r3644 - in trunk/scipy/sparse: . tests Message-ID: <20071214034519.E4C0439C06D@new.scipy.org> Author: wnbell Date: 2007-12-13 21:45:15 -0600 (Thu, 13 Dec 2007) New Revision: 3644 Modified: trunk/scipy/sparse/base.py trunk/scipy/sparse/tests/test_sparse.py Log: TestCOO now runs most _TestCS unittests get/set tests were seperated from others Modified: trunk/scipy/sparse/base.py =================================================================== --- trunk/scipy/sparse/base.py 2007-12-14 02:58:33 UTC (rev 3643) +++ trunk/scipy/sparse/base.py 2007-12-14 03:45:15 UTC (rev 3644) @@ -4,7 +4,7 @@ from numpy import asarray, asmatrix, ones -from sputils import isdense +from sputils import isdense, isscalarlike # The formats that we might potentially understand. Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-14 02:58:33 UTC (rev 3643) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-14 03:45:15 UTC (rev 3644) @@ -32,11 +32,6 @@ self.dat = matrix([[1,0,0,2],[3,0,1,0],[0,2,0,0]],'d') self.datsp = self.spmatrix(self.dat) - def check_getelement(self): - assert_equal(self.datsp[0,0],1) - assert_equal(self.datsp[0,1],0) - assert_equal(self.datsp[1,0],3) - assert_equal(self.datsp[2,1],2) def check_empty(self): """Test manipulating empty matrices. Fails in SciPy SVN <= r1768 @@ -104,14 +99,6 @@ check2 = dot(self.datsp.toarray(), b) assert_array_equal(dense_dot_dense, check2) - def check_setelement(self): - a = self.datsp - self.datsp - a[1,2] = 4.0 - a[0,1] = 3 - a[2,0] = 2.0 - a[0,-1] = 8 - a[-1,-2] = 7 - assert_array_equal(a.todense(),[[0,3,0,8],[0,0,4,0],[2,0,7,0]]) def check_mul_scalar(self): assert_array_equal(self.dat*2,(self.datsp*2).todense()) @@ -270,12 +257,14 @@ L = 30 frac = .3 random.seed(0) # make runs repeatable - A = self.spmatrix((L,2)) + A = zeros((L,2)) for i in xrange(L): for j in xrange(2): r = random.random() if r < frac: A[i,j] = r/frac + + A = self.spmatrix(A) B = A*A.T assert_array_almost_equal(B.todense(), A.todense() * A.T.todense()) assert_array_almost_equal(B.todense(), A.todense() * A.todense().T) @@ -382,6 +371,36 @@ # dense_dot_sparse = dot(self.datsp, b) # assert_array_equal(dense_dot_dense, dense_dot_sparse) + + def check_extract_diagonal(self): + """ + Test extraction of main diagonal from sparse matrices + """ + L = [] + L.append(array([[0,0,3],[1,6,4],[5,2,0]])) + L.append(array([[1,2,3]])) + L.append(array([[7],[6],[5]])) + L.append(array([[2]])) + + for A in L: + assert_array_equal(numpy.diag(A),extract_diagonal(self.spmatrix(A))) +class _TestGetSet: + def check_setelement(self): + a = self.datsp - self.datsp + a[1,2] = 4.0 + a[0,1] = 3 + a[2,0] = 2.0 + a[0,-1] = 8 + a[-1,-2] = 7 + assert_array_equal(a.todense(),[[0,3,0,8],[0,0,4,0],[2,0,7,0]]) + + def check_getelement(self): + assert_equal(self.datsp[0,0],1) + assert_equal(self.datsp[0,1],0) + assert_equal(self.datsp[1,0],3) + assert_equal(self.datsp[2,1],2) + +class _TestSolve: def check_solve(self): """ Test whether the lu_solve command segfaults, as reported by Nils Wagner for a 64-bit machine, 02 March 2005 (EJS) @@ -400,20 +419,7 @@ xx = splu(B).solve(r) # Don't actually test the output until we know what it should be ... - def check_extract_diagonal(self): - """ - Test extraction of main diagonal from sparse matrices - """ - L = [] - L.append(array([[0,0,3],[1,6,4],[5,2,0]])) - L.append(array([[1,2,3]])) - L.append(array([[7],[6],[5]])) - L.append(array([[2]])) - for A in L: - assert_array_equal(numpy.diag(A),extract_diagonal(self.spmatrix(A))) - - class _TestHorizSlicing: """Tests horizontal slicing (e.g. [:, 0]). Tests for individual sparse matrix types that implement this should derive from this class. @@ -675,7 +681,8 @@ class TestCSR(_TestCS, _TestHorizSlicing, _TestVertSlicing, - _test_slicing, _test_arith, NumpyTestCase): + _TestGetSet, _TestSolve, + _test_slicing, _test_arith, NumpyTestCase): spmatrix = csr_matrix def check_constructor1(self): @@ -772,6 +779,7 @@ assert_equal( ab, aa[i0,i1[0]:i1[1]] ) class TestCSC(_TestCS, _TestHorizSlicing, _TestVertSlicing, + _TestGetSet, _TestSolve, _test_slicing, _test_arith, NumpyTestCase): spmatrix = csc_matrix @@ -844,7 +852,7 @@ assert_equal(b.shape, (2,2)) assert_equal( ab, aa[i0,i1[0]:i1[1]] ) -class TestDOK(_TestCS, NumpyTestCase): +class TestDOK(_TestCS, _TestGetSet, _TestSolve, NumpyTestCase): spmatrix = dok_matrix def check_mult(self): @@ -951,8 +959,8 @@ assert_equal(caught,5) -class TestLIL(_TestCS, _TestHorizSlicing, NumpyTestCase, - ParametricTestCase): +class TestLIL(_TestCS, _TestHorizSlicing, _TestGetSet, _TestSolve, + NumpyTestCase, ParametricTestCase): spmatrix = lil_matrix B = lil_matrix((4,3)) @@ -1175,7 +1183,8 @@ assert_array_equal(result,expected) -class TestCOO(NumpyTestCase): +class TestCOO(_TestCS, NumpyTestCase): + spmatrix = coo_matrix def check_constructor1(self): """unsorted triplet format""" row = numpy.array([2, 3, 1, 3, 0, 1, 3, 0, 2, 1, 2]) From scipy-svn at scipy.org Fri Dec 14 00:20:25 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 13 Dec 2007 23:20:25 -0600 (CST) Subject: [Scipy-svn] r3645 - trunk/scipy/sparse/tests Message-ID: <20071214052025.3D8F039C133@new.scipy.org> Author: wnbell Date: 2007-12-13 23:20:23 -0600 (Thu, 13 Dec 2007) New Revision: 3645 Modified: trunk/scipy/sparse/tests/test_sparse.py Log: removed benchmarking and construction tests from test_sparse Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-14 03:45:15 UTC (rev 3644) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-14 05:20:23 UTC (rev 3645) @@ -21,17 +21,17 @@ import random from numpy.testing import * set_package_path() -from scipy.sparse import csc_matrix, csr_matrix, dok_matrix, coo_matrix, \ - spidentity, speye, spkron, extract_diagonal, lil_matrix, lil_eye, \ - lil_diags, spdiags +from scipy.sparse import csc_matrix, csr_matrix, dok_matrix, \ + coo_matrix, lil_matrix, extract_diagonal, speye from scipy.linsolve import splu restore_path() -class _TestCS: +class _TestCommon: + """test common functionality shared by all sparse formats""" + def setUp(self): self.dat = matrix([[1,0,0,2],[3,0,1,0],[0,2,0,0]],'d') self.datsp = self.spmatrix(self.dat) - def check_empty(self): """Test manipulating empty matrices. Fails in SciPy SVN <= r1768 @@ -680,7 +680,7 @@ -class TestCSR(_TestCS, _TestHorizSlicing, _TestVertSlicing, +class TestCSR(_TestCommon, _TestHorizSlicing, _TestVertSlicing, _TestGetSet, _TestSolve, _test_slicing, _test_arith, NumpyTestCase): spmatrix = csr_matrix @@ -778,7 +778,7 @@ assert b.shape == (2,2) assert_equal( ab, aa[i0,i1[0]:i1[1]] ) -class TestCSC(_TestCS, _TestHorizSlicing, _TestVertSlicing, +class TestCSC(_TestCommon, _TestHorizSlicing, _TestVertSlicing, _TestGetSet, _TestSolve, _test_slicing, _test_arith, NumpyTestCase): spmatrix = csc_matrix @@ -852,7 +852,7 @@ assert_equal(b.shape, (2,2)) assert_equal( ab, aa[i0,i1[0]:i1[1]] ) -class TestDOK(_TestCS, _TestGetSet, _TestSolve, NumpyTestCase): +class TestDOK(_TestCommon, _TestGetSet, _TestSolve, NumpyTestCase): spmatrix = dok_matrix def check_mult(self): @@ -959,7 +959,7 @@ assert_equal(caught,5) -class TestLIL(_TestCS, _TestHorizSlicing, _TestGetSet, _TestSolve, +class TestLIL(_TestCommon, _TestHorizSlicing, _TestGetSet, _TestSolve, NumpyTestCase, ParametricTestCase): spmatrix = lil_matrix @@ -1104,86 +1104,8 @@ [0,16,0]]) - def check_lil_diags(self): - assert_array_equal(lil_diags([[1,2,3],[4,5],[6]], - [0,1,2],(3,3)).todense(), - [[1,4,6], - [0,2,5], - [0,0,3]]) - assert_array_equal(lil_diags([[6],[4,5],[1,2,3]], - [2,1,0],(3,3)).todense(), - [[1,4,6], - [0,2,5], - [0,0,3]]) - - assert_array_equal(lil_diags([[6,7,8],[4,5],[1,2,3]], - [2,1,0],(3,3)).todense(), - [[1,4,6], - [0,2,5], - [0,0,3]]) - - assert_array_equal(lil_diags([[1,2,3],[4,5],[6]], - [0,-1,-2],(3,3)).todense(), - [[1,0,0], - [4,2,0], - [6,5,3]]) - - assert_array_equal(lil_diags([[6,7,8],[4,5]], - [-2,-1],(3,3)).todense(), - [[0,0,0], - [4,0,0], - [6,5,0]]) - -class TestConstructUtils(NumpyTestCase): - def check_identity(self): - a = spidentity(3) - b = array([[1, 0, 0], [0, 1, 0], [0, 0, 1]], dtype='d') - assert_array_equal(a.toarray(), b) - - def check_eye(self): - a = speye(2, 3 ) -# print a, a.__repr__ - b = array([[1, 0, 0], [0, 1, 0]], dtype='d') - assert_array_equal(a.toarray(), b) - - a = speye(3, 2) -# print a, a.__repr__ - b = array([[1, 0], [0, 1], [0, 0]], dtype='d') - assert_array_equal( a.toarray(), b) - - a = speye(3, 3) -# print a, a.__repr__ - b = array([[1, 0, 0], [0, 1, 0], [0, 0, 1]], dtype='d') - assert_array_equal(a.toarray(), b) - - def check_spkron(self): - from numpy import kron - - cases = [] - - cases.append(array([[ 0]])) - cases.append(array([[-1]])) - cases.append(array([[ 4]])) - cases.append(array([[10]])) - cases.append(array([[0],[0]])) - cases.append(array([[0,0]])) - cases.append(array([[1,2],[3,4]])) - cases.append(array([[0,2],[5,0]])) - cases.append(array([[0,2,-6],[8,0,14]])) - cases.append(array([[5,4],[0,0],[6,0]])) - cases.append(array([[5,4,4],[1,0,0],[6,0,8]])) - cases.append(array([[0,1,0,2,0,5,8]])) - cases.append(array([[0.5,0.125,0,3.25],[0,2.5,0,0]])) - - for a in cases: - for b in cases: - result = spkron(csr_matrix(a),csr_matrix(b)).todense() - expected = kron(a,b) - - assert_array_equal(result,expected) - -class TestCOO(_TestCS, NumpyTestCase): +class TestCOO(_TestCommon, NumpyTestCase): spmatrix = coo_matrix def check_constructor1(self): """unsorted triplet format""" @@ -1225,134 +1147,6 @@ coo = coo_matrix(mat) assert_array_equal(mat,coo.todense()) -def poisson2d(N,epsilon=1.0): - """ - Return a sparse CSR matrix for the 2d poisson problem - with standard 5-point finite difference stencil on a - square N-by-N grid. - """ - - D = (2 + 2*epsilon)*ones(N*N) - T = -epsilon * ones(N*N) - O = -ones(N*N) - T[N-1::N] = 0 - return spdiags([D,O,T,T,O],[0,-N,-1,1,N],N*N,N*N).tocoo().tocsr() #eliminate explicit zeros - - -import time -class TestSparseTools(NumpyTestCase): - """Simple benchmarks for sparse matrix module""" - - def bench_matvec(self,level=5): - matrices = [] - matrices.append(('Identity',spidentity(10**5))) - matrices.append(('Poisson5pt', poisson2d(250))) - matrices.append(('Poisson5pt', poisson2d(500))) - matrices.append(('Poisson5pt', poisson2d(1000))) - - print - print ' Sparse Matrix Vector Product' - print '==================================================================' - print ' type | name | shape | nnz | MFLOPs ' - print '------------------------------------------------------------------' - fmt = ' %3s | %12s | %20s | %8d | %6.1f ' - - for name,A in matrices: - A = A.tocsr() - - x = ones(A.shape[1],dtype=A.dtype) - - y = A*x #warmup - - start = time.clock() - iter = 0 - while iter < 5 or time.clock() < start + 1: - y = A*x - iter += 1 - end = time.clock() - - name = name.center(12) - shape = ("%s" % (A.shape,)).center(20) - MFLOPs = (2*A.nnz*iter/(end-start))/float(1e6) - - print fmt % (A.format,name,shape,A.nnz,MFLOPs) - - def bench_construction(self,level=5): - """build matrices by inserting single values""" - matrices = [] - matrices.append( ('Empty',csr_matrix((10000,10000))) ) - matrices.append( ('Identity',spidentity(10000)) ) - matrices.append( ('Poisson5pt', poisson2d(100)) ) - - print - print ' Sparse Matrix Construction' - print '====================================================================' - print ' type | name | shape | nnz | time (sec) ' - print '--------------------------------------------------------------------' - fmt = ' %3s | %12s | %20s | %8d | %6.4f ' - - for name,A in matrices: - A = A.tocoo() - - for format in ['lil','dok']: - - start = time.clock() - iter = 0 - while time.clock() < start + 0.1: - T = eval(format + '_matrix')(A.shape) - for i,j,v in zip(A.row,A.col,A.data): - T[i,j] = v - iter += 1 - end = time.clock() - - del T - name = name.center(12) - shape = ("%s" % (A.shape,)).center(20) - - print fmt % (format,name,shape,A.nnz,(end-start)/float(iter)) - - - def bench_conversion(self,level=5): - A = poisson2d(100) - - formats = ['csr','csc','coo','lil','dok'] - - print - print ' Sparse Matrix Conversion' - print '==========================================================' - print ' format | tocsr() | tocsc() | tocoo() | tolil() | todok() ' - print '----------------------------------------------------------' - - for fromfmt in formats: - base = getattr(A,'to' + fromfmt)() - - times = [] - - for tofmt in formats: - try: - fn = getattr(base,'to' + tofmt) - except: - times.append(None) - else: - x = fn() #warmup - start = time.clock() - iter = 0 - while time.clock() < start + 0.2: - x = fn() - iter += 1 - end = time.clock() - del x - times.append( (end - start)/float(iter)) - - output = " %3s " % fromfmt - for t in times: - if t is None: - output += '| n/a ' - else: - output += '| %5.1fms ' % (1000*t) - print output - - if __name__ == "__main__": NumpyTest().run() From scipy-svn at scipy.org Fri Dec 14 00:24:19 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 13 Dec 2007 23:24:19 -0600 (CST) Subject: [Scipy-svn] r3646 - trunk/scipy/sparse/tests Message-ID: <20071214052419.90BAD39C26F@new.scipy.org> Author: wnbell Date: 2007-12-13 23:24:17 -0600 (Thu, 13 Dec 2007) New Revision: 3646 Added: trunk/scipy/sparse/tests/test_base.py Removed: trunk/scipy/sparse/tests/test_sparse.py Log: Copied: trunk/scipy/sparse/tests/test_base.py (from rev 3645, trunk/scipy/sparse/tests/test_sparse.py) Deleted: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-14 05:20:23 UTC (rev 3645) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-14 05:24:17 UTC (rev 3646) @@ -1,1152 +0,0 @@ -#!/usr/bin/env python -# -# Authors: Travis Oliphant, Ed Schofield, Robert Cimrman, Nathan Bell, and others - -""" Test functions for sparse matrices - -""" -__usage__ = """ -Build sparse: - python setup.py build -Run tests if scipy is installed: - python -c 'import scipy;scipy.sparse.test()' -Run tests if sparse is not installed: - python tests/test_sparse.py [] -""" - -import numpy -from numpy import arange, zeros, array, dot, ones, matrix, asmatrix, \ - asarray, vstack - -import random -from numpy.testing import * -set_package_path() -from scipy.sparse import csc_matrix, csr_matrix, dok_matrix, \ - coo_matrix, lil_matrix, extract_diagonal, speye -from scipy.linsolve import splu -restore_path() - -class _TestCommon: - """test common functionality shared by all sparse formats""" - - def setUp(self): - self.dat = matrix([[1,0,0,2],[3,0,1,0],[0,2,0,0]],'d') - self.datsp = self.spmatrix(self.dat) - - def check_empty(self): - """Test manipulating empty matrices. Fails in SciPy SVN <= r1768 - """ - shape = (5, 5) - for mytype in ['int32', 'float32', 'float64', 'complex64', 'complex128']: - a = self.spmatrix(shape, dtype=mytype) - b = a + a - c = 2 * a - d = a * a.tocsc() - e = a * a.tocsr() - f = a * a.tocoo() - for m in [a,b,c,d,e,f]: - assert_equal(m.A, a.A*a.A) - # These fail in all revisions <= r1768: - assert_equal(m.dtype,mytype) - assert_equal(m.A.dtype,mytype) - - def check_abs(self): - A = matrix([[-1, 0, 17],[0, -5, 0],[1, -4, 0],[0,0,0]],'d') - assert_equal(abs(A),abs(self.spmatrix(A)).todense()) - - def check_neg(self): - A = matrix([[-1, 0, 17],[0, -5, 0],[1, -4, 0],[0,0,0]],'d') - assert_equal(-A,(-self.spmatrix(A)).todense()) - - def check_sum(self): - """Does the matrix's sum(,axis=0) method work? - """ - assert_array_equal(self.dat.sum(), self.datsp.sum()) - assert_array_equal(self.dat.sum(axis=None), self.datsp.sum(axis=None)) - assert_array_equal(self.dat.sum(axis=0), self.datsp.sum(axis=0)) - assert_array_equal(self.dat.sum(axis=1), self.datsp.sum(axis=1)) - - def check_mean(self): - """Does the matrix's mean(,axis=0) method work? - """ - assert_array_equal(self.dat.mean(), self.datsp.mean()) - assert_array_equal(self.dat.mean(axis=None), self.datsp.mean(axis=None)) - assert_array_equal(self.dat.mean(axis=0), self.datsp.mean(axis=0)) - assert_array_equal(self.dat.mean(axis=1), self.datsp.mean(axis=1)) - - def check_todense(self): - chk = self.datsp.todense() - assert_array_equal(chk,self.dat) - a = matrix([1.,2.,3.]) - dense_dot_dense = a * self.dat - check = a * self.datsp.todense() - assert_array_equal(dense_dot_dense, check) - b = matrix([1.,2.,3.,4.]).T - dense_dot_dense = self.dat * b - check2 = self.datsp.todense() * b - assert_array_equal(dense_dot_dense, check2) - - def check_toarray(self): - dat = asarray(self.dat) - chk = self.datsp.toarray() - assert_array_equal(chk, dat) - a = array([1.,2.,3.]) - dense_dot_dense = dot(a, dat) - check = dot(a, self.datsp.toarray()) - assert_array_equal(dense_dot_dense, check) - b = array([1.,2.,3.,4.]) - dense_dot_dense = dot(dat, b) - check2 = dot(self.datsp.toarray(), b) - assert_array_equal(dense_dot_dense, check2) - - - def check_mul_scalar(self): - assert_array_equal(self.dat*2,(self.datsp*2).todense()) - assert_array_equal(self.dat*17.3,(self.datsp*17.3).todense()) - - def check_imul_scalar(self): - a = self.datsp.copy() - a *= 2 - assert_array_equal(self.dat*2,a.todense()) - - a = self.datsp.copy() - a *= 17.3 - assert_array_equal(self.dat*17.3,a.todense()) - - def check_idiv_scalar(self): - a = self.datsp.copy() - a /= 2 - assert_array_equal(self.dat/2,a.todense()) - - a = self.datsp.copy() - a /= 17.3 - assert_array_equal(self.dat/17.3,a.todense()) - - def check_rmul_scalar(self): - assert_array_equal(2*self.dat,(2*self.datsp).todense()) - assert_array_equal(17.3*self.dat,(17.3*self.datsp).todense()) - - def check_add(self): - a = self.datsp - b = self.datsp.copy() - b[0,2] = 2.0 - c = a + b - assert_array_equal(c.todense(),[[2,0,2,4],[6,0,2,0],[0,4,0,0]]) - - def check_radd(self): - a = self.datsp - b = self.datsp.copy() - b[0,2] = 2.0 - c = a.todense() + b - assert_array_equal(c,[[2,0,2,4],[6,0,2,0],[0,4,0,0]]) - - def check_sub(self): - assert_array_equal((self.datsp - self.datsp).todense(),[[0,0,0,0],[0,0,0,0],[0,0,0,0]]) - - A = self.spmatrix(matrix([[1,0,0,4],[-1,0,0,0],[0,8,0,-5]],'d')) - assert_array_equal((self.datsp - A).todense(),self.dat - A.todense()) - assert_array_equal((A - self.datsp).todense(),A.todense() - self.dat) - - def check_rsub(self): - assert_array_equal((self.dat - self.datsp),[[0,0,0,0],[0,0,0,0],[0,0,0,0]]) - assert_array_equal((self.datsp - self.dat),[[0,0,0,0],[0,0,0,0],[0,0,0,0]]) - - A = self.spmatrix(matrix([[1,0,0,4],[-1,0,0,0],[0,8,0,-5]],'d')) - assert_array_equal((self.dat - A),self.dat - A.todense()) - assert_array_equal((A - self.dat),A.todense() - self.dat) - assert_array_equal(A.todense() - self.datsp,A.todense() - self.dat) - assert_array_equal(self.datsp - A.todense(),self.dat - A.todense()) - - def check_elmul(self): - a = self.datsp - b = self.datsp.copy() - b[0,2] = 2.0 - c = a ** b - assert_array_equal(c.todense(),[[1,0,0,4],[9,0,1,0],[0,4,0,0]]) - - def check_eldiv(self): - assert_array_equal((self.datsp / self.datsp).todense(),[[1,0,0,1],[1,0,1,0],[0,1,0,0]]) - - denom = self.spmatrix(matrix([[1,0,0,4],[-1,0,0,0],[0,8,0,-5]],'d')) - res = matrix([[1,0,0,0.5],[-3,0,numpy.inf,0],[0,0.25,0,0]],'d') - assert_array_equal((self.datsp / denom).todense(),res) - - def check_rmatvec(self): - M = self.spmatrix(matrix([[3,0,0],[0,1,0],[2,0,3.0],[2,3,0]])) - assert_array_almost_equal([1,2,3,4]*M, dot([1,2,3,4], M.toarray())) - row = matrix([[1,2,3,4]]) - assert_array_almost_equal(row*M, row*M.todense()) - - def check_matvec(self): - M = self.spmatrix(matrix([[3,0,0],[0,1,0],[2,0,3.0],[2,3,0]])) - col = matrix([1,2,3]).T - assert_array_almost_equal(M * col, M.todense() * col) - - #check result dimensions (ticket #514) - assert_equal((M * array([1,2,3])).shape,(4,)) - assert_equal((M * array([[1],[2],[3]])).shape,(4,1)) - assert_equal((M * matrix([[1],[2],[3]])).shape,(4,1)) - - #ensure exception is raised for improper dimensions - bad_vecs = [array([1,2]), array([1,2,3,4]), array([[1],[2]]), - matrix([1,2,3]), matrix([[1],[2]])] - caught = 0 - for x in bad_vecs: - try: - y = M * x - except ValueError: - caught += 1 - assert_equal(caught,len(bad_vecs)) - - # Should this be supported or not?! - #flat = array([1,2,3]) - #assert_array_almost_equal(M*flat, M.todense()*flat) - # Currently numpy dense matrices promote the result to a 1x3 matrix, - # whereas sparse matrices leave the result as a rank-1 array. Which - # is preferable? - - # Note: the following command does not work. Both NumPy matrices - # and spmatrices should raise exceptions! - # assert_array_almost_equal(M*[1,2,3], M.todense()*[1,2,3]) - - # The current relationship between sparse matrix products and array - # products is as follows: - assert_array_almost_equal(M*array([1,2,3]), dot(M.A,[1,2,3])) - assert_array_almost_equal(M*[[1],[2],[3]], asmatrix(dot(M.A,[1,2,3])).T) - # Note that the result of M * x is dense if x has a singleton dimension. - - # Currently M.matvec(asarray(col)) is rank-1, whereas M.matvec(col) - # is rank-2. Is this desirable? - - def check_matmat_sparse(self): - a = matrix([[3,0,0],[0,1,0],[2,0,3.0],[2,3,0]]) - a2 = array([[3,0,0],[0,1,0],[2,0,3.0],[2,3,0]]) - b = matrix([[0,1],[1,0],[0,2]],'d') - asp = self.spmatrix(a) - bsp = self.spmatrix(b) - assert_array_almost_equal((asp*bsp).todense(), a*b) - assert_array_almost_equal( asp*b, a*b) - assert_array_almost_equal( a*bsp, a*b) - assert_array_almost_equal( a2*bsp, a*b) - - # Now try performing cross-type multplication: - csp = bsp.tocsc() - c = b - assert_array_almost_equal((asp*csp).todense(), a*c) - assert_array_almost_equal((asp.matmat(csp)).todense(), a*c) - assert_array_almost_equal( asp*c, a*c) - - assert_array_almost_equal( a*csp, a*c) - assert_array_almost_equal( a2*csp, a*c) - csp = bsp.tocsr() - assert_array_almost_equal((asp*csp).todense(), a*c) - assert_array_almost_equal((asp.matmat(csp)).todense(), a*c) - assert_array_almost_equal( asp*c, a*c) - - assert_array_almost_equal( a*csp, a*c) - assert_array_almost_equal( a2*csp, a*c) - csp = bsp.tocoo() - assert_array_almost_equal((asp*csp).todense(), a*c) - assert_array_almost_equal((asp.matmat(csp)).todense(), a*c) - assert_array_almost_equal( asp*c, a*c) - - assert_array_almost_equal( a*csp, a*c) - assert_array_almost_equal( a2*csp, a*c) - - # Test provided by Andy Fraser, 2006-03-26 - L = 30 - frac = .3 - random.seed(0) # make runs repeatable - A = zeros((L,2)) - for i in xrange(L): - for j in xrange(2): - r = random.random() - if r < frac: - A[i,j] = r/frac - - A = self.spmatrix(A) - B = A*A.T - assert_array_almost_equal(B.todense(), A.todense() * A.T.todense()) - assert_array_almost_equal(B.todense(), A.todense() * A.todense().T) - - def check_matmat_dense(self): - a = matrix([[3,0,0],[0,1,0],[2,0,3.0],[2,3,0]]) - asp = self.spmatrix(a) - - # check both array and matrix types - bs = [ array([[1,2],[3,4],[5,6]]), matrix([[1,2],[3,4],[5,6]]) ] - - for b in bs: - result = asp*b - assert( isinstance(result, type(b)) ) - assert_equal( result.shape, (4,2) ) - assert_equal( result, dot(a,b) ) - - def check_tocoo(self): - a = self.datsp.tocoo() - assert_array_almost_equal(a.todense(), self.dat) - - def check_tolil(self): - a = self.datsp.tolil() - assert_array_almost_equal(a.todense(), self.dat) - - def check_todok(self): - a = self.datsp.todok() - assert_array_almost_equal(a.todense(), self.dat) - - def check_tocsc(self): - a = self.datsp.tocsc() - assert_array_almost_equal(a.todense(), self.dat) - b = complexsp = self.spmatrix(self.dat+3j) - c = b.tocsc() - assert_array_almost_equal(c.todense(), self.dat+3j) - - def check_tocsr(self): - a = self.datsp.tocsr() - assert_array_almost_equal(a.todense(), self.dat) - - def check_transpose(self): - a = self.datsp.transpose() - b = self.dat.transpose() - assert_array_equal(a.todense(), b) - assert_array_equal(a.transpose().todense(), self.dat) - assert_array_equal(a.transpose().todense(), self.datsp.todense()) - - def check_large(self): - # Create a 100x100 matrix with 100 non-zero elements - # and play around with it - A = dok_matrix((100,100)) - for k in range(100): - i = random.randrange(100) - j = random.randrange(100) - A[i,j] = 1. - csr = A.tocsr() - csc = A.tocsc() - csc2 = csr.tocsc() - coo = A.tocoo() - csr2 = coo.tocsr() - assert_array_equal(A.transpose().todense(), csr.transpose().todense()) - assert_array_equal(csc.todense(), csr.todense()) - assert_array_equal(csr.todense(), csr2.todense()) - assert_array_equal(csr2.todense().transpose(), coo.transpose().todense()) - assert_array_equal(csr2.todense(), csc2.todense()) - csr_plus_csc = csr + csc - csc_plus_csr = csc + csr - assert_array_equal(csr_plus_csc.todense(), (2*A).todense()) - assert_array_equal(csr_plus_csc.todense(), csc_plus_csr.todense()) - - def check_add_dense(self): - """ Check whether adding a dense matrix to a sparse matrix works - """ - sum1 = self.dat + self.datsp - assert_array_equal(sum1, 2*self.dat) - sum2 = self.datsp + self.dat - assert_array_equal(sum2, 2*self.dat) - - def check_sub_dense(self): - """ Check whether adding a dense matrix to a sparse matrix works - """ - sum1 = 3*self.dat - self.datsp - assert_array_equal(sum1, 2*self.dat) - sum2 = 3*self.datsp - self.dat - assert_array_equal(sum2, 2*self.dat) - - - def check_copy(self): - """ Check whether the copy=True and copy=False keywords work - """ - pass - - # Eventually we'd like to allow matrix products between dense - # and sparse matrices using the normal dot() function: - #def check_dense_dot_sparse(self): - # a = array([1.,2.,3.]) - # dense_dot_dense = dot(a, self.dat) - # dense_dot_sparse = dot(a, self.datsp) - # assert_array_equal(dense_dot_dense, dense_dot_sparse) - - #def check_sparse_dot_dense(self): - # b = array([1.,2.,3.,4.]) - # dense_dot_dense = dot(self.dat, b) - # dense_dot_sparse = dot(self.datsp, b) - # assert_array_equal(dense_dot_dense, dense_dot_sparse) - - - def check_extract_diagonal(self): - """ - Test extraction of main diagonal from sparse matrices - """ - L = [] - L.append(array([[0,0,3],[1,6,4],[5,2,0]])) - L.append(array([[1,2,3]])) - L.append(array([[7],[6],[5]])) - L.append(array([[2]])) - - for A in L: - assert_array_equal(numpy.diag(A),extract_diagonal(self.spmatrix(A))) -class _TestGetSet: - def check_setelement(self): - a = self.datsp - self.datsp - a[1,2] = 4.0 - a[0,1] = 3 - a[2,0] = 2.0 - a[0,-1] = 8 - a[-1,-2] = 7 - assert_array_equal(a.todense(),[[0,3,0,8],[0,0,4,0],[2,0,7,0]]) - - def check_getelement(self): - assert_equal(self.datsp[0,0],1) - assert_equal(self.datsp[0,1],0) - assert_equal(self.datsp[1,0],3) - assert_equal(self.datsp[2,1],2) - -class _TestSolve: - def check_solve(self): - """ Test whether the lu_solve command segfaults, as reported by Nils - Wagner for a 64-bit machine, 02 March 2005 (EJS) - """ - n = 20 - A = self.spmatrix((n,n), dtype=complex) - x = numpy.random.rand(n) - y = numpy.random.rand(n-1)+1j*numpy.random.rand(n-1) - r = numpy.random.rand(n) - for i in range(len(x)): - A[i,i] = x[i] - for i in range(len(y)): - A[i,i+1] = y[i] - A[i+1,i] = numpy.conjugate(y[i]) - B = A.tocsc() - xx = splu(B).solve(r) - # Don't actually test the output until we know what it should be ... - - -class _TestHorizSlicing: - """Tests horizontal slicing (e.g. [:, 0]). Tests for individual sparse - matrix types that implement this should derive from this class. - """ - def check_get_horiz_slice(self): - """Test for new slice functionality (EJS)""" - B = asmatrix(arange(50.).reshape(5,10)) - A = self.spmatrix(B) - assert_array_equal(B[1,:], A[1,:].todense()) - assert_array_equal(B[1,2:5], A[1,2:5].todense()) - - C = matrix([[1, 2, 1], [4, 0, 6], [0, 0, 0], [0, 0, 1]]) - D = self.spmatrix(C) - assert_array_equal(C[1, 1:3], D[1, 1:3].todense()) - - # Now test slicing when a row contains only zeros - E = matrix([[1, 2, 1], [4, 0, 0], [0, 0, 0], [0, 0, 1]]) - F = self.spmatrix(E) - assert_array_equal(E[1, 1:3], F[1, 1:3].todense()) - assert_array_equal(E[2, -2:], F[2, -2:].A) - - # The following should raise exceptions: - caught = 0 - try: - a = A[:,11] - except IndexError: - caught += 1 - try: - a = A[6,3:7] - except IndexError: - caught += 1 - assert caught == 2 - - -class _TestVertSlicing: - """Tests vertical slicing (e.g. [:, 0]). Tests for individual sparse - matrix types that implement this should derive from this class. - """ - def check_get_vert_slice(self): - """Test for new slice functionality (EJS)""" - B = asmatrix(arange(50.).reshape(5,10)) - A = self.spmatrix(B) - assert_array_equal(B[2:5,0], A[2:5,0].todense()) - assert_array_equal(B[:,1], A[:,1].todense()) - - C = matrix([[1, 2, 1], [4, 0, 6], [0, 0, 0], [0, 0, 1]]) - D = self.spmatrix(C) - assert_array_equal(C[1:3, 1], D[1:3, 1].todense()) - assert_array_equal(C[:, 2], D[:, 2].todense()) - - # Now test slicing when a column contains only zeros - E = matrix([[1, 0, 1], [4, 0, 0], [0, 0, 0], [0, 0, 1]]) - F = self.spmatrix(E) - assert_array_equal(E[:, 1], F[:, 1].todense()) - assert_array_equal(E[-2:, 2], F[-2:, 2].todense()) - - # The following should raise exceptions: - caught = 0 - try: - a = A[:,11] - except IndexError: - caught += 1 - try: - a = A[6,3:7] - except IndexError: - caught += 1 - assert caught == 2 - -class _test_slicing: - """Tests vertical and horizontal slicing (e.g. [:,0:2]). Tests for - individual sparse matrix types that implement this should derive from this - class. - """ - def check_get_slices(self): - B = asmatrix(arange(50.).reshape(5,10)) - A = self.spmatrix(B) - assert_array_equal(B[2:5,0:3], A[2:5,0:3].todense()) - assert_array_equal(B[1:,:-1], A[1:,:-1].todense()) - assert_array_equal(B[:-1,1:], A[:-1,1:].todense()) - - # Now test slicing when a column contains only zeros - E = matrix([[1, 0, 1], [4, 0, 0], [0, 0, 0], [0, 0, 1]]) - F = self.spmatrix(E) - assert_array_equal(E[1:2, 1:2], F[1:2, 1:2].todense()) - assert_array_equal(E[:, 1:], F[:, 1:].todense()) - -class _test_fancy_indexing: - """Tests fancy indexing features. The tests for any matrix formats - that implement these features should derive from this class. - """ - # This isn't supported by any matrix objects yet: - def check_sequence_indexing(self): - B = asmatrix(arange(50.).reshape(5,10)) - A = self.spmatrix(B) - assert_array_equal(B[(1,2),(3,4)], A[(1,2),(3,4)].todense()) - assert_array_equal(B[(1,2,3),(3,4,5)], A[(1,2,3),(3,4,5)].todense()) - - def check_fancy_indexing(self): - """Test for new indexing functionality""" - B = ones((5,10), float) - A = dok_matrix(B) - # Write me! - - # Both slicing and fancy indexing: not yet supported - # assert_array_equal(B[(1,2),:], A[(1,2),:].todense()) - # assert_array_equal(B[(1,2,3),:], A[(1,2,3),:].todense()) - - -class _test_arith: - """ - Test real/complex arithmetic - """ - def arith_init(self): - #these can be represented exactly in FP (so arithmetic should be exact) - self.A = matrix([[ -1.5, 0, 0, 2.25], - [ 3.125, 0, -0.125, 0], - [ 0, -5.375, 0, 0]],'float64') - self.B = matrix([[ 0, 3.375, 0, -7.875], - [ 6.625, 4.75, 0, 0], - [ 3.5, 6.0625, 0, 1]],'float64') - - self.C = matrix([[ 0.375, 0, -5, 2.5], - [ 0, 7.25, 0, -4.875], - [ 0, -0.0625, 0, 0]],'complex128') - self.C.imag = matrix([[ 1.25, 0, 0, -3.875], - [ 0, 4.125, 0, 2.75], - [ -0.0625, 0, 0, 1]],'float64') - - #fractions are all x/16ths - assert_array_equal((self.A*16).astype('int32'),16*self.A) - assert_array_equal((self.B*16).astype('int32'),16*self.B) - assert_array_equal((self.C.real*16).astype('int32'),16*self.C.real) - assert_array_equal((self.C.imag*16).astype('int32'),16*self.C.imag) - - self.Asp = self.spmatrix(self.A) - self.Bsp = self.spmatrix(self.B) - self.Csp = self.spmatrix(self.C) - - #supported types - self.dtypes = ['int8','uint8','int16','int32','int64', - 'float32','float64','complex64','complex128'] - - def check_conversion(self): - self.arith_init() - - #check whether dtype and value is preserved in conversion - for x in self.dtypes: - A = self.A.astype(x) - B = self.B.astype(x) - C = self.C.astype(x) - - Asp = self.spmatrix(A) - Bsp = self.spmatrix(B) - Csp = self.spmatrix(C) - assert_equal(A.dtype,Asp.dtype) - assert_equal(B.dtype,Bsp.dtype) - assert_equal(C.dtype,Csp.dtype) - assert_array_equal(A,Asp.todense()) - assert_array_equal(B,Bsp.todense()) - assert_array_equal(C,Csp.todense()) - - def check_add_sub(self): - self.arith_init() - - #basic tests - assert_array_equal(self.A+self.B,(self.Asp+self.Bsp).todense()) - assert_array_equal(self.A+self.C,(self.Asp+self.Csp).todense()) - - #check conversions - for x in self.dtypes: - for y in self.dtypes: - A = self.A.astype(x) - B = self.B.astype(y) - C = self.C.astype(y) - - Asp = self.spmatrix(A) - Bsp = self.spmatrix(B) - Csp = self.spmatrix(C) - - #addition - D1 = A + B - D2 = A + C - D3 = B + C - S1 = Asp + Bsp - S2 = Asp + Csp - S3 = Bsp + Csp - - assert_equal(D1.dtype,S1.dtype) - assert_equal(D2.dtype,S2.dtype) - assert_equal(D3.dtype,S3.dtype) - assert_array_equal(D1,S1.todense()) - assert_array_equal(D2,S2.todense()) - assert_array_equal(D3,S3.todense()) - assert_array_equal(D1,Asp + B) #check sparse + dense - assert_array_equal(D2,Asp + C) - assert_array_equal(D3,Bsp + C) - assert_array_equal(D1,A + Bsp) #check dense + sparse - assert_array_equal(D2,A + Csp) - assert_array_equal(D3,B + Csp) - - #subtraction - D1 = A - B - D2 = A - C - D3 = B - C - S1 = Asp - Bsp - S2 = Asp - Csp - S3 = Bsp - Csp - - assert_equal(D1.dtype,S1.dtype) - assert_equal(D2.dtype,S2.dtype) - assert_equal(D3.dtype,S3.dtype) - assert_array_equal(D1,S1.todense()) - assert_array_equal(D2,S2.todense()) - assert_array_equal(D3,S3.todense()) - assert_array_equal(D1,Asp - B) #check sparse - dense - assert_array_equal(D2,Asp - C) - assert_array_equal(D3,Bsp - C) - assert_array_equal(D1,A - Bsp) #check dense - sparse - try: - assert_array_equal(D2,A - Csp) - except: - import pdb; pdb.set_trace() - assert_array_equal(D3,B - Csp) - - - def check_mu(self): - self.arith_init() - - #basic tests - assert_array_equal(self.A*self.B.T,(self.Asp*self.Bsp.T).todense()) - assert_array_equal(self.A*self.C.T,(self.Asp*self.Csp.T).todense()) - - for x in self.dtypes: - for y in self.dtypes: - A = self.A.astype(x) - B = self.B.astype(y) - C = self.C.astype(y) - - Asp = self.spmatrix(A) - Bsp = self.spmatrix(B) - Csp = self.spmatrix(C) - - D1 = A * B.T - D2 = A * C.T - D3 = B * C.T - - S1 = Asp * Bsp.T - S2 = Asp * Csp.T - S3 = Bsp * Csp.T - - assert_array_equal(D1,S1.todense()) - assert_array_equal(D2,S2.todense()) - assert_array_equal(D3,S3.todense()) - assert_equal(D1.dtype,S1.dtype) - assert_equal(D2.dtype,S2.dtype) - assert_equal(D3.dtype,S3.dtype) - - - - -class TestCSR(_TestCommon, _TestHorizSlicing, _TestVertSlicing, - _TestGetSet, _TestSolve, - _test_slicing, _test_arith, NumpyTestCase): - spmatrix = csr_matrix - - def check_constructor1(self): - b = matrix([[0,4,0], - [3,0,0], - [0,2,0]],'d') - bsp = csr_matrix(b) - assert_array_almost_equal(bsp.data,[4,3,2]) - assert_array_equal(bsp.indices,[1,0,1]) - assert_array_equal(bsp.indptr,[0,1,2,3]) - assert_equal(bsp.getnnz(),3) - assert_equal(bsp.getformat(),'csr') - assert_array_equal(bsp.todense(),b) - - def check_constructor2(self): - b = zeros((6,6),'d') - b[3,4] = 5 - bsp = csr_matrix(b) - assert_array_almost_equal(bsp.data,[5]) - assert_array_equal(bsp.indices,[4]) - assert_array_equal(bsp.indptr,[0,0,0,0,1,1,1]) - assert_array_almost_equal(bsp.todense(),b) - - def check_constructor3(self): - b = matrix([[1,0], - [0,2], - [3,0]],'d') - bsp = csr_matrix(b) - assert_array_almost_equal(bsp.data,[1,2,3]) - assert_array_equal(bsp.indices,[0,1,0]) - assert_array_equal(bsp.indptr,[0,1,2,3]) - assert_array_almost_equal(bsp.todense(),b) - -### currently disabled -## def check_constructor4(self): -## """try using int64 indices""" -## data = arange( 6 ) + 1 -## col = array( [1, 2, 1, 0, 0, 2], dtype='int64' ) -## ptr = array( [0, 2, 4, 6], dtype='int64' ) -## -## a = csr_matrix( (data, col, ptr), dims = (3,3) ) -## -## b = matrix([[0,1,2], -## [4,3,0], -## [5,0,6]],'d') -## -## assert_equal(a.indptr.dtype,numpy.dtype('int64')) -## assert_equal(a.indices.dtype,numpy.dtype('int64')) -## assert_array_equal(a.todense(),b) - - def check_constructor4(self): - """using (data, ij) format""" - row = numpy.array([2, 3, 1, 3, 0, 1, 3, 0, 2, 1, 2]) - col = numpy.array([0, 1, 0, 0, 1, 1, 2, 2, 2, 2, 1]) - data = numpy.array([ 6., 10., 3., 9., 1., 4., - 11., 2., 8., 5., 7.]) - - ij = vstack((row,col)) - csr = csr_matrix((data,ij),(4,3)) - assert_array_equal(arange(12).reshape(4,3),csr.todense()) - - def check_constructor5(self): - """infer dimensions from arrays""" - indptr = array([0,1,3,3]) - indices = array([0,5,1,2]) - data = array([1,2,3,4]) - csr = csr_matrix((data, indices, indptr)) - assert_array_equal(csr.shape,(3,6)) - - - def check_sort_indices(self): - data = arange( 5 ) - indices = array( [7, 2, 1, 5, 4] ) - indptr = array( [0, 3, 5] ) - asp = csr_matrix( (data, indices, indptr), dims = (2,10) ) - bsp = asp.copy() - asp.sort_indices( ) - assert_array_equal(asp.indices,[1, 2, 7, 4, 5]) - for ir in range( asp.shape[0] ): - for ic in range( asp.shape[1] ): - assert_equal( asp[ir, ic], bsp[ir, ic] ) - - def check_get_submatrix(self): - a = csr_matrix( array([[1,2,3,4],[1,2,3,5],[0,2,0,1]]) ) - i0 = slice( 0, 2 ) - i1 = ( 1, 3 ) - b = a.get_submatrix( i0, i1 ) - - aa = a.toarray() - ab = b.toarray() - - assert b.dtype == a.dtype - assert b.shape == (2,2) - assert_equal( ab, aa[i0,i1[0]:i1[1]] ) - -class TestCSC(_TestCommon, _TestHorizSlicing, _TestVertSlicing, - _TestGetSet, _TestSolve, - _test_slicing, _test_arith, NumpyTestCase): - spmatrix = csc_matrix - - def check_constructor1(self): - b = matrix([[1,0,0,0],[0,0,1,0],[0,2,0,3]],'d') - bsp = csc_matrix(b) - assert_array_almost_equal(bsp.data,[1,2,1,3]) - assert_array_equal(bsp.indices,[0,2,1,2]) - assert_array_equal(bsp.indptr,[0,1,2,3,4]) - assert_equal(bsp.getnnz(),4) - assert_equal(bsp.shape,b.shape) - assert_equal(bsp.getformat(),'csc') - - def check_constructor2(self): - b = zeros((6,6),'d') - b[2,4] = 5 - bsp = csc_matrix(b) - assert_array_almost_equal(bsp.data,[5]) - assert_array_equal(bsp.indices,[2]) - assert_array_equal(bsp.indptr,[0,0,0,0,0,1,1]) - - def check_constructor3(self): - b = matrix([[1,0],[0,0],[0,2]],'d') - bsp = csc_matrix(b) - assert_array_almost_equal(bsp.data,[1,2]) - assert_array_equal(bsp.indices,[0,2]) - assert_array_equal(bsp.indptr,[0,1,2]) - - def check_constructor4(self): - """using (data, ij) format""" - row = numpy.array([2, 3, 1, 3, 0, 1, 3, 0, 2, 1, 2]) - col = numpy.array([0, 1, 0, 0, 1, 1, 2, 2, 2, 2, 1]) - data = numpy.array([ 6., 10., 3., 9., 1., 4., - 11., 2., 8., 5., 7.]) - - ij = vstack((row,col)) - csc = csc_matrix((data,ij),(4,3)) - assert_array_equal(arange(12).reshape(4,3),csc.todense()) - - def check_constructor5(self): - """infer dimensions from arrays""" - indptr = array([0,1,3,3]) - indices = array([0,5,1,2]) - data = array([1,2,3,4]) - csc = csc_matrix((data, indices, indptr)) - assert_array_equal(csc.shape,(6,3)) - - def check_sort_indices(self): - data = arange( 5 ) - row = array( [7, 2, 1, 5, 4] ) - ptr = [0, 3, 5] - asp = csc_matrix( (data, row, ptr), dims = (10,2) ) - bsp = asp.copy() - asp.sort_indices() - assert_array_equal(asp.indices,[1, 2, 7, 4, 5]) - for ir in range( asp.shape[0] ): - for ic in range( asp.shape[1] ): - assert_equal( asp[ir, ic], bsp[ir, ic] ) - - def check_get_submatrix(self): - a = csc_matrix( array([[1,2,3,4],[1,2,3,5],[0,2,0,1]]) ) - i0 = slice( 0, 2 ) - i1 = ( 1, 3 ) - b = a.get_submatrix( i0, i1 ) - - aa = a.toarray() - ab = b.toarray() - - assert_equal(b.dtype, a.dtype) - assert_equal(b.shape, (2,2)) - assert_equal( ab, aa[i0,i1[0]:i1[1]] ) - -class TestDOK(_TestCommon, _TestGetSet, _TestSolve, NumpyTestCase): - spmatrix = dok_matrix - - def check_mult(self): - A = dok_matrix((10,10)) - A[0,3] = 10 - A[5,6] = 20 - D = A*A.T - E = A*A.H - assert_array_equal(D.A, E.A) - - def check_add(self): - A = dok_matrix((3,2)) - A[0,1] = -10 - A[2,0] = 20 - A = A + 10 - B = matrix([[10, 0], [10, 10], [30, 10]]) - assert_array_equal(A.todense(), B) - - def check_convert(self): - """Test provided by Andrew Straw. Fails in SciPy <= r1477. - """ - (m, n) = (6, 7) - a=dok_matrix((m, n)) - - # set a few elements, but none in the last column - a[2,1]=1 - a[0,2]=2 - a[3,1]=3 - a[1,5]=4 - a[4,3]=5 - a[4,2]=6 - - # assert that the last column is all zeros - assert_array_equal( a.toarray()[:,n-1], zeros(m,) ) - - # make sure it still works for CSC format - csc=a.tocsc() - assert_array_equal( csc.toarray()[:,n-1], zeros(m,) ) - - # now test CSR - (m, n) = (n, m) - b = a.transpose() - assert_equal(b.shape, (m, n)) - # assert that the last row is all zeros - assert_array_equal( b.toarray()[m-1,:], zeros(n,) ) - - # make sure it still works for CSR format - csr=b.tocsr() - assert_array_equal( csr.toarray()[m-1,:], zeros(n,)) - - def check_set_slice(self): - """Test for slice functionality (EJS)""" - A = dok_matrix((5,10)) - B = zeros((5,10), float) - A[:,0] = 1 - B[:,0] = 1 - assert_array_equal(A.todense(), B) - A[1,:] = 2 - B[1,:] = 2 - assert_array_equal(A.todense(), B) - A[:,:] = 3 - B[:,:] = 3 - assert_array_equal(A.todense(), B) - A[1:5, 3] = 4 - B[1:5, 3] = 4 - assert_array_equal(A.todense(), B) - A[1, 3:6] = 5 - B[1, 3:6] = 5 - assert_array_equal(A.todense(), B) - A[1:4, 3:6] = 6 - B[1:4, 3:6] = 6 - assert_array_equal(A.todense(), B) - A[1, 3:10:3] = 7 - B[1, 3:10:3] = 7 - assert_array_equal(A.todense(), B) - A[1:5, 0] = range(1,5) - B[1:5, 0] = range(1,5) - assert_array_equal(A.todense(), B) - A[0, 1:10:2] = xrange(1,10,2) - B[0, 1:10:2] = xrange(1,10,2) - assert_array_equal(A.todense(), B) - caught = 0 - # The next 6 commands should raise exceptions - try: - A[0,0] = range(100) - except TypeError: - caught += 1 - try: - A[0,0] = arange(100) - except TypeError: - caught += 1 - try: - A[0,:] = range(100) - except ValueError: - caught += 1 - try: - A[:,1] = range(100) - except ValueError: - caught += 1 - try: - A[:,1] = A.copy() - except: - caught += 1 - assert_equal(caught,5) - - -class TestLIL(_TestCommon, _TestHorizSlicing, _TestGetSet, _TestSolve, - NumpyTestCase, ParametricTestCase): - spmatrix = lil_matrix - - B = lil_matrix((4,3)) - B[0,0] = 2 - B[1,2] = 7 - B[2,1] = 3 - B[3,0] = 10 - - def check_dot(self): - A = matrix(zeros((10,10))) - A[0,3] = 10 - A[5,6] = 20 - - B = lil_matrix((10,10)) - B[0,3] = 10 - B[5,6] = 20 - assert_array_equal(A * A.T, (B * B.T).todense()) - assert_array_equal(A * A.H, (B * B.H).todense()) - - def check_scalar_mul(self): - x = lil_matrix((3,3)) - x[0,0] = 2 - - x = x*2 - assert_equal(x[0,0],4) - - x = x*0 - assert_equal(x[0,0],0) - - def check_reshape(self): - x = lil_matrix((4,3)) - x[0,0] = 1 - x[2,1] = 3 - x[3,2] = 5 - x[0,2] = 7 - - for s in [(12,1),(1,12)]: - assert_array_equal(x.reshape(s).todense(), - x.todense().reshape(s)) - - def check_lil_lil_assignment(self): - """ Tests whether a row of one lil_matrix can be assigned to - another. - """ - B = self.B.copy() - A = B / 10 - B[0,:] = A[0,:] - assert_array_equal(A[0,:].A, B[0,:].A) - - def tst_inplace_op(self,op,arr,other,result): - cpy = arr - getattr(arr,"__i%s__" % op)(other) - - assert_array_equal(cpy.todense(),arr.todense()) - assert_array_equal(arr.todense(),result) - - def testip_inplace_ops(self): - B = self.B[:3,:3].copy() - B[:,:] = B-B - C = B.todense() - - data = {'add':(B,C+C), - 'sub':(B,zeros(B.shape)), - 'mul':(3,C*3)} - - return [(self.tst_inplace_op,op,B,other,result) - for op,(other,result) in data.iteritems()] - - def check_lil_slice_assignment(self): - B = lil_matrix((4,3)) - B[0,0] = 5 - B[1,2] = 3 - B[2,1] = 7 - - expected = array([[10,0,0], - [0,0,6], - [0,14,0], - [0,0,0]]) - - B[:,:] = B+B - assert_array_equal(B.todense(),expected) - - block = [[1,0],[0,4]] - B[:2,:2] = csc_matrix(array(block)) - assert_array_equal(B.todense()[:2,:2],block) - - def check_lil_sequence_assignement(self): - A = lil_matrix((4,3)) - B = speye(3,4,format='lil') - - i0 = [0,1,2] - i1 = (0,1,2) - i2 = array( i0 ) - - A[0,i0] = B[i0,0] - A[1,i1] = B[i1,1] - A[2,i2] = B[i2,2] - assert_array_equal(A.todense(),B.T.todense()) - - def check_lil_iteration(self): - row_data = [[1,2,3],[4,5,6]] - B = lil_matrix(array(row_data)) - for r,row in enumerate(B): - assert_array_equal(row.todense(),array(row_data[r],ndmin=2)) - - def check_lil_from_csr(self): - """ Tests whether a lil_matrix can be constructed from a - csr_matrix. - """ - B = lil_matrix((10,10)) - B[0,3] = 10 - B[5,6] = 20 - B[8,3] = 30 - B[3,8] = 40 - B[8,9] = 50 - C = B.tocsr() - D = lil_matrix(C) - assert_array_equal(C.A, D.A) - - def check_point_wise_multiply(self): - l = lil_matrix((4,3)) - l[0,0] = 1 - l[1,1] = 2 - l[2,2] = 3 - l[3,1] = 4 - - m = lil_matrix((4,3)) - m[0,0] = 1 - m[0,1] = 2 - m[2,2] = 3 - m[3,1] = 4 - m[3,2] = 4 - - assert_array_equal(l.multiply(m).todense(), - m.multiply(l).todense()) - - assert_array_equal(l.multiply(m).todense(), - [[1,0,0], - [0,0,0], - [0,0,9], - [0,16,0]]) - - - -class TestCOO(_TestCommon, NumpyTestCase): - spmatrix = coo_matrix - def check_constructor1(self): - """unsorted triplet format""" - row = numpy.array([2, 3, 1, 3, 0, 1, 3, 0, 2, 1, 2]) - col = numpy.array([0, 1, 0, 0, 1, 1, 2, 2, 2, 2, 1]) - data = numpy.array([ 6., 10., 3., 9., 1., 4., - 11., 2., 8., 5., 7.]) - - coo = coo_matrix((data,(row,col)),(4,3)) - - assert_array_equal(arange(12).reshape(4,3),coo.todense()) - - def check_constructor2(self): - """unsorted triplet format with duplicates (which are summed)""" - row = numpy.array([0,1,2,2,2,2,0,0,2,2]) - col = numpy.array([0,2,0,2,1,1,1,0,0,2]) - data = numpy.array([2,9,-4,5,7,0,-1,2,1,-5]) - coo = coo_matrix((data,(row,col)),(3,3)) - - mat = matrix([[4,-1,0],[0,0,9],[-3,7,0]]) - - assert_array_equal(mat,coo.todense()) - - def check_constructor3(self): - """empty matrix""" - coo = coo_matrix( (4,3) ) - - assert_array_equal(coo.shape,(4,3)) - assert_array_equal(coo.row,[]) - assert_array_equal(coo.col,[]) - assert_array_equal(coo.data,[]) - assert_array_equal(zeros((4,3)),coo.todense()) - - def check_constructor4(self): - """from dense matrix""" - mat = numpy.array([[0,1,0,0], - [7,0,3,0], - [0,4,0,0]]) - coo = coo_matrix(mat) - assert_array_equal(mat,coo.todense()) - - -if __name__ == "__main__": - NumpyTest().run() From scipy-svn at scipy.org Fri Dec 14 00:44:12 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 13 Dec 2007 23:44:12 -0600 (CST) Subject: [Scipy-svn] r3647 - in trunk/scipy/sparse: . tests Message-ID: <20071214054412.47B4A39C0A0@new.scipy.org> Author: wnbell Date: 2007-12-13 23:44:09 -0600 (Thu, 13 Dec 2007) New Revision: 3647 Added: trunk/scipy/sparse/tests/test_construct.py trunk/scipy/sparse/tests/test_sparse.py Modified: trunk/scipy/sparse/__init__.py Log: reorganized unittests Modified: trunk/scipy/sparse/__init__.py =================================================================== --- trunk/scipy/sparse/__init__.py 2007-12-14 05:24:17 UTC (rev 3646) +++ trunk/scipy/sparse/__init__.py 2007-12-14 05:44:09 UTC (rev 3647) @@ -1,4 +1,4 @@ -"Rudimentary sparse matrix class" +"Sparse Matrix Support" from info import __doc__ Added: trunk/scipy/sparse/tests/test_construct.py =================================================================== --- trunk/scipy/sparse/tests/test_construct.py 2007-12-14 05:24:17 UTC (rev 3646) +++ trunk/scipy/sparse/tests/test_construct.py 2007-12-14 05:44:09 UTC (rev 3647) @@ -0,0 +1,95 @@ +"""test sparse matrix construction functions""" + +import numpy +from numpy import array +from numpy.testing import * + +set_package_path() +from scipy.sparse import csc_matrix, csr_matrix, dok_matrix, coo_matrix, \ + spidentity, speye, spkron, extract_diagonal, lil_matrix, lil_eye, \ + lil_diags, spdiags +from scipy.linsolve import splu +restore_path() + +class TestConstructUtils(NumpyTestCase): + def check_identity(self): + a = spidentity(3) + b = array([[1, 0, 0], [0, 1, 0], [0, 0, 1]], dtype='d') + assert_array_equal(a.toarray(), b) + + def check_eye(self): + a = speye(2, 3 ) +# print a, a.__repr__ + b = array([[1, 0, 0], [0, 1, 0]], dtype='d') + assert_array_equal(a.toarray(), b) + + a = speye(3, 2) +# print a, a.__repr__ + b = array([[1, 0], [0, 1], [0, 0]], dtype='d') + assert_array_equal( a.toarray(), b) + + a = speye(3, 3) +# print a, a.__repr__ + b = array([[1, 0, 0], [0, 1, 0], [0, 0, 1]], dtype='d') + assert_array_equal(a.toarray(), b) + + def check_spkron(self): + from numpy import kron + + cases = [] + + cases.append(array([[ 0]])) + cases.append(array([[-1]])) + cases.append(array([[ 4]])) + cases.append(array([[10]])) + cases.append(array([[0],[0]])) + cases.append(array([[0,0]])) + cases.append(array([[1,2],[3,4]])) + cases.append(array([[0,2],[5,0]])) + cases.append(array([[0,2,-6],[8,0,14]])) + cases.append(array([[5,4],[0,0],[6,0]])) + cases.append(array([[5,4,4],[1,0,0],[6,0,8]])) + cases.append(array([[0,1,0,2,0,5,8]])) + cases.append(array([[0.5,0.125,0,3.25],[0,2.5,0,0]])) + + for a in cases: + for b in cases: + result = spkron(csr_matrix(a),csr_matrix(b)).todense() + expected = kron(a,b) + + assert_array_equal(result,expected) + + def check_lil_diags(self): + assert_array_equal(lil_diags([[1,2,3],[4,5],[6]], + [0,1,2],(3,3)).todense(), + [[1,4,6], + [0,2,5], + [0,0,3]]) + + assert_array_equal(lil_diags([[6],[4,5],[1,2,3]], + [2,1,0],(3,3)).todense(), + [[1,4,6], + [0,2,5], + [0,0,3]]) + + assert_array_equal(lil_diags([[6,7,8],[4,5],[1,2,3]], + [2,1,0],(3,3)).todense(), + [[1,4,6], + [0,2,5], + [0,0,3]]) + + assert_array_equal(lil_diags([[1,2,3],[4,5],[6]], + [0,-1,-2],(3,3)).todense(), + [[1,0,0], + [4,2,0], + [6,5,3]]) + + assert_array_equal(lil_diags([[6,7,8],[4,5]], + [-2,-1],(3,3)).todense(), + [[0,0,0], + [4,0,0], + [6,5,0]]) + +if __name__ == "__main__": + NumpyTest().run() + Added: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-14 05:24:17 UTC (rev 3646) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-14 05:44:09 UTC (rev 3647) @@ -0,0 +1,147 @@ +"""general tests and simple benchmarks for the sparse module""" + +import numpy +from numpy import ones + +import random +from numpy.testing import * +set_package_path() +from scipy.sparse import csc_matrix, csr_matrix, dok_matrix, \ + coo_matrix, lil_matrix, spidentity, spdiags +from scipy.linsolve import splu +restore_path() + + +def poisson2d(N,epsilon=1.0): + """ + Return a sparse CSR matrix for the 2d poisson problem + with standard 5-point finite difference stencil on a + square N-by-N grid. + """ + + D = (2 + 2*epsilon)*ones(N*N) + T = -epsilon * ones(N*N) + O = -ones(N*N) + T[N-1::N] = 0 + return spdiags([D,O,T,T,O],[0,-N,-1,1,N],N*N,N*N).tocoo().tocsr() #eliminate explicit zeros + + +import time +class TestSparseTools(NumpyTestCase): + """Simple benchmarks for sparse matrix module""" + + def test_matvec(self,level=5): + matrices = [] + matrices.append(('Identity',spidentity(10**5))) + matrices.append(('Poisson5pt', poisson2d(250))) + matrices.append(('Poisson5pt', poisson2d(500))) + matrices.append(('Poisson5pt', poisson2d(1000))) + + print + print ' Sparse Matrix Vector Product' + print '==================================================================' + print ' type | name | shape | nnz | MFLOPs ' + print '------------------------------------------------------------------' + fmt = ' %3s | %12s | %20s | %8d | %6.1f ' + + for name,A in matrices: + A = A.tocsr() + + x = ones(A.shape[1],dtype=A.dtype) + + y = A*x #warmup + + start = time.clock() + iter = 0 + while iter < 5 or time.clock() < start + 1: + y = A*x + iter += 1 + end = time.clock() + + name = name.center(12) + shape = ("%s" % (A.shape,)).center(20) + MFLOPs = (2*A.nnz*iter/(end-start))/float(1e6) + + print fmt % (A.format,name,shape,A.nnz,MFLOPs) + + def bench_construction(self,level=5): + """build matrices by inserting single values""" + matrices = [] + matrices.append( ('Empty',csr_matrix((10000,10000))) ) + matrices.append( ('Identity',spidentity(10000)) ) + matrices.append( ('Poisson5pt', poisson2d(100)) ) + + print + print ' Sparse Matrix Construction' + print '====================================================================' + print ' type | name | shape | nnz | time (sec) ' + print '--------------------------------------------------------------------' + fmt = ' %3s | %12s | %20s | %8d | %6.4f ' + + for name,A in matrices: + A = A.tocoo() + + for format in ['lil','dok']: + + start = time.clock() + + iter = 0 + while time.clock() < start + 0.1: + T = eval(format + '_matrix')(A.shape) + for i,j,v in zip(A.row,A.col,A.data): + T[i,j] = v + iter += 1 + end = time.clock() + + del T + name = name.center(12) + shape = ("%s" % (A.shape,)).center(20) + + print fmt % (format,name,shape,A.nnz,(end-start)/float(iter)) + + + def bench_conversion(self,level=5): + A = poisson2d(100) + + formats = ['csr','csc','coo','lil','dok'] + + print + print ' Sparse Matrix Conversion' + print '==========================================================' + print ' format | tocsr() | tocsc() | tocoo() | tolil() | todok() ' + print '----------------------------------------------------------' + + for fromfmt in formats: + base = getattr(A,'to' + fromfmt)() + + times = [] + + for tofmt in formats: + try: + fn = getattr(base,'to' + tofmt) + except: + times.append(None) + else: + x = fn() #warmup + start = time.clock() + iter = 0 + while time.clock() < start + 0.2: + x = fn() + iter += 1 + end = time.clock() + del x + times.append( (end - start)/float(iter)) + + output = " %3s " % fromfmt + for t in times: + if t is None: + output += '| n/a ' + else: + output += '| %5.1fms ' % (1000*t) + print output + + + +if __name__ == "__main__": + NumpyTest().run() + From scipy-svn at scipy.org Fri Dec 14 01:55:05 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 14 Dec 2007 00:55:05 -0600 (CST) Subject: [Scipy-svn] r3648 - trunk/scipy/sparse/tests Message-ID: <20071214065505.6DFF439C0A0@new.scipy.org> Author: wnbell Date: 2007-12-14 00:55:02 -0600 (Fri, 14 Dec 2007) New Revision: 3648 Modified: trunk/scipy/sparse/tests/test_base.py Log: small changes to unittests Modified: trunk/scipy/sparse/tests/test_base.py =================================================================== --- trunk/scipy/sparse/tests/test_base.py 2007-12-14 05:44:09 UTC (rev 3647) +++ trunk/scipy/sparse/tests/test_base.py 2007-12-14 06:55:02 UTC (rev 3648) @@ -16,7 +16,7 @@ import numpy from numpy import arange, zeros, array, dot, ones, matrix, asmatrix, \ - asarray, vstack + asarray, vstack, ndarray import random from numpy.testing import * @@ -74,6 +74,10 @@ assert_array_equal(self.dat.mean(axis=0), self.datsp.mean(axis=0)) assert_array_equal(self.dat.mean(axis=1), self.datsp.mean(axis=1)) + def check_fromdense(self): + A = matrix([[1,0,0],[2,3,4],[0,5,0],[0,0,0]]) + assert_array_equal(self.spmatrix(A).todense(),A) + def check_todense(self): chk = self.datsp.todense() assert_array_equal(chk,self.dat) @@ -187,6 +191,11 @@ assert_equal((M * array([[1],[2],[3]])).shape,(4,1)) assert_equal((M * matrix([[1],[2],[3]])).shape,(4,1)) + #check result type + assert(isinstance( M * array([1,2,3]), ndarray)) + assert(isinstance( M * matrix([1,2,3]).T, matrix)) + + #ensure exception is raised for improper dimensions bad_vecs = [array([1,2]), array([1,2,3,4]), array([[1],[2]]), matrix([1,2,3]), matrix([[1],[2]])] @@ -384,6 +393,8 @@ for A in L: assert_array_equal(numpy.diag(A),extract_diagonal(self.spmatrix(A))) + + class _TestGetSet: def check_setelement(self): a = self.datsp - self.datsp @@ -406,7 +417,8 @@ Wagner for a 64-bit machine, 02 March 2005 (EJS) """ n = 20 - A = self.spmatrix((n,n), dtype=complex) + numpy.random.seed(0) #make tests repeatable + A = zeros((n,n), dtype=complex) x = numpy.random.rand(n) y = numpy.random.rand(n-1)+1j*numpy.random.rand(n-1) r = numpy.random.rand(n) @@ -415,13 +427,13 @@ for i in range(len(y)): A[i,i+1] = y[i] A[i+1,i] = numpy.conjugate(y[i]) - B = A.tocsc() - xx = splu(B).solve(r) - # Don't actually test the output until we know what it should be ... + A = self.spmatrix(A) + x = splu(A).solve(r) + assert_almost_equal(A*x,r) class _TestHorizSlicing: - """Tests horizontal slicing (e.g. [:, 0]). Tests for individual sparse + """Tests horizontal slicing (e.g. [0, :]). Tests for individual sparse matrix types that implement this should derive from this class. """ def check_get_horiz_slice(self): @@ -488,7 +500,7 @@ caught += 1 assert caught == 2 -class _test_slicing: +class _TestBothSlicing: """Tests vertical and horizontal slicing (e.g. [:,0:2]). Tests for individual sparse matrix types that implement this should derive from this class. @@ -506,7 +518,7 @@ assert_array_equal(E[1:2, 1:2], F[1:2, 1:2].todense()) assert_array_equal(E[:, 1:], F[:, 1:].todense()) -class _test_fancy_indexing: +class _TestFancyIndexing: """Tests fancy indexing features. The tests for any matrix formats that implement these features should derive from this class. """ @@ -528,7 +540,7 @@ # assert_array_equal(B[(1,2,3),:], A[(1,2,3),:].todense()) -class _test_arith: +class _TestArithmetic: """ Test real/complex arithmetic """ @@ -638,10 +650,7 @@ assert_array_equal(D2,Asp - C) assert_array_equal(D3,Bsp - C) assert_array_equal(D1,A - Bsp) #check dense - sparse - try: - assert_array_equal(D2,A - Csp) - except: - import pdb; pdb.set_trace() + assert_array_equal(D2,A - Csp) assert_array_equal(D3,B - Csp) @@ -679,10 +688,9 @@ - -class TestCSR(_TestCommon, _TestHorizSlicing, _TestVertSlicing, - _TestGetSet, _TestSolve, - _test_slicing, _test_arith, NumpyTestCase): +class TestCSR(_TestCommon, _TestGetSet, _TestSolve, _TestArithmetic, + _TestHorizSlicing, _TestVertSlicing, _TestBothSlicing, + NumpyTestCase): spmatrix = csr_matrix def check_constructor1(self): @@ -761,9 +769,7 @@ bsp = asp.copy() asp.sort_indices( ) assert_array_equal(asp.indices,[1, 2, 7, 4, 5]) - for ir in range( asp.shape[0] ): - for ic in range( asp.shape[1] ): - assert_equal( asp[ir, ic], bsp[ir, ic] ) + assert_array_equal(asp.todense(),bsp.todense()) def check_get_submatrix(self): a = csr_matrix( array([[1,2,3,4],[1,2,3,5],[0,2,0,1]]) ) @@ -778,9 +784,9 @@ assert b.shape == (2,2) assert_equal( ab, aa[i0,i1[0]:i1[1]] ) -class TestCSC(_TestCommon, _TestHorizSlicing, _TestVertSlicing, - _TestGetSet, _TestSolve, - _test_slicing, _test_arith, NumpyTestCase): +class TestCSC(_TestCommon, _TestGetSet, _TestSolve, _TestArithmetic, + _TestHorizSlicing, _TestVertSlicing, _TestBothSlicing, + NumpyTestCase): spmatrix = csc_matrix def check_constructor1(self): @@ -835,9 +841,7 @@ bsp = asp.copy() asp.sort_indices() assert_array_equal(asp.indices,[1, 2, 7, 4, 5]) - for ir in range( asp.shape[0] ): - for ic in range( asp.shape[1] ): - assert_equal( asp[ir, ic], bsp[ir, ic] ) + assert_array_equal(asp.todense(),bsp.todense()) def check_get_submatrix(self): a = csc_matrix( array([[1,2,3,4],[1,2,3,5],[0,2,0,1]]) ) @@ -959,8 +963,9 @@ assert_equal(caught,5) -class TestLIL(_TestCommon, _TestHorizSlicing, _TestGetSet, _TestSolve, - NumpyTestCase, ParametricTestCase): +class TestLIL( _TestCommon, _TestHorizSlicing, _TestVertSlicing, + _TestBothSlicing, _TestGetSet, _TestSolve, _TestArithmetic, + NumpyTestCase): spmatrix = lil_matrix B = lil_matrix((4,3)) From scipy-svn at scipy.org Fri Dec 14 04:42:34 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 14 Dec 2007 03:42:34 -0600 (CST) Subject: [Scipy-svn] r3649 - in trunk/scipy/sparse: . tests Message-ID: <20071214094234.4DC6DC7C0D8@new.scipy.org> Author: wnbell Date: 2007-12-14 03:42:19 -0600 (Fri, 14 Dec 2007) New Revision: 3649 Added: trunk/scipy/sparse/dia.py Modified: trunk/scipy/sparse/__init__.py trunk/scipy/sparse/base.py trunk/scipy/sparse/dok.py trunk/scipy/sparse/tests/test_base.py trunk/scipy/sparse/tests/test_sparse.py Log: added DIAgonal sparse matrix format Modified: trunk/scipy/sparse/__init__.py =================================================================== --- trunk/scipy/sparse/__init__.py 2007-12-14 06:55:02 UTC (rev 3648) +++ trunk/scipy/sparse/__init__.py 2007-12-14 09:42:19 UTC (rev 3649) @@ -7,6 +7,7 @@ from lil import * from dok import * from coo import * +from dia import * from construct import * from spfuncs import * Modified: trunk/scipy/sparse/base.py =================================================================== --- trunk/scipy/sparse/base.py 2007-12-14 06:55:02 UTC (rev 3648) +++ trunk/scipy/sparse/base.py 2007-12-14 09:42:19 UTC (rev 3649) @@ -374,6 +374,9 @@ def tolil(self): return self.tocsr().tolil() + def todia(self): + return self.tocoo().todia() + def toself(self, copy=False): if copy: new = self.copy() Added: trunk/scipy/sparse/dia.py =================================================================== --- trunk/scipy/sparse/dia.py 2007-12-14 06:55:02 UTC (rev 3648) +++ trunk/scipy/sparse/dia.py 2007-12-14 09:42:19 UTC (rev 3649) @@ -0,0 +1,192 @@ +"""Sparse DIAgonal format""" + +__all__ = ['dia_matrix','isspmatrix_dia'] + +from numpy import asarray, asmatrix, matrix, zeros, arange, unique, \ + searchsorted, intc + +from base import spmatrix, isspmatrix, isdense +from sputils import isscalarlike, isshape, upcast, getdtype + +from sets import Set + +class dia_matrix(spmatrix): + #TODO add description/motivation + def __init__(self, arg1, shape=None, dtype=None, copy=False): + spmatrix.__init__(self) + + if isdense(arg1) or isspmatrix(arg1): + #convert to COO first, then to DIA + from coo import coo_matrix + if isdense(arg1): + A = coo_matrix(arg1) + elif arg1.format in ['csr','csc','coo']: + A = arg1.tocoo(copy=False) + else: + A = arg1.tocoo() + + ks = A.col - A.row #the offset for each nonzero + offsets = unique(ks) + + if len(offsets) > 10: + pass #do something + + #initialize and fill in diags array + diags_shape = (len(offsets), A.col.max()+1) + diags_dtype = getdtype(dtype, default=A.data.dtype) + diags = zeros(diags_shape, dtype=diags_dtype) + diags[ searchsorted(offsets,ks), A.col ] = A.data + + self.diags,self.offsets = diags,offsets + self.shape = A.shape + elif isinstance(arg1, tuple): + if isshape(arg1): + # It's a tuple of matrix dimensions (M, N) + # create empty matrix + self.shape = arg1 #spmatrix checks for errors here + self.diags = zeros( (0,0), getdtype(dtype, default=float)) + self.offsets = zeros( (0), dtype=intc) + else: + try: + # Try interpreting it as (diags, offsets) + data, offsets = arg1 + except: + raise ValueError, "unrecognized form for dia_matrix constructor" + else: + if shape is None: + raise ValueError,'expected a shape argument' + self.diags = asarray(arg1[0],dtype=dtype) + self.offsets = asarray(arg1[1],dtype='i').squeeze() + self.shape = shape + + #check format + if self.diags.ndim != 2: + raise ValueError,'expected rank 2 array for argument diags' + + if self.diags.shape[0] != len(self.offsets): + raise ValueError,'number of diagonals (%d) ' \ + 'does not match the number of offsets (%d)' \ + % (self.diags.shape[0], len(self.offsets)) + + + if len(Set(self.offsets)) != len(self.offsets): + raise ValueError,'offset array contains duplicate values' + + + + def __getdtype(self): + return self.diags.dtype + + def __setdtype(self,newtype): + self.dtype = newtype + + dtype = property(fget=__getdtype,fset=__setdtype) + + def getnnz(self): + """number of nonzero values + + explicit zero values are included in this number + """ + M,N = self.shape + nnz = 0 + for k in self.offsets: + if k > 0: + nnz += min(M,N-k) + else: + nnz += min(M+k,N) + return nnz + + nnz = property(fget=getnnz) + + + + def __mul__(self, other): # self * other + """ Scalar, vector, or matrix multiplication + """ + if isscalarlike(other): + return dia_matrix((other * self.diags, self.offsets),self.shape) + else: + return self.dot(other) + + + def matmat(self, other): + if isspmatrix(other): + M, K1 = self.shape + K2, N = other.shape + if (K1 != K2): + raise ValueError, "shape mismatch error" + + return self.tocsr() * other + #TODO handle sparse matmat here + else: + # matvec handles multiple columns + return self.matvec(other) + + + def matvec(self,other): + #TODO why is this so slow? it should run at BLAS-speed + + x = asarray(other) + + if x.ndim == 1: + x = x.reshape(-1,1) + if self.shape[1] != x.shape[0]: + raise ValueError, "dimension mismatch" + + y = zeros((self.shape[0],x.shape[1]), dtype=upcast(self.dtype,x.dtype)) + + L = self.diags.shape[1] + M,N = self.shape + + for diag,k in zip(self.diags,self.offsets): + j_start = max(0,k) + j_end = min(M+k,N,L) + + i_start = max(0,-k) + i_end = i_start + (j_end - j_start) + + y[i_start:i_end] += diag[j_start:j_end].reshape(-1,1) * x[j_start:j_end] + + + if isinstance(other, matrix): + y = asmatrix(y) + + if other.ndim == 1: + # If 'other' was a 1d array, reshape the result + y = y.reshape(-1) + + return y + + def tocsr(self): + #could be optimized + return self.tocoo().tocsr() + + def tocsc(self): + #could be optimized + return self.tocoo().tocsc() + + def tocoo(self): + num_diags = len(self.diags) + len_diags = self.diags.shape[1] + + row = arange(len_diags).reshape(1,-1).repeat(num_diags,axis=0) + col = row.copy() + + for i,k in enumerate(self.offsets): + row[i,:] -= k + + mask = (row >= 0) & (row < self.shape[0]) & (col < self.shape[1]) + row,col,data = row[mask],col[mask],self.diags[mask] + row,col,data = row.reshape(-1),col.reshape(-1),data.reshape(-1) + + from coo import coo_matrix + return coo_matrix((data,(row,col)),dims=self.shape) + + + +from sputils import _isinstance + +def isspmatrix_dia(x): + return _isinstance(x, dia_matrix) + + Modified: trunk/scipy/sparse/dok.py =================================================================== --- trunk/scipy/sparse/dok.py 2007-12-14 06:55:02 UTC (rev 3648) +++ trunk/scipy/sparse/dok.py 2007-12-14 09:42:19 UTC (rev 3649) @@ -58,6 +58,7 @@ nnz = self.getnnz() keys = self.keys() keys.sort() + #TODO why does dok_matrix wipe out .maxprint? if nnz > self.maxprint: for k in xrange(self.maxprint / 2): key = keys[k] Modified: trunk/scipy/sparse/tests/test_base.py =================================================================== --- trunk/scipy/sparse/tests/test_base.py 2007-12-14 06:55:02 UTC (rev 3648) +++ trunk/scipy/sparse/tests/test_base.py 2007-12-14 09:42:19 UTC (rev 3649) @@ -22,7 +22,7 @@ from numpy.testing import * set_package_path() from scipy.sparse import csc_matrix, csr_matrix, dok_matrix, \ - coo_matrix, lil_matrix, extract_diagonal, speye + coo_matrix, lil_matrix, dia_matrix, extract_diagonal, speye from scipy.linsolve import splu restore_path() @@ -324,6 +324,7 @@ def check_large(self): # Create a 100x100 matrix with 100 non-zero elements # and play around with it + #TODO make this use self.spmatrix or move it elsewhere A = dok_matrix((100,100)) for k in range(100): i = random.randrange(100) @@ -1152,6 +1153,13 @@ coo = coo_matrix(mat) assert_array_equal(mat,coo.todense()) +class TestDIA(_TestCommon, _TestArithmetic, NumpyTestCase): + spmatrix = dia_matrix + + def check_constructor1(self): + pass + #TODO add test + if __name__ == "__main__": NumpyTest().run() Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-14 06:55:02 UTC (rev 3648) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-14 09:42:19 UTC (rev 3649) @@ -7,7 +7,7 @@ from numpy.testing import * set_package_path() from scipy.sparse import csc_matrix, csr_matrix, dok_matrix, \ - coo_matrix, lil_matrix, spidentity, spdiags + coo_matrix, lil_matrix, dia_matrix, spidentity, spdiags from scipy.linsolve import splu restore_path() @@ -32,10 +32,9 @@ def test_matvec(self,level=5): matrices = [] - matrices.append(('Identity',spidentity(10**5))) - matrices.append(('Poisson5pt', poisson2d(250))) - matrices.append(('Poisson5pt', poisson2d(500))) + matrices.append(('Identity', spidentity(10**5,format='csr'))) matrices.append(('Poisson5pt', poisson2d(1000))) + matrices.append(('Poisson5pt', dia_matrix(poisson2d(1000)))) print print ' Sparse Matrix Vector Product' @@ -45,8 +44,6 @@ fmt = ' %3s | %12s | %20s | %8d | %6.1f ' for name,A in matrices: - A = A.tocsr() - x = ones(A.shape[1],dtype=A.dtype) y = A*x #warmup From scipy-svn at scipy.org Fri Dec 14 06:00:23 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 14 Dec 2007 05:00:23 -0600 (CST) Subject: [Scipy-svn] r3650 - trunk/scipy/sparse Message-ID: <20071214110023.D95A939C0FC@new.scipy.org> Author: rc Date: 2007-12-14 05:00:19 -0600 (Fri, 14 Dec 2007) New Revision: 3650 Modified: trunk/scipy/sparse/compressed.py Log: updated get_submatrix() docstring Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-14 09:42:19 UTC (rev 3649) +++ trunk/scipy/sparse/compressed.py 2007-12-14 11:00:19 UTC (rev 3650) @@ -727,8 +727,10 @@ def get_submatrix( self, slice0, slice1 ): """Return a submatrix of this matrix (new matrix is created). - Rows and columns can be selected using slice instances, tuples, - or scalars.""" + Contigous range of rows and columns can be selected using: + 1. a slice object + 2. a tuple (from, to) + 3. a scalar for single row/column selection.""" aux = _cs_matrix._get_submatrix( self, self.shape[1], self.shape[0], slice1, slice0 ) nr, nc = aux[3:] @@ -918,9 +920,11 @@ return data def get_submatrix( self, slice0, slice1 ): - """Return a submatrix of this matrix (new matrix is created).. - Rows and columns can be selected using slice instances, tuples, - or scalars.""" + """Return a submatrix of this matrix (new matrix is created). + Contigous range of rows and columns can be selected using: + 1. a slice object + 2. a tuple (from, to) + 3. a scalar for single row/column selection.""" aux = _cs_matrix._get_submatrix( self, self.shape[0], self.shape[1], slice0, slice1 ) nr, nc = aux[3:] From scipy-svn at scipy.org Fri Dec 14 13:30:31 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 14 Dec 2007 12:30:31 -0600 (CST) Subject: [Scipy-svn] r3651 - trunk/scipy/sparse Message-ID: <20071214183031.A13A639C097@new.scipy.org> Author: wnbell Date: 2007-12-14 12:30:20 -0600 (Fri, 14 Dec 2007) New Revision: 3651 Added: trunk/scipy/sparse/csc.py trunk/scipy/sparse/csr.py Modified: trunk/scipy/sparse/__init__.py trunk/scipy/sparse/base.py trunk/scipy/sparse/compressed.py trunk/scipy/sparse/construct.py trunk/scipy/sparse/coo.py trunk/scipy/sparse/lil.py trunk/scipy/sparse/spfuncs.py Log: moved csr_matrix and csc_matrix to individual files Modified: trunk/scipy/sparse/__init__.py =================================================================== --- trunk/scipy/sparse/__init__.py 2007-12-14 11:00:19 UTC (rev 3650) +++ trunk/scipy/sparse/__init__.py 2007-12-14 18:30:20 UTC (rev 3651) @@ -3,7 +3,8 @@ from info import __doc__ from base import * -from compressed import * +from csr import * +from csc import * from lil import * from dok import * from coo import * Modified: trunk/scipy/sparse/base.py =================================================================== --- trunk/scipy/sparse/base.py 2007-12-14 11:00:19 UTC (rev 3650) +++ trunk/scipy/sparse/base.py 2007-12-14 18:30:20 UTC (rev 3651) @@ -2,6 +2,8 @@ __all__ = ['spmatrix','isspmatrix','issparse'] +from warnings import warn + from numpy import asarray, asmatrix, ones from sputils import isdense, isscalarlike @@ -447,8 +449,10 @@ def save(self, file_name, format = '%d %d %f\n'): - #TODO deprecate, use io.mmwrite or mio instead - + #deprecated on Dec 14 2007 + warn('save() is deprecated, consider using mmwrite() or savemat()' \ + ' provided by scipy.io instead', + DeprecationWarning) try: fd = open(file_name, 'w') except Exception, e: Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-14 11:00:19 UTC (rev 3650) +++ trunk/scipy/sparse/compressed.py 2007-12-14 18:30:20 UTC (rev 3651) @@ -1,16 +1,14 @@ -"""Sparse matrix classes using compressed storage +"""Base class for sparse matrix formats using compressed storage """ +__all__ = [] -__all__ = ['csr_matrix', 'csc_matrix', 'isspmatrix_csr', 'isspmatrix_csc' ] - import numpy from numpy import array, matrix, asarray, asmatrix, zeros, rank, intc, \ empty, hstack, isscalar, ndarray, shape, searchsorted from base import spmatrix,isspmatrix import sparsetools -from sparsetools import csrtodense, cootocsr, cootocsc, csctocsr, csrtocsc from sputils import upcast, to_native, isdense, isshape, getdtype, \ isscalarlike @@ -23,8 +21,6 @@ return new - - class _cs_matrix(spmatrix): """base matrix class for compressed row and column oriented matrices""" @@ -68,7 +64,8 @@ # Try interpreting it as (data, indices, indptr) (data, indices, indptr) = arg1 except: - raise ValueError, "unrecognized form for csr_matrix constructor" + raise ValueError, "unrecognized form for" \ + " %s_matrix constructor" % self.format else: self.data = array(data, copy=copy, dtype=getdtype(dtype, data)) self.indices = array(indices, copy=copy) @@ -81,7 +78,8 @@ self._set_self( other ) else: - raise ValueError, "unrecognized form for csr_matrix constructor" + raise ValueError, "unrecognized form for" \ + " %s_matrix constructor" % self.format # Read matrix dimensions given, if any if dims is not None: @@ -120,7 +118,15 @@ self.indptr = other.indptr self.shape = other.shape - def _check_format(self, full_check): + def check_format(self, full_check=True): + """check whether the matrix format is valid + + *Parameters*: + full_check: + True - rigorous check, O(N) operations : default + False - basic check, O(1) operations + + """ self.shape = tuple([int(x) for x in self.shape]) # for floats etc. #use _swap to determine proper bounds @@ -179,17 +185,6 @@ def astype(self, t): return self._with_data(self.data.astype(t)) - def _with_data(self,data,copy=True): - """Returns a matrix with the same sparsity structure as self, - but with different data. By default the structure arrays - (i.e. .indptr and .indices) are copied. - """ - if copy: - return self.__class__((data,self.indices.copy(),self.indptr.copy()), \ - dims=self.shape,dtype=data.dtype) - else: - return self.__class__((data,self.indices,self.indptr), \ - dims=self.shape,dtype=data.dtype) def __abs__(self): return self._with_data(abs(self.data)) @@ -200,24 +195,7 @@ def _imag(self): return self._with_data(numpy.imag(self.data)) - def _binopt(self, other, op, in_shape=None, out_shape=None): - """apply the binary operation fn to two sparse matrices""" - other = self._tothis(other) - if in_shape is None: - in_shape = self.shape - if out_shape is None: - out_shape = self.shape - - # e.g. csr_plus_csr, cscmucsc, etc. - fn = getattr(sparsetools, self.format + op + self.format) - - indptr, ind, data = fn(in_shape[0], in_shape[1], \ - self.indptr, self.indices, self.data, - other.indptr, other.indices, other.data) - return self.__class__((data, ind, indptr), dims=out_shape) - - def __add__(self,other): # First check if argument is a scalar if isscalarlike(other): @@ -388,24 +366,6 @@ def getdata(self, ind): return self.data[ind] -# def _other_format(self): -# if self.format == 'csr': -# return 'csc' -# elif self.format == 'csc': -# return 'csr' -# else: -# raise TypeError,'unrecognized type' -# -# def _other__class__(self): -# if self.format == 'csr': -# return csc_matrix -# elif self.format == 'csc': -# return csr_matrix -# else: -# raise TypeError,'unrecognized type' - - - def sum(self, axis=None): """Sum the matrix over the given axis. If the axis is None, sum over both rows and columns, returning a scalar. @@ -418,7 +378,6 @@ return spmatrix.sum(self,axis) raise ValueError, "axis out of bounds" - def copy(self): return self._with_data(self.data.copy(),copy=True) @@ -564,392 +523,34 @@ return data, indices, indptr, i1 - i0, j1 - j0 -class csc_matrix(_cs_matrix): - """ Compressed sparse column matrix - This can be instantiated in several ways: - - csc_matrix(d) - with a dense matrix d - - - csc_matrix(s) - with another sparse matrix s (sugar for .tocsc()) - - - csc_matrix((M, N), [dtype]) - to construct a container, where (M, N) are dimensions and - dtype is optional, defaulting to dtype='d'. - - - csc_matrix((data, ij), [(M, N)]) - where data, ij satisfy: - a[ij[0, k], ij[1, k]] = data[k] - - - csc_matrix((data, row, ptr), [(M, N)]) - standard CSC representation - """ - - def check_format(self,full_check=True): - """check whether matrix is in valid CSC format - - *Parameters*: - full_check: - True - rigorous check, O(N) operations : default - False - basic check, O(1) operations - + # utility functions + def _with_data(self,data,copy=True): + """Returns a matrix with the same sparsity structure as self, + but with different data. By default the structure arrays + (i.e. .indptr and .indices) are copied. """ - _cs_matrix._check_format(self,full_check) - - def __getattr__(self, attr): - if attr == 'rowind': - warnings.warn("rowind attribute no longer in use. Use .indices instead", - DeprecationWarning) - return self.indices + if copy: + return self.__class__((data,self.indices.copy(),self.indptr.copy()), \ + dims=self.shape,dtype=data.dtype) else: - return _cs_matrix.__getattr__(self, attr) + return self.__class__((data,self.indices,self.indptr), \ + dims=self.shape,dtype=data.dtype) - def __iter__(self): - csr = self.tocsr() - for r in xrange(self.shape[0]): - yield csr[r,:] + def _binopt(self, other, op, in_shape=None, out_shape=None): + """apply the binary operation fn to two sparse matrices""" + other = self._tothis(other) - def transpose(self, copy=False): - return _cs_matrix._transpose(self, csr_matrix, copy) + if in_shape is None: + in_shape = self.shape + if out_shape is None: + out_shape = self.shape - def __getitem__(self, key): - if isinstance(key, tuple): - #TODO use _swap() to unify this in _cs_matrix - row = key[0] - col = key[1] - if isinstance(col, slice): - # Returns a new matrix! - return self.get_submatrix( row, col ) - elif isinstance(row, slice): - return self._getslice(row, col) - M, N = self.shape - if (row < 0): - row = M + row - if (col < 0): - col = N + col - if not (0<=row= N): - self.indptr = resize1d(self.indptr, col+2) - self.indptr[N+1:] = self.indptr[N] - N = col+1 - if (row >= M): - M = row+1 - self.shape = (M, N) - indxs = numpy.where(row == self.indices[self.indptr[col]:self.indptr[col+1]]) - - if len(indxs[0]) == 0: - #value not present - #TODO handle this with concatenation - self.data = resize1d(self.data, self.nnz + 1) - self.indices = resize1d(self.indices, self.nnz + 1) - - newindex = self.indptr[col] - self.data[newindex+1:] = self.data[newindex:-1] - self.indices[newindex+1:] = self.indices[newindex:-1] - - self.data[newindex] = val - self.indices[newindex] = row - self.indptr[col+1:] += 1 - - elif len(indxs[0]) == 1: - #value already present - self.data[self.indptr[col]:self.indptr[col+1]][indxs[0]] = val - else: - raise IndexError, "row index occurs more than once" - - self.check_format(full_check=False) - else: - # We should allow slices here! - raise IndexError, "invalid index" - - def _getslice(self, i, myslice): - return self._getcolslice(i, myslice) - - def _getcolslice(self, myslice, j): - """Returns a view of the elements [myslice.start:myslice.stop, j]. - """ - start, stop, stride = myslice.indices(self.shape[0]) - return _cs_matrix._get_slice(self, j, start, stop, stride, (stop - start, 1)) - - def rowcol(self, ind): - row = self.indices[ind] - col = searchsorted(self.indptr, ind+1)-1 - return (row, col) - - - def tocsc(self, copy=False): - return self.toself(copy) - - def tocsr(self): - indptr = empty(self.shape[0] + 1, dtype=intc) - indices = empty(self.nnz, dtype=intc) - data = empty(self.nnz, dtype=upcast(self.dtype)) - - csctocsr(self.shape[0], self.shape[1], \ - self.indptr, self.indices, self.data, \ - indptr, indices, data) - - return csr_matrix((data, indices, indptr), self.shape) - - def toarray(self): - return self.tocsr().toarray() - - def get_submatrix( self, slice0, slice1 ): - """Return a submatrix of this matrix (new matrix is created). - Contigous range of rows and columns can be selected using: - 1. a slice object - 2. a tuple (from, to) - 3. a scalar for single row/column selection.""" - aux = _cs_matrix._get_submatrix( self, self.shape[1], self.shape[0], - slice1, slice0 ) - nr, nc = aux[3:] - return self.__class__( aux[:3], dims = (nc, nr) ) - - # these functions are used by the parent class (_cs_matrix) - # to remove redudancy between csc_matrix and csr_matrix - def _swap(self,x): - """swap the members of x if this is a column-oriented matrix - """ - return (x[1],x[0]) - - def _toother(self): - return self.tocsr() - - def _tothis(self, other): - return other.tocsc() - -class csr_matrix(_cs_matrix): - """ Compressed sparse row matrix - This can be instantiated in several ways: - - csr_matrix(d) - with a dense matrix d - - - csr_matrix(s) - with another sparse matrix s (sugar for .tocsr()) - - - csr_matrix((M, N), [dtype]) - to construct a container, where (M, N) are dimensions and - dtype is optional, defaulting to dtype='d'. - - - csr_matrix((data, ij), [dims=(M, N)]) - where data, ij satisfy: - a[ij[0, k], ij[1, k]] = data[k] - - - csr_matrix((data, col, ptr), [dims=(M, N)]) - standard CSR representation - """ - - def check_format(self,full_check=True): - """check whether matrix is in valid CSR format - - *Parameters*: - full_check: - True - perform rigorous checking - default - False - perform basic format check - - """ - _cs_matrix._check_format(self,full_check) - - def __getattr__(self, attr): - if attr == 'colind': - warnings.warn("colind attribute no longer in use. Use .indices instead", - DeprecationWarning) - return self.indices - else: - return _cs_matrix.__getattr__(self, attr) - - def transpose(self, copy=False): - return _cs_matrix._transpose(self, csc_matrix, copy) - - def __getitem__(self, key): - if isinstance(key, tuple): - #TODO use _swap() to unify this in _cs_matrix - row = key[0] - col = key[1] - if isinstance(row, slice): - # Returns a new matrix! - return self.get_submatrix( row, col ) - elif isinstance(col, slice): - return self._getslice(row, col) - M, N = self.shape - if (row < 0): - row = M + row - if (col < 0): - col = N + col - if not (0<=row= M): - self.indptr = resize1d(self.indptr, row+2) - self.indptr[M+1:] = self.indptr[M] - M = row+1 - if (col >= N): - N = col+1 - self.shape = (M, N) - - indxs = numpy.where(col == self.indices[self.indptr[row]:self.indptr[row+1]]) - if len(indxs[0]) == 0: - #value not present - self.data = resize1d(self.data, self.nnz + 1) - self.indices = resize1d(self.indices, self.nnz + 1) - - newindex = self.indptr[row] - self.data[newindex+1:] = self.data[newindex:-1] - self.indices[newindex+1:] = self.indices[newindex:-1] - - self.data[newindex] = val - self.indices[newindex] = col - self.indptr[row+1:] += 1 - - elif len(indxs[0]) == 1: - #value already present - self.data[self.indptr[row]:self.indptr[row+1]][indxs[0]] = val - else: - raise IndexError, "row index occurs more than once" - - self.check_format(full_check=False) - else: - # We should allow slices here! - raise IndexError, "invalid index" - - def rowcol(self, ind): - col = self.indices[ind] - row = searchsorted(self.indptr, ind+1)-1 - return (row, col) - - - def tolil(self): - from lil import lil_matrix - lil = lil_matrix(self.shape,dtype=self.dtype) - - csr = self.sorted_indices() #lil_matrix needs sorted rows - - rows,data = lil.rows,lil.data - ptr,ind,dat = csr.indptr,csr.indices,csr.data - - for n in xrange(self.shape[0]): - start = ptr[n] - end = ptr[n+1] - rows[n] = ind[start:end].tolist() - data[n] = dat[start:end].tolist() - - return lil - - def tocsr(self, copy=False): - return self.toself(copy) - - def tocsc(self): - indptr = empty(self.shape[1] + 1, dtype=intc) - indices = empty(self.nnz, dtype=intc) - data = empty(self.nnz, dtype=upcast(self.dtype)) - - csrtocsc(self.shape[0], self.shape[1], \ - self.indptr, self.indices, self.data, \ - indptr, indices, data) - - return csc_matrix((data, indices, indptr), self.shape) - - def toarray(self): - data = numpy.zeros(self.shape, dtype=upcast(self.data.dtype)) - csrtodense(self.shape[0], self.shape[1], self.indptr, self.indices, - self.data, data) - return data - - def get_submatrix( self, slice0, slice1 ): - """Return a submatrix of this matrix (new matrix is created). - Contigous range of rows and columns can be selected using: - 1. a slice object - 2. a tuple (from, to) - 3. a scalar for single row/column selection.""" - aux = _cs_matrix._get_submatrix( self, self.shape[0], self.shape[1], - slice0, slice1 ) - nr, nc = aux[3:] - return self.__class__( aux[:3], dims = (nr, nc) ) - - # these functions are used by the parent class (_cs_matrix) - # to remove redudancy between csc_matrix and csr_matrix - def _swap(self,x): - """swap the members of x if this is a column-oriented matrix - """ - return (x[0],x[1]) - - def _toother(self): - return self.tocsc() - - def _tothis(self, other): - return other.tocsr() - - -from sputils import _isinstance - -def isspmatrix_csr(x): - return _isinstance(x, csr_matrix) - -def isspmatrix_csc(x): - return _isinstance(x, csc_matrix) - - Modified: trunk/scipy/sparse/construct.py =================================================================== --- trunk/scipy/sparse/construct.py 2007-12-14 11:00:19 UTC (rev 3650) +++ trunk/scipy/sparse/construct.py 2007-12-14 18:30:20 UTC (rev 3651) @@ -10,7 +10,8 @@ import numpy from numpy import ones, clip, array, arange, intc -from compressed import csr_matrix, csc_matrix, isspmatrix_csr, isspmatrix_csc +from csr import csr_matrix, isspmatrix_csr +from csc import csc_matrix, isspmatrix_csc from coo import coo_matrix from dok import dok_matrix from lil import lil_matrix Modified: trunk/scipy/sparse/coo.py =================================================================== --- trunk/scipy/sparse/coo.py 2007-12-14 11:00:19 UTC (rev 3650) +++ trunk/scipy/sparse/coo.py 2007-12-14 18:30:20 UTC (rev 3651) @@ -149,7 +149,7 @@ return self.data[num] def tocsc(self): - from compressed import csc_matrix + from csc import csc_matrix if self.nnz == 0: return csc_matrix(self.shape, dtype=self.dtype) else: @@ -164,7 +164,7 @@ return csc_matrix((data, indices, indptr), self.shape) def tocsr(self): - from compressed import csr_matrix + from csr import csr_matrix if self.nnz == 0: return csr_matrix(self.shape, dtype=self.dtype) else: Added: trunk/scipy/sparse/csc.py =================================================================== --- trunk/scipy/sparse/csc.py 2007-12-14 11:00:19 UTC (rev 3650) +++ trunk/scipy/sparse/csc.py 2007-12-14 18:30:20 UTC (rev 3651) @@ -0,0 +1,198 @@ +"""Compressed Sparse Column sparse matrix format +""" + +__all__ = ['csc_matrix', 'isspmatrix_csc'] + + +import numpy +from numpy import array, matrix, asarray, asmatrix, zeros, rank, intc, \ + empty, hstack, isscalar, ndarray, shape, searchsorted + +from base import spmatrix,isspmatrix +from sparsetools import csctocsr +from sputils import upcast, to_native, isdense, isshape, getdtype, \ + isscalarlike + +from compressed import _cs_matrix,resize1d + + +class csc_matrix(_cs_matrix): + """ Compressed sparse column matrix + This can be instantiated in several ways: + - csc_matrix(d) + with a dense matrix d + + - csc_matrix(s) + with another sparse matrix s (sugar for .tocsc()) + + - csc_matrix((M, N), [dtype]) + to construct a container, where (M, N) are dimensions and + dtype is optional, defaulting to dtype='d'. + + - csc_matrix((data, ij), [(M, N)]) + where data, ij satisfy: + a[ij[0, k], ij[1, k]] = data[k] + + - csc_matrix((data, row, ptr), [(M, N)]) + standard CSC representation + """ + + def __getattr__(self, attr): + if attr == 'rowind': + warnings.warn("rowind attribute no longer in use. Use .indices instead", + DeprecationWarning) + return self.indices + else: + return _cs_matrix.__getattr__(self, attr) + + def __iter__(self): + csr = self.tocsr() + for r in xrange(self.shape[0]): + yield csr[r,:] + + def transpose(self, copy=False): + from csr import csr_matrix + return _cs_matrix._transpose(self, csr_matrix, copy) + + def __getitem__(self, key): + if isinstance(key, tuple): + #TODO use _swap() to unify this in _cs_matrix + row = key[0] + col = key[1] + if isinstance(col, slice): + # Returns a new matrix! + return self.get_submatrix( row, col ) + elif isinstance(row, slice): + return self._getslice(row, col) + M, N = self.shape + if (row < 0): + row = M + row + if (col < 0): + col = N + col + if not (0<=row= N): + self.indptr = resize1d(self.indptr, col+2) + self.indptr[N+1:] = self.indptr[N] + N = col+1 + if (row >= M): + M = row+1 + self.shape = (M, N) + + indxs = numpy.where(row == self.indices[self.indptr[col]:self.indptr[col+1]]) + + if len(indxs[0]) == 0: + #value not present + #TODO handle this with concatenation + self.data = resize1d(self.data, self.nnz + 1) + self.indices = resize1d(self.indices, self.nnz + 1) + + newindex = self.indptr[col] + self.data[newindex+1:] = self.data[newindex:-1] + self.indices[newindex+1:] = self.indices[newindex:-1] + + self.data[newindex] = val + self.indices[newindex] = row + self.indptr[col+1:] += 1 + + elif len(indxs[0]) == 1: + #value already present + self.data[self.indptr[col]:self.indptr[col+1]][indxs[0]] = val + else: + raise IndexError, "row index occurs more than once" + + self.check_format(full_check=False) + else: + # We should allow slices here! + raise IndexError, "invalid index" + + def _getslice(self, i, myslice): + return self._getcolslice(i, myslice) + + def _getcolslice(self, myslice, j): + """Returns a view of the elements [myslice.start:myslice.stop, j]. + """ + start, stop, stride = myslice.indices(self.shape[0]) + return _cs_matrix._get_slice(self, j, start, stop, stride, (stop - start, 1)) + + def rowcol(self, ind): + row = self.indices[ind] + col = searchsorted(self.indptr, ind+1)-1 + return (row, col) + + + def tocsc(self, copy=False): + return self.toself(copy) + + def tocsr(self): + indptr = empty(self.shape[0] + 1, dtype=intc) + indices = empty(self.nnz, dtype=intc) + data = empty(self.nnz, dtype=upcast(self.dtype)) + + csctocsr(self.shape[0], self.shape[1], \ + self.indptr, self.indices, self.data, \ + indptr, indices, data) + + from csr import csr_matrix + return csr_matrix((data, indices, indptr), self.shape) + + def toarray(self): + return self.tocsr().toarray() + + def get_submatrix( self, slice0, slice1 ): + """Return a submatrix of this matrix (new matrix is created). + Contigous range of rows and columns can be selected using: + 1. a slice object + 2. a tuple (from, to) + 3. a scalar for single row/column selection.""" + aux = _cs_matrix._get_submatrix( self, self.shape[1], self.shape[0], + slice1, slice0 ) + nr, nc = aux[3:] + return self.__class__( aux[:3], dims = (nc, nr) ) + + # these functions are used by the parent class (_cs_matrix) + # to remove redudancy between csc_matrix and csr_matrix + def _swap(self,x): + """swap the members of x if this is a column-oriented matrix + """ + return (x[1],x[0]) + + def _toother(self): + return self.tocsr() + + def _tothis(self, other): + return other.tocsc() +from sputils import _isinstance + +def isspmatrix_csc(x): + return _isinstance(x, csc_matrix) + Added: trunk/scipy/sparse/csr.py =================================================================== --- trunk/scipy/sparse/csr.py 2007-12-14 11:00:19 UTC (rev 3650) +++ trunk/scipy/sparse/csr.py 2007-12-14 18:30:20 UTC (rev 3651) @@ -0,0 +1,209 @@ +"""Compressed Sparse Row sparse matrix format +""" + +__all__ = ['csr_matrix', 'isspmatrix_csr'] + + +import numpy +from numpy import array, matrix, asarray, asmatrix, zeros, rank, intc, \ + empty, hstack, isscalar, ndarray, shape, searchsorted + +from base import spmatrix,isspmatrix +from sparsetools import csrtodense, csrtocsc +from sputils import upcast, to_native, isdense, isshape, getdtype, \ + isscalarlike + +from compressed import _cs_matrix,resize1d + +class csr_matrix(_cs_matrix): + """ Compressed sparse row matrix + This can be instantiated in several ways: + - csr_matrix(d) + with a dense matrix d + + - csr_matrix(s) + with another sparse matrix s (sugar for .tocsr()) + + - csr_matrix((M, N), [dtype]) + to construct a container, where (M, N) are dimensions and + dtype is optional, defaulting to dtype='d'. + + - csr_matrix((data, ij), [dims=(M, N)]) + where data, ij satisfy: + a[ij[0, k], ij[1, k]] = data[k] + + - csr_matrix((data, col, ptr), [dims=(M, N)]) + standard CSR representation + """ + + def __getattr__(self, attr): + if attr == 'colind': + warnings.warn("colind attribute no longer in use. Use .indices instead", + DeprecationWarning) + return self.indices + else: + return _cs_matrix.__getattr__(self, attr) + + def transpose(self, copy=False): + from csc import csc_matrix + return _cs_matrix._transpose(self, csc_matrix, copy) + + def __getitem__(self, key): + if isinstance(key, tuple): + #TODO use _swap() to unify this in _cs_matrix + row = key[0] + col = key[1] + if isinstance(row, slice): + # Returns a new matrix! + return self.get_submatrix( row, col ) + elif isinstance(col, slice): + return self._getslice(row, col) + M, N = self.shape + if (row < 0): + row = M + row + if (col < 0): + col = N + col + if not (0<=row= M): + self.indptr = resize1d(self.indptr, row+2) + self.indptr[M+1:] = self.indptr[M] + M = row+1 + if (col >= N): + N = col+1 + self.shape = (M, N) + + indxs = numpy.where(col == self.indices[self.indptr[row]:self.indptr[row+1]]) + if len(indxs[0]) == 0: + #value not present + self.data = resize1d(self.data, self.nnz + 1) + self.indices = resize1d(self.indices, self.nnz + 1) + + newindex = self.indptr[row] + self.data[newindex+1:] = self.data[newindex:-1] + self.indices[newindex+1:] = self.indices[newindex:-1] + + self.data[newindex] = val + self.indices[newindex] = col + self.indptr[row+1:] += 1 + + elif len(indxs[0]) == 1: + #value already present + self.data[self.indptr[row]:self.indptr[row+1]][indxs[0]] = val + else: + raise IndexError, "row index occurs more than once" + + self.check_format(full_check=False) + else: + # We should allow slices here! + raise IndexError, "invalid index" + + def rowcol(self, ind): + col = self.indices[ind] + row = searchsorted(self.indptr, ind+1)-1 + return (row, col) + + + def tolil(self): + from lil import lil_matrix + lil = lil_matrix(self.shape,dtype=self.dtype) + + csr = self.sorted_indices() #lil_matrix needs sorted rows + + rows,data = lil.rows,lil.data + ptr,ind,dat = csr.indptr,csr.indices,csr.data + + for n in xrange(self.shape[0]): + start = ptr[n] + end = ptr[n+1] + rows[n] = ind[start:end].tolist() + data[n] = dat[start:end].tolist() + + return lil + + def tocsr(self, copy=False): + return self.toself(copy) + + def tocsc(self): + indptr = empty(self.shape[1] + 1, dtype=intc) + indices = empty(self.nnz, dtype=intc) + data = empty(self.nnz, dtype=upcast(self.dtype)) + + csrtocsc(self.shape[0], self.shape[1], \ + self.indptr, self.indices, self.data, \ + indptr, indices, data) + + from csc import csc_matrix + return csc_matrix((data, indices, indptr), self.shape) + + def toarray(self): + #TODO use a cheap tocoo() and make coo->todense() + data = numpy.zeros(self.shape, dtype=upcast(self.data.dtype)) + csrtodense(self.shape[0], self.shape[1], self.indptr, self.indices, + self.data, data) + return data + + def get_submatrix( self, slice0, slice1 ): + """Return a submatrix of this matrix (new matrix is created). + Contigous range of rows and columns can be selected using: + 1. a slice object + 2. a tuple (from, to) + 3. a scalar for single row/column selection.""" + aux = _cs_matrix._get_submatrix( self, self.shape[0], self.shape[1], + slice0, slice1 ) + nr, nc = aux[3:] + return self.__class__( aux[:3], dims = (nr, nc) ) + + # these functions are used by the parent class (_cs_matrix) + # to remove redudancy between csc_matrix and csr_matrix + def _swap(self,x): + """swap the members of x if this is a column-oriented matrix + """ + return (x[0],x[1]) + + def _toother(self): + return self.tocsc() + + def _tothis(self, other): + return other.tocsr() + + +from sputils import _isinstance + +def isspmatrix_csr(x): + return _isinstance(x, csr_matrix) + Modified: trunk/scipy/sparse/lil.py =================================================================== --- trunk/scipy/sparse/lil.py 2007-12-14 11:00:19 UTC (rev 3650) +++ trunk/scipy/sparse/lil.py 2007-12-14 18:30:20 UTC (rev 3651) @@ -25,9 +25,7 @@ """ Create a new list-of-lists sparse matrix. An optional argument A is accepted, which initializes the lil_matrix with it. This can be a tuple of dimensions (M, N) or a dense array / - matrix to copy, or a sparse matrix of the following types: - - csr_matrix - - lil_matrix + matrix to copy, or a sparse matrix. """ spmatrix.__init__(self) self.dtype = getdtype(dtype, A, default=float) @@ -65,7 +63,7 @@ except TypeError: raise TypeError, "unsupported matrix type" else: - from compressed import csr_matrix + from csr import csr_matrix A = csr_matrix(A).tolil() #A is a lil matrix @@ -409,7 +407,7 @@ data.extend(x) data = asarray(data,dtype=self.dtype) - from compressed import csr_matrix + from csr import csr_matrix return csr_matrix((data, indices, indptr), dims=self.shape) def tocsc(self): Modified: trunk/scipy/sparse/spfuncs.py =================================================================== --- trunk/scipy/sparse/spfuncs.py 2007-12-14 11:00:19 UTC (rev 3650) +++ trunk/scipy/sparse/spfuncs.py 2007-12-14 18:30:20 UTC (rev 3651) @@ -4,7 +4,8 @@ from numpy import empty from base import isspmatrix -from compressed import isspmatrix_csr, isspmatrix_csc +from csr import isspmatrix_csr +from csc import isspmatrix_csc from sputils import upcast import sparsetools From scipy-svn at scipy.org Fri Dec 14 14:34:51 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 14 Dec 2007 13:34:51 -0600 (CST) Subject: [Scipy-svn] r3652 - in trunk/scipy/sparse: . tests Message-ID: <20071214193451.BD0AB39C0D8@new.scipy.org> Author: wnbell Date: 2007-12-14 13:34:41 -0600 (Fri, 14 Dec 2007) New Revision: 3652 Modified: trunk/scipy/sparse/compressed.py trunk/scipy/sparse/construct.py trunk/scipy/sparse/coo.py trunk/scipy/sparse/csc.py trunk/scipy/sparse/csr.py trunk/scipy/sparse/dia.py trunk/scipy/sparse/dok.py trunk/scipy/sparse/info.py trunk/scipy/sparse/lil.py trunk/scipy/sparse/tests/test_base.py Log: deprecated dims argument in CSR/CSC/COO constructors support coo_matrix( sparse ) initialization Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-14 18:30:20 UTC (rev 3651) +++ trunk/scipy/sparse/compressed.py 2007-12-14 19:34:41 UTC (rev 3652) @@ -3,6 +3,8 @@ __all__ = [] +from warnings import warn + import numpy from numpy import array, matrix, asarray, asmatrix, zeros, rank, intc, \ empty, hstack, isscalar, ndarray, shape, searchsorted @@ -24,9 +26,13 @@ class _cs_matrix(spmatrix): """base matrix class for compressed row and column oriented matrices""" - def __init__(self, arg1, dims=None, dtype=None, copy=False): + def __init__(self, arg1, shape=None, dtype=None, copy=False, dims=None): spmatrix.__init__(self) + if dims is not None: + warn("dims is deprecated, use shape instead", DeprecationWarning) + shape=dims + if isdense(arg1): # Convert the dense array or matrix arg1 to sparse format if rank(arg1) == 1: @@ -58,7 +64,7 @@ # Try interpreting it as (data, ij) (data, ij) = arg1 assert isinstance(ij, ndarray) and (rank(ij) == 2) \ - and (shape(ij) == (2, len(data))) + and (ij.shape == (2, len(data))) except (AssertionError, TypeError, ValueError, AttributeError): try: # Try interpreting it as (data, indices, indptr) @@ -73,7 +79,7 @@ else: # (data, ij) format from coo import coo_matrix - other = coo_matrix((data, ij), dims=dims ) + other = coo_matrix((data, ij), shape=shape ) other = self._tothis(other) self._set_self( other ) @@ -82,8 +88,8 @@ " %s_matrix constructor" % self.format # Read matrix dimensions given, if any - if dims is not None: - self.shape = dims # spmatrix will check for errors + if shape is not None: + self.shape = shape # spmatrix will check for errors else: if self.shape is None: # shape not already set, try to infer dimensions @@ -135,11 +141,11 @@ # index arrays should have integer data types if self.indptr.dtype.kind != 'i': - warnings.warn("indptr array has non-integer dtype (%s)" \ - % self.indptr.dtype.name ) + warn("indptr array has non-integer dtype (%s)" \ + % self.indptr.dtype.name ) if self.indices.dtype.kind != 'i': - warnings.warn("indices array has non-integer dtype (%s)" \ - % self.indices.dtype.name ) + warn("indices array has non-integer dtype (%s)" \ + % self.indices.dtype.name ) # only support 32-bit ints for now self.indptr = self.indptr.astype('intc') @@ -381,7 +387,7 @@ def copy(self): return self._with_data(self.data.copy(),copy=True) - def _get_slice(self, i, start, stop, stride, dims): + def _get_slice(self, i, start, stop, stride, shape): """Returns a view of the elements [i, myslice.start:myslice.stop]. """ if stride != 1: @@ -398,7 +404,7 @@ index = self.indices[indices] - start data = self.data[indices] indptr = numpy.array([0, len(indices)]) - return self.__class__((data, index, indptr), dims=dims, \ + return self.__class__((data, index, indptr), shape=shape, \ dtype=self.dtype) @@ -454,9 +460,9 @@ def ensure_sorted_indices(self, inplace=False): """Return a copy of this matrix where the column indices are sorted """ - warnings.warn('ensure_sorted_indices is deprecated, ' \ - 'use sorted_indices() or sort_indices() instead', \ - DeprecationWarning) + warn('ensure_sorted_indices is deprecated, ' \ + 'use sorted_indices() or sort_indices() instead', \ + DeprecationWarning) if inplace: self.sort_indices() @@ -531,10 +537,10 @@ """ if copy: return self.__class__((data,self.indices.copy(),self.indptr.copy()), \ - dims=self.shape,dtype=data.dtype) + shape=self.shape,dtype=data.dtype) else: return self.__class__((data,self.indices,self.indptr), \ - dims=self.shape,dtype=data.dtype) + shape=self.shape,dtype=data.dtype) def _binopt(self, other, op, in_shape=None, out_shape=None): """apply the binary operation fn to two sparse matrices""" @@ -551,6 +557,6 @@ indptr, ind, data = fn(in_shape[0], in_shape[1], \ self.indptr, self.indices, self.data, other.indptr, other.indices, other.data) - return self.__class__((data, ind, indptr), dims=out_shape) + return self.__class__((data, ind, indptr), shape=out_shape) Modified: trunk/scipy/sparse/construct.py =================================================================== --- trunk/scipy/sparse/construct.py 2007-12-14 18:30:20 UTC (rev 3651) +++ trunk/scipy/sparse/construct.py 2007-12-14 19:34:41 UTC (rev 3652) @@ -5,7 +5,7 @@ __all__ = [ 'spdiags','speye','spidentity','spkron', 'lil_eye', 'lil_diags' ] import itertools -import warnings +from warnings import warn import numpy from numpy import ones, clip, array, arange, intc @@ -136,7 +136,7 @@ data = data.reshape(-1,B.nnz) * B.data data = data.reshape(-1) - return coo_matrix((data,(row,col)), dims=output_shape).asformat(format) + return coo_matrix((data,(row,col)), shape=output_shape).asformat(format) @@ -155,7 +155,7 @@ Data-type of the output array. """ - warnings.warn("lil_eye is deprecated. use speye(... , format='lil') instead", \ + warn("lil_eye is deprecated. use speye(... , format='lil') instead", \ DeprecationWarning) return speye(r,c,k,dtype=dtype,format='lil') Modified: trunk/scipy/sparse/coo.py =================================================================== --- trunk/scipy/sparse/coo.py 2007-12-14 18:30:20 UTC (rev 3651) +++ trunk/scipy/sparse/coo.py 2007-12-14 19:34:41 UTC (rev 3652) @@ -3,11 +3,12 @@ __all__ = ['coo_matrix', 'isspmatrix_coo'] from itertools import izip +from warnings import warn from numpy import array, asarray, empty, intc from sparsetools import cootocsr, cootocsc -from base import spmatrix +from base import spmatrix, isspmatrix from sputils import upcast, to_native, isshape, getdtype class coo_matrix(spmatrix): @@ -16,10 +17,12 @@ COO matrices are created either as: A = coo_matrix( (m, n), [dtype]) for a zero matrix, or as: + A = coo_matrix(S) + where S is a sparse matrix, or as: A = coo_matrix(M) where M is a dense matrix or rank 2 ndarray, or as: - A = coo_matrix((obj, ij), [dims]) - where the dimensions are optional. If supplied, we set (M, N) = dims. + A = coo_matrix((obj, ij), [shape]) + where the dimensions are optional. If supplied, we set (M, N) = shape. If not supplied, we infer these from the index arrays: ij[0][:] and ij[1][:] @@ -37,8 +40,13 @@ of finite element matrices and the like. """ - def __init__(self, arg1, dims=None, dtype=None): + def __init__(self, arg1, shape=None, dtype=None, copy=False, dims=None): spmatrix.__init__(self) + + if dims is not None: + warn("dims is deprecated, use shape instead", DeprecationWarning) + shape=dims + if isinstance(arg1, tuple): if isshape(arg1): M, N = arg1 @@ -58,44 +66,54 @@ except TypeError: raise TypeError, "invalid input format" - self.row = asarray(ij[0]) - self.col = asarray(ij[1]) - self.data = asarray(obj) + self.row = array(ij[0],copy=copy) + self.col = array(ij[1],copy=copy) + self.data = array(obj,copy=copy) - if dims is None: + if shape is None: if len(self.row) == 0 or len(self.col) == 0: raise ValueError, "cannot infer dimensions from zero sized index arrays" M = self.row.max() + 1 N = self.col.max() + 1 self.shape = (M, N) else: - # Use 2 steps to ensure dims has length 2. - M, N = dims + # Use 2 steps to ensure shape has length 2. + M, N = shape self.shape = (M, N) elif arg1 is None: # Initialize an empty matrix. - if not isinstance(dims, tuple) or not isintlike(dims[0]): + if not isinstance(shape, tuple) or not isintlike(shape[0]): raise TypeError, "dimensions not understood" - warnings.warn('coo_matrix(None, dims=(M,N)) is deprecated, ' \ - 'use coo_matrix( (M,N) ) instead', \ - DeprecationWarning) - self.shape = dims + warn('coo_matrix(None, shape=(M,N)) is deprecated, ' \ + 'use coo_matrix( (M,N) ) instead', DeprecationWarning) + self.shape = shape self.data = array([],getdtype(dtype, default=float)) self.row = array([],dtype=intc) self.col = array([],dtype=intc) else: - #dense argument - try: - M = asarray(arg1) - except: - raise TypeError, "invalid input format" + if isspmatrix(arg1): + if isspmatrix_coo and copy: + A = arg1.copy() + else: + A = arg1.tocoo() - if len(M.shape) != 2: - raise TypeError, "expected rank 2 array or matrix" - self.shape = M.shape - self.row,self.col = (M != 0).nonzero() - self.data = M[self.row,self.col] + self.row = A.row + self.col = A.col + self.data = A.data + self.shape = A.shape + else: + #dense argument + try: + M = asarray(arg1) + except: + raise TypeError, "invalid input format" + + if len(M.shape) != 2: + raise TypeError, "expected rank 2 array or matrix" + self.shape = M.shape + self.row,self.col = (M != 0).nonzero() + self.data = M[self.row,self.col] self._check() @@ -116,11 +134,11 @@ # index arrays should have integer data types if self.row.dtype.kind != 'i': - warnings.warn("row index array has non-integer dtype (%s) " \ - % self.row.dtype.name ) + warn("row index array has non-integer dtype (%s) " \ + % self.row.dtype.name ) if self.col.dtype.kind != 'i': - warnings.warn("col index array has non-integer dtype (%s) " \ - % self.col.dtype.name ) + warn("col index array has non-integer dtype (%s) " \ + % self.col.dtype.name ) # only support 32-bit ints for now self.row = self.row.astype('intc') @@ -147,6 +165,10 @@ def getdata(self, num): return self.data[num] + + def transpose(self,copy=False): + M,N = self.shape + return coo_matrix((self.data,(self.col,self.row)),(N,M),copy=copy) def tocsc(self): from csc import csc_matrix Modified: trunk/scipy/sparse/csc.py =================================================================== --- trunk/scipy/sparse/csc.py 2007-12-14 18:30:20 UTC (rev 3651) +++ trunk/scipy/sparse/csc.py 2007-12-14 19:34:41 UTC (rev 3652) @@ -3,6 +3,7 @@ __all__ = ['csc_matrix', 'isspmatrix_csc'] +from warnings import warn import numpy from numpy import array, matrix, asarray, asmatrix, zeros, rank, intc, \ @@ -39,8 +40,8 @@ def __getattr__(self, attr): if attr == 'rowind': - warnings.warn("rowind attribute no longer in use. Use .indices instead", - DeprecationWarning) + warn("rowind attribute no longer in use. Use .indices instead", + DeprecationWarning) return self.indices else: return _cs_matrix.__getattr__(self, attr) @@ -177,7 +178,7 @@ aux = _cs_matrix._get_submatrix( self, self.shape[1], self.shape[0], slice1, slice0 ) nr, nc = aux[3:] - return self.__class__( aux[:3], dims = (nc, nr) ) + return self.__class__( aux[:3], shape = (nc, nr) ) # these functions are used by the parent class (_cs_matrix) # to remove redudancy between csc_matrix and csr_matrix @@ -186,6 +187,9 @@ """ return (x[1],x[0]) + def _otherformat(self): + return "csr" + def _toother(self): return self.tocsr() Modified: trunk/scipy/sparse/csr.py =================================================================== --- trunk/scipy/sparse/csr.py 2007-12-14 18:30:20 UTC (rev 3651) +++ trunk/scipy/sparse/csr.py 2007-12-14 19:34:41 UTC (rev 3652) @@ -4,6 +4,8 @@ __all__ = ['csr_matrix', 'isspmatrix_csr'] +from warnings import warn + import numpy from numpy import array, matrix, asarray, asmatrix, zeros, rank, intc, \ empty, hstack, isscalar, ndarray, shape, searchsorted @@ -28,18 +30,18 @@ to construct a container, where (M, N) are dimensions and dtype is optional, defaulting to dtype='d'. - - csr_matrix((data, ij), [dims=(M, N)]) + - csr_matrix((data, ij), [shape=(M, N)]) where data, ij satisfy: a[ij[0, k], ij[1, k]] = data[k] - - csr_matrix((data, col, ptr), [dims=(M, N)]) + - csr_matrix((data, col, ptr), [shape=(M, N)]) standard CSR representation """ def __getattr__(self, attr): if attr == 'colind': - warnings.warn("colind attribute no longer in use. Use .indices instead", - DeprecationWarning) + warn("colind attribute no longer in use. Use .indices instead", + DeprecationWarning) return self.indices else: return _cs_matrix.__getattr__(self, attr) @@ -186,7 +188,7 @@ aux = _cs_matrix._get_submatrix( self, self.shape[0], self.shape[1], slice0, slice1 ) nr, nc = aux[3:] - return self.__class__( aux[:3], dims = (nr, nc) ) + return self.__class__( aux[:3], shape = (nr, nc) ) # these functions are used by the parent class (_cs_matrix) # to remove redudancy between csc_matrix and csr_matrix @@ -195,6 +197,9 @@ """ return (x[0],x[1]) + def _otherformat(self): + return "csc" + def _toother(self): return self.tocsc() Modified: trunk/scipy/sparse/dia.py =================================================================== --- trunk/scipy/sparse/dia.py 2007-12-14 18:30:20 UTC (rev 3651) +++ trunk/scipy/sparse/dia.py 2007-12-14 19:34:41 UTC (rev 3652) @@ -180,7 +180,7 @@ row,col,data = row.reshape(-1),col.reshape(-1),data.reshape(-1) from coo import coo_matrix - return coo_matrix((data,(row,col)),dims=self.shape) + return coo_matrix((data,(row,col)),shape=self.shape) Modified: trunk/scipy/sparse/dok.py =================================================================== --- trunk/scipy/sparse/dok.py 2007-12-14 18:30:20 UTC (rev 3651) +++ trunk/scipy/sparse/dok.py 2007-12-14 19:34:41 UTC (rev 3652) @@ -20,6 +20,8 @@ This can be a tuple of dimensions (M, N) or a (dense) array to copy. """ + #TODO deprecate argument A in favor of arg1 style + dict.__init__(self) spmatrix.__init__(self,shape) self.dtype = getdtype(dtype, A, default=float) @@ -536,7 +538,7 @@ else: data = asarray(self.values(), dtype=self.dtype) indices = asarray(self.keys(), dtype=intc).T - return coo_matrix((data,indices),dims=self.shape,dtype=self.dtype) + return coo_matrix((data,indices),shape=self.shape,dtype=self.dtype) def todok(self,copy=False): if copy: Modified: trunk/scipy/sparse/info.py =================================================================== --- trunk/scipy/sparse/info.py 2007-12-14 18:30:20 UTC (rev 3651) +++ trunk/scipy/sparse/info.py 2007-12-14 19:34:41 UTC (rev 3652) @@ -59,7 +59,7 @@ >>> I = array([0,3,1,0]) >>> J = array([0,3,1,2]) >>> V = array([4,5,7,9]) - >>> A = sparse.coo_matrix((V,(I,J)),dims=(4,4)) + >>> A = sparse.coo_matrix((V,(I,J)),shape=(4,4)) Notice that the indices do not need to be sorted. @@ -67,7 +67,7 @@ >>> I = array([0,0,1,3,1,0,0]) >>> J = array([0,2,1,3,1,0,0]) >>> V = array([1,1,1,1,1,1,1]) - >>> B = sparse.coo_matrix((V,(I,J)),dims=(4,4)).tocsr() + >>> B = sparse.coo_matrix((V,(I,J)),shape=(4,4)).tocsr() This is useful for constructing finite-element stiffness and mass matrices. Modified: trunk/scipy/sparse/lil.py =================================================================== --- trunk/scipy/sparse/lil.py 2007-12-14 18:30:20 UTC (rev 3651) +++ trunk/scipy/sparse/lil.py 2007-12-14 19:34:41 UTC (rev 3652) @@ -376,11 +376,7 @@ return d def transpose(self): - """ Return the transpose as a csc_matrix. - """ - # Overriding the spmatrix.transpose method here prevents an unnecessary - # csr -> csc conversion - return self.tocsr().transpose() + return self.tocsr().transpose().tolil() def tolil(self, copy=False): if copy: @@ -408,7 +404,7 @@ data = asarray(data,dtype=self.dtype) from csr import csr_matrix - return csr_matrix((data, indices, indptr), dims=self.shape) + return csr_matrix((data, indices, indptr), shape=self.shape) def tocsc(self): """ Return Compressed Sparse Column format arrays for this matrix. Modified: trunk/scipy/sparse/tests/test_base.py =================================================================== --- trunk/scipy/sparse/tests/test_base.py 2007-12-14 18:30:20 UTC (rev 3651) +++ trunk/scipy/sparse/tests/test_base.py 2007-12-14 19:34:41 UTC (rev 3652) @@ -26,6 +26,9 @@ from scipy.linsolve import splu restore_path() + +#TODO test spmatrix(DENSE) and spmatrix(SPARSE) for all combos +#TODO check that invalid shape in constructor raises exception class _TestCommon: """test common functionality shared by all sparse formats""" @@ -732,7 +735,7 @@ ## col = array( [1, 2, 1, 0, 0, 2], dtype='int64' ) ## ptr = array( [0, 2, 4, 6], dtype='int64' ) ## -## a = csr_matrix( (data, col, ptr), dims = (3,3) ) +## a = csr_matrix( (data, col, ptr), shape = (3,3) ) ## ## b = matrix([[0,1,2], ## [4,3,0], @@ -766,7 +769,7 @@ data = arange( 5 ) indices = array( [7, 2, 1, 5, 4] ) indptr = array( [0, 3, 5] ) - asp = csr_matrix( (data, indices, indptr), dims = (2,10) ) + asp = csr_matrix( (data, indices, indptr), shape=(2,10) ) bsp = asp.copy() asp.sort_indices( ) assert_array_equal(asp.indices,[1, 2, 7, 4, 5]) @@ -838,7 +841,7 @@ data = arange( 5 ) row = array( [7, 2, 1, 5, 4] ) ptr = [0, 3, 5] - asp = csc_matrix( (data, row, ptr), dims = (10,2) ) + asp = csc_matrix( (data, row, ptr), shape=(10,2) ) bsp = asp.copy() asp.sort_indices() assert_array_equal(asp.indices,[1, 2, 7, 4, 5]) From scipy-svn at scipy.org Fri Dec 14 15:59:28 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 14 Dec 2007 14:59:28 -0600 (CST) Subject: [Scipy-svn] r3653 - branches Message-ID: <20071214205928.181D139C0E3@new.scipy.org> Author: fperez Date: 2007-12-14 14:59:23 -0600 (Fri, 14 Dec 2007) New Revision: 3653 Added: branches/weave_cleanup/ Log: Create branch for weave cleanup at December 2007 Scipy Sprint at UC Berkeley. Copied: branches/weave_cleanup (from rev 3652, trunk) From scipy-svn at scipy.org Fri Dec 14 16:51:49 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 14 Dec 2007 15:51:49 -0600 (CST) Subject: [Scipy-svn] r3654 - branches Message-ID: <20071214215149.9640739C10E@new.scipy.org> Author: chris.burns Date: 2007-12-14 15:51:44 -0600 (Fri, 14 Dec 2007) New Revision: 3654 Added: branches/io_cleanup/ Log: Create io cleanup branch Copied: branches/io_cleanup (from rev 3653, trunk) From scipy-svn at scipy.org Fri Dec 14 17:16:36 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 14 Dec 2007 16:16:36 -0600 (CST) Subject: [Scipy-svn] r3655 - branches Message-ID: <20071214221636.123C239C058@new.scipy.org> Author: oliphant Date: 2007-12-14 16:16:29 -0600 (Fri, 14 Dec 2007) New Revision: 3655 Added: branches/io_new/ Log: Create branch from just io Copied: branches/io_new (from rev 3654, trunk/scipy/io) From scipy-svn at scipy.org Fri Dec 14 17:17:48 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 14 Dec 2007 16:17:48 -0600 (CST) Subject: [Scipy-svn] r3656 - branches Message-ID: <20071214221748.C080639C058@new.scipy.org> Author: oliphant Date: 2007-12-14 16:17:45 -0600 (Fri, 14 Dec 2007) New Revision: 3656 Removed: branches/io_cleanup/ Log: Remove io_cleanup branch. From scipy-svn at scipy.org Fri Dec 14 17:44:48 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 14 Dec 2007 16:44:48 -0600 (CST) Subject: [Scipy-svn] r3657 - in trunk/scipy/sparse: . tests Message-ID: <20071214224448.48B3239C0D8@new.scipy.org> Author: wnbell Date: 2007-12-14 16:44:43 -0600 (Fri, 14 Dec 2007) New Revision: 3657 Modified: trunk/scipy/sparse/base.py trunk/scipy/sparse/coo.py trunk/scipy/sparse/csc.py trunk/scipy/sparse/csr.py trunk/scipy/sparse/dia.py trunk/scipy/sparse/tests/test_base.py trunk/scipy/sparse/tests/test_sparse.py Log: test .copy() methods and copy contructor fixed dia_matrix handling of offsets Modified: trunk/scipy/sparse/base.py =================================================================== --- trunk/scipy/sparse/base.py 2007-12-14 22:17:45 UTC (rev 3656) +++ trunk/scipy/sparse/base.py 2007-12-14 22:44:43 UTC (rev 3657) @@ -379,15 +379,15 @@ def todia(self): return self.tocoo().todia() - def toself(self, copy=False): - if copy: - new = self.copy() - else: - new = self - return new +# def toself(self, copy=False): +# if copy: +# new = self.copy() +# else: +# new = self +# return new def copy(self): - return self.tocsr().copy() + return self.__class__(self,copy=True) def sum(self, axis=None): """Sum the matrix over the given axis. If the axis is None, sum Modified: trunk/scipy/sparse/coo.py =================================================================== --- trunk/scipy/sparse/coo.py 2007-12-14 22:17:45 UTC (rev 3656) +++ trunk/scipy/sparse/coo.py 2007-12-14 22:44:43 UTC (rev 3657) @@ -93,15 +93,17 @@ self.col = array([],dtype=intc) else: if isspmatrix(arg1): - if isspmatrix_coo and copy: - A = arg1.copy() + if isspmatrix_coo(arg1) and copy: + self.row = arg1.row.copy() + self.col = arg1.col.copy() + self.data = arg1.data.copy() + self.shape = arg1.shape else: - A = arg1.tocoo() - - self.row = A.row - self.col = A.col - self.data = A.data - self.shape = A.shape + coo = arg1.tocoo() + self.row = coo.row + self.col = coo.col + self.data = coo.data + self.shape = coo.shape else: #dense argument try: @@ -199,9 +201,13 @@ indptr, indices, data) return csr_matrix((data, indices, indptr), self.shape) + def tocoo(self, copy=False): - return self.toself(copy) + if copy: + return self.copy() + else: + return self def todok(self): from dok import dok_matrix Modified: trunk/scipy/sparse/csc.py =================================================================== --- trunk/scipy/sparse/csc.py 2007-12-14 22:17:45 UTC (rev 3656) +++ trunk/scipy/sparse/csc.py 2007-12-14 22:44:43 UTC (rev 3657) @@ -150,9 +150,11 @@ col = searchsorted(self.indptr, ind+1)-1 return (row, col) - def tocsc(self, copy=False): - return self.toself(copy) + if copy: + return self.copy() + else: + return self def tocsr(self): indptr = empty(self.shape[0] + 1, dtype=intc) Modified: trunk/scipy/sparse/csr.py =================================================================== --- trunk/scipy/sparse/csr.py 2007-12-14 22:17:45 UTC (rev 3656) +++ trunk/scipy/sparse/csr.py 2007-12-14 22:44:43 UTC (rev 3657) @@ -158,7 +158,10 @@ return lil def tocsr(self, copy=False): - return self.toself(copy) + if copy: + return self.copy() + else: + return self def tocsc(self): indptr = empty(self.shape[1] + 1, dtype=intc) Modified: trunk/scipy/sparse/dia.py =================================================================== --- trunk/scipy/sparse/dia.py 2007-12-14 22:17:45 UTC (rev 3656) +++ trunk/scipy/sparse/dia.py 2007-12-14 22:44:43 UTC (rev 3657) @@ -56,19 +56,21 @@ if shape is None: raise ValueError,'expected a shape argument' self.diags = asarray(arg1[0],dtype=dtype) - self.offsets = asarray(arg1[1],dtype='i').squeeze() + self.offsets = asarray(arg1[1],dtype='i') self.shape = shape #check format + if self.offsets.ndim != 1: + raise ValueError,'offsets array must have rank 1' + if self.diags.ndim != 2: - raise ValueError,'expected rank 2 array for argument diags' + raise ValueError,'diags array must have rank 2' if self.diags.shape[0] != len(self.offsets): raise ValueError,'number of diagonals (%d) ' \ 'does not match the number of offsets (%d)' \ % (self.diags.shape[0], len(self.offsets)) - if len(Set(self.offsets)) != len(self.offsets): raise ValueError,'offset array contains duplicate values' @@ -157,12 +159,18 @@ return y + def todia(self,copy=False): + if copy: + return self.copy() + else: + return self + def tocsr(self): - #could be optimized + #TODO optimize COO->CSR return self.tocoo().tocsr() def tocsc(self): - #could be optimized + #TODO optimize COO->CSC return self.tocoo().tocsc() def tocoo(self): Modified: trunk/scipy/sparse/tests/test_base.py =================================================================== --- trunk/scipy/sparse/tests/test_base.py 2007-12-14 22:17:45 UTC (rev 3656) +++ trunk/scipy/sparse/tests/test_base.py 2007-12-14 22:44:43 UTC (rev 3657) @@ -29,6 +29,7 @@ #TODO test spmatrix(DENSE) and spmatrix(SPARSE) for all combos #TODO check that invalid shape in constructor raises exception +#TODO check that spmatrix( ... , copy=X ) is respected class _TestCommon: """test common functionality shared by all sparse formats""" @@ -110,41 +111,23 @@ def check_mul_scalar(self): assert_array_equal(self.dat*2,(self.datsp*2).todense()) assert_array_equal(self.dat*17.3,(self.datsp*17.3).todense()) - - def check_imul_scalar(self): - a = self.datsp.copy() - a *= 2 - assert_array_equal(self.dat*2,a.todense()) - - a = self.datsp.copy() - a *= 17.3 - assert_array_equal(self.dat*17.3,a.todense()) - - def check_idiv_scalar(self): - a = self.datsp.copy() - a /= 2 - assert_array_equal(self.dat/2,a.todense()) - - a = self.datsp.copy() - a /= 17.3 - assert_array_equal(self.dat/17.3,a.todense()) - + def check_rmul_scalar(self): assert_array_equal(2*self.dat,(2*self.datsp).todense()) assert_array_equal(17.3*self.dat,(17.3*self.datsp).todense()) def check_add(self): - a = self.datsp - b = self.datsp.copy() - b[0,2] = 2.0 - c = a + b - assert_array_equal(c.todense(),[[2,0,2,4],[6,0,2,0],[0,4,0,0]]) + a = self.dat.copy() + a[0,2] = 2.0 + b = self.datsp + c = b + a + assert_array_equal(c,[[2,0,2,4],[6,0,2,0],[0,4,0,0]]) def check_radd(self): - a = self.datsp - b = self.datsp.copy() - b[0,2] = 2.0 - c = a.todense() + b + a = self.dat.copy() + a[0,2] = 2.0 + b = self.datsp + c = a + b assert_array_equal(c,[[2,0,2,4],[6,0,2,0],[0,4,0,0]]) def check_sub(self): @@ -165,10 +148,10 @@ assert_array_equal(self.datsp - A.todense(),self.dat - A.todense()) def check_elmul(self): - a = self.datsp - b = self.datsp.copy() - b[0,2] = 2.0 - c = a ** b + temp = self.dat.copy() + temp[0,2] = 2.0 + temp = self.spmatrix(temp) + c = temp ** self.datsp assert_array_equal(c.todense(),[[1,0,0,4],[9,0,1,0],[0,4,0,0]]) def check_eldiv(self): @@ -368,6 +351,29 @@ def check_copy(self): """ Check whether the copy=True and copy=False keywords work """ + A = self.datsp + + #check that copy preserves format + assert_equal(A.copy().format, A.format) + assert_equal(A.__class__(A,copy=True).format, A.format) + assert_equal(A.__class__(A,copy=False).format, A.format) + + assert_equal(A.copy().todense(), A.todense()) + assert_equal(A.__class__(A,copy=True).todense(), A.todense()) + assert_equal(A.__class__(A,copy=False).todense(), A.todense()) + + #check that XXX_matrix.toXXX() works + toself = getattr(A,'to' + A.format) + assert_equal(toself().format, A.format) + assert_equal(toself(copy=True).format, A.format) + assert_equal(toself(copy=False).format, A.format) + + assert_equal(toself().todense(), A.todense()) + assert_equal(toself(copy=True).todense(), A.todense()) + assert_equal(toself(copy=False).todense(), A.todense()) + + + #TODO how can we check whether the data is copied? pass # Eventually we'd like to allow matrix products between dense @@ -399,6 +405,27 @@ assert_array_equal(numpy.diag(A),extract_diagonal(self.spmatrix(A))) +class _TestInplaceArithmetic: + def check_imul_scalar(self): + a = self.datsp.copy() + a *= 2 + assert_array_equal(self.dat*2,a.todense()) + + a = self.datsp.copy() + a *= 17.3 + assert_array_equal(self.dat*17.3,a.todense()) + + def check_idiv_scalar(self): + a = self.datsp.copy() + a /= 2 + assert_array_equal(self.dat/2,a.todense()) + + a = self.datsp.copy() + a /= 17.3 + assert_array_equal(self.dat/17.3,a.todense()) + + + class _TestGetSet: def check_setelement(self): a = self.datsp - self.datsp @@ -692,7 +719,8 @@ -class TestCSR(_TestCommon, _TestGetSet, _TestSolve, _TestArithmetic, +class TestCSR(_TestCommon, _TestGetSet, _TestSolve, + _TestInplaceArithmetic, _TestArithmetic, _TestHorizSlicing, _TestVertSlicing, _TestBothSlicing, NumpyTestCase): spmatrix = csr_matrix @@ -788,7 +816,8 @@ assert b.shape == (2,2) assert_equal( ab, aa[i0,i1[0]:i1[1]] ) -class TestCSC(_TestCommon, _TestGetSet, _TestSolve, _TestArithmetic, +class TestCSC(_TestCommon, _TestGetSet, _TestSolve, + _TestInplaceArithmetic, _TestArithmetic, _TestHorizSlicing, _TestVertSlicing, _TestBothSlicing, NumpyTestCase): spmatrix = csc_matrix @@ -968,7 +997,8 @@ class TestLIL( _TestCommon, _TestHorizSlicing, _TestVertSlicing, - _TestBothSlicing, _TestGetSet, _TestSolve, _TestArithmetic, + _TestBothSlicing, _TestGetSet, _TestSolve, + _TestArithmetic, _TestInplaceArithmetic, NumpyTestCase): spmatrix = lil_matrix Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-14 22:17:45 UTC (rev 3656) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-14 22:44:43 UTC (rev 3657) @@ -1,7 +1,7 @@ """general tests and simple benchmarks for the sparse module""" import numpy -from numpy import ones +from numpy import ones, array, asarray, empty import random from numpy.testing import * @@ -11,21 +11,29 @@ from scipy.linsolve import splu restore_path() - -def poisson2d(N,epsilon=1.0): +#TODO move this to a matrix gallery and add unittests +def poisson2d(N,dtype='d',format=None): """ - Return a sparse CSR matrix for the 2d poisson problem + Return a sparse matrix for the 2d poisson problem with standard 5-point finite difference stencil on a square N-by-N grid. """ + if N == 1: + diags = asarray( [[4]],dtype=dtype) + return dia_matrix((diags,[0]), shape=(1,1)).asformat(format) - D = (2 + 2*epsilon)*ones(N*N) - T = -epsilon * ones(N*N) - O = -ones(N*N) - T[N-1::N] = 0 - return spdiags([D,O,T,T,O],[0,-N,-1,1,N],N*N,N*N).tocoo().tocsr() #eliminate explicit zeros + offsets = array([0,-N,N,-1,1]) + diags = empty((5,N**2),dtype=dtype) + diags[0] = 4 #main diagonal + diags[1:] = -1 #all offdiagonals + + diags[3,N-1::N] = 0 #first lower diagonal + diags[4,N::N] = 0 #first upper diagonal + + return dia_matrix((diags,offsets),shape=(N**2,N**2)).asformat(format) + import time class TestSparseTools(NumpyTestCase): """Simple benchmarks for sparse matrix module""" @@ -33,8 +41,8 @@ def test_matvec(self,level=5): matrices = [] matrices.append(('Identity', spidentity(10**5,format='csr'))) - matrices.append(('Poisson5pt', poisson2d(1000))) - matrices.append(('Poisson5pt', dia_matrix(poisson2d(1000)))) + matrices.append(('Poisson5pt', poisson2d(1000,format='csr'))) + matrices.append(('Poisson5pt', poisson2d(1000,format='dia'))) print print ' Sparse Matrix Vector Product' From scipy-svn at scipy.org Fri Dec 14 18:31:10 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 14 Dec 2007 17:31:10 -0600 (CST) Subject: [Scipy-svn] r3658 - in trunk/scipy/sandbox/multigrid: . multigridtools tests Message-ID: <20071214233110.E0A9139C07E@new.scipy.org> Author: wnbell Date: 2007-12-14 17:31:02 -0600 (Fri, 14 Dec 2007) New Revision: 3658 Modified: trunk/scipy/sandbox/multigrid/adaptive.py trunk/scipy/sandbox/multigrid/dec_test.py trunk/scipy/sandbox/multigrid/multigridtools/README.txt trunk/scipy/sandbox/multigrid/multilevel.py trunk/scipy/sandbox/multigrid/rs.py trunk/scipy/sandbox/multigrid/sa.py trunk/scipy/sandbox/multigrid/tests/test_adaptive.py trunk/scipy/sandbox/multigrid/tests/test_sa.py trunk/scipy/sandbox/multigrid/tests/test_utils.py trunk/scipy/sandbox/multigrid/utils.py Log: updated multigrid to use shape instead of dims Modified: trunk/scipy/sandbox/multigrid/adaptive.py =================================================================== --- trunk/scipy/sandbox/multigrid/adaptive.py 2007-12-14 22:44:43 UTC (rev 3657) +++ trunk/scipy/sandbox/multigrid/adaptive.py 2007-12-14 23:31:02 UTC (rev 3658) @@ -44,17 +44,17 @@ c = new_candidate.reshape(-1)[diff(AggOp.indptr) == 1] #eliminate DOFs that aggregation misses threshold = 1e-10 * abs(c).max() # cutoff for small basis functions - X = csr_matrix((c,AggOp.indices,AggOp.indptr),dims=AggOp.shape) + X = csr_matrix((c,AggOp.indices,AggOp.indptr),shape=AggOp.shape) #orthogonalize X against previous for i in range(K): old_c = ascontiguousarray(Q_data[:,:,i].reshape(-1)) - D_AtX = csr_matrix((old_c*X.data,X.indices,X.indptr),dims=X.shape).sum(axis=0).A.flatten() #same as diagonal of A.T * X + D_AtX = csr_matrix((old_c*X.data,X.indices,X.indptr),shape=X.shape).sum(axis=0).A.flatten() #same as diagonal of A.T * X R[:,i,K] = D_AtX X.data -= D_AtX[X.indices] * old_c #normalize X - D_XtX = csr_matrix((X.data**2,X.indices,X.indptr),dims=X.shape).sum(axis=0).A.flatten() #same as diagonal of X.T * X + D_XtX = csr_matrix((X.data**2,X.indices,X.indptr),shape=X.shape).sum(axis=0).A.flatten() #same as diagonal of X.T * X col_norms = sqrt(D_XtX) mask = col_norms < threshold # find small basis functions col_norms[mask] = 0 # and set them to zero @@ -69,7 +69,7 @@ Q_data = Q_data.reshape(-1) #TODO BSR change R = R.reshape(-1,K+1) - Q = csr_matrix((Q_data,Q_indices,Q_indptr),dims=(AggOp.shape[0],(K+1)*AggOp.shape[1])) + Q = csr_matrix((Q_data,Q_indices,Q_indptr),shape=(AggOp.shape[0],(K+1)*AggOp.shape[1])) return Q,R @@ -249,7 +249,7 @@ indptr = hstack((indptr,indptr[:,-1].reshape(-1,1))) indptr = indptr.reshape(-1) indptr = hstack((indptr,indptr[-1:])) #duplicate last element - return csr_matrix((P.data,P.indices,indptr),dims=(K*P.shape[0]/(K-1),P.shape[1])) + return csr_matrix((P.data,P.indices,indptr),shape=(K*P.shape[0]/(K-1),P.shape[1])) for i in range(len(As) - 2): T,R = augment_candidates(AggOps[i], Ts[i], Bs[i+1], x) Modified: trunk/scipy/sandbox/multigrid/dec_test.py =================================================================== --- trunk/scipy/sandbox/multigrid/dec_test.py 2007-12-14 22:44:43 UTC (rev 3657) +++ trunk/scipy/sandbox/multigrid/dec_test.py 2007-12-14 23:31:02 UTC (rev 3658) @@ -41,7 +41,7 @@ # replace with CSR + eliminate duplicates #indptr = (2*num_basis) * arange(num_edges+1) ## same same - #csr_matrix((data,indices,indptr),dims=(num_edges,num_aggs)) + #csr_matrix((data,indices,indptr),shape=(num_edges,num_aggs)) row = arange(num_edges).repeat(2*num_basis) col = (num_basis*aggs[D_nodal.indices]).repeat(num_basis) @@ -49,7 +49,7 @@ col = col.reshape(-1) data = tile(0.5 * (D_nodal*vertices),(1,2)).reshape(-1) - return coo_matrix((data,(row,col)),dims=(num_edges,num_basis*num_aggs)).tocsr() + return coo_matrix((data,(row,col)),shape=(num_edges,num_basis*num_aggs)).tocsr() Modified: trunk/scipy/sandbox/multigrid/multigridtools/README.txt =================================================================== --- trunk/scipy/sandbox/multigrid/multigridtools/README.txt 2007-12-14 22:44:43 UTC (rev 3657) +++ trunk/scipy/sandbox/multigrid/multigridtools/README.txt 2007-12-14 23:31:02 UTC (rev 3658) @@ -1,5 +1,5 @@ Before regenerating multigridtools_wrap.cxx with SWIG, ensure that you -are using SWIG Version 1.3.32 or newer (check with: 'swig -version') +are using SWIG Version 1.3.33 or newer (check with: 'swig -version') The wrappers are generated with: swig -c++ -python multigridtools.i Modified: trunk/scipy/sandbox/multigrid/multilevel.py =================================================================== --- trunk/scipy/sandbox/multigrid/multilevel.py 2007-12-14 22:44:43 UTC (rev 3657) +++ trunk/scipy/sandbox/multigrid/multilevel.py 2007-12-14 23:31:02 UTC (rev 3658) @@ -4,9 +4,10 @@ import scipy import numpy -from numpy import ones,zeros,zeros_like,array,asarray +from numpy import ones,zeros,zeros_like,array,asarray,empty from numpy.linalg import norm from scipy.linsolve import spsolve +from scipy.sparse import dia_matrix from sa import sa_interpolation from rs import rs_interpolation @@ -24,19 +25,33 @@ O = -ones(N) return scipy.sparse.spdiags([D,O,O],[0,-1,1],N,N).tocoo().tocsr() #eliminate explicit zeros -def poisson_problem2D(N,epsilon=1.0): +def poisson_problem2D(N, epsilon=1.0, dtype='d', format=None): """ - Return a sparse CSR matrix for the 2d poisson problem + Return a sparse matrix for the 2d poisson problem with standard 5-point finite difference stencil on a square N-by-N grid. """ - D = (2 + 2*epsilon)*ones(N*N) - T = -epsilon * ones(N*N) - O = -ones(N*N) - T[N-1::N] = 0 - return scipy.sparse.spdiags([D,O,T,T,O],[0,-N,-1,1,N],N*N,N*N).tocoo().tocsr() #eliminate explicit zeros + if N == 1: + diags = asarray( [[4]],dtype=dtype) + return dia_matrix((diags,[0]), shape=(1,1)).asformat(format) + offsets = array([0,-N,N,-1,1]) + diags = empty((5,N**2),dtype=dtype) + + diags[0] = (2 + 2*epsilon) #main diagonal + diags[1,:] = -1 + diags[2,:] = -1 + + diags[3,:] = -epsilon #first lower diagonal + diags[4,:] = -epsilon #first upper diagonal + diags[3,N-1::N] = 0 + diags[4,N::N] = 0 + + return dia_matrix((diags,offsets),shape=(N**2,N**2)).tocoo().tocsr() #eliminate explicit zeros + #return dia_matrix((diags,offsets),shape=(N**2,N**2)).asformat(format) + + def ruge_stuben_solver(A,max_levels=10,max_coarse=500): """ Create a multilevel solver using Ruge-Stuben coarsening (Classical AMG) Modified: trunk/scipy/sandbox/multigrid/rs.py =================================================================== --- trunk/scipy/sandbox/multigrid/rs.py 2007-12-14 22:44:43 UTC (rev 3657) +++ trunk/scipy/sandbox/multigrid/rs.py 2007-12-14 23:31:02 UTC (rev 3658) @@ -14,7 +14,7 @@ if not isspmatrix_csr(A): raise TypeError('expected csr_matrix') Sp,Sj,Sx = multigridtools.rs_strong_connections(A.shape[0],theta,A.indptr,A.indices,A.data) - return csr_matrix((Sx,Sj,Sp),dims=A.shape) + return csr_matrix((Sx,Sj,Sp),shape=A.shape) def rs_interpolation(A,theta=0.25): Modified: trunk/scipy/sandbox/multigrid/sa.py =================================================================== --- trunk/scipy/sandbox/multigrid/sa.py 2007-12-14 22:44:43 UTC (rev 3657) +++ trunk/scipy/sandbox/multigrid/sa.py 2007-12-14 23:31:02 UTC (rev 3658) @@ -41,11 +41,11 @@ ## # for non-scalar problems, use pre-defined blocks in aggregation ## # the strength of connection matrix is based on the 1-norms of the blocks ## -## B = csr_matrix((ones(num_dofs),blocks,arange(num_dofs + 1)),dims=(num_dofs,num_blocks)) +## B = csr_matrix((ones(num_dofs),blocks,arange(num_dofs + 1)),shape=(num_dofs,num_blocks)) ## Bt = B.T.tocsr() ## ## #1-norms of blocks entries of A -## Block_A = Bt * csr_matrix((abs(A.data),A.indices,A.indptr),dims=A.shape) * B +## Block_A = Bt * csr_matrix((abs(A.data),A.indices,A.indptr),shape=A.shape) * B ## ## S = sa_strong_connections(Block_A,epsilon) ## S.data[:] = 1 @@ -80,10 +80,10 @@ # for non-scalar problems, use pre-defined blocks in aggregation # the strength of connection matrix is based on the Frobenius norms of the blocks - B = csr_matrix((ones(num_dofs),blocks,arange(num_dofs + 1)),dims=(num_dofs,num_blocks)) + B = csr_matrix((ones(num_dofs),blocks,arange(num_dofs + 1)),shape=(num_dofs,num_blocks)) #1-norms of blocks entries of A #TODO figure out what to do for blocks here - Block_A = B.T.tocsr() * csr_matrix((abs(A.data),A.indices,A.indptr),dims=A.shape) * B + Block_A = B.T.tocsr() * csr_matrix((abs(A.data),A.indices,A.indptr),shape=A.shape) * B S = sa_strong_connections(Block_A,epsilon) @@ -125,16 +125,16 @@ threshold = tol * abs(c).max() # cutoff for small basis functions - X = csr_matrix((c,AggOp.indices,AggOp.indptr),dims=AggOp.shape) + X = csr_matrix((c,AggOp.indices,AggOp.indptr),shape=AggOp.shape) #orthogonalize X against previous for j,A in enumerate(candidate_matrices): - D_AtX = csr_matrix((A.data*X.data,X.indices,X.indptr),dims=X.shape).sum(axis=0).A.flatten() #same as diagonal of A.T * X + D_AtX = csr_matrix((A.data*X.data,X.indices,X.indptr),shape=X.shape).sum(axis=0).A.flatten() #same as diagonal of A.T * X R[:,j,i] = D_AtX X.data -= D_AtX[X.indices] * A.data #normalize X - D_XtX = csr_matrix((X.data**2,X.indices,X.indptr),dims=X.shape).sum(axis=0).A.flatten() #same as diagonal of X.T * X + D_XtX = csr_matrix((X.data**2,X.indices,X.indptr),shape=X.shape).sum(axis=0).A.flatten() #same as diagonal of X.T * X col_norms = sqrt(D_XtX) mask = col_norms < threshold # set small basis functions to 0 col_norms[mask] = 0 @@ -153,7 +153,7 @@ Q_data = empty(AggOp.indptr[-1] * K) #if AggOp includes all nodes, then this is (N_fine * K) for i,X in enumerate(candidate_matrices): Q_data[i::K] = X.data - Q = csr_matrix((Q_data,Q_indices,Q_indptr),dims=(N_fine,K*N_coarse)) + Q = csr_matrix((Q_data,Q_indices,Q_indptr),shape=(N_fine,K*N_coarse)) R = R.reshape(-1,K) Modified: trunk/scipy/sandbox/multigrid/tests/test_adaptive.py =================================================================== --- trunk/scipy/sandbox/multigrid/tests/test_adaptive.py 2007-12-14 22:44:43 UTC (rev 3657) +++ trunk/scipy/sandbox/multigrid/tests/test_adaptive.py 2007-12-14 23:31:02 UTC (rev 3658) @@ -21,7 +21,7 @@ #two candidates ##block candidates - ##self.cases.append((csr_matrix((ones(9),array([0,0,0,1,1,1,2,2,2]),arange(10)),dims=(9,3)), vstack((array([1]*9 + [0]*9),arange(2*9))).T )) + ##self.cases.append((csr_matrix((ones(9),array([0,0,0,1,1,1,2,2,2]),arange(10)),shape=(9,3)), vstack((array([1]*9 + [0]*9),arange(2*9))).T )) @@ -29,17 +29,17 @@ cases = [] ## tests where AggOp includes all DOFs - cases.append((csr_matrix((ones(4),array([0,0,1,1]),arange(5)),dims=(4,2)), vstack((ones(4),arange(4))).T )) - cases.append((csr_matrix((ones(9),array([0,0,0,1,1,1,2,2,2]),arange(10)),dims=(9,3)), vstack((ones(9),arange(9))).T )) - cases.append((csr_matrix((ones(9),array([0,0,1,1,2,2,3,3,3]),arange(10)),dims=(9,4)), vstack((ones(9),arange(9))).T )) + cases.append((csr_matrix((ones(4),array([0,0,1,1]),arange(5)),shape=(4,2)), vstack((ones(4),arange(4))).T )) + cases.append((csr_matrix((ones(9),array([0,0,0,1,1,1,2,2,2]),arange(10)),shape=(9,3)), vstack((ones(9),arange(9))).T )) + cases.append((csr_matrix((ones(9),array([0,0,1,1,2,2,3,3,3]),arange(10)),shape=(9,4)), vstack((ones(9),arange(9))).T )) ## tests where AggOp excludes some DOFs - cases.append((csr_matrix((ones(4),array([0,0,1,1]),array([0,1,2,2,3,4])),dims=(5,2)), vstack((ones(5),arange(5))).T )) + cases.append((csr_matrix((ones(4),array([0,0,1,1]),array([0,1,2,2,3,4])),shape=(5,2)), vstack((ones(5),arange(5))).T )) # overdetermined blocks - cases.append((csr_matrix((ones(4),array([0,0,1,1]),array([0,1,2,2,3,4])),dims=(5,2)), vstack((ones(5),arange(5),arange(5)**2)).T )) - cases.append((csr_matrix((ones(6),array([1,3,0,2,1,0]),array([0,0,1,2,2,3,4,5,5,6])),dims=(9,4)), vstack((ones(9),arange(9),arange(9)**2)).T )) - cases.append((csr_matrix((ones(6),array([1,3,0,2,1,0]),array([0,0,1,2,2,3,4,5,5,6])),dims=(9,4)), vstack((ones(9),arange(9))).T )) + cases.append((csr_matrix((ones(4),array([0,0,1,1]),array([0,1,2,2,3,4])),shape=(5,2)), vstack((ones(5),arange(5),arange(5)**2)).T )) + cases.append((csr_matrix((ones(6),array([1,3,0,2,1,0]),array([0,0,1,2,2,3,4,5,5,6])),shape=(9,4)), vstack((ones(9),arange(9),arange(9)**2)).T )) + cases.append((csr_matrix((ones(6),array([1,3,0,2,1,0]),array([0,0,1,2,2,3,4,5,5,6])),shape=(9,4)), vstack((ones(9),arange(9))).T )) def mask_candidate(AggOp,candidates): #mask out all DOFs that are not included in the aggregation Modified: trunk/scipy/sandbox/multigrid/tests/test_sa.py =================================================================== --- trunk/scipy/sandbox/multigrid/tests/test_sa.py 2007-12-14 22:44:43 UTC (rev 3657) +++ trunk/scipy/sandbox/multigrid/tests/test_sa.py 2007-12-14 23:31:02 UTC (rev 3658) @@ -71,11 +71,11 @@ # two aggregates in 1D A = poisson_problem1D(6) - AggOp = csr_matrix((ones(6),array([0,0,0,1,1,1]),arange(7)),dims=(6,2)) + AggOp = csr_matrix((ones(6),array([0,0,0,1,1,1]),arange(7)),shape=(6,2)) candidates = ones((6,1)) T_result,coarse_candidates_result = sa_fit_candidates(AggOp,candidates) - T_expected = csr_matrix((sqrt(1.0/3.0)*ones(6),array([0,0,0,1,1,1]),arange(7)),dims=(6,2)) + T_expected = csr_matrix((sqrt(1.0/3.0)*ones(6),array([0,0,0,1,1,1]),arange(7)),shape=(6,2)) assert_almost_equal(T_result.todense(),T_expected.todense()) #check simple block examples @@ -103,13 +103,13 @@ #simple 1d example w/ two aggregates A = poisson_problem1D(6) - AggOp = csr_matrix((ones(6),array([0,0,0,1,1,1]),arange(7)),dims=(6,2)) + AggOp = csr_matrix((ones(6),array([0,0,0,1,1,1]),arange(7)),shape=(6,2)) candidates = ones((6,1)) user_cases.append((A,AggOp,candidates)) #simple 1d example w/ two aggregates (not all nodes are aggregated) A = poisson_problem1D(6) - AggOp = csr_matrix((ones(4),array([0,0,1,1]),array([0,1,1,2,3,3,4])),dims=(6,2)) + AggOp = csr_matrix((ones(4),array([0,0,1,1]),array([0,1,1,2,3,3,4])),shape=(6,2)) candidates = ones((6,1)) user_cases.append((A,AggOp,candidates)) @@ -129,25 +129,25 @@ ## tests where AggOp includes all DOFs #one candidate - #self.cases.append((csr_matrix((ones(5),array([0,0,0,1,1]),arange(6)),dims=(5,2)), ones((5,1)) )) - #self.cases.append((csr_matrix((ones(5),array([1,1,0,0,0]),arange(6)),dims=(5,2)), ones((5,1)) )) - #self.cases.append((csr_matrix((ones(9),array([0,0,0,1,1,1,2,2,2]),arange(10)),dims=(9,3)), ones((9,1)) )) - self.cases.append((csr_matrix((ones(9),array([2,1,0,0,1,2,1,0,2]),arange(10)),dims=(9,3)), arange(9).reshape(9,1) )) + #self.cases.append((csr_matrix((ones(5),array([0,0,0,1,1]),arange(6)),shape=(5,2)), ones((5,1)) )) + #self.cases.append((csr_matrix((ones(5),array([1,1,0,0,0]),arange(6)),shape=(5,2)), ones((5,1)) )) + #self.cases.append((csr_matrix((ones(9),array([0,0,0,1,1,1,2,2,2]),arange(10)),shape=(9,3)), ones((9,1)) )) + self.cases.append((csr_matrix((ones(9),array([2,1,0,0,1,2,1,0,2]),arange(10)),shape=(9,3)), arange(9).reshape(9,1) )) #two candidates - #self.cases.append((csr_matrix((ones(4),array([0,0,1,1]),arange(5)),dims=(4,2)), vstack((ones(4),arange(4))).T )) - #self.cases.append((csr_matrix((ones(9),array([0,0,0,1,1,1,2,2,2]),arange(10)),dims=(9,3)), vstack((ones(9),arange(9))).T )) - #self.cases.append((csr_matrix((ones(9),array([0,0,1,1,2,2,3,3,3]),arange(10)),dims=(9,4)), vstack((ones(9),arange(9))).T )) + #self.cases.append((csr_matrix((ones(4),array([0,0,1,1]),arange(5)),shape=(4,2)), vstack((ones(4),arange(4))).T )) + #self.cases.append((csr_matrix((ones(9),array([0,0,0,1,1,1,2,2,2]),arange(10)),shape=(9,3)), vstack((ones(9),arange(9))).T )) + #self.cases.append((csr_matrix((ones(9),array([0,0,1,1,2,2,3,3,3]),arange(10)),shape=(9,4)), vstack((ones(9),arange(9))).T )) ##block candidates - #self.cases.append((csr_matrix((ones(9),array([0,0,0,1,1,1,2,2,2]),arange(10)),dims=(9,3)), vstack((array([1]*9 + [0]*9),arange(2*9))).T )) + #self.cases.append((csr_matrix((ones(9),array([0,0,0,1,1,1,2,2,2]),arange(10)),shape=(9,3)), vstack((array([1]*9 + [0]*9),arange(2*9))).T )) # ### tests where AggOp excludes some DOFs - #self.cases.append((csr_matrix((ones(4),array([0,0,1,1]),array([0,1,2,2,3,4])),dims=(5,2)), ones((5,1)) )) - #self.cases.append((csr_matrix((ones(4),array([0,0,1,1]),array([0,1,2,2,3,4])),dims=(5,2)), vstack((ones(5),arange(5))).T )) + #self.cases.append((csr_matrix((ones(4),array([0,0,1,1]),array([0,1,2,2,3,4])),shape=(5,2)), ones((5,1)) )) + #self.cases.append((csr_matrix((ones(4),array([0,0,1,1]),array([0,1,2,2,3,4])),shape=(5,2)), vstack((ones(5),arange(5))).T )) ## overdetermined blocks - #self.cases.append((csr_matrix((ones(4),array([0,0,1,1]),array([0,1,2,2,3,4])),dims=(5,2)), vstack((ones(5),arange(5),arange(5)**2)).T )) - #self.cases.append((csr_matrix((ones(6),array([1,3,0,2,1,0]),array([0,0,1,2,2,3,4,5,5,6])),dims=(9,4)), vstack((ones(9),arange(9),arange(9)**2)).T )) - #self.cases.append((csr_matrix((ones(6),array([1,3,0,2,1,0]),array([0,0,1,2,2,3,4,5,5,6])),dims=(9,4)), vstack((ones(9),arange(9))).T )) + #self.cases.append((csr_matrix((ones(4),array([0,0,1,1]),array([0,1,2,2,3,4])),shape=(5,2)), vstack((ones(5),arange(5),arange(5)**2)).T )) + #self.cases.append((csr_matrix((ones(6),array([1,3,0,2,1,0]),array([0,0,1,2,2,3,4,5,5,6])),shape=(9,4)), vstack((ones(9),arange(9),arange(9)**2)).T )) + #self.cases.append((csr_matrix((ones(6),array([1,3,0,2,1,0]),array([0,0,1,2,2,3,4,5,5,6])),shape=(9,4)), vstack((ones(9),arange(9))).T )) def check_all_cases(self): """Test case where aggregation includes all fine nodes""" @@ -168,7 +168,7 @@ ## #aggregate one more level (to a single aggregate) ## K = coarse_candidates.shape[1] ## N = K*AggOp.shape[1] -## AggOp = csr_matrix((ones(N),zeros(N),arange(N + 1)),dims=(N,1)) #aggregate to a single point +## AggOp = csr_matrix((ones(N),zeros(N),arange(N + 1)),shape=(N,1)) #aggregate to a single point ## fine_candidates = coarse_candidates ## ## #mask_candidate(AggOp,fine_candidates) #not needed Modified: trunk/scipy/sandbox/multigrid/tests/test_utils.py =================================================================== --- trunk/scipy/sandbox/multigrid/tests/test_utils.py 2007-12-14 22:44:43 UTC (rev 3657) +++ trunk/scipy/sandbox/multigrid/tests/test_utils.py 2007-12-14 23:31:02 UTC (rev 3658) @@ -116,8 +116,8 @@ cases.append( ( matrix([[0,1,0],[0,2,3]]), (3,2) ) ) cases.append( ( matrix([[1,0,0],[2,0,3]]), (2,5) ) ) - for A,dims in cases: - m,n = dims + for A,shape in cases: + m,n = shape result = expand_into_blocks(csr_matrix(A),m,n).todense() expected = zeros((m*A.shape[0],n*A.shape[1])) Modified: trunk/scipy/sandbox/multigrid/utils.py =================================================================== --- trunk/scipy/sandbox/multigrid/utils.py 2007-12-14 22:44:43 UTC (rev 3657) +++ trunk/scipy/sandbox/multigrid/utils.py 2007-12-14 23:31:02 UTC (rev 3658) @@ -112,7 +112,7 @@ if isspmatrix_csr(A) or isspmatrix_csc(A): #avoid copying index and ptr arrays - abs_A = A.__class__((abs(A.data),A.indices,A.indptr),dims=A.shape) + abs_A = A.__class__((abs(A.data),A.indices,A.indptr),shape=A.shape) return (abs_A * numpy.ones(A.shape[1],dtype=A.dtype)).max() else: return (abs(A) * numpy.ones(A.shape[1],dtype=A.dtype)).max() @@ -152,7 +152,7 @@ data = A.data[:A.nnz] * D_sqrt_inv[Acoo.row] data *= D_sqrt_inv[Acoo.col] - DAD = A.__class__((data,A.indices[:A.nnz],A.indptr),dims=A.shape) + DAD = A.__class__((data,A.indices[:A.nnz],A.indptr),shape=A.shape) return D_sqrt,D_sqrt_inv,DAD @@ -169,7 +169,7 @@ I = concatenate((A.row,B.row)) J = concatenate((A.col,B.col+A.shape[1])) V = concatenate((A.data,B.data)) - return coo_matrix((V,(I,J)),dims=(A.shape[0],A.shape[1]+B.shape[1])).tocsr() + return coo_matrix((V,(I,J)),shape=(A.shape[0],A.shape[1]+B.shape[1])).tocsr() def vstack_csr(A,B): #TODO OPTIMIZE THIS @@ -184,7 +184,7 @@ I = concatenate((A.row,B.row+A.shape[0])) J = concatenate((A.col,B.col)) V = concatenate((A.data,B.data)) - return coo_matrix((V,(I,J)),dims=(A.shape[0]+B.shape[0],A.shape[1])).tocsr() + return coo_matrix((V,(I,J)),shape=(A.shape[0]+B.shape[0],A.shape[1])).tocsr() def expand_into_blocks(A,m,n): @@ -224,4 +224,4 @@ data = A.data.repeat(m*n) - return coo_matrix((data,(row,col)),dims=(m*A.shape[0],n*A.shape[1])) + return coo_matrix((data,(row,col)),shape=(m*A.shape[0],n*A.shape[1])) From scipy-svn at scipy.org Fri Dec 14 18:33:56 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 14 Dec 2007 17:33:56 -0600 (CST) Subject: [Scipy-svn] r3659 - in branches/io_new: . matlab tests Message-ID: <20071214233356.4582E39C07E@new.scipy.org> Author: jarrod.millman Date: 2007-12-14 17:33:47 -0600 (Fri, 14 Dec 2007) New Revision: 3659 Added: branches/io_new/matlab/ branches/io_new/matlab/mio.py branches/io_new/matlab/mio4.py branches/io_new/matlab/mio5.py branches/io_new/matlab/miobase.py Removed: branches/io_new/mio.py branches/io_new/mio4.py branches/io_new/mio5.py branches/io_new/miobase.py Modified: branches/io_new/__init__.py branches/io_new/tests/test_mio.py Log: moved matlab code to new directory Modified: branches/io_new/__init__.py =================================================================== --- branches/io_new/__init__.py 2007-12-14 23:31:02 UTC (rev 3658) +++ branches/io_new/__init__.py 2007-12-14 23:33:47 UTC (rev 3659) @@ -8,7 +8,7 @@ from numpyio import packbits, unpackbits, bswap, fread, fwrite, \ convert_objectarray # matfile read and write -from mio import * +from matlab.mio import loadmat, savemat # netCDF file support from netcdf import * from npfile import npfile Copied: branches/io_new/matlab/mio.py (from rev 3657, branches/io_new/mio.py) =================================================================== --- branches/io_new/mio.py 2007-12-14 22:44:43 UTC (rev 3657) +++ branches/io_new/matlab/mio.py 2007-12-14 23:33:47 UTC (rev 3659) @@ -0,0 +1,133 @@ +# Authors: Travis Oliphant, Matthew Brett + +""" +Module for reading and writing matlab (TM) .mat files +""" + +import os +import sys + +from scipy.io.matlab.mio4 import MatFile4Reader, MatFile4Writer +from scipy.io.matlab.mio5 import MatFile5Reader, MatFile5Writer + +__all__ = ['find_mat_file', 'mat_reader_factory', 'loadmat', 'savemat'] + +def find_mat_file(file_name, appendmat=True): + ''' Try to find .mat file on system path + + file_name - file name string + append_mat - If True, and file_name does not end in '.mat', appends it + ''' + if appendmat and file_name[-4:] == ".mat": + file_name = file_name[:-4] + if os.sep in file_name: + full_name = file_name + if appendmat: + full_name = file_name + ".mat" + else: + full_name = None + junk, file_name = os.path.split(file_name) + for path in [os.curdir] + list(sys.path): + test_name = os.path.join(path, file_name) + if appendmat: + test_name += ".mat" + try: + fid = open(test_name,'rb') + fid.close() + full_name = test_name + break + except IOError: + pass + return full_name + +def mat_reader_factory(file_name, appendmat=True, **kwargs): + """Create reader for matlab (TM) .mat format files + + See docstring for loadmat for input options + """ + if isinstance(file_name, basestring): + full_name = find_mat_file(file_name, appendmat) + if full_name is None: + raise IOError, "%s not found on the path." % file_name + byte_stream = open(full_name, 'rb') + else: + try: + file_name.read(0) + except AttributeError: + raise IOError, 'Reader needs file name or open file-like object' + byte_stream = file_name + + MR = MatFile4Reader(byte_stream, **kwargs) + if MR.format_looks_right(): + return MR + return MatFile5Reader(byte_stream, **kwargs) + +def loadmat(file_name, mdict=None, appendmat=True, basename='raw', **kwargs): + ''' Load Matlab(tm) file + + file_name - Name of the mat file + (do not need .mat extension if appendmat==True) + If name not a full path name, search for the file on + the sys.path list and use the first one found (the + current directory is searched first). + Can also pass open file-like object + m_dict - optional dictionary in which to insert matfile variables + appendmat - True to append the .mat extension to the end of the + given filename, if not already present + base_name - base name for unnamed variables (unused in code) + byte_order - byte order ('native', 'little', 'BIG') + in ('native', '=') + or in ('little', '<') + or in ('BIG', '>') + mat_dtype - return arrays in same dtype as loaded into matlab + (instead of the dtype with which they are saved) + squeeze_me - whether to squeeze matrix dimensions or not + chars_as_strings - whether to convert char arrays to string arrays + mat_dtype - return matrices with datatype that matlab would load as + (rather than in the datatype matlab saves as) + matlab_compatible - returns matrices as would be loaded by matlab + (implies squeeze_me=False, chars_as_strings=False, + mat_dtype=True) + + v4 (Level 1.0), v6 and v7.1 matfiles are supported. + + ''' + MR = mat_reader_factory(file_name, appendmat, **kwargs) + matfile_dict = MR.get_variables() + if mdict is not None: + mdict.update(matfile_dict) + else: + mdict = matfile_dict + return mdict + +def savemat(file_name, mdict, appendmat=True, format='4'): + """Save a dictionary of names and arrays into the MATLAB-style .mat file. + + This saves the arrayobjects in the given dictionary to a matlab + style .mat file. + + appendmat - if true, appends '.mat' extension to filename, if not present + format - '4' for matlab 4 mat files, '5' for matlab 5 onwards + """ + file_is_string = isinstance(file_name, basestring) + if file_is_string: + if appendmat and file_name[-4:] != ".mat": + file_name = file_name + ".mat" + file_stream = open(file_name, 'wb') + else: + try: + file_name.write('') + except AttributeError: + raise IOError, 'Writer needs file name or writeable '\ + 'file-like object' + file_stream = file_name + + if format == '4': + MW = MatFile4Writer(file_stream) + elif format == '5': + MW = MatFile5Writer(file_stream) + else: + raise ValueError, 'Format should be 4 or 5' + MW.put_variables(mdict) + if file_is_string: + file_stream.close() Copied: branches/io_new/matlab/mio4.py (from rev 3657, branches/io_new/mio4.py) =================================================================== --- branches/io_new/mio4.py 2007-12-14 22:44:43 UTC (rev 3657) +++ branches/io_new/matlab/mio4.py 2007-12-14 23:33:47 UTC (rev 3659) @@ -0,0 +1,345 @@ +''' Classes for read / write of matlab (TM) 4 files +''' + +import numpy as N + +from scipy.io.matlab.miobase import * + +miDOUBLE = 0 +miSINGLE = 1 +miINT32 = 2 +miINT16 = 3 +miUINT16 = 4 +miUINT8 = 5 + +mdtypes_template = { + miDOUBLE: 'f8', + miSINGLE: 'f4', + miINT32: 'i4', + miINT16: 'i2', + miUINT16: 'u2', + miUINT8: 'u1', + 'header': [('mopt', 'i4'), + ('mrows', 'i4'), + ('ncols', 'i4'), + ('imagf', 'i4'), + ('namlen', 'i4')], + 'U1': 'U1', + } + +np_to_mtypes = { + 'f8': miDOUBLE, + 'c32': miDOUBLE, + 'c24': miDOUBLE, + 'c16': miDOUBLE, + 'f4': miSINGLE, + 'c8': miSINGLE, + 'i4': miINT32, + 'i2': miINT16, + 'u2': miUINT16, + 'u1': miUINT8, + 'S1': miUINT8, + } + +# matrix classes +mxFULL_CLASS = 0 +mxCHAR_CLASS = 1 +mxSPARSE_CLASS = 2 + +order_codes = { + 0: '<', + 1: '>', + 2: 'VAX D-float', #! + 3: 'VAX G-float', + 4: 'Cray', #!! + } + + +class Mat4ArrayReader(MatArrayReader): + ''' Class for reading Mat4 arrays + ''' + + def matrix_getter_factory(self): + ''' Read header, return matrix getter ''' + data = self.read_dtype(self.dtypes['header']) + header = {} + header['name'] = self.read_ztstring(data['namlen']) + if data['mopt'] < 0 or data['mopt'] > 5000: + ValueError, 'Mat 4 mopt wrong format, byteswapping problem?' + M,rest = divmod(data['mopt'], 1000) + O,rest = divmod(rest,100) + P,rest = divmod(rest,10) + T = rest + if O != 0: + raise ValueError, 'O in MOPT integer should be 0, wrong format?' + header['dtype'] = self.dtypes[P] + header['mclass'] = T + header['dims'] = (data['mrows'], data['ncols']) + header['is_complex'] = data['imagf'] == 1 + remaining_bytes = header['dtype'].itemsize * N.product(header['dims']) + if header['is_complex'] and not header['mclass'] == mxSPARSE_CLASS: + remaining_bytes *= 2 + next_pos = self.mat_stream.tell() + remaining_bytes + if T == mxFULL_CLASS: + getter = Mat4FullGetter(self, header) + elif T == mxCHAR_CLASS: + getter = Mat4CharGetter(self, header) + elif T == mxSPARSE_CLASS: + getter = Mat4SparseGetter(self, header) + else: + raise TypeError, 'No reader for class code %s' % T + getter.next_position = next_pos + return getter + + +class Mat4MatrixGetter(MatMatrixGetter): + + # Mat4 variables never global or logical + is_global = False + is_logical = False + + def read_array(self, copy=True): + ''' Mat4 read array always uses header dtype and dims + copy - copies array if True + (buffer is usually read only) + a_dtype is assumed to be correct endianness + ''' + dt = self.header['dtype'] + dims = self.header['dims'] + num_bytes = dt.itemsize + for d in dims: + num_bytes *= d + arr = N.ndarray(shape=dims, + dtype=dt, + buffer=self.mat_stream.read(num_bytes), + order='F') + if copy: + arr = arr.copy() + return arr + + +class Mat4FullGetter(Mat4MatrixGetter): + def __init__(self, array_reader, header): + super(Mat4FullGetter, self).__init__(array_reader, header) + if header['is_complex']: + self.mat_dtype = N.dtype(N.complex128) + else: + self.mat_dtype = N.dtype(N.float64) + + def get_raw_array(self): + if self.header['is_complex']: + # avoid array copy to save memory + res = self.read_array(copy=False) + res_j = self.read_array(copy=False) + return res + (res_j * 1j) + return self.read_array() + + +class Mat4CharGetter(Mat4MatrixGetter): + def get_raw_array(self): + arr = self.read_array().astype(N.uint8) + # ascii to unicode + S = arr.tostring().decode('ascii') + return N.ndarray(shape=self.header['dims'], + dtype=N.dtype('U1'), + buffer = N.array(S)).copy() + + +class Mat4SparseGetter(Mat4MatrixGetter): + ''' Read sparse matrix type + + Matlab (TM) 4 real sparse arrays are saved in a N+1 by 3 array + format, where N is the number of non-zero values. Column 1 values + [0:N] are the (1-based) row indices of the each non-zero value, + column 2 [0:N] are the column indices, column 3 [0:N] are the + (real) values. The last values [-1,0:2] of the rows, column + indices are shape[0] and shape[1] respectively of the output + matrix. The last value for the values column is a padding 0. mrows + and ncols values from the header give the shape of the stored + matrix, here [N+1, 3]. Complex data is saved as a 4 column + matrix, where the fourth column contains the imaginary component; + the last value is again 0. Complex sparse data do _not_ have the + header imagf field set to True; the fact that the data are complex + is only detectable because there are 4 storage columns + ''' + def get_raw_array(self): + res = self.read_array() + tmp = res[:-1,:] + dims = res[-1,0:2] + I = N.ascontiguousarray(tmp[:,0],dtype='intc') #fixes byte order also + J = N.ascontiguousarray(tmp[:,1],dtype='intc') + I -= 1 # for 1-based indexing + J -= 1 + if res.shape[1] == 3: + V = N.ascontiguousarray(tmp[:,2],dtype='float') + else: + V = N.ascontiguousarray(tmp[:,2],dtype='complex') + V.imag = tmp[:,3] + if have_sparse: + return scipy.sparse.coo_matrix((V,(I,J)), dims) + return (dims, I, J, V) + + +class MatFile4Reader(MatFileReader): + ''' Reader for Mat4 files ''' + def __init__(self, mat_stream, *args, **kwargs): + self._array_reader = Mat4ArrayReader( + mat_stream, + None, + None, + ) + super(MatFile4Reader, self).__init__(mat_stream, *args, **kwargs) + self._array_reader.processor_func = self.processor_func + + def set_dtypes(self): + self.dtypes = self.convert_dtypes(mdtypes_template) + self._array_reader.dtypes = self.dtypes + + def matrix_getter_factory(self): + return self._array_reader.matrix_getter_factory() + + def format_looks_right(self): + # Mat4 files have a zero somewhere in first 4 bytes + self.mat_stream.seek(0) + mopt_bytes = N.ndarray(shape=(4,), + dtype=N.uint8, + buffer = self.mat_stream.read(4)) + self.mat_stream.seek(0) + return 0 in mopt_bytes + + def guess_byte_order(self): + self.mat_stream.seek(0) + mopt = self.read_dtype(N.dtype('i4')) + self.mat_stream.seek(0) + if mopt < 0 or mopt > 5000: + return ByteOrder.swapped_code + return ByteOrder.native_code + + +class Mat4MatrixWriter(MatStreamWriter): + + def write_header(self, P=0, T=0, imagf=0, dims=None): + ''' Write header for given data options + P - mat4 data type + T - mat4 matrix class + imagf - complex flag + dims - matrix dimensions + ''' + if dims is None: + dims = self.arr.shape + header = N.empty((), mdtypes_template['header']) + M = not ByteOrder.little_endian + O = 0 + header['mopt'] = (M * 1000 + + O * 100 + + P * 10 + + T) + header['mrows'] = dims[0] + header['ncols'] = dims[1] + header['imagf'] = imagf + header['namlen'] = len(self.name) + 1 + self.write_bytes(header) + self.write_string(self.name + '\0') + + def arr_to_2d(self): + self.arr = N.atleast_2d(self.arr) + dims = self.arr.shape + if len(dims) > 2: + self.arr = self.arr.reshape(-1,dims[-1]) + + def write(self): + assert False, 'Not implemented' + + +class Mat4NumericWriter(Mat4MatrixWriter): + + def write(self): + self.arr_to_2d() + imagf = self.arr.dtype.kind == 'c' + try: + P = np_to_mtypes[self.arr.dtype.str[1:]] + except KeyError: + if imagf: + self.arr = self.arr.astype('c128') + else: + self.arr = self.arr.astype('f8') + P = miDOUBLE + self.write_header(P=P, + T=mxFULL_CLASS, + imagf=imagf) + if imagf: + self.write_bytes(self.arr.real) + self.write_bytes(self.arr.imag) + else: + self.write_bytes(self.arr) + + +class Mat4CharWriter(Mat4MatrixWriter): + + def write(self): + self.arr_to_chars() + self.arr_to_2d() + dims = self.arr.shape + self.write_header(P=miUINT8, + T=mxCHAR_CLASS) + if self.arr.dtype.kind == 'U': + # Recode unicode to ascii + n_chars = N.product(dims) + st_arr = N.ndarray(shape=(), + dtype=self.arr_dtype_number(n_chars), + buffer=self.arr) + st = st_arr.item().encode('ascii') + self.arr = N.ndarray(shape=dims, dtype='S1', buffer=st) + self.write_bytes(self.arr) + + +class Mat4SparseWriter(Mat4MatrixWriter): + + def write(self): + ''' Sparse matrices are 2D + See docstring for Mat4SparseGetter + ''' + imagf = self.arr.dtype.kind == 'c' + nnz = self.arr.nnz + ijd = N.zeros((nnz+1, 3+imagf), dtype='f8') + for i in range(nnz): + ijd[i,0], ijd[i,1] = self.arr.rowcol(i) + ijd[:-1,0:2] += 1 # 1 based indexing + if imagf: + ijd[:-1,2] = self.arr.data.real + ijd[:-1,3] = self.arr.data.imag + else: + ijd[:-1,2] = self.arr.data + ijd[-1,0:2] = self.arr.shape + self.write_header(P=miDOUBLE, + T=mxSPARSE_CLASS, + dims=ijd.shape) + self.write_bytes(ijd) + + +def matrix_writer_factory(stream, arr, name): + ''' Factory function to return matrix writer given variable to write + stream - file or file-like stream to write to + arr - array to write + name - name in matlab (TM) workspace + ''' + if have_sparse: + if scipy.sparse.issparse(arr): + return Mat4SparseWriter(stream, arr, name) + arr = N.array(arr) + dtt = arr.dtype.type + if dtt is N.object_: + raise TypeError, 'Cannot save object arrays in Mat4' + elif dtt is N.void: + raise TypeError, 'Cannot save void type arrays' + elif dtt in (N.unicode_, N.string_): + return Mat4CharWriter(stream, arr, name) + else: + return Mat4NumericWriter(stream, arr, name) + + +class MatFile4Writer(MatFileWriter): + + def put_variables(self, mdict): + for name, var in mdict.items(): + matrix_writer_factory(self.file_stream, var, name).write() Copied: branches/io_new/matlab/mio5.py (from rev 3657, branches/io_new/mio5.py) =================================================================== --- branches/io_new/mio5.py 2007-12-14 22:44:43 UTC (rev 3657) +++ branches/io_new/matlab/mio5.py 2007-12-14 23:33:47 UTC (rev 3659) @@ -0,0 +1,807 @@ +''' Classes for read / write of matlab (TM) 5 files +''' + +# Small fragments of current code adapted from matfile.py by Heiko +# Henkelmann + +## Notice in matfile.py file + +# Copyright (c) 2003 Heiko Henkelmann + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. + +import zlib +from copy import copy as pycopy +from cStringIO import StringIO +import numpy as N + +from scipy.io.matlab.miobase import * + +try: # Python 2.3 support + from sets import Set as set +except: + pass + +miINT8 = 1 +miUINT8 = 2 +miINT16 = 3 +miUINT16 = 4 +miINT32 = 5 +miUINT32 = 6 +miSINGLE = 7 +miDOUBLE = 9 +miINT64 = 12 +miUINT64 = 13 +miMATRIX = 14 +miCOMPRESSED = 15 +miUTF8 = 16 +miUTF16 = 17 +miUTF32 = 18 + +mxCELL_CLASS = 1 +mxSTRUCT_CLASS = 2 +mxOBJECT_CLASS = 3 +mxCHAR_CLASS = 4 +mxSPARSE_CLASS = 5 +mxDOUBLE_CLASS = 6 +mxSINGLE_CLASS = 7 +mxINT8_CLASS = 8 +mxUINT8_CLASS = 9 +mxINT16_CLASS = 10 +mxUINT16_CLASS = 11 +mxINT32_CLASS = 12 +mxUINT32_CLASS = 13 + +mdtypes_template = { + miINT8: 'i1', + miUINT8: 'u1', + miINT16: 'i2', + miUINT16: 'u2', + miINT32: 'i4', + miUINT32: 'u4', + miSINGLE: 'f4', + miDOUBLE: 'f8', + miINT64: 'i8', + miUINT64: 'u8', + miUTF8: 'u1', + miUTF16: 'u2', + miUTF32: 'u4', + 'file_header': [('description', 'S116'), + ('subsystem_offset', 'i8'), + ('version', 'u2'), + ('endian_test', 'S2')], + 'tag_full': [('mdtype', 'u4'), ('byte_count', 'u4')], + 'array_flags': [('data_type', 'u4'), + ('byte_count', 'u4'), + ('flags_class','u4'), + ('nzmax', 'u4')], + 'U1': 'U1', + } + +mclass_dtypes_template = { + mxINT8_CLASS: 'i1', + mxUINT8_CLASS: 'u1', + mxINT16_CLASS: 'i2', + mxUINT16_CLASS: 'u2', + mxINT32_CLASS: 'i4', + mxUINT32_CLASS: 'u4', + mxSINGLE_CLASS: 'f4', + mxDOUBLE_CLASS: 'f8', + } + + +np_to_mtypes = { + 'f8': miDOUBLE, + 'c32': miDOUBLE, + 'c24': miDOUBLE, + 'c16': miDOUBLE, + 'f4': miSINGLE, + 'c8': miSINGLE, + 'i1': miINT8, + 'i2': miINT16, + 'i4': miINT32, + 'u1': miUINT8, + 'u4': miUINT32, + 'u2': miUINT16, + 'S1': miUINT8, + 'U1': miUTF16, + } + + +np_to_mxtypes = { + 'f8': mxDOUBLE_CLASS, + 'c32': mxDOUBLE_CLASS, + 'c24': mxDOUBLE_CLASS, + 'c16': mxDOUBLE_CLASS, + 'f4': mxSINGLE_CLASS, + 'c8': mxSINGLE_CLASS, + 'i4': mxINT32_CLASS, + 'i2': mxINT16_CLASS, + 'u2': mxUINT16_CLASS, + 'u1': mxUINT8_CLASS, + 'S1': mxUINT8_CLASS, + } + + + +''' Before release v7.1 (release 14) matlab (TM) used the system +default character encoding scheme padded out to 16-bits. Release 14 +and later use Unicode. When saving character data, R14 checks if it +can be encoded in 7-bit ascii, and saves in that format if so.''' + +codecs_template = { + miUTF8: {'codec': 'utf_8', 'width': 1}, + miUTF16: {'codec': 'utf_16', 'width': 2}, + miUTF32: {'codec': 'utf_32','width': 4}, + } + +miUINT16_codec = sys.getdefaultencoding() + +mx_numbers = ( + mxDOUBLE_CLASS, + mxSINGLE_CLASS, + mxINT8_CLASS, + mxUINT8_CLASS, + mxINT16_CLASS, + mxUINT16_CLASS, + mxINT32_CLASS, + mxUINT32_CLASS, + ) + +class mat_struct(object): + ''' Placeholder for holding read data from structs ''' + pass + +class mat_obj(object): + ''' Placeholder for holding read data from objects ''' + pass + +class Mat5ArrayReader(MatArrayReader): + ''' Class to get Mat5 arrays + + Provides element reader functions, header reader, matrix reader + factory function + ''' + + def __init__(self, mat_stream, dtypes, processor_func, codecs, class_dtypes): + super(Mat5ArrayReader, self).__init__(mat_stream, + dtypes, + processor_func, + ) + self.codecs = codecs + self.class_dtypes = class_dtypes + + def read_element(self, copy=True): + raw_tag = self.mat_stream.read(8) + tag = N.ndarray(shape=(), + dtype=self.dtypes['tag_full'], + buffer = raw_tag) + mdtype = tag['mdtype'].item() + byte_count = mdtype >> 16 + if byte_count: # small data element format + if byte_count > 4: + raise ValueError, 'Too many bytes for sde format' + mdtype = mdtype & 0xFFFF + dt = self.dtypes[mdtype] + el_count = byte_count / dt.itemsize + return N.ndarray(shape=(el_count,), + dtype=dt, + buffer=raw_tag[4:]) + byte_count = tag['byte_count'].item() + if mdtype == miMATRIX: + return self.current_getter(byte_count).get_array() + if mdtype in self.codecs: # encoded char data + raw_str = self.mat_stream.read(byte_count) + codec = self.codecs[mdtype] + if not codec: + raise TypeError, 'Do not support encoding %d' % mdtype + el = raw_str.decode(codec) + else: # numeric data + dt = self.dtypes[mdtype] + el_count = byte_count / dt.itemsize + el = N.ndarray(shape=(el_count,), + dtype=dt, + buffer=self.mat_stream.read(byte_count)) + if copy: + el = el.copy() + mod8 = byte_count % 8 + if mod8: + self.mat_stream.seek(8 - mod8, 1) + return el + + def matrix_getter_factory(self): + ''' Returns reader for next matrix at top level ''' + tag = self.read_dtype(self.dtypes['tag_full']) + mdtype = tag['mdtype'].item() + byte_count = tag['byte_count'].item() + next_pos = self.mat_stream.tell() + byte_count + if mdtype == miCOMPRESSED: + getter = Mat5ZArrayReader(self, byte_count).matrix_getter_factory() + elif not mdtype == miMATRIX: + raise TypeError, \ + 'Expecting miMATRIX type here, got %d' % mdtype + else: + getter = self.current_getter(byte_count) + getter.next_position = next_pos + return getter + + def current_getter(self, byte_count): + ''' Return matrix getter for current stream position + + Returns matrix getters at top level and sub levels + ''' + if not byte_count: # an empty miMATRIX can contain no bytes + return Mat5EmptyMatrixGetter(self) + af = self.read_dtype(self.dtypes['array_flags']) + header = {} + flags_class = af['flags_class'] + mc = flags_class & 0xFF + header['mclass'] = mc + header['is_logical'] = flags_class >> 9 & 1 + header['is_global'] = flags_class >> 10 & 1 + header['is_complex'] = flags_class >> 11 & 1 + header['nzmax'] = af['nzmax'] + header['dims'] = self.read_element() + header['name'] = self.read_element().tostring() + if mc in mx_numbers: + return Mat5NumericMatrixGetter(self, header) + if mc == mxSPARSE_CLASS: + return Mat5SparseMatrixGetter(self, header) + if mc == mxCHAR_CLASS: + return Mat5CharMatrixGetter(self, header) + if mc == mxCELL_CLASS: + return Mat5CellMatrixGetter(self, header) + if mc == mxSTRUCT_CLASS: + return Mat5StructMatrixGetter(self, header) + if mc == mxOBJECT_CLASS: + return Mat5ObjectMatrixGetter(self, header) + raise TypeError, 'No reader for class code %s' % mc + + +class Mat5ZArrayReader(Mat5ArrayReader): + ''' Getter for compressed arrays + + Reads and uncompresses gzipped stream on init, providing wrapper + for this new sub-stream. + ''' + def __init__(self, array_reader, byte_count): + '''Reads and uncompresses gzipped stream''' + data = array_reader.mat_stream.read(byte_count) + super(Mat5ZArrayReader, self).__init__( + StringIO(zlib.decompress(data)), + array_reader.dtypes, + array_reader.processor_func, + array_reader.codecs, + array_reader.class_dtypes) + + +class Mat5MatrixGetter(MatMatrixGetter): + ''' Base class for getting Mat5 matrices + + Gets current read information from passed array_reader + ''' + + def __init__(self, array_reader, header): + super(Mat5MatrixGetter, self).__init__(array_reader, header) + self.class_dtypes = array_reader.class_dtypes + self.codecs = array_reader.codecs + self.is_global = header['is_global'] + self.mat_dtype = None + + def read_element(self, *args, **kwargs): + return self.array_reader.read_element(*args, **kwargs) + + +class Mat5EmptyMatrixGetter(Mat5MatrixGetter): + ''' Dummy class to return empty array for empty matrix + ''' + def __init__(self, array_reader): + self.array_reader = array_reader + self.mat_stream = array_reader.mat_stream + self.data_position = self.mat_stream.tell() + self.header = {} + self.is_global = False + self.mat_dtype = 'f8' + + def get_raw_array(self): + return N.array([[]]) + + +class Mat5NumericMatrixGetter(Mat5MatrixGetter): + + def __init__(self, array_reader, header): + super(Mat5NumericMatrixGetter, self).__init__(array_reader, header) + if header['is_logical']: + self.mat_dtype = N.dtype('bool') + else: + self.mat_dtype = self.class_dtypes[header['mclass']] + + def get_raw_array(self): + if self.header['is_complex']: + # avoid array copy to save memory + res = self.read_element(copy=False) + res_j = self.read_element(copy=False) + res = res + (res_j * 1j) + else: + res = self.read_element() + return N.ndarray(shape=self.header['dims'], + dtype=res.dtype, + buffer=res, + order='F') + + +class Mat5SparseMatrixGetter(Mat5MatrixGetter): + def get_raw_array(self): + rowind = self.read_element() + indptr = self.read_element() + if self.header['is_complex']: + # avoid array copy to save memory + data = self.read_element(copy=False) + data_j = self.read_element(copy=False) + data = data + (data_j * 1j) + else: + data = self.read_element() + ''' From the matlab (TM) API documentation, last found here: + http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/ + rowind are simply the row indices for all the (res) non-zero + entries in the sparse array. rowind has nzmax entries, so + may well have more entries than len(res), the actual number + of non-zero entries, but rowind[len(res):] can be discarded + and should be 0. indptr has length (number of columns + 1), + and is such that, if D = diff(colind), D[j] gives the number + of non-zero entries in column j. Because rowind values are + stored in column order, this gives the column corresponding to + each rowind + ''' + if have_sparse: + dims = self.header['dims'] + return scipy.sparse.csc_matrix((data,rowind,indptr), dims) + else: + return (dims, data, rowind, indptr) + + +class Mat5CharMatrixGetter(Mat5MatrixGetter): + def get_raw_array(self): + res = self.read_element() + # Convert non-string types to unicode + if isinstance(res, N.ndarray): + if res.dtype.type == N.uint16: + codec = miUINT16_codec + if self.codecs['uint16_len'] == 1: + res = res.astype(N.uint8) + elif res.dtype.type in (N.uint8, N.int8): + codec = 'ascii' + else: + raise TypeError, 'Did not expect type %s' % res.dtype + res = res.tostring().decode(codec) + return N.ndarray(shape=self.header['dims'], + dtype=N.dtype('U1'), + buffer=N.array(res), + order='F').copy() + + +class Mat5CellMatrixGetter(Mat5MatrixGetter): + def get_raw_array(self): + # Account for fortran indexing of cells + tupdims = tuple(self.header['dims'][::-1]) + length = N.product(tupdims) + result = N.empty(length, dtype=object) + for i in range(length): + result[i] = self.get_item() + return result.reshape(tupdims).T + + def get_item(self): + return self.read_element() + + +class Mat5StructMatrixGetter(Mat5CellMatrixGetter): + def __init__(self, *args, **kwargs): + super(Mat5StructMatrixGetter, self).__init__(*args, **kwargs) + self.obj_template = mat_struct() + + def get_raw_array(self): + namelength = self.read_element()[0] + # get field names + names = self.read_element() + splitnames = [names[i:i+namelength] for i in \ + xrange(0,len(names),namelength)] + self.obj_template._fieldnames = [x.tostring().strip('\x00') + for x in splitnames] + return super(Mat5StructMatrixGetter, self).get_raw_array() + + def get_item(self): + item = pycopy(self.obj_template) + for element in item._fieldnames: + item.__dict__[element] = self.read_element() + return item + + +class Mat5ObjectMatrixGetter(Mat5StructMatrixGetter): + def __init__(self, *args, **kwargs): + super(Mat5StructMatrixGetter, self).__init__(*args, **kwargs) + self.obj_template = mat_obj() + + def get_raw_array(self): + self.obj_template._classname = self.read_element().tostring() + return super(Mat5ObjectMatrixGetter, self).get_raw_array() + + +class MatFile5Reader(MatFileReader): + ''' Reader for Mat 5 mat files + + Adds the following attribute to base class + + uint16_codec - char codec to use for uint16 char arrays + (defaults to system default codec) + ''' + + def __init__(self, + mat_stream, + byte_order=None, + mat_dtype=False, + squeeze_me=True, + chars_as_strings=True, + matlab_compatible=False, + uint16_codec=None + ): + self.codecs = {} + self._array_reader = Mat5ArrayReader( + mat_stream, + None, + None, + None, + None, + ) + super(MatFile5Reader, self).__init__( + mat_stream, + byte_order, + mat_dtype, + squeeze_me, + chars_as_strings, + matlab_compatible, + ) + self._array_reader.processor_func = self.processor_func + self.uint16_codec = uint16_codec + + def get_uint16_codec(self): + return self._uint16_codec + def set_uint16_codec(self, uint16_codec): + if not uint16_codec: + uint16_codec = sys.getdefaultencoding() + # Set length of miUINT16 char encoding + self.codecs['uint16_len'] = len(" ".encode(uint16_codec)) \ + - len(" ".encode(uint16_codec)) + self.codecs['uint16_codec'] = uint16_codec + self._array_reader.codecs = self.codecs + self._uint16_codec = uint16_codec + uint16_codec = property(get_uint16_codec, + set_uint16_codec, + None, + 'get/set uint16_codec') + + def set_dtypes(self): + ''' Set dtypes and codecs ''' + self.dtypes = self.convert_dtypes(mdtypes_template) + self.class_dtypes = self.convert_dtypes(mclass_dtypes_template) + codecs = {} + postfix = self.order_code == '<' and '_le' or '_be' + for k, v in codecs_template.items(): + codec = v['codec'] + try: + " ".encode(codec) + except LookupError: + codecs[k] = None + continue + if v['width'] > 1: + codec += postfix + codecs[k] = codec + self.codecs.update(codecs) + self.update_array_reader() + + def update_array_reader(self): + self._array_reader.codecs = self.codecs + self._array_reader.dtypes = self.dtypes + self._array_reader.class_dtypes = self.class_dtypes + + def matrix_getter_factory(self): + return self._array_reader.matrix_getter_factory() + + def guess_byte_order(self): + self.mat_stream.seek(126) + mi = self.mat_stream.read(2) + self.mat_stream.seek(0) + return mi == 'IM' and '<' or '>' + + def file_header(self): + ''' Read in mat 5 file header ''' + hdict = {} + hdr = self.read_dtype(self.dtypes['file_header']) + hdict['__header__'] = hdr['description'].item().strip(' \t\n\000') + v_major = hdr['version'] >> 8 + v_minor = hdr['version'] & 0xFF + hdict['__version__'] = '%d.%d' % (v_major, v_minor) + return hdict + + def format_looks_right(self): + # Mat4 files have a zero somewhere in first 4 bytes + self.mat_stream.seek(0) + mopt_bytes = N.ndarray(shape=(4,), + dtype=N.uint8, + buffer = self.mat_stream.read(4)) + self.mat_stream.seek(0) + return 0 not in mopt_bytes + + +class Mat5MatrixWriter(MatStreamWriter): + + mat_tag = N.zeros((), mdtypes_template['tag_full']) + mat_tag['mdtype'] = miMATRIX + + def __init__(self, file_stream, arr, name, is_global=False): + super(Mat5MatrixWriter, self).__init__(file_stream, arr, name) + self.is_global = is_global + + def write_dtype(self, arr): + self.file_stream.write(arr.tostring()) + + def write_element(self, arr, mdtype=None): + # write tag, data + tag = N.zeros((), mdtypes_template['tag_full']) + if mdtype is None: + tag['mdtype'] = np_to_mtypes[arr.dtype.str[1:]] + else: + tag['mdtype'] = mdtype + tag['byte_count'] = arr.size*arr.itemsize + self.write_dtype(tag) + self.write_bytes(arr) + # do 8 byte padding if needed + if tag['byte_count']%8 != 0: + pad = (1+tag['byte_count']//8)*8 - tag['byte_count'] + self.write_bytes(N.zeros((pad,),dtype='u1')) + + def write_header(self, mclass, + is_global=False, + is_complex=False, + is_logical=False, + nzmax=0): + ''' Write header for given data options + mclass - mat5 matrix class + is_global - True if matrix is global + is_complex - True is matrix is complex + is_logical - True if matrix is logical + nzmax - max non zero elements for sparse arrays + ''' + self._mat_tag_pos = self.file_stream.tell() + self.write_dtype(self.mat_tag) + # write array flags (complex, global, logical, class, nzmax) + af = N.zeros((), mdtypes_template['array_flags']) + af['data_type'] = miUINT32 + af['byte_count'] = 8 + flags = is_complex << 3 | is_global << 2 | is_logical << 1 + af['flags_class'] = mclass | flags << 8 + af['nzmax'] = nzmax + self.write_dtype(af) + # write array shape + self.arr=N.atleast_2d(self.arr) + self.write_element(N.array(self.arr.shape, dtype='i4')) + # write name + self.write_element(N.ndarray(shape=len(self.name), dtype='S1', buffer=self.name)) + + def update_matrix_tag(self): + curr_pos = self.file_stream.tell() + self.file_stream.seek(self._mat_tag_pos) + self.mat_tag['byte_count'] = curr_pos - self._mat_tag_pos - 8 + self.write_dtype(self.mat_tag) + self.file_stream.seek(curr_pos) + + def write(self): + assert False, 'Not implemented' + + +class Mat5NumericWriter(Mat5MatrixWriter): + + def write(self): + imagf = self.arr.dtype.kind == 'c' + try: + mclass = np_to_mxtypes[self.arr.dtype.str[1:]] + except KeyError: + if imagf: + self.arr = self.arr.astype('c128') + else: + self.arr = self.arr.astype('f8') + mclass = mxDOUBLE_CLASS + self.write_header(mclass=mclass,is_complex=imagf) + if imagf: + self.write_element(self.arr.real) + self.write_element(self.arr.imag) + else: + self.write_element(self.arr) + self.update_matrix_tag() + +class Mat5CharWriter(Mat5MatrixWriter): + codec='ascii' + def write(self): + self.arr_to_chars() + self.write_header(mclass=mxCHAR_CLASS) + if self.arr.dtype.kind == 'U': + # Recode unicode using self.codec + n_chars = N.product(self.arr.shape) + st_arr = N.ndarray(shape=(), + dtype=self.arr_dtype_number(n_chars), + buffer=self.arr) + st = st_arr.item().encode(self.codec) + self.arr = N.ndarray(shape=(len(st)), dtype='u1', buffer=st) + self.write_element(self.arr,mdtype=miUTF8) + self.update_matrix_tag() + +class Mat5UniCharWriter(Mat5CharWriter): + codec='UTF8' + + +class Mat5SparseWriter(Mat5MatrixWriter): + + def write(self): + ''' Sparse matrices are 2D + See docstring for Mat5SparseGetter + ''' + imagf = self.arr.dtype.kind == 'c' + N = self.arr.nnz + ijd = N.zeros((N+1, 3+imagf), dtype='f8') + for i in range(N): + ijd[i,0], ijd[i,1] = self.arr.rowcol(i) + ijd[:-1,0:2] += 1 # 1 based indexing + if imagf: + ijd[:-1,2] = self.arr.data.real + ijd[:-1,3] = self.arr.data.imag + else: + ijd[:-1,2] = self.arr.data + ijd[-1,0:2] = self.arr.shape + self.write_header(P=miDOUBLE, + T=mxSPARSE_CLASS, + dims=ijd.shape) + self.write_bytes(ijd) + + +class Mat5WriterGetter(object): + ''' Wraps stream and options, provides methods for getting Writer objects ''' + def __init__(self, stream, unicode_strings): + self.stream = stream + self.unicode_strings = unicode_strings + + def rewind(self): + self.stream.seek(0) + + def matrix_writer_factory(self, arr, name, is_global=False): + ''' Factory function to return matrix writer given variable to write + stream - file or file-like stream to write to + arr - array to write + name - name in matlab (TM) workspace + ''' + if have_sparse: + if scipy.sparse.issparse(arr): + return Mat5SparseWriter(self.stream, arr, name, is_global) + arr = N.array(arr) + if arr.dtype.hasobject: + types, arr_type = self.classify_mobjects(arr) + if arr_type == 'c': + return Mat5CellWriter(self.stream, arr, name, is_global, types) + elif arr_type == 's': + return Mat5StructWriter(self.stream, arr, name, is_global) + elif arr_type == 'o': + return Mat5ObjectWriter(self.stream, arr, name, is_global) + if arr.dtype.kind in ('U', 'S'): + if self.unicode_strings: + return Mat5UniCharWriter(self.stream, arr, name, is_global) + else: + return Mat5CharWriter(self.stream, arr, name, is_global) + else: + return Mat5NumericWriter(self.stream, arr, name, is_global) + + def classify_mobjects(self, objarr): + ''' Function to classify objects passed for writing + returns + types - S1 array of same shape as objarr with codes for each object + i - invalid object + a - ndarray + s - matlab struct + o - matlab object + arr_type - one of + c - cell array + s - struct array + o - object array + ''' + n = objarr.size + types = N.empty((n,), dtype='S1') + types[:] = 'i' + type_set = set() + flato = objarr.flat + for i in range(n): + obj = flato[i] + if isinstance(obj, N.ndarray): + types[i] = 'a' + continue + try: + fns = tuple(obj._fieldnames) + except AttributeError: + continue + try: + cn = obj._classname + except AttributeError: + types[i] = 's' + type_set.add(fns) + continue + types[i] = 'o' + type_set.add((cn, fns)) + arr_type = 'c' + if len(set(types))==1 and len(type_set) == 1: + arr_type = types[0] + return types.reshape(objarr.shape), arr_type + + +class MatFile5Writer(MatFileWriter): + ''' Class for writing mat5 files ''' + def __init__(self, file_stream, + do_compression=False, + unicode_strings=False, + global_vars=None): + super(MatFile5Writer, self).__init__(file_stream) + self.do_compression = do_compression + if global_vars: + self.global_vars = global_vars + else: + self.global_vars = [] + self.writer_getter = Mat5WriterGetter( + StringIO(), + unicode_strings) + # write header + import os, time + hdr = N.zeros((), mdtypes_template['file_header']) + hdr['description']='MATLAB 5.0 MAT-file Platform: %s, Created on: %s' % ( + os.name,time.asctime()) + hdr['version']= 0x0100 + hdr['endian_test']=N.ndarray(shape=(),dtype='S2',buffer=N.uint16(0x4d49)) + file_stream.write(hdr.tostring()) + + def get_unicode_strings(self): + return self.write_getter.unicode_strings + def set_unicode_strings(self, unicode_strings): + self.writer_getter.unicode_strings = unicode_strings + unicode_strings = property(get_unicode_strings, + set_unicode_strings, + None, + 'get/set unicode strings property') + + def put_variables(self, mdict): + for name, var in mdict.items(): + is_global = name in self.global_vars + self.writer_getter.rewind() + self.writer_getter.matrix_writer_factory( + var, + name, + is_global, + ).write() + stream = self.writer_getter.stream + if self.do_compression: + str = zlib.compress(stream.getvalue(stream.tell())) + tag = N.empty((), mdtypes_template['tag_full']) + tag['mdtype'] = miCOMPRESSED + tag['byte_count'] = len(str) + self.file_stream.write(tag.tostring() + str) + else: + self.file_stream.write(stream.getvalue(stream.tell())) Copied: branches/io_new/matlab/miobase.py (from rev 3657, branches/io_new/miobase.py) Deleted: branches/io_new/mio.py =================================================================== --- branches/io_new/mio.py 2007-12-14 23:31:02 UTC (rev 3658) +++ branches/io_new/mio.py 2007-12-14 23:33:47 UTC (rev 3659) @@ -1,133 +0,0 @@ -# Authors: Travis Oliphant, Matthew Brett - -""" -Module for reading and writing matlab (TM) .mat files -""" - -import os -import sys - -from scipy.io.mio4 import MatFile4Reader, MatFile4Writer -from scipy.io.mio5 import MatFile5Reader, MatFile5Writer - -__all__ = ['find_mat_file', 'mat_reader_factory', 'loadmat', 'savemat'] - -def find_mat_file(file_name, appendmat=True): - ''' Try to find .mat file on system path - - file_name - file name string - append_mat - If True, and file_name does not end in '.mat', appends it - ''' - if appendmat and file_name[-4:] == ".mat": - file_name = file_name[:-4] - if os.sep in file_name: - full_name = file_name - if appendmat: - full_name = file_name + ".mat" - else: - full_name = None - junk, file_name = os.path.split(file_name) - for path in [os.curdir] + list(sys.path): - test_name = os.path.join(path, file_name) - if appendmat: - test_name += ".mat" - try: - fid = open(test_name,'rb') - fid.close() - full_name = test_name - break - except IOError: - pass - return full_name - -def mat_reader_factory(file_name, appendmat=True, **kwargs): - """Create reader for matlab (TM) .mat format files - - See docstring for loadmat for input options - """ - if isinstance(file_name, basestring): - full_name = find_mat_file(file_name, appendmat) - if full_name is None: - raise IOError, "%s not found on the path." % file_name - byte_stream = open(full_name, 'rb') - else: - try: - file_name.read(0) - except AttributeError: - raise IOError, 'Reader needs file name or open file-like object' - byte_stream = file_name - - MR = MatFile4Reader(byte_stream, **kwargs) - if MR.format_looks_right(): - return MR - return MatFile5Reader(byte_stream, **kwargs) - -def loadmat(file_name, mdict=None, appendmat=True, basename='raw', **kwargs): - ''' Load Matlab(tm) file - - file_name - Name of the mat file - (do not need .mat extension if appendmat==True) - If name not a full path name, search for the file on - the sys.path list and use the first one found (the - current directory is searched first). - Can also pass open file-like object - m_dict - optional dictionary in which to insert matfile variables - appendmat - True to append the .mat extension to the end of the - given filename, if not already present - base_name - base name for unnamed variables (unused in code) - byte_order - byte order ('native', 'little', 'BIG') - in ('native', '=') - or in ('little', '<') - or in ('BIG', '>') - mat_dtype - return arrays in same dtype as loaded into matlab - (instead of the dtype with which they are saved) - squeeze_me - whether to squeeze matrix dimensions or not - chars_as_strings - whether to convert char arrays to string arrays - mat_dtype - return matrices with datatype that matlab would load as - (rather than in the datatype matlab saves as) - matlab_compatible - returns matrices as would be loaded by matlab - (implies squeeze_me=False, chars_as_strings=False, - mat_dtype=True) - - v4 (Level 1.0), v6 and v7.1 matfiles are supported. - - ''' - MR = mat_reader_factory(file_name, appendmat, **kwargs) - matfile_dict = MR.get_variables() - if mdict is not None: - mdict.update(matfile_dict) - else: - mdict = matfile_dict - return mdict - -def savemat(file_name, mdict, appendmat=True, format='4'): - """Save a dictionary of names and arrays into the MATLAB-style .mat file. - - This saves the arrayobjects in the given dictionary to a matlab - style .mat file. - - appendmat - if true, appends '.mat' extension to filename, if not present - format - '4' for matlab 4 mat files, '5' for matlab 5 onwards - """ - file_is_string = isinstance(file_name, basestring) - if file_is_string: - if appendmat and file_name[-4:] != ".mat": - file_name = file_name + ".mat" - file_stream = open(file_name, 'wb') - else: - try: - file_name.write('') - except AttributeError: - raise IOError, 'Writer needs file name or writeable '\ - 'file-like object' - file_stream = file_name - - if format == '4': - MW = MatFile4Writer(file_stream) - elif format == '5': - MW = MatFile5Writer(file_stream) - else: - raise ValueError, 'Format should be 4 or 5' - MW.put_variables(mdict) - if file_is_string: - file_stream.close() Deleted: branches/io_new/mio4.py =================================================================== --- branches/io_new/mio4.py 2007-12-14 23:31:02 UTC (rev 3658) +++ branches/io_new/mio4.py 2007-12-14 23:33:47 UTC (rev 3659) @@ -1,345 +0,0 @@ -''' Classes for read / write of matlab (TM) 4 files -''' - -import numpy as N - -from scipy.io.miobase import * - -miDOUBLE = 0 -miSINGLE = 1 -miINT32 = 2 -miINT16 = 3 -miUINT16 = 4 -miUINT8 = 5 - -mdtypes_template = { - miDOUBLE: 'f8', - miSINGLE: 'f4', - miINT32: 'i4', - miINT16: 'i2', - miUINT16: 'u2', - miUINT8: 'u1', - 'header': [('mopt', 'i4'), - ('mrows', 'i4'), - ('ncols', 'i4'), - ('imagf', 'i4'), - ('namlen', 'i4')], - 'U1': 'U1', - } - -np_to_mtypes = { - 'f8': miDOUBLE, - 'c32': miDOUBLE, - 'c24': miDOUBLE, - 'c16': miDOUBLE, - 'f4': miSINGLE, - 'c8': miSINGLE, - 'i4': miINT32, - 'i2': miINT16, - 'u2': miUINT16, - 'u1': miUINT8, - 'S1': miUINT8, - } - -# matrix classes -mxFULL_CLASS = 0 -mxCHAR_CLASS = 1 -mxSPARSE_CLASS = 2 - -order_codes = { - 0: '<', - 1: '>', - 2: 'VAX D-float', #! - 3: 'VAX G-float', - 4: 'Cray', #!! - } - - -class Mat4ArrayReader(MatArrayReader): - ''' Class for reading Mat4 arrays - ''' - - def matrix_getter_factory(self): - ''' Read header, return matrix getter ''' - data = self.read_dtype(self.dtypes['header']) - header = {} - header['name'] = self.read_ztstring(data['namlen']) - if data['mopt'] < 0 or data['mopt'] > 5000: - ValueError, 'Mat 4 mopt wrong format, byteswapping problem?' - M,rest = divmod(data['mopt'], 1000) - O,rest = divmod(rest,100) - P,rest = divmod(rest,10) - T = rest - if O != 0: - raise ValueError, 'O in MOPT integer should be 0, wrong format?' - header['dtype'] = self.dtypes[P] - header['mclass'] = T - header['dims'] = (data['mrows'], data['ncols']) - header['is_complex'] = data['imagf'] == 1 - remaining_bytes = header['dtype'].itemsize * N.product(header['dims']) - if header['is_complex'] and not header['mclass'] == mxSPARSE_CLASS: - remaining_bytes *= 2 - next_pos = self.mat_stream.tell() + remaining_bytes - if T == mxFULL_CLASS: - getter = Mat4FullGetter(self, header) - elif T == mxCHAR_CLASS: - getter = Mat4CharGetter(self, header) - elif T == mxSPARSE_CLASS: - getter = Mat4SparseGetter(self, header) - else: - raise TypeError, 'No reader for class code %s' % T - getter.next_position = next_pos - return getter - - -class Mat4MatrixGetter(MatMatrixGetter): - - # Mat4 variables never global or logical - is_global = False - is_logical = False - - def read_array(self, copy=True): - ''' Mat4 read array always uses header dtype and dims - copy - copies array if True - (buffer is usually read only) - a_dtype is assumed to be correct endianness - ''' - dt = self.header['dtype'] - dims = self.header['dims'] - num_bytes = dt.itemsize - for d in dims: - num_bytes *= d - arr = N.ndarray(shape=dims, - dtype=dt, - buffer=self.mat_stream.read(num_bytes), - order='F') - if copy: - arr = arr.copy() - return arr - - -class Mat4FullGetter(Mat4MatrixGetter): - def __init__(self, array_reader, header): - super(Mat4FullGetter, self).__init__(array_reader, header) - if header['is_complex']: - self.mat_dtype = N.dtype(N.complex128) - else: - self.mat_dtype = N.dtype(N.float64) - - def get_raw_array(self): - if self.header['is_complex']: - # avoid array copy to save memory - res = self.read_array(copy=False) - res_j = self.read_array(copy=False) - return res + (res_j * 1j) - return self.read_array() - - -class Mat4CharGetter(Mat4MatrixGetter): - def get_raw_array(self): - arr = self.read_array().astype(N.uint8) - # ascii to unicode - S = arr.tostring().decode('ascii') - return N.ndarray(shape=self.header['dims'], - dtype=N.dtype('U1'), - buffer = N.array(S)).copy() - - -class Mat4SparseGetter(Mat4MatrixGetter): - ''' Read sparse matrix type - - Matlab (TM) 4 real sparse arrays are saved in a N+1 by 3 array - format, where N is the number of non-zero values. Column 1 values - [0:N] are the (1-based) row indices of the each non-zero value, - column 2 [0:N] are the column indices, column 3 [0:N] are the - (real) values. The last values [-1,0:2] of the rows, column - indices are shape[0] and shape[1] respectively of the output - matrix. The last value for the values column is a padding 0. mrows - and ncols values from the header give the shape of the stored - matrix, here [N+1, 3]. Complex data is saved as a 4 column - matrix, where the fourth column contains the imaginary component; - the last value is again 0. Complex sparse data do _not_ have the - header imagf field set to True; the fact that the data are complex - is only detectable because there are 4 storage columns - ''' - def get_raw_array(self): - res = self.read_array() - tmp = res[:-1,:] - dims = res[-1,0:2] - I = N.ascontiguousarray(tmp[:,0],dtype='intc') #fixes byte order also - J = N.ascontiguousarray(tmp[:,1],dtype='intc') - I -= 1 # for 1-based indexing - J -= 1 - if res.shape[1] == 3: - V = N.ascontiguousarray(tmp[:,2],dtype='float') - else: - V = N.ascontiguousarray(tmp[:,2],dtype='complex') - V.imag = tmp[:,3] - if have_sparse: - return scipy.sparse.coo_matrix((V,(I,J)), dims) - return (dims, I, J, V) - - -class MatFile4Reader(MatFileReader): - ''' Reader for Mat4 files ''' - def __init__(self, mat_stream, *args, **kwargs): - self._array_reader = Mat4ArrayReader( - mat_stream, - None, - None, - ) - super(MatFile4Reader, self).__init__(mat_stream, *args, **kwargs) - self._array_reader.processor_func = self.processor_func - - def set_dtypes(self): - self.dtypes = self.convert_dtypes(mdtypes_template) - self._array_reader.dtypes = self.dtypes - - def matrix_getter_factory(self): - return self._array_reader.matrix_getter_factory() - - def format_looks_right(self): - # Mat4 files have a zero somewhere in first 4 bytes - self.mat_stream.seek(0) - mopt_bytes = N.ndarray(shape=(4,), - dtype=N.uint8, - buffer = self.mat_stream.read(4)) - self.mat_stream.seek(0) - return 0 in mopt_bytes - - def guess_byte_order(self): - self.mat_stream.seek(0) - mopt = self.read_dtype(N.dtype('i4')) - self.mat_stream.seek(0) - if mopt < 0 or mopt > 5000: - return ByteOrder.swapped_code - return ByteOrder.native_code - - -class Mat4MatrixWriter(MatStreamWriter): - - def write_header(self, P=0, T=0, imagf=0, dims=None): - ''' Write header for given data options - P - mat4 data type - T - mat4 matrix class - imagf - complex flag - dims - matrix dimensions - ''' - if dims is None: - dims = self.arr.shape - header = N.empty((), mdtypes_template['header']) - M = not ByteOrder.little_endian - O = 0 - header['mopt'] = (M * 1000 + - O * 100 + - P * 10 + - T) - header['mrows'] = dims[0] - header['ncols'] = dims[1] - header['imagf'] = imagf - header['namlen'] = len(self.name) + 1 - self.write_bytes(header) - self.write_string(self.name + '\0') - - def arr_to_2d(self): - self.arr = N.atleast_2d(self.arr) - dims = self.arr.shape - if len(dims) > 2: - self.arr = self.arr.reshape(-1,dims[-1]) - - def write(self): - assert False, 'Not implemented' - - -class Mat4NumericWriter(Mat4MatrixWriter): - - def write(self): - self.arr_to_2d() - imagf = self.arr.dtype.kind == 'c' - try: - P = np_to_mtypes[self.arr.dtype.str[1:]] - except KeyError: - if imagf: - self.arr = self.arr.astype('c128') - else: - self.arr = self.arr.astype('f8') - P = miDOUBLE - self.write_header(P=P, - T=mxFULL_CLASS, - imagf=imagf) - if imagf: - self.write_bytes(self.arr.real) - self.write_bytes(self.arr.imag) - else: - self.write_bytes(self.arr) - - -class Mat4CharWriter(Mat4MatrixWriter): - - def write(self): - self.arr_to_chars() - self.arr_to_2d() - dims = self.arr.shape - self.write_header(P=miUINT8, - T=mxCHAR_CLASS) - if self.arr.dtype.kind == 'U': - # Recode unicode to ascii - n_chars = N.product(dims) - st_arr = N.ndarray(shape=(), - dtype=self.arr_dtype_number(n_chars), - buffer=self.arr) - st = st_arr.item().encode('ascii') - self.arr = N.ndarray(shape=dims, dtype='S1', buffer=st) - self.write_bytes(self.arr) - - -class Mat4SparseWriter(Mat4MatrixWriter): - - def write(self): - ''' Sparse matrices are 2D - See docstring for Mat4SparseGetter - ''' - imagf = self.arr.dtype.kind == 'c' - nnz = self.arr.nnz - ijd = N.zeros((nnz+1, 3+imagf), dtype='f8') - for i in range(nnz): - ijd[i,0], ijd[i,1] = self.arr.rowcol(i) - ijd[:-1,0:2] += 1 # 1 based indexing - if imagf: - ijd[:-1,2] = self.arr.data.real - ijd[:-1,3] = self.arr.data.imag - else: - ijd[:-1,2] = self.arr.data - ijd[-1,0:2] = self.arr.shape - self.write_header(P=miDOUBLE, - T=mxSPARSE_CLASS, - dims=ijd.shape) - self.write_bytes(ijd) - - -def matrix_writer_factory(stream, arr, name): - ''' Factory function to return matrix writer given variable to write - stream - file or file-like stream to write to - arr - array to write - name - name in matlab (TM) workspace - ''' - if have_sparse: - if scipy.sparse.issparse(arr): - return Mat4SparseWriter(stream, arr, name) - arr = N.array(arr) - dtt = arr.dtype.type - if dtt is N.object_: - raise TypeError, 'Cannot save object arrays in Mat4' - elif dtt is N.void: - raise TypeError, 'Cannot save void type arrays' - elif dtt in (N.unicode_, N.string_): - return Mat4CharWriter(stream, arr, name) - else: - return Mat4NumericWriter(stream, arr, name) - - -class MatFile4Writer(MatFileWriter): - - def put_variables(self, mdict): - for name, var in mdict.items(): - matrix_writer_factory(self.file_stream, var, name).write() Deleted: branches/io_new/mio5.py =================================================================== --- branches/io_new/mio5.py 2007-12-14 23:31:02 UTC (rev 3658) +++ branches/io_new/mio5.py 2007-12-14 23:33:47 UTC (rev 3659) @@ -1,807 +0,0 @@ -''' Classes for read / write of matlab (TM) 5 files -''' - -# Small fragments of current code adapted from matfile.py by Heiko -# Henkelmann - -## Notice in matfile.py file - -# Copyright (c) 2003 Heiko Henkelmann - -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: - -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -import zlib -from copy import copy as pycopy -from cStringIO import StringIO -import numpy as N - -from scipy.io.miobase import * - -try: # Python 2.3 support - from sets import Set as set -except: - pass - -miINT8 = 1 -miUINT8 = 2 -miINT16 = 3 -miUINT16 = 4 -miINT32 = 5 -miUINT32 = 6 -miSINGLE = 7 -miDOUBLE = 9 -miINT64 = 12 -miUINT64 = 13 -miMATRIX = 14 -miCOMPRESSED = 15 -miUTF8 = 16 -miUTF16 = 17 -miUTF32 = 18 - -mxCELL_CLASS = 1 -mxSTRUCT_CLASS = 2 -mxOBJECT_CLASS = 3 -mxCHAR_CLASS = 4 -mxSPARSE_CLASS = 5 -mxDOUBLE_CLASS = 6 -mxSINGLE_CLASS = 7 -mxINT8_CLASS = 8 -mxUINT8_CLASS = 9 -mxINT16_CLASS = 10 -mxUINT16_CLASS = 11 -mxINT32_CLASS = 12 -mxUINT32_CLASS = 13 - -mdtypes_template = { - miINT8: 'i1', - miUINT8: 'u1', - miINT16: 'i2', - miUINT16: 'u2', - miINT32: 'i4', - miUINT32: 'u4', - miSINGLE: 'f4', - miDOUBLE: 'f8', - miINT64: 'i8', - miUINT64: 'u8', - miUTF8: 'u1', - miUTF16: 'u2', - miUTF32: 'u4', - 'file_header': [('description', 'S116'), - ('subsystem_offset', 'i8'), - ('version', 'u2'), - ('endian_test', 'S2')], - 'tag_full': [('mdtype', 'u4'), ('byte_count', 'u4')], - 'array_flags': [('data_type', 'u4'), - ('byte_count', 'u4'), - ('flags_class','u4'), - ('nzmax', 'u4')], - 'U1': 'U1', - } - -mclass_dtypes_template = { - mxINT8_CLASS: 'i1', - mxUINT8_CLASS: 'u1', - mxINT16_CLASS: 'i2', - mxUINT16_CLASS: 'u2', - mxINT32_CLASS: 'i4', - mxUINT32_CLASS: 'u4', - mxSINGLE_CLASS: 'f4', - mxDOUBLE_CLASS: 'f8', - } - - -np_to_mtypes = { - 'f8': miDOUBLE, - 'c32': miDOUBLE, - 'c24': miDOUBLE, - 'c16': miDOUBLE, - 'f4': miSINGLE, - 'c8': miSINGLE, - 'i1': miINT8, - 'i2': miINT16, - 'i4': miINT32, - 'u1': miUINT8, - 'u4': miUINT32, - 'u2': miUINT16, - 'S1': miUINT8, - 'U1': miUTF16, - } - - -np_to_mxtypes = { - 'f8': mxDOUBLE_CLASS, - 'c32': mxDOUBLE_CLASS, - 'c24': mxDOUBLE_CLASS, - 'c16': mxDOUBLE_CLASS, - 'f4': mxSINGLE_CLASS, - 'c8': mxSINGLE_CLASS, - 'i4': mxINT32_CLASS, - 'i2': mxINT16_CLASS, - 'u2': mxUINT16_CLASS, - 'u1': mxUINT8_CLASS, - 'S1': mxUINT8_CLASS, - } - - - -''' Before release v7.1 (release 14) matlab (TM) used the system -default character encoding scheme padded out to 16-bits. Release 14 -and later use Unicode. When saving character data, R14 checks if it -can be encoded in 7-bit ascii, and saves in that format if so.''' - -codecs_template = { - miUTF8: {'codec': 'utf_8', 'width': 1}, - miUTF16: {'codec': 'utf_16', 'width': 2}, - miUTF32: {'codec': 'utf_32','width': 4}, - } - -miUINT16_codec = sys.getdefaultencoding() - -mx_numbers = ( - mxDOUBLE_CLASS, - mxSINGLE_CLASS, - mxINT8_CLASS, - mxUINT8_CLASS, - mxINT16_CLASS, - mxUINT16_CLASS, - mxINT32_CLASS, - mxUINT32_CLASS, - ) - -class mat_struct(object): - ''' Placeholder for holding read data from structs ''' - pass - -class mat_obj(object): - ''' Placeholder for holding read data from objects ''' - pass - -class Mat5ArrayReader(MatArrayReader): - ''' Class to get Mat5 arrays - - Provides element reader functions, header reader, matrix reader - factory function - ''' - - def __init__(self, mat_stream, dtypes, processor_func, codecs, class_dtypes): - super(Mat5ArrayReader, self).__init__(mat_stream, - dtypes, - processor_func, - ) - self.codecs = codecs - self.class_dtypes = class_dtypes - - def read_element(self, copy=True): - raw_tag = self.mat_stream.read(8) - tag = N.ndarray(shape=(), - dtype=self.dtypes['tag_full'], - buffer = raw_tag) - mdtype = tag['mdtype'].item() - byte_count = mdtype >> 16 - if byte_count: # small data element format - if byte_count > 4: - raise ValueError, 'Too many bytes for sde format' - mdtype = mdtype & 0xFFFF - dt = self.dtypes[mdtype] - el_count = byte_count / dt.itemsize - return N.ndarray(shape=(el_count,), - dtype=dt, - buffer=raw_tag[4:]) - byte_count = tag['byte_count'].item() - if mdtype == miMATRIX: - return self.current_getter(byte_count).get_array() - if mdtype in self.codecs: # encoded char data - raw_str = self.mat_stream.read(byte_count) - codec = self.codecs[mdtype] - if not codec: - raise TypeError, 'Do not support encoding %d' % mdtype - el = raw_str.decode(codec) - else: # numeric data - dt = self.dtypes[mdtype] - el_count = byte_count / dt.itemsize - el = N.ndarray(shape=(el_count,), - dtype=dt, - buffer=self.mat_stream.read(byte_count)) - if copy: - el = el.copy() - mod8 = byte_count % 8 - if mod8: - self.mat_stream.seek(8 - mod8, 1) - return el - - def matrix_getter_factory(self): - ''' Returns reader for next matrix at top level ''' - tag = self.read_dtype(self.dtypes['tag_full']) - mdtype = tag['mdtype'].item() - byte_count = tag['byte_count'].item() - next_pos = self.mat_stream.tell() + byte_count - if mdtype == miCOMPRESSED: - getter = Mat5ZArrayReader(self, byte_count).matrix_getter_factory() - elif not mdtype == miMATRIX: - raise TypeError, \ - 'Expecting miMATRIX type here, got %d' % mdtype - else: - getter = self.current_getter(byte_count) - getter.next_position = next_pos - return getter - - def current_getter(self, byte_count): - ''' Return matrix getter for current stream position - - Returns matrix getters at top level and sub levels - ''' - if not byte_count: # an empty miMATRIX can contain no bytes - return Mat5EmptyMatrixGetter(self) - af = self.read_dtype(self.dtypes['array_flags']) - header = {} - flags_class = af['flags_class'] - mc = flags_class & 0xFF - header['mclass'] = mc - header['is_logical'] = flags_class >> 9 & 1 - header['is_global'] = flags_class >> 10 & 1 - header['is_complex'] = flags_class >> 11 & 1 - header['nzmax'] = af['nzmax'] - header['dims'] = self.read_element() - header['name'] = self.read_element().tostring() - if mc in mx_numbers: - return Mat5NumericMatrixGetter(self, header) - if mc == mxSPARSE_CLASS: - return Mat5SparseMatrixGetter(self, header) - if mc == mxCHAR_CLASS: - return Mat5CharMatrixGetter(self, header) - if mc == mxCELL_CLASS: - return Mat5CellMatrixGetter(self, header) - if mc == mxSTRUCT_CLASS: - return Mat5StructMatrixGetter(self, header) - if mc == mxOBJECT_CLASS: - return Mat5ObjectMatrixGetter(self, header) - raise TypeError, 'No reader for class code %s' % mc - - -class Mat5ZArrayReader(Mat5ArrayReader): - ''' Getter for compressed arrays - - Reads and uncompresses gzipped stream on init, providing wrapper - for this new sub-stream. - ''' - def __init__(self, array_reader, byte_count): - '''Reads and uncompresses gzipped stream''' - data = array_reader.mat_stream.read(byte_count) - super(Mat5ZArrayReader, self).__init__( - StringIO(zlib.decompress(data)), - array_reader.dtypes, - array_reader.processor_func, - array_reader.codecs, - array_reader.class_dtypes) - - -class Mat5MatrixGetter(MatMatrixGetter): - ''' Base class for getting Mat5 matrices - - Gets current read information from passed array_reader - ''' - - def __init__(self, array_reader, header): - super(Mat5MatrixGetter, self).__init__(array_reader, header) - self.class_dtypes = array_reader.class_dtypes - self.codecs = array_reader.codecs - self.is_global = header['is_global'] - self.mat_dtype = None - - def read_element(self, *args, **kwargs): - return self.array_reader.read_element(*args, **kwargs) - - -class Mat5EmptyMatrixGetter(Mat5MatrixGetter): - ''' Dummy class to return empty array for empty matrix - ''' - def __init__(self, array_reader): - self.array_reader = array_reader - self.mat_stream = array_reader.mat_stream - self.data_position = self.mat_stream.tell() - self.header = {} - self.is_global = False - self.mat_dtype = 'f8' - - def get_raw_array(self): - return N.array([[]]) - - -class Mat5NumericMatrixGetter(Mat5MatrixGetter): - - def __init__(self, array_reader, header): - super(Mat5NumericMatrixGetter, self).__init__(array_reader, header) - if header['is_logical']: - self.mat_dtype = N.dtype('bool') - else: - self.mat_dtype = self.class_dtypes[header['mclass']] - - def get_raw_array(self): - if self.header['is_complex']: - # avoid array copy to save memory - res = self.read_element(copy=False) - res_j = self.read_element(copy=False) - res = res + (res_j * 1j) - else: - res = self.read_element() - return N.ndarray(shape=self.header['dims'], - dtype=res.dtype, - buffer=res, - order='F') - - -class Mat5SparseMatrixGetter(Mat5MatrixGetter): - def get_raw_array(self): - rowind = self.read_element() - indptr = self.read_element() - if self.header['is_complex']: - # avoid array copy to save memory - data = self.read_element(copy=False) - data_j = self.read_element(copy=False) - data = data + (data_j * 1j) - else: - data = self.read_element() - ''' From the matlab (TM) API documentation, last found here: - http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/ - rowind are simply the row indices for all the (res) non-zero - entries in the sparse array. rowind has nzmax entries, so - may well have more entries than len(res), the actual number - of non-zero entries, but rowind[len(res):] can be discarded - and should be 0. indptr has length (number of columns + 1), - and is such that, if D = diff(colind), D[j] gives the number - of non-zero entries in column j. Because rowind values are - stored in column order, this gives the column corresponding to - each rowind - ''' - if have_sparse: - dims = self.header['dims'] - return scipy.sparse.csc_matrix((data,rowind,indptr), dims) - else: - return (dims, data, rowind, indptr) - - -class Mat5CharMatrixGetter(Mat5MatrixGetter): - def get_raw_array(self): - res = self.read_element() - # Convert non-string types to unicode - if isinstance(res, N.ndarray): - if res.dtype.type == N.uint16: - codec = miUINT16_codec - if self.codecs['uint16_len'] == 1: - res = res.astype(N.uint8) - elif res.dtype.type in (N.uint8, N.int8): - codec = 'ascii' - else: - raise TypeError, 'Did not expect type %s' % res.dtype - res = res.tostring().decode(codec) - return N.ndarray(shape=self.header['dims'], - dtype=N.dtype('U1'), - buffer=N.array(res), - order='F').copy() - - -class Mat5CellMatrixGetter(Mat5MatrixGetter): - def get_raw_array(self): - # Account for fortran indexing of cells - tupdims = tuple(self.header['dims'][::-1]) - length = N.product(tupdims) - result = N.empty(length, dtype=object) - for i in range(length): - result[i] = self.get_item() - return result.reshape(tupdims).T - - def get_item(self): - return self.read_element() - - -class Mat5StructMatrixGetter(Mat5CellMatrixGetter): - def __init__(self, *args, **kwargs): - super(Mat5StructMatrixGetter, self).__init__(*args, **kwargs) - self.obj_template = mat_struct() - - def get_raw_array(self): - namelength = self.read_element()[0] - # get field names - names = self.read_element() - splitnames = [names[i:i+namelength] for i in \ - xrange(0,len(names),namelength)] - self.obj_template._fieldnames = [x.tostring().strip('\x00') - for x in splitnames] - return super(Mat5StructMatrixGetter, self).get_raw_array() - - def get_item(self): - item = pycopy(self.obj_template) - for element in item._fieldnames: - item.__dict__[element] = self.read_element() - return item - - -class Mat5ObjectMatrixGetter(Mat5StructMatrixGetter): - def __init__(self, *args, **kwargs): - super(Mat5StructMatrixGetter, self).__init__(*args, **kwargs) - self.obj_template = mat_obj() - - def get_raw_array(self): - self.obj_template._classname = self.read_element().tostring() - return super(Mat5ObjectMatrixGetter, self).get_raw_array() - - -class MatFile5Reader(MatFileReader): - ''' Reader for Mat 5 mat files - - Adds the following attribute to base class - - uint16_codec - char codec to use for uint16 char arrays - (defaults to system default codec) - ''' - - def __init__(self, - mat_stream, - byte_order=None, - mat_dtype=False, - squeeze_me=True, - chars_as_strings=True, - matlab_compatible=False, - uint16_codec=None - ): - self.codecs = {} - self._array_reader = Mat5ArrayReader( - mat_stream, - None, - None, - None, - None, - ) - super(MatFile5Reader, self).__init__( - mat_stream, - byte_order, - mat_dtype, - squeeze_me, - chars_as_strings, - matlab_compatible, - ) - self._array_reader.processor_func = self.processor_func - self.uint16_codec = uint16_codec - - def get_uint16_codec(self): - return self._uint16_codec - def set_uint16_codec(self, uint16_codec): - if not uint16_codec: - uint16_codec = sys.getdefaultencoding() - # Set length of miUINT16 char encoding - self.codecs['uint16_len'] = len(" ".encode(uint16_codec)) \ - - len(" ".encode(uint16_codec)) - self.codecs['uint16_codec'] = uint16_codec - self._array_reader.codecs = self.codecs - self._uint16_codec = uint16_codec - uint16_codec = property(get_uint16_codec, - set_uint16_codec, - None, - 'get/set uint16_codec') - - def set_dtypes(self): - ''' Set dtypes and codecs ''' - self.dtypes = self.convert_dtypes(mdtypes_template) - self.class_dtypes = self.convert_dtypes(mclass_dtypes_template) - codecs = {} - postfix = self.order_code == '<' and '_le' or '_be' - for k, v in codecs_template.items(): - codec = v['codec'] - try: - " ".encode(codec) - except LookupError: - codecs[k] = None - continue - if v['width'] > 1: - codec += postfix - codecs[k] = codec - self.codecs.update(codecs) - self.update_array_reader() - - def update_array_reader(self): - self._array_reader.codecs = self.codecs - self._array_reader.dtypes = self.dtypes - self._array_reader.class_dtypes = self.class_dtypes - - def matrix_getter_factory(self): - return self._array_reader.matrix_getter_factory() - - def guess_byte_order(self): - self.mat_stream.seek(126) - mi = self.mat_stream.read(2) - self.mat_stream.seek(0) - return mi == 'IM' and '<' or '>' - - def file_header(self): - ''' Read in mat 5 file header ''' - hdict = {} - hdr = self.read_dtype(self.dtypes['file_header']) - hdict['__header__'] = hdr['description'].item().strip(' \t\n\000') - v_major = hdr['version'] >> 8 - v_minor = hdr['version'] & 0xFF - hdict['__version__'] = '%d.%d' % (v_major, v_minor) - return hdict - - def format_looks_right(self): - # Mat4 files have a zero somewhere in first 4 bytes - self.mat_stream.seek(0) - mopt_bytes = N.ndarray(shape=(4,), - dtype=N.uint8, - buffer = self.mat_stream.read(4)) - self.mat_stream.seek(0) - return 0 not in mopt_bytes - - -class Mat5MatrixWriter(MatStreamWriter): - - mat_tag = N.zeros((), mdtypes_template['tag_full']) - mat_tag['mdtype'] = miMATRIX - - def __init__(self, file_stream, arr, name, is_global=False): - super(Mat5MatrixWriter, self).__init__(file_stream, arr, name) - self.is_global = is_global - - def write_dtype(self, arr): - self.file_stream.write(arr.tostring()) - - def write_element(self, arr, mdtype=None): - # write tag, data - tag = N.zeros((), mdtypes_template['tag_full']) - if mdtype is None: - tag['mdtype'] = np_to_mtypes[arr.dtype.str[1:]] - else: - tag['mdtype'] = mdtype - tag['byte_count'] = arr.size*arr.itemsize - self.write_dtype(tag) - self.write_bytes(arr) - # do 8 byte padding if needed - if tag['byte_count']%8 != 0: - pad = (1+tag['byte_count']//8)*8 - tag['byte_count'] - self.write_bytes(N.zeros((pad,),dtype='u1')) - - def write_header(self, mclass, - is_global=False, - is_complex=False, - is_logical=False, - nzmax=0): - ''' Write header for given data options - mclass - mat5 matrix class - is_global - True if matrix is global - is_complex - True is matrix is complex - is_logical - True if matrix is logical - nzmax - max non zero elements for sparse arrays - ''' - self._mat_tag_pos = self.file_stream.tell() - self.write_dtype(self.mat_tag) - # write array flags (complex, global, logical, class, nzmax) - af = N.zeros((), mdtypes_template['array_flags']) - af['data_type'] = miUINT32 - af['byte_count'] = 8 - flags = is_complex << 3 | is_global << 2 | is_logical << 1 - af['flags_class'] = mclass | flags << 8 - af['nzmax'] = nzmax - self.write_dtype(af) - # write array shape - self.arr=N.atleast_2d(self.arr) - self.write_element(N.array(self.arr.shape, dtype='i4')) - # write name - self.write_element(N.ndarray(shape=len(self.name), dtype='S1', buffer=self.name)) - - def update_matrix_tag(self): - curr_pos = self.file_stream.tell() - self.file_stream.seek(self._mat_tag_pos) - self.mat_tag['byte_count'] = curr_pos - self._mat_tag_pos - 8 - self.write_dtype(self.mat_tag) - self.file_stream.seek(curr_pos) - - def write(self): - assert False, 'Not implemented' - - -class Mat5NumericWriter(Mat5MatrixWriter): - - def write(self): - imagf = self.arr.dtype.kind == 'c' - try: - mclass = np_to_mxtypes[self.arr.dtype.str[1:]] - except KeyError: - if imagf: - self.arr = self.arr.astype('c128') - else: - self.arr = self.arr.astype('f8') - mclass = mxDOUBLE_CLASS - self.write_header(mclass=mclass,is_complex=imagf) - if imagf: - self.write_element(self.arr.real) - self.write_element(self.arr.imag) - else: - self.write_element(self.arr) - self.update_matrix_tag() - -class Mat5CharWriter(Mat5MatrixWriter): - codec='ascii' - def write(self): - self.arr_to_chars() - self.write_header(mclass=mxCHAR_CLASS) - if self.arr.dtype.kind == 'U': - # Recode unicode using self.codec - n_chars = N.product(self.arr.shape) - st_arr = N.ndarray(shape=(), - dtype=self.arr_dtype_number(n_chars), - buffer=self.arr) - st = st_arr.item().encode(self.codec) - self.arr = N.ndarray(shape=(len(st)), dtype='u1', buffer=st) - self.write_element(self.arr,mdtype=miUTF8) - self.update_matrix_tag() - -class Mat5UniCharWriter(Mat5CharWriter): - codec='UTF8' - - -class Mat5SparseWriter(Mat5MatrixWriter): - - def write(self): - ''' Sparse matrices are 2D - See docstring for Mat5SparseGetter - ''' - imagf = self.arr.dtype.kind == 'c' - N = self.arr.nnz - ijd = N.zeros((N+1, 3+imagf), dtype='f8') - for i in range(N): - ijd[i,0], ijd[i,1] = self.arr.rowcol(i) - ijd[:-1,0:2] += 1 # 1 based indexing - if imagf: - ijd[:-1,2] = self.arr.data.real - ijd[:-1,3] = self.arr.data.imag - else: - ijd[:-1,2] = self.arr.data - ijd[-1,0:2] = self.arr.shape - self.write_header(P=miDOUBLE, - T=mxSPARSE_CLASS, - dims=ijd.shape) - self.write_bytes(ijd) - - -class Mat5WriterGetter(object): - ''' Wraps stream and options, provides methods for getting Writer objects ''' - def __init__(self, stream, unicode_strings): - self.stream = stream - self.unicode_strings = unicode_strings - - def rewind(self): - self.stream.seek(0) - - def matrix_writer_factory(self, arr, name, is_global=False): - ''' Factory function to return matrix writer given variable to write - stream - file or file-like stream to write to - arr - array to write - name - name in matlab (TM) workspace - ''' - if have_sparse: - if scipy.sparse.issparse(arr): - return Mat5SparseWriter(self.stream, arr, name, is_global) - arr = N.array(arr) - if arr.dtype.hasobject: - types, arr_type = self.classify_mobjects(arr) - if arr_type == 'c': - return Mat5CellWriter(self.stream, arr, name, is_global, types) - elif arr_type == 's': - return Mat5StructWriter(self.stream, arr, name, is_global) - elif arr_type == 'o': - return Mat5ObjectWriter(self.stream, arr, name, is_global) - if arr.dtype.kind in ('U', 'S'): - if self.unicode_strings: - return Mat5UniCharWriter(self.stream, arr, name, is_global) - else: - return Mat5CharWriter(self.stream, arr, name, is_global) - else: - return Mat5NumericWriter(self.stream, arr, name, is_global) - - def classify_mobjects(self, objarr): - ''' Function to classify objects passed for writing - returns - types - S1 array of same shape as objarr with codes for each object - i - invalid object - a - ndarray - s - matlab struct - o - matlab object - arr_type - one of - c - cell array - s - struct array - o - object array - ''' - n = objarr.size - types = N.empty((n,), dtype='S1') - types[:] = 'i' - type_set = set() - flato = objarr.flat - for i in range(n): - obj = flato[i] - if isinstance(obj, N.ndarray): - types[i] = 'a' - continue - try: - fns = tuple(obj._fieldnames) - except AttributeError: - continue - try: - cn = obj._classname - except AttributeError: - types[i] = 's' - type_set.add(fns) - continue - types[i] = 'o' - type_set.add((cn, fns)) - arr_type = 'c' - if len(set(types))==1 and len(type_set) == 1: - arr_type = types[0] - return types.reshape(objarr.shape), arr_type - - -class MatFile5Writer(MatFileWriter): - ''' Class for writing mat5 files ''' - def __init__(self, file_stream, - do_compression=False, - unicode_strings=False, - global_vars=None): - super(MatFile5Writer, self).__init__(file_stream) - self.do_compression = do_compression - if global_vars: - self.global_vars = global_vars - else: - self.global_vars = [] - self.writer_getter = Mat5WriterGetter( - StringIO(), - unicode_strings) - # write header - import os, time - hdr = N.zeros((), mdtypes_template['file_header']) - hdr['description']='MATLAB 5.0 MAT-file Platform: %s, Created on: %s' % ( - os.name,time.asctime()) - hdr['version']= 0x0100 - hdr['endian_test']=N.ndarray(shape=(),dtype='S2',buffer=N.uint16(0x4d49)) - file_stream.write(hdr.tostring()) - - def get_unicode_strings(self): - return self.write_getter.unicode_strings - def set_unicode_strings(self, unicode_strings): - self.writer_getter.unicode_strings = unicode_strings - unicode_strings = property(get_unicode_strings, - set_unicode_strings, - None, - 'get/set unicode strings property') - - def put_variables(self, mdict): - for name, var in mdict.items(): - is_global = name in self.global_vars - self.writer_getter.rewind() - self.writer_getter.matrix_writer_factory( - var, - name, - is_global, - ).write() - stream = self.writer_getter.stream - if self.do_compression: - str = zlib.compress(stream.getvalue(stream.tell())) - tag = N.empty((), mdtypes_template['tag_full']) - tag['mdtype'] = miCOMPRESSED - tag['byte_count'] = len(str) - self.file_stream.write(tag.tostring() + str) - else: - self.file_stream.write(stream.getvalue(stream.tell())) Deleted: branches/io_new/miobase.py =================================================================== --- branches/io_new/miobase.py 2007-12-14 23:31:02 UTC (rev 3658) +++ branches/io_new/miobase.py 2007-12-14 23:33:47 UTC (rev 3659) @@ -1,379 +0,0 @@ -# Authors: Travis Oliphant, Matthew Brett - -""" -Base classes for matlab (TM) file stream reading -""" - -import sys - -import numpy as N - -try: - import scipy.sparse - have_sparse = 1 -except ImportError: - have_sparse = 0 - - -def small_product(arr): - ''' Faster than product for small arrays ''' - res = 1 - for e in arr: - res *= e - return res - -class ByteOrder(object): - ''' Namespace for byte ordering ''' - little_endian = sys.byteorder == 'little' - native_code = little_endian and '<' or '>' - swapped_code = little_endian and '>' or '<' - - def to_numpy_code(code): - if code is None: - return ByteOrder.native_code - if code in ('little', '<', 'l', 'L'): - return '<' - elif code in ('BIG', '>', 'B', 'b'): - return '>' - elif code in ('native', '='): - return ByteOrder.native_code - elif code in ('swapped'): - return ByteOrder.swapped_code - else: - raise ValueError, 'We cannot handle byte order %s' % byte_order - to_numpy_code = staticmethod(to_numpy_code) - - -class MatStreamAgent(object): - ''' Base object for readers / getters from mat file streams - - Attaches to initialized stream - - Base class for "getters" - which do store state of what they are - reading on itialization, and therefore need to be initialized - before each read, and "readers" which do not store state, and only - need to be initialized once on object creation - - Implements common array reading functions - - Inputs mat_steam - MatFileReader object - ''' - - def __init__(self, mat_stream): - self.mat_stream = mat_stream - - def read_dtype(self, a_dtype): - ''' Generic get of byte stream data of known type - - Inputs - a_dtype - dtype of array - - a_dtype is assumed to be correct endianness - ''' - num_bytes = a_dtype.itemsize - arr = N.ndarray(shape=(), - dtype=a_dtype, - buffer=self.mat_stream.read(num_bytes), - order='F') - return arr - - def read_ztstring(self, num_bytes): - return self.mat_stream.read(num_bytes).strip('\x00') - - -class MatFileReader(MatStreamAgent): - """ Base object for reading mat files - - mat_stream - initialized byte stream object - file io interface object - byte_order - byte order ('native', 'little', 'BIG') - in ('native', '=') - or in ('little', '<') - or in ('BIG', '>') - mat_dtype - return arrays in same dtype as loaded into matlab - (instead of the dtype with which they are saved) - squeeze_me - whether to squeeze unit dimensions or not - chars_as_strings - whether to convert char arrays to string arrays - mat_dtype - return matrices with datatype that matlab would load as - (rather than in the datatype matlab saves as) - matlab_compatible - returns matrices as would be loaded by matlab - (implies squeeze_me=False, chars_as_strings=False - mat_dtype=True) - - To make this class functional, you will need to override the - following methods: - - set_dtypes - sets data types defs from byte order - matrix_getter_factory - gives object to fetch next matrix from stream - format_looks_right - returns True if format looks correct for - this file type (Mat4, Mat5) - guess_byte_order - guesses file byte order from file - """ - - def __init__(self, mat_stream, - byte_order=None, - mat_dtype=False, - squeeze_me=True, - chars_as_strings=True, - matlab_compatible=False, - ): - # Initialize stream - self.mat_stream = mat_stream - self.dtypes = {} - if not byte_order: - byte_order = self.guess_byte_order() - self.order_code = byte_order # sets dtypes and other things too - if matlab_compatible: - self.set_matlab_compatible() - else: - self._squeeze_me = squeeze_me - self._chars_as_strings = chars_as_strings - self._mat_dtype = mat_dtype - self.processor_func = self.get_processor_func() - - def set_matlab_compatible(self): - ''' Sets options to return arrays as matlab (tm) loads them ''' - self._mat_dtype = True - self._squeeze_me = False - self._chars_as_strings = False - self.processor_func = self.get_processor_func() - - def get_mat_dtype(self): - return self._mat_dtype - def set_mat_dtype(self, mat_dtype): - self._mat_dtype = mat_dtype - self.processor_func = self.get_processor_func() - mat_dtype = property(get_mat_dtype, - set_mat_dtype, - None, - 'get/set mat_dtype property') - - def get_squeeze_me(self): - return self._squeeze_me - def set_squeeze_me(self, squeeze_me): - self._squeeze_me = squeeze_me - self.processor_func = self.get_processor_func() - squeeze_me = property(get_squeeze_me, - set_squeeze_me, - None, - 'get/set squeeze me property') - - def get_chars_as_strings(self): - return self._chars_as_strings - def set_chars_as_strings(self, chars_as_strings): - self._chars_as_strings = chars_as_strings - self.processor_func = self.get_processor_func() - chars_as_strings = property(get_chars_as_strings, - set_chars_as_strings, - None, - 'get/set squeeze me property') - - def get_order_code(self): - return self._order_code - def set_order_code(self, order_code): - order_code = ByteOrder.to_numpy_code(order_code) - self._order_code = order_code - self.set_dtypes() - order_code = property(get_order_code, - set_order_code, - None, - 'get/set order code') - - def set_dtypes(self): - assert False, 'Not implemented' - - def convert_dtypes(self, dtype_template): - dtypes = dtype_template.copy() - for k in dtypes: - dtypes[k] = N.dtype(dtypes[k]).newbyteorder( - self.order_code) - return dtypes - - def matrix_getter_factory(self): - assert False, 'Not implemented' - - def format_looks_right(self): - "Return True if the format looks right for this object" - assert False, 'Not implemented' - - def file_header(self): - return {} - - def guess_byte_order(self): - assert 0, 'Not implemented' - - def get_processor_func(self): - ''' Processing to apply to read matrices - - Function applies options to matrices. We have to pass this - function into the reader routines because Mat5 matrices - occur as submatrices - in cell arrays, structs and objects - - so we will not see these in the main variable getting routine - here. - - The read array is the first argument. - The getter, passed as second argument to the function, must - define properties, iff mat_dtype option is True: - - mat_dtype - data type when loaded into matlab (tm) - (None for no conversion) - - func returns the processed array - ''' - - def func(arr, getter): - if arr.dtype.kind == 'U' and self.chars_as_strings: - # Convert char array to string or array of strings - dims = arr.shape - if len(dims) >= 2: # return array of strings - dtt = self.order_code + 'U' - n_dims = dims[:-1] - str_arr = arr.reshape( - (small_product(n_dims), - dims[-1])) - arr = N.empty(n_dims, dtype=object) - for i in range(0, n_dims[-1]): - arr[...,i] = self.chars_to_str(str_arr[i]) - else: # return string - arr = self.chars_to_str(arr) - if self.mat_dtype: - # Apply options to replicate matlab's (TM) - # load into workspace - if getter.mat_dtype is not None: - arr = arr.astype(getter.mat_dtype) - if self.squeeze_me: - arr = N.squeeze(arr) - if not arr.size: - arr = N.array([]) - elif not arr.shape: # 0d coverted to scalar - arr = arr.item() - return arr - return func - - def chars_to_str(self, str_arr): - ''' Convert string array to string ''' - dt = N.dtype('U' + str(small_product(str_arr.shape))) - return N.ndarray(shape=(), - dtype = dt, - buffer = str_arr.copy()).item() - - def get_variables(self, variable_names=None): - ''' get variables from stream as dictionary - - variable_names - optional list of variable names to get - - If variable_names is None, then get all variables in file - ''' - if isinstance(variable_names, basestring): - variable_names = [variable_names] - self.mat_stream.seek(0) - mdict = self.file_header() - mdict['__globals__'] = [] - while not self.end_of_stream(): - getter = self.matrix_getter_factory() - name = getter.name - if variable_names and name not in variable_names: - getter.to_next() - continue - res = getter.get_array() - mdict[name] = res - if getter.is_global: - mdict['__globals__'].append(name) - if variable_names: - variable_names.remove(name) - if not variable_names: - break - return mdict - - def end_of_stream(self): - b = self.mat_stream.read(1) - self.mat_stream.seek(-1,1) - return len(b) == 0 - - -class MatMatrixGetter(MatStreamAgent): - """ Base class for matrix getters - - Getters are stateful versions of agents, and record state of - current read on initialization, so need to be created for each - read - one-shot objects. - - MatrixGetters are initialized with the content of the matrix - header - - Accepts - array_reader - array reading object (see below) - header - header dictionary for matrix being read - """ - - def __init__(self, array_reader, header): - super(MatMatrixGetter, self).__init__(array_reader.mat_stream) - self.array_reader = array_reader - self.dtypes = array_reader.dtypes - self.header = header - self.name = header['name'] - - def get_array(self): - ''' Gets an array from matrix, and applies any necessary processing ''' - arr = self.get_raw_array() - return self.array_reader.processor_func(arr, self) - - def get_raw_array(self): - assert False, 'Not implemented' - - def to_next(self): - self.mat_stream.seek(self.next_position) - - -class MatArrayReader(MatStreamAgent): - ''' Base class for array readers - - The array_reader contains information about the current reading - process, such as byte ordered dtypes and the processing function - to apply to matrices as they are read, as well as routines for - reading matrix compenents. - ''' - - def __init__(self, mat_stream, dtypes, processor_func): - self.mat_stream = mat_stream - self.dtypes = dtypes - self.processor_func = processor_func - - def matrix_getter_factory(self): - assert False, 'Not implemented' - - -class MatStreamWriter(object): - ''' Base object for writing to mat files ''' - def __init__(self, file_stream, arr, name): - self.file_stream = file_stream - self.arr = arr - dt = self.arr.dtype - if not dt.isnative: - self.arr = self.arr.astype(dt.newbyteorder('=')) - self.name = name - - def arr_dtype_number(self, num): - ''' Return dtype for given number of items per element''' - return N.dtype(self.arr.dtype.str[:2] + str(num)) - - def arr_to_chars(self): - ''' Convert string array to char array ''' - dims = list(self.arr.shape) - if not dims: - dims = [1] - dims.append(int(self.arr.dtype.str[2:])) - self.arr = N.ndarray(shape=dims, - dtype=self.arr_dtype_number(1), - buffer=self.arr) - - def write_bytes(self, arr): - self.file_stream.write(arr.tostring(order='F')) - - def write_string(self, s): - self.file_stream.write(s) - - -class MatFileWriter(object): - ''' Base class for Mat file writers ''' - def __init__(self, file_stream): - self.file_stream = file_stream Modified: branches/io_new/tests/test_mio.py =================================================================== --- branches/io_new/tests/test_mio.py 2007-12-14 23:31:02 UTC (rev 3658) +++ branches/io_new/tests/test_mio.py 2007-12-14 23:33:47 UTC (rev 3659) @@ -11,8 +11,8 @@ import scipy.sparse as SP set_package_path() -from scipy.io.mio import loadmat, savemat -from scipy.io.mio5 import mat_obj, mat_struct +from scipy.io.matlab.mio import loadmat, savemat +from scipy.io.matlab.mio5 import mat_obj, mat_struct restore_path() try: # Python 2.3 support From scipy-svn at scipy.org Fri Dec 14 18:44:54 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 14 Dec 2007 17:44:54 -0600 (CST) Subject: [Scipy-svn] r3660 - trunk/scipy/sparse Message-ID: <20071214234454.C2577C7C123@new.scipy.org> Author: wnbell Date: 2007-12-14 17:44:51 -0600 (Fri, 14 Dec 2007) New Revision: 3660 Modified: trunk/scipy/sparse/compressed.py Log: small change to constructor Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-14 23:33:47 UTC (rev 3659) +++ trunk/scipy/sparse/compressed.py 2007-12-14 23:44:51 UTC (rev 3660) @@ -60,28 +60,21 @@ self.indices = zeros(0, intc) self.indptr = zeros(self._swap(self.shape)[0] + 1, dtype='intc') else: - try: - # Try interpreting it as (data, ij) - (data, ij) = arg1 - assert isinstance(ij, ndarray) and (rank(ij) == 2) \ - and (ij.shape == (2, len(data))) - except (AssertionError, TypeError, ValueError, AttributeError): - try: - # Try interpreting it as (data, indices, indptr) - (data, indices, indptr) = arg1 - except: - raise ValueError, "unrecognized form for" \ - " %s_matrix constructor" % self.format - else: - self.data = array(data, copy=copy, dtype=getdtype(dtype, data)) - self.indices = array(indices, copy=copy) - self.indptr = array(indptr, copy=copy) - else: + if len(arg1) == 2: # (data, ij) format from coo import coo_matrix - other = coo_matrix((data, ij), shape=shape ) - other = self._tothis(other) + other = self._tothis(coo_matrix(arg1, shape=shape)) self._set_self( other ) + elif len(arg1) == 3: + # (data, indices, indptr) format + (data, indices, indptr) = arg1 + self.indices = array(indices, copy=copy) + self.indptr = array(indptr, copy=copy) + self.data = array(data, copy=copy, \ + dtype=getdtype(dtype, data)) + else: + raise ValueError, "unrecognized form for" \ + " %s_matrix constructor" % self.format else: raise ValueError, "unrecognized form for" \ From scipy-svn at scipy.org Fri Dec 14 18:45:22 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 14 Dec 2007 17:45:22 -0600 (CST) Subject: [Scipy-svn] r3661 - branches/io_new Message-ID: <20071214234522.41C2DC7C123@new.scipy.org> Author: jarrod.millman Date: 2007-12-14 17:45:19 -0600 (Fri, 14 Dec 2007) New Revision: 3661 Modified: branches/io_new/__init__.py Log: cleaned up imports Modified: branches/io_new/__init__.py =================================================================== --- branches/io_new/__init__.py 2007-12-14 23:44:51 UTC (rev 3660) +++ branches/io_new/__init__.py 2007-12-14 23:45:19 UTC (rev 3661) @@ -1,4 +1,3 @@ - # # io - Data input and output # @@ -7,18 +6,23 @@ from numpyio import packbits, unpackbits, bswap, fread, fwrite, \ convert_objectarray + # matfile read and write from matlab.mio import loadmat, savemat + # netCDF file support -from netcdf import * +from netcdf import netcdf_file, netcdf_variable + from npfile import npfile + from recaster import sctype_attributes, Recaster -from array_import import * -from data_store import * -from pickler import * -from mmio import mminfo,mmread,mmwrite +from array_import import read_array, write_array +from data_store import read_array, write_array +from pickler import objload, objsave +from mmio import mminfo, mmread, mmwrite + __all__ = filter(lambda s:not s.startswith('_'),dir()) from numpy.testing import NumpyTest test = NumpyTest().test From scipy-svn at scipy.org Fri Dec 14 21:15:23 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 14 Dec 2007 20:15:23 -0600 (CST) Subject: [Scipy-svn] r3662 - branches Message-ID: <20071215021523.44A7AC7C027@new.scipy.org> Author: fperez Date: 2007-12-14 20:15:16 -0600 (Fri, 14 Dec 2007) New Revision: 3662 Added: branches/testing_cleanup/ Log: Create new branch for cleaning up the entire testing infrastructure. We will now be using nose for test discovery, so the tests need to be nose-compliant. Copied: branches/testing_cleanup (from rev 3661, trunk) From scipy-svn at scipy.org Sat Dec 15 00:39:06 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 14 Dec 2007 23:39:06 -0600 (CST) Subject: [Scipy-svn] r3663 - in trunk/scipy/io: . tests Message-ID: <20071215053906.5873AC7C16B@new.scipy.org> Author: wnbell Date: 2007-12-14 23:38:59 -0600 (Fri, 14 Dec 2007) New Revision: 3663 Modified: trunk/scipy/io/mmio.py trunk/scipy/io/tests/test_mmio.py Log: changed dims= to shape= Modified: trunk/scipy/io/mmio.py =================================================================== --- trunk/scipy/io/mmio.py 2007-12-15 02:15:16 UTC (rev 3662) +++ trunk/scipy/io/mmio.py 2007-12-15 05:38:59 UTC (rev 3663) @@ -229,7 +229,7 @@ V = concatenate((V,od_V)) - a = coo_matrix((V, (I, J)), dims=(rows, cols), dtype=dtype) + a = coo_matrix((V, (I, J)), shape=(rows, cols), dtype=dtype) else: raise NotImplementedError,`rep` Modified: trunk/scipy/io/tests/test_mmio.py =================================================================== --- trunk/scipy/io/tests/test_mmio.py 2007-12-15 02:15:16 UTC (rev 3662) +++ trunk/scipy/io/tests/test_mmio.py 2007-12-15 05:38:59 UTC (rev 3663) @@ -266,7 +266,7 @@ J = array([0, 3, 1, 2, 1, 3, 4, 4]) V = array([ 1.0, 6.0, 10.5, 0.015, 250.5, -280.0, 33.32, 12.0 ]) - b = scipy.sparse.coo_matrix((V,(I,J)),dims=(5,5)) + b = scipy.sparse.coo_matrix((V,(I,J)),shape=(5,5)) fn = mktemp() mmwrite(fn,b) @@ -282,7 +282,7 @@ V = array([ 1.0 + 3j, 6.0 + 2j, 10.50 + 0.9j, 0.015 + -4.4j, 250.5 + 0j, -280.0 + 5j, 33.32 + 6.4j, 12.00 + 0.8j]) - b = scipy.sparse.coo_matrix((V,(I,J)),dims=(5,5)) + b = scipy.sparse.coo_matrix((V,(I,J)),shape=(5,5)) fn = mktemp() mmwrite(fn,b) From scipy-svn at scipy.org Sat Dec 15 00:59:31 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 14 Dec 2007 23:59:31 -0600 (CST) Subject: [Scipy-svn] r3664 - in trunk/scipy: linsolve/umfpack linsolve/umfpack/tests sparse sparse/sparsetools sparse/tests Message-ID: <20071215055931.8B78D39C056@new.scipy.org> Author: wnbell Date: 2007-12-14 23:59:12 -0600 (Fri, 14 Dec 2007) New Revision: 3664 Modified: trunk/scipy/linsolve/umfpack/tests/test_umfpack.py trunk/scipy/linsolve/umfpack/umfpack.py trunk/scipy/sparse/base.py trunk/scipy/sparse/compressed.py trunk/scipy/sparse/construct.py trunk/scipy/sparse/coo.py trunk/scipy/sparse/csc.py trunk/scipy/sparse/csr.py trunk/scipy/sparse/dia.py trunk/scipy/sparse/lil.py trunk/scipy/sparse/sparsetools/sparsetools.h trunk/scipy/sparse/sparsetools/sparsetools.i trunk/scipy/sparse/sparsetools/sparsetools.py trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx trunk/scipy/sparse/spfuncs.py trunk/scipy/sparse/tests/test_construct.py Log: changed sparsetools interface. made sparse matrix multiplication a 2-pass algorithm. replaced sparsetools csr_matrix -> dense with numpy coo_matrix -> dense. fixed spdiags and added unittests (now returns dia_matrix) misc fixes Modified: trunk/scipy/linsolve/umfpack/tests/test_umfpack.py =================================================================== --- trunk/scipy/linsolve/umfpack/tests/test_umfpack.py 2007-12-15 05:38:59 UTC (rev 3663) +++ trunk/scipy/linsolve/umfpack/tests/test_umfpack.py 2007-12-15 05:59:12 UTC (rev 3664) @@ -150,15 +150,17 @@ random.seed(0) #make tests repeatable self.real_matrices = [] self.real_matrices.append(spdiags([[1, 2, 3, 4, 5], [6, 5, 8, 9, 10]], - [0, 1], 5, 5)) + [0, 1], 5, 5) ) self.real_matrices.append(spdiags([[1, 2, 3, 4, 5], [6, 5, 8, 9, 10]], - [0, 1], 4, 5)) + [0, 1], 4, 5) ) self.real_matrices.append(spdiags([[1, 2, 3, 4, 5], [6, 5, 8, 9, 10]], - [0, 2], 5, 5)) - self.real_matrices.append(csc_matrix(rand(3,3))) - self.real_matrices.append(csc_matrix(rand(5,4))) - self.real_matrices.append(csc_matrix(rand(4,5))) + [0, 2], 5, 5) ) + self.real_matrices.append(rand(3,3)) + self.real_matrices.append(rand(5,4)) + self.real_matrices.append(rand(4,5)) + self.real_matrices = [csc_matrix(x).astype('d') for x \ + in self.real_matrices] self.complex_matrices = [x.astype(nm.complex128) for x in self.real_matrices] Modified: trunk/scipy/linsolve/umfpack/umfpack.py =================================================================== --- trunk/scipy/linsolve/umfpack/umfpack.py 2007-12-15 05:38:59 UTC (rev 3663) +++ trunk/scipy/linsolve/umfpack/umfpack.py 2007-12-15 05:59:12 UTC (rev 3664) @@ -353,11 +353,12 @@ sparsity pattern.""" self.free_symbolic() + indx = self._getIndx( mtx ) + if not assumeSortedIndices: # row/column indices cannot be assumed to be sorted mtx.sort_indices() - indx = self._getIndx( mtx ) if self.isReal: status, self._symbolic\ = self.funs.symbolic( mtx.shape[0], mtx.shape[1], Modified: trunk/scipy/sparse/base.py =================================================================== --- trunk/scipy/sparse/base.py 2007-12-15 05:38:59 UTC (rev 3663) +++ trunk/scipy/sparse/base.py 2007-12-15 05:59:12 UTC (rev 3664) @@ -364,8 +364,7 @@ return asmatrix(self.toarray()) def toarray(self): - csr = self.tocsr() - return csr.toarray() + return self.tocsr().toarray() def todok(self): return self.tocoo().todok() @@ -379,13 +378,6 @@ def todia(self): return self.tocoo().todia() -# def toself(self, copy=False): -# if copy: -# new = self.copy() -# else: -# new = self -# return new - def copy(self): return self.__class__(self,copy=True) Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-15 05:38:59 UTC (rev 3663) +++ trunk/scipy/sparse/compressed.py 2007-12-15 05:59:12 UTC (rev 3664) @@ -171,10 +171,10 @@ if full_check: #check format validity (more expensive) if self.nnz > 0: - if amax(self.indices) >= minor_dim: + if self.indices.max() >= minor_dim: raise ValueError, "%s index values must be < %d" % \ (minor_name,minor_dim) - if amin(self.indices) < 0: + if self.indices.min() < 0: raise ValueError, "%s index values must be >= 0" % \ minor_name if numpy.diff(self.indptr).min() < 0: @@ -315,9 +315,34 @@ K2, N = other.shape if (K1 != K2): raise ValueError, "shape mismatch error" + + #return self._binopt(other,'mu',in_shape=(M,N),out_shape=(M,N)) + + major_axis = self._swap((M,N))[0] + indptr = empty( major_axis + 1, dtype=intc ) + other = self._tothis(other) + fn = getattr(sparsetools, self.format + '_matmat_pass1') + fn( M, N, self.indptr, self.indices, \ + other.indptr, other.indices, \ + indptr) + + nnz = indptr[-1] + indices = empty( nnz, dtype=intc) + data = empty( nnz, dtype=upcast(self.dtype,other.dtype)) - return self._binopt(other,'mu',in_shape=(M,N),out_shape=(M,N)) + fn = getattr(sparsetools, self.format + '_matmat_pass2') + fn( M, N, self.indptr, self.indices, self.data, \ + other.indptr, other.indices, other.data, \ + indptr, indices, data) + + nnz = indptr[-1] #may have changed + #indices = indices[:nnz] + #data = indices[:nnz] + + return self.__class__((data,indices,indptr),shape=(M,N)) + + elif isdense(other): # TODO make sparse * dense matrix multiplication more efficient @@ -333,7 +358,7 @@ raise ValueError, "dimension mismatch" # csrmux, cscmux - fn = getattr(sparsetools,self.format + 'mux') + fn = getattr(sparsetools,self.format + '_matvec') #output array y = empty( self.shape[0], dtype=upcast(self.dtype,other.dtype) ) @@ -445,7 +470,7 @@ def sort_indices(self): """Sort the indices of this matrix *in place* """ - fn = getattr(sparsetools,'sort_' + self.format + '_indices') + fn = getattr(sparsetools,self.format + '_sort_indices') M,N = self.shape fn( M, N, self.indptr, self.indices, self.data) Modified: trunk/scipy/sparse/construct.py =================================================================== --- trunk/scipy/sparse/construct.py 2007-12-15 05:38:59 UTC (rev 3663) +++ trunk/scipy/sparse/construct.py 2007-12-15 05:59:12 UTC (rev 3664) @@ -4,7 +4,7 @@ __all__ = [ 'spdiags','speye','spidentity','spkron', 'lil_eye', 'lil_diags' ] -import itertools +from itertools import izip from warnings import warn import numpy @@ -15,9 +15,9 @@ from coo import coo_matrix from dok import dok_matrix from lil import lil_matrix +from dia import dia_matrix from base import isspmatrix -import sparsetools def spdiags(diags, offsets, m, n, format=None): """Return a sparse matrix given its diagonals. @@ -47,19 +47,7 @@ """ #TODO update this example - - if format == 'csc': - diags = array(diags, copy = True) - if diags.dtype.char not in 'fdFD': - diags = diags.astype('d') - if not hasattr(offsets, '__len__' ): - offsets = (offsets,) - offsets = array(offsets, copy=False, dtype=intc) - assert(len(offsets) == diags.shape[0]) - indptr, rowind, data = sparsetools.spdiags(m, n, len(offsets), offsets, diags) - return csc_matrix((data, rowind, indptr), (m, n)) - else: - return spdiags( diags, offsets, m, n, format='csc').asformat(format) + return dia_matrix((diags, offsets), shape=(m,n)).asformat(format) def spidentity(n, dtype='d', format=None): """spidentity(n) returns an (n x n) identity matrix""" @@ -201,7 +189,7 @@ "diagonal %s." % k) out = lil_matrix((m,n),dtype=dtype) - for k,diag in itertools.izip(offsets,diags): + for k,diag in izip(offsets,diags): for ix,c in enumerate(xrange(clip(k,0,n),clip(m+k,0,n))): out.rows[c-k].append(c) out.data[c-k].append(diag[ix]) Modified: trunk/scipy/sparse/coo.py =================================================================== --- trunk/scipy/sparse/coo.py 2007-12-15 05:38:59 UTC (rev 3663) +++ trunk/scipy/sparse/coo.py 2007-12-15 05:59:12 UTC (rev 3664) @@ -5,9 +5,9 @@ from itertools import izip from warnings import warn -from numpy import array, asarray, empty, intc +from numpy import array, asarray, empty, intc, zeros, bincount -from sparsetools import cootocsr, cootocsc +from sparsetools import coo_tocsr, coo_tocsc from base import spmatrix, isspmatrix from sputils import upcast, to_native, isshape, getdtype @@ -161,7 +161,6 @@ self.shape = tuple([int(x) for x in self.shape]) self.nnz = nnz - def rowcol(self, num): return (self.row[num], self.col[num]) @@ -172,6 +171,12 @@ M,N = self.shape return coo_matrix((self.data,(self.col,self.row)),(N,M),copy=copy) + def toarray(self): + A = self.tocsr().tocoo(copy=False) #eliminate (i,j) duplicates + M = zeros(self.shape, dtype=self.dtype) + M[A.row, A.col] = A.data + return M + def tocsc(self): from csc import csc_matrix if self.nnz == 0: @@ -181,9 +186,9 @@ indices = empty(self.nnz, dtype=intc) data = empty(self.nnz, dtype=upcast(self.dtype)) - cootocsc(self.shape[0], self.shape[1], self.nnz, \ - self.row, self.col, self.data, \ - indptr, indices, data) + coo_tocsc(self.shape[0], self.shape[1], self.nnz, \ + self.row, self.col, self.data, \ + indptr, indices, data) return csc_matrix((data, indices, indptr), self.shape) @@ -196,9 +201,9 @@ indices = empty(self.nnz, dtype=intc) data = empty(self.nnz, dtype=upcast(self.dtype)) - cootocsr(self.shape[0], self.shape[1], self.nnz, \ - self.row, self.col, self.data, \ - indptr, indices, data) + coo_tocsr(self.shape[0], self.shape[1], self.nnz, \ + self.row, self.col, self.data, \ + indptr, indices, data) return csr_matrix((data, indices, indptr), self.shape) Modified: trunk/scipy/sparse/csc.py =================================================================== --- trunk/scipy/sparse/csc.py 2007-12-15 05:38:59 UTC (rev 3663) +++ trunk/scipy/sparse/csc.py 2007-12-15 05:59:12 UTC (rev 3664) @@ -10,7 +10,7 @@ empty, hstack, isscalar, ndarray, shape, searchsorted from base import spmatrix,isspmatrix -from sparsetools import csctocsr +from sparsetools import csc_tocsr from sputils import upcast, to_native, isdense, isshape, getdtype, \ isscalarlike @@ -161,15 +161,18 @@ indices = empty(self.nnz, dtype=intc) data = empty(self.nnz, dtype=upcast(self.dtype)) - csctocsr(self.shape[0], self.shape[1], \ - self.indptr, self.indices, self.data, \ - indptr, indices, data) + csc_tocsr(self.shape[0], self.shape[1], \ + self.indptr, self.indices, self.data, \ + indptr, indices, data) from csr import csr_matrix return csr_matrix((data, indices, indptr), self.shape) - + def toarray(self): - return self.tocsr().toarray() + A = self.tocoo(copy=False) + M = zeros(self.shape, dtype=self.dtype) + M[A.row, A.col] = A.data + return M def get_submatrix( self, slice0, slice1 ): """Return a submatrix of this matrix (new matrix is created). @@ -197,6 +200,7 @@ def _tothis(self, other): return other.tocsc() + from sputils import _isinstance def isspmatrix_csc(x): Modified: trunk/scipy/sparse/csr.py =================================================================== --- trunk/scipy/sparse/csr.py 2007-12-15 05:38:59 UTC (rev 3663) +++ trunk/scipy/sparse/csr.py 2007-12-15 05:59:12 UTC (rev 3664) @@ -11,7 +11,7 @@ empty, hstack, isscalar, ndarray, shape, searchsorted from base import spmatrix,isspmatrix -from sparsetools import csrtodense, csrtocsc +from sparsetools import csr_tocsc from sputils import upcast, to_native, isdense, isshape, getdtype, \ isscalarlike @@ -168,19 +168,18 @@ indices = empty(self.nnz, dtype=intc) data = empty(self.nnz, dtype=upcast(self.dtype)) - csrtocsc(self.shape[0], self.shape[1], \ - self.indptr, self.indices, self.data, \ - indptr, indices, data) + csr_tocsc(self.shape[0], self.shape[1], \ + self.indptr, self.indices, self.data, \ + indptr, indices, data) from csc import csc_matrix return csc_matrix((data, indices, indptr), self.shape) def toarray(self): - #TODO use a cheap tocoo() and make coo->todense() - data = numpy.zeros(self.shape, dtype=upcast(self.data.dtype)) - csrtodense(self.shape[0], self.shape[1], self.indptr, self.indices, - self.data, data) - return data + A = self.tocoo(copy=False) + M = zeros(self.shape, dtype=self.dtype) + M[A.row, A.col] = A.data + return M def get_submatrix( self, slice0, slice1 ): """Return a submatrix of this matrix (new matrix is created). Modified: trunk/scipy/sparse/dia.py =================================================================== --- trunk/scipy/sparse/dia.py 2007-12-15 05:38:59 UTC (rev 3663) +++ trunk/scipy/sparse/dia.py 2007-12-15 05:59:12 UTC (rev 3664) @@ -3,7 +3,7 @@ __all__ = ['dia_matrix','isspmatrix_dia'] from numpy import asarray, asmatrix, matrix, zeros, arange, unique, \ - searchsorted, intc + searchsorted, intc, atleast_1d, atleast_2d from base import spmatrix, isspmatrix, isdense from sputils import isscalarlike, isshape, upcast, getdtype @@ -55,8 +55,8 @@ else: if shape is None: raise ValueError,'expected a shape argument' - self.diags = asarray(arg1[0],dtype=dtype) - self.offsets = asarray(arg1[1],dtype='i') + self.diags = atleast_2d(asarray(arg1[0],dtype=dtype)) + self.offsets = atleast_1d(asarray(arg1[1],dtype='i')) self.shape = shape #check format Modified: trunk/scipy/sparse/lil.py =================================================================== --- trunk/scipy/sparse/lil.py 2007-12-15 05:38:59 UTC (rev 3663) +++ trunk/scipy/sparse/lil.py 2007-12-15 05:59:12 UTC (rev 3664) @@ -3,6 +3,8 @@ Original code by Ed Schofield. """ +__all__ = ['lil_matrix','isspmatrix_lil'] + import copy from bisect import bisect_left Modified: trunk/scipy/sparse/sparsetools/sparsetools.h =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.h 2007-12-15 05:38:59 UTC (rev 3663) +++ trunk/scipy/sparse/sparsetools/sparsetools.h 2007-12-15 05:59:12 UTC (rev 3664) @@ -45,12 +45,12 @@ * */ template -void extract_csr_diagonal(const I n_row, - const I n_col, - const I Ap[], - const I Aj[], - const T Ax[], - T Yx[]) +void csr_diagonal(const I n_row, + const I n_col, + const I Ap[], + const I Aj[], + const T Ax[], + T Yx[]) { const I N = std::min(n_row, n_col); @@ -132,21 +132,21 @@ * */ template -void csrtocsc(const I n_row, - const I n_col, - const I Ap[], - const I Aj[], - const T Ax[], - I Bp[], - I Bi[], - T Bx[]) +void csr_tocsc(const I n_row, + const I n_col, + const I Ap[], + const I Aj[], + const T Ax[], + I Bp[], + I Bi[], + T Bx[]) { - I NNZ = Ap[n_row]; + I nnz = Ap[n_row]; std::vector temp(n_col,0); //temp array //compute number of non-zero entries per column of A - for (I i = 0; i < NNZ; i++){ + for (I i = 0; i < nnz; i++){ temp[Aj[i]]++; } @@ -155,7 +155,7 @@ Bp[i] = cumsum; cumsum += temp[i]; } - Bp[n_col] = NNZ; + Bp[n_col] = nnz; std::copy(Bp, Bp + n_col, temp.begin()); @@ -203,19 +203,19 @@ * */ template -void csrtocoo(const I n_row, - const I n_col, - const I Ap[], - const I Aj[], - const T Ax[], - std::vector* Bi, - std::vector* Bj, - std::vector* Bx) +void csr_tocoo(const I n_row, + const I n_col, + const I Ap[], + const I Aj[], + const T Ax[], + std::vector* Bi, + std::vector* Bj, + std::vector* Bx) { - I NNZ = Ap[n_row]; - Bi->reserve(NNZ); - Bi->reserve(NNZ); - Bx->reserve(NNZ); + I nnz = Ap[n_row]; + Bi->reserve(nnz); + Bi->reserve(nnz); + Bx->reserve(nnz); for(I i = 0; i < n_row; i++){ I row_start = Ap[i]; I row_end = Ap[i+1]; @@ -230,6 +230,120 @@ /* + * Compute CSR row pointer for the matrix product C = A * B + * + */ +template +void csr_matmat_pass1(const I n_row, + const I n_col, + const I Ap[], + const I Aj[], + const I Bp[], + const I Bj[], + I Cp[]) +{ + std::vector next(n_col,-1); + + Cp[0] = 0; + + for(I i = 0; i < n_row; i++){ + I head = -2; + I length = 0; + + I jj_start = Ap[i]; + I jj_end = Ap[i+1]; + for(I jj = jj_start; jj < jj_end; jj++){ + I j = Aj[jj]; + I kk_start = Bp[j]; + I kk_end = Bp[j+1]; + for(I kk = kk_start; kk < kk_end; kk++){ + I k = Bj[kk]; + if(next[k] == -1){ + next[k] = head; + head = k; + length++; + } + } + } + + for(I jj = 0; jj < length; jj++){ + I temp = head; + head = next[head]; + next[temp] = -1; + } + + Cp[i+1] = Cp[i] + length; + } +} + +template +void csr_matmat_pass2(const I n_row, + const I n_col, + const I Ap[], + const I Aj[], + const T Ax[], + const I Bp[], + const I Bj[], + const T Bx[], + I Cp[], + I Cj[], + T Cx[]) +{ + std::vector next(n_col,-1); + std::vector sums(n_col, 0); + + I nnz = 0; + + Cp[0] = 0; + + for(I i = 0; i < n_row; i++){ + I head = -2; + I length = 0; + + I jj_start = Ap[i]; + I jj_end = Ap[i+1]; + for(I jj = jj_start; jj < jj_end; jj++){ + I j = Aj[jj]; + T v = Ax[jj]; + + I kk_start = Bp[j]; + I kk_end = Bp[j+1]; + for(I kk = kk_start; kk < kk_end; kk++){ + I k = Bj[kk]; + + sums[k] += v*Bx[kk]; + + if(next[k] == -1){ + next[k] = head; + head = k; + length++; + } + } + } + + for(I jj = 0; jj < length; jj++){ + + if(sums[head] != 0){ + Cj[nnz] = head; + Cx[nnz] = sums[head]; + nnz++; + } + + I temp = head; + head = next[head]; + + next[temp] = -1; //clear arrays + sums[temp] = 0; + } + + Cp[i+1] = nnz; + } +} + + + + +/* * Compute C = A*B for CSR matrices A,B * * @@ -282,45 +396,50 @@ std::vector* Cj, std::vector* Cx) { - Cp->resize(n_row+1,0); - - std::vector index(n_col,-1); - std::vector sums(n_col,0); + Cp->resize(n_row+1,0); - for(I i = 0; i < n_row; i++){ - I istart = -2; - I length = 0; - - for(I jj = Ap[i]; jj < Ap[i+1]; jj++){ - I j = Aj[jj]; - for(I kk = Bp[j]; kk < Bp[j+1]; kk++){ - I k = Bj[kk]; - - sums[k] += Ax[jj]*Bx[kk]; - - if(index[k] == -1){ - index[k] = istart; - istart = k; - length++; - } - } - } + std::vector next(n_col,-1); + std::vector sums(n_col, 0); - for(I jj = 0; jj < length; jj++){ - if(sums[istart] != 0){ - Cj->push_back(istart); - Cx->push_back(sums[istart]); - } - - I temp = istart; - istart = index[istart]; - - index[temp] = -1; //clear arrays - sums[temp] = 0; + for(I i = 0; i < n_row; i++){ + I head = -2; + I length = 0; + + I jj_start = Ap[i]; + I jj_end = Ap[i+1]; + for(I jj = jj_start; jj < jj_end; jj++){ + I j = Aj[jj]; + + I kk_start = Bp[j]; + I kk_end = Bp[j+1]; + for(I kk = kk_start; kk < kk_end; kk++){ + I k = Bj[kk]; + + sums[k] += Ax[jj]*Bx[kk]; + + if(next[k] == -1){ + next[k] = head; + head = k; + length++; + } + } + } + + for(I jj = 0; jj < length; jj++){ + if(sums[head] != 0){ + Cj->push_back(head); + Cx->push_back(sums[head]); + } + + I temp = head; + head = next[head]; + + next[temp] = -1; //clear arrays + sums[temp] = 0; + } + + (*Cp)[i+1] = Cx->size(); } - - (*Cp)[i+1] = Cx->size(); - } } @@ -371,53 +490,57 @@ { Cp->resize(n_row+1,0); - std::vector index(n_col,-1); + std::vector next(n_col,-1); std::vector A_row(n_col,0); std::vector B_row(n_col,0); for(I i = 0; i < n_row; i++){ - I istart = -2; + I head = -2; I length = 0; //add a row of A to A_row - for(I jj = Ap[i]; jj < Ap[i+1]; jj++){ + I i_start = Ap[i]; + I i_end = Ap[i+1]; + for(I jj = i_start; jj < i_end; jj++){ I j = Aj[jj]; A_row[j] += Ax[jj]; - if(index[j] == -1){ - index[j] = istart; - istart = j; + if(next[j] == -1){ + next[j] = head; + head = j; length++; } } //add a row of B to B_row - for(I jj = Bp[i]; jj < Bp[i+1]; jj++){ + i_start = Bp[i]; + i_end = Bp[i+1]; + for(I jj = i_start; jj < i_end; jj++){ I j = Bj[jj]; B_row[j] += Bx[jj]; - if(index[j] == -1){ - index[j] = istart; - istart = j; + if(next[j] == -1){ + next[j] = head; + head = j; length++; } } for(I jj = 0; jj < length; jj++){ - T result = op(A_row[istart],B_row[istart]); + T result = op(A_row[head],B_row[head]); if(result != 0){ - Cj->push_back(istart); + Cj->push_back(head); Cx->push_back(result); } - I temp = istart; - istart = index[istart]; + I temp = head; + head = next[head]; - index[temp] = -1; + next[temp] = -1; A_row[temp] = 0; B_row[temp] = 0; } @@ -491,7 +614,7 @@ std::vector next(n_col,-1); std::vector sums(n_col, 0); - I NNZ = 0; + I nnz = 0; I row_start = 0; I row_end = 0; @@ -518,15 +641,15 @@ head = next[curr]; if(sums[curr] != 0){ - Aj[NNZ] = curr; - Ax[NNZ] = sums[curr]; - NNZ++; + Aj[nnz] = curr; + Ax[nnz] = sums[curr]; + nnz++; } next[curr] = -1; sums[curr] = 0; } - Ap[i+1] = NNZ; + Ap[i+1] = nnz; } } @@ -539,6 +662,7 @@ * Input Arguments: * I n_row - number of rows in A * I n_col - number of columns in A + * I nnz - number of nonzeros in A * I Ai[nnz(A)] - row indices * I Aj[nnz(A)] - column indices * T Ax[nnz(A)] - nonzeros @@ -561,20 +685,20 @@ * */ template -void cootocsr(const I n_row, - const I n_col, - const I NNZ, - const I Ai[], - const I Aj[], - const T Ax[], - I Bp[], - I Bj[], - T Bx[]) +void coo_tocsr(const I n_row, + const I n_col, + const I nnz, + const I Ai[], + const I Aj[], + const T Ax[], + I Bp[], + I Bj[], + T Bx[]) { std::vector temp(n_row,0); //compute nnz per row, then compute Bp - for(I i = 0; i < NNZ; i++){ + for(I i = 0; i < nnz; i++){ temp[Ai[i]]++; } //cumsum the nnz per row to get Bp[] @@ -582,11 +706,11 @@ Bp[i] = cumsum; cumsum += temp[i]; } - Bp[n_row] = NNZ; + Bp[n_row] = nnz; std::copy(Bp, Bp + n_row, temp.begin()); //write Aj,Ax into Bj,Bx - for(I i = 0; i < NNZ; i++){ + for(I i = 0; i < nnz; i++){ I row = Ai[i]; I n = temp[row]; @@ -626,13 +750,13 @@ * */ template -void csrmux(const I n_row, - const I n_col, - const I Ap[], - const I Aj[], - const T Ax[], - const T Xx[], - T Yx[]) +void csr_matvec(const I n_row, + const I n_col, + const I Ap[], + const I Aj[], + const T Ax[], + const T Xx[], + T Yx[]) { for(I i = 0; i < n_row; i++){ I row_start = Ap[i]; @@ -671,13 +795,13 @@ * */ template -void cscmux(const I n_row, - const I n_col, - const I Ap[], - const I Ai[], - const T Ax[], - const T Xx[], - T Yx[]) +void csc_matvec(const I n_row, + const I n_col, + const I Ap[], + const I Ai[], + const T Ax[], + const T Xx[], + T Yx[]) { for(I i = 0; i < n_row; i++){ Yx[i] = 0; @@ -772,12 +896,12 @@ * */ template -void csrtodense(const I n_row, - const I n_col, - const I Ap[], - const I Aj[], - const T Ax[], - T Mx[]) +void csr_todense(const I n_row, + const I n_col, + const I Ap[], + const I Aj[], + const T Ax[], + T Mx[]) { I row_base = 0; for(I i = 0; i < n_row; i++){ @@ -809,12 +933,12 @@ * */ template -void densetocsr(const I n_row, - const I n_col, - const T Mx[], - std::vector* Ap, - std::vector* Aj, - std::vector* Ax) +void dense_tocsr(const I n_row, + const I n_col, + const T Mx[], + std::vector* Ap, + std::vector* Aj, + std::vector* Ax) { const T* x_ptr = Mx; @@ -852,7 +976,7 @@ } template -void sort_csr_indices(const I n_row, +void csr_sort_indices(const I n_row, const I n_col, const I Ap[], I Aj[], @@ -933,33 +1057,35 @@ } + + + /* * Derived methods */ - template -void extract_csc_diagonal(const I n_row, - const I n_col, - const I Ap[], - const I Aj[], - const T Ax[], - T Yx[]) -{ extract_csr_diagonal(n_col, n_row, Ap, Aj, Ax, Yx); } +void csc_diagonal(const I n_row, + const I n_col, + const I Ap[], + const I Aj[], + const T Ax[], + T Yx[]) +{ csr_diagonal(n_col, n_row, Ap, Aj, Ax, Yx); } template -void csctocsr(const I n_row, - const I n_col, - const I Ap[], - const I Ai[], - const T Ax[], - I Bp[], - I Bj[], - T Bx[]) -{ csrtocsc(n_col,n_row,Ap,Ai,Ax,Bp,Bj,Bx); } +void csc_tocsr(const I n_row, + const I n_col, + const I Ap[], + const I Ai[], + const T Ax[], + I Bp[], + I Bj[], + T Bx[]) +{ csr_tocsc(n_col, n_row, Ap, Ai, Ax, Bp, Bj, Bx); } template -void csctocoo(const I n_row, +void csc_tocoo(const I n_row, const I n_col, const I Ap[], const I Ai[], @@ -967,7 +1093,31 @@ std::vector* Bi, std::vector* Bj, std::vector* Bx) -{ csrtocoo(n_col,n_row,Ap,Ai,Ax,Bj,Bi,Bx); } +{ csr_tocoo(n_col, n_row, Ap, Ai, Ax, Bj, Bi, Bx); } + +template +void csc_matmat_pass1(const I n_row, + const I n_col, + const I Ap[], + const I Ai[], + const I Bp[], + const I Bi[], + I Cp[]) +{ csr_matmat_pass1(n_col, n_row, Bp, Bi, Ap, Ai, Cp); } + +template +void csc_matmat_pass2(const I n_row, + const I n_col, + const I Ap[], + const I Ai[], + const T Ax[], + const I Bp[], + const I Bi[], + const T Bx[], + I Cp[], + I Ci[], + T Cx[]) +{ csr_matmat_pass2(n_col, n_row, Bp, Bi, Bx, Ap, Ai, Ax, Cp, Ci, Cx); } template void cscmucsc(const I n_row, @@ -981,19 +1131,19 @@ std::vector* Cp, std::vector* Ci, std::vector* Cx) -{ csrmucsr(n_col,n_row,Bp,Bi,Bx,Ap,Ai,Ax,Cp,Ci,Cx); } +{ csrmucsr(n_col, n_row, Bp, Bi, Bx, Ap, Ai, Ax, Cp, Ci, Cx); } template -void cootocsc(const I n_row, - const I n_col, - const I NNZ, - const I Ai[], - const I Aj[], - const T Ax[], - I Bp[], - I Bi[], - T Bx[]) -{ cootocsr(n_col,n_row,NNZ,Aj,Ai,Ax,Bp,Bi,Bx); } +void coo_tocsc(const I n_row, + const I n_col, + const I nnz, + const I Ai[], + const I Aj[], + const T Ax[], + I Bp[], + I Bi[], + T Bx[]) +{ coo_tocsr(n_col, n_row, nnz, Aj, Ai, Ax, Bp, Bi, Bx); } @@ -1003,7 +1153,7 @@ const I Bp [], const I Bi [], const T Bx [], std::vector* Cp, std::vector* Ci, std::vector* Cx) { - csr_elmul_csr(n_col,n_row,Ap,Ai,Ax,Bp,Bi,Bx,Cp,Ci,Cx); + csr_elmul_csr(n_col, n_row, Ap, Ai, Ax, Bp, Bi, Bx, Cp, Ci, Cx); } template @@ -1012,7 +1162,7 @@ const I Bp [], const I Bi [], const T Bx [], std::vector* Cp, std::vector* Ci, std::vector* Cx) { - csr_eldiv_csr(n_col,n_row,Ap,Ai,Ax,Bp,Bi,Bx,Cp,Ci,Cx); + csr_eldiv_csr(n_col, n_row, Ap, Ai, Ax, Bp, Bi, Bx, Cp, Ci, Cx); } @@ -1022,7 +1172,7 @@ const I Bp [], const I Bi [], const T Bx [], std::vector* Cp, std::vector* Ci, std::vector* Cx) { - csr_plus_csr(n_col,n_row,Ap,Ai,Ax,Bp,Bi,Bx,Cp,Ci,Cx); + csr_plus_csr(n_col, n_row, Ap, Ai, Ax, Bp, Bi, Bx, Cp, Ci, Cx); } template @@ -1031,7 +1181,7 @@ const I Bp [], const I Bi [], const T Bx [], std::vector* Cp, std::vector* Ci, std::vector* Cx) { - csr_minus_csr(n_col,n_row,Ap,Ai,Ax,Bp,Bi,Bx,Cp,Ci,Cx); + csr_minus_csr(n_col, n_row, Ap, Ai, Ax, Bp, Bi, Bx, Cp, Ci, Cx); } @@ -1042,15 +1192,15 @@ I Ap[], I Ai[], T Ax[]) -{ sum_csr_duplicates(n_col,n_row,Ap,Ai,Ax); } +{ sum_csr_duplicates(n_col, n_row, Ap, Ai, Ax); } template -void sort_csc_indices(const I n_row, +void csc_sort_indices(const I n_row, const I n_col, const I Ap[], I Ai[], T Ax[]) -{ sort_csr_indices(n_col,n_row,Ap,Ai,Ax); } +{ csr_sort_indices(n_col, n_row, Ap, Ai, Ax); } #endif Modified: trunk/scipy/sparse/sparsetools/sparsetools.i =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.i 2007-12-15 05:38:59 UTC (rev 3663) +++ trunk/scipy/sparse/sparsetools/sparsetools.i 2007-12-15 05:59:12 UTC (rev 3664) @@ -33,6 +33,9 @@ const ctype Bp [ ], const ctype Bi [ ], const ctype Bj [ ], + const ctype Cp [ ], + const ctype Ci [ ], + const ctype Cj [ ], const ctype offsets [ ] }; %enddef @@ -41,6 +44,7 @@ %apply ctype * IN_ARRAY1 { const ctype Ax [ ], const ctype Bx [ ], + const ctype Cx [ ], const ctype Xx [ ], const ctype Yx [ ] }; @@ -94,7 +98,10 @@ ctype Aj [ ], ctype Bp [ ], ctype Bi [ ], - ctype Bj [ ] + ctype Bj [ ], + ctype Cp [ ], + ctype Ci [ ], + ctype Cj [ ] }; %enddef @@ -102,6 +109,7 @@ %apply ctype * INPLACE_ARRAY { ctype Ax [ ], ctype Bx [ ], + ctype Cx [ ], ctype Yx [ ] }; %enddef @@ -175,15 +183,15 @@ /* * diag(CSR) and diag(CSC) */ -INSTANTIATE_ALL(extract_csr_diagonal) -INSTANTIATE_ALL(extract_csc_diagonal) +INSTANTIATE_ALL(csr_diagonal) +INSTANTIATE_ALL(csc_diagonal) /* * CSR->CSC or CSC->CSR or CSR = CSR^T or CSC = CSC^T */ -INSTANTIATE_ALL(csrtocsc) -INSTANTIATE_ALL(csctocsr) +INSTANTIATE_ALL(csr_tocsc) +INSTANTIATE_ALL(csc_tocsr) /* * CSR<->COO and CSC<->COO @@ -191,21 +199,25 @@ %template(expandptr) expandptr; /*INSTANTIATE_ALL(csrtocoo)*/ /*INSTANTIATE_ALL(csctocoo)*/ -INSTANTIATE_ALL(cootocsr) -INSTANTIATE_ALL(cootocsc) +INSTANTIATE_ALL(coo_tocsr) +INSTANTIATE_ALL(coo_tocsc) /* * CSR*CSR and CSC*CSC */ -INSTANTIATE_ALL(csrmucsr) -INSTANTIATE_ALL(cscmucsc) +%template(csr_matmat_pass1) csr_matmat_pass1; +%template(csc_matmat_pass1) csc_matmat_pass1; +INSTANTIATE_ALL(csr_matmat_pass2) +INSTANTIATE_ALL(csc_matmat_pass2) +/*INSTANTIATE_ALL(csrmucsr)*/ +/*INSTANTIATE_ALL(cscmucsc)*/ /* * CSR*x and CSC*x */ -INSTANTIATE_ALL(csrmux) -INSTANTIATE_ALL(cscmux) +INSTANTIATE_ALL(csr_matvec) +INSTANTIATE_ALL(csc_matvec) /* * CSR (binary op) CSR and CSC (binary op) CSC @@ -225,19 +237,19 @@ /* * spdiags->CSC */ -INSTANTIATE_ALL(spdiags) +/*INSTANTIATE_ALL(spdiags)*/ /* * CSR<->Dense */ -INSTANTIATE_ALL(csrtodense) +/*INSTANTIATE_ALL(csr_todense)*/ /*INSTANTIATE_ALL(densetocsr)*/ /* * Sort CSR/CSC indices. */ -INSTANTIATE_ALL(sort_csr_indices) -INSTANTIATE_ALL(sort_csc_indices) +INSTANTIATE_ALL(csr_sort_indices) +INSTANTIATE_ALL(csc_sort_indices) /* Modified: trunk/scipy/sparse/sparsetools/sparsetools.py =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.py 2007-12-15 05:38:59 UTC (rev 3663) +++ trunk/scipy/sparse/sparsetools/sparsetools.py 2007-12-15 05:59:12 UTC (rev 3664) @@ -53,250 +53,252 @@ """expandptr(int n_row, int Ap, int Bi)""" return _sparsetools.expandptr(*args) +def csr_matmat_pass1(*args): + """ + csr_matmat_pass1(int n_row, int n_col, int Ap, int Aj, int Bp, int Bj, + int Cp) + """ + return _sparsetools.csr_matmat_pass1(*args) -def extract_csr_diagonal(*args): +def csc_matmat_pass1(*args): """ - extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, signed char Ax, + csc_matmat_pass1(int n_row, int n_col, int Ap, int Ai, int Bp, int Bi, + int Cp) + """ + return _sparsetools.csc_matmat_pass1(*args) + + +def csr_diagonal(*args): + """ + csr_diagonal(int n_row, int n_col, int Ap, int Aj, signed char Ax, signed char Yx) - extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, + csr_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, unsigned char Yx) - extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, short Ax, short Yx) - extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, int Ax, int Yx) - extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, long long Ax, + csr_diagonal(int n_row, int n_col, int Ap, int Aj, short Ax, short Yx) + csr_diagonal(int n_row, int n_col, int Ap, int Aj, int Ax, int Yx) + csr_diagonal(int n_row, int n_col, int Ap, int Aj, long long Ax, long long Yx) - extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, float Ax, float Yx) - extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, double Ax, double Yx) - extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, + csr_diagonal(int n_row, int n_col, int Ap, int Aj, float Ax, float Yx) + csr_diagonal(int n_row, int n_col, int Ap, int Aj, double Ax, double Yx) + csr_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, npy_cfloat_wrapper Yx) - extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, + csr_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, npy_cdouble_wrapper Yx) """ - return _sparsetools.extract_csr_diagonal(*args) + return _sparsetools.csr_diagonal(*args) -def extract_csc_diagonal(*args): +def csc_diagonal(*args): """ - extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, signed char Ax, + csc_diagonal(int n_row, int n_col, int Ap, int Aj, signed char Ax, signed char Yx) - extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, + csc_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, unsigned char Yx) - extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, short Ax, short Yx) - extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, int Ax, int Yx) - extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, long long Ax, + csc_diagonal(int n_row, int n_col, int Ap, int Aj, short Ax, short Yx) + csc_diagonal(int n_row, int n_col, int Ap, int Aj, int Ax, int Yx) + csc_diagonal(int n_row, int n_col, int Ap, int Aj, long long Ax, long long Yx) - extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, float Ax, float Yx) - extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, double Ax, double Yx) - extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, + csc_diagonal(int n_row, int n_col, int Ap, int Aj, float Ax, float Yx) + csc_diagonal(int n_row, int n_col, int Ap, int Aj, double Ax, double Yx) + csc_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, npy_cfloat_wrapper Yx) - extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, + csc_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, npy_cdouble_wrapper Yx) """ - return _sparsetools.extract_csc_diagonal(*args) + return _sparsetools.csc_diagonal(*args) -def csrtocsc(*args): +def csr_tocsc(*args): """ - csrtocsc(int n_row, int n_col, int Ap, int Aj, signed char Ax, + csr_tocsc(int n_row, int n_col, int Ap, int Aj, signed char Ax, int Bp, int Bi, signed char Bx) - csrtocsc(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, + csr_tocsc(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, int Bp, int Bi, unsigned char Bx) - csrtocsc(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, + csr_tocsc(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, int Bi, short Bx) - csrtocsc(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, + csr_tocsc(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, int Bi, int Bx) - csrtocsc(int n_row, int n_col, int Ap, int Aj, long long Ax, + csr_tocsc(int n_row, int n_col, int Ap, int Aj, long long Ax, int Bp, int Bi, long long Bx) - csrtocsc(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, + csr_tocsc(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, int Bi, float Bx) - csrtocsc(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, + csr_tocsc(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, int Bi, double Bx) - csrtocsc(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, + csr_tocsc(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, int Bp, int Bi, npy_cfloat_wrapper Bx) - csrtocsc(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, + csr_tocsc(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, int Bp, int Bi, npy_cdouble_wrapper Bx) """ - return _sparsetools.csrtocsc(*args) + return _sparsetools.csr_tocsc(*args) -def csctocsr(*args): +def csc_tocsr(*args): """ - csctocsr(int n_row, int n_col, int Ap, int Ai, signed char Ax, + csc_tocsr(int n_row, int n_col, int Ap, int Ai, signed char Ax, int Bp, int Bj, signed char Bx) - csctocsr(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, + csc_tocsr(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, int Bp, int Bj, unsigned char Bx) - csctocsr(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, + csc_tocsr(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, int Bj, short Bx) - csctocsr(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, + csc_tocsr(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, int Bj, int Bx) - csctocsr(int n_row, int n_col, int Ap, int Ai, long long Ax, + csc_tocsr(int n_row, int n_col, int Ap, int Ai, long long Ax, int Bp, int Bj, long long Bx) - csctocsr(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, + csc_tocsr(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, int Bj, float Bx) - csctocsr(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, + csc_tocsr(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, int Bj, double Bx) - csctocsr(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, + csc_tocsr(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx) - csctocsr(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, + csc_tocsr(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx) """ - return _sparsetools.csctocsr(*args) + return _sparsetools.csc_tocsr(*args) -def cootocsr(*args): +def coo_tocsr(*args): """ - cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, signed char Ax, + coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, signed char Ax, int Bp, int Bj, signed char Bx) - cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, unsigned char Ax, + coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned char Ax, int Bp, int Bj, unsigned char Bx) - cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, short Ax, + coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, short Ax, int Bp, int Bj, short Bx) - cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, int Ax, + coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, int Ax, int Bp, int Bj, int Bx) - cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, long long Ax, + coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, long long Ax, int Bp, int Bj, long long Bx) - cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, float Ax, + coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, float Ax, int Bp, int Bj, float Bx) - cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, double Ax, + coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, double Ax, int Bp, int Bj, double Bx) - cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cfloat_wrapper Ax, + coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx) - cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cdouble_wrapper Ax, + coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx) """ - return _sparsetools.cootocsr(*args) + return _sparsetools.coo_tocsr(*args) -def cootocsc(*args): +def coo_tocsc(*args): """ - cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, signed char Ax, + coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, signed char Ax, int Bp, int Bi, signed char Bx) - cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, unsigned char Ax, + coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned char Ax, int Bp, int Bi, unsigned char Bx) - cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, short Ax, + coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, short Ax, int Bp, int Bi, short Bx) - cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, int Ax, + coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, int Ax, int Bp, int Bi, int Bx) - cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, long long Ax, + coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, long long Ax, int Bp, int Bi, long long Bx) - cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, float Ax, + coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, float Ax, int Bp, int Bi, float Bx) - cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, double Ax, + coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, double Ax, int Bp, int Bi, double Bx) - cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cfloat_wrapper Ax, + coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cfloat_wrapper Ax, int Bp, int Bi, npy_cfloat_wrapper Bx) - cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cdouble_wrapper Ax, + coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cdouble_wrapper Ax, int Bp, int Bi, npy_cdouble_wrapper Bx) """ - return _sparsetools.cootocsc(*args) + return _sparsetools.coo_tocsc(*args) -def csrmucsr(*args): +def csr_matmat_pass2(*args): """ - csrmucsr(int n_row, int n_col, int Ap, int Aj, signed char Ax, - int Bp, int Bj, signed char Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(signed char)> Cx) - csrmucsr(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, - int Bp, int Bj, unsigned char Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(unsigned char)> Cx) - csrmucsr(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, - int Bj, short Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(short)> Cx) - csrmucsr(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, - int Bj, int Bx, std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(int)> Cx) - csrmucsr(int n_row, int n_col, int Ap, int Aj, long long Ax, - int Bp, int Bj, long long Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(long long)> Cx) - csrmucsr(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, - int Bj, float Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(float)> Cx) - csrmucsr(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, - int Bj, double Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(double)> Cx) - csrmucsr(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, + csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, signed char Ax, + int Bp, int Bj, signed char Bx, int Cp, int Cj, + signed char Cx) + csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, + int Bp, int Bj, unsigned char Bx, int Cp, + int Cj, unsigned char Cx) + csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, + int Bj, short Bx, int Cp, int Cj, short Cx) + csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, + int Bj, int Bx, int Cp, int Cj, int Cx) + csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, long long Ax, + int Bp, int Bj, long long Bx, int Cp, int Cj, + long long Cx) + csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, + int Bj, float Bx, int Cp, int Cj, float Cx) + csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, + int Bj, double Bx, int Cp, int Cj, double Cx) + csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(npy_cfloat_wrapper)> Cx) - csrmucsr(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, + int Cp, int Cj, npy_cfloat_wrapper Cx) + csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(npy_cdouble_wrapper)> Cx) + int Cp, int Cj, npy_cdouble_wrapper Cx) """ - return _sparsetools.csrmucsr(*args) + return _sparsetools.csr_matmat_pass2(*args) -def cscmucsc(*args): +def csc_matmat_pass2(*args): """ - cscmucsc(int n_row, int n_col, int Ap, int Ai, signed char Ax, - int Bp, int Bi, signed char Bx, std::vector<(int)> Cp, - std::vector<(int)> Ci, std::vector<(signed char)> Cx) - cscmucsc(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, - int Bp, int Bi, unsigned char Bx, std::vector<(int)> Cp, - std::vector<(int)> Ci, std::vector<(unsigned char)> Cx) - cscmucsc(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, - int Bi, short Bx, std::vector<(int)> Cp, - std::vector<(int)> Ci, std::vector<(short)> Cx) - cscmucsc(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, - int Bi, int Bx, std::vector<(int)> Cp, std::vector<(int)> Ci, - std::vector<(int)> Cx) - cscmucsc(int n_row, int n_col, int Ap, int Ai, long long Ax, - int Bp, int Bi, long long Bx, std::vector<(int)> Cp, - std::vector<(int)> Ci, std::vector<(long long)> Cx) - cscmucsc(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, - int Bi, float Bx, std::vector<(int)> Cp, - std::vector<(int)> Ci, std::vector<(float)> Cx) - cscmucsc(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, - int Bi, double Bx, std::vector<(int)> Cp, - std::vector<(int)> Ci, std::vector<(double)> Cx) - cscmucsc(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, + csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, signed char Ax, + int Bp, int Bi, signed char Bx, int Cp, int Ci, + signed char Cx) + csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, + int Bp, int Bi, unsigned char Bx, int Cp, + int Ci, unsigned char Cx) + csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, + int Bi, short Bx, int Cp, int Ci, short Cx) + csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, + int Bi, int Bx, int Cp, int Ci, int Cx) + csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, long long Ax, + int Bp, int Bi, long long Bx, int Cp, int Ci, + long long Cx) + csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, + int Bi, float Bx, int Cp, int Ci, float Cx) + csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, + int Bi, double Bx, int Cp, int Ci, double Cx) + csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, int Bp, int Bi, npy_cfloat_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Ci, - std::vector<(npy_cfloat_wrapper)> Cx) - cscmucsc(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, + int Cp, int Ci, npy_cfloat_wrapper Cx) + csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, int Bp, int Bi, npy_cdouble_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Ci, - std::vector<(npy_cdouble_wrapper)> Cx) + int Cp, int Ci, npy_cdouble_wrapper Cx) """ - return _sparsetools.cscmucsc(*args) + return _sparsetools.csc_matmat_pass2(*args) -def csrmux(*args): +def csr_matvec(*args): """ - csrmux(int n_row, int n_col, int Ap, int Aj, signed char Ax, + csr_matvec(int n_row, int n_col, int Ap, int Aj, signed char Ax, signed char Xx, signed char Yx) - csrmux(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, + csr_matvec(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, unsigned char Xx, unsigned char Yx) - csrmux(int n_row, int n_col, int Ap, int Aj, short Ax, short Xx, + csr_matvec(int n_row, int n_col, int Ap, int Aj, short Ax, short Xx, short Yx) - csrmux(int n_row, int n_col, int Ap, int Aj, int Ax, int Xx, + csr_matvec(int n_row, int n_col, int Ap, int Aj, int Ax, int Xx, int Yx) - csrmux(int n_row, int n_col, int Ap, int Aj, long long Ax, + csr_matvec(int n_row, int n_col, int Ap, int Aj, long long Ax, long long Xx, long long Yx) - csrmux(int n_row, int n_col, int Ap, int Aj, float Ax, float Xx, + csr_matvec(int n_row, int n_col, int Ap, int Aj, float Ax, float Xx, float Yx) - csrmux(int n_row, int n_col, int Ap, int Aj, double Ax, double Xx, + csr_matvec(int n_row, int n_col, int Ap, int Aj, double Ax, double Xx, double Yx) - csrmux(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, + csr_matvec(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, npy_cfloat_wrapper Xx, npy_cfloat_wrapper Yx) - csrmux(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, + csr_matvec(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, npy_cdouble_wrapper Xx, npy_cdouble_wrapper Yx) """ - return _sparsetools.csrmux(*args) + return _sparsetools.csr_matvec(*args) -def cscmux(*args): +def csc_matvec(*args): """ - cscmux(int n_row, int n_col, int Ap, int Ai, signed char Ax, + csc_matvec(int n_row, int n_col, int Ap, int Ai, signed char Ax, signed char Xx, signed char Yx) - cscmux(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, + csc_matvec(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, unsigned char Xx, unsigned char Yx) - cscmux(int n_row, int n_col, int Ap, int Ai, short Ax, short Xx, + csc_matvec(int n_row, int n_col, int Ap, int Ai, short Ax, short Xx, short Yx) - cscmux(int n_row, int n_col, int Ap, int Ai, int Ax, int Xx, + csc_matvec(int n_row, int n_col, int Ap, int Ai, int Ax, int Xx, int Yx) - cscmux(int n_row, int n_col, int Ap, int Ai, long long Ax, + csc_matvec(int n_row, int n_col, int Ap, int Ai, long long Ax, long long Xx, long long Yx) - cscmux(int n_row, int n_col, int Ap, int Ai, float Ax, float Xx, + csc_matvec(int n_row, int n_col, int Ap, int Ai, float Ax, float Xx, float Yx) - cscmux(int n_row, int n_col, int Ap, int Ai, double Ax, double Xx, + csc_matvec(int n_row, int n_col, int Ap, int Ai, double Ax, double Xx, double Yx) - cscmux(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, + csc_matvec(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, npy_cfloat_wrapper Xx, npy_cfloat_wrapper Yx) - cscmux(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, + csc_matvec(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, npy_cdouble_wrapper Xx, npy_cdouble_wrapper Yx) """ - return _sparsetools.cscmux(*args) + return _sparsetools.csc_matvec(*args) def csr_elmul_csr(*args): """ @@ -570,85 +572,34 @@ """ return _sparsetools.csc_minus_csc(*args) -def spdiags(*args): +def csr_sort_indices(*args): """ - spdiags(int n_row, int n_col, int n_diag, int offsets, signed char diags, - std::vector<(int)> Ap, std::vector<(int)> Ai, - std::vector<(signed char)> Ax) - spdiags(int n_row, int n_col, int n_diag, int offsets, unsigned char diags, - std::vector<(int)> Ap, std::vector<(int)> Ai, - std::vector<(unsigned char)> Ax) - spdiags(int n_row, int n_col, int n_diag, int offsets, short diags, - std::vector<(int)> Ap, std::vector<(int)> Ai, - std::vector<(short)> Ax) - spdiags(int n_row, int n_col, int n_diag, int offsets, int diags, - std::vector<(int)> Ap, std::vector<(int)> Ai, - std::vector<(int)> Ax) - spdiags(int n_row, int n_col, int n_diag, int offsets, long long diags, - std::vector<(int)> Ap, std::vector<(int)> Ai, - std::vector<(long long)> Ax) - spdiags(int n_row, int n_col, int n_diag, int offsets, float diags, - std::vector<(int)> Ap, std::vector<(int)> Ai, - std::vector<(float)> Ax) - spdiags(int n_row, int n_col, int n_diag, int offsets, double diags, - std::vector<(int)> Ap, std::vector<(int)> Ai, - std::vector<(double)> Ax) - spdiags(int n_row, int n_col, int n_diag, int offsets, npy_cfloat_wrapper diags, - std::vector<(int)> Ap, - std::vector<(int)> Ai, std::vector<(npy_cfloat_wrapper)> Ax) - spdiags(int n_row, int n_col, int n_diag, int offsets, npy_cdouble_wrapper diags, - std::vector<(int)> Ap, - std::vector<(int)> Ai, std::vector<(npy_cdouble_wrapper)> Ax) + csr_sort_indices(int n_row, int n_col, int Ap, int Aj, signed char Ax) + csr_sort_indices(int n_row, int n_col, int Ap, int Aj, unsigned char Ax) + csr_sort_indices(int n_row, int n_col, int Ap, int Aj, short Ax) + csr_sort_indices(int n_row, int n_col, int Ap, int Aj, int Ax) + csr_sort_indices(int n_row, int n_col, int Ap, int Aj, long long Ax) + csr_sort_indices(int n_row, int n_col, int Ap, int Aj, float Ax) + csr_sort_indices(int n_row, int n_col, int Ap, int Aj, double Ax) + csr_sort_indices(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax) + csr_sort_indices(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax) """ - return _sparsetools.spdiags(*args) + return _sparsetools.csr_sort_indices(*args) -def csrtodense(*args): +def csc_sort_indices(*args): """ - csrtodense(int n_row, int n_col, int Ap, int Aj, signed char Ax, - signed char Mx) - csrtodense(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, - unsigned char Mx) - csrtodense(int n_row, int n_col, int Ap, int Aj, short Ax, short Mx) - csrtodense(int n_row, int n_col, int Ap, int Aj, int Ax, int Mx) - csrtodense(int n_row, int n_col, int Ap, int Aj, long long Ax, - long long Mx) - csrtodense(int n_row, int n_col, int Ap, int Aj, float Ax, float Mx) - csrtodense(int n_row, int n_col, int Ap, int Aj, double Ax, double Mx) - csrtodense(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, - npy_cfloat_wrapper Mx) - csrtodense(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, - npy_cdouble_wrapper Mx) + csc_sort_indices(int n_row, int n_col, int Ap, int Ai, signed char Ax) + csc_sort_indices(int n_row, int n_col, int Ap, int Ai, unsigned char Ax) + csc_sort_indices(int n_row, int n_col, int Ap, int Ai, short Ax) + csc_sort_indices(int n_row, int n_col, int Ap, int Ai, int Ax) + csc_sort_indices(int n_row, int n_col, int Ap, int Ai, long long Ax) + csc_sort_indices(int n_row, int n_col, int Ap, int Ai, float Ax) + csc_sort_indices(int n_row, int n_col, int Ap, int Ai, double Ax) + csc_sort_indices(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax) + csc_sort_indices(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax) """ - return _sparsetools.csrtodense(*args) + return _sparsetools.csc_sort_indices(*args) -def sort_csr_indices(*args): - """ - sort_csr_indices(int n_row, int n_col, int Ap, int Aj, signed char Ax) - sort_csr_indices(int n_row, int n_col, int Ap, int Aj, unsigned char Ax) - sort_csr_indices(int n_row, int n_col, int Ap, int Aj, short Ax) - sort_csr_indices(int n_row, int n_col, int Ap, int Aj, int Ax) - sort_csr_indices(int n_row, int n_col, int Ap, int Aj, long long Ax) - sort_csr_indices(int n_row, int n_col, int Ap, int Aj, float Ax) - sort_csr_indices(int n_row, int n_col, int Ap, int Aj, double Ax) - sort_csr_indices(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax) - sort_csr_indices(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax) - """ - return _sparsetools.sort_csr_indices(*args) - -def sort_csc_indices(*args): - """ - sort_csc_indices(int n_row, int n_col, int Ap, int Ai, signed char Ax) - sort_csc_indices(int n_row, int n_col, int Ap, int Ai, unsigned char Ax) - sort_csc_indices(int n_row, int n_col, int Ap, int Ai, short Ax) - sort_csc_indices(int n_row, int n_col, int Ap, int Ai, int Ax) - sort_csc_indices(int n_row, int n_col, int Ap, int Ai, long long Ax) - sort_csc_indices(int n_row, int n_col, int Ap, int Ai, float Ax) - sort_csc_indices(int n_row, int n_col, int Ap, int Ai, double Ax) - sort_csc_indices(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax) - sort_csc_indices(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax) - """ - return _sparsetools.sort_csc_indices(*args) - def sum_csr_duplicates(*args): """ sum_csr_duplicates(int n_row, int n_col, int Ap, int Aj, signed char Ax) Modified: trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx 2007-12-15 05:38:59 UTC (rev 3663) +++ trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx 2007-12-15 05:59:12 UTC (rev 3664) @@ -3080,7 +3080,7 @@ #ifdef __cplusplus extern "C" { #endif -SWIGINTERN PyObject *_wrap_extract_csr_diagonal__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_diagonal__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -3106,15 +3106,15 @@ PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_diagonal" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csr_diagonal" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_diagonal" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -3152,7 +3152,7 @@ if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; arg6 = (signed char*) array_data(temp6); } - extract_csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6); + csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -3178,7 +3178,7 @@ } -SWIGINTERN PyObject *_wrap_extract_csr_diagonal__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_diagonal__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -3204,15 +3204,15 @@ PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_diagonal" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csr_diagonal" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_diagonal" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -3250,7 +3250,7 @@ if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; arg6 = (unsigned char*) array_data(temp6); } - extract_csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6); + csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -3276,7 +3276,7 @@ } -SWIGINTERN PyObject *_wrap_extract_csr_diagonal__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_diagonal__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -3302,15 +3302,15 @@ PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_diagonal" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csr_diagonal" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_diagonal" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -3348,7 +3348,7 @@ if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; arg6 = (short*) array_data(temp6); } - extract_csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6); + csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -3374,7 +3374,7 @@ } -SWIGINTERN PyObject *_wrap_extract_csr_diagonal__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_diagonal__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -3400,15 +3400,15 @@ PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_diagonal" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csr_diagonal" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_diagonal" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -3446,7 +3446,7 @@ if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; arg6 = (int*) array_data(temp6); } - extract_csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6); + csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -3472,7 +3472,7 @@ } -SWIGINTERN PyObject *_wrap_extract_csr_diagonal__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_diagonal__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -3498,15 +3498,15 @@ PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_diagonal" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csr_diagonal" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_diagonal" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -3544,7 +3544,7 @@ if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; arg6 = (long long*) array_data(temp6); } - extract_csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,arg6); + csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -3570,7 +3570,7 @@ } -SWIGINTERN PyObject *_wrap_extract_csr_diagonal__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_diagonal__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -3596,15 +3596,15 @@ PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_diagonal" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csr_diagonal" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_diagonal" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -3642,7 +3642,7 @@ if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; arg6 = (float*) array_data(temp6); } - extract_csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6); + csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -3668,7 +3668,7 @@ } -SWIGINTERN PyObject *_wrap_extract_csr_diagonal__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_diagonal__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -3694,15 +3694,15 @@ PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_diagonal" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csr_diagonal" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_diagonal" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -3740,7 +3740,7 @@ if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; arg6 = (double*) array_data(temp6); } - extract_csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6); + csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -3766,7 +3766,7 @@ } -SWIGINTERN PyObject *_wrap_extract_csr_diagonal__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_diagonal__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -3792,15 +3792,15 @@ PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_diagonal" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csr_diagonal" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_diagonal" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -3838,7 +3838,7 @@ if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; arg6 = (npy_cfloat_wrapper*) array_data(temp6); } - extract_csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,arg6); + csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -3864,7 +3864,7 @@ } -SWIGINTERN PyObject *_wrap_extract_csr_diagonal__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_diagonal__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -3890,15 +3890,15 @@ PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csr_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csr_diagonal" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_diagonal" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csr_diagonal" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_diagonal" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -3936,7 +3936,7 @@ if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; arg6 = (npy_cdouble_wrapper*) array_data(temp6); } - extract_csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,arg6); + csr_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -3962,7 +3962,7 @@ } -SWIGINTERN PyObject *_wrap_extract_csr_diagonal(PyObject *self, PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_diagonal(PyObject *self, PyObject *args) { int argc; PyObject *argv[7]; int ii; @@ -4000,7 +4000,7 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_extract_csr_diagonal__SWIG_1(self, args); + return _wrap_csr_diagonal__SWIG_1(self, args); } } } @@ -4036,7 +4036,7 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_extract_csr_diagonal__SWIG_2(self, args); + return _wrap_csr_diagonal__SWIG_2(self, args); } } } @@ -4072,7 +4072,7 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_extract_csr_diagonal__SWIG_3(self, args); + return _wrap_csr_diagonal__SWIG_3(self, args); } } } @@ -4108,7 +4108,7 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_extract_csr_diagonal__SWIG_4(self, args); + return _wrap_csr_diagonal__SWIG_4(self, args); } } } @@ -4144,7 +4144,7 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_extract_csr_diagonal__SWIG_5(self, args); + return _wrap_csr_diagonal__SWIG_5(self, args); } } } @@ -4180,7 +4180,7 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_extract_csr_diagonal__SWIG_6(self, args); + return _wrap_csr_diagonal__SWIG_6(self, args); } } } @@ -4216,7 +4216,7 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_extract_csr_diagonal__SWIG_7(self, args); + return _wrap_csr_diagonal__SWIG_7(self, args); } } } @@ -4252,7 +4252,7 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_extract_csr_diagonal__SWIG_8(self, args); + return _wrap_csr_diagonal__SWIG_8(self, args); } } } @@ -4288,7 +4288,7 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_extract_csr_diagonal__SWIG_9(self, args); + return _wrap_csr_diagonal__SWIG_9(self, args); } } } @@ -4298,12 +4298,12 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'extract_csr_diagonal'.\n Possible C/C++ prototypes are:\n"" extract_csr_diagonal<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],signed char [])\n"" extract_csr_diagonal<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],unsigned char [])\n"" extract_csr_diagonal<(int,short)>(int const,int const,int const [],int const [],short const [],short [])\n"" extract_csr_diagonal<(int,int)>(int const,int const,int const [],int const [],int const [],int [])\n"" extract_csr_diagonal<(int,long long)>(int const,int const,int const [],int const [],long long const [],long long [])\n"" extract_csr_diagonal<(int,float)>(int const,int const,int const [],int const [],float const [],float [])\n"" extract_csr_diagonal<(int,double)>(int const,int const,int const [],int const [],double const [],double [])\n"" extract_csr_diagonal<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper [])\n"" extract_csr_diagonal<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper [])\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_diagonal'.\n Possible C/C++ prototypes are:\n"" csr_diagonal<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],signed char [])\n"" csr_diagonal<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],unsigned char [])\n"" csr_diagonal<(int,short)>(int const,int const,int const [],int const [],short const [],short [])\n"" csr_diagonal<(int,int)>(int const,int const,int const [],int const [],int const [],int [])\n"" csr_diagonal<(int,long long)>(int const,int const,int const [],int const [],long long const [],long long [])\n"" csr_diagonal<(int,float)>(int const,int const,int const [],int const [],float const [],float [])\n"" csr_diagonal<(int,double)>(int const,int const,int const [],int const [],double const [],double [])\n"" csr_diagonal<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper [])\n"" csr_diagonal<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper [])\n"); return NULL; } -SWIGINTERN PyObject *_wrap_extract_csc_diagonal__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_diagonal__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -4329,15 +4329,15 @@ PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_diagonal" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csc_diagonal" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_diagonal" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -4375,7 +4375,7 @@ if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; arg6 = (signed char*) array_data(temp6); } - extract_csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6); + csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -4401,7 +4401,7 @@ } -SWIGINTERN PyObject *_wrap_extract_csc_diagonal__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_diagonal__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -4427,15 +4427,15 @@ PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_diagonal" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csc_diagonal" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_diagonal" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -4473,7 +4473,7 @@ if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; arg6 = (unsigned char*) array_data(temp6); } - extract_csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6); + csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -4499,7 +4499,7 @@ } -SWIGINTERN PyObject *_wrap_extract_csc_diagonal__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_diagonal__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -4525,15 +4525,15 @@ PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_diagonal" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csc_diagonal" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_diagonal" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -4571,7 +4571,7 @@ if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; arg6 = (short*) array_data(temp6); } - extract_csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6); + csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -4597,7 +4597,7 @@ } -SWIGINTERN PyObject *_wrap_extract_csc_diagonal__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_diagonal__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -4623,15 +4623,15 @@ PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_diagonal" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csc_diagonal" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_diagonal" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -4669,7 +4669,7 @@ if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; arg6 = (int*) array_data(temp6); } - extract_csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6); + csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -4695,7 +4695,7 @@ } -SWIGINTERN PyObject *_wrap_extract_csc_diagonal__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_diagonal__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -4721,15 +4721,15 @@ PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_diagonal" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csc_diagonal" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_diagonal" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -4767,7 +4767,7 @@ if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; arg6 = (long long*) array_data(temp6); } - extract_csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,arg6); + csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -4793,7 +4793,7 @@ } -SWIGINTERN PyObject *_wrap_extract_csc_diagonal__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_diagonal__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -4819,15 +4819,15 @@ PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_diagonal" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csc_diagonal" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_diagonal" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -4865,7 +4865,7 @@ if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; arg6 = (float*) array_data(temp6); } - extract_csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6); + csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -4891,7 +4891,7 @@ } -SWIGINTERN PyObject *_wrap_extract_csc_diagonal__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_diagonal__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -4917,15 +4917,15 @@ PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_diagonal" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csc_diagonal" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_diagonal" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -4963,7 +4963,7 @@ if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; arg6 = (double*) array_data(temp6); } - extract_csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6); + csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -4989,7 +4989,7 @@ } -SWIGINTERN PyObject *_wrap_extract_csc_diagonal__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_diagonal__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -5015,15 +5015,15 @@ PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_diagonal" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csc_diagonal" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_diagonal" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -5061,7 +5061,7 @@ if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; arg6 = (npy_cfloat_wrapper*) array_data(temp6); } - extract_csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,arg6); + csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -5087,7 +5087,7 @@ } -SWIGINTERN PyObject *_wrap_extract_csc_diagonal__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_diagonal__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -5113,15 +5113,15 @@ PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:extract_csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csc_diagonal",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "extract_csc_diagonal" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_diagonal" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "extract_csc_diagonal" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_diagonal" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -5159,7 +5159,7 @@ if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; arg6 = (npy_cdouble_wrapper*) array_data(temp6); } - extract_csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,arg6); + csc_diagonal(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,arg6); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -5185,7 +5185,7 @@ } -SWIGINTERN PyObject *_wrap_extract_csc_diagonal(PyObject *self, PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_diagonal(PyObject *self, PyObject *args) { int argc; PyObject *argv[7]; int ii; @@ -5223,7 +5223,7 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_extract_csc_diagonal__SWIG_1(self, args); + return _wrap_csc_diagonal__SWIG_1(self, args); } } } @@ -5259,7 +5259,7 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_extract_csc_diagonal__SWIG_2(self, args); + return _wrap_csc_diagonal__SWIG_2(self, args); } } } @@ -5295,7 +5295,7 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_extract_csc_diagonal__SWIG_3(self, args); + return _wrap_csc_diagonal__SWIG_3(self, args); } } } @@ -5331,7 +5331,7 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_extract_csc_diagonal__SWIG_4(self, args); + return _wrap_csc_diagonal__SWIG_4(self, args); } } } @@ -5367,7 +5367,7 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_extract_csc_diagonal__SWIG_5(self, args); + return _wrap_csc_diagonal__SWIG_5(self, args); } } } @@ -5403,7 +5403,7 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_extract_csc_diagonal__SWIG_6(self, args); + return _wrap_csc_diagonal__SWIG_6(self, args); } } } @@ -5439,7 +5439,7 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_extract_csc_diagonal__SWIG_7(self, args); + return _wrap_csc_diagonal__SWIG_7(self, args); } } } @@ -5475,7 +5475,7 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_extract_csc_diagonal__SWIG_8(self, args); + return _wrap_csc_diagonal__SWIG_8(self, args); } } } @@ -5511,7 +5511,7 @@ _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_extract_csc_diagonal__SWIG_9(self, args); + return _wrap_csc_diagonal__SWIG_9(self, args); } } } @@ -5521,12 +5521,12 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'extract_csc_diagonal'.\n Possible C/C++ prototypes are:\n"" extract_csc_diagonal<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],signed char [])\n"" extract_csc_diagonal<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],unsigned char [])\n"" extract_csc_diagonal<(int,short)>(int const,int const,int const [],int const [],short const [],short [])\n"" extract_csc_diagonal<(int,int)>(int const,int const,int const [],int const [],int const [],int [])\n"" extract_csc_diagonal<(int,long long)>(int const,int const,int const [],int const [],long long const [],long long [])\n"" extract_csc_diagonal<(int,float)>(int const,int const,int const [],int const [],float const [],float [])\n"" extract_csc_diagonal<(int,double)>(int const,int const,int const [],int const [],double const [],double [])\n"" extract_csc_diagonal<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper [])\n"" extract_csc_diagonal<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper [])\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_diagonal'.\n Possible C/C++ prototypes are:\n"" csc_diagonal<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],signed char [])\n"" csc_diagonal<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],unsigned char [])\n"" csc_diagonal<(int,short)>(int const,int const,int const [],int const [],short const [],short [])\n"" csc_diagonal<(int,int)>(int const,int const,int const [],int const [],int const [],int [])\n"" csc_diagonal<(int,long long)>(int const,int const,int const [],int const [],long long const [],long long [])\n"" csc_diagonal<(int,float)>(int const,int const,int const [],int const [],float const [],float [])\n"" csc_diagonal<(int,double)>(int const,int const,int const [],int const [],double const [],double [])\n"" csc_diagonal<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper [])\n"" csc_diagonal<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper [])\n"); return NULL; } -SWIGINTERN PyObject *_wrap_csrtocsc__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_tocsc__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -5558,15 +5558,15 @@ PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_tocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_tocsc" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csrtocsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_tocsc" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -5614,7 +5614,7 @@ if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; arg8 = (signed char*) array_data(temp8); } - csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6,arg7,arg8); + csr_tocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6,arg7,arg8); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -5640,7 +5640,7 @@ } -SWIGINTERN PyObject *_wrap_csrtocsc__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_tocsc__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -5672,15 +5672,15 @@ PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_tocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_tocsc" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csrtocsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_tocsc" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -5728,7 +5728,7 @@ if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; arg8 = (unsigned char*) array_data(temp8); } - csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6,arg7,arg8); + csr_tocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6,arg7,arg8); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -5754,7 +5754,7 @@ } -SWIGINTERN PyObject *_wrap_csrtocsc__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_tocsc__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -5786,15 +5786,15 @@ PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_tocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_tocsc" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csrtocsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_tocsc" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -5842,7 +5842,7 @@ if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; arg8 = (short*) array_data(temp8); } - csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6,arg7,arg8); + csr_tocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6,arg7,arg8); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -5868,7 +5868,7 @@ } -SWIGINTERN PyObject *_wrap_csrtocsc__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_tocsc__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -5900,15 +5900,15 @@ PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_tocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_tocsc" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csrtocsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_tocsc" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -5956,7 +5956,7 @@ if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; arg8 = (int*) array_data(temp8); } - csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6,arg7,arg8); + csr_tocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6,arg7,arg8); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -5982,7 +5982,7 @@ } -SWIGINTERN PyObject *_wrap_csrtocsc__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_tocsc__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -6014,15 +6014,15 @@ PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_tocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_tocsc" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csrtocsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_tocsc" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -6070,7 +6070,7 @@ if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; arg8 = (long long*) array_data(temp8); } - csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,arg6,arg7,arg8); + csr_tocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,arg6,arg7,arg8); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -6096,7 +6096,7 @@ } -SWIGINTERN PyObject *_wrap_csrtocsc__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_tocsc__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -6128,15 +6128,15 @@ PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_tocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_tocsc" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csrtocsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_tocsc" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -6184,7 +6184,7 @@ if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; arg8 = (float*) array_data(temp8); } - csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6,arg7,arg8); + csr_tocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6,arg7,arg8); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -6210,7 +6210,7 @@ } -SWIGINTERN PyObject *_wrap_csrtocsc__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_tocsc__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -6242,15 +6242,15 @@ PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_tocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_tocsc" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csrtocsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_tocsc" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -6298,7 +6298,7 @@ if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; arg8 = (double*) array_data(temp8); } - csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6,arg7,arg8); + csr_tocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6,arg7,arg8); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -6324,7 +6324,7 @@ } -SWIGINTERN PyObject *_wrap_csrtocsc__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_tocsc__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -6356,15 +6356,15 @@ PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_tocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_tocsc" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csrtocsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_tocsc" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -6412,7 +6412,7 @@ if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; arg8 = (npy_cfloat_wrapper*) array_data(temp8); } - csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,arg6,arg7,arg8); + csr_tocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,arg6,arg7,arg8); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -6438,7 +6438,7 @@ } -SWIGINTERN PyObject *_wrap_csrtocsc__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_tocsc__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -6470,15 +6470,15 @@ PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrtocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_tocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrtocsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_tocsc" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csrtocsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_tocsc" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -6526,7 +6526,7 @@ if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; arg8 = (npy_cdouble_wrapper*) array_data(temp8); } - csrtocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,arg6,arg7,arg8); + csr_tocsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,arg6,arg7,arg8); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -6552,7 +6552,7 @@ } -SWIGINTERN PyObject *_wrap_csrtocsc(PyObject *self, PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_tocsc(PyObject *self, PyObject *args) { int argc; PyObject *argv[9]; int ii; @@ -6598,7 +6598,7 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_csrtocsc__SWIG_1(self, args); + return _wrap_csr_tocsc__SWIG_1(self, args); } } } @@ -6644,7 +6644,7 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_csrtocsc__SWIG_2(self, args); + return _wrap_csr_tocsc__SWIG_2(self, args); } } } @@ -6690,7 +6690,7 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_csrtocsc__SWIG_3(self, args); + return _wrap_csr_tocsc__SWIG_3(self, args); } } } @@ -6736,7 +6736,7 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_csrtocsc__SWIG_4(self, args); + return _wrap_csr_tocsc__SWIG_4(self, args); } } } @@ -6782,7 +6782,7 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_csrtocsc__SWIG_5(self, args); + return _wrap_csr_tocsc__SWIG_5(self, args); } } } @@ -6828,7 +6828,7 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csrtocsc__SWIG_6(self, args); + return _wrap_csr_tocsc__SWIG_6(self, args); } } } @@ -6874,7 +6874,7 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csrtocsc__SWIG_7(self, args); + return _wrap_csr_tocsc__SWIG_7(self, args); } } } @@ -6920,7 +6920,7 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csrtocsc__SWIG_8(self, args); + return _wrap_csr_tocsc__SWIG_8(self, args); } } } @@ -6966,7 +6966,7 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csrtocsc__SWIG_9(self, args); + return _wrap_csr_tocsc__SWIG_9(self, args); } } } @@ -6978,12 +6978,12 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csrtocsc'.\n Possible C/C++ prototypes are:\n"" csrtocsc<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int [],int [],signed char [])\n"" csrtocsc<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" csrtocsc<(int,short)>(int const,int const,int const [],int const [],short const [],int [],int [],short [])\n"" csrtocsc<(int,int)>(int const,int const,int const [],int const [],int const [],int [],int [],int [])\n"" csrtocsc<(int,long long)>(int const,int const,int const [],int const [],long long const [],int [],int [],long long [])\n"" csrtocsc<(int,float)>(int const,int const,int const [],int const [],float const [],int [],int [],float [])\n"" csrtocsc<(int,double)>(int const,int const,int const [],int const [],double const [],int [],int [],double [])\n"" csrtocsc<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" csrtocsc<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_tocsc'.\n Possible C/C++ prototypes are:\n"" csr_tocsc<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int [],int [],signed char [])\n"" csr_tocsc<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" csr_tocsc<(int,short)>(int const,int const,int const [],int const [],short const [],int [],int [],short [])\n"" csr_tocsc<(int,int)>(int const,int const,int const [],int const [],int const [],int [],int [],int [])\n"" csr_tocsc<(int,long long)>(int const,int const,int const [],int const [],long long const [],int [],int [],long long [])\n"" csr_tocsc<(int,float)>(int const,int const,int const [],int const [],float const [],int [],int [],float [])\n"" csr_tocsc<(int,double)>(int const,int const,int const [],int const [],double const [],int [],int [],double [])\n"" csr_tocsc<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" csr_tocsc<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); return NULL; } -SWIGINTERN PyObject *_wrap_csctocsr__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_tocsr__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -7015,15 +7015,15 @@ PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_tocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_tocsr" "', 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 '" "csctocsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_tocsr" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -7071,7 +7071,7 @@ if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; arg8 = (signed char*) array_data(temp8); } - csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6,arg7,arg8); + csc_tocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6,arg7,arg8); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -7097,7 +7097,7 @@ } -SWIGINTERN PyObject *_wrap_csctocsr__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_tocsr__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -7129,15 +7129,15 @@ PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_tocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_tocsr" "', 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 '" "csctocsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_tocsr" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -7185,7 +7185,7 @@ if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; arg8 = (unsigned char*) array_data(temp8); } - csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6,arg7,arg8); + csc_tocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6,arg7,arg8); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -7211,7 +7211,7 @@ } -SWIGINTERN PyObject *_wrap_csctocsr__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_tocsr__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -7243,15 +7243,15 @@ PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_tocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_tocsr" "', 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 '" "csctocsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_tocsr" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -7299,7 +7299,7 @@ if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; arg8 = (short*) array_data(temp8); } - csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6,arg7,arg8); + csc_tocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6,arg7,arg8); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -7325,7 +7325,7 @@ } -SWIGINTERN PyObject *_wrap_csctocsr__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_tocsr__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -7357,15 +7357,15 @@ PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_tocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_tocsr" "', 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 '" "csctocsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_tocsr" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -7413,7 +7413,7 @@ if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; arg8 = (int*) array_data(temp8); } - csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6,arg7,arg8); + csc_tocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6,arg7,arg8); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -7439,7 +7439,7 @@ } -SWIGINTERN PyObject *_wrap_csctocsr__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_tocsr__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -7471,15 +7471,15 @@ PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_tocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_tocsr" "', 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 '" "csctocsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_tocsr" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -7527,7 +7527,7 @@ if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; arg8 = (long long*) array_data(temp8); } - csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,arg6,arg7,arg8); + csc_tocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,arg6,arg7,arg8); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -7553,7 +7553,7 @@ } -SWIGINTERN PyObject *_wrap_csctocsr__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_tocsr__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -7585,15 +7585,15 @@ PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_tocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_tocsr" "', 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 '" "csctocsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_tocsr" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -7641,7 +7641,7 @@ if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; arg8 = (float*) array_data(temp8); } - csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6,arg7,arg8); + csc_tocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6,arg7,arg8); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -7667,7 +7667,7 @@ } -SWIGINTERN PyObject *_wrap_csctocsr__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_tocsr__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -7699,15 +7699,15 @@ PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_tocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_tocsr" "', 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 '" "csctocsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_tocsr" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -7755,7 +7755,7 @@ if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; arg8 = (double*) array_data(temp8); } - csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6,arg7,arg8); + csc_tocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6,arg7,arg8); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -7781,7 +7781,7 @@ } -SWIGINTERN PyObject *_wrap_csctocsr__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_tocsr__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -7813,15 +7813,15 @@ PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_tocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_tocsr" "', 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 '" "csctocsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_tocsr" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -7869,7 +7869,7 @@ if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; arg8 = (npy_cfloat_wrapper*) array_data(temp8); } - csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,arg6,arg7,arg8); + csc_tocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,arg6,arg7,arg8); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -7895,7 +7895,7 @@ } -SWIGINTERN PyObject *_wrap_csctocsr__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_tocsr__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -7927,15 +7927,15 @@ PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csctocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_tocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csctocsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_tocsr" "', 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 '" "csctocsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_tocsr" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -7983,7 +7983,7 @@ if (!temp8 || !require_contiguous(temp8) || !require_native(temp8)) SWIG_fail; arg8 = (npy_cdouble_wrapper*) array_data(temp8); } - csctocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,arg6,arg7,arg8); + csc_tocsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,arg6,arg7,arg8); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -8009,7 +8009,7 @@ } -SWIGINTERN PyObject *_wrap_csctocsr(PyObject *self, PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_tocsr(PyObject *self, PyObject *args) { int argc; PyObject *argv[9]; int ii; @@ -8055,7 +8055,7 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_csctocsr__SWIG_1(self, args); + return _wrap_csc_tocsr__SWIG_1(self, args); } } } @@ -8101,7 +8101,7 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_csctocsr__SWIG_2(self, args); + return _wrap_csc_tocsr__SWIG_2(self, args); } } } @@ -8147,7 +8147,7 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_csctocsr__SWIG_3(self, args); + return _wrap_csc_tocsr__SWIG_3(self, args); } } } @@ -8193,7 +8193,7 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_csctocsr__SWIG_4(self, args); + return _wrap_csc_tocsr__SWIG_4(self, args); } } } @@ -8239,7 +8239,7 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_csctocsr__SWIG_5(self, args); + return _wrap_csc_tocsr__SWIG_5(self, args); } } } @@ -8285,7 +8285,7 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csctocsr__SWIG_6(self, args); + return _wrap_csc_tocsr__SWIG_6(self, args); } } } @@ -8331,7 +8331,7 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csctocsr__SWIG_7(self, args); + return _wrap_csc_tocsr__SWIG_7(self, args); } } } @@ -8377,7 +8377,7 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csctocsr__SWIG_8(self, args); + return _wrap_csc_tocsr__SWIG_8(self, args); } } } @@ -8423,7 +8423,7 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csctocsr__SWIG_9(self, args); + return _wrap_csc_tocsr__SWIG_9(self, args); } } } @@ -8435,7 +8435,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csctocsr'.\n Possible C/C++ prototypes are:\n"" csctocsr<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int [],int [],signed char [])\n"" csctocsr<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" csctocsr<(int,short)>(int const,int const,int const [],int const [],short const [],int [],int [],short [])\n"" csctocsr<(int,int)>(int const,int const,int const [],int const [],int const [],int [],int [],int [])\n"" csctocsr<(int,long long)>(int const,int const,int const [],int const [],long long const [],int [],int [],long long [])\n"" csctocsr<(int,float)>(int const,int const,int const [],int const [],float const [],int [],int [],float [])\n"" csctocsr<(int,double)>(int const,int const,int const [],int const [],double const [],int [],int [],double [])\n"" csctocsr<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" csctocsr<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_tocsr'.\n Possible C/C++ prototypes are:\n"" csc_tocsr<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int [],int [],signed char [])\n"" csc_tocsr<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" csc_tocsr<(int,short)>(int const,int const,int const [],int const [],short const [],int [],int [],short [])\n"" csc_tocsr<(int,int)>(int const,int const,int const [],int const [],int const [],int [],int [],int [])\n"" csc_tocsr<(int,long long)>(int const,int const,int const [],int const [],long long const [],int [],int [],long long [])\n"" csc_tocsr<(int,float)>(int const,int const,int const [],int const [],float const [],int [],int [],float [])\n"" csc_tocsr<(int,double)>(int const,int const,int const [],int const [],double const [],int [],int [],double [])\n"" csc_tocsr<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" csc_tocsr<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); return NULL; } @@ -8489,7 +8489,7 @@ } -SWIGINTERN PyObject *_wrap_cootocsr__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_coo_tocsr__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -8525,20 +8525,20 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:coo_tocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "coo_tocsr" "', 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 '" "cootocsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "coo_tocsr" "', 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 '" "cootocsr" "', argument " "3"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "coo_tocsr" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); { @@ -8586,7 +8586,7 @@ if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; arg9 = (signed char*) array_data(temp9); } - cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(signed char const (*))arg6,arg7,arg8,arg9); + coo_tocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(signed char const (*))arg6,arg7,arg8,arg9); resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); @@ -8612,7 +8612,7 @@ } -SWIGINTERN PyObject *_wrap_cootocsr__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_coo_tocsr__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -8648,20 +8648,20 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:coo_tocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "coo_tocsr" "', 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 '" "cootocsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "coo_tocsr" "', 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 '" "cootocsr" "', argument " "3"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "coo_tocsr" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); { @@ -8709,7 +8709,7 @@ if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; arg9 = (unsigned char*) array_data(temp9); } - cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(unsigned char const (*))arg6,arg7,arg8,arg9); + coo_tocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(unsigned char const (*))arg6,arg7,arg8,arg9); resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); @@ -8735,7 +8735,7 @@ } -SWIGINTERN PyObject *_wrap_cootocsr__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_coo_tocsr__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -8771,20 +8771,20 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:coo_tocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "coo_tocsr" "', 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 '" "cootocsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "coo_tocsr" "', 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 '" "cootocsr" "', argument " "3"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "coo_tocsr" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); { @@ -8832,7 +8832,7 @@ if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; arg9 = (short*) array_data(temp9); } - cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(short const (*))arg6,arg7,arg8,arg9); + coo_tocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(short const (*))arg6,arg7,arg8,arg9); resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); @@ -8858,7 +8858,7 @@ } -SWIGINTERN PyObject *_wrap_cootocsr__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_coo_tocsr__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -8894,20 +8894,20 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:coo_tocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "coo_tocsr" "', 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 '" "cootocsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "coo_tocsr" "', 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 '" "cootocsr" "', argument " "3"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "coo_tocsr" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); { @@ -8955,7 +8955,7 @@ if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; arg9 = (int*) array_data(temp9); } - cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,arg7,arg8,arg9); + coo_tocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,arg7,arg8,arg9); resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); @@ -8981,7 +8981,7 @@ } -SWIGINTERN PyObject *_wrap_cootocsr__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_coo_tocsr__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -9017,20 +9017,20 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:coo_tocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "coo_tocsr" "', 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 '" "cootocsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "coo_tocsr" "', 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 '" "cootocsr" "', argument " "3"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "coo_tocsr" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); { @@ -9078,7 +9078,7 @@ if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; arg9 = (long long*) array_data(temp9); } - cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(long long const (*))arg6,arg7,arg8,arg9); + coo_tocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(long long const (*))arg6,arg7,arg8,arg9); resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); @@ -9104,7 +9104,7 @@ } -SWIGINTERN PyObject *_wrap_cootocsr__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_coo_tocsr__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -9140,20 +9140,20 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:coo_tocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "coo_tocsr" "', 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 '" "cootocsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "coo_tocsr" "', 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 '" "cootocsr" "', argument " "3"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "coo_tocsr" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); { @@ -9201,7 +9201,7 @@ if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; arg9 = (float*) array_data(temp9); } - cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(float const (*))arg6,arg7,arg8,arg9); + coo_tocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(float const (*))arg6,arg7,arg8,arg9); resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); @@ -9227,7 +9227,7 @@ } -SWIGINTERN PyObject *_wrap_cootocsr__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_coo_tocsr__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -9263,20 +9263,20 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:coo_tocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "coo_tocsr" "', 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 '" "cootocsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "coo_tocsr" "', 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 '" "cootocsr" "', argument " "3"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "coo_tocsr" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); { @@ -9324,7 +9324,7 @@ if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; arg9 = (double*) array_data(temp9); } - cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(double const (*))arg6,arg7,arg8,arg9); + coo_tocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(double const (*))arg6,arg7,arg8,arg9); resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); @@ -9350,7 +9350,7 @@ } -SWIGINTERN PyObject *_wrap_cootocsr__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_coo_tocsr__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -9386,20 +9386,20 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:coo_tocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "coo_tocsr" "', 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 '" "cootocsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "coo_tocsr" "', 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 '" "cootocsr" "', argument " "3"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "coo_tocsr" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); { @@ -9447,7 +9447,7 @@ if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; arg9 = (npy_cfloat_wrapper*) array_data(temp9); } - cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(npy_cfloat_wrapper const (*))arg6,arg7,arg8,arg9); + coo_tocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(npy_cfloat_wrapper const (*))arg6,arg7,arg8,arg9); resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); @@ -9473,7 +9473,7 @@ } -SWIGINTERN PyObject *_wrap_cootocsr__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_coo_tocsr__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -9509,20 +9509,20 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:coo_tocsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "coo_tocsr" "', 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 '" "cootocsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "coo_tocsr" "', 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 '" "cootocsr" "', argument " "3"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "coo_tocsr" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); { @@ -9570,7 +9570,7 @@ if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; arg9 = (npy_cdouble_wrapper*) array_data(temp9); } - cootocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(npy_cdouble_wrapper const (*))arg6,arg7,arg8,arg9); + coo_tocsr(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(npy_cdouble_wrapper const (*))arg6,arg7,arg8,arg9); resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); @@ -9596,7 +9596,7 @@ } -SWIGINTERN PyObject *_wrap_cootocsr(PyObject *self, PyObject *args) { +SWIGINTERN PyObject *_wrap_coo_tocsr(PyObject *self, PyObject *args) { int argc; PyObject *argv[10]; int ii; @@ -9647,7 +9647,7 @@ _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_cootocsr__SWIG_1(self, args); + return _wrap_coo_tocsr__SWIG_1(self, args); } } } @@ -9699,7 +9699,7 @@ _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_cootocsr__SWIG_2(self, args); + return _wrap_coo_tocsr__SWIG_2(self, args); } } } @@ -9751,7 +9751,7 @@ _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_cootocsr__SWIG_3(self, args); + return _wrap_coo_tocsr__SWIG_3(self, args); } } } @@ -9803,7 +9803,7 @@ _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_cootocsr__SWIG_4(self, args); + return _wrap_coo_tocsr__SWIG_4(self, args); } } } @@ -9855,7 +9855,7 @@ _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_cootocsr__SWIG_5(self, args); + return _wrap_coo_tocsr__SWIG_5(self, args); } } } @@ -9907,7 +9907,7 @@ _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_cootocsr__SWIG_6(self, args); + return _wrap_coo_tocsr__SWIG_6(self, args); } } } @@ -9959,7 +9959,7 @@ _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_cootocsr__SWIG_7(self, args); + return _wrap_coo_tocsr__SWIG_7(self, args); } } } @@ -10011,7 +10011,7 @@ _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_cootocsr__SWIG_8(self, args); + return _wrap_coo_tocsr__SWIG_8(self, args); } } } @@ -10063,7 +10063,7 @@ _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_cootocsr__SWIG_9(self, args); + return _wrap_coo_tocsr__SWIG_9(self, args); } } } @@ -10076,12 +10076,12 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'cootocsr'.\n Possible C/C++ prototypes are:\n"" cootocsr<(int,signed char)>(int const,int const,int const,int const [],int const [],signed char const [],int [],int [],signed char [])\n"" cootocsr<(int,unsigned char)>(int const,int const,int const,int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" cootocsr<(int,short)>(int const,int const,int const,int const [],int const [],short const [],int [],int [],short [])\n"" cootocsr<(int,int)>(int const,int const,int const,int const [],int const [],int const [],int [],int [],int [])\n"" cootocsr<(int,long long)>(int const,int const,int const,int const [],int const [],long long const [],int [],int [],long long [])\n"" cootocsr<(int,float)>(int const,int const,int const,int const [],int const [],float const [],int [],int [],float [])\n"" cootocsr<(int,double)>(int const,int const,int const,int const [],int const [],double const [],int [],int [],double [])\n"" cootocsr<(int,npy_cfloat_wrapper)>(int const,int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" cootocsr<(int,npy_cdouble_wrapper)>(int const,int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'coo_tocsr'.\n Possible C/C++ prototypes are:\n"" coo_tocsr<(int,signed char)>(int const,int const,int const,int const [],int const [],signed char const [],int [],int [],signed char [])\n"" coo_tocsr<(int,unsigned char)>(int const,int const,int const,int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" coo_tocsr<(int,short)>(int const,int const,int const,int const [],int const [],short const [],int [],int [],short [])\n"" coo_tocsr<(int,int)>(int const,int const,int const,int const [],int const [],int const [],int [],int [],int [])\n"" coo_tocsr<(int,long long)>(int const,int const,int const,int const [],int const [],long long const [],int [],int [],long long [])\n"" coo_tocsr<(int,float)>(int const,int const,int const,int const [],int const [],float const [],int [],int [],float [])\n"" coo_tocsr<(int,double)>(int const,int const,int const,int const [],int const [],double const [],int [],int [],double [])\n"" coo_tocsr<(int,npy_cfloat_wrapper)>(int const,int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" coo_tocsr<(int,npy_cdouble_wrapper)>(int const,int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); return NULL; } -SWIGINTERN PyObject *_wrap_cootocsc__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_coo_tocsc__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -10117,20 +10117,20 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:coo_tocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "coo_tocsc" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cootocsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "coo_tocsc" "', 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 '" "cootocsc" "', argument " "3"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "coo_tocsc" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); { @@ -10178,7 +10178,7 @@ if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; arg9 = (signed char*) array_data(temp9); } - cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(signed char const (*))arg6,arg7,arg8,arg9); + coo_tocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(signed char const (*))arg6,arg7,arg8,arg9); resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); @@ -10204,7 +10204,7 @@ } -SWIGINTERN PyObject *_wrap_cootocsc__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_coo_tocsc__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -10240,20 +10240,20 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:coo_tocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "coo_tocsc" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cootocsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "coo_tocsc" "', 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 '" "cootocsc" "', argument " "3"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "coo_tocsc" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); { @@ -10301,7 +10301,7 @@ if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; arg9 = (unsigned char*) array_data(temp9); } - cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(unsigned char const (*))arg6,arg7,arg8,arg9); + coo_tocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(unsigned char const (*))arg6,arg7,arg8,arg9); resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); @@ -10327,7 +10327,7 @@ } -SWIGINTERN PyObject *_wrap_cootocsc__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_coo_tocsc__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -10363,20 +10363,20 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:coo_tocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "coo_tocsc" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cootocsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "coo_tocsc" "', 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 '" "cootocsc" "', argument " "3"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "coo_tocsc" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); { @@ -10424,7 +10424,7 @@ if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; arg9 = (short*) array_data(temp9); } - cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(short const (*))arg6,arg7,arg8,arg9); + coo_tocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(short const (*))arg6,arg7,arg8,arg9); resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); @@ -10450,7 +10450,7 @@ } -SWIGINTERN PyObject *_wrap_cootocsc__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_coo_tocsc__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -10486,20 +10486,20 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:coo_tocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "coo_tocsc" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cootocsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "coo_tocsc" "', 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 '" "cootocsc" "', argument " "3"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "coo_tocsc" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); { @@ -10547,7 +10547,7 @@ if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; arg9 = (int*) array_data(temp9); } - cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,arg7,arg8,arg9); + coo_tocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,arg7,arg8,arg9); resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); @@ -10573,7 +10573,7 @@ } -SWIGINTERN PyObject *_wrap_cootocsc__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_coo_tocsc__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -10609,20 +10609,20 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:coo_tocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "coo_tocsc" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cootocsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "coo_tocsc" "', 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 '" "cootocsc" "', argument " "3"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "coo_tocsc" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); { @@ -10670,7 +10670,7 @@ if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; arg9 = (long long*) array_data(temp9); } - cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(long long const (*))arg6,arg7,arg8,arg9); + coo_tocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(long long const (*))arg6,arg7,arg8,arg9); resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); @@ -10696,7 +10696,7 @@ } -SWIGINTERN PyObject *_wrap_cootocsc__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_coo_tocsc__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -10732,20 +10732,20 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:coo_tocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "coo_tocsc" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cootocsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "coo_tocsc" "', 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 '" "cootocsc" "', argument " "3"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "coo_tocsc" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); { @@ -10793,7 +10793,7 @@ if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; arg9 = (float*) array_data(temp9); } - cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(float const (*))arg6,arg7,arg8,arg9); + coo_tocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(float const (*))arg6,arg7,arg8,arg9); resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); @@ -10819,7 +10819,7 @@ } -SWIGINTERN PyObject *_wrap_cootocsc__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_coo_tocsc__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -10855,20 +10855,20 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:coo_tocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "coo_tocsc" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cootocsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "coo_tocsc" "', 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 '" "cootocsc" "', argument " "3"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "coo_tocsc" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); { @@ -10916,7 +10916,7 @@ if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; arg9 = (double*) array_data(temp9); } - cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(double const (*))arg6,arg7,arg8,arg9); + coo_tocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(double const (*))arg6,arg7,arg8,arg9); resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); @@ -10942,7 +10942,7 @@ } -SWIGINTERN PyObject *_wrap_cootocsc__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_coo_tocsc__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -10978,20 +10978,20 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:coo_tocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "coo_tocsc" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cootocsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "coo_tocsc" "', 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 '" "cootocsc" "', argument " "3"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "coo_tocsc" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); { @@ -11039,7 +11039,7 @@ if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; arg9 = (npy_cfloat_wrapper*) array_data(temp9); } - cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(npy_cfloat_wrapper const (*))arg6,arg7,arg8,arg9); + coo_tocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(npy_cfloat_wrapper const (*))arg6,arg7,arg8,arg9); resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); @@ -11065,7 +11065,7 @@ } -SWIGINTERN PyObject *_wrap_cootocsc__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_coo_tocsc__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -11101,20 +11101,20 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:cootocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:coo_tocsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cootocsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "coo_tocsc" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cootocsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "coo_tocsc" "', 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 '" "cootocsc" "', argument " "3"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "coo_tocsc" "', argument " "3"" of type '" "int""'"); } arg3 = static_cast< int >(val3); { @@ -11162,7 +11162,7 @@ if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; arg9 = (npy_cdouble_wrapper*) array_data(temp9); } - cootocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(npy_cdouble_wrapper const (*))arg6,arg7,arg8,arg9); + coo_tocsc(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,(npy_cdouble_wrapper const (*))arg6,arg7,arg8,arg9); resultobj = SWIG_Py_Void(); { if (is_new_object4 && array4) Py_DECREF(array4); @@ -11188,7 +11188,7 @@ } -SWIGINTERN PyObject *_wrap_cootocsc(PyObject *self, PyObject *args) { +SWIGINTERN PyObject *_wrap_coo_tocsc(PyObject *self, PyObject *args) { int argc; PyObject *argv[10]; int ii; @@ -11239,7 +11239,7 @@ _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_cootocsc__SWIG_1(self, args); + return _wrap_coo_tocsc__SWIG_1(self, args); } } } @@ -11291,7 +11291,7 @@ _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_cootocsc__SWIG_2(self, args); + return _wrap_coo_tocsc__SWIG_2(self, args); } } } @@ -11343,7 +11343,7 @@ _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_cootocsc__SWIG_3(self, args); + return _wrap_coo_tocsc__SWIG_3(self, args); } } } @@ -11395,7 +11395,7 @@ _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_cootocsc__SWIG_4(self, args); + return _wrap_coo_tocsc__SWIG_4(self, args); } } } @@ -11447,7 +11447,7 @@ _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_cootocsc__SWIG_5(self, args); + return _wrap_coo_tocsc__SWIG_5(self, args); } } } @@ -11499,7 +11499,7 @@ _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_cootocsc__SWIG_6(self, args); + return _wrap_coo_tocsc__SWIG_6(self, args); } } } @@ -11551,7 +11551,7 @@ _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_cootocsc__SWIG_7(self, args); + return _wrap_coo_tocsc__SWIG_7(self, args); } } } @@ -11603,7 +11603,7 @@ _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_cootocsc__SWIG_8(self, args); + return _wrap_coo_tocsc__SWIG_8(self, args); } } } @@ -11655,7 +11655,7 @@ _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_cootocsc__SWIG_9(self, args); + return _wrap_coo_tocsc__SWIG_9(self, args); } } } @@ -11668,24 +11668,260 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'cootocsc'.\n Possible C/C++ prototypes are:\n"" cootocsc<(int,signed char)>(int const,int const,int const,int const [],int const [],signed char const [],int [],int [],signed char [])\n"" cootocsc<(int,unsigned char)>(int const,int const,int const,int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" cootocsc<(int,short)>(int const,int const,int const,int const [],int const [],short const [],int [],int [],short [])\n"" cootocsc<(int,int)>(int const,int const,int const,int const [],int const [],int const [],int [],int [],int [])\n"" cootocsc<(int,long long)>(int const,int const,int const,int const [],int const [],long long const [],int [],int [],long long [])\n"" cootocsc<(int,float)>(int const,int const,int const,int const [],int const [],float const [],int [],int [],float [])\n"" cootocsc<(int,double)>(int const,int const,int const,int const [],int const [],double const [],int [],int [],double [])\n"" cootocsc<(int,npy_cfloat_wrapper)>(int const,int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" cootocsc<(int,npy_cdouble_wrapper)>(int const,int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'coo_tocsc'.\n Possible C/C++ prototypes are:\n"" coo_tocsc<(int,signed char)>(int const,int const,int const,int const [],int const [],signed char const [],int [],int [],signed char [])\n"" coo_tocsc<(int,unsigned char)>(int const,int const,int const,int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" coo_tocsc<(int,short)>(int const,int const,int const,int const [],int const [],short const [],int [],int [],short [])\n"" coo_tocsc<(int,int)>(int const,int const,int const,int const [],int const [],int const [],int [],int [],int [])\n"" coo_tocsc<(int,long long)>(int const,int const,int const,int const [],int const [],long long const [],int [],int [],long long [])\n"" coo_tocsc<(int,float)>(int const,int const,int const,int const [],int const [],float const [],int [],int [],float [])\n"" coo_tocsc<(int,double)>(int const,int const,int const,int const [],int const [],double const [],int [],int [],double [])\n"" coo_tocsc<(int,npy_cfloat_wrapper)>(int const,int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" coo_tocsc<(int,npy_cdouble_wrapper)>(int const,int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); return NULL; } -SWIGINTERN PyObject *_wrap_csrmucsr__SWIG_1(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 *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 ; + 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 *)"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_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_matmat_pass1" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + { + npy_intp size[1] = { + -1 + }; + array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); + if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) + || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; + + arg3 = (int*) array3->data; + } + { + npy_intp size[1] = { + -1 + }; + array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); + if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) + || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; + + arg4 = (int*) array4->data; + } + { + npy_intp size[1] = { + -1 + }; + array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_INT, &is_new_object5); + if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) + || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + 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(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); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + 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); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_csc_matmat_pass1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + 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 ; + 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 *)"OOOOOOO:csc_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 '" "csc_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 '" "csc_matmat_pass1" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + { + npy_intp size[1] = { + -1 + }; + array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); + if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) + || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; + + arg3 = (int*) array3->data; + } + { + npy_intp size[1] = { + -1 + }; + array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); + if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) + || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; + + arg4 = (int*) array4->data; + } + { + npy_intp size[1] = { + -1 + }; + array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_INT, &is_new_object5); + if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) + || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + temp7 = obj_to_array_no_conversion(obj6,PyArray_INT); + if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; + arg7 = (int*) array_data(temp7); + } + csc_matmat_pass1(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); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + 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); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_csr_matmat_pass2__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int *arg3 ; + int *arg4 ; signed char *arg5 ; int *arg6 ; int *arg7 ; signed char *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + signed char *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -11702,9 +11938,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -11713,28 +11949,19 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrmucsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrmucsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_matmat_pass2" "', 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 '" "csrmucsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_matmat_pass2" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -11797,29 +12024,23 @@ arg8 = (signed char*) array8->data; } - csrmucsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(signed char const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(signed char)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_BYTE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (signed char*) array_data(temp11); } + csr_matmat_pass2(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(signed char const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -11862,7 +12083,7 @@ } -SWIGINTERN PyObject *_wrap_csrmucsr__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_matmat_pass2__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -11872,9 +12093,9 @@ int *arg6 ; int *arg7 ; unsigned char *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + unsigned char *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -11891,9 +12112,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -11902,28 +12123,19 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrmucsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrmucsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_matmat_pass2" "', 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 '" "csrmucsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_matmat_pass2" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -11986,29 +12198,23 @@ arg8 = (unsigned char*) array8->data; } - csrmucsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(unsigned char const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(unsigned char)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_UBYTE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (unsigned char*) array_data(temp11); } + csr_matmat_pass2(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(unsigned char const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -12051,7 +12257,7 @@ } -SWIGINTERN PyObject *_wrap_csrmucsr__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_matmat_pass2__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -12061,9 +12267,9 @@ int *arg6 ; int *arg7 ; short *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + short *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -12080,9 +12286,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -12091,28 +12297,19 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrmucsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrmucsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_matmat_pass2" "', 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 '" "csrmucsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_matmat_pass2" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -12175,29 +12372,23 @@ arg8 = (short*) array8->data; } - csrmucsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,(int const (*))arg6,(int const (*))arg7,(short const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(short)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_SHORT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (short*) array_data(temp11); } + csr_matmat_pass2(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,(int const (*))arg6,(int const (*))arg7,(short const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -12240,7 +12431,7 @@ } -SWIGINTERN PyObject *_wrap_csrmucsr__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_matmat_pass2__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -12250,9 +12441,9 @@ int *arg6 ; int *arg7 ; int *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + int *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -12269,9 +12460,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -12280,28 +12471,19 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrmucsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrmucsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_matmat_pass2" "', 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 '" "csrmucsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_matmat_pass2" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -12364,29 +12546,23 @@ arg8 = (int*) array8->data; } - csrmucsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } + csr_matmat_pass2(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -12429,7 +12605,7 @@ } -SWIGINTERN PyObject *_wrap_csrmucsr__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_matmat_pass2__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -12439,9 +12615,9 @@ int *arg6 ; int *arg7 ; long long *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + long long *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -12458,9 +12634,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -12469,28 +12645,19 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrmucsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrmucsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_matmat_pass2" "', 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 '" "csrmucsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_matmat_pass2" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -12553,29 +12720,23 @@ arg8 = (long long*) array8->data; } - csrmucsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,(int const (*))arg6,(int const (*))arg7,(long long const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(long long)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_LONGLONG); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (long long*) array_data(temp11); } + csr_matmat_pass2(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,(int const (*))arg6,(int const (*))arg7,(long long const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -12618,7 +12779,7 @@ } -SWIGINTERN PyObject *_wrap_csrmucsr__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_matmat_pass2__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -12628,9 +12789,9 @@ int *arg6 ; int *arg7 ; float *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + float *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -12647,9 +12808,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -12658,28 +12819,19 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrmucsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrmucsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_matmat_pass2" "', 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 '" "csrmucsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_matmat_pass2" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -12742,29 +12894,23 @@ arg8 = (float*) array8->data; } - csrmucsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(int const (*))arg6,(int const (*))arg7,(float const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(float)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_FLOAT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (float*) array_data(temp11); } + csr_matmat_pass2(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(int const (*))arg6,(int const (*))arg7,(float const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -12807,7 +12953,7 @@ } -SWIGINTERN PyObject *_wrap_csrmucsr__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_matmat_pass2__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -12817,9 +12963,9 @@ int *arg6 ; int *arg7 ; double *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + double *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -12836,9 +12982,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -12847,28 +12993,19 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrmucsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrmucsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_matmat_pass2" "', 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 '" "csrmucsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_matmat_pass2" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -12931,29 +13068,23 @@ arg8 = (double*) array8->data; } - csrmucsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(int const (*))arg6,(int const (*))arg7,(double const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(double)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_DOUBLE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (double*) array_data(temp11); } + csr_matmat_pass2(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(int const (*))arg6,(int const (*))arg7,(double const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -12996,7 +13127,7 @@ } -SWIGINTERN PyObject *_wrap_csrmucsr__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_matmat_pass2__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -13006,9 +13137,9 @@ int *arg6 ; int *arg7 ; npy_cfloat_wrapper *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + npy_cfloat_wrapper *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -13025,9 +13156,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -13036,28 +13167,19 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrmucsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrmucsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_matmat_pass2" "', 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 '" "csrmucsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_matmat_pass2" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -13120,29 +13242,23 @@ arg8 = (npy_cfloat_wrapper*) array8->data; } - csrmucsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cfloat_wrapper const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(npy_cfloat_wrapper)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_CFLOAT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (npy_cfloat_wrapper*) array_data(temp11); } + csr_matmat_pass2(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cfloat_wrapper const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -13185,7 +13301,7 @@ } -SWIGINTERN PyObject *_wrap_csrmucsr__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_matmat_pass2__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -13195,9 +13311,9 @@ int *arg6 ; int *arg7 ; npy_cdouble_wrapper *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + npy_cdouble_wrapper *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -13214,9 +13330,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -13225,28 +13341,19 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csrmucsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csrmucsr" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_matmat_pass2" "', 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 '" "csrmucsr" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_matmat_pass2" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -13309,29 +13416,23 @@ arg8 = (npy_cdouble_wrapper*) array8->data; } - csrmucsr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cdouble_wrapper const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(npy_cdouble_wrapper)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_CDOUBLE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (npy_cdouble_wrapper*) array_data(temp11); } + csr_matmat_pass2(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cdouble_wrapper const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -13374,17 +13475,17 @@ } -SWIGINTERN PyObject *_wrap_csrmucsr(PyObject *self, PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_matmat_pass2(PyObject *self, PyObject *args) { int argc; - PyObject *argv[9]; + PyObject *argv[12]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 8); ii++) { + for (ii = 0; (ii < argc) && (ii < 11); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -13420,7 +13521,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_csrmucsr__SWIG_1(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_matmat_pass2__SWIG_1(self, args); + } + } + } } } } @@ -13430,7 +13546,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -13466,7 +13582,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_csrmucsr__SWIG_2(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_matmat_pass2__SWIG_2(self, args); + } + } + } } } } @@ -13476,7 +13607,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -13512,7 +13643,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_csrmucsr__SWIG_3(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_matmat_pass2__SWIG_3(self, args); + } + } + } } } } @@ -13522,7 +13668,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -13558,7 +13704,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_csrmucsr__SWIG_4(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_matmat_pass2__SWIG_4(self, args); + } + } + } } } } @@ -13568,7 +13729,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -13604,7 +13765,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_csrmucsr__SWIG_5(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_matmat_pass2__SWIG_5(self, args); + } + } + } } } } @@ -13614,7 +13790,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -13650,7 +13826,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csrmucsr__SWIG_6(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_matmat_pass2__SWIG_6(self, args); + } + } + } } } } @@ -13660,7 +13851,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -13696,7 +13887,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csrmucsr__SWIG_7(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_matmat_pass2__SWIG_7(self, args); + } + } + } } } } @@ -13706,7 +13912,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -13742,7 +13948,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csrmucsr__SWIG_8(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_matmat_pass2__SWIG_8(self, args); + } + } + } } } } @@ -13752,7 +13973,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -13788,7 +14009,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csrmucsr__SWIG_9(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_matmat_pass2__SWIG_9(self, args); + } + } + } } } } @@ -13800,12 +14036,12 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csrmucsr'.\n Possible C/C++ prototypes are:\n"" csrmucsr<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],std::vector *,std::vector *,std::vector *)\n"" csrmucsr<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],std::vector *,std::vector *,std::vector *)\n"" csrmucsr<(int,short)>(int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],std::vector *,std::vector *,std::vector *)\n"" csrmucsr<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],std::vector *,std::vector *,std::vector *)\n"" csrmucsr<(int,long long)>(int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],std::vector *,std::vector *,std::vector *)\n"" csrmucsr<(int,float)>(int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" csrmucsr<(int,double)>(int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"" csrmucsr<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],std::vector *,std::vector *,std::vector *)\n"" csrmucsr<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],std::vector *,std::vector *,std::vector *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_matmat_pass2'.\n Possible C/C++ prototypes are:\n"" csr_matmat_pass2<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],int [],int [],signed char [])\n"" csr_matmat_pass2<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" csr_matmat_pass2<(int,short)>(int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],int [],int [],short [])\n"" csr_matmat_pass2<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],int [],int [],int [])\n"" csr_matmat_pass2<(int,long long)>(int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],int [],int [],long long [])\n"" csr_matmat_pass2<(int,float)>(int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],int [],int [],float [])\n"" csr_matmat_pass2<(int,double)>(int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],int [],int [],double [])\n"" csr_matmat_pass2<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" csr_matmat_pass2<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); return NULL; } -SWIGINTERN PyObject *_wrap_cscmucsc__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_matmat_pass2__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -13815,9 +14051,9 @@ int *arg6 ; int *arg7 ; signed char *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + signed char *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -13834,9 +14070,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -13845,28 +14081,19 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:cscmucsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cscmucsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_matmat_pass2" "', 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 '" "cscmucsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_matmat_pass2" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -13929,29 +14156,23 @@ arg8 = (signed char*) array8->data; } - cscmucsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(signed char const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(signed char)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_BYTE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (signed char*) array_data(temp11); } + csc_matmat_pass2(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(signed char const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -13994,7 +14215,7 @@ } -SWIGINTERN PyObject *_wrap_cscmucsc__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_matmat_pass2__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -14004,9 +14225,9 @@ int *arg6 ; int *arg7 ; unsigned char *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + unsigned char *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -14023,9 +14244,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -14034,28 +14255,19 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:cscmucsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cscmucsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_matmat_pass2" "', 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 '" "cscmucsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_matmat_pass2" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -14118,29 +14330,23 @@ arg8 = (unsigned char*) array8->data; } - cscmucsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(unsigned char const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(unsigned char)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_UBYTE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (unsigned char*) array_data(temp11); } + csc_matmat_pass2(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(unsigned char const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -14183,7 +14389,7 @@ } -SWIGINTERN PyObject *_wrap_cscmucsc__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_matmat_pass2__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -14193,9 +14399,9 @@ int *arg6 ; int *arg7 ; short *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + short *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -14212,9 +14418,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -14223,28 +14429,19 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:cscmucsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cscmucsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_matmat_pass2" "', 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 '" "cscmucsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_matmat_pass2" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -14307,29 +14504,23 @@ arg8 = (short*) array8->data; } - cscmucsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,(int const (*))arg6,(int const (*))arg7,(short const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(short)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_SHORT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (short*) array_data(temp11); } + csc_matmat_pass2(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,(int const (*))arg6,(int const (*))arg7,(short const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -14372,7 +14563,7 @@ } -SWIGINTERN PyObject *_wrap_cscmucsc__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_matmat_pass2__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -14382,9 +14573,9 @@ int *arg6 ; int *arg7 ; int *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + int *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -14401,9 +14592,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -14412,28 +14603,19 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:cscmucsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cscmucsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_matmat_pass2" "', 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 '" "cscmucsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_matmat_pass2" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -14496,29 +14678,23 @@ arg8 = (int*) array8->data; } - cscmucsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } + csc_matmat_pass2(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -14561,7 +14737,7 @@ } -SWIGINTERN PyObject *_wrap_cscmucsc__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_matmat_pass2__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -14571,9 +14747,9 @@ int *arg6 ; int *arg7 ; long long *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + long long *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -14590,9 +14766,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -14601,28 +14777,19 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:cscmucsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cscmucsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_matmat_pass2" "', 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 '" "cscmucsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_matmat_pass2" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -14685,29 +14852,23 @@ arg8 = (long long*) array8->data; } - cscmucsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,(int const (*))arg6,(int const (*))arg7,(long long const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(long long)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_LONGLONG); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (long long*) array_data(temp11); } + csc_matmat_pass2(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,(int const (*))arg6,(int const (*))arg7,(long long const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -14750,7 +14911,7 @@ } -SWIGINTERN PyObject *_wrap_cscmucsc__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_matmat_pass2__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -14760,9 +14921,9 @@ int *arg6 ; int *arg7 ; float *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + float *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -14779,9 +14940,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -14790,28 +14951,19 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:cscmucsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cscmucsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_matmat_pass2" "', 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 '" "cscmucsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_matmat_pass2" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -14874,29 +15026,23 @@ arg8 = (float*) array8->data; } - cscmucsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(int const (*))arg6,(int const (*))arg7,(float const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(float)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_FLOAT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (float*) array_data(temp11); } + csc_matmat_pass2(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(int const (*))arg6,(int const (*))arg7,(float const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -14939,7 +15085,7 @@ } -SWIGINTERN PyObject *_wrap_cscmucsc__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_matmat_pass2__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -14949,9 +15095,9 @@ int *arg6 ; int *arg7 ; double *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + double *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -14968,9 +15114,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -14979,28 +15125,19 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:cscmucsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cscmucsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_matmat_pass2" "', 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 '" "cscmucsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_matmat_pass2" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -15063,29 +15200,23 @@ arg8 = (double*) array8->data; } - cscmucsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(int const (*))arg6,(int const (*))arg7,(double const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(double)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_DOUBLE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (double*) array_data(temp11); } + csc_matmat_pass2(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(int const (*))arg6,(int const (*))arg7,(double const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -15128,7 +15259,7 @@ } -SWIGINTERN PyObject *_wrap_cscmucsc__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_matmat_pass2__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -15138,9 +15269,9 @@ int *arg6 ; int *arg7 ; npy_cfloat_wrapper *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + npy_cfloat_wrapper *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -15157,9 +15288,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -15168,28 +15299,19 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:cscmucsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cscmucsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_matmat_pass2" "', 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 '" "cscmucsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_matmat_pass2" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -15252,29 +15374,23 @@ arg8 = (npy_cfloat_wrapper*) array8->data; } - cscmucsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cfloat_wrapper const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(npy_cfloat_wrapper)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_CFLOAT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (npy_cfloat_wrapper*) array_data(temp11); } + csc_matmat_pass2(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cfloat_wrapper const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -15317,7 +15433,7 @@ } -SWIGINTERN PyObject *_wrap_cscmucsc__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_matmat_pass2__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -15327,9 +15443,9 @@ int *arg6 ; int *arg7 ; npy_cdouble_wrapper *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + npy_cdouble_wrapper *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -15346,9 +15462,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -15357,28 +15473,19 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:cscmucsc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cscmucsc" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_matmat_pass2" "', 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 '" "cscmucsc" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_matmat_pass2" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -15441,29 +15548,23 @@ arg8 = (npy_cdouble_wrapper*) array8->data; } - cscmucsc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cdouble_wrapper const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(npy_cdouble_wrapper)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_CDOUBLE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (npy_cdouble_wrapper*) array_data(temp11); } + csc_matmat_pass2(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cdouble_wrapper const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -15506,17 +15607,17 @@ } -SWIGINTERN PyObject *_wrap_cscmucsc(PyObject *self, PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_matmat_pass2(PyObject *self, PyObject *args) { int argc; - PyObject *argv[9]; + PyObject *argv[12]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 8); ii++) { + for (ii = 0; (ii < argc) && (ii < 11); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -15552,7 +15653,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_cscmucsc__SWIG_1(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_matmat_pass2__SWIG_1(self, args); + } + } + } } } } @@ -15562,7 +15678,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -15598,7 +15714,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_cscmucsc__SWIG_2(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_matmat_pass2__SWIG_2(self, args); + } + } + } } } } @@ -15608,7 +15739,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -15644,7 +15775,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_cscmucsc__SWIG_3(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_matmat_pass2__SWIG_3(self, args); + } + } + } } } } @@ -15654,7 +15800,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -15690,7 +15836,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_cscmucsc__SWIG_4(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_matmat_pass2__SWIG_4(self, args); + } + } + } } } } @@ -15700,7 +15861,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -15736,7 +15897,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_cscmucsc__SWIG_5(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_matmat_pass2__SWIG_5(self, args); + } + } + } } } } @@ -15746,7 +15922,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -15782,7 +15958,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_cscmucsc__SWIG_6(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_matmat_pass2__SWIG_6(self, args); + } + } + } } } } @@ -15792,7 +15983,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -15828,7 +16019,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_cscmucsc__SWIG_7(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_matmat_pass2__SWIG_7(self, args); + } + } + } } } } @@ -15838,7 +16044,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -15874,7 +16080,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_cscmucsc__SWIG_8(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_matmat_pass2__SWIG_8(self, args); + } + } + } } } } @@ -15884,7 +16105,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -15920,7 +16141,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_cscmucsc__SWIG_9(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_matmat_pass2__SWIG_9(self, args); + } + } + } } } } @@ -15932,12 +16168,12 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'cscmucsc'.\n Possible C/C++ prototypes are:\n"" cscmucsc<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],std::vector *,std::vector *,std::vector *)\n"" cscmucsc<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],std::vector *,std::vector *,std::vector *)\n"" cscmucsc<(int,short)>(int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],std::vector *,std::vector *,std::vector *)\n"" cscmucsc<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],std::vector *,std::vector *,std::vector *)\n"" cscmucsc<(int,long long)>(int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],std::vector *,std::vector *,std::vector *)\n"" cscmucsc<(int,float)>(int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" cscmucsc<(int,double)>(int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"" cscmucsc<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],std::vector *,std::vector *,std::vector *)\n"" cscmucsc<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],std::vector *,std::vector *,std::vector *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_matmat_pass2'.\n Possible C/C++ prototypes are:\n"" csc_matmat_pass2<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],int [],int [],signed char [])\n"" csc_matmat_pass2<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" csc_matmat_pass2<(int,short)>(int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],int [],int [],short [])\n"" csc_matmat_pass2<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],int [],int [],int [])\n"" csc_matmat_pass2<(int,long long)>(int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],int [],int [],long long [])\n"" csc_matmat_pass2<(int,float)>(int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],int [],int [],float [])\n"" csc_matmat_pass2<(int,double)>(int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],int [],int [],double [])\n"" csc_matmat_pass2<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" csc_matmat_pass2<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); return NULL; } -SWIGINTERN PyObject *_wrap_csrmux__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_matvec__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -15967,15 +16203,15 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csrmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csr_matvec",&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 '" "csrmux" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_matvec" "', 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 '" "csrmux" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_matvec" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -16023,7 +16259,7 @@ if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; arg7 = (signed char*) array_data(temp7); } - csrmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,(signed char const (*))arg6,arg7); + csr_matvec(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,(signed char const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -16055,7 +16291,7 @@ } -SWIGINTERN PyObject *_wrap_csrmux__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_matvec__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -16085,15 +16321,15 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csrmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csr_matvec",&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 '" "csrmux" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_matvec" "', 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 '" "csrmux" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_matvec" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -16141,7 +16377,7 @@ if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; arg7 = (unsigned char*) array_data(temp7); } - csrmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,(unsigned char const (*))arg6,arg7); + csr_matvec(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,(unsigned char const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -16173,7 +16409,7 @@ } -SWIGINTERN PyObject *_wrap_csrmux__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_matvec__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -16203,15 +16439,15 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csrmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csr_matvec",&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 '" "csrmux" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_matvec" "', 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 '" "csrmux" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_matvec" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -16259,7 +16495,7 @@ if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; arg7 = (short*) array_data(temp7); } - csrmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,(short const (*))arg6,arg7); + csr_matvec(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,(short const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -16291,7 +16527,7 @@ } -SWIGINTERN PyObject *_wrap_csrmux__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_matvec__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -16321,15 +16557,15 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csrmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csr_matvec",&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 '" "csrmux" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_matvec" "', 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 '" "csrmux" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_matvec" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -16377,7 +16613,7 @@ if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; arg7 = (int*) array_data(temp7); } - csrmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,arg7); + csr_matvec(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); @@ -16409,7 +16645,7 @@ } -SWIGINTERN PyObject *_wrap_csrmux__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_matvec__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -16439,15 +16675,15 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csrmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csr_matvec",&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 '" "csrmux" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_matvec" "', 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 '" "csrmux" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_matvec" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -16495,7 +16731,7 @@ if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; arg7 = (long long*) array_data(temp7); } - csrmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,(long long const (*))arg6,arg7); + csr_matvec(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,(long long const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -16527,7 +16763,7 @@ } -SWIGINTERN PyObject *_wrap_csrmux__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_matvec__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -16557,15 +16793,15 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csrmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csr_matvec",&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 '" "csrmux" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_matvec" "', 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 '" "csrmux" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_matvec" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -16613,7 +16849,7 @@ if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; arg7 = (float*) array_data(temp7); } - csrmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(float const (*))arg6,arg7); + csr_matvec(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(float const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -16645,7 +16881,7 @@ } -SWIGINTERN PyObject *_wrap_csrmux__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_matvec__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -16675,15 +16911,15 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csrmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csr_matvec",&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 '" "csrmux" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_matvec" "', 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 '" "csrmux" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_matvec" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -16731,7 +16967,7 @@ if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; arg7 = (double*) array_data(temp7); } - csrmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(double const (*))arg6,arg7); + csr_matvec(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(double const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -16763,7 +16999,7 @@ } -SWIGINTERN PyObject *_wrap_csrmux__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_matvec__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -16793,15 +17029,15 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csrmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csr_matvec",&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 '" "csrmux" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_matvec" "', 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 '" "csrmux" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_matvec" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -16849,7 +17085,7 @@ if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; arg7 = (npy_cfloat_wrapper*) array_data(temp7); } - csrmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,(npy_cfloat_wrapper const (*))arg6,arg7); + csr_matvec(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,(npy_cfloat_wrapper const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -16881,7 +17117,7 @@ } -SWIGINTERN PyObject *_wrap_csrmux__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_matvec__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -16911,15 +17147,15 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csrmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csr_matvec",&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 '" "csrmux" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_matvec" "', 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 '" "csrmux" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_matvec" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -16967,7 +17203,7 @@ if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; arg7 = (npy_cdouble_wrapper*) array_data(temp7); } - csrmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,(npy_cdouble_wrapper const (*))arg6,arg7); + csr_matvec(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,(npy_cdouble_wrapper const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -16999,7 +17235,7 @@ } -SWIGINTERN PyObject *_wrap_csrmux(PyObject *self, PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_matvec(PyObject *self, PyObject *args) { int argc; PyObject *argv[8]; int ii; @@ -17041,7 +17277,7 @@ _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_csrmux__SWIG_1(self, args); + return _wrap_csr_matvec__SWIG_1(self, args); } } } @@ -17082,7 +17318,7 @@ _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_csrmux__SWIG_2(self, args); + return _wrap_csr_matvec__SWIG_2(self, args); } } } @@ -17123,7 +17359,7 @@ _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_csrmux__SWIG_3(self, args); + return _wrap_csr_matvec__SWIG_3(self, args); } } } @@ -17164,7 +17400,7 @@ _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_csrmux__SWIG_4(self, args); + return _wrap_csr_matvec__SWIG_4(self, args); } } } @@ -17205,7 +17441,7 @@ _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_csrmux__SWIG_5(self, args); + return _wrap_csr_matvec__SWIG_5(self, args); } } } @@ -17246,7 +17482,7 @@ _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csrmux__SWIG_6(self, args); + return _wrap_csr_matvec__SWIG_6(self, args); } } } @@ -17287,7 +17523,7 @@ _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csrmux__SWIG_7(self, args); + return _wrap_csr_matvec__SWIG_7(self, args); } } } @@ -17328,7 +17564,7 @@ _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csrmux__SWIG_8(self, args); + return _wrap_csr_matvec__SWIG_8(self, args); } } } @@ -17369,7 +17605,7 @@ _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csrmux__SWIG_9(self, args); + return _wrap_csr_matvec__SWIG_9(self, args); } } } @@ -17380,12 +17616,12 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csrmux'.\n Possible C/C++ prototypes are:\n"" csrmux<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],signed char const [],signed char [])\n"" csrmux<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],unsigned char const [],unsigned char [])\n"" csrmux<(int,short)>(int const,int const,int const [],int const [],short const [],short const [],short [])\n"" csrmux<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],int [])\n"" csrmux<(int,long long)>(int const,int const,int const [],int const [],long long const [],long long const [],long long [])\n"" csrmux<(int,float)>(int const,int const,int const [],int const [],float const [],float const [],float [])\n"" csrmux<(int,double)>(int const,int const,int const [],int const [],double const [],double const [],double [])\n"" csrmux<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper [])\n"" csrmux<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper [])\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_matvec'.\n Possible C/C++ prototypes are:\n"" csr_matvec<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],signed char const [],signed char [])\n"" csr_matvec<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],unsigned char const [],unsigned char [])\n"" csr_matvec<(int,short)>(int const,int const,int const [],int const [],short const [],short const [],short [])\n"" csr_matvec<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],int [])\n"" csr_matvec<(int,long long)>(int const,int const,int const [],int const [],long long const [],long long const [],long long [])\n"" csr_matvec<(int,float)>(int const,int const,int const [],int const [],float const [],float const [],float [])\n"" csr_matvec<(int,double)>(int const,int const,int const [],int const [],double const [],double const [],double [])\n"" csr_matvec<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper [])\n"" csr_matvec<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper [])\n"); return NULL; } -SWIGINTERN PyObject *_wrap_cscmux__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_matvec__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -17415,15 +17651,15 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:cscmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csc_matvec",&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 '" "cscmux" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_matvec" "', 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 '" "cscmux" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_matvec" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -17471,7 +17707,7 @@ if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; arg7 = (signed char*) array_data(temp7); } - cscmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,(signed char const (*))arg6,arg7); + csc_matvec(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,(signed char const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -17503,7 +17739,7 @@ } -SWIGINTERN PyObject *_wrap_cscmux__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_matvec__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -17533,15 +17769,15 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:cscmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csc_matvec",&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 '" "cscmux" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_matvec" "', 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 '" "cscmux" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_matvec" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -17589,7 +17825,7 @@ if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; arg7 = (unsigned char*) array_data(temp7); } - cscmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,(unsigned char const (*))arg6,arg7); + csc_matvec(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,(unsigned char const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -17621,7 +17857,7 @@ } -SWIGINTERN PyObject *_wrap_cscmux__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_matvec__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -17651,15 +17887,15 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:cscmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csc_matvec",&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 '" "cscmux" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_matvec" "', 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 '" "cscmux" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_matvec" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -17707,7 +17943,7 @@ if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; arg7 = (short*) array_data(temp7); } - cscmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,(short const (*))arg6,arg7); + csc_matvec(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,(short const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -17739,7 +17975,7 @@ } -SWIGINTERN PyObject *_wrap_cscmux__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_matvec__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -17769,15 +18005,15 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:cscmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csc_matvec",&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 '" "cscmux" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_matvec" "', 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 '" "cscmux" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_matvec" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -17825,7 +18061,7 @@ if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; arg7 = (int*) array_data(temp7); } - cscmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,arg7); + csc_matvec(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); @@ -17857,7 +18093,7 @@ } -SWIGINTERN PyObject *_wrap_cscmux__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_matvec__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -17887,15 +18123,15 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:cscmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csc_matvec",&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 '" "cscmux" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_matvec" "', 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 '" "cscmux" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_matvec" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -17943,7 +18179,7 @@ if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; arg7 = (long long*) array_data(temp7); } - cscmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,(long long const (*))arg6,arg7); + csc_matvec(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,(long long const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -17975,7 +18211,7 @@ } -SWIGINTERN PyObject *_wrap_cscmux__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_matvec__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -18005,15 +18241,15 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:cscmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csc_matvec",&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 '" "cscmux" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_matvec" "', 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 '" "cscmux" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_matvec" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -18061,7 +18297,7 @@ if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; arg7 = (float*) array_data(temp7); } - cscmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(float const (*))arg6,arg7); + csc_matvec(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(float const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -18093,7 +18329,7 @@ } -SWIGINTERN PyObject *_wrap_cscmux__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_matvec__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -18123,15 +18359,15 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:cscmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csc_matvec",&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 '" "cscmux" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_matvec" "', 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 '" "cscmux" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_matvec" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -18179,7 +18415,7 @@ if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; arg7 = (double*) array_data(temp7); } - cscmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(double const (*))arg6,arg7); + csc_matvec(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(double const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -18211,7 +18447,7 @@ } -SWIGINTERN PyObject *_wrap_cscmux__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_matvec__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -18241,15 +18477,15 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:cscmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csc_matvec",&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 '" "cscmux" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_matvec" "', 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 '" "cscmux" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_matvec" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -18297,7 +18533,7 @@ if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; arg7 = (npy_cfloat_wrapper*) array_data(temp7); } - cscmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,(npy_cfloat_wrapper const (*))arg6,arg7); + csc_matvec(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,(npy_cfloat_wrapper const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -18329,7 +18565,7 @@ } -SWIGINTERN PyObject *_wrap_cscmux__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_matvec__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -18359,15 +18595,15 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:cscmux",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csc_matvec",&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 '" "cscmux" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_matvec" "', 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 '" "cscmux" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_matvec" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -18415,7 +18651,7 @@ if (!temp7 || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail; arg7 = (npy_cdouble_wrapper*) array_data(temp7); } - cscmux(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,(npy_cdouble_wrapper const (*))arg6,arg7); + csc_matvec(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,(npy_cdouble_wrapper const (*))arg6,arg7); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -18447,7 +18683,7 @@ } -SWIGINTERN PyObject *_wrap_cscmux(PyObject *self, PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_matvec(PyObject *self, PyObject *args) { int argc; PyObject *argv[8]; int ii; @@ -18489,7 +18725,7 @@ _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_cscmux__SWIG_1(self, args); + return _wrap_csc_matvec__SWIG_1(self, args); } } } @@ -18530,7 +18766,7 @@ _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_cscmux__SWIG_2(self, args); + return _wrap_csc_matvec__SWIG_2(self, args); } } } @@ -18571,7 +18807,7 @@ _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_cscmux__SWIG_3(self, args); + return _wrap_csc_matvec__SWIG_3(self, args); } } } @@ -18612,7 +18848,7 @@ _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_cscmux__SWIG_4(self, args); + return _wrap_csc_matvec__SWIG_4(self, args); } } } @@ -18653,7 +18889,7 @@ _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_cscmux__SWIG_5(self, args); + return _wrap_csc_matvec__SWIG_5(self, args); } } } @@ -18694,7 +18930,7 @@ _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_cscmux__SWIG_6(self, args); + return _wrap_csc_matvec__SWIG_6(self, args); } } } @@ -18735,7 +18971,7 @@ _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_cscmux__SWIG_7(self, args); + return _wrap_csc_matvec__SWIG_7(self, args); } } } @@ -18776,7 +19012,7 @@ _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_cscmux__SWIG_8(self, args); + return _wrap_csc_matvec__SWIG_8(self, args); } } } @@ -18817,7 +19053,7 @@ _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_cscmux__SWIG_9(self, args); + return _wrap_csc_matvec__SWIG_9(self, args); } } } @@ -18828,7 +19064,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'cscmux'.\n Possible C/C++ prototypes are:\n"" cscmux<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],signed char const [],signed char [])\n"" cscmux<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],unsigned char const [],unsigned char [])\n"" cscmux<(int,short)>(int const,int const,int const [],int const [],short const [],short const [],short [])\n"" cscmux<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],int [])\n"" cscmux<(int,long long)>(int const,int const,int const [],int const [],long long const [],long long const [],long long [])\n"" cscmux<(int,float)>(int const,int const,int const [],int const [],float const [],float const [],float [])\n"" cscmux<(int,double)>(int const,int const,int const [],int const [],double const [],double const [],double [])\n"" cscmux<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper [])\n"" cscmux<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper [])\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_matvec'.\n Possible C/C++ prototypes are:\n"" csc_matvec<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],signed char const [],signed char [])\n"" csc_matvec<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],unsigned char const [],unsigned char [])\n"" csc_matvec<(int,short)>(int const,int const,int const [],int const [],short const [],short const [],short [])\n"" csc_matvec<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],int [])\n"" csc_matvec<(int,long long)>(int const,int const,int const [],int const [],long long const [],long long const [],long long [])\n"" csc_matvec<(int,float)>(int const,int const,int const [],int const [],float const [],float const [],float [])\n"" csc_matvec<(int,double)>(int const,int const,int const [],int const [],double const [],double const [],double [])\n"" csc_matvec<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper [])\n"" csc_matvec<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper [])\n"); return NULL; } @@ -35889,2600 +36125,19 @@ } -SWIGINTERN PyObject *_wrap_spdiags__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; - int arg3 ; - int *arg4 ; - signed char *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:spdiags",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "spdiags" "', 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 '" "spdiags" "', 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 '" "spdiags" "', argument " "3"" of type '" "int""'"); - } - arg3 = static_cast< int >(val3); - { - 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[2] = { - -1,-1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_BYTE, &is_new_object5); - if (!array5 || !require_dimensions(array5,2) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - arg5 = (signed char*) array5->data; - } - spdiags(arg1,arg2,arg3,(int const (*))arg4,(signed char const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(signed char)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_spdiags__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int *arg4 ; - unsigned char *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:spdiags",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "spdiags" "', 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 '" "spdiags" "', 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 '" "spdiags" "', argument " "3"" of type '" "int""'"); - } - arg3 = static_cast< int >(val3); - { - 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[2] = { - -1,-1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_UBYTE, &is_new_object5); - if (!array5 || !require_dimensions(array5,2) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - arg5 = (unsigned char*) array5->data; - } - spdiags(arg1,arg2,arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(unsigned char)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_spdiags__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int *arg4 ; - short *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:spdiags",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "spdiags" "', 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 '" "spdiags" "', 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 '" "spdiags" "', argument " "3"" of type '" "int""'"); - } - arg3 = static_cast< int >(val3); - { - 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[2] = { - -1,-1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_SHORT, &is_new_object5); - if (!array5 || !require_dimensions(array5,2) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - arg5 = (short*) array5->data; - } - spdiags(arg1,arg2,arg3,(int const (*))arg4,(short const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(short)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_spdiags__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int *arg4 ; - int *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:spdiags",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "spdiags" "', 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 '" "spdiags" "', 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 '" "spdiags" "', argument " "3"" of type '" "int""'"); - } - arg3 = static_cast< int >(val3); - { - 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[2] = { - -1,-1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_INT, &is_new_object5); - if (!array5 || !require_dimensions(array5,2) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - arg5 = (int*) array5->data; - } - spdiags(arg1,arg2,arg3,(int const (*))arg4,(int const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(int)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_spdiags__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int *arg4 ; - long long *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:spdiags",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "spdiags" "', 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 '" "spdiags" "', 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 '" "spdiags" "', argument " "3"" of type '" "int""'"); - } - arg3 = static_cast< int >(val3); - { - 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[2] = { - -1,-1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_LONGLONG, &is_new_object5); - if (!array5 || !require_dimensions(array5,2) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - arg5 = (long long*) array5->data; - } - spdiags(arg1,arg2,arg3,(int const (*))arg4,(long long const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(long long)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_spdiags__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int *arg4 ; - float *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:spdiags",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "spdiags" "', 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 '" "spdiags" "', 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 '" "spdiags" "', argument " "3"" of type '" "int""'"); - } - arg3 = static_cast< int >(val3); - { - 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[2] = { - -1,-1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_FLOAT, &is_new_object5); - if (!array5 || !require_dimensions(array5,2) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - arg5 = (float*) array5->data; - } - spdiags(arg1,arg2,arg3,(int const (*))arg4,(float const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(float)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_spdiags__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int *arg4 ; - double *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:spdiags",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "spdiags" "', 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 '" "spdiags" "', 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 '" "spdiags" "', argument " "3"" of type '" "int""'"); - } - arg3 = static_cast< int >(val3); - { - 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[2] = { - -1,-1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_DOUBLE, &is_new_object5); - if (!array5 || !require_dimensions(array5,2) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - arg5 = (double*) array5->data; - } - spdiags(arg1,arg2,arg3,(int const (*))arg4,(double const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(double)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_spdiags__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int *arg4 ; - npy_cfloat_wrapper *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:spdiags",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "spdiags" "', 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 '" "spdiags" "', 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 '" "spdiags" "', argument " "3"" of type '" "int""'"); - } - arg3 = static_cast< int >(val3); - { - 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[2] = { - -1,-1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_CFLOAT, &is_new_object5); - if (!array5 || !require_dimensions(array5,2) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - arg5 = (npy_cfloat_wrapper*) array5->data; - } - spdiags(arg1,arg2,arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(npy_cfloat_wrapper)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_spdiags__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int *arg4 ; - npy_cdouble_wrapper *arg5 ; - std::vector *arg6 = (std::vector *) 0 ; - std::vector *arg7 = (std::vector *) 0 ; - std::vector *arg8 = (std::vector *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - std::vector *tmp6 ; - std::vector *tmp7 ; - std::vector *tmp8 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - { - tmp6 = new std::vector(); - arg6 = tmp6; - } - { - tmp7 = new std::vector(); - arg7 = tmp7; - } - { - tmp8 = new std::vector(); - arg8 = tmp8; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOO:spdiags",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "spdiags" "', 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 '" "spdiags" "', 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 '" "spdiags" "', argument " "3"" of type '" "int""'"); - } - arg3 = static_cast< int >(val3); - { - 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[2] = { - -1,-1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_CDOUBLE, &is_new_object5); - if (!array5 || !require_dimensions(array5,2) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - arg5 = (npy_cdouble_wrapper*) array5->data; - } - spdiags(arg1,arg2,arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - { - int length = (arg6)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg6))[0]),sizeof(int)*length); - delete arg6; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg7)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg7))[0]),sizeof(int)*length); - delete arg7; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - int length = (arg8)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg8))[0]),sizeof(npy_cdouble_wrapper)*length); - delete arg8; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_spdiags(PyObject *self, PyObject *args) { - int argc; - PyObject *argv[6]; - int ii; - - if (!PyTuple_Check(args)) SWIG_fail; - argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 5); ii++) { - argv[ii] = PyTuple_GET_ITEM(args,ii); - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_BYTE)) ? 1 : 0; - } - if (_v) { - return _wrap_spdiags__SWIG_1(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_UBYTE)) ? 1 : 0; - } - if (_v) { - return _wrap_spdiags__SWIG_2(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_SHORT)) ? 1 : 0; - } - if (_v) { - return _wrap_spdiags__SWIG_3(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - return _wrap_spdiags__SWIG_4(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_LONGLONG)) ? 1 : 0; - } - if (_v) { - return _wrap_spdiags__SWIG_5(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0; - } - if (_v) { - return _wrap_spdiags__SWIG_6(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0; - } - if (_v) { - return _wrap_spdiags__SWIG_7(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CFLOAT)) ? 1 : 0; - } - if (_v) { - return _wrap_spdiags__SWIG_8(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CDOUBLE)) ? 1 : 0; - } - if (_v) { - return _wrap_spdiags__SWIG_9(self, args); - } - } - } - } - } - } - -fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'spdiags'.\n Possible C/C++ prototypes are:\n"" spdiags<(int,signed char)>(int const,int const,int const,int const [],signed char const [],std::vector *,std::vector *,std::vector *)\n"" spdiags<(int,unsigned char)>(int const,int const,int const,int const [],unsigned char const [],std::vector *,std::vector *,std::vector *)\n"" spdiags<(int,short)>(int const,int const,int const,int const [],short const [],std::vector *,std::vector *,std::vector *)\n"" spdiags<(int,int)>(int const,int const,int const,int const [],int const [],std::vector *,std::vector *,std::vector *)\n"" spdiags<(int,long long)>(int const,int const,int const,int const [],long long const [],std::vector *,std::vector *,std::vector *)\n"" spdiags<(int,float)>(int const,int const,int const,int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" spdiags<(int,double)>(int const,int const,int const,int const [],double const [],std::vector *,std::vector *,std::vector *)\n"" spdiags<(int,npy_cfloat_wrapper)>(int const,int const,int const,int const [],npy_cfloat_wrapper const [],std::vector *,std::vector *,std::vector *)\n"" spdiags<(int,npy_cdouble_wrapper)>(int const,int const,int const,int const [],npy_cdouble_wrapper const [],std::vector *,std::vector *,std::vector *)\n"); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csrtodense__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; int *arg3 ; int *arg4 ; signed char *arg5 ; - signed char *arg6 ; int val1 ; int ecode1 = 0 ; int val2 ; int ecode2 = 0 ; PyArrayObject *array3 = NULL ; int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - PyArrayObject *temp6 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - PyObject * obj5 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csrtodense",&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 '" "csrtodense" "', 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 '" "csrtodense" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_BYTE, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (signed char*) array5->data; - } - { - temp6 = obj_to_array_no_conversion(obj5,PyArray_BYTE); - if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; - arg6 = (signed char*) array_data(temp6); - } - csrtodense(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,arg6); - resultobj = SWIG_Py_Void(); - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csrtodense__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - unsigned char *arg5 ; - unsigned char *arg6 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - PyArrayObject *temp6 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - PyObject * obj5 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csrtodense",&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 '" "csrtodense" "', 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 '" "csrtodense" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_UBYTE, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (unsigned char*) array5->data; - } - { - temp6 = obj_to_array_no_conversion(obj5,PyArray_UBYTE); - if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; - arg6 = (unsigned char*) array_data(temp6); - } - csrtodense(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,arg6); - resultobj = SWIG_Py_Void(); - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csrtodense__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - short *arg5 ; - short *arg6 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - PyArrayObject *temp6 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - PyObject * obj5 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csrtodense",&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 '" "csrtodense" "', 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 '" "csrtodense" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_SHORT, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (short*) array5->data; - } - { - temp6 = obj_to_array_no_conversion(obj5,PyArray_SHORT); - if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; - arg6 = (short*) array_data(temp6); - } - csrtodense(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,arg6); - 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); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csrtodense__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - int *arg5 ; - int *arg6 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - PyArrayObject *temp6 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - PyObject * obj5 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csrtodense",&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 '" "csrtodense" "', 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 '" "csrtodense" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_INT, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (int*) array5->data; - } - { - temp6 = obj_to_array_no_conversion(obj5,PyArray_INT); - if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; - arg6 = (int*) array_data(temp6); - } - csrtodense(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,arg6); - 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); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csrtodense__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - long long *arg5 ; - long long *arg6 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - PyArrayObject *temp6 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - PyObject * obj5 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csrtodense",&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 '" "csrtodense" "', 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 '" "csrtodense" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_LONGLONG, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (long long*) array5->data; - } - { - temp6 = obj_to_array_no_conversion(obj5,PyArray_LONGLONG); - if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; - arg6 = (long long*) array_data(temp6); - } - csrtodense(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,arg6); - resultobj = SWIG_Py_Void(); - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csrtodense__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - float *arg5 ; - float *arg6 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - PyArrayObject *temp6 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - PyObject * obj5 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csrtodense",&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 '" "csrtodense" "', 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 '" "csrtodense" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_FLOAT, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (float*) array5->data; - } - { - temp6 = obj_to_array_no_conversion(obj5,PyArray_FLOAT); - if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; - arg6 = (float*) array_data(temp6); - } - csrtodense(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,arg6); - 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); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csrtodense__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - double *arg5 ; - double *arg6 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - PyArrayObject *temp6 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - PyObject * obj5 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csrtodense",&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 '" "csrtodense" "', 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 '" "csrtodense" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_DOUBLE, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (double*) array5->data; - } - { - temp6 = obj_to_array_no_conversion(obj5,PyArray_DOUBLE); - if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; - arg6 = (double*) array_data(temp6); - } - csrtodense(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,arg6); - 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); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csrtodense__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - npy_cfloat_wrapper *arg5 ; - npy_cfloat_wrapper *arg6 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - PyArrayObject *temp6 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - PyObject * obj5 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csrtodense",&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 '" "csrtodense" "', 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 '" "csrtodense" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_CFLOAT, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (npy_cfloat_wrapper*) array5->data; - } - { - temp6 = obj_to_array_no_conversion(obj5,PyArray_CFLOAT); - if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; - arg6 = (npy_cfloat_wrapper*) array_data(temp6); - } - csrtodense(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,arg6); - resultobj = SWIG_Py_Void(); - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csrtodense__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - npy_cdouble_wrapper *arg5 ; - npy_cdouble_wrapper *arg6 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; - PyArrayObject *array5 = NULL ; - int is_new_object5 ; - PyArrayObject *temp6 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - PyObject * obj5 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csrtodense",&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 '" "csrtodense" "', 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 '" "csrtodense" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - npy_intp size[1] = { - -1 - }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; - - arg4 = (int*) array4->data; - } - { - npy_intp size[1] = { - -1 - }; - array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_CDOUBLE, &is_new_object5); - if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1) - || !require_contiguous(array5) || !require_native(array5)) SWIG_fail; - - arg5 = (npy_cdouble_wrapper*) array5->data; - } - { - temp6 = obj_to_array_no_conversion(obj5,PyArray_CDOUBLE); - if (!temp6 || !require_contiguous(temp6) || !require_native(temp6)) SWIG_fail; - arg6 = (npy_cdouble_wrapper*) array_data(temp6); - } - csrtodense(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,arg6); - resultobj = SWIG_Py_Void(); - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - { - if (is_new_object4 && array4) Py_DECREF(array4); - } - { - if (is_new_object5 && array5) Py_DECREF(array5); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csrtodense(PyObject *self, PyObject *args) { - int argc; - PyObject *argv[7]; - int ii; - - if (!PyTuple_Check(args)) SWIG_fail; - argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 6); ii++) { - argv[ii] = PyTuple_GET_ITEM(args,ii); - } - if (argc == 6) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_BYTE)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_BYTE)) ? 1 : 0; - } - if (_v) { - return _wrap_csrtodense__SWIG_1(self, args); - } - } - } - } - } - } - } - if (argc == 6) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_UBYTE)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_UBYTE)) ? 1 : 0; - } - if (_v) { - return _wrap_csrtodense__SWIG_2(self, args); - } - } - } - } - } - } - } - if (argc == 6) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_SHORT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_SHORT)) ? 1 : 0; - } - if (_v) { - return _wrap_csrtodense__SWIG_3(self, args); - } - } - } - } - } - } - } - if (argc == 6) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - return _wrap_csrtodense__SWIG_4(self, args); - } - } - } - } - } - } - } - if (argc == 6) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_LONGLONG)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_LONGLONG)) ? 1 : 0; - } - if (_v) { - return _wrap_csrtodense__SWIG_5(self, args); - } - } - } - } - } - } - } - if (argc == 6) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_FLOAT)) ? 1 : 0; - } - if (_v) { - return _wrap_csrtodense__SWIG_6(self, args); - } - } - } - } - } - } - } - if (argc == 6) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_DOUBLE)) ? 1 : 0; - } - if (_v) { - return _wrap_csrtodense__SWIG_7(self, args); - } - } - } - } - } - } - } - if (argc == 6) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CFLOAT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_CFLOAT)) ? 1 : 0; - } - if (_v) { - return _wrap_csrtodense__SWIG_8(self, args); - } - } - } - } - } - } - } - if (argc == 6) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CDOUBLE)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_CDOUBLE)) ? 1 : 0; - } - if (_v) { - return _wrap_csrtodense__SWIG_9(self, args); - } - } - } - } - } - } - } - -fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csrtodense'.\n Possible C/C++ prototypes are:\n"" csrtodense<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],signed char [])\n"" csrtodense<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],unsigned char [])\n"" csrtodense<(int,short)>(int const,int const,int const [],int const [],short const [],short [])\n"" csrtodense<(int,int)>(int const,int const,int const [],int const [],int const [],int [])\n"" csrtodense<(int,long long)>(int const,int const,int const [],int const [],long long const [],long long [])\n"" csrtodense<(int,float)>(int const,int const,int const [],int const [],float const [],float [])\n"" csrtodense<(int,double)>(int const,int const,int const [],int const [],double const [],double [])\n"" csrtodense<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper [])\n"" csrtodense<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper [])\n"); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_sort_csr_indices__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - signed char *arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; PyArrayObject *temp4 = NULL ; PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; @@ -38491,15 +36146,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sort_csr_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sort_csr_indices" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sort_csr_indices" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sort_indices" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -38522,7 +36177,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (signed char*) array_data(temp5); } - sort_csr_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csr_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -38536,7 +36191,7 @@ } -SWIGINTERN PyObject *_wrap_sort_csr_indices__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -38557,15 +36212,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sort_csr_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sort_csr_indices" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sort_csr_indices" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sort_indices" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -38588,7 +36243,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (unsigned char*) array_data(temp5); } - sort_csr_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csr_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -38602,7 +36257,7 @@ } -SWIGINTERN PyObject *_wrap_sort_csr_indices__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -38623,15 +36278,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sort_csr_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sort_csr_indices" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sort_csr_indices" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sort_indices" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -38654,7 +36309,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (short*) array_data(temp5); } - sort_csr_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csr_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -38668,7 +36323,7 @@ } -SWIGINTERN PyObject *_wrap_sort_csr_indices__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -38689,15 +36344,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sort_csr_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sort_csr_indices" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sort_csr_indices" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sort_indices" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -38720,7 +36375,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (int*) array_data(temp5); } - sort_csr_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csr_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -38734,7 +36389,7 @@ } -SWIGINTERN PyObject *_wrap_sort_csr_indices__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -38755,15 +36410,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sort_csr_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sort_csr_indices" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sort_csr_indices" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sort_indices" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -38786,7 +36441,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (long long*) array_data(temp5); } - sort_csr_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csr_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -38800,7 +36455,7 @@ } -SWIGINTERN PyObject *_wrap_sort_csr_indices__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -38821,15 +36476,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sort_csr_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sort_csr_indices" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sort_csr_indices" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sort_indices" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -38852,7 +36507,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (float*) array_data(temp5); } - sort_csr_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csr_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -38866,7 +36521,7 @@ } -SWIGINTERN PyObject *_wrap_sort_csr_indices__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -38887,15 +36542,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sort_csr_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sort_csr_indices" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sort_csr_indices" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sort_indices" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -38918,7 +36573,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (double*) array_data(temp5); } - sort_csr_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csr_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -38932,7 +36587,7 @@ } -SWIGINTERN PyObject *_wrap_sort_csr_indices__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -38953,15 +36608,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sort_csr_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sort_csr_indices" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sort_csr_indices" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sort_indices" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -38984,7 +36639,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (npy_cfloat_wrapper*) array_data(temp5); } - sort_csr_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csr_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -38998,7 +36653,7 @@ } -SWIGINTERN PyObject *_wrap_sort_csr_indices__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -39019,15 +36674,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sort_csr_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sort_csr_indices" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sort_csr_indices" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sort_indices" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -39050,7 +36705,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (npy_cdouble_wrapper*) array_data(temp5); } - sort_csr_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csr_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -39064,7 +36719,7 @@ } -SWIGINTERN PyObject *_wrap_sort_csr_indices(PyObject *self, PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_sort_indices(PyObject *self, PyObject *args) { int argc; PyObject *argv[6]; int ii; @@ -39098,7 +36753,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_sort_csr_indices__SWIG_1(self, args); + return _wrap_csr_sort_indices__SWIG_1(self, args); } } } @@ -39129,7 +36784,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_sort_csr_indices__SWIG_2(self, args); + return _wrap_csr_sort_indices__SWIG_2(self, args); } } } @@ -39160,7 +36815,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_sort_csr_indices__SWIG_3(self, args); + return _wrap_csr_sort_indices__SWIG_3(self, args); } } } @@ -39191,7 +36846,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_sort_csr_indices__SWIG_4(self, args); + return _wrap_csr_sort_indices__SWIG_4(self, args); } } } @@ -39222,7 +36877,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_sort_csr_indices__SWIG_5(self, args); + return _wrap_csr_sort_indices__SWIG_5(self, args); } } } @@ -39253,7 +36908,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_sort_csr_indices__SWIG_6(self, args); + return _wrap_csr_sort_indices__SWIG_6(self, args); } } } @@ -39284,7 +36939,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_sort_csr_indices__SWIG_7(self, args); + return _wrap_csr_sort_indices__SWIG_7(self, args); } } } @@ -39315,7 +36970,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_sort_csr_indices__SWIG_8(self, args); + return _wrap_csr_sort_indices__SWIG_8(self, args); } } } @@ -39346,7 +37001,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_sort_csr_indices__SWIG_9(self, args); + return _wrap_csr_sort_indices__SWIG_9(self, args); } } } @@ -39355,12 +37010,12 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'sort_csr_indices'.\n Possible C/C++ prototypes are:\n"" sort_csr_indices<(int,signed char)>(int const,int const,int const [],int [],signed char [])\n"" sort_csr_indices<(int,unsigned char)>(int const,int const,int const [],int [],unsigned char [])\n"" sort_csr_indices<(int,short)>(int const,int const,int const [],int [],short [])\n"" sort_csr_indices<(int,int)>(int const,int const,int const [],int [],int [])\n"" sort_csr_indices<(int,long long)>(int const,int const,int const [],int [],long long [])\n"" sort_csr_indices<(int,float)>(int const,int const,int const [],int [],float [])\n"" sort_csr_indices<(int,double)>(int const,int const,int const [],int [],double [])\n"" sort_csr_indices<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int [],npy_cfloat_wrapper [])\n"" sort_csr_indices<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int [],npy_cdouble_wrapper [])\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_sort_indices'.\n Possible C/C++ prototypes are:\n"" csr_sort_indices<(int,signed char)>(int const,int const,int const [],int [],signed char [])\n"" csr_sort_indices<(int,unsigned char)>(int const,int const,int const [],int [],unsigned char [])\n"" csr_sort_indices<(int,short)>(int const,int const,int const [],int [],short [])\n"" csr_sort_indices<(int,int)>(int const,int const,int const [],int [],int [])\n"" csr_sort_indices<(int,long long)>(int const,int const,int const [],int [],long long [])\n"" csr_sort_indices<(int,float)>(int const,int const,int const [],int [],float [])\n"" csr_sort_indices<(int,double)>(int const,int const,int const [],int [],double [])\n"" csr_sort_indices<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int [],npy_cfloat_wrapper [])\n"" csr_sort_indices<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int [],npy_cdouble_wrapper [])\n"); return NULL; } -SWIGINTERN PyObject *_wrap_sort_csc_indices__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -39381,15 +37036,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sort_csc_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sort_csc_indices" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sort_csc_indices" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sort_indices" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -39412,7 +37067,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (signed char*) array_data(temp5); } - sort_csc_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csc_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -39426,7 +37081,7 @@ } -SWIGINTERN PyObject *_wrap_sort_csc_indices__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -39447,15 +37102,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sort_csc_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sort_csc_indices" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sort_csc_indices" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sort_indices" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -39478,7 +37133,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (unsigned char*) array_data(temp5); } - sort_csc_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csc_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -39492,7 +37147,7 @@ } -SWIGINTERN PyObject *_wrap_sort_csc_indices__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -39513,15 +37168,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sort_csc_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sort_csc_indices" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sort_csc_indices" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sort_indices" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -39544,7 +37199,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (short*) array_data(temp5); } - sort_csc_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csc_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -39558,7 +37213,7 @@ } -SWIGINTERN PyObject *_wrap_sort_csc_indices__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -39579,15 +37234,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sort_csc_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sort_csc_indices" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sort_csc_indices" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sort_indices" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -39610,7 +37265,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (int*) array_data(temp5); } - sort_csc_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csc_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -39624,7 +37279,7 @@ } -SWIGINTERN PyObject *_wrap_sort_csc_indices__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -39645,15 +37300,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sort_csc_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sort_csc_indices" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sort_csc_indices" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sort_indices" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -39676,7 +37331,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (long long*) array_data(temp5); } - sort_csc_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csc_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -39690,7 +37345,7 @@ } -SWIGINTERN PyObject *_wrap_sort_csc_indices__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -39711,15 +37366,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sort_csc_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sort_csc_indices" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sort_csc_indices" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sort_indices" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -39742,7 +37397,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (float*) array_data(temp5); } - sort_csc_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csc_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -39756,7 +37411,7 @@ } -SWIGINTERN PyObject *_wrap_sort_csc_indices__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -39777,15 +37432,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sort_csc_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sort_csc_indices" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sort_csc_indices" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sort_indices" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -39808,7 +37463,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (double*) array_data(temp5); } - sort_csc_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csc_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -39822,7 +37477,7 @@ } -SWIGINTERN PyObject *_wrap_sort_csc_indices__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -39843,15 +37498,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sort_csc_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sort_csc_indices" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sort_csc_indices" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sort_indices" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -39874,7 +37529,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (npy_cfloat_wrapper*) array_data(temp5); } - sort_csc_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csc_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -39888,7 +37543,7 @@ } -SWIGINTERN PyObject *_wrap_sort_csc_indices__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -39909,15 +37564,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sort_csc_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sort_csc_indices" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sort_csc_indices" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sort_indices" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -39940,7 +37595,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (npy_cdouble_wrapper*) array_data(temp5); } - sort_csc_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csc_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); @@ -39954,7 +37609,7 @@ } -SWIGINTERN PyObject *_wrap_sort_csc_indices(PyObject *self, PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_sort_indices(PyObject *self, PyObject *args) { int argc; PyObject *argv[6]; int ii; @@ -39988,7 +37643,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_sort_csc_indices__SWIG_1(self, args); + return _wrap_csc_sort_indices__SWIG_1(self, args); } } } @@ -40019,7 +37674,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_sort_csc_indices__SWIG_2(self, args); + return _wrap_csc_sort_indices__SWIG_2(self, args); } } } @@ -40050,7 +37705,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_sort_csc_indices__SWIG_3(self, args); + return _wrap_csc_sort_indices__SWIG_3(self, args); } } } @@ -40081,7 +37736,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_sort_csc_indices__SWIG_4(self, args); + return _wrap_csc_sort_indices__SWIG_4(self, args); } } } @@ -40112,7 +37767,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_sort_csc_indices__SWIG_5(self, args); + return _wrap_csc_sort_indices__SWIG_5(self, args); } } } @@ -40143,7 +37798,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_sort_csc_indices__SWIG_6(self, args); + return _wrap_csc_sort_indices__SWIG_6(self, args); } } } @@ -40174,7 +37829,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_sort_csc_indices__SWIG_7(self, args); + return _wrap_csc_sort_indices__SWIG_7(self, args); } } } @@ -40205,7 +37860,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_sort_csc_indices__SWIG_8(self, args); + return _wrap_csc_sort_indices__SWIG_8(self, args); } } } @@ -40236,7 +37891,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_sort_csc_indices__SWIG_9(self, args); + return _wrap_csc_sort_indices__SWIG_9(self, args); } } } @@ -40245,7 +37900,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'sort_csc_indices'.\n Possible C/C++ prototypes are:\n"" sort_csc_indices<(int,signed char)>(int const,int const,int const [],int [],signed char [])\n"" sort_csc_indices<(int,unsigned char)>(int const,int const,int const [],int [],unsigned char [])\n"" sort_csc_indices<(int,short)>(int const,int const,int const [],int [],short [])\n"" sort_csc_indices<(int,int)>(int const,int const,int const [],int [],int [])\n"" sort_csc_indices<(int,long long)>(int const,int const,int const [],int [],long long [])\n"" sort_csc_indices<(int,float)>(int const,int const,int const [],int [],float [])\n"" sort_csc_indices<(int,double)>(int const,int const,int const [],int [],double [])\n"" sort_csc_indices<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int [],npy_cfloat_wrapper [])\n"" sort_csc_indices<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int [],npy_cdouble_wrapper [])\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_sort_indices'.\n Possible C/C++ prototypes are:\n"" csc_sort_indices<(int,signed char)>(int const,int const,int const [],int [],signed char [])\n"" csc_sort_indices<(int,unsigned char)>(int const,int const,int const [],int [],unsigned char [])\n"" csc_sort_indices<(int,short)>(int const,int const,int const [],int [],short [])\n"" csc_sort_indices<(int,int)>(int const,int const,int const [],int [],int [])\n"" csc_sort_indices<(int,long long)>(int const,int const,int const [],int [],long long [])\n"" csc_sort_indices<(int,float)>(int const,int const,int const [],int [],float [])\n"" csc_sort_indices<(int,double)>(int const,int const,int const [],int [],double [])\n"" csc_sort_indices<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int [],npy_cfloat_wrapper [])\n"" csc_sort_indices<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int [],npy_cdouble_wrapper [])\n"); return NULL; } @@ -43812,219 +41467,215 @@ static PyMethodDef SwigMethods[] = { - { (char *)"extract_csr_diagonal", _wrap_extract_csr_diagonal, METH_VARARGS, (char *)"\n" - "extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n" + { (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" " signed char Yx)\n" - "extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, \n" + "csr_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, \n" " unsigned char Yx)\n" - "extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, short Ax, short Yx)\n" - "extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, int Ax, int Yx)\n" - "extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, long long Ax, \n" + "csr_diagonal(int n_row, int n_col, int Ap, int Aj, short Ax, short Yx)\n" + "csr_diagonal(int n_row, int n_col, int Ap, int Aj, int Ax, int Yx)\n" + "csr_diagonal(int n_row, int n_col, int Ap, int Aj, long long Ax, \n" " long long Yx)\n" - "extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, float Ax, float Yx)\n" - "extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, double Ax, double Yx)\n" - "extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, \n" + "csr_diagonal(int n_row, int n_col, int Ap, int Aj, float Ax, float Yx)\n" + "csr_diagonal(int n_row, int n_col, int Ap, int Aj, double Ax, double Yx)\n" + "csr_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, \n" " npy_cfloat_wrapper Yx)\n" - "extract_csr_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, \n" + "csr_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, \n" " npy_cdouble_wrapper Yx)\n" ""}, - { (char *)"extract_csc_diagonal", _wrap_extract_csc_diagonal, METH_VARARGS, (char *)"\n" - "extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n" + { (char *)"csc_diagonal", _wrap_csc_diagonal, METH_VARARGS, (char *)"\n" + "csc_diagonal(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n" " signed char Yx)\n" - "extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, \n" + "csc_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, \n" " unsigned char Yx)\n" - "extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, short Ax, short Yx)\n" - "extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, int Ax, int Yx)\n" - "extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, long long Ax, \n" + "csc_diagonal(int n_row, int n_col, int Ap, int Aj, short Ax, short Yx)\n" + "csc_diagonal(int n_row, int n_col, int Ap, int Aj, int Ax, int Yx)\n" + "csc_diagonal(int n_row, int n_col, int Ap, int Aj, long long Ax, \n" " long long Yx)\n" - "extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, float Ax, float Yx)\n" - "extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, double Ax, double Yx)\n" - "extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, \n" + "csc_diagonal(int n_row, int n_col, int Ap, int Aj, float Ax, float Yx)\n" + "csc_diagonal(int n_row, int n_col, int Ap, int Aj, double Ax, double Yx)\n" + "csc_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, \n" " npy_cfloat_wrapper Yx)\n" - "extract_csc_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, \n" + "csc_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, \n" " npy_cdouble_wrapper Yx)\n" ""}, - { (char *)"csrtocsc", _wrap_csrtocsc, METH_VARARGS, (char *)"\n" - "csrtocsc(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n" + { (char *)"csr_tocsc", _wrap_csr_tocsc, METH_VARARGS, (char *)"\n" + "csr_tocsc(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n" " int Bp, int Bi, signed char Bx)\n" - "csrtocsc(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, \n" + "csr_tocsc(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, \n" " int Bp, int Bi, unsigned char Bx)\n" - "csrtocsc(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, \n" + "csr_tocsc(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, \n" " int Bi, short Bx)\n" - "csrtocsc(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, \n" + "csr_tocsc(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, \n" " int Bi, int Bx)\n" - "csrtocsc(int n_row, int n_col, int Ap, int Aj, long long Ax, \n" + "csr_tocsc(int n_row, int n_col, int Ap, int Aj, long long Ax, \n" " int Bp, int Bi, long long Bx)\n" - "csrtocsc(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, \n" + "csr_tocsc(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, \n" " int Bi, float Bx)\n" - "csrtocsc(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, \n" + "csr_tocsc(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, \n" " int Bi, double Bx)\n" - "csrtocsc(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, \n" + "csr_tocsc(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, \n" " int Bp, int Bi, npy_cfloat_wrapper Bx)\n" - "csrtocsc(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, \n" + "csr_tocsc(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, \n" " int Bp, int Bi, npy_cdouble_wrapper Bx)\n" ""}, - { (char *)"csctocsr", _wrap_csctocsr, METH_VARARGS, (char *)"\n" - "csctocsr(int n_row, int n_col, int Ap, int Ai, signed char Ax, \n" + { (char *)"csc_tocsr", _wrap_csc_tocsr, METH_VARARGS, (char *)"\n" + "csc_tocsr(int n_row, int n_col, int Ap, int Ai, signed char Ax, \n" " int Bp, int Bj, signed char Bx)\n" - "csctocsr(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, \n" + "csc_tocsr(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, \n" " int Bp, int Bj, unsigned char Bx)\n" - "csctocsr(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, \n" + "csc_tocsr(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, \n" " int Bj, short Bx)\n" - "csctocsr(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, \n" + "csc_tocsr(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, \n" " int Bj, int Bx)\n" - "csctocsr(int n_row, int n_col, int Ap, int Ai, long long Ax, \n" + "csc_tocsr(int n_row, int n_col, int Ap, int Ai, long long Ax, \n" " int Bp, int Bj, long long Bx)\n" - "csctocsr(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, \n" + "csc_tocsr(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, \n" " int Bj, float Bx)\n" - "csctocsr(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, \n" + "csc_tocsr(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, \n" " int Bj, double Bx)\n" - "csctocsr(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, \n" + "csc_tocsr(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, \n" " int Bp, int Bj, npy_cfloat_wrapper Bx)\n" - "csctocsr(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, \n" + "csc_tocsr(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, \n" " int Bp, int Bj, npy_cdouble_wrapper Bx)\n" ""}, { (char *)"expandptr", _wrap_expandptr, METH_VARARGS, (char *)"expandptr(int n_row, int Ap, int Bi)"}, - { (char *)"cootocsr", _wrap_cootocsr, METH_VARARGS, (char *)"\n" - "cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, signed char Ax, \n" + { (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" " int Bp, int Bj, signed char Bx)\n" - "cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, unsigned char Ax, \n" + "coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned char Ax, \n" " int Bp, int Bj, unsigned char Bx)\n" - "cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, short Ax, \n" + "coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, short Ax, \n" " int Bp, int Bj, short Bx)\n" - "cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, int Ax, \n" + "coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, int Ax, \n" " int Bp, int Bj, int Bx)\n" - "cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, long long Ax, \n" + "coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, long long Ax, \n" " int Bp, int Bj, long long Bx)\n" - "cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, float Ax, \n" + "coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, float Ax, \n" " int Bp, int Bj, float Bx)\n" - "cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, double Ax, \n" + "coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, double Ax, \n" " int Bp, int Bj, double Bx)\n" - "cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cfloat_wrapper Ax, \n" + "coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cfloat_wrapper Ax, \n" " int Bp, int Bj, npy_cfloat_wrapper Bx)\n" - "cootocsr(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cdouble_wrapper Ax, \n" + "coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cdouble_wrapper Ax, \n" " int Bp, int Bj, npy_cdouble_wrapper Bx)\n" ""}, - { (char *)"cootocsc", _wrap_cootocsc, METH_VARARGS, (char *)"\n" - "cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, signed char Ax, \n" + { (char *)"coo_tocsc", _wrap_coo_tocsc, METH_VARARGS, (char *)"\n" + "coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, signed char Ax, \n" " int Bp, int Bi, signed char Bx)\n" - "cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, unsigned char Ax, \n" + "coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned char Ax, \n" " int Bp, int Bi, unsigned char Bx)\n" - "cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, short Ax, \n" + "coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, short Ax, \n" " int Bp, int Bi, short Bx)\n" - "cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, int Ax, \n" + "coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, int Ax, \n" " int Bp, int Bi, int Bx)\n" - "cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, long long Ax, \n" + "coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, long long Ax, \n" " int Bp, int Bi, long long Bx)\n" - "cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, float Ax, \n" + "coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, float Ax, \n" " int Bp, int Bi, float Bx)\n" - "cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, double Ax, \n" + "coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, double Ax, \n" " int Bp, int Bi, double Bx)\n" - "cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cfloat_wrapper Ax, \n" + "coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cfloat_wrapper Ax, \n" " int Bp, int Bi, npy_cfloat_wrapper Bx)\n" - "cootocsc(int n_row, int n_col, int NNZ, int Ai, int Aj, npy_cdouble_wrapper Ax, \n" + "coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cdouble_wrapper Ax, \n" " int Bp, int Bi, npy_cdouble_wrapper Bx)\n" ""}, - { (char *)"csrmucsr", _wrap_csrmucsr, METH_VARARGS, (char *)"\n" - "csrmucsr(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n" - " int Bp, int Bj, signed char Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(signed char)> Cx)\n" - "csrmucsr(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, \n" - " int Bp, int Bj, unsigned char Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(unsigned char)> Cx)\n" - "csrmucsr(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, \n" - " int Bj, short Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(short)> Cx)\n" - "csrmucsr(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, \n" - " int Bj, int Bx, std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(int)> Cx)\n" - "csrmucsr(int n_row, int n_col, int Ap, int Aj, long long Ax, \n" - " int Bp, int Bj, long long Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(long long)> Cx)\n" - "csrmucsr(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, \n" - " int Bj, float Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(float)> Cx)\n" - "csrmucsr(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, \n" - " int Bj, double Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(double)> Cx)\n" - "csrmucsr(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, \n" + { (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 *)"csc_matmat_pass1", _wrap_csc_matmat_pass1, METH_VARARGS, (char *)"\n" + "csc_matmat_pass1(int n_row, int n_col, int Ap, int Ai, int Bp, int Bi, \n" + " int Cp)\n" + ""}, + { (char *)"csr_matmat_pass2", _wrap_csr_matmat_pass2, METH_VARARGS, (char *)"\n" + "csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n" + " int Bp, int Bj, signed char Bx, int Cp, int Cj, \n" + " signed char Cx)\n" + "csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, \n" + " int Bp, int Bj, unsigned char Bx, int Cp, \n" + " int Cj, unsigned char Cx)\n" + "csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, \n" + " int Bj, short Bx, int Cp, int Cj, short Cx)\n" + "csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, \n" + " int Bj, int Bx, int Cp, int Cj, int Cx)\n" + "csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, long long Ax, \n" + " int Bp, int Bj, long long Bx, int Cp, int Cj, \n" + " long long Cx)\n" + "csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, \n" + " int Bj, float Bx, int Cp, int Cj, float Cx)\n" + "csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, \n" + " int Bj, double Bx, int Cp, int Cj, double Cx)\n" + "csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, \n" " int Bp, int Bj, npy_cfloat_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(npy_cfloat_wrapper)> Cx)\n" - "csrmucsr(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, \n" + " int Cp, int Cj, npy_cfloat_wrapper Cx)\n" + "csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, \n" " int Bp, int Bj, npy_cdouble_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(npy_cdouble_wrapper)> Cx)\n" + " int Cp, int Cj, npy_cdouble_wrapper Cx)\n" ""}, - { (char *)"cscmucsc", _wrap_cscmucsc, METH_VARARGS, (char *)"\n" - "cscmucsc(int n_row, int n_col, int Ap, int Ai, signed char Ax, \n" - " int Bp, int Bi, signed char Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(signed char)> Cx)\n" - "cscmucsc(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, \n" - " int Bp, int Bi, unsigned char Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(unsigned char)> Cx)\n" - "cscmucsc(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, \n" - " int Bi, short Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(short)> Cx)\n" - "cscmucsc(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, \n" - " int Bi, int Bx, std::vector<(int)> Cp, std::vector<(int)> Ci, \n" - " std::vector<(int)> Cx)\n" - "cscmucsc(int n_row, int n_col, int Ap, int Ai, long long Ax, \n" - " int Bp, int Bi, long long Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(long long)> Cx)\n" - "cscmucsc(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, \n" - " int Bi, float Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(float)> Cx)\n" - "cscmucsc(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, \n" - " int Bi, double Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(double)> Cx)\n" - "cscmucsc(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, \n" + { (char *)"csc_matmat_pass2", _wrap_csc_matmat_pass2, METH_VARARGS, (char *)"\n" + "csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, signed char Ax, \n" + " int Bp, int Bi, signed char Bx, int Cp, int Ci, \n" + " signed char Cx)\n" + "csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, \n" + " int Bp, int Bi, unsigned char Bx, int Cp, \n" + " int Ci, unsigned char Cx)\n" + "csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, \n" + " int Bi, short Bx, int Cp, int Ci, short Cx)\n" + "csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, \n" + " int Bi, int Bx, int Cp, int Ci, int Cx)\n" + "csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, long long Ax, \n" + " int Bp, int Bi, long long Bx, int Cp, int Ci, \n" + " long long Cx)\n" + "csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, \n" + " int Bi, float Bx, int Cp, int Ci, float Cx)\n" + "csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, \n" + " int Bi, double Bx, int Cp, int Ci, double Cx)\n" + "csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, \n" " int Bp, int Bi, npy_cfloat_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Ci, \n" - " std::vector<(npy_cfloat_wrapper)> Cx)\n" - "cscmucsc(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, \n" + " int Cp, int Ci, npy_cfloat_wrapper Cx)\n" + "csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, \n" " int Bp, int Bi, npy_cdouble_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Ci, \n" - " std::vector<(npy_cdouble_wrapper)> Cx)\n" + " int Cp, int Ci, npy_cdouble_wrapper Cx)\n" ""}, - { (char *)"csrmux", _wrap_csrmux, METH_VARARGS, (char *)"\n" - "csrmux(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n" + { (char *)"csr_matvec", _wrap_csr_matvec, METH_VARARGS, (char *)"\n" + "csr_matvec(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n" " signed char Xx, signed char Yx)\n" - "csrmux(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, \n" + "csr_matvec(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, \n" " unsigned char Xx, unsigned char Yx)\n" - "csrmux(int n_row, int n_col, int Ap, int Aj, short Ax, short Xx, \n" + "csr_matvec(int n_row, int n_col, int Ap, int Aj, short Ax, short Xx, \n" " short Yx)\n" - "csrmux(int n_row, int n_col, int Ap, int Aj, int Ax, int Xx, \n" + "csr_matvec(int n_row, int n_col, int Ap, int Aj, int Ax, int Xx, \n" " int Yx)\n" - "csrmux(int n_row, int n_col, int Ap, int Aj, long long Ax, \n" + "csr_matvec(int n_row, int n_col, int Ap, int Aj, long long Ax, \n" " long long Xx, long long Yx)\n" - "csrmux(int n_row, int n_col, int Ap, int Aj, float Ax, float Xx, \n" + "csr_matvec(int n_row, int n_col, int Ap, int Aj, float Ax, float Xx, \n" " float Yx)\n" - "csrmux(int n_row, int n_col, int Ap, int Aj, double Ax, double Xx, \n" + "csr_matvec(int n_row, int n_col, int Ap, int Aj, double Ax, double Xx, \n" " double Yx)\n" - "csrmux(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, \n" + "csr_matvec(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, \n" " npy_cfloat_wrapper Xx, npy_cfloat_wrapper Yx)\n" - "csrmux(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, \n" + "csr_matvec(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, \n" " npy_cdouble_wrapper Xx, npy_cdouble_wrapper Yx)\n" ""}, - { (char *)"cscmux", _wrap_cscmux, METH_VARARGS, (char *)"\n" - "cscmux(int n_row, int n_col, int Ap, int Ai, signed char Ax, \n" + { (char *)"csc_matvec", _wrap_csc_matvec, METH_VARARGS, (char *)"\n" + "csc_matvec(int n_row, int n_col, int Ap, int Ai, signed char Ax, \n" " signed char Xx, signed char Yx)\n" - "cscmux(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, \n" + "csc_matvec(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, \n" " unsigned char Xx, unsigned char Yx)\n" - "cscmux(int n_row, int n_col, int Ap, int Ai, short Ax, short Xx, \n" + "csc_matvec(int n_row, int n_col, int Ap, int Ai, short Ax, short Xx, \n" " short Yx)\n" - "cscmux(int n_row, int n_col, int Ap, int Ai, int Ax, int Xx, \n" + "csc_matvec(int n_row, int n_col, int Ap, int Ai, int Ax, int Xx, \n" " int Yx)\n" - "cscmux(int n_row, int n_col, int Ap, int Ai, long long Ax, \n" + "csc_matvec(int n_row, int n_col, int Ap, int Ai, long long Ax, \n" " long long Xx, long long Yx)\n" - "cscmux(int n_row, int n_col, int Ap, int Ai, float Ax, float Xx, \n" + "csc_matvec(int n_row, int n_col, int Ap, int Ai, float Ax, float Xx, \n" " float Yx)\n" - "cscmux(int n_row, int n_col, int Ap, int Ai, double Ax, double Xx, \n" + "csc_matvec(int n_row, int n_col, int Ap, int Ai, double Ax, double Xx, \n" " double Yx)\n" - "cscmux(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, \n" + "csc_matvec(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, \n" " npy_cfloat_wrapper Xx, npy_cfloat_wrapper Yx)\n" - "cscmux(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, \n" + "csc_matvec(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, \n" " npy_cdouble_wrapper Xx, npy_cdouble_wrapper Yx)\n" ""}, { (char *)"csr_elmul_csr", _wrap_csr_elmul_csr, METH_VARARGS, (char *)"\n" @@ -44275,73 +41926,28 @@ " std::vector<(int)> Cp, std::vector<(int)> Ci, \n" " std::vector<(npy_cdouble_wrapper)> Cx)\n" ""}, - { (char *)"spdiags", _wrap_spdiags, METH_VARARGS, (char *)"\n" - "spdiags(int n_row, int n_col, int n_diag, int offsets, signed char diags, \n" - " std::vector<(int)> Ap, std::vector<(int)> Ai, \n" - " std::vector<(signed char)> Ax)\n" - "spdiags(int n_row, int n_col, int n_diag, int offsets, unsigned char diags, \n" - " std::vector<(int)> Ap, std::vector<(int)> Ai, \n" - " std::vector<(unsigned char)> Ax)\n" - "spdiags(int n_row, int n_col, int n_diag, int offsets, short diags, \n" - " std::vector<(int)> Ap, std::vector<(int)> Ai, \n" - " std::vector<(short)> Ax)\n" - "spdiags(int n_row, int n_col, int n_diag, int offsets, int diags, \n" - " std::vector<(int)> Ap, std::vector<(int)> Ai, \n" - " std::vector<(int)> Ax)\n" - "spdiags(int n_row, int n_col, int n_diag, int offsets, long long diags, \n" - " std::vector<(int)> Ap, std::vector<(int)> Ai, \n" - " std::vector<(long long)> Ax)\n" - "spdiags(int n_row, int n_col, int n_diag, int offsets, float diags, \n" - " std::vector<(int)> Ap, std::vector<(int)> Ai, \n" - " std::vector<(float)> Ax)\n" - "spdiags(int n_row, int n_col, int n_diag, int offsets, double diags, \n" - " std::vector<(int)> Ap, std::vector<(int)> Ai, \n" - " std::vector<(double)> Ax)\n" - "spdiags(int n_row, int n_col, int n_diag, int offsets, npy_cfloat_wrapper diags, \n" - " std::vector<(int)> Ap, \n" - " std::vector<(int)> Ai, std::vector<(npy_cfloat_wrapper)> Ax)\n" - "spdiags(int n_row, int n_col, int n_diag, int offsets, npy_cdouble_wrapper diags, \n" - " std::vector<(int)> Ap, \n" - " std::vector<(int)> Ai, std::vector<(npy_cdouble_wrapper)> Ax)\n" + { (char *)"csr_sort_indices", _wrap_csr_sort_indices, METH_VARARGS, (char *)"\n" + "csr_sort_indices(int n_row, int n_col, int Ap, int Aj, signed char Ax)\n" + "csr_sort_indices(int n_row, int n_col, int Ap, int Aj, unsigned char Ax)\n" + "csr_sort_indices(int n_row, int n_col, int Ap, int Aj, short Ax)\n" + "csr_sort_indices(int n_row, int n_col, int Ap, int Aj, int Ax)\n" + "csr_sort_indices(int n_row, int n_col, int Ap, int Aj, long long Ax)\n" + "csr_sort_indices(int n_row, int n_col, int Ap, int Aj, float Ax)\n" + "csr_sort_indices(int n_row, int n_col, int Ap, int Aj, double Ax)\n" + "csr_sort_indices(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax)\n" + "csr_sort_indices(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax)\n" ""}, - { (char *)"csrtodense", _wrap_csrtodense, METH_VARARGS, (char *)"\n" - "csrtodense(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n" - " signed char Mx)\n" - "csrtodense(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, \n" - " unsigned char Mx)\n" - "csrtodense(int n_row, int n_col, int Ap, int Aj, short Ax, short Mx)\n" - "csrtodense(int n_row, int n_col, int Ap, int Aj, int Ax, int Mx)\n" - "csrtodense(int n_row, int n_col, int Ap, int Aj, long long Ax, \n" - " long long Mx)\n" - "csrtodense(int n_row, int n_col, int Ap, int Aj, float Ax, float Mx)\n" - "csrtodense(int n_row, int n_col, int Ap, int Aj, double Ax, double Mx)\n" - "csrtodense(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, \n" - " npy_cfloat_wrapper Mx)\n" - "csrtodense(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, \n" - " npy_cdouble_wrapper Mx)\n" + { (char *)"csc_sort_indices", _wrap_csc_sort_indices, METH_VARARGS, (char *)"\n" + "csc_sort_indices(int n_row, int n_col, int Ap, int Ai, signed char Ax)\n" + "csc_sort_indices(int n_row, int n_col, int Ap, int Ai, unsigned char Ax)\n" + "csc_sort_indices(int n_row, int n_col, int Ap, int Ai, short Ax)\n" + "csc_sort_indices(int n_row, int n_col, int Ap, int Ai, int Ax)\n" + "csc_sort_indices(int n_row, int n_col, int Ap, int Ai, long long Ax)\n" + "csc_sort_indices(int n_row, int n_col, int Ap, int Ai, float Ax)\n" + "csc_sort_indices(int n_row, int n_col, int Ap, int Ai, double Ax)\n" + "csc_sort_indices(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax)\n" + "csc_sort_indices(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax)\n" ""}, - { (char *)"sort_csr_indices", _wrap_sort_csr_indices, METH_VARARGS, (char *)"\n" - "sort_csr_indices(int n_row, int n_col, int Ap, int Aj, signed char Ax)\n" - "sort_csr_indices(int n_row, int n_col, int Ap, int Aj, unsigned char Ax)\n" - "sort_csr_indices(int n_row, int n_col, int Ap, int Aj, short Ax)\n" - "sort_csr_indices(int n_row, int n_col, int Ap, int Aj, int Ax)\n" - "sort_csr_indices(int n_row, int n_col, int Ap, int Aj, long long Ax)\n" - "sort_csr_indices(int n_row, int n_col, int Ap, int Aj, float Ax)\n" - "sort_csr_indices(int n_row, int n_col, int Ap, int Aj, double Ax)\n" - "sort_csr_indices(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax)\n" - "sort_csr_indices(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax)\n" - ""}, - { (char *)"sort_csc_indices", _wrap_sort_csc_indices, METH_VARARGS, (char *)"\n" - "sort_csc_indices(int n_row, int n_col, int Ap, int Ai, signed char Ax)\n" - "sort_csc_indices(int n_row, int n_col, int Ap, int Ai, unsigned char Ax)\n" - "sort_csc_indices(int n_row, int n_col, int Ap, int Ai, short Ax)\n" - "sort_csc_indices(int n_row, int n_col, int Ap, int Ai, int Ax)\n" - "sort_csc_indices(int n_row, int n_col, int Ap, int Ai, long long Ax)\n" - "sort_csc_indices(int n_row, int n_col, int Ap, int Ai, float Ax)\n" - "sort_csc_indices(int n_row, int n_col, int Ap, int Ai, double Ax)\n" - "sort_csc_indices(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax)\n" - "sort_csc_indices(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax)\n" - ""}, { (char *)"sum_csr_duplicates", _wrap_sum_csr_duplicates, METH_VARARGS, (char *)"\n" "sum_csr_duplicates(int n_row, int n_col, int Ap, int Aj, signed char Ax)\n" "sum_csr_duplicates(int n_row, int n_col, int Ap, int Aj, unsigned char Ax)\n" Modified: trunk/scipy/sparse/spfuncs.py =================================================================== --- trunk/scipy/sparse/spfuncs.py 2007-12-15 05:38:59 UTC (rev 3663) +++ trunk/scipy/sparse/spfuncs.py 2007-12-15 05:59:12 UTC (rev 3664) @@ -1,6 +1,8 @@ """ Functions that operate on sparse matrices """ +__all__ = ['extract_diagonal'] + from numpy import empty from base import isspmatrix @@ -16,7 +18,7 @@ """ #TODO extract k-th diagonal if isspmatrix_csr(A) or isspmatrix_csc(A): - fn = getattr(sparsetools, "extract_" + A.format + "_diagonal") + fn = getattr(sparsetools, A.format + "_diagonal") y = empty( min(A.shape), dtype=upcast(A.dtype) ) fn(A.shape[0],A.shape[1],A.indptr,A.indices,A.data,y) return y Modified: trunk/scipy/sparse/tests/test_construct.py =================================================================== --- trunk/scipy/sparse/tests/test_construct.py 2007-12-15 05:38:59 UTC (rev 3663) +++ trunk/scipy/sparse/tests/test_construct.py 2007-12-15 05:59:12 UTC (rev 3664) @@ -1,17 +1,63 @@ """test sparse matrix construction functions""" -import numpy -from numpy import array +from numpy import array, kron from numpy.testing import * set_package_path() -from scipy.sparse import csc_matrix, csr_matrix, dok_matrix, coo_matrix, \ - spidentity, speye, spkron, extract_diagonal, lil_matrix, lil_eye, \ - lil_diags, spdiags -from scipy.linsolve import splu +from scipy.sparse import csr_matrix, \ + spidentity, speye, spkron, spdiags, \ + lil_eye, lil_diags restore_path() class TestConstructUtils(NumpyTestCase): + def check_spdiags(self): + diags1 = array( [[ 1, 2, 3, 4, 5]] ) + diags2 = array( [[ 1, 2, 3, 4, 5], + [ 6, 7, 8, 9,10]] ) + diags3 = array( [[ 1, 2, 3, 4, 5], + [ 6, 7, 8, 9,10], + [11,12,13,14,15]] ) + + cases = [] + cases.append( (diags1, 0, 1, 1, [[1]]) ) + cases.append( (diags1, [0], 1, 1, [[1]]) ) + cases.append( (diags1, [0], 2, 1, [[1],[0]]) ) + cases.append( (diags1, [0], 1, 2, [[1,0]]) ) + cases.append( (diags1, [1], 1, 2, [[0,2]]) ) + cases.append( (diags1,[-1], 1, 2, [[0,0]]) ) + cases.append( (diags1, [0], 2, 2, [[1,0],[0,2]]) ) + cases.append( (diags1,[-1], 2, 2, [[0,0],[1,0]]) ) + cases.append( (diags1, [3], 2, 2, [[0,0],[0,0]]) ) + cases.append( (diags1, [0], 3, 4, [[1,0,0,0],[0,2,0,0],[0,0,3,0]]) ) + cases.append( (diags1, [1], 3, 4, [[0,2,0,0],[0,0,3,0],[0,0,0,4]]) ) + cases.append( (diags1, [2], 3, 5, [[0,0,3,0,0],[0,0,0,4,0],[0,0,0,0,5]]) ) + + cases.append( (diags2, [0,2], 3, 3, [[1,0,8],[0,2,0],[0,0,3]]) ) + cases.append( (diags2, [-1,0], 3, 4, [[6,0,0,0],[1,7,0,0],[0,2,8,0]]) ) + cases.append( (diags2, [2,-3], 6, 6, [[0,0,3,0,0,0], + [0,0,0,4,0,0], + [0,0,0,0,5,0], + [6,0,0,0,0,0], + [0,7,0,0,0,0], + [0,0,8,0,0,0]]) ) + + cases.append( (diags3, [-1,0,1], 6, 6, [[ 6,12, 0, 0, 0, 0], + [ 1, 7,13, 0, 0, 0], + [ 0, 2, 8,14, 0, 0], + [ 0, 0, 3, 9,15, 0], + [ 0, 0, 0, 4,10, 0], + [ 0, 0, 0, 0, 5, 0]]) ) + cases.append( (diags3, [-4,2,-1], 6, 5, [[ 0, 0, 8, 0, 0], + [11, 0, 0, 9, 0], + [ 0,12, 0, 0,10], + [ 0, 0,13, 0, 0], + [ 1, 0, 0,14, 0], + [ 0, 2, 0, 0,15]]) ) + + for d,o,m,n,result in cases: + assert_equal( spdiags(d,o,m,n).todense(), result ) + + def check_identity(self): a = spidentity(3) b = array([[1, 0, 0], [0, 1, 0], [0, 0, 1]], dtype='d') @@ -19,23 +65,18 @@ def check_eye(self): a = speye(2, 3 ) -# print a, a.__repr__ b = array([[1, 0, 0], [0, 1, 0]], dtype='d') assert_array_equal(a.toarray(), b) a = speye(3, 2) -# print a, a.__repr__ b = array([[1, 0], [0, 1], [0, 0]], dtype='d') assert_array_equal( a.toarray(), b) a = speye(3, 3) -# print a, a.__repr__ b = array([[1, 0, 0], [0, 1, 0], [0, 0, 1]], dtype='d') assert_array_equal(a.toarray(), b) def check_spkron(self): - from numpy import kron - cases = [] cases.append(array([[ 0]])) From scipy-svn at scipy.org Sat Dec 15 01:54:49 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Dec 2007 00:54:49 -0600 (CST) Subject: [Scipy-svn] r3665 - in trunk/scipy/sparse: . tests Message-ID: <20071215065449.F3E3439C018@new.scipy.org> Author: wnbell Date: 2007-12-15 00:54:42 -0600 (Sat, 15 Dec 2007) New Revision: 3665 Modified: trunk/scipy/sparse/csc.py trunk/scipy/sparse/csr.py trunk/scipy/sparse/tests/test_base.py Log: beginning unification of CSR/CSC get/set method sped up sparse unittests Modified: trunk/scipy/sparse/csc.py =================================================================== --- trunk/scipy/sparse/csc.py 2007-12-15 05:59:12 UTC (rev 3664) +++ trunk/scipy/sparse/csc.py 2007-12-15 06:54:42 UTC (rev 3665) @@ -7,7 +7,7 @@ import numpy from numpy import array, matrix, asarray, asmatrix, zeros, rank, intc, \ - empty, hstack, isscalar, ndarray, shape, searchsorted + empty, hstack, isscalar, ndarray, shape, searchsorted, where from base import spmatrix,isspmatrix from sparsetools import csc_tocsr @@ -56,15 +56,17 @@ return _cs_matrix._transpose(self, csr_matrix, copy) def __getitem__(self, key): + #TODO unify these in _cs_matrix if isinstance(key, tuple): - #TODO use _swap() to unify this in _cs_matrix row = key[0] col = key[1] + if isinstance(col, slice): # Returns a new matrix! return self.get_submatrix( row, col ) elif isinstance(row, slice): return self._getslice(row, col) + M, N = self.shape if (row < 0): row = M + row @@ -72,12 +74,23 @@ col = N + col if not (0<=row Author: wnbell Date: 2007-12-15 14:12:57 -0600 (Sat, 15 Dec 2007) New Revision: 3666 Modified: trunk/scipy/sparse/construct.py trunk/scipy/sparse/csr.py Log: updated spdiags example Modified: trunk/scipy/sparse/construct.py =================================================================== --- trunk/scipy/sparse/construct.py 2007-12-15 06:54:42 UTC (rev 3665) +++ trunk/scipy/sparse/construct.py 2007-12-15 20:12:57 UTC (rev 3666) @@ -37,13 +37,13 @@ *Example* ------- - - >>> diags = array([[1,2,3],[4,5,6],[7,8,9]]) + >>> diags = array([[1,2,3,4]]).repeat(3,axis=0) >>> offsets = array([0,-1,2]) - >>> spdiags( diags, offsets, 3, 5).todense() - matrix([[ 1., 0., 7., 0., 0.], - [ 4., 2., 0., 8., 0.], - [ 0., 5., 3., 0., 9.]]) + >>> spdiags(diags,offsets,4,4).todense() + matrix([[1, 0, 3, 0], + [1, 2, 0, 4], + [0, 2, 3, 0], + [0, 0, 3, 4]]) """ #TODO update this example Modified: trunk/scipy/sparse/csr.py =================================================================== --- trunk/scipy/sparse/csr.py 2007-12-15 06:54:42 UTC (rev 3665) +++ trunk/scipy/sparse/csr.py 2007-12-15 20:12:57 UTC (rev 3666) @@ -51,6 +51,7 @@ return _cs_matrix._transpose(self, csc_matrix, copy) def __getitem__(self, key): + #TODO unify these in _cs_matrix if isinstance(key, tuple): row = key[0] col = key[1] From scipy-svn at scipy.org Sat Dec 15 16:05:49 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Dec 2007 15:05:49 -0600 (CST) Subject: [Scipy-svn] r3667 - in branches/io_new: matlab tests Message-ID: <20071215210549.60ECA39C03A@new.scipy.org> Author: brian.hawthorne Date: 2007-12-15 15:04:05 -0600 (Sat, 15 Dec 2007) New Revision: 3667 Added: branches/io_new/matlab/__init__.py Modified: branches/io_new/matlab/mio.py branches/io_new/matlab/mio4.py branches/io_new/matlab/mio5.py branches/io_new/tests/test_mio.py Log: make matlab dir a package, use relative imports among matlab modules, and change test imports of matlab stuff to local instead of from scipy (enables tests to run in branch) Added: branches/io_new/matlab/__init__.py =================================================================== Modified: branches/io_new/matlab/mio.py =================================================================== --- branches/io_new/matlab/mio.py 2007-12-15 20:12:57 UTC (rev 3666) +++ branches/io_new/matlab/mio.py 2007-12-15 21:04:05 UTC (rev 3667) @@ -7,8 +7,8 @@ import os import sys -from scipy.io.matlab.mio4 import MatFile4Reader, MatFile4Writer -from scipy.io.matlab.mio5 import MatFile5Reader, MatFile5Writer +from mio4 import MatFile4Reader, MatFile4Writer +from mio5 import MatFile5Reader, MatFile5Writer __all__ = ['find_mat_file', 'mat_reader_factory', 'loadmat', 'savemat'] Modified: branches/io_new/matlab/mio4.py =================================================================== --- branches/io_new/matlab/mio4.py 2007-12-15 20:12:57 UTC (rev 3666) +++ branches/io_new/matlab/mio4.py 2007-12-15 21:04:05 UTC (rev 3667) @@ -3,7 +3,7 @@ import numpy as N -from scipy.io.matlab.miobase import * +from miobase import * miDOUBLE = 0 miSINGLE = 1 Modified: branches/io_new/matlab/mio5.py =================================================================== --- branches/io_new/matlab/mio5.py 2007-12-15 20:12:57 UTC (rev 3666) +++ branches/io_new/matlab/mio5.py 2007-12-15 21:04:05 UTC (rev 3667) @@ -31,7 +31,7 @@ from cStringIO import StringIO import numpy as N -from scipy.io.matlab.miobase import * +from miobase import * try: # Python 2.3 support from sets import Set as set Modified: branches/io_new/tests/test_mio.py =================================================================== --- branches/io_new/tests/test_mio.py 2007-12-15 20:12:57 UTC (rev 3666) +++ branches/io_new/tests/test_mio.py 2007-12-15 21:04:05 UTC (rev 3667) @@ -11,8 +11,8 @@ import scipy.sparse as SP set_package_path() -from scipy.io.matlab.mio import loadmat, savemat -from scipy.io.matlab.mio5 import mat_obj, mat_struct +from matlab.mio import loadmat, savemat +from matlab.mio5 import mat_obj, mat_struct restore_path() try: # Python 2.3 support From scipy-svn at scipy.org Sat Dec 15 17:19:51 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Dec 2007 16:19:51 -0600 (CST) Subject: [Scipy-svn] r3668 - branches/io_new Message-ID: <20071215221951.B012D39C02E@new.scipy.org> Author: brian.hawthorne Date: 2007-12-15 16:19:46 -0600 (Sat, 15 Dec 2007) New Revision: 3668 Modified: branches/io_new/__init__.py Log: remove broken import from data_store Modified: branches/io_new/__init__.py =================================================================== --- branches/io_new/__init__.py 2007-12-15 21:04:05 UTC (rev 3667) +++ branches/io_new/__init__.py 2007-12-15 22:19:46 UTC (rev 3668) @@ -18,7 +18,6 @@ from recaster import sctype_attributes, Recaster from array_import import read_array, write_array -from data_store import read_array, write_array from pickler import objload, objsave from mmio import mminfo, mmread, mmwrite From scipy-svn at scipy.org Sat Dec 15 17:40:28 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Dec 2007 16:40:28 -0600 (CST) Subject: [Scipy-svn] r3669 - branches/io_new Message-ID: <20071215224028.632DA39C0F2@new.scipy.org> Author: brian.hawthorne Date: 2007-12-15 16:39:53 -0600 (Sat, 15 Dec 2007) New Revision: 3669 Modified: branches/io_new/__init__.py branches/io_new/array_import.py branches/io_new/data_store.py branches/io_new/pickler.py Log: add stub deprecate_with_doc decorators Modified: branches/io_new/__init__.py =================================================================== --- branches/io_new/__init__.py 2007-12-15 22:19:46 UTC (rev 3668) +++ branches/io_new/__init__.py 2007-12-15 22:39:53 UTC (rev 3669) @@ -18,6 +18,8 @@ from recaster import sctype_attributes, Recaster from array_import import read_array, write_array +from data_store import save as save_as_module +from data_store import load, create_module, create_shelf from pickler import objload, objsave from mmio import mminfo, mmread, mmwrite Modified: branches/io_new/array_import.py =================================================================== --- branches/io_new/array_import.py 2007-12-15 22:19:46 UTC (rev 3668) +++ branches/io_new/array_import.py 2007-12-15 22:39:53 UTC (rev 3669) @@ -17,7 +17,13 @@ # Numpy imports. import numpy -from numpy import array, take, concatenate, asarray, real, imag + +# snip on----- DELETE after numpy.deprecate_with_doc is available +numpy.deprecate_with_doc = lambda doc: (lambda func: func) +# snip off---- DELETE after numpy.deprecate_with_doc is available + +from numpy import array, take, concatenate, asarray, real, imag, \ + deprecate_with_doc # Sadly, this module is still written with typecodes in mind. from numpy.oldnumeric import Float @@ -310,6 +316,7 @@ return cols, atype + at deprecate_with_doc('') def read_array(fileobject, separator=default, columns=default, comment="#", lines=default, atype=Float, linesep='\n', rowsize=10000, missing=0): @@ -437,6 +444,7 @@ return row_sep.join(thestr) + at deprecate_with_doc('') def write_array(fileobject, arr, separator=" ", linesep='\n', precision=5, suppress_small=0, keep_open=0): """Write a rank-2 or less array to file represented by fileobject. Modified: branches/io_new/data_store.py =================================================================== --- branches/io_new/data_store.py 2007-12-15 22:19:46 UTC (rev 3668) +++ branches/io_new/data_store.py 2007-12-15 22:39:53 UTC (rev 3669) @@ -19,6 +19,15 @@ import dumb_shelve import os +# snip on----- DELETE after numpy.deprecate_with_doc is available +import numpy +numpy.deprecate_with_doc = lambda doc: (lambda func: func) +# snip off---- DELETE after numpy.deprecate_with_doc is available + +from numpy deprecate_with_doc + + + at deprecate_with_doc('') def load(module): """ Load data into module from a shelf with the same name as the module. @@ -34,7 +43,7 @@ # print i, 'loaded...' # print 'done' -def save(file_name=None,data=None): +def save_as_module(file_name=None,data=None): """ Save the dictionary "data" into a module and shelf named save """ @@ -42,6 +51,9 @@ create_module(file_name) create_shelf(file_name,data) +save = @deprecate_with_doc('')(save_as_module) + + at deprecate_with_doc('') def create_module(file_name): """ Create the module file. """ @@ -53,6 +65,7 @@ f.write('data_store.load(%s)' % module_name) f.close() + at deprecate_with_doc('') def create_shelf(file_name,data): """Use this to write the data to a new file """ Modified: branches/io_new/pickler.py =================================================================== --- branches/io_new/pickler.py 2007-12-15 22:19:46 UTC (rev 3668) +++ branches/io_new/pickler.py 2007-12-15 22:39:53 UTC (rev 3669) @@ -1,5 +1,13 @@ import cPickle +# snip on----- DELETE after numpy.deprecate_with_doc is available +import numpy +numpy.deprecate_with_doc = lambda doc: (lambda func: func) +# snip off---- DELETE after numpy.deprecate_with_doc is available + +from numpy deprecate_with_doc + + at deprecate_with_doc('') def objsave(file, allglobals, *args): """Pickle the part of a dictionary containing the argument list into file string. From scipy-svn at scipy.org Sat Dec 15 17:58:24 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Dec 2007 16:58:24 -0600 (CST) Subject: [Scipy-svn] r3670 - branches/io_new Message-ID: <20071215225824.A9E9AC7C025@new.scipy.org> Author: brian.hawthorne Date: 2007-12-15 16:58:21 -0600 (Sat, 15 Dec 2007) New Revision: 3670 Modified: branches/io_new/__init__.py Log: more deprecation stubs Modified: branches/io_new/__init__.py =================================================================== --- branches/io_new/__init__.py 2007-12-15 22:39:53 UTC (rev 3669) +++ branches/io_new/__init__.py 2007-12-15 22:58:21 UTC (rev 3670) @@ -4,8 +4,18 @@ from info import __doc__ +# snip on----- DELETE after numpy.deprecate_with_doc is available +import numpy +numpy.deprecate_with_doc = lambda doc: (lambda func: func) +# snip off---- DELETE after numpy.deprecate_with_doc is available + +from numpy deprecate_with_doc + from numpyio import packbits, unpackbits, bswap, fread, fwrite, \ convert_objectarray +fread = deprecate_with_doc('')(fread) +fwrite = deprecate_with_doc('')(fwrite) +bswap = deprecate_with_doc('')(bswap) # matfile read and write from matlab.mio import loadmat, savemat From scipy-svn at scipy.org Sat Dec 15 22:59:37 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Dec 2007 21:59:37 -0600 (CST) Subject: [Scipy-svn] r3671 - branches/io_new Message-ID: <20071216035937.7C84A39C013@new.scipy.org> Author: brian.hawthorne Date: 2007-12-15 21:59:30 -0600 (Sat, 15 Dec 2007) New Revision: 3671 Modified: branches/io_new/__init__.py Log: fix syntax error Modified: branches/io_new/__init__.py =================================================================== --- branches/io_new/__init__.py 2007-12-15 22:58:21 UTC (rev 3670) +++ branches/io_new/__init__.py 2007-12-16 03:59:30 UTC (rev 3671) @@ -9,7 +9,7 @@ numpy.deprecate_with_doc = lambda doc: (lambda func: func) # snip off---- DELETE after numpy.deprecate_with_doc is available -from numpy deprecate_with_doc +from numpy import deprecate_with_doc from numpyio import packbits, unpackbits, bswap, fread, fwrite, \ convert_objectarray From scipy-svn at scipy.org Sat Dec 15 23:05:41 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Dec 2007 22:05:41 -0600 (CST) Subject: [Scipy-svn] r3672 - in branches/weave_cleanup/scipy/weave: . scxx tests Message-ID: <20071216040541.7C84839C034@new.scipy.org> Author: benjamin.ragan-kelley Date: 2007-12-15 22:05:12 -0600 (Sat, 15 Dec 2007) New Revision: 3672 Modified: branches/weave_cleanup/scipy/weave/c_spec.py branches/weave_cleanup/scipy/weave/inline_tools.py branches/weave_cleanup/scipy/weave/scxx/object.h branches/weave_cleanup/scipy/weave/tests/test_c_spec.py branches/weave_cleanup/scipy/weave/tests/test_numpy_scalar_spec.py branches/weave_cleanup/scipy/weave/tests/test_scxx_dict.py branches/weave_cleanup/scipy/weave/tests/test_scxx_object.py branches/weave_cleanup/scipy/weave/tests/test_scxx_sequence.py branches/weave_cleanup/scipy/weave/tests/test_wx_spec.py branches/weave_cleanup/scipy/weave/wx_spec.py Log: test cleanup Modified: branches/weave_cleanup/scipy/weave/c_spec.py =================================================================== --- branches/weave_cleanup/scipy/weave/c_spec.py 2007-12-16 03:59:30 UTC (rev 3671) +++ branches/weave_cleanup/scipy/weave/c_spec.py 2007-12-16 04:05:12 UTC (rev 3672) @@ -310,7 +310,7 @@ num_to_c_types['H'] = 'npy_ushort' num_to_c_types['i'] = 'int' num_to_c_types['I'] = 'npy_uint' - +num_to_c_types['?'] = 'bool' num_to_c_types['l'] = 'long' num_to_c_types['L'] = 'npy_ulong' Modified: branches/weave_cleanup/scipy/weave/inline_tools.py =================================================================== --- branches/weave_cleanup/scipy/weave/inline_tools.py 2007-12-16 03:59:30 UTC (rev 3671) +++ branches/weave_cleanup/scipy/weave/inline_tools.py 2007-12-16 04:05:12 UTC (rev 3672) @@ -340,7 +340,25 @@ # we try 3 levels here -- a local cache first, then the # catalog cache, and then persistent catalog. # - global function_cache + global function_catalog + # 1. try local cache + try: + results = apply(function_cache[code],(local_dict,global_dict)) + return results + except TypeError, msg: + msg = str(msg).strip() + if msg[:16] == "Conversion Error": + pass + else: + raise TypeError, msg + except NameError, msg: + msg = str(msg).strip() + if msg[:16] == "Conversion Error": + pass + else: + raise NameError, msg + except KeyError: + pass # 2. try catalog cache. function_list = function_catalog.get_functions_fast(code) for func in function_list: Modified: branches/weave_cleanup/scipy/weave/scxx/object.h =================================================================== --- branches/weave_cleanup/scipy/weave/scxx/object.h 2007-12-16 03:59:30 UTC (rev 3671) +++ branches/weave_cleanup/scipy/weave/scxx/object.h 2007-12-16 04:05:12 UTC (rev 3672) @@ -866,6 +866,10 @@ object _other = object(other); return operator=(_other); } + keyed_ref& operator=(const keyed_ref& other) { + object _other = object(other); + return operator=(_other); + } }; } // namespace Modified: branches/weave_cleanup/scipy/weave/tests/test_c_spec.py =================================================================== --- branches/weave_cleanup/scipy/weave/tests/test_c_spec.py 2007-12-16 03:59:30 UTC (rev 3671) +++ branches/weave_cleanup/scipy/weave/tests/test_c_spec.py 2007-12-16 04:05:12 UTC (rev 3672) @@ -17,6 +17,7 @@ restore_path() + def unique_mod(d,file_name): f = os.path.basename(unique_file(d,file_name)) m = os.path.splitext(f)[0] @@ -48,7 +49,24 @@ # Scalar conversion test classes # int, float, complex #---------------------------------------------------------------------------- -class TestIntConverter(NumpyTestCase): +# compilers = [] +# for c in ('gcc','msvc'): +# mod_name = 'empty' + c +# mod_name = unique_mod(test_dir,mod_name) +# mod = ext_tools.ext_module(mod_name) +# # a = 1 +# # code = "a=2;" +# # test = ext_tools.ext_function('test',code,['a']) +# # mod.add_function(test) +# try: +# mod.compile(location = test_dir, compiler = c) +# except CompileError: +# print "Probably don't have Compiler: %s"%c +# else: +# compilers.append(c) + + +class IntConverter(NumpyTestCase): compiler = '' def check_type_match_string(self,level=5): s = c_spec.int_converter() @@ -103,11 +121,11 @@ assert( c == 3) -class TestFloatConverter(NumpyTestCase): +class FloatConverter(NumpyTestCase): compiler = '' def check_type_match_string(self,level=5): s = c_spec.float_converter() - assert( not s.type_match('string') ) + assert( not s.type_match('string')) def check_type_match_int(self,level=5): s = c_spec.float_converter() assert(not s.type_match(5)) @@ -158,7 +176,7 @@ c = test(b) assert( c == 3.) -class TestComplexConverter(NumpyTestCase): +class ComplexConverter(NumpyTestCase): compiler = '' def check_type_match_string(self,level=5): s = c_spec.complex_converter() @@ -216,7 +234,7 @@ # File conversion tests #---------------------------------------------------------------------------- -class TestFileConverter(NumpyTestCase): +class FileConverter(NumpyTestCase): compiler = '' def check_py_to_file(self,level=5): import tempfile @@ -250,14 +268,14 @@ # Instance conversion tests #---------------------------------------------------------------------------- -class TestInstanceConverter(NumpyTestCase): +class InstanceConverter(NumpyTestCase): pass #---------------------------------------------------------------------------- # Callable object conversion tests #---------------------------------------------------------------------------- -class TestCallableConverter(NumpyTestCase): +class CallableConverter(NumpyTestCase): compiler='' def check_call_function(self,level=5): import string @@ -277,7 +295,7 @@ desired = func(search_str,sub_str) assert(desired == actual) -class TestSequenceConverter(NumpyTestCase): +class SequenceConverter(NumpyTestCase): compiler = '' def check_convert_to_dict(self,level=5): d = {} @@ -292,7 +310,7 @@ t = () inline_tools.inline("",['t'],compiler=self.compiler,force=1) -class TestStringConverter(NumpyTestCase): +class StringConverter(NumpyTestCase): compiler = '' def check_type_match_string(self,level=5): s = c_spec.string_converter() @@ -347,7 +365,7 @@ c = test(b) assert( c == 'hello') -class TestListConverter(NumpyTestCase): +class ListConverter(NumpyTestCase): compiler = '' def check_type_match_bad(self,level=5): s = c_spec.list_converter() @@ -458,7 +476,7 @@ print 'python:', t2 - t1 assert( sum1 == sum2 and sum1 == sum3) -class TestTupleConverter(NumpyTestCase): +class TupleConverter(NumpyTestCase): compiler = '' def check_type_match_bad(self,level=5): s = c_spec.tuple_converter() @@ -511,7 +529,7 @@ assert( c == ('hello',None)) -class TestDictConverter(NumpyTestCase): +class DictConverter(NumpyTestCase): """ Base Class for dictionary conversion tests. """ @@ -570,86 +588,100 @@ c = test(b) assert( c['hello'] == 5) -class TestMsvcIntConverter(TestIntConverter): - compiler = 'msvc' -class TestUnixIntConverter(TestIntConverter): - compiler = '' -class TestGccIntConverter(TestIntConverter): - compiler = 'gcc' +# for compiler in compilers: + # for name,klass in globals().iteritems(): + # if name[:4]=="Test" and name[-9:] == "Converter": + # exec("class %s%s(%s):\n compiler = '%s'"%(name,compiler,name,compiler)) +# for converter in +for _n in dir(): + if _n[-9:]=='Converter': + if msvc_exists(): + exec "class Test%sMsvc(%s):\n compiler = 'msvc'"%(_n,_n) + else: + exec "class Test%sUnix(%s):\n compiler = ''"%(_n,_n) + if gcc_exists(): + exec "class Test%sGcc(%s):\n compiler = 'gcc'"%(_n,_n) -class TestMsvcFloatConverter(TestFloatConverter): - compiler = 'msvc' +# class TestMsvcIntConverter(TestIntConverter): +# compiler = 'msvc' +# class TestUnixIntConverter(TestIntConverter): +# compiler = '' +# class TestGccIntConverter(TestIntConverter): +# compiler = 'gcc' +# +# class TestMsvcFloatConverter(TestFloatConverter): +# compiler = 'msvc' +# +# class TestMsvcFloatConverter(TestFloatConverter): +# compiler = 'msvc' +# class TestUnixFloatConverter(TestFloatConverter): +# compiler = '' +# class TestGccFloatConverter(TestFloatConverter): +# compiler = 'gcc' +# +# class TestMsvcComplexConverter(TestComplexConverter): +# compiler = 'msvc' +# class TestUnixComplexConverter(TestComplexConverter): +# compiler = '' +# class TestGccComplexConverter(TestComplexConverter): +# compiler = 'gcc' +# +# class TestMsvcFileConverter(TestFileConverter): +# compiler = 'msvc' +# class TestUnixFileConverter(TestFileConverter): +# compiler = '' +# class TestGccFileConverter(TestFileConverter): +# compiler = 'gcc' +# +# class TestMsvcCallableConverter(TestCallableConverter): +# compiler = 'msvc' +# class TestUnixCallableConverter(TestCallableConverter): +# compiler = '' +# class TestGccCallableConverter(TestCallableConverter): +# compiler = 'gcc' +# +# class TestMsvcSequenceConverter(TestSequenceConverter): +# compiler = 'msvc' +# class TestUnixSequenceConverter(TestSequenceConverter): +# compiler = '' +# class TestGccSequenceConverter(TestSequenceConverter): +# compiler = 'gcc' +# +# class TestMsvcStringConverter(TestStringConverter): +# compiler = 'msvc' +# class TestUnixStringConverter(TestStringConverter): +# compiler = '' +# class TestGccStringConverter(TestStringConverter): +# compiler = 'gcc' +# +# class TestMsvcListConverter(TestListConverter): +# compiler = 'msvc' +# class TestUnixListConverter(TestListConverter): +# compiler = '' +# class TestGccListConverter(TestListConverter): +# compiler = 'gcc' +# +# class TestMsvcTupleConverter(TestTupleConverter): +# compiler = 'msvc' +# class TestUnixTupleConverter(TestTupleConverter): +# compiler = '' +# class TestGccTupleConverter(TestTupleConverter): +# compiler = 'gcc' +# +# class TestMsvcDictConverter(TestDictConverter): +# compiler = 'msvc' +# class TestUnixDictConverter(TestDictConverter): +# compiler = '' +# class TestGccDictConverter(TestDictConverter): +# compiler = 'gcc' +# +# class TestMsvcInstanceConverter(TestInstanceConverter): +# compiler = 'msvc' +# class TestUnixInstanceConverter(TestInstanceConverter): +# compiler = '' +# class TestGccInstanceConverter(TestInstanceConverter): +# compiler = 'gcc' -class TestMsvcFloatConverter(TestFloatConverter): - compiler = 'msvc' -class TestUnixFloatConverter(TestFloatConverter): - compiler = '' -class TestGccFloatConverter(TestFloatConverter): - compiler = 'gcc' - -class TestMsvcComplexConverter(TestComplexConverter): - compiler = 'msvc' -class TestUnixComplexConverter(TestComplexConverter): - compiler = '' -class TestGccComplexConverter(TestComplexConverter): - compiler = 'gcc' - -class TestMsvcFileConverter(TestFileConverter): - compiler = 'msvc' -class TestUnixFileConverter(TestFileConverter): - compiler = '' -class TestGccFileConverter(TestFileConverter): - compiler = 'gcc' - -class TestMsvcCallableConverter(TestCallableConverter): - compiler = 'msvc' -class TestUnixCallableConverter(TestCallableConverter): - compiler = '' -class TestGccCallableConverter(TestCallableConverter): - compiler = 'gcc' - -class TestMsvcSequenceConverter(TestSequenceConverter): - compiler = 'msvc' -class TestUnixSequenceConverter(TestSequenceConverter): - compiler = '' -class TestGccSequenceConverter(TestSequenceConverter): - compiler = 'gcc' - -class TestMsvcStringConverter(TestStringConverter): - compiler = 'msvc' -class TestUnixStringConverter(TestStringConverter): - compiler = '' -class TestGccStringConverter(TestStringConverter): - compiler = 'gcc' - -class TestMsvcListConverter(TestListConverter): - compiler = 'msvc' -class TestUnixListConverter(TestListConverter): - compiler = '' -class TestGccListConverter(TestListConverter): - compiler = 'gcc' - -class TestMsvcTupleConverter(TestTupleConverter): - compiler = 'msvc' -class TestUnixTupleConverter(TestTupleConverter): - compiler = '' -class TestGccTupleConverter(TestTupleConverter): - compiler = 'gcc' - -class TestMsvcDictConverter(TestDictConverter): - compiler = 'msvc' -class TestUnixDictConverter(TestDictConverter): - compiler = '' -class TestGccDictConverter(TestDictConverter): - compiler = 'gcc' - -class TestMsvcInstanceConverter(TestInstanceConverter): - compiler = 'msvc' -class TestUnixInstanceConverter(TestInstanceConverter): - compiler = '' -class TestGccInstanceConverter(TestInstanceConverter): - compiler = 'gcc' - def setup_test_location(): import tempfile #test_dir = os.path.join(tempfile.gettempdir(),'test_files') @@ -671,16 +703,16 @@ def remove_file(name): test_dir = os.path.abspath(name) -if not msvc_exists(): - for _n in dir(): - if _n[:10]=='test_msvc_': exec 'del '+_n -else: - for _n in dir(): - if _n[:10]=='test_unix_': exec 'del '+_n - -if not (gcc_exists() and msvc_exists() and sys.platform == 'win32'): - for _n in dir(): - if _n[:9]=='test_gcc_': exec 'del '+_n - +# if not msvc_exists(): +# for _n in dir(): +# if _n[:8]=='TestMsvc': exec 'del '+_n +# else: +# for _n in dir(): +# if _n[:8]=='TestUnix': exec 'del '+_n +# +# if not (gcc_exists() and msvc_exists() and sys.platform == 'win32'): +# for _n in dir(): +# if _n[:7]=='TestGcc': exec 'del '+_n +# if __name__ == "__main__": NumpyTest('weave.c_spec').run() Modified: branches/weave_cleanup/scipy/weave/tests/test_numpy_scalar_spec.py =================================================================== --- branches/weave_cleanup/scipy/weave/tests/test_numpy_scalar_spec.py 2007-12-16 03:59:30 UTC (rev 3671) +++ branches/weave_cleanup/scipy/weave/tests/test_numpy_scalar_spec.py 2007-12-16 04:05:12 UTC (rev 3672) @@ -52,7 +52,7 @@ # int, float, complex #---------------------------------------------------------------------------- -class TestNumpyComplexScalarConverter(NumpyTestCase): +class NumpyComplexScalarConverter(NumpyTestCase): compiler = '' def setUp(self): @@ -112,15 +112,23 @@ result = inline_tools.inline("return_val=1.0/a;",['a']) assert( result==.5-.5j) -class TestMsvcNumpyComplexScalarConverter( - TestNumpyComplexScalarConverter): - compiler = 'msvc' -class TestUnixNumpyComplexScalarConverter( - TestNumpyComplexScalarConverter): - compiler = '' -class TestGccNumpyComplexScalarConverter( - TestNumpyComplexScalarConverter): - compiler = 'gcc' +# class TestMsvcNumpyComplexScalarConverter( +# TestNumpyComplexScalarConverter): +# compiler = 'msvc' +# class TestUnixNumpyComplexScalarConverter( +# TestNumpyComplexScalarConverter): +# compiler = '' +# class TestGccNumpyComplexScalarConverter( +# TestNumpyComplexScalarConverter): +# compiler = 'gcc' +for _n in dir(): + if _n[-9:]=='Converter': + if msvc_exists(): + exec "class Test%sMsvc(%s):\n compiler = 'msvc'"%(_n,_n) + else: + exec "class Test%sUnix(%s):\n compiler = ''"%(_n,_n) + if gcc_exists(): + exec "class Test%sGcc(%s):\n compiler = 'gcc'"%(_n,_n) def setup_test_location(): @@ -146,14 +154,14 @@ if not msvc_exists(): for _n in dir(): - if _n[:10]=='test_msvc_': exec 'del '+_n + if _n[:8]=='TestMsvc': exec 'del '+_n else: for _n in dir(): - if _n[:10]=='test_unix_': exec 'del '+_n + if _n[:8]=='TestUnix': exec 'del '+_n if not (gcc_exists() and msvc_exists() and sys.platform == 'win32'): for _n in dir(): - if _n[:9]=='test_gcc_': exec 'del '+_n + if _n[:7]=='TestGcc': exec 'del '+_n if __name__ == "__main__": NumpyTest('weave.numpy_scalar_spec').run() Modified: branches/weave_cleanup/scipy/weave/tests/test_scxx_dict.py =================================================================== --- branches/weave_cleanup/scipy/weave/tests/test_scxx_dict.py 2007-12-16 03:59:30 UTC (rev 3671) +++ branches/weave_cleanup/scipy/weave/tests/test_scxx_dict.py 2007-12-16 04:05:12 UTC (rev 3672) @@ -34,7 +34,7 @@ a = {} a[key] = 12345 code = """ - return_val = key in a; + return_val = a.has_key(key); """ res = inline_tools.inline(code,['a','key']) assert res @@ -42,7 +42,7 @@ a = {} a[1234] = 12345 code = """ - return_val = 1234 in a; + return_val = a.has_key(1234); """ res = inline_tools.inline(code,['a']) assert res @@ -50,7 +50,7 @@ a = {} a[1234.] = 12345 code = """ - return_val = 1234. in a; + return_val = a.has_key(1234.); """ res = inline_tools.inline(code,['a']) assert res @@ -59,7 +59,7 @@ a[1+1j] = 12345 key = 1+1j code = """ - return_val = key in a; + return_val = a.has_key(key); """ res = inline_tools.inline(code,['a','key']) assert res @@ -68,7 +68,7 @@ a = {} a["b"] = 12345 code = """ - return_val = "b" in a; + return_val = a.has_key("b"); """ res = inline_tools.inline(code,['a']) assert res @@ -77,7 +77,7 @@ a["b"] = 12345 key_name = "b" code = """ - return_val = key_name in a; + return_val = a.has_key(key_name); """ res = inline_tools.inline(code,['a','key_name']) assert res @@ -85,7 +85,7 @@ a = {} a["b"] = 12345 code = """ - return_val = "c" in a; + return_val = a.has_key("c"); """ res = inline_tools.inline(code,['a']) assert not res Modified: branches/weave_cleanup/scipy/weave/tests/test_scxx_object.py =================================================================== --- branches/weave_cleanup/scipy/weave/tests/test_scxx_object.py 2007-12-16 03:59:30 UTC (rev 3671) +++ branches/weave_cleanup/scipy/weave/tests/test_scxx_object.py 2007-12-16 04:05:12 UTC (rev 3672) @@ -483,7 +483,7 @@ return (1,2,3) res = inline_tools.inline('return_val = Foo.call();',['Foo']) assert_equal(res,(1,2,3)) - assert_equal(sys.getrefcount(res),2) + assert_equal(sys.getrefcount(res),3) # should be 2? def check_args(self,level=5): def Foo(val1,val2): return (val1,val2) @@ -649,18 +649,6 @@ res = inline_tools.inline('return_val = a.is_true();',['a']) assert_equal(res,0) -class TestObjectIsTrue(NumpyTestCase): - def check_false(self,level=5): - class Foo: - pass - a= Foo() - res = inline_tools.inline('return_val = a.mcall("not");',['a']) - assert_equal(res,0) - def check_true(self,level=5): - a= None - res = inline_tools.inline('return_val = a.mcall("not");',['a']) - assert_equal(res,1) - class TestObjectType(NumpyTestCase): def check_type(self,level=5): class Foo: @@ -787,7 +775,7 @@ a = UserDict() key = 1+1j inline_tools.inline("a[key] = 1234;",['a','key']) - assert_equal(sys.getrefcount(key),3) + assert_equal(sys.getrefcount(key),4) # should be 3 assert_equal(sys.getrefcount(a[key]),2) assert_equal(a[key],1234) def check_set_char(self,level=5): Modified: branches/weave_cleanup/scipy/weave/tests/test_scxx_sequence.py =================================================================== --- branches/weave_cleanup/scipy/weave/tests/test_scxx_sequence.py 2007-12-16 03:59:30 UTC (rev 3671) +++ branches/weave_cleanup/scipy/weave/tests/test_scxx_sequence.py 2007-12-16 04:05:12 UTC (rev 3672) @@ -24,14 +24,13 @@ seq_type = None def check_conversion(self,level=5): - a = self.seq_type([]) + a = self.seq_type([1]) before = sys.getrefcount(a) - import weave - weave.inline("",['a']) + inline_tools.inline(" ",['a']) #print 'first:',before # first call is goofing up refcount. before = sys.getrefcount(a) - weave.inline("",['a']) + inline_tools.inline(" ",['a']) after = sys.getrefcount(a) #print '2nd,3rd:', before, after assert(after == before) @@ -399,7 +398,7 @@ const int N = a.length(); std::string blah = std::string("blah"); for(int i=0; i < N; i++) - b[i] = (std::string)a[i] + blah; + b[i] = convert_to_string(a[i],"a") + blah; """ # compile not included in timing inline_tools.inline(code,['a','b']) @@ -435,4 +434,4 @@ assert b == desired if __name__ == "__main__": - NumpyTest().run() + NumpyTest().test(10,10) Modified: branches/weave_cleanup/scipy/weave/tests/test_wx_spec.py =================================================================== --- branches/weave_cleanup/scipy/weave/tests/test_wx_spec.py 2007-12-16 03:59:30 UTC (rev 3671) +++ branches/weave_cleanup/scipy/weave/tests/test_wx_spec.py 2007-12-16 04:05:12 UTC (rev 3672) @@ -40,7 +40,7 @@ assert(self.s.type_match(f)) def check_var_in(self,level=5): - mod = ext_tools.ext_module('wx_var_in',compiler='msvc') + mod = ext_tools.ext_module('wx_var_in',compiler='') mod.customize.add_header('') mod.customize.add_extra_compile_arg(' '.join(self.s.extra_compile_args)) mod.customize.add_extra_link_arg(' '.join(self.s.extra_link_args)) @@ -61,12 +61,12 @@ try: b = 1. wx_var_in.test(b) - except TypeError: + except AttributeError: pass try: b = 1 wx_var_in.test(b) - except TypeError: + except AttributeError: pass def no_check_var_local(self,level=5): @@ -102,4 +102,4 @@ import sys if len(sys.argv) == 1: sys.argv.extend(["--level=5"]) - NumpyTest().run() + NumpyTest().test(10,10) Modified: branches/weave_cleanup/scipy/weave/wx_spec.py =================================================================== --- branches/weave_cleanup/scipy/weave/wx_spec.py 2007-12-16 03:59:30 UTC (rev 3671) +++ branches/weave_cleanup/scipy/weave/wx_spec.py 2007-12-16 04:05:12 UTC (rev 3672) @@ -141,7 +141,7 @@ def type_match(self,value): is_match = 0 try: - wx_class = value.this.split('_')[-2] + wx_class = str(value.this).split('_')[-1] if wx_class[:2] == 'wx': is_match = 1 except AttributeError: @@ -166,7 +166,7 @@ def type_spec(self,name,value): # factory - class_name = value.this.split('_')[-2] + class_name = str(value.this).split('_')[-1] new_spec = self.__class__(class_name) new_spec.name = name return new_spec From scipy-svn at scipy.org Sat Dec 15 23:06:57 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Dec 2007 22:06:57 -0600 (CST) Subject: [Scipy-svn] r3673 - trunk/scipy/sandbox/fdfpack/src Message-ID: <20071216040657.D894439C034@new.scipy.org> Author: oliphant Date: 2007-12-15 22:06:55 -0600 (Sat, 15 Dec 2007) New Revision: 3673 Removed: trunk/scipy/sandbox/fdfpack/src/32250.pdf Log: Remove paper. Deleted: trunk/scipy/sandbox/fdfpack/src/32250.pdf =================================================================== (Binary files differ) From scipy-svn at scipy.org Sat Dec 15 23:35:28 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Dec 2007 22:35:28 -0600 (CST) Subject: [Scipy-svn] r3674 - branches/io_new Message-ID: <20071216043528.41D9339C013@new.scipy.org> Author: brian.hawthorne Date: 2007-12-15 22:35:23 -0600 (Sat, 15 Dec 2007) New Revision: 3674 Modified: branches/io_new/data_store.py branches/io_new/pickler.py Log: fix syntax errors Modified: branches/io_new/data_store.py =================================================================== --- branches/io_new/data_store.py 2007-12-16 04:06:55 UTC (rev 3673) +++ branches/io_new/data_store.py 2007-12-16 04:35:23 UTC (rev 3674) @@ -24,7 +24,7 @@ numpy.deprecate_with_doc = lambda doc: (lambda func: func) # snip off---- DELETE after numpy.deprecate_with_doc is available -from numpy deprecate_with_doc +from numpy import deprecate_with_doc @deprecate_with_doc('') @@ -51,7 +51,7 @@ create_module(file_name) create_shelf(file_name,data) -save = @deprecate_with_doc('')(save_as_module) +save = deprecate_with_doc('')(save_as_module) @deprecate_with_doc('') def create_module(file_name): Modified: branches/io_new/pickler.py =================================================================== --- branches/io_new/pickler.py 2007-12-16 04:06:55 UTC (rev 3673) +++ branches/io_new/pickler.py 2007-12-16 04:35:23 UTC (rev 3674) @@ -5,7 +5,7 @@ numpy.deprecate_with_doc = lambda doc: (lambda func: func) # snip off---- DELETE after numpy.deprecate_with_doc is available -from numpy deprecate_with_doc +from numpy import deprecate_with_doc @deprecate_with_doc('') def objsave(file, allglobals, *args): From scipy-svn at scipy.org Sat Dec 15 23:35:46 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Dec 2007 22:35:46 -0600 (CST) Subject: [Scipy-svn] r3675 - branches/io_new Message-ID: <20071216043546.A55FD39C013@new.scipy.org> Author: brian.hawthorne Date: 2007-12-15 22:35:42 -0600 (Sat, 15 Dec 2007) New Revision: 3675 Modified: branches/io_new/mmio.py Log: cleanup, factoring Modified: branches/io_new/mmio.py =================================================================== --- branches/io_new/mmio.py 2007-12-16 04:35:23 UTC (rev 3674) +++ branches/io_new/mmio.py 2007-12-16 04:35:42 UTC (rev 3675) @@ -14,8 +14,10 @@ empty, concatenate, ones, ascontiguousarray from itertools import izip -__all__ = ['mminfo','mmread','mmwrite'] +__all__ = ['mminfo','mmread','mmwrite', 'MMFile'] + +#------------------------------------------------------------------------------- def mminfo(source): """ Queries the contents of the Matrix Market file 'filename' to extract size and storage information. @@ -29,51 +31,13 @@ rows,cols - number of matrix rows and columns entries - number of non-zero entries of a sparse matrix or rows*cols for a dense matrix - rep - 'coordinate' | 'array' + format - 'coordinate' | 'array' field - 'real' | 'complex' | 'pattern' | 'integer' symm - 'general' | 'symmetric' | 'skew-symmetric' | 'hermitian' """ - close_it = 0 - if type(source) is type(''): - if not os.path.isfile(source): - if source[-4:] != '.mtx': - source = source + '.mtx' - source = open(source,'r') - close_it = 1 - line = source.readline().split() - if not line[0].startswith('%%MatrixMarket'): - raise ValueError,'source is not in Matrix Market format' + return MMFile.info(source) - assert len(line)==5,`line` - - assert line[1].strip().lower()=='matrix',`line` - - rep = line[2].strip().lower() - if rep=='dense': rep='array' - elif rep=='sparse': rep='coordinate' - - field = line[3].strip().lower() - - symm = line[4].strip().lower() - - while line: - line = source.readline() - if line.startswith('%'): - continue - line = line.split() - if rep=='array': - assert len(line)==2,`line` - rows,cols = map(eval,line) - entries = rows*cols - else: - assert len(line)==3,`line` - rows,cols,entries = map(eval,line) - break - - if close_it: - source.close() - return (rows,cols,entries,rep,field,symm) - +#------------------------------------------------------------------------------- def mmread(source): """ Reads the contents of a Matrix Market file 'filename' into a matrix. @@ -86,313 +50,525 @@ a - sparse or full matrix """ - close_it = 0 - if type(source) is type(''): - if not os.path.isfile(source): - if os.path.isfile(source+'.mtx'): - source = source + '.mtx' - elif os.path.isfile(source+'.mtx.gz'): - source = source + '.mtx.gz' - if source[-3:] == '.gz': - import gzip - source = gzip.open(source) - else: - source = open(source,'r') - close_it = 1 + return MMFile().read(source) - rows,cols,entries,rep,field,symm = mminfo(source) +#------------------------------------------------------------------------------- +def mmwrite(target, a, comment='', field=None, precision=None): + """ Writes the sparse or dense matrix A to a Matrix Market formatted file. - try: - from scipy.sparse import coo_matrix - except ImportError: - coo_matrix = None + Inputs: - if field=='integer': - dtype='i' - elif field=='real': - dtype='d' - elif field=='complex': - dtype='D' - elif field=='pattern': - dtype='d' - else: - raise ValueError,`field` + target - Matrix Market filename (extension .mtx) or open file object + a - sparse or full matrix + comment - comments to be prepended to the Matrix Market file + field - 'real' | 'complex' | 'pattern' | 'integer' + precision - Number of digits to display for real or complex values. + """ + MMFile().write(target, a, comment, field, precision) - has_symmetry = symm in ['symmetric','skew-symmetric','hermitian'] - is_complex = field=='complex' - is_skew = symm=='skew-symmetric' - is_herm = symm=='hermitian' - is_pattern = field=='pattern' - if rep == 'array': - a = zeros((rows,cols),dtype=dtype) - line = 1 - i,j = 0,0 - while line: +################################################################################ +class MMFile (object): + __slots__ = ( + '_rows', + '_cols', + '_entries', + '_format', + '_field', + '_symmetry') + + @property + def rows(self): return self._rows + @property + def cols(self): return self._cols + @property + def entries(self): return self._entries + @property + def format(self): return self._format + @property + def field(self): return self._field + @property + def symmetry(self): return self._symmetry + + @property + def has_symmetry(self): + return self._symmetry in (self.SYMMETRY_SYMMETRIC, + self.SYMMETRY_SKEW_SYMMETRIC, self.SYMMETRY_HERMITIAN) + + # format values + FORMAT_COORDINATE = 'coordinate' + FORMAT_ARRAY = 'array' + FORMAT_VALUES = (FORMAT_COORDINATE, FORMAT_ARRAY) + + @classmethod + def _validate_format(self, format): + if format not in self.FORMAT_VALUES: + raise ValueError,'unknown format type %s, must be one of %s'% \ + (`format`, `self.FORMAT_VALUES`) + + # field values + FIELD_INTEGER = 'integer' + FIELD_REAL = 'real' + FIELD_COMPLEX = 'complex' + FIELD_PATTERN = 'pattern' + FIELD_VALUES = (FIELD_INTEGER, FIELD_REAL, FIELD_COMPLEX, FIELD_PATTERN) + + @classmethod + def _validate_field(self, field): + if field not in self.FIELD_VALUES: + raise ValueError,'unknown field type %s, must be one of %s'% \ + (`field`, `self.FIELD_VALUES`) + + # symmetry values + SYMMETRY_GENERAL = 'general' + SYMMETRY_SYMMETRIC = 'symmetric' + SYMMETRY_SKEW_SYMMETRIC = 'skew-symmetric' + SYMMETRY_HERMITIAN = 'hermitian' + SYMMETRY_VALUES = ( + SYMMETRY_GENERAL, SYMMETRY_SYMMETRIC, SYMMETRY_SKEW_SYMMETRIC, + SYMMETRY_HERMITIAN) + + @classmethod + def _validate_symmetry(self, symmetry): + if symmetry not in self.SYMMETRY_VALUES: + raise ValueError,'unknown symmetry type %s, must be one of %s'% \ + (`symmetry`, `self.SYMMETRY_VALUES`) + + DTYPES_BY_FIELD = { + FIELD_INTEGER: 'i', + FIELD_REAL: 'd', + FIELD_COMPLEX:'D', + FIELD_PATTERN:'d'} + + #--------------------------------------------------------------------------- + @staticmethod + def reader(): pass + + #--------------------------------------------------------------------------- + @staticmethod + def writer(): pass + + #--------------------------------------------------------------------------- + @classmethod + def info(self, source): + source, close_it = self._open(source) + + try: + + # read and validate header line line = source.readline() - if not line or line.startswith('%'): - continue - if is_complex: - aij = complex(*map(float,line.split())) + mmid, matrix, format, field, symmetry = \ + [part.strip().lower() for part in line.split()] + if not mmid.startswith('%%matrixmarket'): + raise ValueError,'source is not in Matrix Market format' + + assert matrix == 'matrix',`line` + + # ??? Is this necessary? I don't see 'dense' or 'sparse' in the spec + # http://math.nist.gov/MatrixMarket/formats.html + if format == 'dense': format = self.FORMAT_ARRAY + elif format == 'sparse': format = self.FORMAT_COORDINATE + + # skip comments + while line.startswith('%'): line = source.readline() + + line = line.split() + if format == self.FORMAT_ARRAY: + assert len(line)==2,`line` + rows,cols = map(float, line) + entries = rows*cols else: - aij = float(line) - a[i,j] = aij - if has_symmetry and i!=j: - if is_skew: - a[j,i] = -aij - elif is_herm: - a[j,i] = conj(aij) + assert len(line)==3,`line` + rows, cols, entries = map(float, line) + + return (rows, cols, entries, format, field, symmetry) + + finally: + if close_it: source.close() + + #--------------------------------------------------------------------------- + @staticmethod + def _open(filespec, mode='r'): + """ + Return an open file stream for reading based on source. If source is + a file name, open it (after trying to find it with mtx and gzipped mtx + extensions). Otherwise, just return source. + """ + close_it = False + if type(filespec) is type(''): + close_it = True + + # open for reading + if mode[0] == 'r': + + # determine filename plus extension + if not os.path.isfile(filespec): + if os.path.isfile(filespec+'.mtx'): + filespec = filespec + '.mtx' + elif os.path.isfile(filespec+'.mtx.gz'): + filespec = filespec + '.mtx.gz' + # open filename + if filespec[-3:] == '.gz': + import gzip + stream = gzip.open(filespec, mode) else: - a[j,i] = aij - if i base 0) - J -= 1 + finally: + if close_it: stream.close() - if has_symmetry: - mask = (I != J) #off diagonal mask - od_I = I[mask] - od_J = J[mask] - od_V = V[mask] + #--------------------------------------------------------------------------- + def write(self, target, a, comment='', field=None, precision=None): + stream, close_it = self._open(target, 'w') - I = concatenate((I,od_J)) - J = concatenate((J,od_I)) + try: + self._write(stream, a, comment, field, precision) - if is_skew: - od_V *= -1 - elif is_herm: - od_V = od_V.conjugate() + finally: + if close_it: stream.close() + else: stream.flush() - V = concatenate((V,od_V)) - a = coo_matrix((V, (I, J)), dims=(rows, cols), dtype=dtype) - else: - raise NotImplementedError,`rep` + #--------------------------------------------------------------------------- + def _init_attrs(self, **kwargs): + """ + Initialize each attributes with the corresponding keyword arg value + or a default of None + """ + attrs = self.__class__.__slots__ + public_attrs = [attr[1:] for attr in attrs] + invalid_keys = set(kwargs.keys()) - set(public_attrs) + + if invalid_keys: + raise ValueError, \ + 'found %s invalid keyword arguments, please only use %s' % \ + (`tuple(invalid_keys)`, `public_attrs`) - if close_it: - source.close() - return a + for attr in attrs: setattr(self, attr, kwargs.get(attr[1:], None)) -def mmwrite(target,a,comment='',field=None,precision=None): - """ Writes the sparse or dense matrix A to a Matrix Market formatted file. + #--------------------------------------------------------------------------- + def _parse_header(self, stream): + rows, cols, entries, format, field, symmetry = \ + self.__class__.info(stream) + self._init_attrs(rows=rows, cols=cols, entries=entries, format=format, + field=field, symmetry=symmetry) - Inputs: + #--------------------------------------------------------------------------- + def _parse_body(self, stream): + rows, cols, entries, format, field, symm = \ + (self.rows, self.cols, self.entries, self.format, self.field, self.symmetry) - target - Matrix Market filename (extension .mtx) or open file object - a - sparse or full matrix - comment - comments to be prepended to the Matrix Market file - field - 'real' | 'complex' | 'pattern' | 'integer' - precision - Number of digits to display for real or complex values. - """ - close_it = 0 - if type(target) is type(''): - if target[-4:] != '.mtx': - target = target + '.mtx' - target = open(target,'w') - close_it = 1 + try: + from scipy.sparse import coo_matrix + except ImportError: + coo_matrix = None - if isinstance(a, list) or isinstance(a, ndarray) or isinstance(a, tuple) or hasattr(a,'__array__'): - rep = 'array' - a = asarray(a) - if len(a.shape) != 2: - raise ValueError, 'expected matrix' - rows,cols = a.shape - entries = rows*cols - typecode = a.dtype.char - if field is not None: - if field=='integer': - a = a.astype('i') - elif field=='real': - if typecode not in 'fd': - a = a.astype('d') - elif field=='complex': - if typecode not in 'FD': - a = a.astype('D') - elif field=='pattern': - pass + dtype = self.DTYPES_BY_FIELD.get(field, None) + + has_symmetry = self.has_symmetry + is_complex = field == self.FIELD_COMPLEX + is_skew = symm == self.SYMMETRY_SKEW_SYMMETRIC + is_herm = symm == self.SYMMETRY_HERMITIAN + is_pattern = field == self.FIELD_PATTERN + + if format == self.FORMAT_ARRAY: + a = zeros((rows,cols),dtype=dtype) + line = 1 + i,j = 0,0 + while line: + line = stream.readline() + if not line or line.startswith('%'): + continue + if is_complex: + aij = complex(*map(float,line.split())) + else: + aij = float(line) + a[i,j] = aij + if has_symmetry and i!=j: + if is_skew: + a[j,i] = -aij + elif is_herm: + a[j,i] = conj(aij) + else: + a[j,i] = aij + if i base 0) + J -= 1 + + if has_symmetry: + mask = (I != J) #off diagonal mask + od_I = I[mask] + od_J = J[mask] + od_V = V[mask] + + I = concatenate((I,od_J)) + J = concatenate((J,od_I)) + + if is_skew: + od_V *= -1 + elif is_herm: + od_V = od_V.conjugate() + + V = concatenate((V,od_V)) + + a = coo_matrix((V, (I, J)), dims=(rows, cols), dtype=dtype) else: - precision = 16 - if field is None: - if typecode in 'li': - field = 'integer' - elif typecode in 'df': - field = 'real' - elif typecode in 'DF': - field = 'complex' - else: - raise TypeError,'unexpected typecode '+typecode + raise NotImplementedError,`format` - if rep == 'array': - symm = _get_symmetry(a) - else: - symm = 'general' + return a - target.write('%%%%MatrixMarket matrix %s %s %s\n' % (rep,field,symm)) + #--------------------------------------------------------------------------- + def _write(self, stream, a, comment='', field=None, precision=None): - for line in comment.split('\n'): - target.write('%%%s\n' % (line)) + if isinstance(a, list) or isinstance(a, ndarray) or isinstance(a, tuple) or hasattr(a,'__array__'): + rep = self.FORMAT_ARRAY + a = asarray(a) + if len(a.shape) != 2: + raise ValueError, 'expected matrix' + rows,cols = a.shape + entries = rows*cols - if field in ['real','integer']: - if field=='real': - format = '%%.%ie\n' % precision + if field is not None: + + if field == self.FIELD_INTEGER: + a = a.astype('i') + elif field == self.FIELD_REAL: + if a.dtype.char not in 'fd': + a = a.astype('d') + elif field == self.FIELD_COMPLEX: + if a.dtype.char not in 'FD': + a = a.astype('D') + else: - format = '%i\n' - elif field=='complex': - format = '%%.%ie %%.%ie\n' % (precision,precision) + from scipy.sparse import spmatrix + if not isinstance(a,spmatrix): + raise ValueError,'unknown matrix type ' + `type(a)` + rep = 'coordinate' + rows, cols = a.shape + entries = a.getnnz() - if rep == 'array': - target.write('%i %i\n' % (rows,cols)) - if field in ['real','integer']: - if symm=='general': - for j in range(cols): - for i in range(rows): - target.write(format % a[i,j]) + typecode = a.dtype.char + + if precision is None: + if typecode in 'fF': + precision = 8 else: - for j in range(cols): - for i in range(j,rows): - target.write(format % a[i,j]) - elif field=='complex': - if symm=='general': - for j in range(cols): - for i in range(rows): - aij = a[i,j] - target.write(format % (real(aij),imag(aij))) + precision = 16 + + if field is None: + if typecode in 'li': + field = 'integer' + elif typecode in 'df': + field = 'real' + elif typecode in 'DF': + field = 'complex' else: - for j in range(cols): - for i in range(j,rows): - aij = a[i,j] - target.write(format % (real(aij),imag(aij))) - elif field=='pattern': - raise ValueError,'Pattern type inconsisted with dense matrix' + raise TypeError,'unexpected typecode '+typecode + + if rep == self.FORMAT_ARRAY: + symm = self._get_symmetry(a) else: - raise TypeError,'Unknown matrix type '+`field` - else: - format = '%i %i ' + format - target.write('%i %i %i\n' % (rows,cols,entries)) - assert symm=='general',`symm` + symm = self.SYMMETRY_GENERAL - coo = a.tocoo() # convert to COOrdinate format - I,J,V = coo.row + 1, coo.col + 1, coo.data # change base 0 -> base 1 + # validate rep, field, and symmetry + self.__class__._validate_format(rep) + self.__class__._validate_field(field) + self.__class__._validate_symmetry(symm) - if field in ['real','integer']: - for ijv_tuple in izip(I,J,V): - target.writelines(format % ijv_tuple) - elif field=='complex': - for ijv_tuple in izip(I,J,V.real,V.imag): - target.writelines(format % ijv_tuple) - elif field=='pattern': - raise NotImplementedError,`field` + # write initial header line + stream.write('%%%%MatrixMarket matrix %s %s %s\n' % (rep,field,symm)) + + # write comments + for line in comment.split('\n'): + stream.write('%%%s\n' % (line)) + + + template = self._field_template(field, precision) + + # write dense format + if rep == self.FORMAT_ARRAY: + + # write shape spec + stream.write('%i %i\n' % (rows,cols)) + + if field in (self.FIELD_INTEGER, self.FIELD_REAL): + + if symm == self.SYMMETRY_GENERAL: + for j in range(cols): + for i in range(rows): + stream.write(template % a[i,j]) + else: + for j in range(cols): + for i in range(j,rows): + stream.write(template % a[i,j]) + + elif field == self.FIELD_COMPLEX: + + if symm == self.SYMMETRY_GENERAL: + for j in range(cols): + for i in range(rows): + aij = a[i,j] + stream.write(template % (real(aij),imag(aij))) + else: + for j in range(cols): + for i in range(j,rows): + aij = a[i,j] + stream.write(template % (real(aij),imag(aij))) + + elif field == self.FIELD_PATTERN: + raise ValueError,'pattern type inconsisted with dense format' + + else: + raise TypeError,'Unknown field type %s'% `field` + + # write sparse format else: - raise TypeError,'Unknown matrix type '+`field` - if close_it: - target.close() - else: - target.flush() - return + if symm != self.SYMMETRY_GENERAL: + raise ValueError, 'symmetric matrices incompatible with sparse format' -def _get_symmetry(a): - m,n = a.shape - if m!=n: - return 'general' - issymm = 1 - isskew = 1 - isherm = a.dtype.char in 'FD' - for j in range(n): - for i in range(j+1,n): - aij,aji = a[i][j],a[j][i] - if issymm and aij != aji: - issymm = 0 - if isskew and aij != -aji: - isskew = 0 - if isherm and aij != conj(aji): - isherm = 0 - if not (issymm or isskew or isherm): - break - if issymm: return 'symmetric' - if isskew: return 'skew-symmetric' - if isherm: return 'hermitian' - return 'general' + # write shape spec + stream.write('%i %i %i\n' % (rows,cols,entries)) + # line template + template = '%i %i ' + template + + coo = a.tocoo() # convert to COOrdinate format + I,J,V = coo.row + 1, coo.col + 1, coo.data # change base 0 -> base 1 + + if field in (self.FIELD_REAL, self.FIELD_INTEGER): + for ijv_tuple in izip(I,J,V): + stream.writelines(template % ijv_tuple) + elif field == self.FIELD_COMPLEX: + for ijv_tuple in izip(I,J,V.real,V.imag): + stream.writelines(template % ijv_tuple) + elif field == self.FIELD_PATTERN: + raise NotImplementedError,`field` + else: + raise TypeError,'Unknown field type %s'% `field` + + +#------------------------------------------------------------------------------- if __name__ == '__main__': import sys import time From scipy-svn at scipy.org Sun Dec 16 17:09:30 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 16 Dec 2007 16:09:30 -0600 (CST) Subject: [Scipy-svn] r3676 - trunk/scipy/sparse Message-ID: <20071216220930.B50B939C0B7@new.scipy.org> Author: wnbell Date: 2007-12-16 16:08:50 -0600 (Sun, 16 Dec 2007) New Revision: 3676 Modified: trunk/scipy/sparse/coo.py trunk/scipy/sparse/csc.py trunk/scipy/sparse/csr.py Log: updated some sparse docstrings Modified: trunk/scipy/sparse/coo.py =================================================================== --- trunk/scipy/sparse/coo.py 2007-12-16 04:35:42 UTC (rev 3675) +++ trunk/scipy/sparse/coo.py 2007-12-16 22:08:50 UTC (rev 3676) @@ -12,34 +12,68 @@ from sputils import upcast, to_native, isshape, getdtype class coo_matrix(spmatrix): - """ A sparse matrix in coordinate list format. + """A sparse matrix in COOrdinate format. + Also known as the 'ijv' or 'triplet' format. - COO matrices are created either as: - A = coo_matrix( (m, n), [dtype]) - for a zero matrix, or as: - A = coo_matrix(S) - where S is a sparse matrix, or as: - A = coo_matrix(M) - where M is a dense matrix or rank 2 ndarray, or as: - A = coo_matrix((obj, ij), [shape]) - where the dimensions are optional. If supplied, we set (M, N) = shape. - If not supplied, we infer these from the index arrays: - ij[0][:] and ij[1][:] + This can be instantiated in several ways: + - coo_matrix(D) + with a dense matrix D - The arguments 'obj' and 'ij' represent three arrays: - 1. obj[:] the entries of the matrix, in any order - 2. ij[0][:] the row indices of the matrix entries - 3. ij[1][:] the column indices of the matrix entries + - coo_matrix(S) + with another sparse matrix S (equivalent to S.tocoo()) - So the following holds: - A[ij[0][k], ij[1][k] = obj[k] + - coo_matrix((M, N), [dtype]) + to construct an empty matrix with shape (M, N) + dtype is optional, defaulting to dtype='d'. + - coo_matrix((data, ij), [shape=(M, N)]) + When shape is not specified, it is inferred from the index arrays: + ij[0][:] and ij[1][:] + + The arguments 'data' and 'ij' represent three arrays: + 1. data[:] the entries of the matrix, in any order + 2. ij[0][:] the row indices of the matrix entries + 3. ij[1][:] the column indices of the matrix entries + + So the following holds: + A[ij[0][k], ij[1][k] = data[k] + Note: When converting to CSR or CSC format, duplicate (i,j) entries will be summed together. This facilitates efficient construction of finite element matrices and the like. + *Examples* + ---------- + + >>> from scipy.sparse import * + >>> from scipy import * + >>> coo_matrix( (3,4), dtype='i' ).todense() + matrix([[0, 0, 0, 0], + [0, 0, 0, 0], + [0, 0, 0, 0]]) + + >>> row = array([0,3,1,0]) + >>> col = array([0,3,1,2]) + >>> data = array([4,5,7,9]) + >>> coo_matrix( (data,(row,col)), shape=(4,4) ).todense() + matrix([[4, 0, 9, 0], + [0, 7, 0, 0], + [0, 0, 0, 0], + [0, 0, 0, 5]]) + + >>> print "example with duplicates" + >>> row = array([0,0,1,3,1,0,0]) + >>> col = array([0,2,1,3,1,0,0]) + >>> data = array([1,1,1,1,1,1,1]) + >>> coo_matrix( (data,(row,col)), shape=(4,4)).todense() + matrix([[3, 0, 1, 0], + [0, 2, 0, 0], + [0, 0, 0, 0], + [0, 0, 0, 1]]) + """ + def __init__(self, arg1, shape=None, dtype=None, copy=False, dims=None): spmatrix.__init__(self) Modified: trunk/scipy/sparse/csc.py =================================================================== --- trunk/scipy/sparse/csc.py 2007-12-16 04:35:42 UTC (rev 3675) +++ trunk/scipy/sparse/csc.py 2007-12-16 22:08:50 UTC (rev 3676) @@ -18,26 +18,61 @@ class csc_matrix(_cs_matrix): - """ Compressed sparse column matrix - This can be instantiated in several ways: - - csc_matrix(d) - with a dense matrix d + """Compressed Sparse Column matrix - - csc_matrix(s) - with another sparse matrix s (sugar for .tocsc()) + This can be instantiated in several ways: + - csc_matrix(D) + with a dense matrix or rank-2 ndarray D - - csc_matrix((M, N), [dtype]) - to construct a container, where (M, N) are dimensions and - dtype is optional, defaulting to dtype='d'. + - csc_matrix(S) + with another sparse matrix S (equivalent to S.tocsc()) - - csc_matrix((data, ij), [(M, N)]) - where data, ij satisfy: - a[ij[0, k], ij[1, k]] = data[k] + - csc_matrix((M, N), [dtype]) + to construct an empty matrix with shape (M, N) + dtype is optional, defaulting to dtype='d'. - - csc_matrix((data, row, ptr), [(M, N)]) - standard CSC representation + - csc_matrix((data, ij), [shape=(M, N)]) + where data, ij satisfy: + a[ij[0, k], ij[1, k]] = data[k] + + - csc_matrix((data, indices, indptr), [shape=(M, N)]) + is the native CSC representation where: + the row indices for column i are stored in + indices[ indptr[i]: indices[i+1] ] + and their corresponding values are stored in + data[ indptr[i]: indptr[i+1] ] + If the shape parameter is not supplied, the matrix dimensions + are inferred from the index arrays. + + + *Examples* + ---------- + + >>> from scipy.sparse import * + >>> from scipy import * + >>> csc_matrix( (3,4), dtype='i' ).todense() + matrix([[0, 0, 0, 0], + [0, 0, 0, 0], + [0, 0, 0, 0]]) + + >>> row = array([0,0,1,2,2,2]) + >>> col = array([0,2,2,0,1,2]) + >>> data = array([1,2,3,4,5,6]) + >>> csc_matrix( (data,(row,col)), shape=(3,3) ).todense() + matrix([[1, 0, 2], + [0, 0, 3], + [4, 5, 6]]) + + >>> indptr = array([0,2,3,6]) + >>> indices = array([0,2,2,0,1,2]) + >>> data = array([1,4,6,2,3,5]) + >>> csc_matrix( (data,indices,indptr), shape=(3,3) ).todense() + matrix([[1, 0, 2], + [0, 0, 3], + [4, 5, 6]]) + """ - + def __getattr__(self, attr): if attr == 'rowind': warn("rowind attribute no longer in use. Use .indices instead", Modified: trunk/scipy/sparse/csr.py =================================================================== --- trunk/scipy/sparse/csr.py 2007-12-16 04:35:42 UTC (rev 3675) +++ trunk/scipy/sparse/csr.py 2007-12-16 22:08:50 UTC (rev 3676) @@ -18,26 +18,65 @@ from compressed import _cs_matrix,resize1d class csr_matrix(_cs_matrix): - """ Compressed sparse row matrix - This can be instantiated in several ways: - - csr_matrix(d) - with a dense matrix d + """Compressed Sparse Row matrix - - csr_matrix(s) - with another sparse matrix s (sugar for .tocsr()) + This can be instantiated in several ways: + - csr_matrix(D) + with a dense matrix or rank-2 ndarray D - - csr_matrix((M, N), [dtype]) - to construct a container, where (M, N) are dimensions and - dtype is optional, defaulting to dtype='d'. + - csr_matrix(S) + with another sparse matrix S (equivalent to S.tocsr()) - - csr_matrix((data, ij), [shape=(M, N)]) - where data, ij satisfy: - a[ij[0, k], ij[1, k]] = data[k] + - csr_matrix((M, N), [dtype]) + to construct an empty matrix with shape (M, N) + dtype is optional, defaulting to dtype='d'. - - csr_matrix((data, col, ptr), [shape=(M, N)]) - standard CSR representation + - csr_matrix((data, ij), [shape=(M, N)]) + where data, ij satisfy: + a[ij[0, k], ij[1, k]] = data[k] + + - csr_matrix((data, indices, indptr), [shape=(M, N)]) + is the native CSR representation where: + the column indices for row i are stored in + indices[ indptr[i]: indices[i+1] ] + and their corresponding values are stored in + data[ indptr[i]: indptr[i+1] ] + If the shape parameter is not supplied, the matrix dimensions + are inferred from the index arrays. + + + *Examples* + ---------- + + >>> from scipy.sparse import * + >>> from scipy import * + >>> csr_matrix( (3,4), dtype='i' ).todense() + matrix([[0, 0, 0, 0], + [0, 0, 0, 0], + [0, 0, 0, 0]]) + + >>> row = array([0,0,1,2,2,2]) + >>> col = array([0,2,2,0,1,2]) + >>> data = array([1,2,3,4,5,6]) + >>> csr_matrix( (data,(row,col)), shape=(3,3) ).todense() + matrix([[1, 0, 2], + [0, 0, 3], + [4, 5, 6]]) + + >>> indptr = array([0,2,3,6]) + >>> indices = array([0,2,2,0,1,2]) + >>> data = array([1,2,3,4,5,6]) + >>> csr_matrix( (data,indices,indptr), shape=(3,3) ).todense() + matrix([[1, 0, 2], + [0, 0, 3], + [4, 5, 6]]) + """ + + + + def __getattr__(self, attr): if attr == 'colind': warn("colind attribute no longer in use. Use .indices instead", From scipy-svn at scipy.org Mon Dec 17 10:59:33 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 17 Dec 2007 09:59:33 -0600 (CST) Subject: [Scipy-svn] r3677 - trunk/scipy/sandbox/multigrid/tests Message-ID: <20071217155933.2395839C05C@new.scipy.org> Author: wnbell Date: 2007-12-17 09:59:22 -0600 (Mon, 17 Dec 2007) New Revision: 3677 Modified: trunk/scipy/sandbox/multigrid/tests/test_sa.py Log: set -> Set Modified: trunk/scipy/sandbox/multigrid/tests/test_sa.py =================================================================== --- trunk/scipy/sandbox/multigrid/tests/test_sa.py 2007-12-16 22:08:50 UTC (rev 3676) +++ trunk/scipy/sandbox/multigrid/tests/test_sa.py 2007-12-17 15:59:22 UTC (rev 3677) @@ -1,5 +1,10 @@ +try: + from sets import Set + set = Set +except: + pass + from numpy.testing import * - from numpy import sqrt,empty,ones,arange,array_split,eye,array, \ zeros,diag,zeros_like,diff,matrix,hstack,vstack from numpy.linalg import norm From scipy-svn at scipy.org Mon Dec 17 15:13:46 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 17 Dec 2007 14:13:46 -0600 (CST) Subject: [Scipy-svn] r3678 - in trunk/scipy/optimize: . slsqp Message-ID: <20071217201346.7E8E439C05C@new.scipy.org> Author: oliphant Date: 2007-12-17 14:13:41 -0600 (Mon, 17 Dec 2007) New Revision: 3678 Added: trunk/scipy/optimize/slsqp.py trunk/scipy/optimize/slsqp/ trunk/scipy/optimize/slsqp/slsqp.pyf trunk/scipy/optimize/slsqp/slsqp_optmz.f Modified: trunk/scipy/optimize/__init__.py trunk/scipy/optimize/setup.py Log: Added slsqp code contributed by Rob Falck in ticket #565 (and #566) Modified: trunk/scipy/optimize/__init__.py =================================================================== --- trunk/scipy/optimize/__init__.py 2007-12-17 15:59:22 UTC (rev 3677) +++ trunk/scipy/optimize/__init__.py 2007-12-17 20:13:41 UTC (rev 3678) @@ -13,6 +13,7 @@ from cobyla import fmin_cobyla from nonlin import broyden1, broyden2, broyden3, broyden_generalized, \ anderson, anderson2 +from slsqp import fmin_slsqp __all__ = filter(lambda s:not s.startswith('_'),dir()) from numpy.testing import NumpyTest Modified: trunk/scipy/optimize/setup.py =================================================================== --- trunk/scipy/optimize/setup.py 2007-12-17 15:59:22 UTC (rev 3677) +++ trunk/scipy/optimize/setup.py 2007-12-17 20:13:41 UTC (rev 3678) @@ -38,6 +38,9 @@ config.add_extension('minpack2', sources=[join('minpack2',x) for x in sources]) + sources = ['slsqp.pyf', 'slsqp_optmz.f'] + config.add_extension('_slsqp', sources=[join('slsqp', x) for x in sources]) + config.add_data_dir('tests') return config Added: trunk/scipy/optimize/slsqp/slsqp.pyf =================================================================== --- trunk/scipy/optimize/slsqp/slsqp.pyf 2007-12-17 15:59:22 UTC (rev 3677) +++ trunk/scipy/optimize/slsqp/slsqp.pyf 2007-12-17 20:13:41 UTC (rev 3678) @@ -0,0 +1,30 @@ +! -*- f90 -*- +! Note: the context of this file is case sensitive. + +python module _slsqp ! in + interface ! in :slsqp + subroutine slsqp(m,meq,la,n,x,xl,xu,f,c,g,a,acc,iter,mode,w,l_w,jw,l_jw) ! in :slsqp:slsqp_optmz.f + integer :: m + integer :: meq + integer optional,check(len(c)>=la),depend(c) :: la=len(c) + integer optional,check(len(x)>=n),depend(x) :: n=len(x) + double precision dimension(n), intent(inout) :: x + double precision dimension(n),depend(n) :: xl + double precision dimension(n),depend(n) :: xu + double precision :: f + double precision dimension(la) :: c + double precision dimension(n + 1),depend(n) :: g + double precision dimension(la,n + 1),depend(la,n) :: a + double precision, intent(inout) :: acc + integer, intent(inout) :: iter + integer, intent(inout) :: mode + double precision dimension(l_w) :: w + integer optional,check(len(w)>=l_w),depend(w) :: l_w=len(w) + integer dimension(l_jw) :: jw + integer optional,check(len(jw)>=l_jw),depend(jw) :: l_jw=len(jw) + end subroutine slsqp + end interface +end python module slsqp + +! This file was auto-generated with f2py (version:2_3844). +! See http://cens.ioc.ee/projects/f2py2e/ Property changes on: trunk/scipy/optimize/slsqp/slsqp.pyf ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/scipy/optimize/slsqp/slsqp_optmz.f =================================================================== --- trunk/scipy/optimize/slsqp/slsqp_optmz.f 2007-12-17 15:59:22 UTC (rev 3677) +++ trunk/scipy/optimize/slsqp/slsqp_optmz.f 2007-12-17 20:13:41 UTC (rev 3678) @@ -0,0 +1,2080 @@ +************************************************************************ +* optimizer * +************************************************************************ + + SUBROUTINE slsqp (m, meq, la, n, x, xl, xu, f, c, g, a, + * acc, iter, mode, w, l_w, jw, l_jw) + +C SLSQP S EQUENTIAL L EAST SQ UARES P ROGRAMMING +C TO SOLVE GENERAL NONLINEAR OPTIMIZATION PROBLEMS + +C*********************************************************************** +C* * +C* * +C* A NONLINEAR PROGRAMMING METHOD WITH * +C* QUADRATIC PROGRAMMING SUBPROBLEMS * +C* * +C* * +C* THIS SUBROUTINE SOLVES THE GENERAL NONLINEAR PROGRAMMING PROBLEM * +C* * +C* MINIMIZE F(X) * +C* * +C* SUBJECT TO C (X) .EQ. 0 , J = 1,...,MEQ * +C* J * +C* * +C* C (X) .GE. 0 , J = MEQ+1,...,M * +C* J * +C* * +C* XL .LE. X .LE. XU , I = 1,...,N. * +C* I I I * +C* * +C* THE ALGORITHM IMPLEMENTS THE METHOD OF HAN AND POWELL * +C* WITH BFGS-UPDATE OF THE B-MATRIX AND L1-TEST FUNCTION * +C* WITHIN THE STEPLENGTH ALGORITHM. * +C* * +C* PARAMETER DESCRIPTION: * +C* ( * MEANS THIS PARAMETER WILL BE CHANGED DURING CALCULATION ) * +C* * +C* M IS THE TOTAL NUMBER OF CONSTRAINTS, M .GE. 0 * +C* MEQ IS THE NUMBER OF EQUALITY CONSTRAINTS, MEQ .GE. 0 * +C* LA SEE A, LA .GE. MAX(M,1) * +C* N IS THE NUMBER OF VARIBLES, N .GE. 1 * +C* * X() X() STORES THE CURRENT ITERATE OF THE N VECTOR X * +C* ON ENTRY X() MUST BE INITIALIZED. ON EXIT X() * +C* STORES THE SOLUTION VECTOR X IF MODE = 0. * +C* XL() XL() STORES AN N VECTOR OF LOWER BOUNDS XL TO X. * +C* XU() XU() STORES AN N VECTOR OF UPPER BOUNDS XU TO X. * +C* F IS THE VALUE OF THE OBJECTIVE FUNCTION. * +C* C() C() STORES THE M VECTOR C OF CONSTRAINTS, * +C* EQUALITY CONSTRAINTS (IF ANY) FIRST. * +C* DIMENSION OF C MUST BE GREATER OR EQUAL LA, * +C* which must be GREATER OR EQUAL MAX(1,M). * +C* G() G() STORES THE N VECTOR G OF PARTIALS OF THE * +C* OBJECTIVE FUNCTION; DIMENSION OF G MUST BE * +C* GREATER OR EQUAL N+1. * +C* A(),LA,M,N THE LA BY N + 1 ARRAY A() STORES * +C* THE M BY N MATRIX A OF CONSTRAINT NORMALS. * +C* A() HAS FIRST DIMENSIONING PARAMETER LA, * +C* WHICH MUST BE GREATER OR EQUAL MAX(1,M). * +C* F,C,G,A MUST ALL BE SET BY THE USER BEFORE EACH CALL. * +C* * ACC ABS(ACC) CONTROLS THE FINAL ACCURACY. * +C* IF ACC .LT. ZERO AN EXACT LINESEARCH IS PERFORMED,* +C* OTHERWISE AN ARMIJO-TYPE LINESEARCH IS USED. * +C* * ITER PRESCRIBES THE MAXIMUM NUMBER OF ITERATIONS. * +C* ON EXIT ITER INDICATES THE NUMBER OF ITERATIONS. * +C* * MODE MODE CONTROLS CALCULATION: * +C* REVERSE COMMUNICATION IS USED IN THE SENSE THAT * +C* THE PROGRAM IS INITIALIZED BY MODE = 0; THEN IT IS* +C* TO BE CALLED REPEATEDLY BY THE USER UNTIL A RETURN* +C* WITH MODE .NE. IABS(1) TAKES PLACE. * +C* IF MODE = -1 GRADIENTS HAVE TO BE CALCULATED, * +C* WHILE WITH MODE = 1 FUNCTIONS HAVE TO BE CALCULATED +C* MODE MUST NOT BE CHANGED BETWEEN SUBSEQUENT CALLS * +C* OF SQP. * +C* EVALUATION MODES: * +C* MODE = -1: GRADIENT EVALUATION, (G&A) * +C* 0: ON ENTRY: INITIALIZATION, (F,G,C&A) * +C* ON EXIT : REQUIRED ACCURACY FOR SOLUTION OBTAINED * +C* 1: FUNCTION EVALUATION, (F&C) * +C* * +C* FAILURE MODES: * +C* 2: NUMBER OF EQUALITY CONTRAINTS LARGER THAN N * +C* 3: MORE THAN 3*N ITERATIONS IN LSQ SUBPROBLEM * +C* 4: INEQUALITY CONSTRAINTS INCOMPATIBLE * +C* 5: SINGULAR MATRIX E IN LSQ SUBPROBLEM * +C* 6: SINGULAR MATRIX C IN LSQ SUBPROBLEM * +C* 7: RANK-DEFICIENT EQUALITY CONSTRAINT SUBPROBLEM HFTI* +C* 8: POSITIVE DIRECTIONAL DERIVATIVE FOR LINESEARCH * +C* 9: MORE THAN ITER ITERATIONS IN SQP * +C* >=10: WORKING SPACE W OR JW TOO SMALL, * +C* W SHOULD BE ENLARGED TO L_W=MODE/1000 * +C* JW SHOULD BE ENLARGED TO L_JW=MODE-1000*L_W * +C* * W(), L_W W() IS A ONE DIMENSIONAL WORKING SPACE, * +C* THE LENGTH L_W OF WHICH SHOULD BE AT LEAST * +C* (3*N1+M)*(N1+1) for LSQ * +C* +(N1-MEQ+1)*(MINEQ+2) + 2*MINEQ for LSI * +C* +(N1+MINEQ)*(N1-MEQ) + 2*MEQ + N1 for LSEI * +C* + N1*N/2 + 2*M + 3*N + 3*N1 + 1 for SLSQPB * +C* with MINEQ = M - MEQ + 2*N1 & N1 = N+1 * +C* NOTICE: FOR PROPER DIMENSIONING OF W IT IS RECOMMENDED TO * +C* COPY THE FOLLOWING STATEMENTS INTO THE HEAD OF * +C* THE CALLING PROGRAM (AND REMOVE THE COMMENT C) * +c####################################################################### +C INTEGER LEN_W, LEN_JW, M, N, N1, MEQ, MINEQ +C PARAMETER (M=... , MEQ=... , N=... ) +C PARAMETER (N1= N+1, MINEQ= M-MEQ+N1+N1) +C PARAMETER (LEN_W= +c $ (3*N1+M)*(N1+1) +c $ +(N1-MEQ+1)*(MINEQ+2) + 2*MINEQ +c $ +(N1+MINEQ)*(N1-MEQ) + 2*MEQ + N1 +c $ +(N+1)*N/2 + 2*M + 3*N + 3*N1 + 1, +c $ LEN_JW=MINEQ) +C DOUBLE PRECISION W(LEN_W) +C INTEGER JW(LEN_JW) +c####################################################################### +C* THE FIRST M+N+N*N1/2 ELEMENTS OF W MUST NOT BE * +C* CHANGED BETWEEN SUBSEQUENT CALLS OF SLSQP. * +C* ON RETURN W(1) ... W(M) CONTAIN THE MULTIPLIERS * +C* ASSOCIATED WITH THE GENERAL CONSTRAINTS, WHILE * +C* W(M+1) ... W(M+N(N+1)/2) STORE THE CHOLESKY FACTOR* +C* L*D*L(T) OF THE APPROXIMATE HESSIAN OF THE * +C* LAGRANGIAN COLUMNWISE DENSE AS LOWER TRIANGULAR * +C* UNIT MATRIX L WITH D IN ITS 'DIAGONAL' and * +C* W(M+N(N+1)/2+N+2 ... W(M+N(N+1)/2+N+2+M+2N) * +C* CONTAIN THE MULTIPLIERS ASSOCIATED WITH ALL * +C* ALL CONSTRAINTS OF THE QUADRATIC PROGRAM FINDING * +C* THE SEARCH DIRECTION TO THE SOLUTION X* * +C* * JW(), L_JW JW() IS A ONE DIMENSIONAL INTEGER WORKING SPACE * +C* THE LENGTH L_JW OF WHICH SHOULD BE AT LEAST * +C* MINEQ * +C* with MINEQ = M - MEQ + 2*N1 & N1 = N+1 * +C* * +C* THE USER HAS TO PROVIDE THE FOLLOWING SUBROUTINES: * +C* LDL(N,A,Z,SIG,W) : UPDATE OF THE LDL'-FACTORIZATION. * +C* LINMIN(A,B,F,TOL) : LINESEARCH ALGORITHM IF EXACT = 1 * +C* LSQ(M,MEQ,LA,N,NC,C,D,A,B,XL,XU,X,LAMBDA,W,....) : * +C* * +C* SOLUTION OF THE QUADRATIC PROGRAM * +C* QPSOL IS RECOMMENDED: * +C* PE GILL, W MURRAY, MA SAUNDERS, MH WRIGHT: * +C* USER'S GUIDE FOR SOL/QPSOL: * +C* A FORTRAN PACKAGE FOR QUADRATIC PROGRAMMING, * +C* TECHNICAL REPORT SOL 83-7, JULY 1983 * +C* DEPARTMENT OF OPERATIONS RESEARCH, STANFORD UNIVERSITY * +C* STANFORD, CA 94305 * +C* QPSOL IS THE MOST ROBUST AND EFFICIENT QP-SOLVER * +C* AS IT ALLOWS WARM STARTS WITH PROPER WORKING SETS * +C* * +C* IF IT IS NOT AVAILABLE USE LSEI, A CONSTRAINT LINEAR LEAST * +C* SQUARES SOLVER IMPLEMENTED USING THE SOFTWARE HFTI, LDP, NNLS * +C* FROM C.L. LAWSON, R.J.HANSON: SOLVING LEAST SQUARES PROBLEMS, * +C* PRENTICE HALL, ENGLEWOOD CLIFFS, 1974. * +C* LSEI COMES WITH THIS PACKAGE, together with all necessary SR's. * +C* * +C* TOGETHER WITH A COUPLE OF SUBROUTINES FROM BLAS LEVEL 1 * +C* * +C* SQP IS HEAD SUBROUTINE FOR BODY SUBROUTINE SQPBDY * +C* IN WHICH THE ALGORITHM HAS BEEN IMPLEMENTED. * +C* * +C* IMPLEMENTED BY: DIETER KRAFT, DFVLR OBERPFAFFENHOFEN * +C* as described in Dieter Kraft: A Software Package for * +C* Sequential Quadratic Programming * +C* DFVLR-FB 88-28, 1988 * +C* which should be referenced if the user publishes results of SLSQP * +C* * +C* DATE: APRIL - OCTOBER, 1981. * +C* STATUS: DECEMBER, 31-ST, 1984. * +C* STATUS: MARCH , 21-ST, 1987, REVISED TO FORTAN 77 * +C* STATUS: MARCH , 20-th, 1989, REVISED TO MS-FORTRAN * +C* STATUS: APRIL , 14-th, 1989, HESSE in-line coded * +C* STATUS: FEBRUARY, 28-th, 1991, FORTRAN/2 Version 1.04 * +C* accepts Statement Functions * +C* STATUS: MARCH , 1-st, 1991, tested with SALFORD * +C* FTN77/386 COMPILER VERS 2.40* +C* in protected mode * +C* * +C*********************************************************************** +C* * +C* Copyright 1991: Dieter Kraft, FHM * +C* * +C*********************************************************************** + + INTEGER il, im, ir, is, iter, iu, iv, iw, ix, l_w, l_jw, + * jw(l_jw), la, m, meq, mineq, mode, n, n1 + + DOUBLE PRECISION acc, a(la,n+1), c(la), f, g(n+1), + * x(n), xl(n), xu(n), w(l_w) + +c dim(W) = N1*(N1+1) + MEQ*(N1+1) + MINEQ*(N1+1) for LSQ +c +(N1-MEQ+1)*(MINEQ+2) + 2*MINEQ for LSI +c +(N1+MINEQ)*(N1-MEQ) + 2*MEQ + N1 for LSEI +c + N1*N/2 + 2*M + 3*N +3*N1 + 1 for SLSQPB +c with MINEQ = M - MEQ + 2*N1 & N1 = N+1 + +C CHECK LENGTH OF WORKING ARRAYS + + n1 = n+1 + mineq = m-meq+n1+n1 + il = (3*n1+m)*(n1+1) + + .(n1-meq+1)*(mineq+2) + 2*mineq + + .(n1+mineq)*(n1-meq) + 2*meq + + .n1*n/2 + 2*m + 3*n + 4*n1 + 1 + im = MAX(mineq, n1-meq) + IF (l_w .LT. il .OR. l_jw .LT. im) THEN + mode = 1000*MAX(10,il) + mode = mode+MAX(10,im) + RETURN + ENDIF + +C PREPARE DATA FOR CALLING SQPBDY - INITIAL ADDRESSES IN W + + im = 1 + il = im + MAX(1,m) + il = im + la + ix = il + n1*n/2 + 1 + ir = ix + n + is = ir + n + n + MAX(1,m) + is = ir + n + n + la + iu = is + n1 + iv = iu + n1 + iw = iv + n1 + + CALL slsqpb (m, meq, la, n, x, xl, xu, f, c, g, a, acc, iter, + * mode, w(ir), w(il), w(ix), w(im), w(is), w(iu), w(iv), w(iw), jw) + + END + + SUBROUTINE slsqpb (m, meq, la, n, x, xl, xu, f, c, g, a, acc, + * iter, mode, r, l, x0, mu, s, u, v, w, iw) + +C NONLINEAR PROGRAMMING BY SOLVING SEQUENTIALLY QUADRATIC PROGRAMS + +C - L1 - LINE SEARCH, POSITIVE DEFINITE BFGS UPDATE - + +C BODY SUBROUTINE FOR SLSQP + + INTEGER iw(*), i, iexact, incons, ireset, iter, itermx, + * k, j, la, line, m, meq, mode, n, n1, n2, n3 + + DOUBLE PRECISION a(la,n+1), c(la), g(n+1), l((n+1)*(n+2)/2), + * mu(la), r(m+n+n+2), s(n+1), u(n+1), v(n+1), w(*), + * x(n), xl(n), xu(n), x0(n), + * ddot_sl, dnrm2_, linmin, + * acc, alfmin, alpha, f, f0, gs, h1, h2, h3, h4, + * hun, one, t, t0, ten, tol, two, ZERO + +c dim(W) = N1*(N1+1) + MEQ*(N1+1) + MINEQ*(N1+1) for LSQ +c +(N1-MEQ+1)*(MINEQ+2) + 2*MINEQ +c +(N1+MINEQ)*(N1-MEQ) + 2*MEQ + N1 for LSEI +c with MINEQ = M - MEQ + 2*N1 & N1 = N+1 + + SAVE alpha, f0, gs, h1, h2, h3, h4, t, t0, tol, + * iexact, incons, ireset, itermx, line, n1, n2, n3 + + DATA ZERO /0.0d0/, one /1.0d0/, alfmin /1.0d-1/, + * hun /1.0d+2/, ten /1.0d+1/, two /2.0d0/ + + IF (mode) 260, 100, 220 + + 100 itermx = iter + IF (acc.GE.ZERO) THEN + iexact = 0 + ELSE + iexact = 1 + ENDIF + acc = ABS(acc) + tol = ten*acc + iter = 0 + ireset = 0 + n1 = n + 1 + n2 = n1*n/2 + n3 = n2 + 1 + s(1) = ZERO + mu(1) = ZERO + CALL dcopy_(n, s(1), 0, s, 1) + CALL dcopy_(m, mu(1), 0, mu, 1) + +C RESET BFGS MATRIX + + 110 ireset = ireset + 1 + IF (ireset.GT.5) GO TO 255 + l(1) = ZERO + CALL dcopy_(n2, l(1), 0, l, 1) + j = 1 + DO 120 i=1,n + l(j) = one + j = j + n1 - i + 120 CONTINUE + +C MAIN ITERATION : SEARCH DIRECTION, STEPLENGTH, LDL'-UPDATE + + 130 iter = iter + 1 + mode = 9 + IF (iter.GT.itermx) GO TO 330 + +C SEARCH DIRECTION AS SOLUTION OF QP - SUBPROBLEM + + CALL dcopy_(n, xl, 1, u, 1) + CALL dcopy_(n, xu, 1, v, 1) + CALL daxpy_sl(n, -one, x, 1, u, 1) + CALL daxpy_sl(n, -one, x, 1, v, 1) + h4 = one + CALL lsq (m, meq, n , n3, la, l, g, a, c, u, v, s, r, w, iw, mode) + +C AUGMENTED PROBLEM FOR INCONSISTENT LINEARIZATION + + IF (mode.EQ.6) THEN + IF (n.EQ.meq) THEN + mode = 4 + ENDIF + ENDIF + IF (mode.EQ.4) THEN + DO 140 j=1,m + IF (j.LE.meq) THEN + a(j,n1) = -c(j) + ELSE + a(j,n1) = MAX(-c(j),ZERO) + ENDIF + 140 CONTINUE + s(1) = ZERO + CALL dcopy_(n, s(1), 0, s, 1) + h3 = ZERO + g(n1) = ZERO + l(n3) = hun + s(n1) = one + u(n1) = ZERO + v(n1) = one + incons = 0 + 150 CALL lsq (m, meq, n1, n3, la, l, g, a, c, u, v, s, r, + * w, iw, mode) + h4 = one - s(n1) + IF (mode.EQ.4) THEN + l(n3) = ten*l(n3) + incons = incons + 1 + IF (incons.GT.5) GO TO 330 + GOTO 150 + ELSE IF (mode.NE.1) THEN + GOTO 330 + ENDIF + ELSE IF (mode.NE.1) THEN + GOTO 330 + ENDIF + +C UPDATE MULTIPLIERS FOR L1-TEST + + DO 160 i=1,n + v(i) = g(i) - ddot_sl(m,a(1,i),1,r,1) + 160 CONTINUE + f0 = f + CALL dcopy_(n, x, 1, x0, 1) + gs = ddot_sl(n, g, 1, s, 1) + h1 = ABS(gs) + h2 = ZERO + DO 170 j=1,m + IF (j.LE.meq) THEN + h3 = c(j) + ELSE + h3 = ZERO + ENDIF + h2 = h2 + MAX(-c(j),h3) + h3 = ABS(r(j)) + mu(j) = MAX(h3,(mu(j)+h3)/two) + h1 = h1 + h3*ABS(c(j)) + 170 CONTINUE + +C CHECK CONVERGENCE + + mode = 0 + IF (h1.LT.acc .AND. h2.LT.acc) GO TO 330 + h1 = ZERO + DO 180 j=1,m + IF (j.LE.meq) THEN + h3 = c(j) + ELSE + h3 = ZERO + ENDIF + h1 = h1 + mu(j)*MAX(-c(j),h3) + 180 CONTINUE + t0 = f + h1 + h3 = gs - h1*h4 + mode = 8 + IF (h3.GE.ZERO) GO TO 110 + +C LINE SEARCH WITH AN L1-TESTFUNCTION + + line = 0 + alpha = one + IF (iexact.EQ.1) GOTO 210 + +C INEXACT LINESEARCH + + 190 line = line + 1 + h3 = alpha*h3 + CALL dscal_sl(n, alpha, s, 1) + CALL dcopy_(n, x0, 1, x, 1) + CALL daxpy_sl(n, one, s, 1, x, 1) + mode = 1 + GO TO 330 + 200 IF (h1.LE.h3/ten .OR. line.GT.10) GO TO 240 + alpha = MAX(h3/(two*(h3-h1)),alfmin) + GO TO 190 + +C EXACT LINESEARCH + + 210 IF (line.NE.3) THEN + alpha = linmin(line,alfmin,one,t,tol) + CALL dcopy_(n, x0, 1, x, 1) + CALL daxpy_sl(n, alpha, s, 1, x, 1) + mode = 1 + GOTO 330 + ENDIF + CALL dscal_sl(n, alpha, s, 1) + GOTO 240 + +C CALL FUNCTIONS AT CURRENT X + + 220 t = f + DO 230 j=1,m + IF (j.LE.meq) THEN + h1 = c(j) + ELSE + h1 = ZERO + ENDIF + t = t + mu(j)*MAX(-c(j),h1) + 230 CONTINUE + h1 = t - t0 + GOTO (200, 210) iexact+1 + +C CHECK CONVERGENCE + + 240 h3 = ZERO + DO 250 j=1,m + IF (j.LE.meq) THEN + h1 = c(j) + ELSE + h1 = ZERO + ENDIF + h3 = h3 + MAX(-c(j),h1) + 250 CONTINUE + IF ((ABS(f-f0).LT.acc .OR. dnrm2_(n,s,1).LT.acc) .AND. h3.LT.acc) + * THEN + mode = 0 + ELSE + mode = -1 + ENDIF + GO TO 330 + +C CHECK relaxed CONVERGENCE in case of positive directional derivative + + 255 CONTINUE + IF ((ABS(f-f0).LT.tol .OR. dnrm2_(n,s,1).LT.tol) .AND. h3.LT.tol) + * THEN + mode = 0 + ELSE + mode = 8 + ENDIF + GO TO 330 + +C CALL JACOBIAN AT CURRENT X + +C UPDATE CHOLESKY-FACTORS OF HESSIAN MATRIX BY MODIFIED BFGS FORMULA + + 260 DO 270 i=1,n + u(i) = g(i) - ddot_sl(m,a(1,i),1,r,1) - v(i) + 270 CONTINUE + +C L'*S + + k = 0 + DO 290 i=1,n + h1 = ZERO + k = k + 1 + DO 280 j=i+1,n + k = k + 1 + h1 = h1 + l(k)*s(j) + 280 CONTINUE + v(i) = s(i) + h1 + 290 CONTINUE + +C D*L'*S + + k = 1 + DO 300 i=1,n + v(i) = l(k)*v(i) + k = k + n1 - i + 300 CONTINUE + +C L*D*L'*S + + DO 320 i=n,1,-1 + h1 = ZERO + k = i + DO 310 j=1,i - 1 + h1 = h1 + l(k)*v(j) + k = k + n - j + 310 CONTINUE + v(i) = v(i) + h1 + 320 CONTINUE + + h1 = ddot_sl(n,s,1,u,1) + h2 = ddot_sl(n,s,1,v,1) + h3 = 0.2d0*h2 + IF (h1.LT.h3) THEN + h4 = (h2-h3)/(h2-h1) + h1 = h3 + CALL dscal_sl(n, h4, u, 1) + CALL daxpy_sl(n, one-h4, v, 1, u, 1) + ENDIF + CALL ldl(n, l, u, +one/h1, v) + CALL ldl(n, l, v, -one/h2, u) + +C END OF MAIN ITERATION + + GO TO 130 + +C END OF SLSQPB + + 330 END + + + SUBROUTINE lsq(m,meq,n,nl,la,l,g,a,b,xl,xu,x,y,w,jw,mode) + +C MINIMIZE with respect to X + +C ||E*X - F|| +C 1/2 T +C WITH UPPER TRIANGULAR MATRIX E = +D *L , + +C -1/2 -1 +C AND VECTOR F = -D *L *G, + +C WHERE THE UNIT LOWER TRIDIANGULAR MATRIX L IS STORED COLUMNWISE +C DENSE IN THE N*(N+1)/2 ARRAY L WITH VECTOR D STORED IN ITS +C 'DIAGONAL' THUS SUBSTITUTING THE ONE-ELEMENTS OF L + +C SUBJECT TO + +C A(J)*X - B(J) = 0 , J=1,...,MEQ, +C A(J)*X - B(J) >=0, J=MEQ+1,...,M, +C XL(I) <= X(I) <= XU(I), I=1,...,N, +C ON ENTRY, THE USER HAS TO PROVIDE THE ARRAYS L, G, A, B, XL, XU. +C WITH DIMENSIONS: L(N*(N+1)/2), G(N), A(LA,N), B(M), XL(N), XU(N) +C THE WORKING ARRAY W MUST HAVE AT LEAST THE FOLLOWING DIMENSION: +c DIM(W) = (3*N+M)*(N+1) for LSQ +c +(N-MEQ+1)*(MINEQ+2) + 2*MINEQ for LSI +c +(N+MINEQ)*(N-MEQ) + 2*MEQ + N for LSEI +c with MINEQ = M - MEQ + 2*N +C ON RETURN, NO ARRAY WILL BE CHANGED BY THE SUBROUTINE. +C X STORES THE N-DIMENSIONAL SOLUTION VECTOR +C Y STORES THE VECTOR OF LAGRANGE MULTIPLIERS OF DIMENSION +C M+N+N (CONSTRAINTS+LOWER+UPPER BOUNDS) +C MODE IS A SUCCESS-FAILURE FLAG WITH THE FOLLOWING MEANINGS: +C MODE=1: SUCCESSFUL COMPUTATION +C 2: ERROR RETURN BECAUSE OF WRONG DIMENSIONS (N<1) +C 3: ITERATION COUNT EXCEEDED BY NNLS +C 4: INEQUALITY CONSTRAINTS INCOMPATIBLE +C 5: MATRIX E IS NOT OF FULL RANK +C 6: MATRIX C IS NOT OF FULL RANK +C 7: RANK DEFECT IN HFTI + +c coded Dieter Kraft, april 1987 +c revised march 1989 + + DOUBLE PRECISION l,g,a,b,w,xl,xu,x,y, + . diag,ZERO,one,ddot_sl,xnorm + + INTEGER jw(*),i,ic,id,ie,IF,ig,ih,il,im,ip,iu,iw, + . i1,i2,i3,i4,la,m,meq,mineq,mode,m1,n,nl,n1,n2,n3 + + DIMENSION a(la,n), b(la), g(n), l(nl), + . w(*), x(n), xl(n), xu(n), y(m+n+n) + + DATA ZERO/0.0d0/, one/1.0d0/ + + n1 = n + 1 + mineq = m - meq + m1 = mineq + n + n + +c determine whether to solve problem +c with inconsistent linerarization (n2=1) +c or not (n2=0) + + n2 = n1*n/2 + 1 + IF (n2.EQ.nl) THEN + n2 = 0 + ELSE + n2 = 1 + ENDIF + n3 = n-n2 + +C RECOVER MATRIX E AND VECTOR F FROM L AND G + + i2 = 1 + i3 = 1 + i4 = 1 + ie = 1 + IF = n*n+1 + DO 10 i=1,n3 + i1 = n1-i + diag = SQRT (l(i2)) + w(i3) = ZERO + CALL dcopy_ (i1 , w(i3), 0, w(i3), 1) + CALL dcopy_ (i1-n2, l(i2), 1, w(i3), n) + CALL dscal_sl (i1-n2, diag, w(i3), n) + w(i3) = diag + w(IF-1+i) = (g(i) - ddot_sl (i-1, w(i4), 1, w(IF), 1))/diag + i2 = i2 + i1 - n2 + i3 = i3 + n1 + i4 = i4 + n + 10 CONTINUE + IF (n2.EQ.1) THEN + w(i3) = l(nl) + w(i4) = ZERO + CALL dcopy_ (n3, w(i4), 0, w(i4), 1) + w(IF-1+n) = ZERO + ENDIF + CALL dscal_sl (n, - one, w(IF), 1) + + ic = IF + n + id = ic + meq*n + + IF (meq .GT. 0) THEN + +C RECOVER MATRIX C FROM UPPER PART OF A + + DO 20 i=1,meq + CALL dcopy_ (n, a(i,1), la, w(ic-1+i), meq) + 20 CONTINUE + +C RECOVER VECTOR D FROM UPPER PART OF B + + CALL dcopy_ (meq, b(1), 1, w(id), 1) + CALL dscal_sl (meq, - one, w(id), 1) + + ENDIF + + ig = id + meq + + IF (mineq .GT. 0) THEN + +C RECOVER MATRIX G FROM LOWER PART OF A + + DO 30 i=1,mineq + CALL dcopy_ (n, a(meq+i,1), la, w(ig-1+i), m1) + 30 CONTINUE + + ENDIF + +C AUGMENT MATRIX G BY +I AND -I + + ip = ig + mineq + DO 40 i=1,n + w(ip-1+i) = ZERO + CALL dcopy_ (n, w(ip-1+i), 0, w(ip-1+i), m1) + 40 CONTINUE + w(ip) = one + CALL dcopy_ (n, w(ip), 0, w(ip), m1+1) + + im = ip + n + DO 50 i=1,n + w(im-1+i) = ZERO + CALL dcopy_ (n, w(im-1+i), 0, w(im-1+i), m1) + 50 CONTINUE + w(im) = -one + CALL dcopy_ (n, w(im), 0, w(im), m1+1) + + ih = ig + m1*n + + IF (mineq .GT. 0) THEN + +C RECOVER H FROM LOWER PART OF B + + CALL dcopy_ (mineq, b(meq+1), 1, w(ih), 1) + CALL dscal_sl (mineq, - one, w(ih), 1) + + ENDIF + +C AUGMENT VECTOR H BY XL AND XU + + il = ih + mineq + CALL dcopy_ (n, xl, 1, w(il), 1) + iu = il + n + CALL dcopy_ (n, xu, 1, w(iu), 1) + CALL dscal_sl (n, - one, w(iu), 1) + + iw = iu + n + + CALL lsei (w(ic), w(id), w(ie), w(IF), w(ig), w(ih), MAX(1,meq), + . meq, n, n, m1, m1, n, x, xnorm, w(iw), jw, mode) + + IF (mode .EQ. 1) THEN + +c restore Lagrange multipliers + + CALL dcopy_ (m, w(iw), 1, y(1), 1) + CALL dcopy_ (n3, w(iw+m), 1, y(m+1), 1) + CALL dcopy_ (n3, w(iw+m+n), 1, y(m+n3+1), 1) + + ENDIF + +C END OF SUBROUTINE LSQ + + END + + + SUBROUTINE lsei(c,d,e,f,g,h,lc,mc,LE,me,lg,mg,n,x,xnrm,w,jw,mode) + +C FOR MODE=1, THE SUBROUTINE RETURNS THE SOLUTION X OF +C EQUALITY & INEQUALITY CONSTRAINED LEAST SQUARES PROBLEM LSEI : + +C MIN ||E*X - F|| +C X + +C S.T. C*X = D, +C G*X >= H. + +C USING QR DECOMPOSITION & ORTHOGONAL BASIS OF NULLSPACE OF C +C CHAPTER 23.6 OF LAWSON & HANSON: SOLVING LEAST SQUARES PROBLEMS. + +C THE FOLLOWING DIMENSIONS OF THE ARRAYS DEFINING THE PROBLEM +C ARE NECESSARY +C DIM(E) : FORMAL (LE,N), ACTUAL (ME,N) +C DIM(F) : FORMAL (LE ), ACTUAL (ME ) +C DIM(C) : FORMAL (LC,N), ACTUAL (MC,N) +C DIM(D) : FORMAL (LC ), ACTUAL (MC ) +C DIM(G) : FORMAL (LG,N), ACTUAL (MG,N) +C DIM(H) : FORMAL (LG ), ACTUAL (MG ) +C DIM(X) : FORMAL (N ), ACTUAL (N ) +C DIM(W) : 2*MC+ME+(ME+MG)*(N-MC) for LSEI +C +(N-MC+1)*(MG+2)+2*MG for LSI +C DIM(JW): MAX(MG,L) +C ON ENTRY, THE USER HAS TO PROVIDE THE ARRAYS C, D, E, F, G, AND H. +C ON RETURN, ALL ARRAYS WILL BE CHANGED BY THE SUBROUTINE. +C X STORES THE SOLUTION VECTOR +C XNORM STORES THE RESIDUUM OF THE SOLUTION IN EUCLIDIAN NORM +C W STORES THE VECTOR OF LAGRANGE MULTIPLIERS IN ITS FIRST +C MC+MG ELEMENTS +C MODE IS A SUCCESS-FAILURE FLAG WITH THE FOLLOWING MEANINGS: +C MODE=1: SUCCESSFUL COMPUTATION +C 2: ERROR RETURN BECAUSE OF WRONG DIMENSIONS (N<1) +C 3: ITERATION COUNT EXCEEDED BY NNLS +C 4: INEQUALITY CONSTRAINTS INCOMPATIBLE +C 5: MATRIX E IS NOT OF FULL RANK +C 6: MATRIX C IS NOT OF FULL RANK +C 7: RANK DEFECT IN HFTI + +C 18.5.1981, DIETER KRAFT, DFVLR OBERPFAFFENHOFEN +C 20.3.1987, DIETER KRAFT, DFVLR OBERPFAFFENHOFEN + + INTEGER jw(*),i,ie,IF,ig,iw,j,k,krank,l,lc,LE,lg, + . mc,mc1,me,mg,mode,n + DOUBLE PRECISION c(lc,n),e(LE,n),g(lg,n),d(lc),f(LE),h(lg),x(n), + . w(*),t,ddot_sl,xnrm,dnrm2_,epmach,ZERO + DATA epmach/2.22d-16/,ZERO/0.0d+00/ + + mode=2 + IF(mc.GT.n) GOTO 75 + l=n-mc + mc1=mc+1 + iw=(l+1)*(mg+2)+2*mg+mc + ie=iw+mc+1 + IF=ie+me*l + ig=IF+me + +C TRIANGULARIZE C AND APPLY FACTORS TO E AND G + + DO 10 i=1,mc + j=MIN(i+1,lc) + CALL h12(1,i,i+1,n,c(i,1),lc,w(iw+i),c(j,1),lc,1,mc-i) + CALL h12(2,i,i+1,n,c(i,1),lc,w(iw+i),e ,LE,1,me) + 10 CALL h12(2,i,i+1,n,c(i,1),lc,w(iw+i),g ,lg,1,mg) + +C SOLVE C*X=D AND MODIFY F + + mode=6 + DO 15 i=1,mc + IF(ABS(c(i,i)).LT.epmach) GOTO 75 + x(i)=(d(i)-ddot_sl(i-1,c(i,1),lc,x,1))/c(i,i) + 15 CONTINUE + mode=1 + w(mc1) = ZERO + CALL dcopy_ (mg-mc,w(mc1),0,w(mc1),1) + + IF(mc.EQ.n) GOTO 50 + + DO 20 i=1,me + 20 w(IF-1+i)=f(i)-ddot_sl(mc,e(i,1),LE,x,1) + +C STORE TRANSFORMED E & G + + DO 25 i=1,me + 25 CALL dcopy_(l,e(i,mc1),LE,w(ie-1+i),me) + DO 30 i=1,mg + 30 CALL dcopy_(l,g(i,mc1),lg,w(ig-1+i),mg) + + IF(mg.GT.0) GOTO 40 + +C SOLVE LS WITHOUT INEQUALITY CONSTRAINTS + + mode=7 + k=MAX(LE,n) + t=SQRT(epmach) + CALL hfti (w(ie),me,me,l,w(IF),k,1,t,krank,xnrm,w,w(l+1),jw) + CALL dcopy_(l,w(IF),1,x(mc1),1) + IF(krank.NE.l) GOTO 75 + mode=1 + GOTO 50 +C MODIFY H AND SOLVE INEQUALITY CONSTRAINED LS PROBLEM + + 40 DO 45 i=1,mg + 45 h(i)=h(i)-ddot_sl(mc,g(i,1),lg,x,1) + CALL lsi + . (w(ie),w(IF),w(ig),h,me,me,mg,mg,l,x(mc1),xnrm,w(mc1),jw,mode) + IF(mc.EQ.0) GOTO 75 + t=dnrm2_(mc,x,1) + xnrm=SQRT(xnrm*xnrm+t*t) + IF(mode.NE.1) GOTO 75 + +C SOLUTION OF ORIGINAL PROBLEM AND LAGRANGE MULTIPLIERS + + 50 DO 55 i=1,me + 55 f(i)=ddot_sl(n,e(i,1),LE,x,1)-f(i) + DO 60 i=1,mc + 60 d(i)=ddot_sl(me,e(1,i),1,f,1)-ddot_sl(mg,g(1,i),1,w(mc1),1) + + DO 65 i=mc,1,-1 + 65 CALL h12(2,i,i+1,n,c(i,1),lc,w(iw+i),x,1,1,1) + + DO 70 i=mc,1,-1 + j=MIN(i+1,lc) + w(i)=(d(i)-ddot_sl(mc-i,c(j,i),1,w(j),1))/c(i,i) + 70 CONTINUE + +C END OF SUBROUTINE LSEI + + 75 END + + + SUBROUTINE lsi(e,f,g,h,LE,me,lg,mg,n,x,xnorm,w,jw,mode) + +C FOR MODE=1, THE SUBROUTINE RETURNS THE SOLUTION X OF +C INEQUALITY CONSTRAINED LINEAR LEAST SQUARES PROBLEM: + +C MIN ||E*X-F|| +C X + +C S.T. G*X >= H + +C THE ALGORITHM IS BASED ON QR DECOMPOSITION AS DESCRIBED IN +C CHAPTER 23.5 OF LAWSON & HANSON: SOLVING LEAST SQUARES PROBLEMS + +C THE FOLLOWING DIMENSIONS OF THE ARRAYS DEFINING THE PROBLEM +C ARE NECESSARY +C DIM(E) : FORMAL (LE,N), ACTUAL (ME,N) +C DIM(F) : FORMAL (LE ), ACTUAL (ME ) +C DIM(G) : FORMAL (LG,N), ACTUAL (MG,N) +C DIM(H) : FORMAL (LG ), ACTUAL (MG ) +C DIM(X) : N +C DIM(W) : (N+1)*(MG+2) + 2*MG +C DIM(JW): LG +C ON ENTRY, THE USER HAS TO PROVIDE THE ARRAYS E, F, G, AND H. +C ON RETURN, ALL ARRAYS WILL BE CHANGED BY THE SUBROUTINE. +C X STORES THE SOLUTION VECTOR +C XNORM STORES THE RESIDUUM OF THE SOLUTION IN EUCLIDIAN NORM +C W STORES THE VECTOR OF LAGRANGE MULTIPLIERS IN ITS FIRST +C MG ELEMENTS +C MODE IS A SUCCESS-FAILURE FLAG WITH THE FOLLOWING MEANINGS: +C MODE=1: SUCCESSFUL COMPUTATION +C 2: ERROR RETURN BECAUSE OF WRONG DIMENSIONS (N<1) +C 3: ITERATION COUNT EXCEEDED BY NNLS +C 4: INEQUALITY CONSTRAINTS INCOMPATIBLE +C 5: MATRIX E IS NOT OF FULL RANK + +C 03.01.1980, DIETER KRAFT: CODED +C 20.03.1987, DIETER KRAFT: REVISED TO FORTRAN 77 + + INTEGER i,j,LE,lg,me,mg,mode,n,jw(lg) + DOUBLE PRECISION e(LE,n),f(LE),g(lg,n),h(lg),x(n),w(*), + . ddot_sl,xnorm,dnrm2_,epmach,t,one + DATA epmach/2.22d-16/,one/1.0d+00/ + +C QR-FACTORS OF E AND APPLICATION TO F + + DO 10 i=1,n + j=MIN(i+1,n) + CALL h12(1,i,i+1,me,e(1,i),1,t,e(1,j),1,LE,n-i) + 10 CALL h12(2,i,i+1,me,e(1,i),1,t,f ,1,1 ,1 ) + +C TRANSFORM G AND H TO GET LEAST DISTANCE PROBLEM + + mode=5 + DO 30 i=1,mg + DO 20 j=1,n + IF (ABS(e(j,j)).LT.epmach) GOTO 50 + 20 g(i,j)=(g(i,j)-ddot_sl(j-1,g(i,1),lg,e(1,j),1))/e(j,j) + 30 h(i)=h(i)-ddot_sl(n,g(i,1),lg,f,1) + +C SOLVE LEAST DISTANCE PROBLEM + + CALL ldp(g,lg,mg,n,h,x,xnorm,w,jw,mode) + IF (mode.NE.1) GOTO 50 + +C SOLUTION OF ORIGINAL PROBLEM + + CALL daxpy_sl(n,one,f,1,x,1) + DO 40 i=n,1,-1 + j=MIN(i+1,n) + 40 x(i)=(x(i)-ddot_sl(n-i,e(i,j),LE,x(j),1))/e(i,i) + j=MIN(n+1,me) + t=dnrm2_(me-n,f(j),1) + xnorm=SQRT(xnorm*xnorm+t*t) + +C END OF SUBROUTINE LSI + + 50 END + + SUBROUTINE ldp(g,mg,m,n,h,x,xnorm,w,INDEX,mode) + +C T +C MINIMIZE 1/2 X X SUBJECT TO G * X >= H. + +C C.L. LAWSON, R.J. HANSON: 'SOLVING LEAST SQUARES PROBLEMS' +C PRENTICE HALL, ENGLEWOOD CLIFFS, NEW JERSEY, 1974. + +C PARAMETER DESCRIPTION: + +C G(),MG,M,N ON ENTRY G() STORES THE M BY N MATRIX OF +C LINEAR INEQUALITY CONSTRAINTS. G() HAS FIRST +C DIMENSIONING PARAMETER MG +C H() ON ENTRY H() STORES THE M VECTOR H REPRESENTING +C THE RIGHT SIDE OF THE INEQUALITY SYSTEM + +C REMARK: G(),H() WILL NOT BE CHANGED DURING CALCULATIONS BY LDP + +C X() ON ENTRY X() NEED NOT BE INITIALIZED. +C ON EXIT X() STORES THE SOLUTION VECTOR X IF MODE=1. +C XNORM ON EXIT XNORM STORES THE EUCLIDIAN NORM OF THE +C SOLUTION VECTOR IF COMPUTATION IS SUCCESSFUL +C W() W IS A ONE DIMENSIONAL WORKING SPACE, THE LENGTH +C OF WHICH SHOULD BE AT LEAST (M+2)*(N+1) + 2*M +C ON EXIT W() STORES THE LAGRANGE MULTIPLIERS +C ASSOCIATED WITH THE CONSTRAINTS +C AT THE SOLUTION OF PROBLEM LDP +C INDEX() INDEX() IS A ONE DIMENSIONAL INTEGER WORKING SPACE +C OF LENGTH AT LEAST M +C MODE MODE IS A SUCCESS-FAILURE FLAG WITH THE FOLLOWING +C MEANINGS: +C MODE=1: SUCCESSFUL COMPUTATION +C 2: ERROR RETURN BECAUSE OF WRONG DIMENSIONS (N.LE.0) +C 3: ITERATION COUNT EXCEEDED BY NNLS +C 4: INEQUALITY CONSTRAINTS INCOMPATIBLE + + DOUBLE PRECISION g,h,x,xnorm,w,u,v, + . ZERO,one,fac,rnorm,dnrm2_,ddot_sl,diff + INTEGER INDEX,i,IF,iw,iwdual,iy,iz,j,m,mg,mode,n,n1 + DIMENSION g(mg,n),h(m),x(n),w(*),INDEX(m) + diff(u,v)= u-v + DATA ZERO,one/0.0d0,1.0d0/ + + mode=2 + IF(n.LE.0) GOTO 50 + +C STATE DUAL PROBLEM + + mode=1 + x(1)=ZERO + CALL dcopy_(n,x(1),0,x,1) + xnorm=ZERO + IF(m.EQ.0) GOTO 50 + iw=0 + DO 20 j=1,m + DO 10 i=1,n + iw=iw+1 + 10 w(iw)=g(j,i) + iw=iw+1 + 20 w(iw)=h(j) + IF=iw+1 + DO 30 i=1,n + iw=iw+1 + 30 w(iw)=ZERO + w(iw+1)=one + n1=n+1 + iz=iw+2 + iy=iz+n1 + iwdual=iy+m + +C SOLVE DUAL PROBLEM + + CALL nnls (w,n1,n1,m,w(IF),w(iy),rnorm,w(iwdual),w(iz),INDEX,mode) + + IF(mode.NE.1) GOTO 50 + mode=4 + IF(rnorm.LE.ZERO) GOTO 50 + +C COMPUTE SOLUTION OF PRIMAL PROBLEM + + fac=one-ddot_sl(m,h,1,w(iy),1) + IF(diff(one+fac,one).LE.ZERO) GOTO 50 + mode=1 + fac=one/fac + DO 40 j=1,n + 40 x(j)=fac*ddot_sl(m,g(1,j),1,w(iy),1) + xnorm=dnrm2_(n,x,1) + +C COMPUTE LAGRANGE MULTIPLIERS FOR PRIMAL PROBLEM + + w(1)=ZERO + CALL dcopy_(m,w(1),0,w,1) + CALL daxpy_sl(m,fac,w(iy),1,w,1) + +C END OF SUBROUTINE LDP + + 50 END + + + SUBROUTINE nnls (a, mda, m, n, b, x, rnorm, w, z, INDEX, mode) + +C C.L.LAWSON AND R.J.HANSON, JET PROPULSION LABORATORY: +C 'SOLVING LEAST SQUARES PROBLEMS'. PRENTICE-HALL.1974 + +C ********** NONNEGATIVE LEAST SQUARES ********** + +C GIVEN AN M BY N MATRIX, A, AND AN M-VECTOR, B, COMPUTE AN +C N-VECTOR, X, WHICH SOLVES THE LEAST SQUARES PROBLEM + +C A*X = B SUBJECT TO X >= 0 + +C A(),MDA,M,N +C MDA IS THE FIRST DIMENSIONING PARAMETER FOR THE ARRAY,A(). +C ON ENTRY A() CONTAINS THE M BY N MATRIX,A. +C ON EXIT A() CONTAINS THE PRODUCT Q*A, +C WHERE Q IS AN M BY M ORTHOGONAL MATRIX GENERATED +C IMPLICITLY BY THIS SUBROUTINE. +C EITHER M>=N OR M= M. EITHER M >= N OR M < N IS PERMITTED. +C THERE IS NO RESTRICTION ON THE RANK OF A. +C THE MATRIX A WILL BE MODIFIED BY THE SUBROUTINE. +C B(*,*),MDB,NB IF NB = 0 THE SUBROUTINE WILL MAKE NO REFERENCE +C TO THE ARRAY B. IF NB > 0 THE ARRAY B() MUST +C INITIALLY CONTAIN THE M x NB MATRIX B OF THE +C THE LEAST SQUARES PROBLEM AX = B AND ON RETURN +C THE ARRAY B() WILL CONTAIN THE N x NB SOLUTION X. +C IF NB>1 THE ARRAY B() MUST BE DOUBLE SUBSCRIPTED +C WITH FIRST DIMENSIONING PARAMETER MDB>=MAX(M,N), +C IF NB=1 THE ARRAY B() MAY BE EITHER SINGLE OR +C DOUBLE SUBSCRIPTED. +C TAU ABSOLUTE TOLERANCE PARAMETER FOR PSEUDORANK +C DETERMINATION, PROVIDED BY THE USER. +C KRANK PSEUDORANK OF A, SET BY THE SUBROUTINE. +C RNORM ON EXIT, RNORM(J) WILL CONTAIN THE EUCLIDIAN +C NORM OF THE RESIDUAL VECTOR FOR THE PROBLEM +C DEFINED BY THE J-TH COLUMN VECTOR OF THE ARRAY B. +C H(), G() ARRAYS OF WORKING SPACE OF LENGTH >= N. +C IP() INTEGER ARRAY OF WORKING SPACE OF LENGTH >= N +C RECORDING PERMUTATION INDICES OF COLUMN VECTORS + + INTEGER i,j,jb,k,kp1,krank,l,ldiag,lmax,m, + . mda,mdb,n,nb,ip(n) + DOUBLE PRECISION a(mda,n),b(mdb,nb),h(n),g(n),rnorm(nb),factor, + . tau,ZERO,hmax,diff,tmp,ddot_sl,dnrm2_,u,v + diff(u,v)= u-v + DATA ZERO/0.0d0/, factor/1.0d-3/ + + k=0 + ldiag=MIN(m,n) + IF(ldiag.LE.0) GOTO 270 + +C COMPUTE LMAX + + DO 80 j=1,ldiag + IF(j.EQ.1) GOTO 20 + lmax=j + DO 10 l=j,n + h(l)=h(l)-a(j-1,l)**2 + 10 IF(h(l).GT.h(lmax)) lmax=l + IF(diff(hmax+factor*h(lmax),hmax).GT.ZERO) + . GOTO 50 + 20 lmax=j + DO 40 l=j,n + h(l)=ZERO + DO 30 i=j,m + 30 h(l)=h(l)+a(i,l)**2 + 40 IF(h(l).GT.h(lmax)) lmax=l + hmax=h(lmax) + +C COLUMN INTERCHANGES IF NEEDED + + 50 ip(j)=lmax + IF(ip(j).EQ.j) GOTO 70 + DO 60 i=1,m + tmp=a(i,j) + a(i,j)=a(i,lmax) + 60 a(i,lmax)=tmp + h(lmax)=h(j) + +C J-TH TRANSFORMATION AND APPLICATION TO A AND B + + 70 i=MIN(j+1,n) + CALL h12(1,j,j+1,m,a(1,j),1,h(j),a(1,i),1,mda,n-j) + 80 CALL h12(2,j,j+1,m,a(1,j),1,h(j),b,1,mdb,nb) + +C DETERMINE PSEUDORANK + + DO 90 j=1,ldiag + 90 IF(ABS(a(j,j)).LE.tau) GOTO 100 + k=ldiag + GOTO 110 + 100 k=j-1 + 110 kp1=k+1 + +C NORM OF RESIDUALS + + DO 130 jb=1,nb + 130 rnorm(jb)=dnrm2_(m-k,b(kp1,jb),1) + IF(k.GT.0) GOTO 160 + DO 150 jb=1,nb + DO 150 i=1,n + 150 b(i,jb)=ZERO + GOTO 270 + 160 IF(k.EQ.n) GOTO 180 + +C HOUSEHOLDER DECOMPOSITION OF FIRST K ROWS + + DO 170 i=k,1,-1 + 170 CALL h12(1,i,kp1,n,a(i,1),mda,g(i),a,mda,1,i-1) + 180 DO 250 jb=1,nb + +C SOLVE K*K TRIANGULAR SYSTEM + + DO 210 i=k,1,-1 + j=MIN(i+1,n) + 210 b(i,jb)=(b(i,jb)-ddot_sl(k-i,a(i,j),mda,b(j,jb),1))/a(i,i) + +C COMPLETE SOLUTION VECTOR + + IF(k.EQ.n) GOTO 240 + DO 220 j=kp1,n + 220 b(j,jb)=ZERO + DO 230 i=1,k + 230 CALL h12(2,i,kp1,n,a(i,1),mda,g(i),b(1,jb),1,mdb,1) + +C REORDER SOLUTION ACCORDING TO PREVIOUS COLUMN INTERCHANGES + + 240 DO 250 j=ldiag,1,-1 + IF(ip(j).EQ.j) GOTO 250 + l=ip(j) + tmp=b(l,jb) + b(l,jb)=b(j,jb) + b(j,jb)=tmp + 250 CONTINUE + 270 krank=k + END + + SUBROUTINE h12 (mode,lpivot,l1,m,u,iue,up,c,ice,icv,ncv) + +C C.L.LAWSON AND R.J.HANSON, JET PROPULSION LABORATORY, 1973 JUN 12 +C TO APPEAR IN 'SOLVING LEAST SQUARES PROBLEMS', PRENTICE-HALL, 1974 + +C CONSTRUCTION AND/OR APPLICATION OF A SINGLE +C HOUSEHOLDER TRANSFORMATION Q = I + U*(U**T)/B + +C MODE = 1 OR 2 TO SELECT ALGORITHM H1 OR H2 . +C LPIVOT IS THE INDEX OF THE PIVOT ELEMENT. +C L1,M IF L1 <= M THE TRANSFORMATION WILL BE CONSTRUCTED TO +C ZERO ELEMENTS INDEXED FROM L1 THROUGH M. +C IF L1 > M THE SUBROUTINE DOES AN IDENTITY TRANSFORMATION. +C U(),IUE,UP +C ON ENTRY TO H1 U() STORES THE PIVOT VECTOR. +C IUE IS THE STORAGE INCREMENT BETWEEN ELEMENTS. +C ON EXIT FROM H1 U() AND UP STORE QUANTITIES DEFINING +C THE VECTOR U OF THE HOUSEHOLDER TRANSFORMATION. +C ON ENTRY TO H2 U() AND UP +C SHOULD STORE QUANTITIES PREVIOUSLY COMPUTED BY H1. +C THESE WILL NOT BE MODIFIED BY H2. +C C() ON ENTRY TO H1 OR H2 C() STORES A MATRIX WHICH WILL BE +C REGARDED AS A SET OF VECTORS TO WHICH THE HOUSEHOLDER +C TRANSFORMATION IS TO BE APPLIED. +C ON EXIT C() STORES THE SET OF TRANSFORMED VECTORS. +C ICE STORAGE INCREMENT BETWEEN ELEMENTS OF VECTORS IN C(). +C ICV STORAGE INCREMENT BETWEEN VECTORS IN C(). +C NCV NUMBER OF VECTORS IN C() TO BE TRANSFORMED. +C IF NCV <= 0 NO OPERATIONS WILL BE DONE ON C(). + + INTEGER incr, ice, icv, iue, lpivot, l1, mode, ncv + INTEGER i, i2, i3, i4, j, m + DOUBLE PRECISION u,up,c,cl,clinv,b,sm,one,ZERO + DIMENSION u(iue,*), c(*) + DATA one/1.0d+00/, ZERO/0.0d+00/ + + IF (0.GE.lpivot.OR.lpivot.GE.l1.OR.l1.GT.m) GOTO 80 + cl=ABS(u(1,lpivot)) + IF (mode.EQ.2) GOTO 30 + +C ****** CONSTRUCT THE TRANSFORMATION ****** + + DO 10 j=l1,m + sm=ABS(u(1,j)) + 10 cl=MAX(sm,cl) + IF (cl.LE.ZERO) GOTO 80 + clinv=one/cl + sm=(u(1,lpivot)*clinv)**2 + DO 20 j=l1,m + 20 sm=sm+(u(1,j)*clinv)**2 + cl=cl*SQRT(sm) + IF (u(1,lpivot).GT.ZERO) cl=-cl + up=u(1,lpivot)-cl + u(1,lpivot)=cl + GOTO 40 +C ****** APPLY THE TRANSFORMATION I+U*(U**T)/B TO C ****** + + 30 IF (cl.LE.ZERO) GOTO 80 + 40 IF (ncv.LE.0) GOTO 80 + b=up*u(1,lpivot) + IF (b.GE.ZERO) GOTO 80 + b=one/b + i2=1-icv+ice*(lpivot-1) + incr=ice*(l1-lpivot) + DO 70 j=1,ncv + i2=i2+icv + i3=i2+incr + i4=i3 + sm=c(i2)*up + DO 50 i=l1,m + sm=sm+c(i3)*u(1,i) + 50 i3=i3+ice + IF (sm.EQ.ZERO) GOTO 70 + sm=sm*b + c(i2)=c(i2)+sm*up + DO 60 i=l1,m + c(i4)=c(i4)+sm*u(1,i) + 60 i4=i4+ice + 70 CONTINUE + 80 END + + SUBROUTINE ldl (n,a,z,sigma,w) +C LDL LDL' - RANK-ONE - UPDATE + +C PURPOSE: +C UPDATES THE LDL' FACTORS OF MATRIX A BY RANK-ONE MATRIX +C SIGMA*Z*Z' + +C INPUT ARGUMENTS: (* MEANS PARAMETERS ARE CHANGED DURING EXECUTION) +C N : ORDER OF THE COEFFICIENT MATRIX A +C * A : POSITIVE DEFINITE MATRIX OF DIMENSION N; +C ONLY THE LOWER TRIANGLE IS USED AND IS STORED COLUMN BY +C COLUMN AS ONE DIMENSIONAL ARRAY OF DIMENSION N*(N+1)/2. +C * Z : VECTOR OF DIMENSION N OF UPDATING ELEMENTS +C SIGMA : SCALAR FACTOR BY WHICH THE MODIFYING DYADE Z*Z' IS +C MULTIPLIED + +C OUTPUT ARGUMENTS: +C A : UPDATED LDL' FACTORS + +C WORKING ARRAY: +C W : VECTOR OP DIMENSION N (USED ONLY IF SIGMA .LT. ZERO) + +C METHOD: +C THAT OF FLETCHER AND POWELL AS DESCRIBED IN : +C FLETCHER,R.,(1974) ON THE MODIFICATION OF LDL' FACTORIZATION. +C POWELL,M.J.D. MATH.COMPUTATION 28, 1067-1078. + +C IMPLEMENTED BY: +C KRAFT,D., DFVLR - INSTITUT FUER DYNAMIK DER FLUGSYSTEME +C D-8031 OBERPFAFFENHOFEN + +C STATUS: 15. JANUARY 1980 + +C SUBROUTINES REQUIRED: NONE + + INTEGER i, ij, j, n + DOUBLE PRECISION a(*), t, v, w(*), z(*), u, tp, one, beta, four, + * ZERO, alpha, delta, gamma, sigma, epmach + DATA ZERO, one, four, epmach /0.0d0, 1.0d0, 4.0d0, 2.22d-16/ + + IF(sigma.EQ.ZERO) GOTO 280 + ij=1 + t=one/sigma + IF(sigma.GT.ZERO) GOTO 220 +C PREPARE NEGATIVE UPDATE + DO 150 i=1,n + 150 w(i)=z(i) + DO 170 i=1,n + v=w(i) + t=t+v*v/a(ij) + DO 160 j=i+1,n + ij=ij+1 + 160 w(j)=w(j)-v*a(ij) + 170 ij=ij+1 + IF(t.GE.ZERO) t=epmach/sigma + DO 210 i=1,n + j=n+1-i + ij=ij-i + u=w(j) + w(j)=t + 210 t=t-u*u/a(ij) + 220 CONTINUE +C HERE UPDATING BEGINS + DO 270 i=1,n + v=z(i) + delta=v/a(ij) + IF(sigma.LT.ZERO) tp=w(i) + IF(sigma.GT.ZERO) tp=t+delta*v + alpha=tp/t + a(ij)=alpha*a(ij) + IF(i.EQ.n) GOTO 280 + beta=delta/tp + IF(alpha.GT.four) GOTO 240 + DO 230 j=i+1,n + ij=ij+1 + z(j)=z(j)-v*a(ij) + 230 a(ij)=a(ij)+beta*z(j) + GOTO 260 + 240 gamma=t/tp + DO 250 j=i+1,n + ij=ij+1 + u=a(ij) + a(ij)=gamma*u+beta*z(j) + 250 z(j)=z(j)-v*u + 260 ij=ij+1 + 270 t=tp + 280 RETURN +C END OF LDL + END + + DOUBLE PRECISION FUNCTION linmin (mode, ax, bx, f, tol) +C LINMIN LINESEARCH WITHOUT DERIVATIVES + +C PURPOSE: + +C TO FIND THE ARGUMENT LINMIN WHERE THE FUNCTION F TAKES IT'S MINIMUM +C ON THE INTERVAL AX, BX. +C COMBINATION OF GOLDEN SECTION AND SUCCESSIVE QUADRATIC INTERPOLATION. + +C INPUT ARGUMENTS: (* MEANS PARAMETERS ARE CHANGED DURING EXECUTION) + +C *MODE SEE OUTPUT ARGUMENTS +C AX LEFT ENDPOINT OF INITIAL INTERVAL +C BX RIGHT ENDPOINT OF INITIAL INTERVAL +C F FUNCTION VALUE AT LINMIN WHICH IS TO BE BROUGHT IN BY +C REVERSE COMMUNICATION CONTROLLED BY MODE +C TOL DESIRED LENGTH OF INTERVAL OF UNCERTAINTY OF FINAL RESULT + +C OUTPUT ARGUMENTS: + +C LINMIN ABSCISSA APPROXIMATING THE POINT WHERE F ATTAINS A MINIMUM +C MODE CONTROLS REVERSE COMMUNICATION +C MUST BE SET TO 0 INITIALLY, RETURNS WITH INTERMEDIATE +C VALUES 1 AND 2 WHICH MUST NOT BE CHANGED BY THE USER, +C ENDS WITH CONVERGENCE WITH VALUE 3. + +C WORKING ARRAY: + +C NONE + +C METHOD: + +C THIS FUNCTION SUBPROGRAM IS A SLIGHTLY MODIFIED VERSION OF THE +C ALGOL 60 PROCEDURE LOCALMIN GIVEN IN +C R.P. BRENT: ALGORITHMS FOR MINIMIZATION WITHOUT DERIVATIVES, +C PRENTICE-HALL (1973). + +C IMPLEMENTED BY: + +C KRAFT, D., DFVLR - INSTITUT FUER DYNAMIK DER FLUGSYSTEME +C D-8031 OBERPFAFFENHOFEN + +C STATUS: 31. AUGUST 1984 + +C SUBROUTINES REQUIRED: NONE + + INTEGER mode + DOUBLE PRECISION f, tol, a, b, c, d, e, p, q, r, u, v, w, x, m, + & fu, fv, fw, fx, eps, tol1, tol2, ZERO, ax, bx + DATA c /0.381966011d0/, eps /1.5d-8/, ZERO /0.0d0/ + +C EPS = SQUARE - ROOT OF MACHINE PRECISION +C C = GOLDEN SECTION RATIO = (3-SQRT(5))/2 + + GOTO (10, 55), mode + +C INITIALIZATION + + a = ax + b = bx + e = ZERO + v = a + c*(b - a) + w = v + x = w + linmin = x + mode = 1 + GOTO 100 + +C MAIN LOOP STARTS HERE + + 10 fx = f + fv = fx + fw = fv + 20 m = 0.5d0*(a + b) + tol1 = eps*ABS(x) + tol + tol2 = tol1 + tol1 + +C TEST CONVERGENCE + + IF (ABS(x - m) .LE. tol2 - 0.5d0*(b - a)) GOTO 90 + r = ZERO + q = r + p = q + IF (ABS(e) .LE. tol1) GOTO 30 + +C FIT PARABOLA + + r = (x - w)*(fx - fv) + q = (x - v)*(fx - fw) + p = (x - v)*q - (x - w)*r + q = q - r + q = q + q + IF (q .GT. ZERO) p = -p + IF (q .LT. ZERO) q = -q + r = e + e = d + +C IS PARABOLA ACCEPTABLE + + 30 IF (ABS(p) .GE. 0.5d0*ABS(q*r) .OR. + & p .LE. q*(a - x) .OR. p .GE. q*(b-x)) GOTO 40 + +C PARABOLIC INTERPOLATION STEP + + d = p/q + +C F MUST NOT BE EVALUATED TOO CLOSE TO A OR B + + IF (u - a .LT. tol2) d = SIGN(tol1, m - x) + IF (b - u .LT. tol2) d = SIGN(tol1, m - x) + GOTO 50 + +C GOLDEN SECTION STEP + + 40 IF (x .GE. m) e = a - x + IF (x .LT. m) e = b - x + d = c*e + +C F MUST NOT BE EVALUATED TOO CLOSE TO X + + 50 IF (ABS(d) .LT. tol1) d = SIGN(tol1, d) + u = x + d + linmin = u + mode = 2 + GOTO 100 + 55 fu = f + +C UPDATE A, B, V, W, AND X + + IF (fu .GT. fx) GOTO 60 + IF (u .GE. x) a = x + IF (u .LT. x) b = x + v = w + fv = fw + w = x + fw = fx + x = u + fx = fu + GOTO 85 + 60 IF (u .LT. x) a = u + IF (u .GE. x) b = u + IF (fu .LE. fw .OR. w .EQ. x) GOTO 70 + IF (fu .LE. fv .OR. v .EQ. x .OR. v .EQ. w) GOTO 80 + GOTO 85 + 70 v = w + fv = fw + w = u + fw = fu + GOTO 85 + 80 v = u + fv = fu + 85 GOTO 20 + +C END OF MAIN LOOP + + 90 linmin = x + mode = 3 + 100 RETURN + +C END OF LINMIN + + END + +C## Following a selection from BLAS Level 1 + + SUBROUTINE daxpy_sl(n,da,dx,incx,dy,incy) + +C CONSTANT TIMES A VECTOR PLUS A VECTOR. +C USES UNROLLED LOOPS FOR INCREMENTS EQUAL TO ONE. +C JACK DONGARRA, LINPACK, 3/11/78. + + DOUBLE PRECISION dx(*),dy(*),da + INTEGER i,incx,incy,ix,iy,m,mp1,n + + IF(n.LE.0)RETURN + IF(da.EQ.0.0d0)RETURN + IF(incx.EQ.1.AND.incy.EQ.1)GO TO 20 + +C CODE FOR UNEQUAL INCREMENTS OR EQUAL INCREMENTS +C NOT EQUAL TO 1 + + ix = 1 + iy = 1 + IF(incx.LT.0)ix = (-n+1)*incx + 1 + IF(incy.LT.0)iy = (-n+1)*incy + 1 + DO 10 i = 1,n + dy(iy) = dy(iy) + da*dx(ix) + ix = ix + incx + iy = iy + incy + 10 CONTINUE + RETURN + +C CODE FOR BOTH INCREMENTS EQUAL TO 1 + +C CLEAN-UP LOOP + + 20 m = MOD(n,4) + IF( m .EQ. 0 ) GO TO 40 + DO 30 i = 1,m + dy(i) = dy(i) + da*dx(i) + 30 CONTINUE + IF( n .LT. 4 ) RETURN + 40 mp1 = m + 1 + DO 50 i = mp1,n,4 + dy(i) = dy(i) + da*dx(i) + dy(i + 1) = dy(i + 1) + da*dx(i + 1) + dy(i + 2) = dy(i + 2) + da*dx(i + 2) + dy(i + 3) = dy(i + 3) + da*dx(i + 3) + 50 CONTINUE + RETURN + END + + SUBROUTINE dcopy_(n,dx,incx,dy,incy) + +C COPIES A VECTOR, X, TO A VECTOR, Y. +C USES UNROLLED LOOPS FOR INCREMENTS EQUAL TO ONE. +C JACK DONGARRA, LINPACK, 3/11/78. + + DOUBLE PRECISION dx(*),dy(*) + INTEGER i,incx,incy,ix,iy,m,mp1,n + + IF(n.LE.0)RETURN + IF(incx.EQ.1.AND.incy.EQ.1)GO TO 20 + +C CODE FOR UNEQUAL INCREMENTS OR EQUAL INCREMENTS +C NOT EQUAL TO 1 + + ix = 1 + iy = 1 + IF(incx.LT.0)ix = (-n+1)*incx + 1 + IF(incy.LT.0)iy = (-n+1)*incy + 1 + DO 10 i = 1,n + dy(iy) = dx(ix) + ix = ix + incx + iy = iy + incy + 10 CONTINUE + RETURN + +C CODE FOR BOTH INCREMENTS EQUAL TO 1 + +C CLEAN-UP LOOP + + 20 m = MOD(n,7) + IF( m .EQ. 0 ) GO TO 40 + DO 30 i = 1,m + dy(i) = dx(i) + 30 CONTINUE + IF( n .LT. 7 ) RETURN + 40 mp1 = m + 1 + DO 50 i = mp1,n,7 + dy(i) = dx(i) + dy(i + 1) = dx(i + 1) + dy(i + 2) = dx(i + 2) + dy(i + 3) = dx(i + 3) + dy(i + 4) = dx(i + 4) + dy(i + 5) = dx(i + 5) + dy(i + 6) = dx(i + 6) + 50 CONTINUE + RETURN + END + + DOUBLE PRECISION FUNCTION ddot_sl(n,dx,incx,dy,incy) + +C FORMS THE DOT PRODUCT OF TWO VECTORS. +C USES UNROLLED LOOPS FOR INCREMENTS EQUAL TO ONE. +C JACK DONGARRA, LINPACK, 3/11/78. + + DOUBLE PRECISION dx(*),dy(*),dtemp + INTEGER i,incx,incy,ix,iy,m,mp1,n + + ddot_sl = 0.0d0 + dtemp = 0.0d0 + IF(n.LE.0)RETURN + IF(incx.EQ.1.AND.incy.EQ.1)GO TO 20 + +C CODE FOR UNEQUAL INCREMENTS OR EQUAL INCREMENTS +C NOT EQUAL TO 1 + + ix = 1 + iy = 1 + IF(incx.LT.0)ix = (-n+1)*incx + 1 + IF(incy.LT.0)iy = (-n+1)*incy + 1 + DO 10 i = 1,n + dtemp = dtemp + dx(ix)*dy(iy) + ix = ix + incx + iy = iy + incy + 10 CONTINUE + ddot_sl = dtemp + RETURN + +C CODE FOR BOTH INCREMENTS EQUAL TO 1 + +C CLEAN-UP LOOP + + 20 m = MOD(n,5) + IF( m .EQ. 0 ) GO TO 40 + DO 30 i = 1,m + dtemp = dtemp + dx(i)*dy(i) + 30 CONTINUE + IF( n .LT. 5 ) GO TO 60 + 40 mp1 = m + 1 + DO 50 i = mp1,n,5 + dtemp = dtemp + dx(i)*dy(i) + dx(i + 1)*dy(i + 1) + + * dx(i + 2)*dy(i + 2) + dx(i + 3)*dy(i + 3) + dx(i + 4)*dy(i + 4) + 50 CONTINUE + 60 ddot_sl = dtemp + RETURN + END + + DOUBLE PRECISION FUNCTION dnrm1(n,x,i,j) + INTEGER n, i, j, k + DOUBLE PRECISION snormx, sum, x(n), ZERO, one, scale, temp + DATA ZERO/0.0d0/, one/1.0d0/ + +C DNRM1 - COMPUTES THE I-NORM OF A VECTOR +C BETWEEN THE ITH AND THE JTH ELEMENTS + +C INPUT - +C N LENGTH OF VECTOR +C X VECTOR OF LENGTH N +C I INITIAL ELEMENT OF VECTOR TO BE USED +C J FINAL ELEMENT TO USE + +C OUTPUT - +C DNRM1 NORM + + snormx=ZERO + DO 10 k=i,j + 10 snormx=MAX(snormx,ABS(x(k))) + dnrm1 = snormx + IF (snormx.EQ.ZERO) RETURN + scale = snormx + IF (snormx.GE.one) scale=SQRT(snormx) + sum=ZERO + DO 20 k=i,j + temp=ZERO + IF (ABS(x(k))+scale .NE. scale) temp = x(k)/snormx + IF (one+temp.NE.one) sum = sum+temp*temp + 20 CONTINUE + sum=SQRT(sum) + dnrm1=snormx*sum + RETURN + END + + DOUBLE PRECISION FUNCTION dnrm2_ ( n, dx, incx) + INTEGER n, i, j, nn, next, incx + DOUBLE PRECISION dx(*), cutlo, cuthi, hitest, sum, xmax, ZERO, one + DATA ZERO, one /0.0d0, 1.0d0/ + +C EUCLIDEAN NORM OF THE N-VECTOR STORED IN DX() WITH STORAGE +C INCREMENT INCX . +C IF N .LE. 0 RETURN WITH RESULT = 0. +C IF N .GE. 1 THEN INCX MUST BE .GE. 1 + +C C.L.LAWSON, 1978 JAN 08 + +C FOUR PHASE METHOD USING TWO BUILT-IN CONSTANTS THAT ARE +C HOPEFULLY APPLICABLE TO ALL MACHINES. +C CUTLO = MAXIMUM OF SQRT(U/EPS) OVER ALL KNOWN MACHINES. +C CUTHI = MINIMUM OF SQRT(V) OVER ALL KNOWN MACHINES. +C WHERE +C EPS = SMALLEST NO. SUCH THAT EPS + 1. .GT. 1. +C U = SMALLEST POSITIVE NO. (UNDERFLOW LIMIT) +C V = LARGEST NO. (OVERFLOW LIMIT) + +C BRIEF OUTLINE OF ALGORITHM.. + +C PHASE 1 SCANS ZERO COMPONENTS. +C MOVE TO PHASE 2 WHEN A COMPONENT IS NONZERO AND .LE. CUTLO +C MOVE TO PHASE 3 WHEN A COMPONENT IS .GT. CUTLO +C MOVE TO PHASE 4 WHEN A COMPONENT IS .GE. CUTHI/M +C WHERE M = N FOR X() REAL AND M = 2*N FOR COMPLEX. + +C VALUES FOR CUTLO AND CUTHI.. +C FROM THE ENVIRONMENTAL PARAMETERS LISTED IN THE IMSL CONVERTER +C DOCUMENT THE LIMITING VALUES ARE AS FOLLOWS.. +C CUTLO, S.P. U/EPS = 2**(-102) FOR HONEYWELL. CLOSE SECONDS ARE +C UNIVAC AND DEC AT 2**(-103) +C THUS CUTLO = 2**(-51) = 4.44089E-16 +C CUTHI, S.P. V = 2**127 FOR UNIVAC, HONEYWELL, AND DEC. +C THUS CUTHI = 2**(63.5) = 1.30438E19 +C CUTLO, D.P. U/EPS = 2**(-67) FOR HONEYWELL AND DEC. +C THUS CUTLO = 2**(-33.5) = 8.23181D-11 +C CUTHI, D.P. SAME AS S.P. CUTHI = 1.30438D19 +C DATA CUTLO, CUTHI / 8.232D-11, 1.304D19 / +C DATA CUTLO, CUTHI / 4.441E-16, 1.304E19 / + DATA cutlo, cuthi / 8.232d-11, 1.304d19 / + + IF(n .GT. 0) GO TO 10 + dnrm2_ = ZERO + GO TO 300 + + 10 assign 30 to next + sum = ZERO + nn = n * incx +C BEGIN MAIN LOOP + i = 1 + 20 GO TO next,(30, 50, 70, 110) + 30 IF( ABS(dx(i)) .GT. cutlo) GO TO 85 + assign 50 to next + xmax = ZERO + +C PHASE 1. SUM IS ZERO + + 50 IF( dx(i) .EQ. ZERO) GO TO 200 + IF( ABS(dx(i)) .GT. cutlo) GO TO 85 + +C PREPARE FOR PHASE 2. + + assign 70 to next + GO TO 105 + +C PREPARE FOR PHASE 4. + + 100 i = j + assign 110 to next + sum = (sum / dx(i)) / dx(i) + 105 xmax = ABS(dx(i)) + GO TO 115 + +C PHASE 2. SUM IS SMALL. +C SCALE TO AVOID DESTRUCTIVE UNDERFLOW. + + 70 IF( ABS(dx(i)) .GT. cutlo ) GO TO 75 + +C COMMON CODE FOR PHASES 2 AND 4. +C IN PHASE 4 SUM IS LARGE. SCALE TO AVOID OVERFLOW. + + 110 IF( ABS(dx(i)) .LE. xmax ) GO TO 115 + sum = one + sum * (xmax / dx(i))**2 + xmax = ABS(dx(i)) + GO TO 200 + + 115 sum = sum + (dx(i)/xmax)**2 + GO TO 200 + +C PREPARE FOR PHASE 3. + + 75 sum = (sum * xmax) * xmax + +C FOR REAL OR D.P. SET HITEST = CUTHI/N +C FOR COMPLEX SET HITEST = CUTHI/(2*N) + + 85 hitest = cuthi/float( n ) + +C PHASE 3. SUM IS MID-RANGE. NO SCALING. + + DO 95 j =i,nn,incx + IF(ABS(dx(j)) .GE. hitest) GO TO 100 + 95 sum = sum + dx(j)**2 + dnrm2_ = SQRT( sum ) + GO TO 300 + + 200 CONTINUE + i = i + incx + IF ( i .LE. nn ) GO TO 20 + +C END OF MAIN LOOP. + +C COMPUTE SQUARE ROOT AND ADJUST FOR SCALING. + + dnrm2_ = xmax * SQRT(sum) + 300 CONTINUE + RETURN + END + + SUBROUTINE dsrot (n,dx,incx,dy,incy,c,s) + +C APPLIES A PLANE ROTATION. +C JACK DONGARRA, LINPACK, 3/11/78. + + DOUBLE PRECISION dx(*),dy(*),dtemp,c,s + INTEGER i,incx,incy,ix,iy,n + + IF(n.LE.0)RETURN + IF(incx.EQ.1.AND.incy.EQ.1)GO TO 20 + +C CODE FOR UNEQUAL INCREMENTS OR EQUAL INCREMENTS NOT EQUAL +C TO 1 + + ix = 1 + iy = 1 + IF(incx.LT.0)ix = (-n+1)*incx + 1 + IF(incy.LT.0)iy = (-n+1)*incy + 1 + DO 10 i = 1,n + dtemp = c*dx(ix) + s*dy(iy) + dy(iy) = c*dy(iy) - s*dx(ix) + dx(ix) = dtemp + ix = ix + incx + iy = iy + incy + 10 CONTINUE + RETURN + +C CODE FOR BOTH INCREMENTS EQUAL TO 1 + + 20 DO 30 i = 1,n + dtemp = c*dx(i) + s*dy(i) + dy(i) = c*dy(i) - s*dx(i) + dx(i) = dtemp + 30 CONTINUE + RETURN + END + + SUBROUTINE dsrotg(da,db,c,s) + +C CONSTRUCT GIVENS PLANE ROTATION. +C JACK DONGARRA, LINPACK, 3/11/78. +C MODIFIED 9/27/86. + + DOUBLE PRECISION da,db,c,s,roe,scale,r,z,one,ZERO + DATA one, ZERO /1.0d+00, 0.0d+00/ + + roe = db + IF( ABS(da) .GT. ABS(db) ) roe = da + scale = ABS(da) + ABS(db) + IF( scale .NE. ZERO ) GO TO 10 + c = one + s = ZERO + r = ZERO + GO TO 20 + 10 r = scale*SQRT((da/scale)**2 + (db/scale)**2) + r = SIGN(one,roe)*r + c = da/r + s = db/r + 20 z = s + IF( ABS(c) .GT. ZERO .AND. ABS(c) .LE. s ) z = one/c + da = r + db = z + RETURN + END + + SUBROUTINE dscal_sl(n,da,dx,incx) + +C SCALES A VECTOR BY A CONSTANT. +C USES UNROLLED LOOPS FOR INCREMENT EQUAL TO ONE. +C JACK DONGARRA, LINPACK, 3/11/78. + + DOUBLE PRECISION da,dx(*) + INTEGER i,incx,m,mp1,n,nincx + + IF(n.LE.0)RETURN + IF(incx.EQ.1)GO TO 20 + + +C CODE FOR INCREMENT NOT EQUAL TO 1 + + nincx = n*incx + DO 10 i = 1,nincx,incx + dx(i) = da*dx(i) + 10 CONTINUE + RETURN + +C CODE FOR INCREMENT EQUAL TO 1 + +C CLEAN-UP LOOP + + 20 m = MOD(n,5) + IF( m .EQ. 0 ) GO TO 40 + DO 30 i = 1,m + dx(i) = da*dx(i) + 30 CONTINUE + IF( n .LT. 5 ) RETURN + 40 mp1 = m + 1 + DO 50 i = mp1,n,5 + dx(i) = da*dx(i) + dx(i + 1) = da*dx(i + 1) + dx(i + 2) = da*dx(i + 2) + dx(i + 3) = da*dx(i + 3) + dx(i + 4) = da*dx(i + 4) + 50 CONTINUE + RETURN + END Property changes on: trunk/scipy/optimize/slsqp/slsqp_optmz.f ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/scipy/optimize/slsqp.py =================================================================== --- trunk/scipy/optimize/slsqp.py 2007-12-17 15:59:22 UTC (rev 3677) +++ trunk/scipy/optimize/slsqp.py 2007-12-17 20:13:41 UTC (rev 3678) @@ -0,0 +1,236 @@ +from _slsqp import slsqp +from numpy import zeros, array, identity, linalg, rank, squeeze, append, \ + asfarray,product +from sys import exit +from math import sqrt +from optimize import approx_fprime, wrap_function +import numpy + +_epsilon = sqrt(numpy.finfo(float).eps) + +def fmin_slsqp( func, x0 , eqcons=[], f_eqcons=None, ieqcons=[], f_ieqcons=None, + bounds = [], fprime = None, fprime_cons=None,args = (), + iter = 100, acc = 1.0E-6, iprint = 1, full_output = 0, + epsilon = _epsilon ): + """ + Minimize a function using Sequential Least SQuares Programming + + Description: + Python interface function for the SLSQP Optimization subroutine + originally implemented by Dieter Kraft. + + Inputs: + func - Objective function (in the form func(x, *args)) + x0 - Initial guess for the independent variable(s). + eqcons - A list of functions of length n such that + eqcons[j](x0,*args) == 0.0 in a successfully optimized + problem. + f_eqcons - A function of the form f_eqcons(x, *args) that returns an + array in which each element must equal 0.0 in a + successfully optimized problem. If f_eqcons is + specified, eqcons is ignored. + ieqcons - A list of functions of length n such that + ieqcons[j](x0,*args) >= 0.0 in a successfully optimized + problem. + f_ieqcons - A function of the form f_ieqcons(x0, *args) that returns + an array in which each element must be greater or equal + to 0.0 in a successfully optimized problem. If + f_ieqcons is specified, ieqcons is ignored. + bounds - A list of tuples specifying the lower and upper bound + for each independent variable [(xl0, xu0),(xl1, xu1),...] + fprime - A function that evaluates the partial derivatives of func + fprime_cons - A function of the form f(x, *args) that returns the + m by n array of constraint normals. If not provided, + the normals will be approximated. Equality constraint + normals precede inequality constraint normals. The + array returned by fprime_cons should be sized as + ( len(eqcons) + len(ieqcons), len(x0) ). If + fprime_cons is not supplied (normals are approximated) + then the constraints must be supplied via the eqcons + and ieqcons structures, not f_eqcons and f_ieqcons. + args - A sequence of additional arguments passed to func and fprime + iter - The maximum number of iterations (int) + acc - Requested accuracy (float) + iprint - The verbosity of fmin_slsqp. + iprint <= 0 : Silent operation + iprint == 1 : Print summary upon completion (default) + iprint >= 2 : Print status of each iterate and summary + full_output - If 0, return only the minimizer of func (default). + Otherwise, output final objective function and summary + information. + epsilon - The step size for finite-difference derivative estimates. + + Outputs: ( x, { fx, gnorm, its, imode, smode }) + x - The final minimizer of func. + fx - The final value of the objective function. + its - The number of iterations. + imode - The exit mode from the optimizer, as an integer. + smode - A string describing the exit mode from the optimizer. + + Exit modes are defined as follows: + -1 : Gradient evaluation required (g & a) + 0 : Optimization terminated successfully. + 1 : Function evaluation required (f & c) + 2 : More equality constraints than independent variables + 3 : More than 3*n iterations in LSQ subproblem + 4 : Inequality constraints incompatible + 5 : Singular matrix E in LSQ subproblem + 6 : Singular matrix C in LSQ subproblem + 7 : Rank-deficient equality constraint subproblem HFTI + 8 : Positive directional derivative for linesearch + 9 : Iteration limit exceeded + + """ + + exit_modes = { -1 : "Gradient evaluation required (g & a)", + 0 : "Optimization terminated successfully.", + 1 : "Function evaluation required (f & c)", + 2 : "More equality constraints than independent variables", + 3 : "More than 3*n iterations in LSQ subproblem", + 4 : "Inequality constraints incompatible", + 5 : "Singular matrix E in LSQ subproblem", + 6 : "Singular matrix C in LSQ subproblem", + 7 : "Rank-deficient equality constraint subproblem HFTI", + 8 : "Positive directional derivative for linesearch", + 9 : "Iteration limit exceeded" } + + # Wrap the functions + # Wrap func + feval, func = wrap_function(func, args) + if fprime: + # Wrap fprime, if provided + geval, fprime = wrap_function(fprime,args) + else: + # Wrap approx_fprime, if fprime not provided + geval, fprime = wrap_function(approx_fprime,(func,epsilon)) + if fprime_cons: + approx_constraint_norms = False + if f_eqcons: + ceval, f_eqcons = wrap_function(f_eqcons,args) + else: + for i in range(len(eqcons)): + if eqcons[i]: + ceval, eqcons[i] = wrap_function(eqcons[i],args) + if f_ieqcons: + ceval, f_ieqcons = wrap_function(f_ieqcons,args) + else: + for i in range(len(ieqcons)): + if ieqcons[i]: + ceval, ieqcons[i] = wrap_function(ieqcons[i],args) + geval, fprime_cons = wrap_function(fprime_cons,args) + else: + approx_constraint_norms = True + eqcons_prime = [] + for i in range(len(eqcons)): + eqcons_prime.append(None) + if eqcons[i]: + ceval, eqcons[i] = wrap_function(eqcons[i],args) + geval, eqcons_prime[i] = \ + wrap_function(approx_fprime, (eqcons[i],epsilon)) + ieqcons_prime = [] + for i in range(len(ieqcons)): + ieqcons_prime.append(None) + if ieqcons[i]: + ceval, ieqcons[i] = wrap_function(ieqcons[i],args) + geval, ieqcons_prime[i] = \ + wrap_function(approx_fprime, (ieqcons[i],epsilon)) + + # Transform x0 into an array. + x = asfarray(x0).flatten() + + # Set the parameters that SLSQP will need + meq = len(eqcons) # meq = The number of equality constraints + m = meq + len(ieqcons) # m = The total number of constraints + la = array([1,m]).max() # la = + n = len(x) # n = The number of independent variables + + # Define the workspaces for SLSQP + n1 = n+1 + mineq = m - meq + n1 + n1 + len_w = (3*n1+m)*(n1+1)+(n1-meq+1)*(mineq+2) + 2*mineq+(n1+mineq)*(n1-meq) \ + + 2*meq + n1 +(n+1)*n/2 + 2*m + 3*n + 3*n1 + 1 + len_jw = mineq + w = zeros(len_w) + jw = zeros(len_jw) + + # Decompose bounds into xl and xu + if len(bounds) == 0: + bounds = [(-1.0E12, 1.0E12) for i in range(n)] + if len(bounds) != n: + raise IndexError, 'SLSQP Error: If bounds is specified, len(bounds) == len(x0)' + xl = array( [ b[0] for b in bounds ] ) + xu = array( [ b[1] for b in bounds ] ) + + # Initialize the iteration counter and the mode value + mode = array(0,int) + acc = array(acc,float) + majiter = array(iter,int) + majiter_prev = 0 + + # Print the header if iprint >= 2 + if iprint >= 2: + print "%5s %5s %16s %16s" % ("NIT","FC","OBJFUN","GNORM") + + while 1: + if mode == 0 or mode == 1: # objective and constraint evaluation requird + # Compute objective function + fx = func(x) + # Compute the constraints + if f_eqcons: + ceq = f_eqcons(x) + else: + ceq = [ eqcons[i](x) for i in range(meq) ] + if f_ieqcons: + cieq = f_ieqcons(x) + else: + cieq = [ ieqcons[i](x) for i in range(len(ieqcons)) ] + c = numpy.concatenate( (ceq,cieq), 1) + #c = array ( [ eqcons[i](x) for i in range(meq) ] + + # [ ieqcons[i](x) for i in range(len(ieqcons)) ] ) + if mode == 0 or mode == -1: # gradient evaluation required + # Compute the derivatives of the objective function + # For some reason SLSQP wants g dimensioned to n+1 + g = append(fprime(x),0.0) + + # Compute the normals of the constraints + if approx_constraint_norms: + a = zeros([la,n1]) + for i in range(meq): + a[i] = append(eqcons_prime[i](x),0.0) + for i in range(meq+1,m): + a[i] = append(ieqcons_prime[i](x),0.0) + else: + a = numpy.concatenate( (fprime_cons(x),zeros([la,1])),1) + + # Call SLSQP + slsqp(m, meq, x, xl, xu, fx, c, g, a, acc, majiter, mode, w, jw) + + # Print the status of the current iterate if iprint > 2 and the + # major iteration has incremented + if iprint >= 2 and majiter > majiter_prev: + print "%5i %5i % 16.6E % 16.6E" % (majiter,feval[0], + fx,linalg.norm(g)) + + # If exit mode is not -1 or 1, slsqp has completed + if abs(mode) != 1: + break + + majiter_prev = int(majiter) + + # Optimization loop complete. Print status if requested + if iprint >= 1: + print exit_modes[int(mode)] + " (Exit mode " + str(mode) + ')' + print " Current function value:", fx + print " Iterations:", majiter + print " Function evaluations:", feval[0] + print " Gradient evaluations:", geval[0] + + if full_output == 0: + return x + else: + return [list(x), + float(fx), + int(majiter), + int(mode), + exit_modes[int(mode)] ] + Property changes on: trunk/scipy/optimize/slsqp.py ___________________________________________________________________ Name: svn:keywords + Id From scipy-svn at scipy.org Mon Dec 17 17:39:32 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 17 Dec 2007 16:39:32 -0600 (CST) Subject: [Scipy-svn] r3679 - in trunk/scipy/optimize: . tests Message-ID: <20071217223932.9A8E539C046@new.scipy.org> Author: stefan Date: 2007-12-17 16:39:03 -0600 (Mon, 17 Dec 2007) New Revision: 3679 Added: trunk/scipy/optimize/tests/test_slsqp.py Modified: trunk/scipy/optimize/slsqp.py Log: Add tests for slsqp. Reformat docstring. Remove Windows line endings. Modified: trunk/scipy/optimize/slsqp.py =================================================================== --- trunk/scipy/optimize/slsqp.py 2007-12-17 20:13:41 UTC (rev 3678) +++ trunk/scipy/optimize/slsqp.py 2007-12-17 22:39:03 UTC (rev 3679) @@ -1,3 +1,5 @@ +__all__ = ['fmin_slsqp'] + from _slsqp import slsqp from numpy import zeros, array, identity, linalg, rank, squeeze, append, \ asfarray,product @@ -10,80 +12,99 @@ def fmin_slsqp( func, x0 , eqcons=[], f_eqcons=None, ieqcons=[], f_ieqcons=None, bounds = [], fprime = None, fprime_cons=None,args = (), - iter = 100, acc = 1.0E-6, iprint = 1, full_output = 0, + iter = 100, acc = 1.0E-6, iprint = 1, full_output = 0, epsilon = _epsilon ): """ Minimize a function using Sequential Least SQuares Programming - - Description: - Python interface function for the SLSQP Optimization subroutine - originally implemented by Dieter Kraft. - - Inputs: - func - Objective function (in the form func(x, *args)) - x0 - Initial guess for the independent variable(s). - eqcons - A list of functions of length n such that - eqcons[j](x0,*args) == 0.0 in a successfully optimized - problem. - f_eqcons - A function of the form f_eqcons(x, *args) that returns an - array in which each element must equal 0.0 in a - successfully optimized problem. If f_eqcons is - specified, eqcons is ignored. - ieqcons - A list of functions of length n such that - ieqcons[j](x0,*args) >= 0.0 in a successfully optimized - problem. - f_ieqcons - A function of the form f_ieqcons(x0, *args) that returns - an array in which each element must be greater or equal - to 0.0 in a successfully optimized problem. If - f_ieqcons is specified, ieqcons is ignored. - bounds - A list of tuples specifying the lower and upper bound - for each independent variable [(xl0, xu0),(xl1, xu1),...] - fprime - A function that evaluates the partial derivatives of func - fprime_cons - A function of the form f(x, *args) that returns the - m by n array of constraint normals. If not provided, - the normals will be approximated. Equality constraint - normals precede inequality constraint normals. The - array returned by fprime_cons should be sized as - ( len(eqcons) + len(ieqcons), len(x0) ). If - fprime_cons is not supplied (normals are approximated) - then the constraints must be supplied via the eqcons - and ieqcons structures, not f_eqcons and f_ieqcons. - args - A sequence of additional arguments passed to func and fprime - iter - The maximum number of iterations (int) - acc - Requested accuracy (float) - iprint - The verbosity of fmin_slsqp. - iprint <= 0 : Silent operation - iprint == 1 : Print summary upon completion (default) - iprint >= 2 : Print status of each iterate and summary - full_output - If 0, return only the minimizer of func (default). - Otherwise, output final objective function and summary - information. - epsilon - The step size for finite-difference derivative estimates. - - Outputs: ( x, { fx, gnorm, its, imode, smode }) - x - The final minimizer of func. - fx - The final value of the objective function. - its - The number of iterations. - imode - The exit mode from the optimizer, as an integer. - smode - A string describing the exit mode from the optimizer. - - Exit modes are defined as follows: - -1 : Gradient evaluation required (g & a) - 0 : Optimization terminated successfully. - 1 : Function evaluation required (f & c) - 2 : More equality constraints than independent variables - 3 : More than 3*n iterations in LSQ subproblem - 4 : Inequality constraints incompatible - 5 : Singular matrix E in LSQ subproblem - 6 : Singular matrix C in LSQ subproblem - 7 : Rank-deficient equality constraint subproblem HFTI - 8 : Positive directional derivative for linesearch - 9 : Iteration limit exceeded + Python interface function for the SLSQP Optimization subroutine + originally implemented by Dieter Kraft. + + *Parameters*: + func : callable f(x,*args) + Objective function. + x0 : ndarray of float + Initial guess for the independent variable(s). + eqcons : list + A list of functions of length n such that + eqcons[j](x0,*args) == 0.0 in a successfully optimized + problem. + f_eqcons : callable f(x,*args) + Returns an array in which each element must equal 0.0 in a + successfully optimized problem. If f_eqcons is specified, + eqcons is ignored. + ieqcons : list + A list of functions of length n such that + ieqcons[j](x0,*args) >= 0.0 in a successfully optimized + problem. + f_ieqcons : callable f(x0,*args) + Returns an array in which each element must be greater or + equal to 0.0 in a successfully optimized problem. If + f_ieqcons is specified, ieqcons is ignored. + bounds : list + A list of tuples specifying the lower and upper bound + for each independent variable [(xl0, xu0),(xl1, xu1),...] + fprime : callable f(x,*args) + A function that evaluates the partial derivatives of func. + fprime_cons : callable f(x,*args) + A function of the form f(x, *args) that returns the m by n + array of constraint normals. If not provided, the normals + will be approximated. Equality constraint normals precede + inequality constraint normals. The array returned by + fprime_cons should be sized as ( len(eqcons) + + len(ieqcons), len(x0) ). If fprime_cons is not supplied + (normals are approximated) then the constraints must be + supplied via the eqcons and ieqcons structures, not + f_eqcons and f_ieqcons. + args : sequence + Additional arguments passed to func and fprime. + iter : int + The maximum number of iterations. + acc : float + Requested accuracy. + iprint : int + The verbosity of fmin_slsqp: + iprint <= 0 : Silent operation + iprint == 1 : Print summary upon completion (default) + iprint >= 2 : Print status of each iterate and summary + full_output : bool + If False, return only the minimizer of func (default). + Otherwise, output final objective function and summary + information. + epsilon : float + The step size for finite-difference derivative estimates. + + *Returns*: ( x, { fx, its, imode, smode }) + x : ndarray of float + The final minimizer of func. + fx : ndarray of float + The final value of the objective function. + its : int + The number of iterations. + imode : int + The exit mode from the optimizer (see below). + smode : string + Message describing the exit mode from the optimizer. + + *Notes* + + Exit modes are defined as follows: + -1 : Gradient evaluation required (g & a) + 0 : Optimization terminated successfully. + 1 : Function evaluation required (f & c) + 2 : More equality constraints than independent variables + 3 : More than 3*n iterations in LSQ subproblem + 4 : Inequality constraints incompatible + 5 : Singular matrix E in LSQ subproblem + 6 : Singular matrix C in LSQ subproblem + 7 : Rank-deficient equality constraint subproblem HFTI + 8 : Positive directional derivative for linesearch + 9 : Iteration limit exceeded + """ exit_modes = { -1 : "Gradient evaluation required (g & a)", - 0 : "Optimization terminated successfully.", + 0 : "Optimization terminated successfully.", 1 : "Function evaluation required (f & c)", 2 : "More equality constraints than independent variables", 3 : "More than 3*n iterations in LSQ subproblem", @@ -93,16 +114,16 @@ 7 : "Rank-deficient equality constraint subproblem HFTI", 8 : "Positive directional derivative for linesearch", 9 : "Iteration limit exceeded" } - + # Wrap the functions # Wrap func - feval, func = wrap_function(func, args) + feval, func = wrap_function(func, args) if fprime: # Wrap fprime, if provided - geval, fprime = wrap_function(fprime,args) + geval, fprime = wrap_function(fprime,args) else: # Wrap approx_fprime, if fprime not provided - geval, fprime = wrap_function(approx_fprime,(func,epsilon)) + geval, fprime = wrap_function(approx_fprime,(func,epsilon)) if fprime_cons: approx_constraint_norms = False if f_eqcons: @@ -118,7 +139,7 @@ if ieqcons[i]: ceval, ieqcons[i] = wrap_function(ieqcons[i],args) geval, fprime_cons = wrap_function(fprime_cons,args) - else: + else: approx_constraint_norms = True eqcons_prime = [] for i in range(len(eqcons)): @@ -134,16 +155,16 @@ ceval, ieqcons[i] = wrap_function(ieqcons[i],args) geval, ieqcons_prime[i] = \ wrap_function(approx_fprime, (ieqcons[i],epsilon)) - - # Transform x0 into an array. + + # Transform x0 into an array. x = asfarray(x0).flatten() # Set the parameters that SLSQP will need meq = len(eqcons) # meq = The number of equality constraints m = meq + len(ieqcons) # m = The total number of constraints - la = array([1,m]).max() # la = + la = array([1,m]).max() # la = n = len(x) # n = The number of independent variables - + # Define the workspaces for SLSQP n1 = n+1 mineq = m - meq + n1 + n1 @@ -151,8 +172,8 @@ + 2*meq + n1 +(n+1)*n/2 + 2*m + 3*n + 3*n1 + 1 len_jw = mineq w = zeros(len_w) - jw = zeros(len_jw) - + jw = zeros(len_jw) + # Decompose bounds into xl and xu if len(bounds) == 0: bounds = [(-1.0E12, 1.0E12) for i in range(n)] @@ -160,10 +181,10 @@ raise IndexError, 'SLSQP Error: If bounds is specified, len(bounds) == len(x0)' xl = array( [ b[0] for b in bounds ] ) xu = array( [ b[1] for b in bounds ] ) - - # Initialize the iteration counter and the mode value + + # Initialize the iteration counter and the mode value mode = array(0,int) - acc = array(acc,float) + acc = array(acc,float) majiter = array(iter,int) majiter_prev = 0 @@ -171,10 +192,10 @@ if iprint >= 2: print "%5s %5s %16s %16s" % ("NIT","FC","OBJFUN","GNORM") - while 1: - if mode == 0 or mode == 1: # objective and constraint evaluation requird + while 1: + if mode == 0 or mode == 1: # objective and constraint evaluation requird # Compute objective function - fx = func(x) + fx = func(x) # Compute the constraints if f_eqcons: ceq = f_eqcons(x) @@ -183,15 +204,15 @@ if f_ieqcons: cieq = f_ieqcons(x) else: - cieq = [ ieqcons[i](x) for i in range(len(ieqcons)) ] + cieq = [ ieqcons[i](x) for i in range(len(ieqcons)) ] c = numpy.concatenate( (ceq,cieq), 1) - #c = array ( [ eqcons[i](x) for i in range(meq) ] + - # [ ieqcons[i](x) for i in range(len(ieqcons)) ] ) + #c = array ( [ eqcons[i](x) for i in range(meq) ] + + # [ ieqcons[i](x) for i in range(len(ieqcons)) ] ) if mode == 0 or mode == -1: # gradient evaluation required # Compute the derivatives of the objective function # For some reason SLSQP wants g dimensioned to n+1 - g = append(fprime(x),0.0) - + g = append(fprime(x),0.0) + # Compute the normals of the constraints if approx_constraint_norms: a = zeros([la,n1]) @@ -200,37 +221,36 @@ for i in range(meq+1,m): a[i] = append(ieqcons_prime[i](x),0.0) else: - a = numpy.concatenate( (fprime_cons(x),zeros([la,1])),1) - + a = numpy.concatenate( (fprime_cons(x),zeros([la,1])),1) + # Call SLSQP slsqp(m, meq, x, xl, xu, fx, c, g, a, acc, majiter, mode, w, jw) - - # Print the status of the current iterate if iprint > 2 and the + + # Print the status of the current iterate if iprint > 2 and the # major iteration has incremented if iprint >= 2 and majiter > majiter_prev: print "%5i %5i % 16.6E % 16.6E" % (majiter,feval[0], - fx,linalg.norm(g)) - + fx,linalg.norm(g)) + # If exit mode is not -1 or 1, slsqp has completed if abs(mode) != 1: break - + majiter_prev = int(majiter) - + # Optimization loop complete. Print status if requested if iprint >= 1: - print exit_modes[int(mode)] + " (Exit mode " + str(mode) + ')' - print " Current function value:", fx + print exit_modes[int(mode)] + " (Exit mode " + str(mode) + ')' + print " Current function value:", fx print " Iterations:", majiter print " Function evaluations:", feval[0] print " Gradient evaluations:", geval[0] - + if full_output == 0: return x - else: - return [list(x), - float(fx), - int(majiter), - int(mode), + else: + return [list(x), + float(fx), + int(majiter), + int(mode), exit_modes[int(mode)] ] - Added: trunk/scipy/optimize/tests/test_slsqp.py =================================================================== --- trunk/scipy/optimize/tests/test_slsqp.py 2007-12-17 20:13:41 UTC (rev 3678) +++ trunk/scipy/optimize/tests/test_slsqp.py 2007-12-17 22:39:03 UTC (rev 3679) @@ -0,0 +1,90 @@ +from numpy.testing import * +import numpy as np + +set_package_path() +from scipy.optimize import fmin_slsqp +from numpy import matrix, diag +restore_path() + +class TestSLSQP(NumpyTestCase): + """Test fmin_slsqp using Example 14.4 from Numerical Methods for + Engineers by Steven Chapra and Raymond Canale. This example + maximizes the function f(x) = 2*x*y + 2*x - x**2 - 2*y**2, which + has a maximum at x=2,y=1. + + """ + + def _testfunc(self,d,*args): + """ + Arguments: + d - A list of two elements, where d[0] represents x and d[1] represents y + in the following equation. + sign - A multiplier for f. Since we want to optimize it, and the scipy + optimizers can only minimize functions, we need to multiply it by + -1 to achieve the desired solution + Returns: + 2*x*y + 2*x - x**2 - 2*y**2 + + """ + try: + sign = args[0] + except: + sign = 1.0 + x = d[0] + y = d[1] + return sign*(2*x*y + 2*x - x**2 - 2*y**2) + + def _testfunc_deriv(self,d,*args): + """ + This is the derivative of testfunc, returning a numpy array + representing df/dx and df/dy. + + """ + try: + sign = args[0] + except: + sign = 1.0 + x = d[0] + y = d[1] + dfdx = sign*(-2*x + 2*y + 2) + dfdy = sign*(2*x - 4*y) + return np.array([ dfdx, dfdy ],float) + + def test_unbounded_approximated(self): + res = fmin_slsqp(self._testfunc, [-1.0,1.0], args = (-1.0,), + iprint = 0, full_output = 1) + x,fx,its,imode,smode = res + assert_array_almost_equal(x,[2,1]) + + def test_unbounded_given(self): + res = fmin_slsqp(self._testfunc,[-1.0,1.0], args = (-1.0,), + iprint = 0, full_output = 1) + x,fx,its,imode,smode = res + assert_array_almost_equal(x,[2,1]) + + def test_bound_approximated(self): + res = fmin_slsqp(self._testfunc,[-1.0,1.0], args = (-1.0,), + eqcons = [lambda x, y: x[0]-x[1] ], + iprint = 0, full_output = 1) + x,fx,its,imode,smode = res + assert_array_almost_equal(x,[1,1]) + + def test_bound_equality_given(self): + res = fmin_slsqp(self._testfunc,[-1.0,1.0], + fprime = self._testfunc_deriv, + args = (-1.0,), eqcons = [lambda x, y: x[0]-x[1] ], + iprint = 0, full_output = 1) + x,fx,its,imode,smode = res + assert_array_almost_equal(x,[1,1]) + + def test_bound_equality_inequality_given(self): + res = fmin_slsqp(self._testfunc,[-1.0,1.0], + fprime = self._testfunc_deriv, + args = (-1.0,), + ieqcons = [lambda x, y: x[0]-x[1]-1.0], + iprint=0, full_output=1) + x,fx,its,imode,smode = res + assert_array_almost_equal(x,[2,1]) + +if __name__ == "__main__": + NumpyTest().run() From scipy-svn at scipy.org Mon Dec 17 19:47:52 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 17 Dec 2007 18:47:52 -0600 (CST) Subject: [Scipy-svn] r3680 - in trunk/scipy/sparse: . tests Message-ID: <20071218004752.67AFE39C05D@new.scipy.org> Author: wnbell Date: 2007-12-17 18:47:46 -0600 (Mon, 17 Dec 2007) New Revision: 3680 Modified: trunk/scipy/sparse/dia.py trunk/scipy/sparse/tests/test_sparse.py Log: changed dia_matrix attribute names Modified: trunk/scipy/sparse/dia.py =================================================================== --- trunk/scipy/sparse/dia.py 2007-12-17 22:39:03 UTC (rev 3679) +++ trunk/scipy/sparse/dia.py 2007-12-18 00:47:46 UTC (rev 3680) @@ -26,58 +26,58 @@ A = arg1.tocoo() ks = A.col - A.row #the offset for each nonzero - offsets = unique(ks) + diags = unique(ks) - if len(offsets) > 10: + if len(diags) > 10: pass #do something - #initialize and fill in diags array - diags_shape = (len(offsets), A.col.max()+1) - diags_dtype = getdtype(dtype, default=A.data.dtype) - diags = zeros(diags_shape, dtype=diags_dtype) - diags[ searchsorted(offsets,ks), A.col ] = A.data + #initialize and fill in data array + data_shape = (len(diags), A.col.max()+1) + data_dtype = getdtype(dtype, default=A.data.dtype) + data = zeros(data_shape, dtype=data_dtype) + data[ searchsorted(diags,ks), A.col ] = A.data - self.diags,self.offsets = diags,offsets + self.data,self.diags = data,diags self.shape = A.shape elif isinstance(arg1, tuple): if isshape(arg1): # It's a tuple of matrix dimensions (M, N) # create empty matrix self.shape = arg1 #spmatrix checks for errors here - self.diags = zeros( (0,0), getdtype(dtype, default=float)) - self.offsets = zeros( (0), dtype=intc) + self.data = zeros( (0,0), getdtype(dtype, default=float)) + self.diags = zeros( (0), dtype=intc) else: try: - # Try interpreting it as (diags, offsets) - data, offsets = arg1 + # Try interpreting it as (data, diags) + data, diags = arg1 except: raise ValueError, "unrecognized form for dia_matrix constructor" else: if shape is None: raise ValueError,'expected a shape argument' - self.diags = atleast_2d(asarray(arg1[0],dtype=dtype)) - self.offsets = atleast_1d(asarray(arg1[1],dtype='i')) + self.data = atleast_2d(asarray(arg1[0],dtype=dtype)) + self.diags = atleast_1d(asarray(arg1[1],dtype='i')) self.shape = shape #check format - if self.offsets.ndim != 1: - raise ValueError,'offsets array must have rank 1' + if self.diags.ndim != 1: + raise ValueError,'diags array must have rank 1' - if self.diags.ndim != 2: - raise ValueError,'diags array must have rank 2' + if self.data.ndim != 2: + raise ValueError,'data array must have rank 2' - if self.diags.shape[0] != len(self.offsets): + if self.data.shape[0] != len(self.diags): raise ValueError,'number of diagonals (%d) ' \ - 'does not match the number of offsets (%d)' \ - % (self.diags.shape[0], len(self.offsets)) + 'does not match the number of diags (%d)' \ + % (self.data.shape[0], len(self.diags)) - if len(Set(self.offsets)) != len(self.offsets): + if len(Set(self.diags)) != len(self.diags): raise ValueError,'offset array contains duplicate values' def __getdtype(self): - return self.diags.dtype + return self.data.dtype def __setdtype(self,newtype): self.dtype = newtype @@ -91,7 +91,7 @@ """ M,N = self.shape nnz = 0 - for k in self.offsets: + for k in self.diags: if k > 0: nnz += min(M,N-k) else: @@ -106,7 +106,7 @@ """ Scalar, vector, or matrix multiplication """ if isscalarlike(other): - return dia_matrix((other * self.diags, self.offsets),self.shape) + return dia_matrix((other * self.data, self.diags),self.shape) else: return self.dot(other) @@ -137,10 +137,10 @@ y = zeros((self.shape[0],x.shape[1]), dtype=upcast(self.dtype,x.dtype)) - L = self.diags.shape[1] + L = self.data.shape[1] M,N = self.shape - for diag,k in zip(self.diags,self.offsets): + for diag,k in zip(self.data,self.diags): j_start = max(0,k) j_end = min(M+k,N,L) @@ -174,17 +174,17 @@ return self.tocoo().tocsc() def tocoo(self): - num_diags = len(self.diags) - len_diags = self.diags.shape[1] + num_data = len(self.data) + len_data = self.data.shape[1] - row = arange(len_diags).reshape(1,-1).repeat(num_diags,axis=0) + row = arange(len_data).reshape(1,-1).repeat(num_data,axis=0) col = row.copy() - for i,k in enumerate(self.offsets): + for i,k in enumerate(self.diags): row[i,:] -= k mask = (row >= 0) & (row < self.shape[0]) & (col < self.shape[1]) - row,col,data = row[mask],col[mask],self.diags[mask] + row,col,data = row[mask],col[mask],self.data[mask] row,col,data = row.reshape(-1),col.reshape(-1),data.reshape(-1) from coo import coo_matrix Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-17 22:39:03 UTC (rev 3679) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-18 00:47:46 UTC (rev 3680) @@ -40,7 +40,7 @@ def test_matvec(self,level=5): matrices = [] - matrices.append(('Identity', spidentity(10**5,format='csr'))) + matrices.append(('Identity', spidentity(10**5,format='csr'))) matrices.append(('Poisson5pt', poisson2d(1000,format='csr'))) matrices.append(('Poisson5pt', poisson2d(1000,format='dia'))) From scipy-svn at scipy.org Mon Dec 17 23:06:25 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 17 Dec 2007 22:06:25 -0600 (CST) Subject: [Scipy-svn] r3681 - in trunk/scipy/sparse: . tests Message-ID: <20071218040625.DCF0E39C059@new.scipy.org> Author: wnbell Date: 2007-12-17 22:06:01 -0600 (Mon, 17 Dec 2007) New Revision: 3681 Added: trunk/scipy/sparse/data.py Modified: trunk/scipy/sparse/compressed.py trunk/scipy/sparse/construct.py trunk/scipy/sparse/coo.py trunk/scipy/sparse/dia.py trunk/scipy/sparse/tests/test_base.py Log: added _data_matrix base class reorganized todia() and dia_matrix added todia() test in test_base Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-18 00:47:46 UTC (rev 3680) +++ trunk/scipy/sparse/compressed.py 2007-12-18 04:06:01 UTC (rev 3681) @@ -9,7 +9,8 @@ from numpy import array, matrix, asarray, asmatrix, zeros, rank, intc, \ empty, hstack, isscalar, ndarray, shape, searchsorted -from base import spmatrix,isspmatrix +from base import spmatrix, isspmatrix +from data import _data_matrix import sparsetools from sputils import upcast, to_native, isdense, isshape, getdtype, \ isscalarlike @@ -23,11 +24,11 @@ return new -class _cs_matrix(spmatrix): +class _cs_matrix(_data_matrix): """base matrix class for compressed row and column oriented matrices""" def __init__(self, arg1, shape=None, dtype=None, copy=False, dims=None): - spmatrix.__init__(self) + _data_matrix.__init__(self) if dims is not None: warn("dims is deprecated, use shape instead", DeprecationWarning) @@ -100,11 +101,6 @@ return self.indptr[-1] nnz = property(fget=getnnz) - def _get_dtype(self): - return self.data.dtype - def _set_dtype(self,newtype): - self.data.dtype = newtype - dtype = property(fget=_get_dtype,fset=_set_dtype) def _set_self(self, other, copy=False): """take the member variables of other and assign them to self""" @@ -181,20 +177,15 @@ raise ValueError,'index pointer values must form a " \ "non-decreasing sequence' - def astype(self, t): - return self._with_data(self.data.astype(t)) + + def __imul__(self, other): #self *= other + if isscalarlike(other): + self.data *= other + return self + else: + raise NotImplementedError - def __abs__(self): - return self._with_data(abs(self.data)) - - def _real(self): - return self._with_data(numpy.real(self.data)) - - def _imag(self): - return self._with_data(numpy.imag(self.data)) - - def __add__(self,other): # First check if argument is a scalar if isscalarlike(other): @@ -265,16 +256,7 @@ tr = asarray(other).transpose() return self.transpose().dot(tr).transpose() - def __imul__(self, other): #self *= other - if isscalarlike(other): - self.data *= other - return self - else: - raise NotImplementedError - def __neg__(self): - return self._with_data(-self.data) - def __truediv__(self,other): if isscalarlike(other): return self * (1./other) @@ -402,8 +384,6 @@ return spmatrix.sum(self,axis) raise ValueError, "axis out of bounds" - def copy(self): - return self._with_data(self.data.copy(),copy=True) def _get_slice(self, i, start, stop, stride, shape): """Returns a view of the elements [i, myslice.start:myslice.stop]. @@ -430,6 +410,12 @@ M, N = self.shape return cls((self.data,self.indices,self.indptr),(N,M),copy=copy) + def todia(self): + return self.tocoo(copy=False).todia() + + def todok(self): + return self.tocoo(copy=False).todok() + def tocoo(self,copy=True): """Return a COOrdinate representation of this matrix @@ -453,8 +439,6 @@ from coo import coo_matrix return coo_matrix((data,(row,col)), self.shape) - def conj(self, copy=False): - return self._with_data(self.data.conj(),copy=copy) def sorted_indices(self): """Return a copy of this matrix with sorted indices @@ -546,8 +530,7 @@ data, indices, indptr = aux[2], aux[1], aux[0] return data, indices, indptr, i1 - i0, j1 - j0 - - # utility functions + # needed by _data_matrix def _with_data(self,data,copy=True): """Returns a matrix with the same sparsity structure as self, but with different data. By default the structure arrays @@ -560,6 +543,7 @@ return self.__class__((data,self.indices,self.indptr), \ shape=self.shape,dtype=data.dtype) + # utility functions def _binopt(self, other, op, in_shape=None, out_shape=None): """apply the binary operation fn to two sparse matrices""" other = self._tothis(other) Modified: trunk/scipy/sparse/construct.py =================================================================== --- trunk/scipy/sparse/construct.py 2007-12-18 00:47:46 UTC (rev 3680) +++ trunk/scipy/sparse/construct.py 2007-12-18 04:06:01 UTC (rev 3681) @@ -19,35 +19,34 @@ from base import isspmatrix -def spdiags(diags, offsets, m, n, format=None): +def spdiags(data, diags, m, n, format=None): """Return a sparse matrix given its diagonals. B = spdiags(diags, offsets, m, n) *Parameters*: - diags : matrix whose rows contain the diagonal values - offsets : diagonals to set + data : matrix whose rows contain the diagonal values + diags : diagonals to set k = 0 - the main diagonal k > 0 - the k-th upper diagonal k < 0 - the k-th lower diagonal - m, n : dimensions of the result - format : format of the result (e.g. "csr") + m, n : dimensions of the result + format : format of the result (e.g. "csr") By default (format=None) an appropriate sparse matrix format is returned. This choice is subject to change. *Example* ------- - >>> diags = array([[1,2,3,4]]).repeat(3,axis=0) - >>> offsets = array([0,-1,2]) - >>> spdiags(diags,offsets,4,4).todense() + >>> data = array([[1,2,3,4]]).repeat(3,axis=0) + >>> diags = array([0,-1,2]) + >>> spdiags(data,diags,4,4).todense() matrix([[1, 0, 3, 0], [1, 2, 0, 4], [0, 2, 3, 0], [0, 0, 3, 4]]) """ - #TODO update this example - return dia_matrix((diags, offsets), shape=(m,n)).asformat(format) + return dia_matrix((data, diags), shape=(m,n)).asformat(format) def spidentity(n, dtype='d', format=None): """spidentity(n) returns an (n x n) identity matrix""" Modified: trunk/scipy/sparse/coo.py =================================================================== --- trunk/scipy/sparse/coo.py 2007-12-18 00:47:46 UTC (rev 3680) +++ trunk/scipy/sparse/coo.py 2007-12-18 04:06:01 UTC (rev 3681) @@ -5,7 +5,8 @@ from itertools import izip from warnings import warn -from numpy import array, asarray, empty, intc, zeros, bincount +from numpy import array, asarray, empty, intc, zeros, bincount, \ + unique, searchsorted from sparsetools import coo_tocsr, coo_tocsc from base import spmatrix, isspmatrix @@ -248,6 +249,21 @@ else: return self + def todia(self): + from dia import dia_matrix + + ks = self.col - self.row #the diagonal for each nonzero + diags = unique(ks) + + if len(diags) > 100: + pass #do something? + + #initialize and fill in data array + data = zeros( (len(diags), self.col.max()+1), dtype=self.dtype) + data[ searchsorted(diags,ks), self.col ] = self.data + + return dia_matrix((data,diags),shape=self.shape) + def todok(self): from dok import dok_matrix Added: trunk/scipy/sparse/data.py =================================================================== --- trunk/scipy/sparse/data.py 2007-12-18 00:47:46 UTC (rev 3680) +++ trunk/scipy/sparse/data.py 2007-12-18 04:06:01 UTC (rev 3681) @@ -0,0 +1,43 @@ +"""Base class for sparse matrice with a .data attribute + + subclasses must provide a _with_data() method that + creates a new matrix with the same sparsity pattern + as self but with a different data array + +""" + +__all__ = [] + +from base import spmatrix + +class _data_matrix(spmatrix): + def __init__(self): + spmatrix.__init__(self) + + def _get_dtype(self): + return self.data.dtype + def _set_dtype(self,newtype): + self.data.dtype = newtype + dtype = property(fget=_get_dtype,fset=_set_dtype) + + def __abs__(self): + return self._with_data(abs(self.data)) + + def _real(self): + return self._with_data(numpy.real(self.data),copy=False) + + def _imag(self): + return self._with_data(numpy.imag(self.data),copy=False) + + def __neg__(self): + return self._with_data(-self.data) + + def astype(self, t): + return self._with_data(self.data.astype(t)) + + def conj(self, copy=False): + return self._with_data(self.data.conj(),copy=copy) + + def copy(self): + return self._with_data(self.data.copy(),copy=True) + Modified: trunk/scipy/sparse/dia.py =================================================================== --- trunk/scipy/sparse/dia.py 2007-12-18 00:47:46 UTC (rev 3680) +++ trunk/scipy/sparse/dia.py 2007-12-18 04:06:01 UTC (rev 3681) @@ -2,49 +2,79 @@ __all__ = ['dia_matrix','isspmatrix_dia'] -from numpy import asarray, asmatrix, matrix, zeros, arange, unique, \ - searchsorted, intc, atleast_1d, atleast_2d +from numpy import asarray, asmatrix, matrix, zeros, arange, array, \ + empty_like, intc, atleast_1d, atleast_2d, add, multiply, \ + unique -from base import spmatrix, isspmatrix, isdense -from sputils import isscalarlike, isshape, upcast, getdtype +from base import isspmatrix +from data import _data_matrix +from sputils import isscalarlike, isshape, upcast, getdtype, isdense -from sets import Set +class dia_matrix(_data_matrix): + """Sparse matrix with DIAgonal storage -class dia_matrix(spmatrix): - #TODO add description/motivation + This can be instantiated in several ways: + - dia_matrix(D) + with a dense matrix or rank-2 ndarray D + + - dia_matrix(S) + with another sparse matrix S (equivalent to S.todia()) + + - dia_matrix((M, N), [dtype]) + to construct an empty matrix with shape (M, N) + dtype is optional, defaulting to dtype='d'. + + - dia_matrix((data, diags), shape=(M, N)) + where the data[k,:] stores the diagonal entries for + diagonal diag[k] (See example below) + + + *Examples* + ---------- + + >>> from scipy.sparse import * + >>> from scipy import * + >>> dia_matrix( (3,4), dtype='i').todense() + matrix([[0, 0, 0, 0], + [0, 0, 0, 0], + [0, 0, 0, 0]]) + + >>> data = array([[1,2,3,4]]).repeat(3,axis=0) + >>> diags = array([0,-1,2]) + >>> dia_matrix( (data,diags), shape=(4,4)).todense() + matrix([[1, 0, 3, 0], + [1, 2, 0, 4], + [0, 2, 3, 0], + [0, 0, 3, 4]]) + + """ + def __init__(self, arg1, shape=None, dtype=None, copy=False): - spmatrix.__init__(self) + _data_matrix.__init__(self) - if isdense(arg1) or isspmatrix(arg1): - #convert to COO first, then to DIA - from coo import coo_matrix + if isspmatrix_dia(arg1): + if copy: + arg1 = arg1.copy() + self.data = arg1.data + self.diags = arg1.diags + self.shape = arg1.shape + elif isdense(arg1) or isspmatrix(arg1): if isdense(arg1): - A = coo_matrix(arg1) - elif arg1.format in ['csr','csc','coo']: - A = arg1.tocoo(copy=False) + #convert to COO first, then to DIA + from coo import coo_matrix + A = coo_matrix(arg1).todia() else: - A = arg1.tocoo() - - ks = A.col - A.row #the offset for each nonzero - diags = unique(ks) - - if len(diags) > 10: - pass #do something - - #initialize and fill in data array - data_shape = (len(diags), A.col.max()+1) - data_dtype = getdtype(dtype, default=A.data.dtype) - data = zeros(data_shape, dtype=data_dtype) - data[ searchsorted(diags,ks), A.col ] = A.data + A = arg1.todia() - self.data,self.diags = data,diags + self.data = A.data + self.diags = A.diags self.shape = A.shape elif isinstance(arg1, tuple): if isshape(arg1): # It's a tuple of matrix dimensions (M, N) # create empty matrix self.shape = arg1 #spmatrix checks for errors here - self.data = zeros( (0,0), getdtype(dtype, default=float)) + self.data = zeros( (0,0), getdtype(dtype, default=float)) self.diags = zeros( (0), dtype=intc) else: try: @@ -55,9 +85,9 @@ else: if shape is None: raise ValueError,'expected a shape argument' - self.data = atleast_2d(asarray(arg1[0],dtype=dtype)) - self.diags = atleast_1d(asarray(arg1[1],dtype='i')) - self.shape = shape + 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 #check format if self.diags.ndim != 1: @@ -71,19 +101,10 @@ 'does not match the number of diags (%d)' \ % (self.data.shape[0], len(self.diags)) - if len(Set(self.diags)) != len(self.diags): + if len(unique(self.diags)) != len(self.diags): raise ValueError,'offset array contains duplicate values' - - def __getdtype(self): - return self.data.dtype - - def __setdtype(self,newtype): - self.dtype = newtype - - dtype = property(fget=__getdtype,fset=__setdtype) - def getnnz(self): """number of nonzero values @@ -101,7 +122,6 @@ nnz = property(fget=getnnz) - def __mul__(self, other): # self * other """ Scalar, vector, or matrix multiplication """ @@ -110,7 +130,6 @@ else: return self.dot(other) - def matmat(self, other): if isspmatrix(other): M, K1 = self.shape @@ -126,8 +145,7 @@ def matvec(self,other): - #TODO why is this so slow? it should run at BLAS-speed - + # can we do the multiply add faster? x = asarray(other) if x.ndim == 1: @@ -136,6 +154,7 @@ raise ValueError, "dimension mismatch" y = zeros((self.shape[0],x.shape[1]), dtype=upcast(self.dtype,x.dtype)) + temp = empty_like( y ) L = self.data.shape[1] M,N = self.shape @@ -147,7 +166,12 @@ i_start = max(0,-k) i_end = i_start + (j_end - j_start) - y[i_start:i_end] += diag[j_start:j_end].reshape(-1,1) * x[j_start:j_end] + #we'd prefer a fused multiply add here + multiply(diag[j_start:j_end].reshape(-1,1), x[j_start:j_end], temp[i_start:i_end]) + add(y[i_start:i_end],temp[i_start:i_end],y[i_start:i_end]) + + #slower version of two steps above + #y[i_start:i_end] += diag[j_start:j_end].reshape(-1,1) * x[j_start:j_end] if isinstance(other, matrix): @@ -190,6 +214,16 @@ from coo import coo_matrix return coo_matrix((data,(row,col)),shape=self.shape) + # needed by _data_matrix + def _with_data(self,data,copy=True): + """Returns a matrix with the same sparsity structure as self, + but with different data. By default the structure arrays + (i.e. .indptr and .indices) are copied. + """ + if copy: + return dia_matrix( (data,self.diags.copy()), shape=self.shape) + else: + return dia_matrix( (data,self.diags), shape=self.shape) from sputils import _isinstance Modified: trunk/scipy/sparse/tests/test_base.py =================================================================== --- trunk/scipy/sparse/tests/test_base.py 2007-12-18 00:47:46 UTC (rev 3680) +++ trunk/scipy/sparse/tests/test_base.py 2007-12-18 04:06:01 UTC (rev 3681) @@ -277,6 +277,10 @@ assert_equal( result.shape, (4,2) ) assert_equal( result, dot(a,b) ) + def check_todia(self): + a = self.datsp.todia() + assert_array_almost_equal(a.todense(), self.dat) + def check_tocoo(self): a = self.datsp.tocoo() assert_array_almost_equal(a.todense(), self.dat) From scipy-svn at scipy.org Mon Dec 17 23:37:39 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 17 Dec 2007 22:37:39 -0600 (CST) Subject: [Scipy-svn] r3682 - in trunk/scipy/sparse: . tests Message-ID: <20071218043739.648E039C059@new.scipy.org> Author: wnbell Date: 2007-12-17 22:37:30 -0600 (Mon, 17 Dec 2007) New Revision: 3682 Modified: trunk/scipy/sparse/base.py trunk/scipy/sparse/compressed.py trunk/scipy/sparse/tests/test_base.py Log: added .multiply() for pointwise multiplication Modified: trunk/scipy/sparse/base.py =================================================================== --- trunk/scipy/sparse/base.py 2007-12-18 04:06:01 UTC (rev 3681) +++ trunk/scipy/sparse/base.py 2007-12-18 04:37:30 UTC (rev 3682) @@ -208,6 +208,11 @@ def __rsub__(self, other): # other - self return self.tocsr().__rsub__(other) + + def multiply(self, other): + """Point-wise multiplication by another matrix + """ + return self.tocsr().multiply(other) def __mul__(self, other): return self.tocsr().__mul__(other) Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-18 04:06:01 UTC (rev 3681) +++ trunk/scipy/sparse/compressed.py 2007-12-18 04:37:30 UTC (rev 3682) @@ -285,11 +285,24 @@ elif isspmatrix(other): if (other.shape != self.shape): raise ValueError, "inconsistent shapes" - + + warn("use .multiply(other) for elementwise multiplication", \ + DeprecationWarning) return self._binopt(other,'_elmul_') else: raise NotImplementedError + + def multiply(self, other): + """Point-wise multiplication by another matrix + """ + if (other.shape != self.shape): + raise ValueError, "inconsistent shapes" + if isdense(other): + return multiply(self.todense(),other) + else: + other = self.__class__(other) + return self._binopt(other,'_elmul_') def matmat(self, other): if isspmatrix(other): Modified: trunk/scipy/sparse/tests/test_base.py =================================================================== --- trunk/scipy/sparse/tests/test_base.py 2007-12-18 04:06:01 UTC (rev 3681) +++ trunk/scipy/sparse/tests/test_base.py 2007-12-18 04:37:30 UTC (rev 3682) @@ -1,4 +1,3 @@ -#!/usr/bin/env python # # Authors: Travis Oliphant, Ed Schofield, Robert Cimrman, Nathan Bell, and others @@ -151,7 +150,7 @@ temp = self.dat.copy() temp[0,2] = 2.0 temp = self.spmatrix(temp) - c = temp ** self.datsp + c = temp.multiply(self.datsp) assert_array_equal(c.todense(),[[1,0,0,4],[9,0,1,0],[0,4,0,0]]) def check_eldiv(self): From scipy-svn at scipy.org Tue Dec 18 00:24:30 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 17 Dec 2007 23:24:30 -0600 (CST) Subject: [Scipy-svn] r3683 - trunk/scipy/sparse Message-ID: <20071218052430.A5D5F39C093@new.scipy.org> Author: wnbell Date: 2007-12-17 23:24:24 -0600 (Mon, 17 Dec 2007) New Revision: 3683 Modified: trunk/scipy/sparse/compressed.py Log: deprecate nzmax instead of dropping it entirely Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-18 04:37:30 UTC (rev 3682) +++ trunk/scipy/sparse/compressed.py 2007-12-18 05:24:24 UTC (rev 3683) @@ -27,12 +27,15 @@ class _cs_matrix(_data_matrix): """base matrix class for compressed row and column oriented matrices""" - def __init__(self, arg1, shape=None, dtype=None, copy=False, dims=None): + def __init__(self, arg1, shape=None, dtype=None, copy=False, dims=None, nzmax=None): _data_matrix.__init__(self) if dims is not None: - warn("dims is deprecated, use shape instead", DeprecationWarning) + warn("dims= is deprecated, use shape= instead", DeprecationWarning) shape=dims + + if dims is not None: + warn("nzmax= is deprecated", DeprecationWarning) if isdense(arg1): # Convert the dense array or matrix arg1 to sparse format From scipy-svn at scipy.org Tue Dec 18 03:43:23 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 18 Dec 2007 02:43:23 -0600 (CST) Subject: [Scipy-svn] r3684 - branches Message-ID: <20071218084323.BB2D639C034@new.scipy.org> Author: cdavid Date: 2007-12-18 02:43:14 -0600 (Tue, 18 Dec 2007) New Revision: 3684 Added: branches/cleanconfig_rtm/ Log: Create a cleanconfig_rtm branch (rtm for ready to merge) which will implements all the changes related to separating config.h numpy header into two distinct headers (one private, one public), and will also make the automatic generation of those files from scons easier later. This is effectively the first step to using scons within distutils. Copied: branches/cleanconfig_rtm (from rev 3683, trunk) From scipy-svn at scipy.org Tue Dec 18 14:54:40 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 18 Dec 2007 13:54:40 -0600 (CST) Subject: [Scipy-svn] r3685 - in trunk/scipy/sparse: . tests Message-ID: <20071218195440.097B839C042@new.scipy.org> Author: wnbell Date: 2007-12-18 13:54:33 -0600 (Tue, 18 Dec 2007) New Revision: 3685 Modified: trunk/scipy/sparse/base.py trunk/scipy/sparse/compressed.py trunk/scipy/sparse/tests/test_base.py trunk/scipy/sparse/tests/test_sparse.py Log: allow matvec() to use preallocated storage added associated unittests Modified: trunk/scipy/sparse/base.py =================================================================== --- trunk/scipy/sparse/base.py 2007-12-18 08:43:14 UTC (rev 3684) +++ trunk/scipy/sparse/base.py 2007-12-18 19:54:33 UTC (rev 3685) @@ -4,7 +4,7 @@ from warnings import warn -from numpy import asarray, asmatrix, ones +from numpy import asarray, asmatrix, asanyarray, ones from sputils import isdense, isscalarlike @@ -321,7 +321,7 @@ other.shape except AttributeError: # If it's a list or whatever, treat it like a matrix - other = asmatrix(other) + other = asanyarray(other) if isdense(other) and asarray(other).squeeze().ndim <= 1: # it's a dense row or column vector Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-18 08:43:14 UTC (rev 3684) +++ trunk/scipy/sparse/compressed.py 2007-12-18 19:54:33 UTC (rev 3685) @@ -333,11 +333,7 @@ fn( M, N, self.indptr, self.indices, self.data, \ other.indptr, other.indices, other.data, \ indptr, indices, data) - - nnz = indptr[-1] #may have changed - #indices = indices[:nnz] - #data = indices[:nnz] - + return self.__class__((data,indices,indptr),shape=(M,N)) @@ -349,17 +345,40 @@ else: raise TypeError, "need a dense or sparse matrix" - def matvec(self, other): + def matvec(self, other, output=None): + """Sparse matrix vector product (self * other) + + 'other' may be a rank 1 array of length N or a rank 2 array + or matrix with shape (N,1). + + If the optional 'output' parameter is defined, it will + be used to store the result. Otherwise, a new vector + will be allocated. + + """ if isdense(other): - if other.size != self.shape[1] or \ - (other.ndim == 2 and self.shape[1] != other.shape[0]): + M,N = self.shape + + if other.shape != (N,) and other.shape != (N,1): raise ValueError, "dimension mismatch" # csrmux, cscmux fn = getattr(sparsetools,self.format + '_matvec') #output array - y = empty( self.shape[0], dtype=upcast(self.dtype,other.dtype) ) + if output is None: + y = empty( self.shape[0], dtype=upcast(self.dtype,other.dtype) ) + else: + if output.shape != (M,) and output.shape != (M,1): + print "self ",self.shape,"other",other.shape + raise ValueError, "output array has improper dimensions" + if not output.flags.c_contiguous: + raise ValueError, "output array must be contiguous" + if output.dtype != upcast(self.dtype,other.dtype): + raise ValueError, "output array has dtype=%s "\ + "dtype=%s is required" % \ + (output.dtype,upcast(self.dtype,other.dtype)) + y = output fn(self.shape[0], self.shape[1], \ self.indptr, self.indices, self.data, numpy.ravel(other), y) Modified: trunk/scipy/sparse/tests/test_base.py =================================================================== --- trunk/scipy/sparse/tests/test_base.py 2007-12-18 08:43:14 UTC (rev 3684) +++ trunk/scipy/sparse/tests/test_base.py 2007-12-18 19:54:33 UTC (rev 3685) @@ -428,7 +428,39 @@ assert_array_equal(self.dat/17.3,a.todense()) +class _TestMatvecOutput: + """test using the matvec() output parameter""" + def check_matvec_output(self): + #flat array + x = array([1.25, -6.5, 0.125, -3.75],dtype='d') + y = zeros(3,dtype='d') + + self.datsp.matvec(x,y) + assert_array_equal(self.datsp*x,y) + + #column vector + x = array([1.25, -6.5, 0.125, -3.75],dtype='d') + x = x.reshape(4,1) + y = zeros((3,1),dtype='d') + self.datsp.matvec(x,y) + assert_array_equal(self.datsp*x,y) + + # improper output type + x = array([1.25, -6.5, 0.125, -3.75],dtype='d') + y = zeros(3,dtype='i') + + self.assertRaises( ValueError, self.datsp.matvec, x, y ) + + # proper upcast output type + x = array([1.25, -6.5, 0.125, -3.75],dtype='complex64') + x.imag = [1,2,3,4] + y = zeros(3,dtype='complex128') + + self.datsp.matvec(x,y) + assert_array_equal(self.datsp*x,y) + assert_equal((self.datsp*x).dtype,y.dtype) + class _TestGetSet: def check_setelement(self): a = self.datsp - self.datsp @@ -674,7 +706,7 @@ class TestCSR(_TestCommon, _TestGetSet, _TestSolve, - _TestInplaceArithmetic, _TestArithmetic, + _TestInplaceArithmetic, _TestArithmetic, _TestMatvecOutput, _TestHorizSlicing, _TestVertSlicing, _TestBothSlicing, NumpyTestCase): spmatrix = csr_matrix @@ -771,7 +803,7 @@ assert_equal( ab, aa[i0,i1[0]:i1[1]] ) class TestCSC(_TestCommon, _TestGetSet, _TestSolve, - _TestInplaceArithmetic, _TestArithmetic, + _TestInplaceArithmetic, _TestArithmetic, _TestMatvecOutput, _TestHorizSlicing, _TestVertSlicing, _TestBothSlicing, NumpyTestCase): spmatrix = csc_matrix Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-18 08:43:14 UTC (rev 3684) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-18 19:54:33 UTC (rev 3685) @@ -59,7 +59,11 @@ start = time.clock() iter = 0 while iter < 5 or time.clock() < start + 1: - y = A*x + try: + #avoid creating y if possible + A.matvec(x,y) + except: + y = A*x iter += 1 end = time.clock() @@ -91,7 +95,7 @@ start = time.clock() iter = 0 - while time.clock() < start + 0.1: + while time.clock() < start + 0.5: T = eval(format + '_matrix')(A.shape) for i,j,v in zip(A.row,A.col,A.data): T[i,j] = v From scipy-svn at scipy.org Tue Dec 18 14:56:16 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 18 Dec 2007 13:56:16 -0600 (CST) Subject: [Scipy-svn] r3686 - in trunk/scipy/sparse: . tests Message-ID: <20071218195616.4A4FB39C042@new.scipy.org> Author: wnbell Date: 2007-12-18 13:56:14 -0600 (Tue, 18 Dec 2007) New Revision: 3686 Modified: trunk/scipy/sparse/compressed.py trunk/scipy/sparse/tests/test_base.py Log: small edit Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-18 19:54:33 UTC (rev 3685) +++ trunk/scipy/sparse/compressed.py 2007-12-18 19:56:14 UTC (rev 3686) @@ -370,7 +370,6 @@ y = empty( self.shape[0], dtype=upcast(self.dtype,other.dtype) ) else: if output.shape != (M,) and output.shape != (M,1): - print "self ",self.shape,"other",other.shape raise ValueError, "output array has improper dimensions" if not output.flags.c_contiguous: raise ValueError, "output array must be contiguous" Modified: trunk/scipy/sparse/tests/test_base.py =================================================================== --- trunk/scipy/sparse/tests/test_base.py 2007-12-18 19:54:33 UTC (rev 3685) +++ trunk/scipy/sparse/tests/test_base.py 2007-12-18 19:56:14 UTC (rev 3686) @@ -452,6 +452,12 @@ self.assertRaises( ValueError, self.datsp.matvec, x, y ) + # improper output shape + x = array([1.25, -6.5, 0.125, -3.75],dtype='d') + y = zeros(2,dtype='d') + + self.assertRaises( ValueError, self.datsp.matvec, x, y ) + # proper upcast output type x = array([1.25, -6.5, 0.125, -3.75],dtype='complex64') x.imag = [1,2,3,4] From scipy-svn at scipy.org Tue Dec 18 18:20:29 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 18 Dec 2007 17:20:29 -0600 (CST) Subject: [Scipy-svn] r3687 - in trunk/scipy/sparse: . tests Message-ID: <20071218232029.30D8E39C0E6@new.scipy.org> Author: wnbell Date: 2007-12-18 17:20:23 -0600 (Tue, 18 Dec 2007) New Revision: 3687 Modified: trunk/scipy/sparse/base.py trunk/scipy/sparse/compressed.py trunk/scipy/sparse/csc.py trunk/scipy/sparse/csr.py trunk/scipy/sparse/data.py trunk/scipy/sparse/tests/test_base.py Log: made __pow__ work like dense matrices consolidated other functionality Modified: trunk/scipy/sparse/base.py =================================================================== --- trunk/scipy/sparse/base.py 2007-12-18 19:56:14 UTC (rev 3686) +++ trunk/scipy/sparse/base.py 2007-12-18 23:20:23 UTC (rev 3687) @@ -6,7 +6,7 @@ from numpy import asarray, asmatrix, asanyarray, ones -from sputils import isdense, isscalarlike +from sputils import isdense, isscalarlike, isintlike # The formats that we might potentially understand. @@ -229,14 +229,9 @@ def __div__(self, other): # Always do true division return self.__truediv__(other) - - def __pow__(self, other): - csc = self.tocsc() - return csc ** other - + def __neg__(self): - csc = self.tocsc() - return -csc + return -self.tocsr() def __iadd__(self, other): raise NotImplementedError @@ -253,6 +248,31 @@ def __itruediv__(self, other): raise NotImplementedError + def __pow__(self, other): + if self.shape[0] != self.shape[1]: + raise TypeError,'matrix is not square' + + if isintlike(other): + other = int(other) + if other < 0: + raise ValueError,'exponent must be >= 0' + + if other == 0: + from construct import spidentity + return spidentity( self.shape[0], dtype=self.dtype ) + elif other == 1: + return self.copy() + else: + result = self + for i in range(1,other): + result = result*self + return result + elif isscalarlike(other): + raise ValueError,'exponent must be an integer' + else: + raise NotImplementedError + + def __getattr__(self, attr): if attr == 'A': return self.toarray() Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-18 19:56:14 UTC (rev 3686) +++ trunk/scipy/sparse/compressed.py 2007-12-18 23:20:23 UTC (rev 3687) @@ -45,14 +45,16 @@ if rank(arg1) == 2: from coo import coo_matrix self.shape = arg1.shape - self._set_self( self._tothis(coo_matrix(arg1)) ) + self._set_self( self.__class__(coo_matrix(arg1)) ) else: raise ValueError, "dense array must have rank 1 or 2" elif isspmatrix(arg1): - if copy: + if arg1.format == self.format and copy: arg1 = arg1.copy() - self._set_self( self._tothis(arg1) ) + else: + arg1 = getattr(arg1,'to' + self.format)() + self._set_self( arg1 ) elif isinstance(arg1, tuple): if isshape(arg1): @@ -67,7 +69,7 @@ if len(arg1) == 2: # (data, ij) format from coo import coo_matrix - other = self._tothis(coo_matrix(arg1, shape=shape)) + other = self.__class__( coo_matrix(arg1, shape=shape) ) self._set_self( other ) elif len(arg1) == 3: # (data, indices, indptr) format @@ -181,13 +183,6 @@ "non-decreasing sequence' - - def __imul__(self, other): #self *= other - if isscalarlike(other): - self.data *= other - return self - else: - raise NotImplementedError def __add__(self,other): # First check if argument is a scalar @@ -271,29 +266,6 @@ else: raise NotImplementedError - def __itruediv__(self, other): #self *= other - if isscalarlike(other): - recip = 1.0 / other - self.data *= recip - return self - else: - raise NotImplementedError - - def __pow__(self, other): - """ Element-by-element power (unless other is a scalar, in which - case return the matrix power.) - """ - if isscalarlike(other): - return self._with_data(self.data**other) - elif isspmatrix(other): - if (other.shape != self.shape): - raise ValueError, "inconsistent shapes" - - warn("use .multiply(other) for elementwise multiplication", \ - DeprecationWarning) - return self._binopt(other,'_elmul_') - else: - raise NotImplementedError def multiply(self, other): """Point-wise multiplication by another matrix @@ -319,7 +291,7 @@ major_axis = self._swap((M,N))[0] indptr = empty( major_axis + 1, dtype=intc ) - other = self._tothis(other) + other = self.__class__(other) #convert to this format fn = getattr(sparsetools, self.format + '_matmat_pass1') fn( M, N, self.indptr, self.indices, \ other.indptr, other.indices, \ @@ -420,7 +392,9 @@ def _get_slice(self, i, start, stop, stride, shape): - """Returns a view of the elements [i, myslice.start:myslice.stop]. + """Returns a copy of the elements + [i, start:stop:string] for row-oriented matrices + [start:stop:string, i] for column-oriented matrices """ if stride != 1: raise ValueError, "slicing with step != 1 not supported" @@ -433,17 +407,14 @@ if self.indices[ind] >= start and self.indices[ind] < stop: indices.append(ind) - index = self.indices[indices] - start + index = self.indices[indices] - start data = self.data[indices] indptr = numpy.array([0, len(indices)]) return self.__class__((data, index, indptr), shape=shape, \ dtype=self.dtype) - def _transpose(self, cls, copy=False): - M, N = self.shape - return cls((self.data,self.indices,self.indptr),(N,M),copy=copy) - + # conversion methods def todia(self): return self.tocoo(copy=False).todia() @@ -472,8 +443,15 @@ from coo import coo_matrix return coo_matrix((data,(row,col)), self.shape) + + def toarray(self): + A = self.tocoo(copy=False) + M = zeros(self.shape, dtype=self.dtype) + M[A.row, A.col] = A.data + return M - + + # methods that modify the internal data structure def sorted_indices(self): """Return a copy of this matrix with sorted indices """ @@ -483,7 +461,7 @@ # an alternative that has linear complexity is the following # typically the previous option is faster - #return self._toother()._toother() + #return self.toother().toother() def sort_indices(self): """Sort the indices of this matrix *in place* @@ -520,6 +498,38 @@ self.data = self.data[:self.nnz] self.indices = self.indices[:self.nnz] + + # needed by _data_matrix + def _with_data(self,data,copy=True): + """Returns a matrix with the same sparsity structure as self, + but with different data. By default the structure arrays + (i.e. .indptr and .indices) are copied. + """ + if copy: + return self.__class__((data,self.indices.copy(),self.indptr.copy()), \ + shape=self.shape,dtype=data.dtype) + else: + return self.__class__((data,self.indices,self.indptr), \ + shape=self.shape,dtype=data.dtype) + + # utility functions + def _binopt(self, other, op, in_shape=None, out_shape=None): + """apply the binary operation fn to two sparse matrices""" + other = self.__class__(other) + + if in_shape is None: + in_shape = self.shape + if out_shape is None: + out_shape = self.shape + + # e.g. csr_plus_csr, cscmucsc, etc. + fn = getattr(sparsetools, self.format + op + self.format) + + indptr, ind, data = fn(in_shape[0], in_shape[1], \ + self.indptr, self.indices, self.data, + other.indptr, other.indices, other.data) + return self.__class__((data, ind, indptr), shape=out_shape) + def _get_submatrix( self, shape0, shape1, slice0, slice1 ): """Return a submatrix of this matrix (new matrix is created).""" def _process_slice( sl, num ): @@ -564,35 +574,3 @@ data, indices, indptr = aux[2], aux[1], aux[0] return data, indices, indptr, i1 - i0, j1 - j0 - # needed by _data_matrix - def _with_data(self,data,copy=True): - """Returns a matrix with the same sparsity structure as self, - but with different data. By default the structure arrays - (i.e. .indptr and .indices) are copied. - """ - if copy: - return self.__class__((data,self.indices.copy(),self.indptr.copy()), \ - shape=self.shape,dtype=data.dtype) - else: - return self.__class__((data,self.indices,self.indptr), \ - shape=self.shape,dtype=data.dtype) - - # utility functions - def _binopt(self, other, op, in_shape=None, out_shape=None): - """apply the binary operation fn to two sparse matrices""" - other = self._tothis(other) - - if in_shape is None: - in_shape = self.shape - if out_shape is None: - out_shape = self.shape - - # e.g. csr_plus_csr, cscmucsc, etc. - fn = getattr(sparsetools, self.format + op + self.format) - - indptr, ind, data = fn(in_shape[0], in_shape[1], \ - self.indptr, self.indices, self.data, - other.indptr, other.indices, other.data) - return self.__class__((data, ind, indptr), shape=out_shape) - - Modified: trunk/scipy/sparse/csc.py =================================================================== --- trunk/scipy/sparse/csc.py 2007-12-18 19:56:14 UTC (rev 3686) +++ trunk/scipy/sparse/csc.py 2007-12-18 23:20:23 UTC (rev 3687) @@ -81,15 +81,16 @@ else: return _cs_matrix.__getattr__(self, attr) + def transpose(self, copy=False): + from csr import csr_matrix + M,N = self.shape + return csr_matrix((self.data,self.indices,self.indptr),(N,M),copy=copy) + def __iter__(self): csr = self.tocsr() for r in xrange(self.shape[0]): yield csr[r,:] - def transpose(self, copy=False): - from csr import csr_matrix - return _cs_matrix._transpose(self, csr_matrix, copy) - def __getitem__(self, key): #TODO unify these in _cs_matrix if isinstance(key, tuple): @@ -217,12 +218,6 @@ from csr import csr_matrix return csr_matrix((data, indices, indptr), self.shape) - def toarray(self): - A = self.tocoo(copy=False) - M = zeros(self.shape, dtype=self.dtype) - M[A.row, A.col] = A.data - return M - def get_submatrix( self, slice0, slice1 ): """Return a submatrix of this matrix (new matrix is created). Contigous range of rows and columns can be selected using: @@ -241,15 +236,7 @@ """ return (x[1],x[0]) - def _otherformat(self): - return "csr" - def _toother(self): - return self.tocsr() - - def _tothis(self, other): - return other.tocsc() - from sputils import _isinstance def isspmatrix_csc(x): Modified: trunk/scipy/sparse/csr.py =================================================================== --- trunk/scipy/sparse/csr.py 2007-12-18 19:56:14 UTC (rev 3686) +++ trunk/scipy/sparse/csr.py 2007-12-18 23:20:23 UTC (rev 3687) @@ -73,10 +73,6 @@ """ - - - - def __getattr__(self, attr): if attr == 'colind': warn("colind attribute no longer in use. Use .indices instead", @@ -87,7 +83,8 @@ def transpose(self, copy=False): from csc import csc_matrix - return _cs_matrix._transpose(self, csc_matrix, copy) + M,N = self.shape + return csc_matrix((self.data,self.indices,self.indptr),(N,M),copy=copy) def __getitem__(self, key): #TODO unify these in _cs_matrix @@ -227,12 +224,6 @@ from csc import csc_matrix return csc_matrix((data, indices, indptr), self.shape) - def toarray(self): - A = self.tocoo(copy=False) - M = zeros(self.shape, dtype=self.dtype) - M[A.row, A.col] = A.data - return M - def get_submatrix( self, slice0, slice1 ): """Return a submatrix of this matrix (new matrix is created). Contigous range of rows and columns can be selected using: @@ -251,16 +242,7 @@ """ return (x[0],x[1]) - def _otherformat(self): - return "csc" - def _toother(self): - return self.tocsc() - - def _tothis(self, other): - return other.tocsr() - - from sputils import _isinstance def isspmatrix_csr(x): Modified: trunk/scipy/sparse/data.py =================================================================== --- trunk/scipy/sparse/data.py 2007-12-18 19:56:14 UTC (rev 3686) +++ trunk/scipy/sparse/data.py 2007-12-18 23:20:23 UTC (rev 3687) @@ -9,6 +9,7 @@ __all__ = [] from base import spmatrix +from sputils import isscalarlike class _data_matrix(spmatrix): def __init__(self): @@ -32,6 +33,21 @@ def __neg__(self): return self._with_data(-self.data) + def __imul__(self, other): #self *= other + if isscalarlike(other): + self.data *= other + return self + else: + raise NotImplementedError + + def __itruediv__(self, other): #self /= other + if isscalarlike(other): + recip = 1.0 / other + self.data *= recip + return self + else: + raise NotImplementedError + def astype(self, t): return self._with_data(self.data.astype(t)) Modified: trunk/scipy/sparse/tests/test_base.py =================================================================== --- trunk/scipy/sparse/tests/test_base.py 2007-12-18 19:56:14 UTC (rev 3686) +++ trunk/scipy/sparse/tests/test_base.py 2007-12-18 23:20:23 UTC (rev 3687) @@ -159,7 +159,23 @@ denom = self.spmatrix(matrix([[1,0,0,4],[-1,0,0,0],[0,8,0,-5]],'d')) res = matrix([[1,0,0,0.5],[-3,0,numpy.inf,0],[0,0.25,0,0]],'d') assert_array_equal((self.datsp / denom).todense(),res) + + def check_pow(self): + A = matrix([[1,0,2,0],[0,3,4,0],[0,5,0,0],[0,6,7,8]]) + B = self.spmatrix( A ) + for exponent in [0,1,2,3]: + assert_array_equal((B**exponent).todense(),A**exponent) + + #invalid exponents + for exponent in [-1, 2.2, 1 + 3j]: + self.assertRaises( Exception, B.__pow__, exponent ) + + #nonsquare matrix + B = self.spmatrix(A[:3,:]) + self.assertRaises( Exception, B.__pow__, 1 ) + + def check_rmatvec(self): M = self.spmatrix(matrix([[3,0,0],[0,1,0],[2,0,3.0],[2,3,0]])) assert_array_almost_equal([1,2,3,4]*M, dot([1,2,3,4], M.toarray())) From scipy-svn at scipy.org Tue Dec 18 21:08:32 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 18 Dec 2007 20:08:32 -0600 (CST) Subject: [Scipy-svn] r3688 - in trunk/scipy/sparse: . tests Message-ID: <20071219020832.5EF1139C089@new.scipy.org> Author: wnbell Date: 2007-12-18 20:08:27 -0600 (Tue, 18 Dec 2007) New Revision: 3688 Added: trunk/scipy/sparse/tests/test_sputils.py Modified: trunk/scipy/sparse/compressed.py trunk/scipy/sparse/coo.py trunk/scipy/sparse/sputils.py Log: added sputils unittests other minor changes Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-18 23:20:23 UTC (rev 3687) +++ trunk/scipy/sparse/compressed.py 2007-12-19 02:08:27 UTC (rev 3688) @@ -64,7 +64,7 @@ M, N = self.shape self.data = zeros(0, getdtype(dtype, default=float)) self.indices = zeros(0, intc) - self.indptr = zeros(self._swap(self.shape)[0] + 1, dtype='intc') + self.indptr = zeros(self._swap((M,N))[0] + 1, dtype=intc) else: if len(arg1) == 2: # (data, ij) format @@ -142,8 +142,8 @@ % self.indices.dtype.name ) # only support 32-bit ints for now - self.indptr = self.indptr.astype('intc') - self.indices = self.indices.astype('intc') + self.indptr = self.indptr.astype(intc) + self.indices = self.indices.astype(intc) self.data = to_native(self.data) # check array shapes Modified: trunk/scipy/sparse/coo.py =================================================================== --- trunk/scipy/sparse/coo.py 2007-12-18 23:20:23 UTC (rev 3687) +++ trunk/scipy/sparse/coo.py 2007-12-19 02:08:27 UTC (rev 3688) @@ -178,8 +178,8 @@ % self.col.dtype.name ) # only support 32-bit ints for now - self.row = self.row.astype('intc') - self.col = self.col.astype('intc') + self.row = self.row.astype(intc) + self.col = self.col.astype(intc) self.data = to_native(self.data) if nnz > 0: Modified: trunk/scipy/sparse/sputils.py =================================================================== --- trunk/scipy/sparse/sputils.py 2007-12-18 23:20:23 UTC (rev 3687) +++ trunk/scipy/sparse/sputils.py 2007-12-19 02:08:27 UTC (rev 3688) @@ -1,7 +1,7 @@ """ Utility functions for sparse matrix module """ -__all__ = ['getdtype','isscalarlike','isintlike', +__all__ = ['upcast','getdtype','isscalarlike','isintlike', 'isshape','issequence','isdense'] import numpy @@ -58,6 +58,7 @@ are both None, construct a data type out of the 'default' parameter. Furthermore, 'dtype' must be in 'allowed' set. """ + #TODO is this really what we want? canCast = True if dtype is None: try: Added: trunk/scipy/sparse/tests/test_sputils.py =================================================================== --- trunk/scipy/sparse/tests/test_sputils.py 2007-12-18 23:20:23 UTC (rev 3687) +++ trunk/scipy/sparse/tests/test_sputils.py 2007-12-19 02:08:27 UTC (rev 3688) @@ -0,0 +1,76 @@ +"""unit tests for sparse utility functions""" + +import numpy + +from numpy.testing import * +set_package_path() +from scipy.sparse.sputils import * +restore_path() + + + +class TestSparseUtils(NumpyTestCase): + + def check_upcast(self): + assert_equal(upcast('int32'),numpy.int32) + assert_equal(upcast('int32','float32'),numpy.float64) + assert_equal(upcast('bool',complex,float),numpy.complex128) + assert_equal(upcast('i','d'),numpy.float64) + + def check_getdtype(self): + A = numpy.array([1],dtype='int8') + + assert_equal(getdtype(None,default=float),numpy.float) + assert_equal(getdtype(None,a=A),numpy.int8) + + def check_isscalarlike(self): + assert_equal(isscalarlike(3.0),True) + assert_equal(isscalarlike(-4),True) + assert_equal(isscalarlike(2.5),True) + assert_equal(isscalarlike(1 + 3j),True) + assert_equal(isscalarlike(numpy.array(3)),True) + assert_equal(isscalarlike( "16" ), True) + + assert_equal(isscalarlike( numpy.array([3])), False) + assert_equal(isscalarlike( [[3]] ), False) + assert_equal(isscalarlike( (1,) ), False) + assert_equal(isscalarlike( (1,2) ), False) + + def check_isintlike(self): + assert_equal(isintlike(3.0),True) + assert_equal(isintlike(-4),True) + assert_equal(isintlike(numpy.array(3)),True) + assert_equal(isintlike( numpy.array([3])), True) + + assert_equal(isintlike(2.5),False) + assert_equal(isintlike(1 + 3j),False) + assert_equal(isintlike( (1,) ), False) + assert_equal(isintlike( (1,2) ), False) + + def check_isshape(self): + assert_equal(isshape( (1,2) ),True) + assert_equal(isshape( (5,2) ),True) + + assert_equal(isshape( (-1,4) ),False) + assert_equal(isshape( (1.5,2) ),False) + assert_equal(isshape( (0,4) ),False) + assert_equal(isshape( (2,2,2) ),False) + + def check_issequence(self): + assert_equal(issequence( (1,) ),True) + assert_equal(issequence( (1,2,3) ),True) + assert_equal(issequence( [1] ),True) + assert_equal(issequence( [1,2,3] ),True) + assert_equal(issequence( numpy.array([1,2,3]) ),True) + + assert_equal(issequence( numpy.array([[1],[2],[3]]) ),False) + assert_equal(issequence( 3 ),False) + + def check_isdense(self): + assert_equal(isdense( numpy.array([1]) ),True) + assert_equal(isdense( numpy.matrix([1]) ),True) + +if __name__ == "__main__": + NumpyTest().run() + + From scipy-svn at scipy.org Wed Dec 19 12:37:36 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 19 Dec 2007 11:37:36 -0600 (CST) Subject: [Scipy-svn] r3689 - in trunk/scipy/sparse: . tests Message-ID: <20071219173736.4EBD239C037@new.scipy.org> Author: wnbell Date: 2007-12-19 11:37:30 -0600 (Wed, 19 Dec 2007) New Revision: 3689 Modified: trunk/scipy/sparse/compressed.py trunk/scipy/sparse/coo.py trunk/scipy/sparse/dia.py trunk/scipy/sparse/dok.py trunk/scipy/sparse/tests/test_base.py Log: allow all sparse matrices to be initialized with dense matrices and anything that works in asarray() added a few related unittests Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-19 02:08:27 UTC (rev 3688) +++ trunk/scipy/sparse/compressed.py 2007-12-19 17:37:30 UTC (rev 3689) @@ -37,19 +37,8 @@ if dims is not None: warn("nzmax= is deprecated", DeprecationWarning) - if isdense(arg1): - # Convert the dense array or matrix arg1 to sparse format - if rank(arg1) == 1: - # Convert to a row vector - arg1 = arg1.reshape(1, arg1.shape[0]) - if rank(arg1) == 2: - from coo import coo_matrix - self.shape = arg1.shape - self._set_self( self.__class__(coo_matrix(arg1)) ) - else: - raise ValueError, "dense array must have rank 1 or 2" - elif isspmatrix(arg1): + if isspmatrix(arg1): if arg1.format == self.format and copy: arg1 = arg1.copy() else: @@ -75,16 +64,21 @@ # (data, indices, indptr) format (data, indices, indptr) = arg1 self.indices = array(indices, copy=copy) - self.indptr = array(indptr, copy=copy) - self.data = array(data, copy=copy, \ - dtype=getdtype(dtype, data)) + self.indptr = array(indptr, copy=copy) + self.data = array(data, copy=copy, dtype=getdtype(dtype, data)) else: raise ValueError, "unrecognized form for" \ " %s_matrix constructor" % self.format else: - raise ValueError, "unrecognized form for" \ - " %s_matrix constructor" % self.format + #must be dense + try: + arg1 = asarray(arg1) + except: + raise ValueError, "unrecognized form for" \ + " %s_matrix constructor" % self.format + from coo import coo_matrix + self._set_self( self.__class__(coo_matrix(arg1)) ) # Read matrix dimensions given, if any if shape is not None: Modified: trunk/scipy/sparse/coo.py =================================================================== --- trunk/scipy/sparse/coo.py 2007-12-19 02:08:27 UTC (rev 3688) +++ trunk/scipy/sparse/coo.py 2007-12-19 17:37:30 UTC (rev 3689) @@ -6,7 +6,7 @@ from warnings import warn from numpy import array, asarray, empty, intc, zeros, bincount, \ - unique, searchsorted + unique, searchsorted, atleast_2d from sparsetools import coo_tocsr, coo_tocsc from base import spmatrix, isspmatrix @@ -142,12 +142,12 @@ else: #dense argument try: - M = asarray(arg1) + M = atleast_2d(asarray(arg1)) except: raise TypeError, "invalid input format" if len(M.shape) != 2: - raise TypeError, "expected rank 2 array or matrix" + raise TypeError, "expected rank <= 2 array or matrix" self.shape = M.shape self.row,self.col = (M != 0).nonzero() self.data = M[self.row,self.col] @@ -278,6 +278,74 @@ return dok +# def tobsr(self,blocksize=None): +# if blocksize in [None, (1,1)]: +# return self.tocsr().tobsr() +# else: +# from bsr import bsr_matrix +# data,indices,indptr = self._toblock(blocksize,'bsr') +# return bsr_matrix((data,indices,indptr),shape=self.shape) +# +# def tobsc(self,blocksize=None): +# if blocksize in [None, (1,1)]: +# return self.tocsc().tobsc() +# else: +# from bsc import bsc_matrix +# data,indices,indptr = self._toblock(blocksize,'bsc') +# return bsc_matrix((data,indices,indptr),shape=self.shape) +# +# def _toblock(self,blocksize,format): +# """generic function to convert to BSR/BSC/BOO formats""" +# M,N = self.shape +# X,Y = blocksize +# +# if (M % X) != 0 or (N % Y) != 0: +# raise ValueError, 'shape must be multiple of blocksize' +# +# i_block,i_sub = divmod(self.row, X) +# j_block,j_sub = divmod(self.col, Y) +# +# if format in ['bsr','boo']: +# perm = lexsort( keys=[j_block,i_block] ) +# else: +# perm = lexsort( keys=[i_block,j_block] ) +# +# i_block = i_block[perm] +# j_block = j_block[perm] +# +# mask = (i_block[1:] != i_block[:-1]) + (j_block[1:] != j_block[:-1]) +# mask = concatenate((array([True]),mask)) +# +# #map self.data[n] -> data[map[n],i_sub[n],j_sub[n]] +# map = cumsum(mask) +# num_blocks = map[-1] +# map -= 1 +# +# iperm = empty_like(perm) #inverse permutation +# iperm[perm] = arange(len(perm)) +# +# data = zeros( (num_blocks,X,Y), dtype=self.dtype ) +# data[map[iperm],i_sub,j_sub] = self.data +# +# row = i_block[mask] +# col = j_block[mask] +# +# #row,col,data form BOO format +# +# if format == 'boo': +# return data,(row,col) +# elif format == 'bsr': +# temp = cumsum(bincount(row)) +# indptr = zeros( M/X + 1, dtype=intc ) +# indptr[1:len(temp)+1] = temp +# indptr[len(temp)+1:] = temp[-1] +# return data,col,indptr +# else: +# temp = cumsum(bincount(col)) +# indptr = zeros( N/Y + 1, dtype=intc ) +# indptr[1:len(temp)+1] = temp +# indptr[len(temp)+1:] = temp[-1] +# return data,row,indptr from sputils import _isinstance Modified: trunk/scipy/sparse/dia.py =================================================================== --- trunk/scipy/sparse/dia.py 2007-12-19 02:08:27 UTC (rev 3688) +++ trunk/scipy/sparse/dia.py 2007-12-19 17:37:30 UTC (rev 3689) @@ -15,7 +15,7 @@ This can be instantiated in several ways: - dia_matrix(D) - with a dense matrix or rank-2 ndarray D + with a dense matrix - dia_matrix(S) with another sparse matrix S (equivalent to S.todia()) @@ -58,14 +58,11 @@ self.data = arg1.data self.diags = arg1.diags self.shape = arg1.shape - elif isdense(arg1) or isspmatrix(arg1): - if isdense(arg1): - #convert to COO first, then to DIA - from coo import coo_matrix - A = coo_matrix(arg1).todia() + elif isspmatrix(arg1): + if isspmatrix_dia(arg1) and copy: + A = arg1.copy() else: - A = arg1.todia() - + A = arg1.todia() self.data = A.data self.diags = A.diags self.shape = A.shape @@ -88,7 +85,20 @@ 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 + else: + #must be dense, convert to COO first, then to DIA + try: + arg1 = asarray(arg1) + except: + raise ValueError, "unrecognized form for" \ + " %s_matrix constructor" % self.format + from coo import coo_matrix + A = coo_matrix(arg1).todia() + self.data = A.data + self.diags = A.diags + self.shape = A.shape + #check format if self.diags.ndim != 1: raise ValueError,'diags array must have rank 1' Modified: trunk/scipy/sparse/dok.py =================================================================== --- trunk/scipy/sparse/dok.py 2007-12-19 02:08:27 UTC (rev 3688) +++ trunk/scipy/sparse/dok.py 2007-12-19 17:37:30 UTC (rev 3689) @@ -40,14 +40,17 @@ self.update( A ) self.shape = A.shape self.dtype = A.dtype - elif isdense(A): + else: + #must be dense, convert to COO first, then to DOK + try: + A = asarray(A) + except: + raise ValueError, "unrecognized form for" \ + " %s_matrix constructor" % self.format from coo import coo_matrix self.update( coo_matrix(A).todok() ) self.shape = A.shape self.dtype = A.dtype - else: - raise TypeError, "argument should be a tuple of dimensions " \ - "or a sparse or dense matrix" def getnnz(self): return dict.__len__(self) Modified: trunk/scipy/sparse/tests/test_base.py =================================================================== --- trunk/scipy/sparse/tests/test_base.py 2007-12-19 02:08:27 UTC (rev 3688) +++ trunk/scipy/sparse/tests/test_base.py 2007-12-19 17:37:30 UTC (rev 3689) @@ -27,6 +27,7 @@ #TODO test spmatrix(DENSE) and spmatrix(SPARSE) for all combos +#TODO test spmatrix( [[1,2],[3,4]] ) format #TODO check that invalid shape in constructor raises exception #TODO check that spmatrix( ... , copy=X ) is respected class _TestCommon: @@ -80,6 +81,8 @@ def check_fromdense(self): A = matrix([[1,0,0],[2,3,4],[0,5,0],[0,0,0]]) assert_array_equal(self.spmatrix(A).todense(),A) + assert_array_equal(self.spmatrix(A.A).todense(),A) + assert_array_equal(self.spmatrix(A.tolist()).todense(),A) def check_todense(self): chk = self.datsp.todense() @@ -1184,7 +1187,7 @@ assert_array_equal(coo.row,[]) assert_array_equal(coo.col,[]) assert_array_equal(coo.data,[]) - assert_array_equal(zeros((4,3)),coo.todense()) + assert_array_equal(coo.todense(),zeros((4,3))) def check_constructor4(self): """from dense matrix""" @@ -1192,8 +1195,14 @@ [7,0,3,0], [0,4,0,0]]) coo = coo_matrix(mat) - assert_array_equal(mat,coo.todense()) + assert_array_equal(coo.todense(),mat) + #upgrade rank 1 arrays to row matrix + mat = numpy.array([0,1,0,0]) + coo = coo_matrix(mat) + assert_array_equal(coo.todense(),mat.reshape(1,-1)) + + class TestDIA(_TestCommon, _TestArithmetic, NumpyTestCase): spmatrix = dia_matrix From scipy-svn at scipy.org Thu Dec 20 04:16:32 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 20 Dec 2007 03:16:32 -0600 (CST) Subject: [Scipy-svn] r3690 - trunk/scipy/sparse Message-ID: <20071220091632.606A239C018@new.scipy.org> Author: wnbell Date: 2007-12-20 03:16:26 -0600 (Thu, 20 Dec 2007) New Revision: 3690 Modified: trunk/scipy/sparse/base.py Log: warn for ** elementwise multiply Modified: trunk/scipy/sparse/base.py =================================================================== --- trunk/scipy/sparse/base.py 2007-12-19 17:37:30 UTC (rev 3689) +++ trunk/scipy/sparse/base.py 2007-12-20 09:16:26 UTC (rev 3690) @@ -269,6 +269,10 @@ return result elif isscalarlike(other): raise ValueError,'exponent must be an integer' + elif isspmatrix(other): + warn('Using ** for elementwise multiplication is deprecated.'\ + 'Use .multiply() instead',DeprecationWarning) + return self.multiply(other) else: raise NotImplementedError @@ -402,7 +406,7 @@ def todia(self): return self.tocoo().todia() - + def copy(self): return self.__class__(self,copy=True) From scipy-svn at scipy.org Thu Dec 20 14:22:31 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 20 Dec 2007 13:22:31 -0600 (CST) Subject: [Scipy-svn] r3691 - in trunk/scipy/sparse: . sparsetools tests Message-ID: <20071220192231.364FD39C294@new.scipy.org> Author: wnbell Date: 2007-12-20 13:22:18 -0600 (Thu, 20 Dec 2007) New Revision: 3691 Added: trunk/scipy/sparse/sparsetools/fixed_size.h Modified: trunk/scipy/sparse/__init__.py trunk/scipy/sparse/base.py trunk/scipy/sparse/compressed.py trunk/scipy/sparse/coo.py trunk/scipy/sparse/csc.py trunk/scipy/sparse/csr.py trunk/scipy/sparse/data.py trunk/scipy/sparse/dia.py trunk/scipy/sparse/sparsetools/sparsetools.h trunk/scipy/sparse/sparsetools/sparsetools.i trunk/scipy/sparse/sparsetools/sparsetools.py trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx trunk/scipy/sparse/tests/test_base.py Log: separated coo_tocsr() and csr_sum_duplicates() added special repr for dia_matrix working towards block CSR/CSC Modified: trunk/scipy/sparse/__init__.py =================================================================== --- trunk/scipy/sparse/__init__.py 2007-12-20 09:16:26 UTC (rev 3690) +++ trunk/scipy/sparse/__init__.py 2007-12-20 19:22:18 UTC (rev 3691) @@ -9,6 +9,8 @@ from dok import * from coo import * from dia import * +#from bsr import * +#from bsc import * from construct import * from spfuncs import * Modified: trunk/scipy/sparse/base.py =================================================================== --- trunk/scipy/sparse/base.py 2007-12-20 09:16:26 UTC (rev 3690) +++ trunk/scipy/sparse/base.py 2007-12-20 19:22:18 UTC (rev 3691) @@ -407,6 +407,12 @@ def todia(self): return self.tocoo().todia() +# def tobsr(self,blocksize=None): +# return self.tocoo().tobsr(blocksize=blocksize) +# +# def tobsc(self,blocksize=None): +# return self.tocoo().tobsc(blocksize=blocksize) + def copy(self): return self.__class__(self,copy=True) Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-20 09:16:26 UTC (rev 3690) +++ trunk/scipy/sparse/compressed.py 2007-12-20 19:22:18 UTC (rev 3691) @@ -42,7 +42,7 @@ if arg1.format == self.format and copy: arg1 = arg1.copy() else: - arg1 = getattr(arg1,'to' + self.format)() + arg1 = arg1.asformat(self.format) self._set_self( arg1 ) elif isinstance(arg1, tuple): @@ -121,6 +121,7 @@ False - basic check, O(1) operations """ + #TODO does spmatrix take care of this? self.shape = tuple([int(x) for x in self.shape]) # for floats etc. #use _swap to determine proper bounds @@ -446,6 +447,18 @@ # methods that modify the internal data structure + def sum_duplicates(self): + """Eliminate duplicate matrix entries by adding them together + + The is an *in place* operation + """ + fn = getattr(sparsetools,self.format + '_sum_duplicates') + + M,N = self.shape + fn( M, N, self.indptr, self.indices, self.data) + + self.prune() #nnz may have changed + def sorted_indices(self): """Return a copy of this matrix with sorted indices """ Modified: trunk/scipy/sparse/coo.py =================================================================== --- trunk/scipy/sparse/coo.py 2007-12-20 09:16:26 UTC (rev 3690) +++ trunk/scipy/sparse/coo.py 2007-12-20 19:22:18 UTC (rev 3691) @@ -6,13 +6,15 @@ from warnings import warn from numpy import array, asarray, empty, intc, zeros, bincount, \ - unique, searchsorted, atleast_2d + unique, searchsorted, atleast_2d, lexsort, cumsum, concatenate, \ + empty_like, arange from sparsetools import coo_tocsr, coo_tocsc -from base import spmatrix, isspmatrix +from base import isspmatrix +from data import _data_matrix from sputils import upcast, to_native, isshape, getdtype -class coo_matrix(spmatrix): +class coo_matrix(_data_matrix): """A sparse matrix in COOrdinate format. Also known as the 'ijv' or 'triplet' format. @@ -76,7 +78,7 @@ """ def __init__(self, arg1, shape=None, dtype=None, copy=False, dims=None): - spmatrix.__init__(self) + _data_matrix.__init__(self) if dims is not None: warn("dims is deprecated, use shape instead", DeprecationWarning) @@ -154,11 +156,6 @@ self._check() - def _get_dtype(self): - return self.data.dtype - def _set_dtype(self,newtype): - self.data.dtype = newtype - dtype = property(fget=_get_dtype,fset=_set_dtype) def _check(self): """ Checks for consistency and stores the number of non-zeros as @@ -212,7 +209,13 @@ M[A.row, A.col] = A.data return M - def tocsc(self): + def tocsc(self,sum_duplicates=True): + """Return a copy of this matrix in Compressed Sparse Column format + + By default sum_duplicates=True and any duplicate + matrix entries are added together. + + """ from csc import csc_matrix if self.nnz == 0: return csc_matrix(self.shape, dtype=self.dtype) @@ -225,9 +228,17 @@ self.row, self.col, self.data, \ indptr, indices, data) - return csc_matrix((data, indices, indptr), self.shape) + A = csc_matrix((data, indices, indptr), self.shape) + A.sum_duplicates() + return A - def tocsr(self): + def tocsr(self,sum_duplicates=True): + """Return a copy of this matrix in Compressed Sparse Row format + + By default sum_duplicates=True and any duplicate + matrix entries are added together. + + """ from csr import csr_matrix if self.nnz == 0: return csr_matrix(self.shape, dtype=self.dtype) @@ -240,7 +251,9 @@ self.row, self.col, self.data, \ indptr, indices, data) - return csr_matrix((data, indices, indptr), self.shape) + A = csr_matrix((data, indices, indptr), self.shape) + A.sum_duplicates() + return A def tocoo(self, copy=False): @@ -256,7 +269,9 @@ diags = unique(ks) if len(diags) > 100: - pass #do something? + #probably undesired, should we do something? + #should todia() have a maxdiags parameter? + pass #initialize and fill in data array data = zeros( (len(diags), self.col.max()+1), dtype=self.dtype) @@ -278,24 +293,17 @@ return dok -# def tobsr(self,blocksize=None): + +# def tobsc(self,blocksize=None): # if blocksize in [None, (1,1)]: -# return self.tocsr().tobsr() +# return self.tocsc().tobsc(blocksize) # else: -# from bsr import bsr_matrix -# data,indices,indptr = self._toblock(blocksize,'bsr') -# return bsr_matrix((data,indices,indptr),shape=self.shape) +# return self.transpose().tobsr().transpose() # -# def tobsc(self,blocksize=None): +# def tobsr(self,blocksize=None): # if blocksize in [None, (1,1)]: -# return self.tocsc().tobsc() -# else: -# from bsc import bsc_matrix -# data,indices,indptr = self._toblock(blocksize,'bsc') -# return bsc_matrix((data,indices,indptr),shape=self.shape) +# return self.tocsr().tobsr(blocksize) # -# def _toblock(self,blocksize,format): -# """generic function to convert to BSR/BSC/BOO formats""" # M,N = self.shape # X,Y = blocksize # @@ -305,10 +313,7 @@ # i_block,i_sub = divmod(self.row, X) # j_block,j_sub = divmod(self.col, Y) # -# if format in ['bsr','boo']: -# perm = lexsort( keys=[j_block,i_block] ) -# else: -# perm = lexsort( keys=[i_block,j_block] ) +# perm = lexsort( keys=[j_block,i_block] ) # # i_block = i_block[perm] # j_block = j_block[perm] @@ -330,24 +335,30 @@ # row = i_block[mask] # col = j_block[mask] # -# #row,col,data form BOO format +# # now row,col,data form BOO format # -# if format == 'boo': -# return data,(row,col) -# elif format == 'bsr': -# temp = cumsum(bincount(row)) -# indptr = zeros( M/X + 1, dtype=intc ) -# indptr[1:len(temp)+1] = temp -# indptr[len(temp)+1:] = temp[-1] -# return data,col,indptr -# else: -# temp = cumsum(bincount(col)) -# indptr = zeros( N/Y + 1, dtype=intc ) -# indptr[1:len(temp)+1] = temp -# indptr[len(temp)+1:] = temp[-1] -# return data,row,indptr +# temp = cumsum(bincount(row)) +# indptr = zeros( M/X + 1, dtype=intc ) +# indptr[1:len(temp)+1] = temp +# indptr[len(temp)+1:] = temp[-1] +# +# from bsr import bsr_matrix +# return bsr_matrix((data,col,indptr),shape=self.shape) + # needed by _data_matrix + def _with_data(self,data,copy=True): + """Returns a matrix with the same sparsity structure as self, + but with different data. By default the index arrays + (i.e. .row and .col) are copied. + """ + if copy: + return coo_matrix( (data, (self.row.copy(), self.col.copy()) ), \ + shape=self.shape, dtype=data.dtype) + else: + return coo_matrix( (data, (self.row, self.col) ), \ + shape=self.shape, dtype=data.dtype) + from sputils import _isinstance def isspmatrix_coo( x ): Modified: trunk/scipy/sparse/csc.py =================================================================== --- trunk/scipy/sparse/csc.py 2007-12-20 09:16:26 UTC (rev 3690) +++ trunk/scipy/sparse/csc.py 2007-12-20 19:22:18 UTC (rev 3691) @@ -1,4 +1,4 @@ -"""Compressed Sparse Column sparse matrix format +"""Compressed Sparse Column matrix format """ __all__ = ['csc_matrix', 'isspmatrix_csc'] @@ -217,7 +217,26 @@ from csr import csr_matrix return csr_matrix((data, indices, indptr), self.shape) - + +# def tobsc(self,blocksize=None, copy=True): +# if blocksize in [None, (1,1)]: +# from bsc import bsc_matrix +# arg1 = (self.data.reshape(-1,1,1),self.indices,self.indptr) +# return bsc_matrix( arg1, shape=self.shape, copy=copy ) +# else: +# #TODO make this more efficient +# return self.tocoo(copy=False).tobsr(blocksize=blocksize) +# +# def tobsr(self, blocksize=None): +# if blocksize in [None, (1,1)]: +# from bsr import bsr_matrix +# csr = self.tocsr() +# arg1 = (csr.data.reshape(-1,1,1),csr.indices,csr.indptr) +# return bsr_matrix( arg1, shape=self.shape ) +# else: +# #TODO make this more efficient +# return self.tocoo(copy=False).tobsr(blocksize=blocksize) + def get_submatrix( self, slice0, slice1 ): """Return a submatrix of this matrix (new matrix is created). Contigous range of rows and columns can be selected using: Modified: trunk/scipy/sparse/csr.py =================================================================== --- trunk/scipy/sparse/csr.py 2007-12-20 09:16:26 UTC (rev 3690) +++ trunk/scipy/sparse/csr.py 2007-12-20 19:22:18 UTC (rev 3691) @@ -1,4 +1,4 @@ -"""Compressed Sparse Row sparse matrix format +"""Compressed Sparse Row matrix format """ __all__ = ['csr_matrix', 'isspmatrix_csr'] @@ -223,6 +223,25 @@ from csc import csc_matrix return csc_matrix((data, indices, indptr), self.shape) + +# def tobsr(self,blocksize=None,copy=True): +# if blocksize in [None, (1,1)]: +# from bsr import bsr_matrix +# arg1 = (self.data.reshape(-1,1,1),self.indices,self.indptr) +# return bsr_matrix( arg1, shape=self.shape, copy=copy ) +# else: +# #TODO make this more efficient +# return self.tocoo(copy=False).tobsr(blocksize=blocksize) +# +# def tobsc(self,blocksize=None): +# if blocksize in [None, (1,1)]: +# from bsc import bsc_matrix +# csc = self.tocsc() +# arg1 = (csc.data.reshape(-1,1,1),csc.indices,csc.indptr) +# return bsc_matrix( arg1, shape=self.shape ) +# else: +# #TODO make this more efficient +# return self.tocoo(copy=False).tobsc(blocksize=blocksize) def get_submatrix( self, slice0, slice1 ): """Return a submatrix of this matrix (new matrix is created). Modified: trunk/scipy/sparse/data.py =================================================================== --- trunk/scipy/sparse/data.py 2007-12-20 09:16:26 UTC (rev 3690) +++ trunk/scipy/sparse/data.py 2007-12-20 19:22:18 UTC (rev 3691) @@ -11,6 +11,8 @@ from base import spmatrix from sputils import isscalarlike +#TODO implement all relevant operations +#use .data.__methods__() instead of /=, *=, etc. class _data_matrix(spmatrix): def __init__(self): spmatrix.__init__(self) Modified: trunk/scipy/sparse/dia.py =================================================================== --- trunk/scipy/sparse/dia.py 2007-12-20 09:16:26 UTC (rev 3690) +++ trunk/scipy/sparse/dia.py 2007-12-20 19:22:18 UTC (rev 3691) @@ -6,7 +6,7 @@ empty_like, intc, atleast_1d, atleast_2d, add, multiply, \ unique -from base import isspmatrix +from base import isspmatrix, _formats from data import _data_matrix from sputils import isscalarlike, isshape, upcast, getdtype, isdense @@ -114,6 +114,13 @@ if len(unique(self.diags)) != len(self.diags): raise ValueError,'offset array contains duplicate values' + def __repr__(self): + nnz = self.getnnz() + format = self.getformat() + return "<%dx%d sparse matrix of type '%s'\n" \ + "\twith %d stored elements (%d diagonals) in %s format>" % \ + ( self.shape + (self.dtype.type, nnz, self.data.shape[0], \ + _formats[format][1],) ) def getnnz(self): """number of nonzero values Added: trunk/scipy/sparse/sparsetools/fixed_size.h =================================================================== --- trunk/scipy/sparse/sparsetools/fixed_size.h 2007-12-20 09:16:26 UTC (rev 3690) +++ trunk/scipy/sparse/sparsetools/fixed_size.h 2007-12-20 19:22:18 UTC (rev 3691) @@ -0,0 +1,39 @@ +#ifndef FIXED_SIZE_H +#define FIXED_SIZE_H + +/* + * templates for fixed size array and vector arithmetic + * + */ + +template +class Dot +{ + public: + inline T operator()(const T * lhs, const T * rhs) + { + Dot d; + return (*lhs * *rhs) + d(++lhs, ++rhs); + } +}; + +template +class Dot<0,T> +{ + public: + inline T operator()(const T * lhs, const T * rhs) + { + return 0; + } +}; + + template +inline T dot(const T * lhs, const T * rhs) +{ + Dot d; + return d(lhs, rhs); +} + + + +#endif Modified: trunk/scipy/sparse/sparsetools/sparsetools.h =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.h 2007-12-20 09:16:26 UTC (rev 3690) +++ trunk/scipy/sparse/sparsetools/sparsetools.h 2007-12-20 19:22:18 UTC (rev 3691) @@ -10,7 +10,7 @@ * Nathan Bell * * Revisions: - * 07/14/2007 - added sum_csr_duplicates + * 07/14/2007 - added csr_sum_duplicates * 07/12/2007 - added templated function for binary arithmetic ops * 01/09/2007 - index type is now templated * 01/06/2007 - initial inclusion into SciPy @@ -24,6 +24,10 @@ #include #include + +#include "fixed_size.h" + + /* * Extract main diagonal of CSR matrix A * @@ -38,7 +42,8 @@ * T Yx[min(n_row,n_col)] - diagonal entries * * Note: - * Output array Yx should be preallocated + * Output array Yx must be preallocated + * * Duplicate entries will be summed. * * Complexity: Linear. Specifically O(nnz(A) + min(n_row,n_col)) @@ -52,20 +57,20 @@ const T Ax[], T Yx[]) { - 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]; - - T diag = 0; - for(I jj = row_start; jj < row_end; jj++){ - if (Aj[jj] == i) - diag += Ax[jj]; + 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]; + + T diag = 0; + for(I jj = row_start; jj < row_end; jj++){ + if (Aj[jj] == i) + diag += Ax[jj]; + } + + Yx[i] = diag; } - - Yx[i] = diag; - } } @@ -80,7 +85,7 @@ * Bi - row indices * * Note: - * Output array Bi needs to be preallocated + * Output array Bi must be preallocated * * Note: * Complexity: Linear. @@ -92,9 +97,7 @@ I Bi[]) { for(I i = 0; i < n_row; i++){ - I row_start = Ap[i]; - I row_end = Ap[i+1]; - for(I jj = row_start; jj < row_end; jj++){ + for(I jj = Ap[i]; jj < Ap[i+1]; jj++){ Bi[jj] = i; } } @@ -122,7 +125,7 @@ * T Bx[nnz(A)] - nonzeros * * Note: - * Output arrays Bp,Bj,Bx should be preallocated + * Output arrays Bp, Bj, Bx must be preallocated * * Note: * Input: column indices *are not* assumed to be in sorted order @@ -141,96 +144,91 @@ I Bi[], T Bx[]) { - I nnz = Ap[n_row]; - - std::vector temp(n_col,0); //temp array + const I nnz = Ap[n_row]; //compute number of non-zero entries per column of A - for (I i = 0; i < nnz; i++){ - temp[Aj[i]]++; + std::fill(Bp, Bp + n_col, 0); + + for (I n = 0; n < nnz; n++){ + Bp[Aj[n]]++; } //cumsum the nnz per column to get Bp[] - for(I i = 0, cumsum = 0; i < n_col; i++){ - Bp[i] = cumsum; - cumsum += temp[i]; + for(I col = 0, cumsum = 0; col < n_col; col++){ + I temp = Bp[col]; + Bp[col] = cumsum; + cumsum += temp; } Bp[n_col] = nnz; - std::copy(Bp, Bp + n_col, temp.begin()); - - for(I i = 0; i < n_row; i++){ - I row_start = Ap[i]; - I row_end = Ap[i+1]; - for(I j = row_start; j < row_end; j++){ - I col = Aj[j]; - I k = temp[col]; + for(I row = 0; row < n_row; row++){ + for(I jj = Ap[row]; jj < Ap[row+1]; jj++){ + I col = Aj[jj]; + I dest = Bp[col]; - Bi[k] = i; - Bx[k] = Ax[j]; + Bi[dest] = row; + Bx[dest] = Ax[jj]; - temp[col]++; + Bp[col]++; } } + + for(I col = 0, last = 0; col <= n_col; col++){ + I temp = Bp[col]; + Bp[col] = last; + last = temp; + } } + + + /* - * Compute B = A for CSR matrix A, COO matrix B + * Compute C = A*B for CSR matrices A,B * - * Also, with the appropriate arguments can also be used to: - * - convert CSC->COO * * Input Arguments: - * I n_row - number of rows in A - * I n_col - number of columns in A - * I Ap[n_row+1] - row pointer - * I Aj[nnz(A)] - column indices - * T Ax[nnz(A)] - nonzeros - * + * 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 Bi - row indices - * vec Bj - column indices - * vec Bx - nonzeros - * + * vec Cp - row pointer + * vec Cj - column indices + * vec Cx - nonzeros + * * Note: - * Output arrays Bi,Bj,Bx will be allocated within in the method + * Output arrays Cp, Cj, and Cx must be preallocated * * Note: - * Complexity: Linear. - * + * Input: A and B column indices *are not* assumed to be in sorted order + * Output: C column indices *are not* assumed to be in sorted order + * Cx will not contain any zero entries + * + * Complexity: O(n_row*K^2 + max(n_row,n_col)) + * where K is the maximum nnz in a row of A + * and column of B. + * + * + * This is an implementation of the SMMP algorithm: + * + * "Sparse Matrix Multiplication Package (SMMP)" + * Randolph E. Bank and Craig C. Douglas + * + * http://citeseer.ist.psu.edu/445062.html + * http://www.mgnet.org/~douglas/ccd-codes.html + * */ -template -void csr_tocoo(const I n_row, - const I n_col, - const I Ap[], - const I Aj[], - const T Ax[], - std::vector* Bi, - std::vector* Bj, - std::vector* Bx) -{ - I nnz = Ap[n_row]; - Bi->reserve(nnz); - Bi->reserve(nnz); - Bx->reserve(nnz); - for(I i = 0; i < n_row; i++){ - I row_start = Ap[i]; - I row_end = Ap[i+1]; - for(I jj = row_start; jj < row_end; jj++){ - Bi->push_back(i); - Bj->push_back(Aj[jj]); - Bx->push_back(Ax[jj]); - } - } -} - - /* - * Compute CSR row pointer for the matrix product C = A * B + * Pass 1 computes CSR row pointer for the matrix product C = A * B * */ template @@ -276,6 +274,10 @@ } } +/* + * Pass 2 computes CSR entries for C using the row pointer computed in Pass 1 + * + */ template void csr_matmat_pass2(const I n_row, const I n_col, @@ -343,108 +345,10 @@ -/* - * Compute C = A*B for CSR matrices A,B - * - * - * Input Arguments: - * 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 Cp - row pointer - * vec Cj - column indices - * vec Cx - nonzeros - * - * Note: - * Output arrays Cp,Cj, and Cx will be allocated within in the method - * - * Note: - * Input: A and B column indices *are not* assumed to be in sorted order - * Output: C column indices *are not* assumed to be in sorted order - * Cx will not contain any zero entries - * - * Complexity: O(n_row*K^2 + max(n_row,n_col)) - * where K is the maximum nnz in a row of A - * and column of B. - * - * - * This implementation closely follows the SMMP algorithm: - * - * "Sparse Matrix Multiplication Package (SMMP)" - * Randolph E. Bank and Craig C. Douglas - * - * http://citeseer.ist.psu.edu/445062.html - * http://www.mgnet.org/~douglas/ccd-codes.html - * - */ -template -void csrmucsr(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* Cp, - std::vector* Cj, - std::vector* Cx) -{ - Cp->resize(n_row+1,0); - std::vector next(n_col,-1); - std::vector sums(n_col, 0); - for(I i = 0; i < n_row; i++){ - I head = -2; - I length = 0; - I jj_start = Ap[i]; - I jj_end = Ap[i+1]; - for(I jj = jj_start; jj < jj_end; jj++){ - I j = Aj[jj]; - I kk_start = Bp[j]; - I kk_end = Bp[j+1]; - for(I kk = kk_start; kk < kk_end; kk++){ - I k = Bj[kk]; - - sums[k] += Ax[jj]*Bx[kk]; - - if(next[k] == -1){ - next[k] = head; - head = k; - length++; - } - } - } - - for(I jj = 0; jj < length; jj++){ - if(sums[head] != 0){ - Cj->push_back(head); - Cx->push_back(sums[head]); - } - - I temp = head; - head = next[head]; - - next[temp] = -1; //clear arrays - sums[temp] = 0; - } - - (*Cp)[i+1] = Cx->size(); - } -} - - - - /* * Compute C = A (bin_op) B for CSR matrices A,B * @@ -466,7 +370,7 @@ * vec Cx - nonzeros * * Note: - * Output arrays Cp,Cj, and Cx will be allocated within in the method + * Output arrays Cp, Cj, and Cx will be allocated within in the method * * Note: * Input: A and B column indices *are not* assumed to be in sorted order @@ -488,14 +392,14 @@ std::vector* Cx, const bin_op& op) { - Cp->resize(n_row+1,0); + Cp->resize(n_row + 1, 0); - std::vector next(n_col,-1); - std::vector A_row(n_col,0); - std::vector B_row(n_col,0); + std::vector next(n_col,-1); + std::vector A_row(n_col, 0); + std::vector B_row(n_col, 0); for(I i = 0; i < n_row; i++){ - I head = -2; + I head = -2; I length = 0; //add a row of A to A_row @@ -605,7 +509,7 @@ * */ template -void sum_csr_duplicates(const I n_row, +void csr_sum_duplicates(const I n_row, const I n_col, I Ap[], I Aj[], @@ -672,15 +576,15 @@ * T Bx - nonzeros * * Note: - * Output arrays Bp,Bj,Bx should be preallocated + * Output arrays Bp, Bj, and Bx must be preallocated * * Note: * Input: row and column indices *are not* assumed to be ordered - * duplicate (i,j) entries will be summed together * * Output: CSR column indices *will be* in sorted order - * Bp[n_row] will store the number of nonzeros * + * Note: duplicate entries are carried over to the CSR represention + * * Complexity: Linear. Specifically O(nnz(A) + max(n_row,n_col)) * */ @@ -695,39 +599,46 @@ I Bj[], T Bx[]) { - std::vector temp(n_row,0); + //compute number of non-zero entries per row of A + std::fill(Bp, Bp + n_row, 0); - //compute nnz per row, then compute Bp - for(I i = 0; i < nnz; i++){ - temp[Ai[i]]++; - } - //cumsum the nnz per row to get Bp[] - for(I i = 0, cumsum = 0; i < n_row; i++){ - Bp[i] = cumsum; - cumsum += temp[i]; - } - Bp[n_row] = nnz; - std::copy(Bp, Bp + n_row, temp.begin()); + for (I n = 0; n < nnz; n++){ + Bp[Ai[n]]++; + } - //write Aj,Ax into Bj,Bx - for(I i = 0; i < nnz; i++){ - I row = Ai[i]; - I n = temp[row]; + //cumsum the nnz per row to get Bp[] + for(I i = 0, cumsum = 0; i < n_row; i++){ + I temp = Bp[i]; + Bp[i] = cumsum; + cumsum += temp; + } + Bp[n_row] = nnz; - Bj[n] = Aj[i]; - Bx[n] = Ax[i]; + //write Aj,Ax into Bj,Bx + for(I n = 0; n < nnz; n++){ + I row = Ai[n]; + I dest = Bp[row]; - temp[row]++; - } - //now Bp,Bj,Bx form a CSR representation (with duplicates) + Bj[dest] = Aj[n]; + Bx[dest] = Ax[n]; - sum_csr_duplicates(n_row,n_col,Bp,Bj,Bx); + Bp[row]++; + } + + for(I i = 0, last = 0; i <= n_row; i++){ + I temp = Bp[i]; + Bp[i] = last; + last = temp; + } + + //now Bp,Bj,Bx form a CSR representation (with possible duplicates) } - + + /* * Compute Y = A*X for CSR matrix A and dense vectors X,Y * @@ -737,16 +648,16 @@ * 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 + * T Ax[nnz(A)] - nonzeros + * T Xx[n_col] - input vector * * Output Arguments: - * vec Yx - nonzeros + * T Yx[n_row] - output vector * * Note: - * Output array Xx will be allocated within in the method + * Output array Yx must be preallocated * - * Complexity: Linear. Specifically O(nnz(A) + max(n_row,n_col)) + * Complexity: Linear. Specifically O(nnz(A) + n_row) * */ template @@ -758,16 +669,13 @@ const T Xx[], T Yx[]) { - for(I i = 0; i < n_row; i++){ - I row_start = Ap[i]; - I row_end = Ap[i+1]; - - T sum = 0; - for(I jj = row_start; jj < row_end; jj++){ - sum += Ax[jj] * Xx[Aj[jj]]; + for(I i = 0; i < n_row; i++){ + T sum = 0; + for(I jj = Ap[i]; jj < Ap[i+1]; jj++){ + sum += Ax[jj] * Xx[Aj[jj]]; + } + Yx[i] = sum; } - Yx[i] = sum; - } } @@ -785,13 +693,12 @@ * T Xx[n_col] - input vector * * Output Arguments: - * T Yx[n_row] - output vector + * T Yx[n_row] - output vector * * Note: - * Output arrays Xx should be be preallocated - * + * Output array Yx must be preallocated * - * Complexity: Linear. Specifically O(nnz(A) + max(n_row,n_col)) + * Complexity: Linear. Specifically O(nnz(A) + n_col) * */ template @@ -803,162 +710,135 @@ const T Xx[], T Yx[]) { - for(I i = 0; i < n_row; i++){ - Yx[i] = 0; - } + for(I i = 0; i < n_row; i++){ + Yx[i] = 0; + } - for(I j = 0; j < n_col; j++){ - I col_start = Ap[j]; - I col_end = Ap[j+1]; - - for(I ii = col_start; ii < col_end; ii++){ - I row = Ai[ii]; - Yx[row] += Ax[ii] * Xx[j]; + for(I j = 0; j < n_col; j++){ + I col_start = Ap[j]; + I col_end = Ap[j+1]; + + for(I ii = col_start; ii < col_end; ii++){ + I row = Ai[ii]; + Yx[row] += Ax[ii] * Xx[j]; + } } - } } -/* - * Construct CSC matrix A from diagonals - * - * Input Arguments: - * 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 Ap - row pointer - * vec Aj - column indices - * vec Ax - nonzeros - * - * Note: - * Output arrays Ap,Aj,Ax will be allocated within in the method - * - * Note: - * Output: row indices are not in sorted order - * - * Complexity: Linear - * - */ -template -void spdiags(const I n_row, - const I n_col, - const I n_diag, - const I offsets[], - const T diags[], - std::vector * Ap, - std::vector * Ai, - std::vector * Ax) +template +void bsr_matvec_fixed(const I n_row, + const I n_col, + const I Ap[], + const I Aj[], + const T Ax[], + const T Xx[], + T Yx[]) { - const I diags_length = std::min(n_row,n_col); - Ap->push_back(0); + for(I i = 0; i < n_row; i++) { + T r0 = 0; + T r1 = 0; + T r2 = 0; + T r3 = 0; + T r4 = 0; + T r5 = 0; - for(I i = 0; i < n_col; i++){ - for(I j = 0; j < n_diag; j++){ - if(offsets[j] <= 0){ //sub-diagonal - 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 - I row = i - offsets[j]; - if (row < 0 || row >= n_row){ continue; } - Ai->push_back(row); - Ax->push_back(diags[j*diags_length + row]); - } + for(I jj = Ap[i]; jj < Ap[i+1]; jj++) { + I j = Aj[jj]; + const T * base = Ax + jj*(R*C); + if (R >= 1) r0 += dot(base + 0*C, Xx + j*C); + if (R >= 2) r1 += dot(base + 1*C, Xx + j*C); + if (R >= 3) r2 += dot(base + 2*C, Xx + j*C); + if (R >= 4) r3 += dot(base + 3*C, Xx + j*C); + if (R >= 5) r4 += dot(base + 4*C, Xx + j*C); + if (R >= 6) r5 += dot(base + 5*C, Xx + j*C); + } + + if (R >= 1) Yx[R*i+0] = r0; + if (R >= 2) Yx[R*i+1] = r1; + if (R >= 3) Yx[R*i+2] = r2; + if (R >= 4) Yx[R*i+3] = r3; + if (R >= 5) Yx[R*i+4] = r4; + if (R >= 6) Yx[R*i+5] = r5; } - Ap->push_back(Ai->size()); - } } -/* - * Compute M = A for CSR matrix A, dense matrix M - * - * Input Arguments: - * I n_row - number of rows in A - * I n_col - number of columns in A - * I Ap[n_row+1] - row pointer - * I Aj[nnz(A)] - column indices - * T Ax[nnz(A)] - nonzeros - * T Mx[n_row*n_col] - dense matrix - * - * Note: - * Output array Mx is assumed to be allocated and - * initialized to 0 by the caller. - * - */ template -void csr_todense(const I n_row, - const I n_col, - const I Ap[], - const I Aj[], - const T Ax[], - T Mx[]) +void bsr_matvec(const I n_row, + const I n_col, + const I R, + const I C, + const I Ap[], + const I Aj[], + const T Ax[], + const T Xx[], + T Yx[]) { - 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; - } -} + /* + //use fixed version for R,C <= 4,4 + if (R == 1){ + if (C == 1) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } + if (C == 2) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } + if (C == 3) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } + if (C == 4) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } + } + if (R == 2){ + if (C == 1) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } + if (C == 2) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } + if (C == 3) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } + if (C == 4) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } + } + if (R == 3){ + if (C == 1) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } + if (C == 2) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } + if (C == 3) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } + if (C == 4) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } + } + if (R == 4){ + if (C == 1) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } + if (C == 2) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } + if (C == 3) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } + if (C == 4) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } + } */ + //otherwise use general method + for(I i = 0; i < n_row; i++){ + Yx[i] = 0; + } -/* - * Compute A = M for CSR matrix A, dense matrix M - * - * Input Arguments: - * 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 -void dense_tocsr(const I n_row, - const I n_col, - const T Mx[], - std::vector* Ap, - std::vector* Aj, - std::vector* Ax) -{ - const T* x_ptr = Mx; + for(I i = 0; i < n_row; i++){ + const T * A = Ax + R * C * Ap[i]; + T * y = Yx + R * i; + for(I jj = Ap[i]; jj < Ap[i+1]; jj++){ + const T * x = Xx + C*Aj[jj]; - Ap->push_back(0); - for(I i = 0; i < n_row; i++){ - for(I j = 0; j < n_col; j++){ - if(*x_ptr != 0){ - Aj->push_back(j); - Ax->push_back(*x_ptr); - } - x_ptr++; + for( I r = 0; r < R; r++ ){ + T sum = 0; + for( I c = 0; c < C; c++ ){ + sum += (*A) * x[c]; + A++; + } + y[r] += sum; + } + + } } - Ap->push_back(Aj->size()); - } } + + + + + /* * Sort CSR column indices inplace * @@ -979,8 +859,8 @@ void csr_sort_indices(const I n_row, const I n_col, const I Ap[], - I Aj[], - T Ax[]) + I Aj[], + T Ax[]) { std::vector< std::pair > temp; @@ -1003,57 +883,58 @@ } } + template void get_csr_submatrix(const I n_row, - const I n_col, - const I Ap[], - const I Aj[], - const T Ax[], - const I ir0, - const I ir1, - const I ic0, - const I ic1, - std::vector* Bp, - std::vector* Bj, - std::vector* Bx) + const I n_col, + const I Ap[], + const I Aj[], + const T Ax[], + const I ir0, + const I ir1, + const I ic0, + const I ic1, + std::vector* Bp, + std::vector* Bj, + std::vector* Bx) { - I new_n_row = ir1 - ir0; - //I new_n_col = ic1 - ic0; //currently unused - I new_nnz = 0; - I kk = 0; + I new_n_row = ir1 - ir0; + //I new_n_col = ic1 - ic0; //currently unused + I new_nnz = 0; + I kk = 0; - // Count nonzeros total/per row. - for(I i = 0; i < new_n_row; i++){ - I row_start = Ap[ir0+i]; - I row_end = Ap[ir0+i+1]; + // Count nonzeros total/per row. + for(I i = 0; i < new_n_row; i++){ + I row_start = Ap[ir0+i]; + I row_end = Ap[ir0+i+1]; - for(I jj = row_start; jj < row_end; jj++){ - if ((Aj[jj] >= ic0) && (Aj[jj] < ic1)) { - new_nnz++; - } + for(I jj = row_start; jj < row_end; jj++){ + if ((Aj[jj] >= ic0) && (Aj[jj] < ic1)) { + new_nnz++; + } + } } - } - // Allocate. - Bp->resize(new_n_row+1); - Bj->resize(new_nnz); - Bx->resize(new_nnz); + // Allocate. + Bp->resize(new_n_row+1); + Bj->resize(new_nnz); + Bx->resize(new_nnz); - // Assign. - (*Bp)[0] = 0; - for(I i = 0; i < new_n_row; i++){ - I row_start = Ap[ir0+i]; - I row_end = Ap[ir0+i+1]; + // Assign. + (*Bp)[0] = 0; + for(I i = 0; i < new_n_row; i++){ + I row_start = Ap[ir0+i]; + I row_end = Ap[ir0+i+1]; - for(I jj = row_start; jj < row_end; jj++){ - if ((Aj[jj] >= ic0) && (Aj[jj] < ic1)) { - (*Bj)[kk] = Aj[jj] - ic0; - (*Bx)[kk] = Ax[jj]; - kk++; - } + for(I jj = row_start; jj < row_end; jj++){ + if ((Aj[jj] >= ic0) && (Aj[jj] < ic1)) { + (*Bj)[kk] = Aj[jj] - ic0; + (*Bx)[kk] = Ax[jj]; + kk++; + } + } + (*Bp)[i+1] = kk; } - (*Bp)[i+1] = kk; - } } @@ -1084,16 +965,6 @@ T Bx[]) { csr_tocsc(n_col, n_row, Ap, Ai, Ax, Bp, Bj, Bx); } -template -void csc_tocoo(const I n_row, - const I n_col, - const I Ap[], - const I Ai[], - const T Ax[], - std::vector* Bi, - std::vector* Bj, - std::vector* Bx) -{ csr_tocoo(n_col, n_row, Ap, Ai, Ax, Bj, Bi, Bx); } template void csc_matmat_pass1(const I n_row, @@ -1119,19 +990,6 @@ T Cx[]) { csr_matmat_pass2(n_col, n_row, Bp, Bi, Bx, Ap, Ai, Ax, Cp, Ci, Cx); } -template -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* Cp, - std::vector* Ci, - std::vector* Cx) -{ csrmucsr(n_col, n_row, Bp, Bi, Bx, Ap, Ai, Ax, Cp, Ci, Cx); } template void coo_tocsc(const I n_row, @@ -1187,12 +1045,12 @@ template -void sum_csc_duplicates(const I n_row, +void csc_sum_duplicates(const I n_row, const I n_col, I Ap[], I Ai[], T Ax[]) -{ sum_csr_duplicates(n_col, n_row, Ap, Ai, Ax); } +{ csr_sum_duplicates(n_col, n_row, Ap, Ai, Ax); } template @@ -1203,4 +1061,306 @@ T Ax[]) { csr_sort_indices(n_col, n_row, Ap, Ai, Ax); } + + + + + +/* + * These are sparsetools functions that are not currently used + * + */ + +///* +// * Compute C = A*B for CSR matrices A,B +// * +// * +// * Input Arguments: +// * 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 Cp - row pointer +// * vec Cj - column indices +// * vec Cx - nonzeros +// * +// * Note: +// * Output arrays Cp, Cj, and Cx will be allocated within in the method +// * +// * Note: +// * Input: A and B column indices *are not* assumed to be in sorted order +// * Output: C column indices *are not* assumed to be in sorted order +// * Cx will not contain any zero entries +// * +// * Complexity: O(n_row*K^2 + max(n_row,n_col)) +// * where K is the maximum nnz in a row of A +// * and column of B. +// * +// * +// * This implementation closely follows the SMMP algorithm: +// * +// * "Sparse Matrix Multiplication Package (SMMP)" +// * Randolph E. Bank and Craig C. Douglas +// * +// * http://citeseer.ist.psu.edu/445062.html +// * http://www.mgnet.org/~douglas/ccd-codes.html +// * +// */ +//template +//void csrmucsr(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* Cp, +// std::vector* Cj, +// std::vector* Cx) +//{ +// Cp->resize(n_row+1,0); +// +// std::vector next(n_col,-1); +// std::vector sums(n_col, 0); +// +// for(I i = 0; i < n_row; i++){ +// I head = -2; +// I length = 0; +// +// I jj_start = Ap[i]; +// I jj_end = Ap[i+1]; +// for(I jj = jj_start; jj < jj_end; jj++){ +// I j = Aj[jj]; +// +// I kk_start = Bp[j]; +// I kk_end = Bp[j+1]; +// for(I kk = kk_start; kk < kk_end; kk++){ +// I k = Bj[kk]; +// +// sums[k] += Ax[jj]*Bx[kk]; +// +// if(next[k] == -1){ +// next[k] = head; +// head = k; +// length++; +// } +// } +// } +// +// for(I jj = 0; jj < length; jj++){ +// if(sums[head] != 0){ +// Cj->push_back(head); +// Cx->push_back(sums[head]); +// } +// +// I temp = head; +// head = next[head]; +// +// next[temp] = -1; //clear arrays +// sums[temp] = 0; +// } +// +// (*Cp)[i+1] = Cx->size(); +// } +//} +// +// +// +// +// +// +// +// +// +// +// +// +///* +// * Compute A = M for CSR matrix A, dense matrix M +// * +// * Input Arguments: +// * 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, and Ax will be allocated within the method +// * +// */ +//template +//void dense_tocsr(const I n_row, +// const I n_col, +// const T Mx[], +// std::vector* Ap, +// std::vector* Aj, +// std::vector* Ax) +//{ +// const T* x_ptr = Mx; +// +// Ap->push_back(0); +// for(I i = 0; i < n_row; i++){ +// for(I j = 0; j < n_col; j++){ +// if(*x_ptr != 0){ +// Aj->push_back(j); +// Ax->push_back(*x_ptr); +// } +// x_ptr++; +// } +// Ap->push_back(Aj->size()); +// } +//} +// +// +///* +// * Compute M = A for CSR matrix A, dense matrix M +// * +// * Input Arguments: +// * I n_row - number of rows in A +// * I n_col - number of columns in A +// * I Ap[n_row+1] - row pointer +// * I Aj[nnz(A)] - column indices +// * T Ax[nnz(A)] - nonzeros +// * T Mx[n_row*n_col] - dense matrix +// * +// * Note: +// * Output array Mx is assumed to be allocated and +// * initialized to 0 by the caller. +// * +// */ +//template +//void csr_todense(const I n_row, +// const I n_col, +// const I Ap[], +// const I Aj[], +// const T Ax[], +// T Mx[]) +//{ +// I row_base = 0; +// for(I i = 0; i < n_row; i++){ +// 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; +// } +//} +///* +// * Compute B = A for CSR matrix A, COO matrix B +// * +// * Also, with the appropriate arguments can also be used to: +// * - convert CSC->COO +// * +// * Input Arguments: +// * I n_row - number of rows in A +// * I n_col - number of columns in A +// * I Ap[n_row+1] - row pointer +// * I Aj[nnz(A)] - column indices +// * T Ax[nnz(A)] - nonzeros +// * +// * Output Arguments: +// * vec Bi - row indices +// * vec Bj - column indices +// * vec Bx - nonzeros +// * +// * Note: +// * Output arrays Bi, Bj, Bx will be allocated within in the method +// * +// * Note: +// * Complexity: Linear. +// * +// */ +//template +//void csr_tocoo(const I n_row, +// const I n_col, +// const I Ap[], +// const I Aj[], +// const T Ax[], +// std::vector* Bi, +// std::vector* Bj, +// std::vector* Bx) +//{ +// I nnz = Ap[n_row]; +// Bi->reserve(nnz); +// Bi->reserve(nnz); +// Bx->reserve(nnz); +// for(I i = 0; i < n_row; i++){ +// I row_start = Ap[i]; +// I row_end = Ap[i+1]; +// for(I jj = row_start; jj < row_end; jj++){ +// Bi->push_back(i); +// Bj->push_back(Aj[jj]); +// Bx->push_back(Ax[jj]); +// } +// } +//} +// +// +///* +// * Construct CSC matrix A from diagonals +// * +// * Input Arguments: +// * 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 Ap - row pointer +// * vec Aj - column indices +// * vec Ax - nonzeros +// * +// * Note: +// * Output arrays Ap, Aj, Ax will be allocated within in the method +// * +// * Note: +// * Output: row indices are not in sorted order +// * +// * Complexity: Linear +// * +// */ +//template +//void spdiags(const I n_row, +// const I n_col, +// const I n_diag, +// const I offsets[], +// const T diags[], +// std::vector * Ap, +// std::vector * Ai, +// std::vector * Ax) +//{ +// const I diags_length = std::min(n_row,n_col); +// Ap->push_back(0); +// +// for(I i = 0; i < n_col; i++){ +// for(I j = 0; j < n_diag; j++){ +// if(offsets[j] <= 0){ //sub-diagonal +// 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 +// I row = i - offsets[j]; +// if (row < 0 || row >= n_row){ continue; } +// Ai->push_back(row); +// Ax->push_back(diags[j*diags_length + row]); +// } +// } +// Ap->push_back(Ai->size()); +// } +//} +// + #endif Modified: trunk/scipy/sparse/sparsetools/sparsetools.i =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.i 2007-12-20 09:16:26 UTC (rev 3690) +++ trunk/scipy/sparse/sparsetools/sparsetools.i 2007-12-20 19:22:18 UTC (rev 3691) @@ -197,8 +197,6 @@ * CSR<->COO and CSC<->COO */ %template(expandptr) expandptr; -/*INSTANTIATE_ALL(csrtocoo)*/ -/*INSTANTIATE_ALL(csctocoo)*/ INSTANTIATE_ALL(coo_tocsr) INSTANTIATE_ALL(coo_tocsc) @@ -210,14 +208,13 @@ %template(csc_matmat_pass1) csc_matmat_pass1; INSTANTIATE_ALL(csr_matmat_pass2) INSTANTIATE_ALL(csc_matmat_pass2) -/*INSTANTIATE_ALL(csrmucsr)*/ -/*INSTANTIATE_ALL(cscmucsc)*/ /* * CSR*x and CSC*x */ INSTANTIATE_ALL(csr_matvec) INSTANTIATE_ALL(csc_matvec) +INSTANTIATE_ALL(bsr_matvec) /* * CSR (binary op) CSR and CSC (binary op) CSC @@ -233,19 +230,7 @@ INSTANTIATE_ALL(csc_minus_csc) - /* - * spdiags->CSC - */ -/*INSTANTIATE_ALL(spdiags)*/ - -/* - * CSR<->Dense - */ -/*INSTANTIATE_ALL(csr_todense)*/ -/*INSTANTIATE_ALL(densetocsr)*/ - -/* * Sort CSR/CSC indices. */ INSTANTIATE_ALL(csr_sort_indices) @@ -255,8 +240,8 @@ /* * Sum duplicate CSR/CSC entries. */ -INSTANTIATE_ALL(sum_csr_duplicates) -INSTANTIATE_ALL(sum_csc_duplicates) +INSTANTIATE_ALL(csr_sum_duplicates) +INSTANTIATE_ALL(csc_sum_duplicates) /* * Extract submatrices Modified: trunk/scipy/sparse/sparsetools/sparsetools.py =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.py 2007-12-20 09:16:26 UTC (rev 3690) +++ trunk/scipy/sparse/sparsetools/sparsetools.py 2007-12-20 19:22:18 UTC (rev 3691) @@ -300,6 +300,31 @@ """ return _sparsetools.csc_matvec(*args) +def bsr_matvec(*args): + """ + bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, + signed char Ax, signed char Xx, signed char Yx) + bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, + unsigned char Ax, unsigned char Xx, unsigned char Yx) + bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, + short Ax, short Xx, short Yx) + bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, + int Ax, int Xx, int Yx) + bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, + long long Ax, long long Xx, long long Yx) + bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, + float Ax, float Xx, float Yx) + bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, + double Ax, double Xx, double Yx) + bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, + npy_cfloat_wrapper Ax, npy_cfloat_wrapper Xx, + npy_cfloat_wrapper Yx) + bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, + npy_cdouble_wrapper Ax, npy_cdouble_wrapper Xx, + npy_cdouble_wrapper Yx) + """ + return _sparsetools.bsr_matvec(*args) + def csr_elmul_csr(*args): """ csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, signed char Ax, @@ -600,33 +625,33 @@ """ return _sparsetools.csc_sort_indices(*args) -def sum_csr_duplicates(*args): +def csr_sum_duplicates(*args): """ - sum_csr_duplicates(int n_row, int n_col, int Ap, int Aj, signed char Ax) - sum_csr_duplicates(int n_row, int n_col, int Ap, int Aj, unsigned char Ax) - sum_csr_duplicates(int n_row, int n_col, int Ap, int Aj, short Ax) - sum_csr_duplicates(int n_row, int n_col, int Ap, int Aj, int Ax) - sum_csr_duplicates(int n_row, int n_col, int Ap, int Aj, long long Ax) - sum_csr_duplicates(int n_row, int n_col, int Ap, int Aj, float Ax) - sum_csr_duplicates(int n_row, int n_col, int Ap, int Aj, double Ax) - sum_csr_duplicates(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax) - sum_csr_duplicates(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax) + csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, signed char Ax) + csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, unsigned char Ax) + csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, short Ax) + csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, int Ax) + csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, long long Ax) + csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, float Ax) + csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, double Ax) + csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax) + csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax) """ - return _sparsetools.sum_csr_duplicates(*args) + return _sparsetools.csr_sum_duplicates(*args) -def sum_csc_duplicates(*args): +def csc_sum_duplicates(*args): """ - sum_csc_duplicates(int n_row, int n_col, int Ap, int Ai, signed char Ax) - sum_csc_duplicates(int n_row, int n_col, int Ap, int Ai, unsigned char Ax) - sum_csc_duplicates(int n_row, int n_col, int Ap, int Ai, short Ax) - sum_csc_duplicates(int n_row, int n_col, int Ap, int Ai, int Ax) - sum_csc_duplicates(int n_row, int n_col, int Ap, int Ai, long long Ax) - sum_csc_duplicates(int n_row, int n_col, int Ap, int Ai, float Ax) - sum_csc_duplicates(int n_row, int n_col, int Ap, int Ai, double Ax) - sum_csc_duplicates(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax) - sum_csc_duplicates(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax) + csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, signed char Ax) + csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, unsigned char Ax) + csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, short Ax) + csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, int Ax) + csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, long long Ax) + csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, float Ax) + csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, double Ax) + csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax) + csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax) """ - return _sparsetools.sum_csc_duplicates(*args) + return _sparsetools.csc_sum_duplicates(*args) def get_csr_submatrix(*args): """ Modified: trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx 2007-12-20 09:16:26 UTC (rev 3690) +++ trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx 2007-12-20 19:22:18 UTC (rev 3691) @@ -19069,6 +19069,1724 @@ } +SWIGINTERN PyObject *_wrap_bsr_matvec__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + signed char *arg7 ; + signed char *arg8 ; + signed char *arg9 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *temp9 = NULL ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:bsr_matvec",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_matvec" "', 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 '" "bsr_matvec" "', 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 '" "bsr_matvec" "', 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 '" "bsr_matvec" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_BYTE, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (signed char*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_BYTE, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (signed char*) array8->data; + } + { + temp9 = obj_to_array_no_conversion(obj8,PyArray_BYTE); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (signed char*) array_data(temp9); + } + bsr_matvec(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(signed char const (*))arg7,(signed char const (*))arg8,arg9); + resultobj = SWIG_Py_Void(); + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_matvec__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + unsigned char *arg7 ; + unsigned char *arg8 ; + unsigned char *arg9 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *temp9 = NULL ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:bsr_matvec",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_matvec" "', 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 '" "bsr_matvec" "', 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 '" "bsr_matvec" "', 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 '" "bsr_matvec" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_UBYTE, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (unsigned char*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_UBYTE, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (unsigned char*) array8->data; + } + { + temp9 = obj_to_array_no_conversion(obj8,PyArray_UBYTE); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (unsigned char*) array_data(temp9); + } + bsr_matvec(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(unsigned char const (*))arg7,(unsigned char const (*))arg8,arg9); + resultobj = SWIG_Py_Void(); + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_matvec__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + short *arg7 ; + short *arg8 ; + short *arg9 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *temp9 = NULL ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:bsr_matvec",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_matvec" "', 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 '" "bsr_matvec" "', 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 '" "bsr_matvec" "', 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 '" "bsr_matvec" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_SHORT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (short*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_SHORT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (short*) array8->data; + } + { + temp9 = obj_to_array_no_conversion(obj8,PyArray_SHORT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (short*) array_data(temp9); + } + bsr_matvec(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(short const (*))arg7,(short const (*))arg8,arg9); + resultobj = SWIG_Py_Void(); + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_matvec__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + int *arg7 ; + int *arg8 ; + int *arg9 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *temp9 = NULL ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:bsr_matvec",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_matvec" "', 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 '" "bsr_matvec" "', 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 '" "bsr_matvec" "', 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 '" "bsr_matvec" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_INT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (int*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); + } + bsr_matvec(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,arg9); + resultobj = SWIG_Py_Void(); + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_matvec__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + long long *arg7 ; + long long *arg8 ; + long long *arg9 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *temp9 = NULL ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:bsr_matvec",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_matvec" "', 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 '" "bsr_matvec" "', 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 '" "bsr_matvec" "', 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 '" "bsr_matvec" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_LONGLONG, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (long long*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_LONGLONG, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (long long*) array8->data; + } + { + temp9 = obj_to_array_no_conversion(obj8,PyArray_LONGLONG); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (long long*) array_data(temp9); + } + bsr_matvec(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(long long const (*))arg7,(long long const (*))arg8,arg9); + resultobj = SWIG_Py_Void(); + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_matvec__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + float *arg7 ; + float *arg8 ; + float *arg9 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *temp9 = NULL ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:bsr_matvec",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_matvec" "', 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 '" "bsr_matvec" "', 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 '" "bsr_matvec" "', 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 '" "bsr_matvec" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_FLOAT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (float*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_FLOAT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (float*) array8->data; + } + { + temp9 = obj_to_array_no_conversion(obj8,PyArray_FLOAT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (float*) array_data(temp9); + } + bsr_matvec(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(float const (*))arg7,(float const (*))arg8,arg9); + resultobj = SWIG_Py_Void(); + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_matvec__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + double *arg7 ; + double *arg8 ; + double *arg9 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *temp9 = NULL ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:bsr_matvec",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_matvec" "', 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 '" "bsr_matvec" "', 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 '" "bsr_matvec" "', 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 '" "bsr_matvec" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_DOUBLE, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (double*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_DOUBLE, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (double*) array8->data; + } + { + temp9 = obj_to_array_no_conversion(obj8,PyArray_DOUBLE); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (double*) array_data(temp9); + } + bsr_matvec(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(double const (*))arg7,(double const (*))arg8,arg9); + resultobj = SWIG_Py_Void(); + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_matvec__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + npy_cfloat_wrapper *arg7 ; + npy_cfloat_wrapper *arg8 ; + npy_cfloat_wrapper *arg9 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *temp9 = NULL ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:bsr_matvec",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_matvec" "', 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 '" "bsr_matvec" "', 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 '" "bsr_matvec" "', 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 '" "bsr_matvec" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_CFLOAT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (npy_cfloat_wrapper*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_CFLOAT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (npy_cfloat_wrapper*) array8->data; + } + { + temp9 = obj_to_array_no_conversion(obj8,PyArray_CFLOAT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (npy_cfloat_wrapper*) array_data(temp9); + } + bsr_matvec(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(npy_cfloat_wrapper const (*))arg7,(npy_cfloat_wrapper const (*))arg8,arg9); + resultobj = SWIG_Py_Void(); + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_matvec__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + npy_cdouble_wrapper *arg7 ; + npy_cdouble_wrapper *arg8 ; + npy_cdouble_wrapper *arg9 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *temp9 = NULL ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:bsr_matvec",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_matvec" "', 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 '" "bsr_matvec" "', 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 '" "bsr_matvec" "', 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 '" "bsr_matvec" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_CDOUBLE, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (npy_cdouble_wrapper*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_CDOUBLE, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (npy_cdouble_wrapper*) array8->data; + } + { + temp9 = obj_to_array_no_conversion(obj8,PyArray_CDOUBLE); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (npy_cdouble_wrapper*) array_data(temp9); + } + bsr_matvec(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(npy_cdouble_wrapper const (*))arg7,(npy_cdouble_wrapper const (*))arg8,arg9); + resultobj = SWIG_Py_Void(); + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_matvec(PyObject *self, PyObject *args) { + int argc; + PyObject *argv[10]; + int ii; + + if (!PyTuple_Check(args)) SWIG_fail; + argc = (int)PyObject_Length(args); + for (ii = 0; (ii < argc) && (ii < 9); ii++) { + argv[ii] = PyTuple_GET_ITEM(args,ii); + } + if (argc == 9) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_matvec__SWIG_1(self, args); + } + } + } + } + } + } + } + } + } + } + if (argc == 9) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_matvec__SWIG_2(self, args); + } + } + } + } + } + } + } + } + } + } + if (argc == 9) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_matvec__SWIG_3(self, args); + } + } + } + } + } + } + } + } + } + } + if (argc == 9) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_matvec__SWIG_4(self, args); + } + } + } + } + } + } + } + } + } + } + if (argc == 9) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_matvec__SWIG_5(self, args); + } + } + } + } + } + } + } + } + } + } + if (argc == 9) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_matvec__SWIG_6(self, args); + } + } + } + } + } + } + } + } + } + } + if (argc == 9) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_matvec__SWIG_7(self, args); + } + } + } + } + } + } + } + } + } + } + if (argc == 9) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_matvec__SWIG_8(self, args); + } + } + } + } + } + } + } + } + } + } + if (argc == 9) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_matvec__SWIG_9(self, args); + } + } + } + } + } + } + } + } + } + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_matvec'.\n Possible C/C++ prototypes are:\n"" bsr_matvec<(int,signed char)>(int const,int const,int const,int const,int const [],int const [],signed char const [],signed char const [],signed char [])\n"" bsr_matvec<(int,unsigned char)>(int const,int const,int const,int const,int const [],int const [],unsigned char const [],unsigned char const [],unsigned char [])\n"" bsr_matvec<(int,short)>(int const,int const,int const,int const,int const [],int const [],short const [],short const [],short [])\n"" bsr_matvec<(int,int)>(int const,int const,int const,int const,int const [],int const [],int const [],int const [],int [])\n"" bsr_matvec<(int,long long)>(int const,int const,int const,int const,int const [],int const [],long long const [],long long const [],long long [])\n"" bsr_matvec<(int,float)>(int const,int const,int const,int const,int const [],int const [],float const [],float const [],float [])\n"" bsr_matvec<(int,double)>(int const,int const,int const,int const,int const [],int const [],double const [],double const [],double [])\n"" bsr_matvec<(int,npy_cfloat_wrapper)>(int const,int const,int const,int const,int const [],int const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper const [],npy_cfloat_wrapper [])\n"" bsr_matvec<(int,npy_cdouble_wrapper)>(int const,int const,int const,int const,int const [],int const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper const [],npy_cdouble_wrapper [])\n"); + return NULL; +} + + SWIGINTERN PyObject *_wrap_csr_elmul_csr__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; @@ -37905,7 +39623,7 @@ } -SWIGINTERN PyObject *_wrap_sum_csr_duplicates__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_sum_duplicates__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -37925,15 +39643,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sum_csr_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sum_csr_duplicates" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sum_duplicates" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sum_csr_duplicates" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sum_duplicates" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -37951,7 +39669,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (signed char*) array_data(temp5); } - sum_csr_duplicates(arg1,arg2,arg3,arg4,arg5); + csr_sum_duplicates(arg1,arg2,arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -37959,7 +39677,7 @@ } -SWIGINTERN PyObject *_wrap_sum_csr_duplicates__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_sum_duplicates__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -37979,15 +39697,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sum_csr_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sum_csr_duplicates" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sum_duplicates" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sum_csr_duplicates" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sum_duplicates" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -38005,7 +39723,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (unsigned char*) array_data(temp5); } - sum_csr_duplicates(arg1,arg2,arg3,arg4,arg5); + csr_sum_duplicates(arg1,arg2,arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -38013,7 +39731,7 @@ } -SWIGINTERN PyObject *_wrap_sum_csr_duplicates__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_sum_duplicates__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -38033,15 +39751,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sum_csr_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sum_csr_duplicates" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sum_duplicates" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sum_csr_duplicates" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sum_duplicates" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -38059,7 +39777,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (short*) array_data(temp5); } - sum_csr_duplicates(arg1,arg2,arg3,arg4,arg5); + csr_sum_duplicates(arg1,arg2,arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -38067,7 +39785,7 @@ } -SWIGINTERN PyObject *_wrap_sum_csr_duplicates__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_sum_duplicates__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -38087,15 +39805,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sum_csr_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sum_csr_duplicates" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sum_duplicates" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sum_csr_duplicates" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sum_duplicates" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -38113,7 +39831,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (int*) array_data(temp5); } - sum_csr_duplicates(arg1,arg2,arg3,arg4,arg5); + csr_sum_duplicates(arg1,arg2,arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -38121,7 +39839,7 @@ } -SWIGINTERN PyObject *_wrap_sum_csr_duplicates__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_sum_duplicates__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -38141,15 +39859,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sum_csr_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sum_csr_duplicates" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sum_duplicates" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sum_csr_duplicates" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sum_duplicates" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -38167,7 +39885,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (long long*) array_data(temp5); } - sum_csr_duplicates(arg1,arg2,arg3,arg4,arg5); + csr_sum_duplicates(arg1,arg2,arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -38175,7 +39893,7 @@ } -SWIGINTERN PyObject *_wrap_sum_csr_duplicates__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_sum_duplicates__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -38195,15 +39913,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sum_csr_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sum_csr_duplicates" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sum_duplicates" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sum_csr_duplicates" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sum_duplicates" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -38221,7 +39939,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (float*) array_data(temp5); } - sum_csr_duplicates(arg1,arg2,arg3,arg4,arg5); + csr_sum_duplicates(arg1,arg2,arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -38229,7 +39947,7 @@ } -SWIGINTERN PyObject *_wrap_sum_csr_duplicates__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_sum_duplicates__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -38249,15 +39967,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sum_csr_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sum_csr_duplicates" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sum_duplicates" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sum_csr_duplicates" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sum_duplicates" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -38275,7 +39993,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (double*) array_data(temp5); } - sum_csr_duplicates(arg1,arg2,arg3,arg4,arg5); + csr_sum_duplicates(arg1,arg2,arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -38283,7 +40001,7 @@ } -SWIGINTERN PyObject *_wrap_sum_csr_duplicates__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_sum_duplicates__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -38303,15 +40021,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sum_csr_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sum_csr_duplicates" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sum_duplicates" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sum_csr_duplicates" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sum_duplicates" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -38329,7 +40047,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (npy_cfloat_wrapper*) array_data(temp5); } - sum_csr_duplicates(arg1,arg2,arg3,arg4,arg5); + csr_sum_duplicates(arg1,arg2,arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -38337,7 +40055,7 @@ } -SWIGINTERN PyObject *_wrap_sum_csr_duplicates__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_sum_duplicates__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -38357,15 +40075,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sum_csr_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sum_csr_duplicates" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sum_duplicates" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sum_csr_duplicates" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sum_duplicates" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -38383,7 +40101,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (npy_cdouble_wrapper*) array_data(temp5); } - sum_csr_duplicates(arg1,arg2,arg3,arg4,arg5); + csr_sum_duplicates(arg1,arg2,arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -38391,7 +40109,7 @@ } -SWIGINTERN PyObject *_wrap_sum_csr_duplicates(PyObject *self, PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_sum_duplicates(PyObject *self, PyObject *args) { int argc; PyObject *argv[6]; int ii; @@ -38425,7 +40143,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_sum_csr_duplicates__SWIG_1(self, args); + return _wrap_csr_sum_duplicates__SWIG_1(self, args); } } } @@ -38456,7 +40174,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_sum_csr_duplicates__SWIG_2(self, args); + return _wrap_csr_sum_duplicates__SWIG_2(self, args); } } } @@ -38487,7 +40205,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_sum_csr_duplicates__SWIG_3(self, args); + return _wrap_csr_sum_duplicates__SWIG_3(self, args); } } } @@ -38518,7 +40236,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_sum_csr_duplicates__SWIG_4(self, args); + return _wrap_csr_sum_duplicates__SWIG_4(self, args); } } } @@ -38549,7 +40267,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_sum_csr_duplicates__SWIG_5(self, args); + return _wrap_csr_sum_duplicates__SWIG_5(self, args); } } } @@ -38580,7 +40298,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_sum_csr_duplicates__SWIG_6(self, args); + return _wrap_csr_sum_duplicates__SWIG_6(self, args); } } } @@ -38611,7 +40329,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_sum_csr_duplicates__SWIG_7(self, args); + return _wrap_csr_sum_duplicates__SWIG_7(self, args); } } } @@ -38642,7 +40360,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_sum_csr_duplicates__SWIG_8(self, args); + return _wrap_csr_sum_duplicates__SWIG_8(self, args); } } } @@ -38673,7 +40391,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_sum_csr_duplicates__SWIG_9(self, args); + return _wrap_csr_sum_duplicates__SWIG_9(self, args); } } } @@ -38682,12 +40400,12 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'sum_csr_duplicates'.\n Possible C/C++ prototypes are:\n"" sum_csr_duplicates<(int,signed char)>(int const,int const,int [],int [],signed char [])\n"" sum_csr_duplicates<(int,unsigned char)>(int const,int const,int [],int [],unsigned char [])\n"" sum_csr_duplicates<(int,short)>(int const,int const,int [],int [],short [])\n"" sum_csr_duplicates<(int,int)>(int const,int const,int [],int [],int [])\n"" sum_csr_duplicates<(int,long long)>(int const,int const,int [],int [],long long [])\n"" sum_csr_duplicates<(int,float)>(int const,int const,int [],int [],float [])\n"" sum_csr_duplicates<(int,double)>(int const,int const,int [],int [],double [])\n"" sum_csr_duplicates<(int,npy_cfloat_wrapper)>(int const,int const,int [],int [],npy_cfloat_wrapper [])\n"" sum_csr_duplicates<(int,npy_cdouble_wrapper)>(int const,int const,int [],int [],npy_cdouble_wrapper [])\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_sum_duplicates'.\n Possible C/C++ prototypes are:\n"" csr_sum_duplicates<(int,signed char)>(int const,int const,int [],int [],signed char [])\n"" csr_sum_duplicates<(int,unsigned char)>(int const,int const,int [],int [],unsigned char [])\n"" csr_sum_duplicates<(int,short)>(int const,int const,int [],int [],short [])\n"" csr_sum_duplicates<(int,int)>(int const,int const,int [],int [],int [])\n"" csr_sum_duplicates<(int,long long)>(int const,int const,int [],int [],long long [])\n"" csr_sum_duplicates<(int,float)>(int const,int const,int [],int [],float [])\n"" csr_sum_duplicates<(int,double)>(int const,int const,int [],int [],double [])\n"" csr_sum_duplicates<(int,npy_cfloat_wrapper)>(int const,int const,int [],int [],npy_cfloat_wrapper [])\n"" csr_sum_duplicates<(int,npy_cdouble_wrapper)>(int const,int const,int [],int [],npy_cdouble_wrapper [])\n"); return NULL; } -SWIGINTERN PyObject *_wrap_sum_csc_duplicates__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -38707,15 +40425,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sum_csc_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sum_csc_duplicates" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sum_csc_duplicates" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -38733,7 +40451,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (signed char*) array_data(temp5); } - sum_csc_duplicates(arg1,arg2,arg3,arg4,arg5); + csc_sum_duplicates(arg1,arg2,arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -38741,7 +40459,7 @@ } -SWIGINTERN PyObject *_wrap_sum_csc_duplicates__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -38761,15 +40479,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sum_csc_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sum_csc_duplicates" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sum_csc_duplicates" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -38787,7 +40505,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (unsigned char*) array_data(temp5); } - sum_csc_duplicates(arg1,arg2,arg3,arg4,arg5); + csc_sum_duplicates(arg1,arg2,arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -38795,7 +40513,7 @@ } -SWIGINTERN PyObject *_wrap_sum_csc_duplicates__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -38815,15 +40533,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sum_csc_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sum_csc_duplicates" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sum_csc_duplicates" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -38841,7 +40559,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (short*) array_data(temp5); } - sum_csc_duplicates(arg1,arg2,arg3,arg4,arg5); + csc_sum_duplicates(arg1,arg2,arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -38849,7 +40567,7 @@ } -SWIGINTERN PyObject *_wrap_sum_csc_duplicates__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -38869,15 +40587,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sum_csc_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sum_csc_duplicates" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sum_csc_duplicates" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -38895,7 +40613,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (int*) array_data(temp5); } - sum_csc_duplicates(arg1,arg2,arg3,arg4,arg5); + csc_sum_duplicates(arg1,arg2,arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -38903,7 +40621,7 @@ } -SWIGINTERN PyObject *_wrap_sum_csc_duplicates__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -38923,15 +40641,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sum_csc_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sum_csc_duplicates" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sum_csc_duplicates" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -38949,7 +40667,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (long long*) array_data(temp5); } - sum_csc_duplicates(arg1,arg2,arg3,arg4,arg5); + csc_sum_duplicates(arg1,arg2,arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -38957,7 +40675,7 @@ } -SWIGINTERN PyObject *_wrap_sum_csc_duplicates__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -38977,15 +40695,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sum_csc_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sum_csc_duplicates" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sum_csc_duplicates" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -39003,7 +40721,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (float*) array_data(temp5); } - sum_csc_duplicates(arg1,arg2,arg3,arg4,arg5); + csc_sum_duplicates(arg1,arg2,arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -39011,7 +40729,7 @@ } -SWIGINTERN PyObject *_wrap_sum_csc_duplicates__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -39031,15 +40749,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sum_csc_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sum_csc_duplicates" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sum_csc_duplicates" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -39057,7 +40775,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (double*) array_data(temp5); } - sum_csc_duplicates(arg1,arg2,arg3,arg4,arg5); + csc_sum_duplicates(arg1,arg2,arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -39065,7 +40783,7 @@ } -SWIGINTERN PyObject *_wrap_sum_csc_duplicates__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -39085,15 +40803,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sum_csc_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sum_csc_duplicates" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sum_csc_duplicates" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -39111,7 +40829,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (npy_cfloat_wrapper*) array_data(temp5); } - sum_csc_duplicates(arg1,arg2,arg3,arg4,arg5); + csc_sum_duplicates(arg1,arg2,arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -39119,7 +40837,7 @@ } -SWIGINTERN PyObject *_wrap_sum_csc_duplicates__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int arg2 ; @@ -39139,15 +40857,15 @@ PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sum_csc_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sum_csc_duplicates" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sum_csc_duplicates" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'"); } arg2 = static_cast< int >(val2); { @@ -39165,7 +40883,7 @@ if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; arg5 = (npy_cdouble_wrapper*) array_data(temp5); } - sum_csc_duplicates(arg1,arg2,arg3,arg4,arg5); + csc_sum_duplicates(arg1,arg2,arg3,arg4,arg5); resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -39173,7 +40891,7 @@ } -SWIGINTERN PyObject *_wrap_sum_csc_duplicates(PyObject *self, PyObject *args) { +SWIGINTERN PyObject *_wrap_csc_sum_duplicates(PyObject *self, PyObject *args) { int argc; PyObject *argv[6]; int ii; @@ -39207,7 +40925,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_sum_csc_duplicates__SWIG_1(self, args); + return _wrap_csc_sum_duplicates__SWIG_1(self, args); } } } @@ -39238,7 +40956,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_sum_csc_duplicates__SWIG_2(self, args); + return _wrap_csc_sum_duplicates__SWIG_2(self, args); } } } @@ -39269,7 +40987,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_sum_csc_duplicates__SWIG_3(self, args); + return _wrap_csc_sum_duplicates__SWIG_3(self, args); } } } @@ -39300,7 +41018,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_sum_csc_duplicates__SWIG_4(self, args); + return _wrap_csc_sum_duplicates__SWIG_4(self, args); } } } @@ -39331,7 +41049,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_sum_csc_duplicates__SWIG_5(self, args); + return _wrap_csc_sum_duplicates__SWIG_5(self, args); } } } @@ -39362,7 +41080,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_sum_csc_duplicates__SWIG_6(self, args); + return _wrap_csc_sum_duplicates__SWIG_6(self, args); } } } @@ -39393,7 +41111,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_sum_csc_duplicates__SWIG_7(self, args); + return _wrap_csc_sum_duplicates__SWIG_7(self, args); } } } @@ -39424,7 +41142,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_sum_csc_duplicates__SWIG_8(self, args); + return _wrap_csc_sum_duplicates__SWIG_8(self, args); } } } @@ -39455,7 +41173,7 @@ _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_sum_csc_duplicates__SWIG_9(self, args); + return _wrap_csc_sum_duplicates__SWIG_9(self, args); } } } @@ -39464,7 +41182,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'sum_csc_duplicates'.\n Possible C/C++ prototypes are:\n"" sum_csc_duplicates<(int,signed char)>(int const,int const,int [],int [],signed char [])\n"" sum_csc_duplicates<(int,unsigned char)>(int const,int const,int [],int [],unsigned char [])\n"" sum_csc_duplicates<(int,short)>(int const,int const,int [],int [],short [])\n"" sum_csc_duplicates<(int,int)>(int const,int const,int [],int [],int [])\n"" sum_csc_duplicates<(int,long long)>(int const,int const,int [],int [],long long [])\n"" sum_csc_duplicates<(int,float)>(int const,int const,int [],int [],float [])\n"" sum_csc_duplicates<(int,double)>(int const,int const,int [],int [],double [])\n"" sum_csc_duplicates<(int,npy_cfloat_wrapper)>(int const,int const,int [],int [],npy_cfloat_wrapper [])\n"" sum_csc_duplicates<(int,npy_cdouble_wrapper)>(int const,int const,int [],int [],npy_cdouble_wrapper [])\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_sum_duplicates'.\n Possible C/C++ prototypes are:\n"" csc_sum_duplicates<(int,signed char)>(int const,int const,int [],int [],signed char [])\n"" csc_sum_duplicates<(int,unsigned char)>(int const,int const,int [],int [],unsigned char [])\n"" csc_sum_duplicates<(int,short)>(int const,int const,int [],int [],short [])\n"" csc_sum_duplicates<(int,int)>(int const,int const,int [],int [],int [])\n"" csc_sum_duplicates<(int,long long)>(int const,int const,int [],int [],long long [])\n"" csc_sum_duplicates<(int,float)>(int const,int const,int [],int [],float [])\n"" csc_sum_duplicates<(int,double)>(int const,int const,int [],int [],double [])\n"" csc_sum_duplicates<(int,npy_cfloat_wrapper)>(int const,int const,int [],int [],npy_cfloat_wrapper [])\n"" csc_sum_duplicates<(int,npy_cdouble_wrapper)>(int const,int const,int [],int [],npy_cdouble_wrapper [])\n"); return NULL; } @@ -41678,6 +43396,28 @@ "csc_matvec(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, \n" " npy_cdouble_wrapper Xx, npy_cdouble_wrapper Yx)\n" ""}, + { (char *)"bsr_matvec", _wrap_bsr_matvec, METH_VARARGS, (char *)"\n" + "bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " signed char Ax, signed char Xx, signed char Yx)\n" + "bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " unsigned char Ax, unsigned char Xx, unsigned char Yx)\n" + "bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " short Ax, short Xx, short Yx)\n" + "bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " int Ax, int Xx, int Yx)\n" + "bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " long long Ax, long long Xx, long long Yx)\n" + "bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " float Ax, float Xx, float Yx)\n" + "bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " double Ax, double Xx, double Yx)\n" + "bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " npy_cfloat_wrapper Ax, npy_cfloat_wrapper Xx, \n" + " npy_cfloat_wrapper Yx)\n" + "bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " npy_cdouble_wrapper Ax, npy_cdouble_wrapper Xx, \n" + " npy_cdouble_wrapper Yx)\n" + ""}, { (char *)"csr_elmul_csr", _wrap_csr_elmul_csr, METH_VARARGS, (char *)"\n" "csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n" " int Bp, int Bj, signed char Bx, std::vector<(int)> Cp, \n" @@ -41948,27 +43688,27 @@ "csc_sort_indices(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax)\n" "csc_sort_indices(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax)\n" ""}, - { (char *)"sum_csr_duplicates", _wrap_sum_csr_duplicates, METH_VARARGS, (char *)"\n" - "sum_csr_duplicates(int n_row, int n_col, int Ap, int Aj, signed char Ax)\n" - "sum_csr_duplicates(int n_row, int n_col, int Ap, int Aj, unsigned char Ax)\n" - "sum_csr_duplicates(int n_row, int n_col, int Ap, int Aj, short Ax)\n" - "sum_csr_duplicates(int n_row, int n_col, int Ap, int Aj, int Ax)\n" - "sum_csr_duplicates(int n_row, int n_col, int Ap, int Aj, long long Ax)\n" - "sum_csr_duplicates(int n_row, int n_col, int Ap, int Aj, float Ax)\n" - "sum_csr_duplicates(int n_row, int n_col, int Ap, int Aj, double Ax)\n" - "sum_csr_duplicates(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax)\n" - "sum_csr_duplicates(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax)\n" + { (char *)"csr_sum_duplicates", _wrap_csr_sum_duplicates, METH_VARARGS, (char *)"\n" + "csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, signed char Ax)\n" + "csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, unsigned char Ax)\n" + "csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, short Ax)\n" + "csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, int Ax)\n" + "csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, long long Ax)\n" + "csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, float Ax)\n" + "csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, double Ax)\n" + "csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax)\n" + "csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax)\n" ""}, - { (char *)"sum_csc_duplicates", _wrap_sum_csc_duplicates, METH_VARARGS, (char *)"\n" - "sum_csc_duplicates(int n_row, int n_col, int Ap, int Ai, signed char Ax)\n" - "sum_csc_duplicates(int n_row, int n_col, int Ap, int Ai, unsigned char Ax)\n" - "sum_csc_duplicates(int n_row, int n_col, int Ap, int Ai, short Ax)\n" - "sum_csc_duplicates(int n_row, int n_col, int Ap, int Ai, int Ax)\n" - "sum_csc_duplicates(int n_row, int n_col, int Ap, int Ai, long long Ax)\n" - "sum_csc_duplicates(int n_row, int n_col, int Ap, int Ai, float Ax)\n" - "sum_csc_duplicates(int n_row, int n_col, int Ap, int Ai, double Ax)\n" - "sum_csc_duplicates(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax)\n" - "sum_csc_duplicates(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax)\n" + { (char *)"csc_sum_duplicates", _wrap_csc_sum_duplicates, METH_VARARGS, (char *)"\n" + "csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, signed char Ax)\n" + "csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, unsigned char Ax)\n" + "csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, short Ax)\n" + "csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, int Ax)\n" + "csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, long long Ax)\n" + "csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, float Ax)\n" + "csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, double Ax)\n" + "csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax)\n" + "csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax)\n" ""}, { (char *)"get_csr_submatrix", _wrap_get_csr_submatrix, METH_VARARGS, (char *)"\n" "get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n" Modified: trunk/scipy/sparse/tests/test_base.py =================================================================== --- trunk/scipy/sparse/tests/test_base.py 2007-12-20 09:16:26 UTC (rev 3690) +++ trunk/scipy/sparse/tests/test_base.py 2007-12-20 19:22:18 UTC (rev 3691) @@ -15,7 +15,7 @@ import numpy from numpy import arange, zeros, array, dot, ones, matrix, asmatrix, \ - asarray, vstack, ndarray + asarray, vstack, ndarray, kron import random from numpy.testing import * @@ -30,13 +30,18 @@ #TODO test spmatrix( [[1,2],[3,4]] ) format #TODO check that invalid shape in constructor raises exception #TODO check that spmatrix( ... , copy=X ) is respected +#TODO test repr(spmatrix) class _TestCommon: """test common functionality shared by all sparse formats""" def setUp(self): self.dat = matrix([[1,0,0,2],[3,0,1,0],[0,2,0,0]],'d') self.datsp = self.spmatrix(self.dat) - + + def check_repr(self): + """make sure __repr__ works""" + repr(self.spmatrix) + def check_empty(self): """Test manipulating empty matrices. Fails in SciPy SVN <= r1768 """ @@ -295,32 +300,37 @@ assert_equal( result.shape, (4,2) ) assert_equal( result, dot(a,b) ) - def check_todia(self): - a = self.datsp.todia() - assert_array_almost_equal(a.todense(), self.dat) + def check_conversions(self): - def check_tocoo(self): - a = self.datsp.tocoo() - assert_array_almost_equal(a.todense(), self.dat) + #TODO add bsr/bsc + #for format in ['bsc','bsr','coo','csc','csr','dia','dok','lil']: + for format in ['coo','csc','csr','dia','dok','lil']: + a = self.datsp.asformat(format) + assert_equal(a.format,format) + assert_array_almost_equal(a.todense(), self.dat) + + b = self.spmatrix(self.dat+3j).asformat(format) + assert_equal(b.format,format) + assert_array_almost_equal(b.todense(), self.dat+3j) - def check_tolil(self): - a = self.datsp.tolil() - assert_array_almost_equal(a.todense(), self.dat) - - def check_todok(self): - a = self.datsp.todok() - assert_array_almost_equal(a.todense(), self.dat) + + def check_todia(self): + #TODO, add and test .todia(maxdiags) + pass - def check_tocsc(self): - a = self.datsp.tocsc() - assert_array_almost_equal(a.todense(), self.dat) - b = complexsp = self.spmatrix(self.dat+3j) - c = b.tocsc() - assert_array_almost_equal(c.todense(), self.dat+3j) +# def check_tocompressedblock(self): +# #TODO more extensively test .tobsc() and .tobsr() w/ blocksizes +# x = array([[1,0,2,0],[0,0,0,0],[0,0,4,5]]) +# y = array([[0,1,2],[3,0,5]]) +# A = kron(x,y) +# Asp = self.spmatrix(A) +# for format in ['bsc','bsr']: +# fn = getattr(Asp, 'to' + format ) +# +# for X in [ 1, 2, 3, 6 ]: +# for Y in [ 1, 2, 3, 4, 6, 12]: +# assert_equal( fn(blocksize=(X,Y)).todense(), A) - def check_tocsr(self): - a = self.datsp.tocsr() - assert_array_almost_equal(a.todense(), self.dat) def check_transpose(self): a = self.datsp.transpose() @@ -591,6 +601,8 @@ caught += 1 assert caught == 2 + + class _TestBothSlicing: """Tests vertical and horizontal slicing (e.g. [:,0:2]). Tests for individual sparse matrix types that implement this should derive from this @@ -1210,6 +1222,39 @@ pass #TODO add test +#class TestBSR(_TestCommon, _TestArithmetic, NumpyTestCase): +# spmatrix = bsr_matrix +# +# def check_constructor1(self): +# indptr = array([0,2,2,4]) +# indices = array([0,2,2,3]) +# data = zeros((4,2,3)) +# +# data[0] = array([[ 0, 1, 2], +# [ 3, 0, 5]]) +# data[1] = array([[ 0, 2, 4], +# [ 6, 0, 10]]) +# data[2] = array([[ 0, 4, 8], +# [12, 0, 20]]) +# data[3] = array([[ 0, 5, 10], +# [15, 0, 25]]) +# +# A = kron( [[1,0,2,0],[0,0,0,0],[0,0,4,5]], [[0,1,2],[3,0,5]] ) +# +# Asp = bsr_matrix((data,indices,indptr),shape=(6,12)) +# +# assert_equal(Asp.todense(),A) +# #TODO add infer from shape example +# +# +# +# +#class TestBSC(_TestCommon, _TestArithmetic, NumpyTestCase): +# spmatrix = bsc_matrix +# +# def check_constructor1(self): +# pass +# #TODO add test if __name__ == "__main__": NumpyTest().run() From scipy-svn at scipy.org Thu Dec 20 16:16:29 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 20 Dec 2007 15:16:29 -0600 (CST) Subject: [Scipy-svn] r3692 - trunk/scipy/sparse/tests Message-ID: <20071220211629.700F239C101@new.scipy.org> Author: wnbell Date: 2007-12-20 15:16:22 -0600 (Thu, 20 Dec 2007) New Revision: 3692 Modified: trunk/scipy/sparse/tests/test_sparse.py Log: added small sparse arithmetic benchmark Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-20 19:22:18 UTC (rev 3691) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-20 21:16:22 UTC (rev 3692) @@ -38,6 +38,59 @@ class TestSparseTools(NumpyTestCase): """Simple benchmarks for sparse matrix module""" + def test_arithmetic(self,level=5): + matrices = [] + matrices.append( ('A','Identity', spidentity(500**2,format='csr')) ) + matrices.append( ('B','Poisson5pt', poisson2d(500,format='csr')) ) + + #matrices = [ (a,b,c.astype('int8')) for (a,b,c) in matrices ] + print + print ' Sparse Matrix Arithmetic' + print '===================================================================' + print ' var | name | shape | dtype | nnz ' + print '-------------------------------------------------------------------' + fmt = ' %1s | %14s | %20s | %9s | %8d ' + + for var,name,mat in matrices: + name = name.center(14) + shape = ("%s" % (mat.shape,)).center(20) + dtype = mat.dtype.name.center(9) + print fmt % (var,name,shape,dtype,mat.nnz) + + space = ' ' * 10 + print + print space+' Timings' + print space+'==========================================' + print space+' format | operation | time (msec) ' + print space+'------------------------------------------' + fmt = space+' %3s | %17s | %7.1f ' + + for format in ['csr']: + vars = dict( [(var,mat.asformat(format)) for (var,name,mat) in matrices ] ) + for X,Y in [ ('A','A'),('A','B'),('B','A'),('B','B') ]: + x,y = vars[X],vars[Y] + for op in ['__add__','__sub__','multiply','__div__','__mul__']: + fn = getattr(x,op) + fn(y) #warmup + + start = time.clock() + iter = 0 + while iter < 5 or time.clock() < start + 1: + fn(y) + iter += 1 + end = time.clock() + + msec_per_it = 1000*(end - start)/float(iter) + operation = (X + '.' + op + '(' + Y + ')').center(17) + print fmt % (format,operation,msec_per_it) + + +# name = name.center(12) +# shape = ("%s" % (A.shape,)).center(20) +# MFLOPs = (2*A.nnz*iter/(end-start))/float(1e6) +# +# print fmt % (A.format,name,shape,A.nnz,MFLOPs) + def test_matvec(self,level=5): matrices = [] matrices.append(('Identity', spidentity(10**5,format='csr'))) From scipy-svn at scipy.org Thu Dec 20 16:42:01 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 20 Dec 2007 15:42:01 -0600 (CST) Subject: [Scipy-svn] r3693 - trunk/scipy/sparse/tests Message-ID: <20071220214201.79B7D39C071@new.scipy.org> Author: wnbell Date: 2007-12-20 15:41:58 -0600 (Thu, 20 Dec 2007) New Revision: 3693 Modified: trunk/scipy/sparse/tests/test_sparse.py Log: small edit Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-20 21:16:22 UTC (rev 3692) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-20 21:41:58 UTC (rev 3693) @@ -38,17 +38,18 @@ class TestSparseTools(NumpyTestCase): """Simple benchmarks for sparse matrix module""" - def test_arithmetic(self,level=5): + def test_arithmetic(self,level=4): matrices = [] matrices.append( ('A','Identity', spidentity(500**2,format='csr')) ) matrices.append( ('B','Poisson5pt', poisson2d(500,format='csr')) ) #matrices = [ (a,b,c.astype('int8')) for (a,b,c) in matrices ] + print print ' Sparse Matrix Arithmetic' - print '===================================================================' - print ' var | name | shape | dtype | nnz ' - print '-------------------------------------------------------------------' + print '====================================================================' + print ' var | name | shape | dtype | nnz ' + print '--------------------------------------------------------------------' fmt = ' %1s | %14s | %20s | %9s | %8d ' for var,name,mat in matrices: @@ -85,12 +86,6 @@ print fmt % (format,operation,msec_per_it) -# name = name.center(12) -# shape = ("%s" % (A.shape,)).center(20) -# MFLOPs = (2*A.nnz*iter/(end-start))/float(1e6) -# -# print fmt % (A.format,name,shape,A.nnz,MFLOPs) - def test_matvec(self,level=5): matrices = [] matrices.append(('Identity', spidentity(10**5,format='csr'))) From scipy-svn at scipy.org Thu Dec 20 16:42:33 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 20 Dec 2007 15:42:33 -0600 (CST) Subject: [Scipy-svn] r3694 - trunk/scipy/sparse Message-ID: <20071220214233.CFD6C39C3A5@new.scipy.org> Author: wnbell Date: 2007-12-20 15:42:31 -0600 (Thu, 20 Dec 2007) New Revision: 3694 Added: trunk/scipy/sparse/block.py trunk/scipy/sparse/bsr.py Log: add bsr_matrix format Added: trunk/scipy/sparse/block.py =================================================================== --- trunk/scipy/sparse/block.py 2007-12-20 21:41:58 UTC (rev 3693) +++ trunk/scipy/sparse/block.py 2007-12-20 21:42:31 UTC (rev 3694) @@ -0,0 +1,263 @@ +"""base class for block sparse formats""" + +from numpy import zeros, intc, array, asarray, arange, diff, tile, rank, \ + prod + +from data import _data_matrix +from base import isspmatrix, _formats +from sputils import isshape, getdtype, to_native + +class _block_matrix(_data_matrix): + def __init__(self, arg1, shape=None, dtype=None, copy=False, blocksize=None): + _data_matrix.__init__(self) + + #process blocksize + if blocksize is None: + blocksize = (1,1) + else: + if not isshape(blocksize): + raise ValueError,'invalid blocksize=%s',blocksize + blocksize = tuple(blocksize) + + if isspmatrix(arg1): + if arg1.format == self.format and copy: + arg1 = arg1.copy() + else: + arg1 = getattr(arg1,'to' + self.format)(blocksize=blocksize) + self._set_self( arg1 ) + + elif isinstance(arg1,tuple): + if isshape(arg1): + #it's a tuple of matrix dimensions (M,N) + self.shape = arg1 + M,N = self.shape + self.data = zeros( (0,) + blocksize, getdtype(dtype, default=float) ) + self.indices = zeros( 0, dtype=intc ) + + X,Y = blocksize + if (M % X) != 0 or (N % Y) != 0: + raise ValueError, 'shape must be multiple of blocksize' + + self.indptr = zeros(self._swap((M/X,N/Y))[0] + 1, dtype=intc ) + + elif len(arg1) == 3: + # data,indices,indptr format + (data, indices, indptr) = arg1 + self.indices = array(indices, copy=copy) + self.indptr = array(indptr, copy=copy) + self.data = array(data, copy=copy, \ + dtype=getdtype(dtype, data)) + else: + raise ValueError, "unrecognized form for" \ + " %s_matrix constructor" % self.format + else: + #must be dense + try: + arg1 = asarray(arg1) + except: + raise ValueError, "unrecognized form for" \ + " %s_matrix constructor" % self.format + from coo import coo_matrix + arg1 = self.__class__( coo_matrix(arg1), blocksize=blocksize ) + self._set_self( arg1 ) + + if self.shape is None: + if shape is None: + #infer shape here + raise ValueError,'need to infer shape' + else: + self.shape = shape + + self.check_format() + + def check_format(self, full_check=True): + """check whether the matrix format is valid + + *Parameters*: + full_check: + True - rigorous check, O(N) operations : default + False - basic check, O(1) operations + + """ + + #use _swap to determine proper bounds + major_name,minor_name = self._swap(('row','column')) + major_dim,minor_dim = self._swap(self.shape) + major_blk,minor_blk = self._swap(self.blocksize) + + # index arrays should have integer data types + if self.indptr.dtype.kind != 'i': + warn("indptr array has non-integer dtype (%s)" \ + % self.indptr.dtype.name ) + if self.indices.dtype.kind != 'i': + warn("indices array has non-integer dtype (%s)" \ + % self.indices.dtype.name ) + + # only support 32-bit ints for now + self.indptr = self.indptr.astype(intc) + self.indices = self.indices.astype(intc) + self.data = to_native(self.data) + + # check array shapes + if (rank(self.indices) != 1) or (rank(self.indptr) != 1): + raise ValueError,"indices, and indptr should be rank 1" + if rank(self.data) != 3: + raise ValueError,"data should be rank 3" + + # check index pointer + if (len(self.indptr) != major_dim/major_blk + 1 ): + raise ValueError, \ + "index pointer size (%d) should be (%d)" % \ + (len(self.indptr), major_dim/major_blk + 1) + if (self.indptr[0] != 0): + raise ValueError,"index pointer should start with 0" + + # check index and data arrays + if (len(self.indices) != len(self.data)): + raise ValueError,"indices and data should have the same size" + if (self.indptr[-1] > len(self.indices)): + raise ValueError, \ + "Last value of index pointer should be less than "\ + "the size of index and data arrays" + + self.prune() + + if full_check: + #check format validity (more expensive) + if self.nnz > 0: + if self.indices.max() >= minor_dim/minor_blk: + raise ValueError, "%s index values must be < %d" % \ + (minor_name,minor_dim) + if self.indices.min() < 0: + raise ValueError, "%s index values must be >= 0" % \ + minor_name + if diff(self.indptr).min() < 0: + raise ValueError,'index pointer values must form a " \ + "non-decreasing sequence' + + + def _get_blocksize(self): + return self.data.shape[1:] + blocksize = property(fget=_get_blocksize) + + def getnnz(self): + X,Y = self.blocksize + return self.indptr[-1] * X * Y + nnz = property(fget=getnnz) + + def __repr__(self): + nnz = self.getnnz() + format = self.getformat() + return "<%dx%d sparse matrix of type '%s'\n" \ + "\twith %d stored elements (blocksize = %dx%d) in %s format>" % \ + ( self.shape + (self.dtype.type, nnz) + self.blocksize + \ + (_formats[format][1],) ) + + def _set_self(self, other, copy=False): + """take the member variables of other and assign them to self""" + + if copy: + other = other.copy() + + self.data = other.data + self.indices = other.indices + self.indptr = other.indptr + self.shape = other.shape + + + #conversion methods + def toarray(self): + A = self.tocoo(copy=False) + M = zeros(self.shape, dtype=self.dtype) + M[A.row, A.col] = A.data + return M + + def todia(self): + return self.tocoo(copy=False).todia() + + def todok(self): + return self.tocoo(copy=False).todok() + + def tocsr(self): + return self.tocoo(copy=False).tocsr() + #TODO make this more efficient + + def tocsc(self): + return self.tocoo(copy=False).tocsc() + #TODO make this more efficient + + + + + # methods that modify the internal data structure + def sorted_indices(self): + """Return a copy of this matrix with sorted indices + """ + A = self.copy() + A.sort_indices() + return A + + # an alternative that has linear complexity is the following + # typically the previous option is faster + #return self.toother().toother() + + def sort_indices(self): + """Sort the indices of this matrix *in place* + """ + X,Y = self.blocksize + M,N = self.shape + + #use CSR.sort_indices to determine a permutation for BSR<->BSC + major,minor = self._swap((M/X,N/Y)) + + data = arange(len(self.indices), dtype=self.indices.dtype) + proxy = csr_matrix((data,self.indices,self.indptr),shape=(major,minor)) + proxy.sort_indices() + + self.data[:] = self.data[proxy.data] + self.indices = proxy.indices + + def prune(self): + """ Remove empty space after all non-zero elements. + """ + major_dim = self._swap(self.shape)[0] + major_blk = self._swap(self.blocksize)[0] + + if len(self.indptr) != major_dim/major_blk + 1: + raise ValueError, "index pointer has invalid length" + if len(self.indices) < self.nnz / prod(self.blocksize): + raise ValueError, "indices has too few elements" + if self.data.size < self.nnz: + raise ValueError, "data array has too few elements" + + self.data = self.data[:self.nnz] + self.indices = self.indices[:self.nnz] + + + # needed by _data_matrix + def _with_data(self,data,copy=True): + """Returns a matrix with the same sparsity structure as self, + but with different data. By default the structure arrays + (i.e. .indptr and .indices) are copied. + """ + if copy: + return self.__class__((data,self.indices.copy(),self.indptr.copy()), \ + shape=self.shape,dtype=data.dtype) + else: + return self.__class__((data,self.indices,self.indptr), \ + shape=self.shape,dtype=data.dtype) + + + + + + + +# test with: +# A = arange(4*6).reshape(4,6) % 5 +# A[0:2,2:4] = 0 +# A[0:2,:] = 0 + + + + Added: trunk/scipy/sparse/bsr.py =================================================================== --- trunk/scipy/sparse/bsr.py 2007-12-20 21:41:58 UTC (rev 3693) +++ trunk/scipy/sparse/bsr.py 2007-12-20 21:42:31 UTC (rev 3694) @@ -0,0 +1,165 @@ +"""Compressed Block Sparse Row matrix format +""" + +__all__ = ['bsr_matrix', 'isspmatrix_bsr'] + +from numpy import zeros, intc, array, asarray, arange, diff, tile, rank, \ + prod, ravel, empty, matrix, asmatrix + +from sparsetools import bsr_matvec +from block import _block_matrix +from base import isspmatrix +from sputils import isdense, upcast, isscalarlike + +class bsr_matrix(_block_matrix): + #TODO add docstring + + def __mul__(self, other): # self * other + """ Scalar, vector, or matrix multiplication + """ + if isscalarlike(other): + return self._with_data(self.data * other) + else: + return self.dot(other) + + def matvec(self, other, output=None): + """Sparse matrix vector product (self * other) + + 'other' may be a rank 1 array of length N or a rank 2 array + or matrix with shape (N,1). + + If the optional 'output' parameter is defined, it will + be used to store the result. Otherwise, a new vector + will be allocated. + + """ + if isdense(other): + M,N = self.shape + X,Y = self.blocksize + + if other.shape != (N,) and other.shape != (N,1): + raise ValueError, "dimension mismatch" + + + #output array + if output is None: + y = empty( self.shape[0], dtype=upcast(self.dtype,other.dtype) ) + else: + if output.shape != (M,) and output.shape != (M,1): + raise ValueError, "output array has improper dimensions" + if not output.flags.c_contiguous: + raise ValueError, "output array must be contiguous" + if output.dtype != upcast(self.dtype,other.dtype): + raise ValueError, "output array has dtype=%s "\ + "dtype=%s is required" % \ + (output.dtype,upcast(self.dtype,other.dtype)) + y = output + + + bsr_matvec(M/X, N/Y, X, Y, \ + self.indptr, self.indices, ravel(self.data), ravel(other), y) + + if isinstance(other, matrix): + y = asmatrix(y) + + if other.ndim == 2 and other.shape[1] == 1: + # If 'other' was an (nx1) column vector, reshape the result + y = y.reshape(-1,1) + + return y + + elif isspmatrix(other): + raise TypeError, "use matmat() for sparse * sparse" + + else: + raise TypeError, "need a dense vector" + + + + + + + + def transpose(self,copy=False): + M,N = self.shape + + data = self.data.swapaxes(1,2) + indices = self.indices + indptr = self.indptr + + from bsc import bsc_matrix + return bsc_matrix( (data,indices,indptr), shape=(N,M), copy=copy) + + def tocoo(self,copy=True): + """Convert this matrix to COOrdinate format. + + When copy=False the data array will be shared between + this matrix and the resultant coo_matrix. + """ + + M,N = self.shape + X,Y = self.blocksize + + row = (X * arange(M/X)).repeat(diff(self.indptr)) + row = row.repeat(X*Y).reshape(-1,X,Y) + row += tile( arange(X).reshape(-1,1), (1,Y) ) + row = row.reshape(-1) + + col = (Y * self.indices).repeat(X*Y).reshape(-1,X,Y) + col += tile( arange(Y), (X,1) ) + col = col.reshape(-1) + + data = self.data.reshape(-1) + + if copy: + data = data.copy() + + from coo import coo_matrix + return coo_matrix( (data,(row,col)), shape=self.shape ) + + + def tobsc(self,blocksize=None): + if blocksize is None: + blocksize = self.blocksize + elif blocksize != self.blocksize: + return self.tocoo(copy=False).tobsc(blocksize=blocksize) + + #maintian blocksize + X,Y = self.blocksize + M,N = self.shape + + #use CSR->CSC to determine a permutation for BSR<->BSC + from csr import csr_matrix + data = arange(len(self.indices), dtype=self.indices.dtype) + proxy = csr_matrix((data,self.indices,self.indptr),shape=(M/X,N/Y)) + proxy = proxy.tocsc() + + data = self.data[proxy.data] #permute data + indices = proxy.indices + indptr = proxy.indptr + + from bsc import bsc_matrix + return bsc_matrix( (data,indices,indptr), shape=self.shape ) + + def tobsr(self,blocksize=None,copy=False): + + if blocksize not in [None, self.blocksize]: + return self.tocoo(copy=False).tobsr(blocksize=blocksize) + if copy: + return self.copy() + else: + return self + + # these functions are used by the parent class + # to remove redudancy between bsc_matrix and bsr_matrix + def _swap(self,x): + """swap the members of x if this is a column-oriented matrix + """ + return (x[0],x[1]) + + +from sputils import _isinstance + +def isspmatrix_bsr(x): + return _isinstance(x, bsr_matrix) + From scipy-svn at scipy.org Thu Dec 20 21:04:29 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 20 Dec 2007 20:04:29 -0600 (CST) Subject: [Scipy-svn] r3695 - in trunk/scipy/sparse: . sparsetools tests Message-ID: <20071221020429.21F4339C0A3@new.scipy.org> Author: wnbell Date: 2007-12-20 20:04:21 -0600 (Thu, 20 Dec 2007) New Revision: 3695 Modified: trunk/scipy/sparse/__init__.py trunk/scipy/sparse/base.py trunk/scipy/sparse/block.py trunk/scipy/sparse/bsr.py trunk/scipy/sparse/coo.py trunk/scipy/sparse/csc.py trunk/scipy/sparse/csr.py trunk/scipy/sparse/sparsetools/fixed_size.h trunk/scipy/sparse/sparsetools/sparsetools.h trunk/scipy/sparse/sparsetools/sparsetools.py trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx trunk/scipy/sparse/tests/test_base.py Log: enabled bsr_matrix improved bsr_matrix.matvec() Modified: trunk/scipy/sparse/__init__.py =================================================================== --- trunk/scipy/sparse/__init__.py 2007-12-20 21:42:31 UTC (rev 3694) +++ trunk/scipy/sparse/__init__.py 2007-12-21 02:04:21 UTC (rev 3695) @@ -9,8 +9,7 @@ from dok import * from coo import * from dia import * -#from bsr import * -#from bsc import * +from bsr import * from construct import * from spfuncs import * Modified: trunk/scipy/sparse/base.py =================================================================== --- trunk/scipy/sparse/base.py 2007-12-20 21:42:31 UTC (rev 3694) +++ trunk/scipy/sparse/base.py 2007-12-21 02:04:21 UTC (rev 3695) @@ -407,12 +407,9 @@ def todia(self): return self.tocoo().todia() -# def tobsr(self,blocksize=None): -# return self.tocoo().tobsr(blocksize=blocksize) -# -# def tobsc(self,blocksize=None): -# return self.tocoo().tobsc(blocksize=blocksize) - + def tobsr(self,blocksize=None): + return self.tocsr().tobsr(blocksize=blocksize) + def copy(self): return self.__class__(self,copy=True) Modified: trunk/scipy/sparse/block.py =================================================================== --- trunk/scipy/sparse/block.py 2007-12-20 21:42:31 UTC (rev 3694) +++ trunk/scipy/sparse/block.py 2007-12-21 02:04:21 UTC (rev 3695) @@ -61,6 +61,21 @@ arg1 = self.__class__( coo_matrix(arg1), blocksize=blocksize ) self._set_self( arg1 ) + if shape is not None: + self.shape = shape # spmatrix will check for errors + else: + if self.shape is None: + # shape not already set, try to infer dimensions + try: + major_dim = len(self.indptr) - 1 + minor_dim = self.indices.max() + 1 + except: + raise ValueError,'unable to infer matrix dimensions' + else: + M,N = self._swap((major_dim,minor_dim)) + R,C = self.blocksize + self.shape = (M*R,N*C) + if self.shape is None: if shape is None: #infer shape here @@ -141,8 +156,8 @@ blocksize = property(fget=_get_blocksize) def getnnz(self): - X,Y = self.blocksize - return self.indptr[-1] * X * Y + R,C = self.blocksize + return self.indptr[-1] * R * C nnz = property(fget=getnnz) def __repr__(self): Modified: trunk/scipy/sparse/bsr.py =================================================================== --- trunk/scipy/sparse/bsr.py 2007-12-20 21:42:31 UTC (rev 3694) +++ trunk/scipy/sparse/bsr.py 2007-12-21 02:04:21 UTC (rev 3695) @@ -39,7 +39,6 @@ if other.shape != (N,) and other.shape != (N,1): raise ValueError, "dimension mismatch" - #output array if output is None: @@ -76,19 +75,15 @@ - - - - - def transpose(self,copy=False): - M,N = self.shape - - data = self.data.swapaxes(1,2) - indices = self.indices - indptr = self.indptr - - from bsc import bsc_matrix - return bsc_matrix( (data,indices,indptr), shape=(N,M), copy=copy) +# def transpose(self,copy=False): +# M,N = self.shape +# +# data = self.data.swapaxes(1,2) +# indices = self.indices +# indptr = self.indptr +# +# from bsc import bsc_matrix +# return bsc_matrix( (data,indices,indptr), shape=(N,M), copy=copy) def tocoo(self,copy=True): """Convert this matrix to COOrdinate format. @@ -118,17 +113,11 @@ return coo_matrix( (data,(row,col)), shape=self.shape ) - def tobsc(self,blocksize=None): - if blocksize is None: - blocksize = self.blocksize - elif blocksize != self.blocksize: - return self.tocoo(copy=False).tobsc(blocksize=blocksize) - - #maintian blocksize + def transpose(self): X,Y = self.blocksize M,N = self.shape - #use CSR->CSC to determine a permutation for BSR<->BSC + #use CSR.T to determine a permutation for BSR.T from csr import csr_matrix data = arange(len(self.indices), dtype=self.indices.dtype) proxy = csr_matrix((data,self.indices,self.indptr),shape=(M/X,N/Y)) @@ -138,8 +127,7 @@ indices = proxy.indices indptr = proxy.indptr - from bsc import bsc_matrix - return bsc_matrix( (data,indices,indptr), shape=self.shape ) + return bsr_matrix( (data,indices,indptr), shape=(N,M) ) def tobsr(self,blocksize=None,copy=False): Modified: trunk/scipy/sparse/coo.py =================================================================== --- trunk/scipy/sparse/coo.py 2007-12-20 21:42:31 UTC (rev 3694) +++ trunk/scipy/sparse/coo.py 2007-12-21 02:04:21 UTC (rev 3695) @@ -293,58 +293,61 @@ return dok - # def tobsc(self,blocksize=None): # if blocksize in [None, (1,1)]: # return self.tocsc().tobsc(blocksize) # else: # return self.transpose().tobsr().transpose() -# -# def tobsr(self,blocksize=None): -# if blocksize in [None, (1,1)]: -# return self.tocsr().tobsr(blocksize) -# -# M,N = self.shape -# X,Y = blocksize -# -# if (M % X) != 0 or (N % Y) != 0: -# raise ValueError, 'shape must be multiple of blocksize' -# -# i_block,i_sub = divmod(self.row, X) -# j_block,j_sub = divmod(self.col, Y) -# -# perm = lexsort( keys=[j_block,i_block] ) -# -# i_block = i_block[perm] -# j_block = j_block[perm] -# -# mask = (i_block[1:] != i_block[:-1]) + (j_block[1:] != j_block[:-1]) -# mask = concatenate((array([True]),mask)) -# -# #map self.data[n] -> data[map[n],i_sub[n],j_sub[n]] -# map = cumsum(mask) -# num_blocks = map[-1] -# map -= 1 -# -# iperm = empty_like(perm) #inverse permutation -# iperm[perm] = arange(len(perm)) -# -# data = zeros( (num_blocks,X,Y), dtype=self.dtype ) -# data[map[iperm],i_sub,j_sub] = self.data -# -# row = i_block[mask] -# col = j_block[mask] -# -# # now row,col,data form BOO format -# -# temp = cumsum(bincount(row)) -# indptr = zeros( M/X + 1, dtype=intc ) -# indptr[1:len(temp)+1] = temp -# indptr[len(temp)+1:] = temp[-1] -# -# from bsr import bsr_matrix -# return bsr_matrix((data,col,indptr),shape=self.shape) + def tobsr(self,blocksize=None): + from bsr import bsr_matrix + + if self.nnz == 0: + return bsr_matrix(self.shape,blocksize=blocksize,dtype=self.dtype) + + if blocksize in [None, (1,1)]: + return self.tocsr().tobsr(blocksize) + + M,N = self.shape + X,Y = blocksize + + if (M % X) != 0 or (N % Y) != 0: + raise ValueError, 'shape must be multiple of blocksize' + + i_block,i_sub = divmod(self.row, X) + j_block,j_sub = divmod(self.col, Y) + + perm = lexsort( keys=[j_block,i_block] ) + + i_block = i_block[perm] + j_block = j_block[perm] + + mask = (i_block[1:] != i_block[:-1]) + (j_block[1:] != j_block[:-1]) + mask = concatenate((array([True]),mask)) + + #map self.data[n] -> data[map[n],i_sub[n],j_sub[n]] + map = cumsum(mask) + num_blocks = map[-1] + map -= 1 + + iperm = empty_like(perm) #inverse permutation + iperm[perm] = arange(len(perm)) + + data = zeros( (num_blocks,X,Y), dtype=self.dtype ) + data[map[iperm],i_sub,j_sub] = self.data + + row = i_block[mask] + col = j_block[mask] + + # now row,col,data form BOO format + + temp = cumsum(bincount(row)) + indptr = zeros( M/X + 1, dtype=intc ) + indptr[1:len(temp)+1] = temp + indptr[len(temp)+1:] = temp[-1] + + return bsr_matrix((data,col,indptr),shape=self.shape) + # needed by _data_matrix def _with_data(self,data,copy=True): """Returns a matrix with the same sparsity structure as self, Modified: trunk/scipy/sparse/csc.py =================================================================== --- trunk/scipy/sparse/csc.py 2007-12-20 21:42:31 UTC (rev 3694) +++ trunk/scipy/sparse/csc.py 2007-12-21 02:04:21 UTC (rev 3695) @@ -225,17 +225,17 @@ # return bsc_matrix( arg1, shape=self.shape, copy=copy ) # else: # #TODO make this more efficient -# return self.tocoo(copy=False).tobsr(blocksize=blocksize) +# return self.tocoo(copy=False).tobsc(blocksize=blocksize) # -# def tobsr(self, blocksize=None): -# if blocksize in [None, (1,1)]: -# from bsr import bsr_matrix -# csr = self.tocsr() -# arg1 = (csr.data.reshape(-1,1,1),csr.indices,csr.indptr) -# return bsr_matrix( arg1, shape=self.shape ) -# else: -# #TODO make this more efficient -# return self.tocoo(copy=False).tobsr(blocksize=blocksize) + def tobsr(self, blocksize=None): + if blocksize in [None, (1,1)]: + from bsr import bsr_matrix + csr = self.tocsr() + arg1 = (csr.data.reshape(-1,1,1),csr.indices,csr.indptr) + return bsr_matrix( arg1, shape=self.shape ) + else: + #TODO make this more efficient + return self.tocoo(copy=False).tobsr(blocksize=blocksize) def get_submatrix( self, slice0, slice1 ): """Return a submatrix of this matrix (new matrix is created). Modified: trunk/scipy/sparse/csr.py =================================================================== --- trunk/scipy/sparse/csr.py 2007-12-20 21:42:31 UTC (rev 3694) +++ trunk/scipy/sparse/csr.py 2007-12-21 02:04:21 UTC (rev 3695) @@ -224,15 +224,15 @@ from csc import csc_matrix return csc_matrix((data, indices, indptr), self.shape) -# def tobsr(self,blocksize=None,copy=True): -# if blocksize in [None, (1,1)]: -# from bsr import bsr_matrix -# arg1 = (self.data.reshape(-1,1,1),self.indices,self.indptr) -# return bsr_matrix( arg1, shape=self.shape, copy=copy ) -# else: -# #TODO make this more efficient -# return self.tocoo(copy=False).tobsr(blocksize=blocksize) -# + def tobsr(self,blocksize=None,copy=True): + if blocksize in [None, (1,1)]: + from bsr import bsr_matrix + arg1 = (self.data.reshape(-1,1,1),self.indices,self.indptr) + return bsr_matrix( arg1, shape=self.shape, copy=copy ) + else: + #TODO make this more efficient + return self.tocoo(copy=False).tobsr(blocksize=blocksize) + # def tobsc(self,blocksize=None): # if blocksize in [None, (1,1)]: # from bsc import bsc_matrix Modified: trunk/scipy/sparse/sparsetools/fixed_size.h =================================================================== --- trunk/scipy/sparse/sparsetools/fixed_size.h 2007-12-20 21:42:31 UTC (rev 3694) +++ trunk/scipy/sparse/sparsetools/fixed_size.h 2007-12-21 02:04:21 UTC (rev 3695) @@ -18,16 +18,16 @@ }; template -class Dot<0,T> +class Dot<1,T> { public: inline T operator()(const T * lhs, const T * rhs) { - return 0; + return *lhs * *rhs; } }; - template +template inline T dot(const T * lhs, const T * rhs) { Dot d; @@ -35,5 +35,4 @@ } - #endif Modified: trunk/scipy/sparse/sparsetools/sparsetools.h =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.h 2007-12-20 21:42:31 UTC (rev 3694) +++ trunk/scipy/sparse/sparsetools/sparsetools.h 2007-12-21 02:04:21 UTC (rev 3695) @@ -727,49 +727,88 @@ +//template +//void bsr_tocsr(const I n_brow, +// const I n_bcol, +// const I R, +// const I C, +// const I Ap[], +// const I Aj[], +// const T Ax[], +// I Bp[], +// I Bj[] +// T Bx[]) +//{ +// const I RC = R*C; +// +// for(I brow = 0; brow < n_brow; brow++){ +// I row_size = C * (Ap[brow + 1] - Ap[brow]); +// for(I r = 0; r < R; r++){ +// Bp[R*brow + r] = RC * Ap[brow] + r * row_size +// } +// } +//} template -void bsr_matvec_fixed(const I n_row, - const I n_col, +void bsr_matvec_fixed(const I n_brow, + const I n_bcol, const I Ap[], const I Aj[], const T Ax[], const T Xx[], T Yx[]) { - for(I i = 0; i < n_row; i++) { + for(I i = 0; i < n_brow; i++) { T r0 = 0; T r1 = 0; T r2 = 0; T r3 = 0; T r4 = 0; T r5 = 0; + T r6 = 0; + T r7 = 0; for(I jj = Ap[i]; jj < Ap[i+1]; jj++) { I j = Aj[jj]; const T * base = Ax + jj*(R*C); - if (R >= 1) r0 += dot(base + 0*C, Xx + j*C); - if (R >= 2) r1 += dot(base + 1*C, Xx + j*C); - if (R >= 3) r2 += dot(base + 2*C, Xx + j*C); - if (R >= 4) r3 += dot(base + 3*C, Xx + j*C); - if (R >= 5) r4 += dot(base + 4*C, Xx + j*C); - if (R >= 6) r5 += dot(base + 5*C, Xx + j*C); + if (R > 0) r0 += dot(base + 0*C, Xx + j*C); + if (R > 1) r1 += dot(base + 1*C, Xx + j*C); + if (R > 2) r2 += dot(base + 2*C, Xx + j*C); + if (R > 3) r3 += dot(base + 3*C, Xx + j*C); + if (R > 4) r4 += dot(base + 4*C, Xx + j*C); + if (R > 5) r5 += dot(base + 5*C, Xx + j*C); + if (R > 6) r6 += dot(base + 6*C, Xx + j*C); + if (R > 7) r7 += dot(base + 7*C, Xx + j*C); } - if (R >= 1) Yx[R*i+0] = r0; - if (R >= 2) Yx[R*i+1] = r1; - if (R >= 3) Yx[R*i+2] = r2; - if (R >= 4) Yx[R*i+3] = r3; - if (R >= 5) Yx[R*i+4] = r4; - if (R >= 6) Yx[R*i+5] = r5; + if (R > 0) Yx[R*i+0] = r0; + if (R > 1) Yx[R*i+1] = r1; + if (R > 2) Yx[R*i+2] = r2; + if (R > 3) Yx[R*i+3] = r3; + if (R > 4) Yx[R*i+4] = r4; + if (R > 5) Yx[R*i+5] = r5; + if (R > 6) Yx[R*i+6] = r6; + if (R > 7) Yx[R*i+7] = r7; } } +#define F(X,Y) bsr_matvec_fixed +/* + * Generate the table below with: + * out = '' + * N = 8 + * for i in range(N): + * out += '{' + * for j in range(N-1): + * out += ' F(%d,%d),' % (i+1,j+1) + * out += ' F(%d,%d) },\n' % (i+1,j+2) + * out = out[:-2] + * + */ - template -void bsr_matvec(const I n_row, - const I n_col, +void bsr_matvec(const I n_brow, + const I n_bcol, const I R, const I C, const I Ap[], @@ -778,45 +817,38 @@ const T Xx[], T Yx[]) { - /* - //use fixed version for R,C <= 4,4 - if (R == 1){ - if (C == 1) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } - if (C == 2) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } - if (C == 3) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } - if (C == 4) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } + assert(R > 0 && C > 0); + + void (*dispatch[8][8])(I,I,const I*,const I*,const T*,const T*,T*) = \ + { + { F(1,1), F(1,2), F(1,3), F(1,4), F(1,5), F(1,6), F(1,7), F(1,8) }, + { F(2,1), F(2,2), F(2,3), F(2,4), F(2,5), F(2,6), F(2,7), F(2,8) }, + { F(3,1), F(3,2), F(3,3), F(3,4), F(3,5), F(3,6), F(3,7), F(3,8) }, + { F(4,1), F(4,2), F(4,3), F(4,4), F(4,5), F(4,6), F(4,7), F(4,8) }, + { F(5,1), F(5,2), F(5,3), F(5,4), F(5,5), F(5,6), F(5,7), F(5,8) }, + { F(6,1), F(6,2), F(6,3), F(6,4), F(6,5), F(6,6), F(6,7), F(6,8) }, + { F(7,1), F(7,2), F(7,3), F(7,4), F(7,5), F(7,6), F(7,7), F(7,8) }, + { F(8,1), F(8,2), F(8,3), F(8,4), F(8,5), F(8,6), F(8,7), F(8,8) } + }; + + if (R <= 8 && C <= 8){ + dispatch[R-1][C-1](n_brow,n_bcol,Ap,Aj,Ax,Xx,Yx); + return; } - if (R == 2){ - if (C == 1) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } - if (C == 2) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } - if (C == 3) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } - if (C == 4) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } - } - if (R == 3){ - if (C == 1) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } - if (C == 2) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } - if (C == 3) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } - if (C == 4) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } - } - if (R == 4){ - if (C == 1) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } - if (C == 2) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } - if (C == 3) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } - if (C == 4) { bsr_matvec_fixed(n_row,n_col,Ap,Aj,Ax,Xx,Yx); return; } - } */ //otherwise use general method - for(I i = 0; i < n_row; i++){ + for(I i = 0; i < n_brow; i++){ Yx[i] = 0; } - for(I i = 0; i < n_row; i++){ + for(I i = 0; i < n_brow; i++){ const T * A = Ax + R * C * Ap[i]; T * y = Yx + R * i; for(I jj = Ap[i]; jj < Ap[i+1]; jj++){ const T * x = Xx + C*Aj[jj]; + //TODO replace this with a proper matvec for( I r = 0; r < R; r++ ){ T sum = 0; for( I c = 0; c < C; c++ ){ @@ -829,6 +861,7 @@ } } } +#undef F Modified: trunk/scipy/sparse/sparsetools/sparsetools.py =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.py 2007-12-20 21:42:31 UTC (rev 3694) +++ trunk/scipy/sparse/sparsetools/sparsetools.py 2007-12-21 02:04:21 UTC (rev 3695) @@ -302,24 +302,24 @@ def bsr_matvec(*args): """ - bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, + bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, signed char Ax, signed char Xx, signed char Yx) - bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, + bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, unsigned char Ax, unsigned char Xx, unsigned char Yx) - bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, + bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, short Ax, short Xx, short Yx) - bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, + bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, int Ax, int Xx, int Yx) - bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, + bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, long long Ax, long long Xx, long long Yx) - bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, + bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, float Ax, float Xx, float Yx) - bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, + bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, double Ax, double Xx, double Yx) - bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, + bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, npy_cfloat_wrapper Ax, npy_cfloat_wrapper Xx, npy_cfloat_wrapper Yx) - bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, + bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, npy_cdouble_wrapper Ax, npy_cdouble_wrapper Xx, npy_cdouble_wrapper Yx) """ Modified: trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx 2007-12-20 21:42:31 UTC (rev 3694) +++ trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx 2007-12-21 02:04:21 UTC (rev 3695) @@ -43397,24 +43397,24 @@ " npy_cdouble_wrapper Xx, npy_cdouble_wrapper Yx)\n" ""}, { (char *)"bsr_matvec", _wrap_bsr_matvec, METH_VARARGS, (char *)"\n" - "bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + "bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, \n" " signed char Ax, signed char Xx, signed char Yx)\n" - "bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + "bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, \n" " unsigned char Ax, unsigned char Xx, unsigned char Yx)\n" - "bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + "bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, \n" " short Ax, short Xx, short Yx)\n" - "bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + "bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, \n" " int Ax, int Xx, int Yx)\n" - "bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + "bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, \n" " long long Ax, long long Xx, long long Yx)\n" - "bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + "bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, \n" " float Ax, float Xx, float Yx)\n" - "bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + "bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, \n" " double Ax, double Xx, double Yx)\n" - "bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + "bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, \n" " npy_cfloat_wrapper Ax, npy_cfloat_wrapper Xx, \n" " npy_cfloat_wrapper Yx)\n" - "bsr_matvec(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + "bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, \n" " npy_cdouble_wrapper Ax, npy_cdouble_wrapper Xx, \n" " npy_cdouble_wrapper Yx)\n" ""}, Modified: trunk/scipy/sparse/tests/test_base.py =================================================================== --- trunk/scipy/sparse/tests/test_base.py 2007-12-20 21:42:31 UTC (rev 3694) +++ trunk/scipy/sparse/tests/test_base.py 2007-12-21 02:04:21 UTC (rev 3695) @@ -21,7 +21,8 @@ from numpy.testing import * set_package_path() from scipy.sparse import csc_matrix, csr_matrix, dok_matrix, \ - coo_matrix, lil_matrix, dia_matrix, extract_diagonal, speye + coo_matrix, lil_matrix, dia_matrix, bsr_matrix, \ + extract_diagonal, speye from scipy.linsolve import splu restore_path() @@ -302,9 +303,7 @@ def check_conversions(self): - #TODO add bsr/bsc - #for format in ['bsc','bsr','coo','csc','csr','dia','dok','lil']: - for format in ['coo','csc','csr','dia','dok','lil']: + for format in ['bsr','coo','csc','csr','dia','dok','lil']: a = self.datsp.asformat(format) assert_equal(a.format,format) assert_array_almost_equal(a.todense(), self.dat) @@ -318,18 +317,17 @@ #TODO, add and test .todia(maxdiags) pass -# def check_tocompressedblock(self): -# #TODO more extensively test .tobsc() and .tobsr() w/ blocksizes -# x = array([[1,0,2,0],[0,0,0,0],[0,0,4,5]]) -# y = array([[0,1,2],[3,0,5]]) -# A = kron(x,y) -# Asp = self.spmatrix(A) -# for format in ['bsc','bsr']: -# fn = getattr(Asp, 'to' + format ) -# -# for X in [ 1, 2, 3, 6 ]: -# for Y in [ 1, 2, 3, 4, 6, 12]: -# assert_equal( fn(blocksize=(X,Y)).todense(), A) + def check_tocompressedblock(self): + x = array([[1,0,2,0],[0,0,0,0],[0,0,4,5]]) + y = array([[0,1,2],[3,0,5]]) + A = kron(x,y) + Asp = self.spmatrix(A) + for format in ['bsr']: + fn = getattr(Asp, 'to' + format ) + + for X in [ 1, 2, 3, 6 ]: + for Y in [ 1, 2, 3, 4, 6, 12]: + assert_equal( fn(blocksize=(X,Y)).todense(), A) def check_transpose(self): @@ -1222,33 +1220,60 @@ pass #TODO add test -#class TestBSR(_TestCommon, _TestArithmetic, NumpyTestCase): -# spmatrix = bsr_matrix -# -# def check_constructor1(self): -# indptr = array([0,2,2,4]) -# indices = array([0,2,2,3]) -# data = zeros((4,2,3)) -# -# data[0] = array([[ 0, 1, 2], -# [ 3, 0, 5]]) -# data[1] = array([[ 0, 2, 4], -# [ 6, 0, 10]]) -# data[2] = array([[ 0, 4, 8], -# [12, 0, 20]]) -# data[3] = array([[ 0, 5, 10], -# [15, 0, 25]]) -# -# A = kron( [[1,0,2,0],[0,0,0,0],[0,0,4,5]], [[0,1,2],[3,0,5]] ) -# -# Asp = bsr_matrix((data,indices,indptr),shape=(6,12)) -# -# assert_equal(Asp.todense(),A) -# #TODO add infer from shape example -# -# -# -# +class TestBSR(_TestCommon, _TestArithmetic, NumpyTestCase): + spmatrix = bsr_matrix + + def check_constructor1(self): + """check native BSR format constructor""" + indptr = array([0,2,2,4]) + indices = array([0,2,2,3]) + data = zeros((4,2,3)) + + data[0] = array([[ 0, 1, 2], + [ 3, 0, 5]]) + data[1] = array([[ 0, 2, 4], + [ 6, 0, 10]]) + data[2] = array([[ 0, 4, 8], + [12, 0, 20]]) + data[3] = array([[ 0, 5, 10], + [15, 0, 25]]) + + A = kron( [[1,0,2,0],[0,0,0,0],[0,0,4,5]], [[0,1,2],[3,0,5]] ) + Asp = bsr_matrix((data,indices,indptr),shape=(6,12)) + assert_equal(Asp.todense(),A) + + #infer shape from arrays + Asp = bsr_matrix((data,indices,indptr)) + assert_equal(Asp.todense(),A) + + def check_constructor2(self): + """construct from dense""" + + #test zero mats + for shape in [ (1,1), (5,1), (1,10), (10,4), (3,7), (2,1)]: + A = zeros(shape) + assert_equal(bsr_matrix(A).todense(),A) + A = zeros((4,6)) + assert_equal(bsr_matrix(A,blocksize=(2,2)).todense(),A) + assert_equal(bsr_matrix(A,blocksize=(2,3)).todense(),A) + + A = kron( [[1,0,2,0],[0,0,0,0],[0,0,4,5]], [[0,1,2],[3,0,5]] ) + assert_equal(bsr_matrix(A).todense(),A) + assert_equal(bsr_matrix(A,shape=(6,12)).todense(),A) + assert_equal(bsr_matrix(A,blocksize=(1,1)).todense(),A) + assert_equal(bsr_matrix(A,blocksize=(2,3)).todense(),A) + assert_equal(bsr_matrix(A,blocksize=(2,6)).todense(),A) + assert_equal(bsr_matrix(A,blocksize=(2,12)).todense(),A) + assert_equal(bsr_matrix(A,blocksize=(3,12)).todense(),A) + assert_equal(bsr_matrix(A,blocksize=(6,12)).todense(),A) + + A = kron( [[1,0,2,0],[0,1,0,0],[0,0,0,0]], [[0,1,2],[3,0,5]] ) + assert_equal(bsr_matrix(A,blocksize=(2,3)).todense(),A) + + + + + #class TestBSC(_TestCommon, _TestArithmetic, NumpyTestCase): # spmatrix = bsc_matrix # From scipy-svn at scipy.org Sat Dec 22 12:20:14 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 22 Dec 2007 11:20:14 -0600 (CST) Subject: [Scipy-svn] r3696 - trunk/scipy/optimize Message-ID: <20071222172014.A02B439C088@new.scipy.org> Author: rob.falck Date: 2007-12-22 11:20:01 -0600 (Sat, 22 Dec 2007) New Revision: 3696 Modified: trunk/scipy/optimize/slsqp.py Log: slsqp updated to allow constraints via functions fixed and additional bounds checking Modified: trunk/scipy/optimize/slsqp.py =================================================================== --- trunk/scipy/optimize/slsqp.py 2007-12-21 02:04:21 UTC (rev 3695) +++ trunk/scipy/optimize/slsqp.py 2007-12-22 17:20:01 UTC (rev 3696) @@ -1,19 +1,55 @@ -__all__ = ['fmin_slsqp'] +"""This module implements the Sequential Least SQuares Programming optimization +algorithm (SLSQP), orginally developed by Dieter Kraft. +See http://www.netlib.org/toms/733 + +""" + +__all__ = ['approx_jacobian','fmin_slsqp'] + from _slsqp import slsqp from numpy import zeros, array, identity, linalg, rank, squeeze, append, \ - asfarray,product -from sys import exit -from math import sqrt + asfarray,product, concatenate, finfo, sqrt, vstack, transpose from optimize import approx_fprime, wrap_function -import numpy -_epsilon = sqrt(numpy.finfo(float).eps) +__docformat__ = "restructuredtext en" +_epsilon = sqrt(finfo(float).eps) + +def approx_jacobian(x,func,epsilon,*args): + """Approximate the Jacobian matrix of callable function func + + *Parameters*: + x - The state vector at which the Jacobian matrix is desired + func - A vector-valued function of the form f(x,*args) + epsilon - The peturbation used to determine the partial derivatives + *args - Additional arguments passed to func + + *Returns*: + An array of dimensions (lenf, lenx) where lenf is the length + of the outputs of func, and lenx is the number of + + *Notes*: + The approximation is done using forward differences + + """ + x0 = asfarray(x) + f0 = func(*((x0,)+args)) + jac = zeros([len(x0),len(f0)]) + dx = zeros(len(x0)) + for i in range(len(x0)): + dx[i] = epsilon + jac[i] = (func(*((x0+dx,)+args)) - f0)/epsilon + dx[i] = 0.0 + return jac.transpose() + + + + def fmin_slsqp( func, x0 , eqcons=[], f_eqcons=None, ieqcons=[], f_ieqcons=None, - bounds = [], fprime = None, fprime_cons=None,args = (), - iter = 100, acc = 1.0E-6, iprint = 1, full_output = 0, - epsilon = _epsilon ): + bounds = [], fprime = None, fprime_eqcons=None, + fprime_ieqcons=None, args = (), iter = 100, acc = 1.0E-6, + iprint = 1, full_output = 0, epsilon = _epsilon ): """ Minimize a function using Sequential Least SQuares Programming @@ -46,16 +82,16 @@ for each independent variable [(xl0, xu0),(xl1, xu1),...] fprime : callable f(x,*args) A function that evaluates the partial derivatives of func. - fprime_cons : callable f(x,*args) + fprime_eqcons : callable f(x,*args) A function of the form f(x, *args) that returns the m by n - array of constraint normals. If not provided, the normals - will be approximated. Equality constraint normals precede - inequality constraint normals. The array returned by - fprime_cons should be sized as ( len(eqcons) + - len(ieqcons), len(x0) ). If fprime_cons is not supplied - (normals are approximated) then the constraints must be - supplied via the eqcons and ieqcons structures, not - f_eqcons and f_ieqcons. + array of equality constraint normals. If not provided, + the normals will be approximated. The array returned by + fprime_eqcons should be sized as ( len(eqcons), len(x0) ). + fprime_ieqcons : callable f(x,*args) + A function of the form f(x, *args) that returns the m by n + array of inequality constraint normals. If not provided, + the normals will be approximated. The array returned by + fprime_ieqcons should be sized as ( len(ieqcons), len(x0) ). args : sequence Additional arguments passed to func and fprime. iter : int @@ -114,56 +150,79 @@ 7 : "Rank-deficient equality constraint subproblem HFTI", 8 : "Positive directional derivative for linesearch", 9 : "Iteration limit exceeded" } + + # Now do a lot of function wrapping - # Wrap the functions # Wrap func feval, func = wrap_function(func, args) + # Wrap fprime, if provided, or approx_fprime if not if fprime: - # Wrap fprime, if provided geval, fprime = wrap_function(fprime,args) else: - # Wrap approx_fprime, if fprime not provided geval, fprime = wrap_function(approx_fprime,(func,epsilon)) - if fprime_cons: - approx_constraint_norms = False - if f_eqcons: - ceval, f_eqcons = wrap_function(f_eqcons,args) + + if f_eqcons: + # Equality constraints provided via f_eqcons + ceval, f_eqcons = wrap_function(f_eqcons,args) + if fprime_eqcons: + # Wrap fprime_eqcons + geval, fprime_eqcons = wrap_function(fprime_eqcons,args) else: - for i in range(len(eqcons)): - if eqcons[i]: - ceval, eqcons[i] = wrap_function(eqcons[i],args) - if f_ieqcons: - ceval, f_ieqcons = wrap_function(f_ieqcons,args) - else: - for i in range(len(ieqcons)): - if ieqcons[i]: - ceval, ieqcons[i] = wrap_function(ieqcons[i],args) - geval, fprime_cons = wrap_function(fprime_cons,args) + # Wrap approx_jacobian + geval, fprime_eqcons = wrap_function(approx_jacobian, + (f_eqcons,epsilon)) else: - approx_constraint_norms = True + # Equality constraints provided via eqcons[] eqcons_prime = [] for i in range(len(eqcons)): eqcons_prime.append(None) if eqcons[i]: + # Wrap eqcons and eqcons_prime ceval, eqcons[i] = wrap_function(eqcons[i],args) - geval, eqcons_prime[i] = \ - wrap_function(approx_fprime, (eqcons[i],epsilon)) + geval, eqcons_prime[i] = wrap_function(approx_fprime, + (eqcons[i],epsilon)) + + if f_ieqcons: + # Inequality constraints provided via f_ieqcons + ceval, f_ieqcons = wrap_function(f_ieqcons,args) + if fprime_ieqcons: + # Wrap fprime_ieqcons + geval, fprime_ieqcons = wrap_function(fprime_ieqcons,args) + else: + # Wrap approx_jacobian + geval, fprime_ieqcons = wrap_function(approx_jacobian, + (f_ieqcons,epsilon)) + else: + # Inequality constraints provided via ieqcons[] ieqcons_prime = [] for i in range(len(ieqcons)): ieqcons_prime.append(None) if ieqcons[i]: + # Wrap ieqcons and ieqcons_prime ceval, ieqcons[i] = wrap_function(ieqcons[i],args) - geval, ieqcons_prime[i] = \ - wrap_function(approx_fprime, (ieqcons[i],epsilon)) + geval, ieqcons_prime[i] = wrap_function(approx_fprime, + (ieqcons[i],epsilon)) + # Transform x0 into an array. x = asfarray(x0).flatten() # Set the parameters that SLSQP will need - meq = len(eqcons) # meq = The number of equality constraints - m = meq + len(ieqcons) # m = The total number of constraints - la = array([1,m]).max() # la = - n = len(x) # n = The number of independent variables + # meq = The number of equality constraints + if f_eqcons: + meq = len(f_eqcons(x)) + else: + meq = len(eqcons) + if f_ieqcons: + mieq = len(f_ieqcons(x)) + else: + mieq = len(ieqcons) + # m = The total number of constraints + m = meq + mieq + # la = The number of constraints, or 1 if there are no constraints + la = array([1,m]).max() + # n = The number of independent variables + n = len(x) # Define the workspaces for SLSQP n1 = n+1 @@ -173,14 +232,23 @@ len_jw = mineq w = zeros(len_w) jw = zeros(len_jw) - + # Decompose bounds into xl and xu if len(bounds) == 0: bounds = [(-1.0E12, 1.0E12) for i in range(n)] - if len(bounds) != n: - raise IndexError, 'SLSQP Error: If bounds is specified, len(bounds) == len(x0)' + elif len(bounds) != n: + raise IndexError, \ + 'SLSQP Error: If bounds is specified, len(bounds) == len(x0)' + else: + for i in range(len(bounds)): + if bounds[i][0] > bounds[i][1]: + raise ValueError, \ + 'SLSQP Error: lb > ub in bounds[' + str(i) +'] ' + str(bounds[4]) + xl = array( [ b[0] for b in bounds ] ) - xu = array( [ b[1] for b in bounds ] ) + xu = array( [ b[1] for b in bounds ] ) + + # Initialize the iteration counter and the mode value mode = array(0,int) @@ -193,36 +261,73 @@ print "%5s %5s %16s %16s" % ("NIT","FC","OBJFUN","GNORM") while 1: + if mode == 0 or mode == 1: # objective and constraint evaluation requird + # Compute objective function fx = func(x) # Compute the constraints if f_eqcons: - ceq = f_eqcons(x) + c_eq = f_eqcons(x) else: - ceq = [ eqcons[i](x) for i in range(meq) ] + c_eq = array([ eqcons[i](x) for i in range(meq) ]) if f_ieqcons: - cieq = f_ieqcons(x) + c_ieq = f_ieqcons(x) else: - cieq = [ ieqcons[i](x) for i in range(len(ieqcons)) ] - c = numpy.concatenate( (ceq,cieq), 1) - #c = array ( [ eqcons[i](x) for i in range(meq) ] + - # [ ieqcons[i](x) for i in range(len(ieqcons)) ] ) + c_ieq = array([ ieqcons[i](x) for i in range(len(ieqcons)) ]) + + # Now combine c_eq and c_ieq into a single matrix + if m == 0: + # no constraints + c = zeros([la]) + else: + # constraints exist + if meq > 0 and mieq == 0: + # only equality constraints + c = c_eq + if meq == 0 and mieq > 0: + # only inequality constraints + c = c_ieq + if meq > 0 and mieq > 0: + # both equality and inequality constraints exist + c = append(c_eq, c_ieq) + if mode == 0 or mode == -1: # gradient evaluation required + # Compute the derivatives of the objective function # For some reason SLSQP wants g dimensioned to n+1 g = append(fprime(x),0.0) - # Compute the normals of the constraints - if approx_constraint_norms: - a = zeros([la,n1]) + # Compute the normals of the constraints + if fprime_eqcons: + a_eq = fprime_eqcons(x) + else: + a_eq = zeros([meq,n]) for i in range(meq): - a[i] = append(eqcons_prime[i](x),0.0) - for i in range(meq+1,m): - a[i] = append(ieqcons_prime[i](x),0.0) + a_eq[i] = eqcons_prime[i](x) + + if fprime_ieqcons: + a_ieq = fprime_ieqcons(x) else: - a = numpy.concatenate( (fprime_cons(x),zeros([la,1])),1) - + a_ieq = zeros([mieq,n]) + for i in range(mieq): + a_ieq[i] = ieqcons_prime[i](x) + + # Now combine a_eq and a_ieq into a single a matrix + if m == 0: + # no constraints + a = zeros([la,n]) + elif meq > 0 and mieq == 0: + # only equality constraints + a = a_eq + elif meq == 0 and mieq > 0: + # only inequality constraints + a = a_ieq + elif meq > 0 and mieq > 0: + # both equality and inequality constraints exist + a = vstack((a_eq,a_ieq)) + a = concatenate((a,zeros([la,1])),1) + # Call SLSQP slsqp(m, meq, x, xl, xu, fx, c, g, a, acc, majiter, mode, w, jw) @@ -246,7 +351,7 @@ print " Function evaluations:", feval[0] print " Gradient evaluations:", geval[0] - if full_output == 0: + if not full_output: return x else: return [list(x), From scipy-svn at scipy.org Sun Dec 23 12:43:22 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 23 Dec 2007 11:43:22 -0600 (CST) Subject: [Scipy-svn] r3697 - in trunk/scipy: sandbox/multigrid sparse sparse/sparsetools sparse/tests Message-ID: <20071223174322.41EF839C010@new.scipy.org> Author: wnbell Date: 2007-12-23 11:42:51 -0600 (Sun, 23 Dec 2007) New Revision: 3697 Modified: trunk/scipy/sandbox/multigrid/utils.py trunk/scipy/sparse/block.py trunk/scipy/sparse/compressed.py trunk/scipy/sparse/construct.py trunk/scipy/sparse/coo.py trunk/scipy/sparse/sparsetools/fixed_size.h trunk/scipy/sparse/sparsetools/sparsetools.h trunk/scipy/sparse/sparsetools/sparsetools.i trunk/scipy/sparse/sparsetools/sparsetools.py trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx trunk/scipy/sparse/spfuncs.py trunk/scipy/sparse/tests/test_sparse.py Log: added bsr arithmetic added simple block size determination Modified: trunk/scipy/sandbox/multigrid/utils.py =================================================================== --- trunk/scipy/sandbox/multigrid/utils.py 2007-12-22 17:20:01 UTC (rev 3696) +++ trunk/scipy/sandbox/multigrid/utils.py 2007-12-23 17:42:51 UTC (rev 3697) @@ -98,8 +98,6 @@ H[1,0] = H[0,1] beta = H[2,1] - #estimates.append( max( [norm(x) for x in eigvals(H[:j+1,:j+1])] ) ) - return norm(H[:j+1,:j+1],2) Modified: trunk/scipy/sparse/block.py =================================================================== --- trunk/scipy/sparse/block.py 2007-12-22 17:20:01 UTC (rev 3696) +++ trunk/scipy/sparse/block.py 2007-12-23 17:42:51 UTC (rev 3697) @@ -1,12 +1,15 @@ """base class for block sparse formats""" from numpy import zeros, intc, array, asarray, arange, diff, tile, rank, \ - prod + prod, ravel from data import _data_matrix from base import isspmatrix, _formats -from sputils import isshape, getdtype, to_native +from sputils import isshape, getdtype, to_native, isscalarlike, isdense +import sparsetools +#TODO refactor w/ compressed.py + class _block_matrix(_data_matrix): def __init__(self, arg1, shape=None, dtype=None, copy=False, blocksize=None): _data_matrix.__init__(self) @@ -109,9 +112,11 @@ % self.indices.dtype.name ) # only support 32-bit ints for now - self.indptr = self.indptr.astype(intc) - self.indices = self.indices.astype(intc) - self.data = to_native(self.data) + if self.indptr.dtype != intc: + self.indptr = self.indptr.astype(intc) + if self.indices.dtype != intc: + self.indices = self.indices.astype(intc) + self.data = to_native(self.data) # check array shapes if (rank(self.indices) != 1) or (rank(self.indptr) != 1): @@ -168,6 +173,109 @@ ( self.shape + (self.dtype.type, nnz) + self.blocksize + \ (_formats[format][1],) ) + + def __add__(self,other): + # First check if argument is a scalar + if isscalarlike(other): + # Now we would add this scalar to every element. + raise NotImplementedError, 'adding a scalar to a CSC or CSR ' \ + 'matrix is not supported' + elif isspmatrix(other): + if (other.shape != self.shape): + raise ValueError, "inconsistent shapes" + + return self._binopt(other,'_plus_') + elif isdense(other): + # Convert this matrix to a dense matrix and add them + return self.todense() + other + else: + raise NotImplementedError + + def __radd__(self,other): + return self.__add__(other) + + def __sub__(self,other): + # First check if argument is a scalar + if isscalarlike(other): + # Now we would add this scalar to every element. + raise NotImplementedError, 'adding a scalar to a sparse ' \ + 'matrix is not supported' + elif isspmatrix(other): + if (other.shape != self.shape): + raise ValueError, "inconsistent shapes" + + return self._binopt(other,'_minus_') + elif isdense(other): + # Convert this matrix to a dense matrix and subtract them + return self.todense() - other + else: + raise NotImplementedError + + def __rsub__(self,other): # other - self + #note: this can't be replaced by other + (-self) for unsigned types + if isscalarlike(other): + # Now we would add this scalar to every element. + raise NotImplementedError, 'adding a scalar to a sparse ' \ + 'matrix is not supported' + elif isdense(other): + # Convert this matrix to a dense matrix and subtract them + return other - self.todense() + else: + raise NotImplementedError + + + def __mul__(self, other): # self * other + """ Scalar, vector, or matrix multiplication + """ + if isscalarlike(other): + return self._with_data(self.data * other) + else: + return self.dot(other) + + + def __rmul__(self, other): # other * self + if isscalarlike(other): + return self.__mul__(other) + else: + # Don't use asarray unless we have to + try: + tr = other.transpose() + except AttributeError: + tr = asarray(other).transpose() + return self.transpose().dot(tr).transpose() + + + def __truediv__(self,other): + if isscalarlike(other): + return self * (1./other) + elif isspmatrix(other): + if (other.shape != self.shape): + raise ValueError, "inconsistent shapes" + + return self._binopt(other,'_eldiv_') + else: + raise NotImplementedError + + + def multiply(self, other): + """Point-wise multiplication by another matrix + """ + if (other.shape != self.shape): + raise ValueError, "inconsistent shapes" + + if isdense(other): + return multiply(self.todense(),other) + else: + other = self.__class__(other) + return self._binopt(other,'_elmul_') + + + + + + + + def _set_self(self, other, copy=False): """take the member variables of other and assign them to self""" @@ -219,6 +327,8 @@ def sort_indices(self): """Sort the indices of this matrix *in place* """ + from csr import csr_matrix + X,Y = self.blocksize M,N = self.shape @@ -248,7 +358,26 @@ self.data = self.data[:self.nnz] self.indices = self.indices[:self.nnz] + # utility functions + def _binopt(self, other, op, in_shape=None, out_shape=None): + """apply the binary operation fn to two sparse matrices""" + other = self.__class__(other,blocksize=self.blocksize) + if in_shape is None: + in_shape = self.shape + if out_shape is None: + out_shape = self.shape + + # e.g. csr_plus_csr, cscmucsc, etc. + fn = getattr(sparsetools, self.format + op + self.format) + + R,C = self.blocksize + indptr, ind, data = fn(in_shape[0]/R, in_shape[1]/C, R, C, \ + self.indptr, self.indices, ravel(self.data), + other.indptr, other.indices, ravel(other.data)) + data = data.reshape(-1,R,C) + return self.__class__((data, ind, indptr), shape=out_shape) + # needed by _data_matrix def _with_data(self,data,copy=True): """Returns a matrix with the same sparsity structure as self, Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-22 17:20:01 UTC (rev 3696) +++ trunk/scipy/sparse/compressed.py 2007-12-23 17:42:51 UTC (rev 3697) @@ -94,7 +94,8 @@ else: self.shape = self._swap((major_dim,minor_dim)) - self.check_format(full_check=False) + #self.check_format(full_check=False) + self.check_format(full_check=True) def getnnz(self): return self.indptr[-1] @@ -137,9 +138,11 @@ % self.indices.dtype.name ) # only support 32-bit ints for now - self.indptr = self.indptr.astype(intc) - self.indices = self.indices.astype(intc) - self.data = to_native(self.data) + if self.indptr.dtype != intc: + self.indptr = self.indptr.astype(intc) + if self.indices.dtype != intc: + self.indices = self.indices.astype(intc) + self.data = to_native(self.data) # check array shapes if (rank(self.data) != 1) or (rank(self.indices) != 1) or \ @@ -203,7 +206,7 @@ # First check if argument is a scalar if isscalarlike(other): # Now we would add this scalar to every element. - raise NotImplementedError, 'adding a scalar to a CSC or CSR ' \ + raise NotImplementedError, 'adding a scalar to a sparse ' \ 'matrix is not supported' elif isspmatrix(other): if (other.shape != self.shape): @@ -220,7 +223,7 @@ #note: this can't be replaced by other + (-self) for unsigned types if isscalarlike(other): # Now we would add this scalar to every element. - raise NotImplementedError, 'adding a scalar to a CSC or CSR ' \ + raise NotImplementedError, 'adding a scalar to a sparse ' \ 'matrix is not supported' elif isdense(other): # Convert this matrix to a dense matrix and subtract them @@ -446,7 +449,7 @@ return M - # methods that modify the internal data structure + # methods that examine or modify the internal data structure def sum_duplicates(self): """Eliminate duplicate matrix entries by adding them together @@ -459,6 +462,13 @@ self.prune() #nnz may have changed + def has_sorted_indices(self): + """Determine whether the matrix has sorted indices + """ + fn = sparsetools.has_sorted_indices + M,N = self._swap(self.shape) + return fn( M, N, self.indptr, self.indices) + def sorted_indices(self): """Return a copy of this matrix with sorted indices """ @@ -473,6 +483,10 @@ def sort_indices(self): """Sort the indices of this matrix *in place* """ + if self.has_sorted_indices(): + #see if sorting can be avoided + return + fn = getattr(sparsetools,self.format + '_sort_indices') M,N = self.shape @@ -529,6 +543,10 @@ if out_shape is None: out_shape = self.shape + #only necessary for sorted binopt method + #self.sort_indices() + #other.sort_indices() + # e.g. csr_plus_csr, cscmucsc, etc. fn = getattr(sparsetools, self.format + op + self.format) Modified: trunk/scipy/sparse/construct.py =================================================================== --- trunk/scipy/sparse/construct.py 2007-12-22 17:20:01 UTC (rev 3696) +++ trunk/scipy/sparse/construct.py 2007-12-23 17:42:51 UTC (rev 3697) @@ -95,10 +95,8 @@ [ 15., 20., 0., 0.]]) """ - if not isspmatrix(A) and isspmatrix(B): - raise ValueError,'expected sparse matrix' - - A,B = A.tocoo(),B.tocoo() + #TODO optimize for small dense B and CSR A + A,B = coo_matrix(A),coo_matrix(B) output_shape = (A.shape[0]*B.shape[0],A.shape[1]*B.shape[1]) if A.nnz == 0 or B.nnz == 0: Modified: trunk/scipy/sparse/coo.py =================================================================== --- trunk/scipy/sparse/coo.py 2007-12-22 17:20:01 UTC (rev 3696) +++ trunk/scipy/sparse/coo.py 2007-12-23 17:42:51 UTC (rev 3697) @@ -13,6 +13,7 @@ from base import isspmatrix from data import _data_matrix from sputils import upcast, to_native, isshape, getdtype +from spfuncs import estimate_blocksize class coo_matrix(_data_matrix): """A sparse matrix in COOrdinate format. @@ -175,8 +176,10 @@ % self.col.dtype.name ) # only support 32-bit ints for now - self.row = self.row.astype(intc) - self.col = self.col.astype(intc) + if self.row.dtype != intc: + self.row = self.row.astype(intc) + if self.col.dtype != intc: + self.col = self.col.astype(intc) self.data = to_native(self.data) if nnz > 0: @@ -305,7 +308,9 @@ if self.nnz == 0: return bsr_matrix(self.shape,blocksize=blocksize,dtype=self.dtype) - if blocksize in [None, (1,1)]: + if blocksize is None: + blocksize = estimate_blocksize(self) + elif blocksize in (1,1): return self.tocsr().tobsr(blocksize) M,N = self.shape Modified: trunk/scipy/sparse/sparsetools/fixed_size.h =================================================================== --- trunk/scipy/sparse/sparsetools/fixed_size.h 2007-12-22 17:20:01 UTC (rev 3696) +++ trunk/scipy/sparse/sparsetools/fixed_size.h 2007-12-23 17:42:51 UTC (rev 3697) @@ -6,33 +6,72 @@ * */ + + +/* + * Dot Product + * + */ template -class Dot +class _dot { public: - inline T operator()(const T * lhs, const T * rhs) + inline T operator()(const T * V1, const T * V2) { - Dot d; - return (*lhs * *rhs) + d(++lhs, ++rhs); + _dot d; + return (*V1) * (*V2) + d(++V1, ++V2); } }; - template -class Dot<1,T> +class _dot<1,T> { public: - inline T operator()(const T * lhs, const T * rhs) + inline T operator()(const T * V1, const T * V2) { - return *lhs * *rhs; + return (*V1) * (*V2); } }; template -inline T dot(const T * lhs, const T * rhs) +inline T dot(const T * V1, const T * V2) { - Dot d; - return d(lhs, rhs); + _dot d; + return d(V1, V2); } + + + +template +class _vec_binop_vec +{ + public: + inline void operator()(const T * V1, const T * V2, T * V3, const bin_op& op) + { + *V3 = op( *V1, *V2 ); + _vec_binop_vec d; + d(V1 + 1, V2 + 1, V3 + 1, op); + } +}; +template +class _vec_binop_vec<1,T,bin_op> +{ + public: + inline void operator()(const T * V1, const T * V2, T * V3, const bin_op& op) + { + *V3 = op( *V1, *V2 ); + } +}; + +template +inline void vec_binop_vec(const T * V1, const T * V2, T * V3, const bin_op& op) +{ + _vec_binop_vec d; + d(V1,V2,V3,op); +} + + + + #endif Modified: trunk/scipy/sparse/sparsetools/sparsetools.h =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.h 2007-12-22 17:20:01 UTC (rev 3696) +++ trunk/scipy/sparse/sparsetools/sparsetools.h 2007-12-23 17:42:51 UTC (rev 3697) @@ -4,17 +4,10 @@ /* * sparsetools.h - * A collection of CSR/CSC/COO matrix conversion and arithmetic functions. + * A collection of CSR/CSC/COO/BSR matrix conversion and arithmetic functions. * - * Authors: - * Nathan Bell + * Original code by Nathan Bell * - * Revisions: - * 07/14/2007 - added csr_sum_duplicates - * 07/12/2007 - added templated function for binary arithmetic ops - * 01/09/2007 - index type is now templated - * 01/06/2007 - initial inclusion into SciPy - * */ @@ -23,11 +16,8 @@ #include #include #include - - #include "fixed_size.h" - /* * Extract main diagonal of CSR matrix A * @@ -96,14 +86,114 @@ const I Ap[], I Bi[]) { + for(I i = 0; i < n_row; i++){ + for(I jj = Ap[i]; jj < Ap[i+1]; jj++){ + Bi[jj] = i; + } + } +} + +/* + * Compute the number of occupied RxC blocks in a matrix + * + * Input Arguments: + * I n_row - number of rows in A + * I R - row blocksize + * I C - column blocksize + * I Ap[n_row+1] - row pointer + * I Aj[nnz(A)] - column indices + * + * Output Arguments: + * I num_blocks - number of blocks + * + * Note: + * Complexity: Linear. + * + */ +template +I csr_count_blocks(const I n_row, + const I n_col, + const I R, + const I C, + const I Ap[], + const I Aj[]) +{ + std::vector mask(n_col/C + 1,-1); + I n_blks = 0; + for(I i = 0; i < n_row; i++){ + I bi = i/R; + for(I jj = Ap[i]; jj < Ap[i+1]; jj++){ + I bj = Aj[jj]/C; + if(mask[bj] != bi){ + mask[bj] = bi; + n_blks++; + } + } + } + return n_blks; +} + + + +/* + * Sort CSR column indices inplace + * + * Input Arguments: + * I n_row - number of rows in A + * I n_col - number of columns in A + * I Ap[n_row+1] - row pointer + * I Aj[nnz(A)] - column indices + * T Ax[nnz(A)] - nonzeros + * + */ +template +bool has_sorted_indices(const I n_row, + const I n_col, + const I Ap[], + const I Aj[]) +{ for(I i = 0; i < n_row; i++){ - for(I jj = Ap[i]; jj < Ap[i+1]; jj++){ - Bi[jj] = i; - } + for(I jj = Ap[i]; jj < Ap[i+1] - 1; jj++){ + if(Aj[jj] > Aj[jj+1]){ + return false; + } + } } + return true; } +template< class T1, class T2 > +bool kv_pair_less(const std::pair& x, const std::pair& y){ + return x.first < y.first; +} +template +void csr_sort_indices(const I n_row, + const I n_col, + const I Ap[], + I Aj[], + T Ax[]) +{ + std::vector< std::pair > temp; + for(I i = 0; i < n_row; i++){ + I row_start = Ap[i]; + I row_end = Ap[i+1]; + + temp.clear(); + + for(I jj = row_start; jj < row_end; jj++){ + temp.push_back(std::make_pair(Aj[jj],Ax[jj])); + } + + std::sort(temp.begin(),temp.end(),kv_pair_less); + + for(I jj = row_start, n = 0; jj < row_end; jj++, n++){ + Aj[jj] = temp[n].first; + Ax[jj] = temp[n].second; + } + } +} + /* * Compute B = A for CSR matrix A, CSC matrix B * @@ -144,40 +234,40 @@ I Bi[], T Bx[]) { - const I nnz = Ap[n_row]; - - //compute number of non-zero entries per column of A - std::fill(Bp, Bp + n_col, 0); + const I nnz = Ap[n_row]; - for (I n = 0; n < nnz; n++){ - Bp[Aj[n]]++; - } - - //cumsum the nnz per column to get Bp[] - for(I col = 0, cumsum = 0; col < n_col; col++){ - I temp = Bp[col]; - Bp[col] = cumsum; - cumsum += temp; - } - Bp[n_col] = nnz; - - for(I row = 0; row < n_row; row++){ - for(I jj = Ap[row]; jj < Ap[row+1]; jj++){ - I col = Aj[jj]; - I dest = Bp[col]; + //compute number of non-zero entries per column of A + std::fill(Bp, Bp + n_col, 0); - Bi[dest] = row; - Bx[dest] = Ax[jj]; + for (I n = 0; n < nnz; n++){ + Bp[Aj[n]]++; + } - Bp[col]++; + //cumsum the nnz per column to get Bp[] + for(I col = 0, cumsum = 0; col < n_col; col++){ + I temp = Bp[col]; + Bp[col] = cumsum; + cumsum += temp; } - } + Bp[n_col] = nnz; - for(I col = 0, last = 0; col <= n_col; col++){ - I temp = Bp[col]; - Bp[col] = last; - last = temp; - } + for(I row = 0; row < n_row; row++){ + for(I jj = Ap[row]; jj < Ap[row+1]; jj++){ + I col = Aj[jj]; + I dest = Bp[col]; + + Bi[dest] = row; + Bx[dest] = Ax[jj]; + + Bp[col]++; + } + } + + for(I col = 0, last = 0; col <= n_col; col++){ + I temp = Bp[col]; + Bp[col] = last; + last = temp; + } } @@ -240,37 +330,22 @@ const I Bj[], I Cp[]) { - std::vector next(n_col,-1); - + std::vector mask(n_col,-1); Cp[0] = 0; + I nnz = 0; for(I i = 0; i < n_row; i++){ - I head = -2; - I length = 0; - - I jj_start = Ap[i]; - I jj_end = Ap[i+1]; - for(I jj = jj_start; jj < jj_end; jj++){ + for(I jj = Ap[i]; jj < Ap[i+1]; jj++){ I j = Aj[jj]; - I kk_start = Bp[j]; - I kk_end = Bp[j+1]; - for(I kk = kk_start; kk < kk_end; kk++){ + for(I kk = Bp[j]; kk < Bp[j+1]; kk++){ I k = Bj[kk]; - if(next[k] == -1){ - next[k] = head; - head = k; - length++; + if(mask[k] != i){ + mask[k] = i; + nnz++; } } } - - for(I jj = 0; jj < length; jj++){ - I temp = head; - head = next[head]; - next[temp] = -1; - } - - Cp[i+1] = Cp[i] + length; + Cp[i+1] = nnz; } } @@ -299,7 +374,7 @@ Cp[0] = 0; for(I i = 0; i < n_row; i++){ - I head = -2; + I head = -2; I length = 0; I jj_start = Ap[i]; @@ -349,6 +424,129 @@ +template +void bsr_binop_bsr(const I n_brow, const I n_bcol, + const I R, const I C, + const I Ap[], const I Aj[], const T Ax[], + const I Bp[], const I Bj[], const T Bx[], + std::vector* Cp, + std::vector* Cj, + std::vector* Cx, + const bin_op& op) +{ + Cp->resize(n_brow + 1, 0); + + const I RC = R*C; + + std::vector next(n_bcol,-1); + std::vector A_row(n_bcol*RC, 0); + std::vector B_row(n_bcol*RC, 0); + + for(I i = 0; i < n_brow; i++){ + I head = -2; + I length = 0; + + //add a row of A to A_row + for(I jj = Ap[i]; jj < Ap[i+1]; jj++){ + I j = Aj[jj]; + + for(I n = 0; n < RC; n++) + A_row[RC*j + n] += Ax[RC*jj + n]; + + if(next[j] == -1){ + next[j] = head; + head = j; + length++; + } + } + + //add a row of B to B_row + for(I jj = Bp[i]; jj < Bp[i+1]; jj++){ + I j = Bj[jj]; + + for(I n = 0; n < RC; n++) + B_row[RC*j + n] += Bx[RC*jj + n]; + + if(next[j] == -1){ + next[j] = head; + head = j; + length++; + } + } + + + for(I jj = 0; jj < length; jj++){ + bool nonzero_block = false; + for(I n = 0; n < RC; n++){ + T result = op(A_row[RC*head + n],B_row[RC*head + n]); + A_row[RC*head + n] = result; + if(result != 0) + nonzero_block = true; + } + + + if(nonzero_block){ + Cj->push_back(head); + for(I n = 0; n < RC; n++){ + Cx->push_back(A_row[RC*head + n]); + } + } + + for(I n = 0; n < RC; n++){ + A_row[RC*head + n] = 0; + B_row[RC*head + n] = 0; + } + + I temp = head; + head = next[head]; + next[temp] = -1; + } + + (*Cp)[i+1] = Cj->size(); + } +} + +/* element-wise binary operations*/ +template +void bsr_elmul_bsr(const I n_row, const I n_col, const I R, const I C, + const I Ap [], const I Aj [], const T Ax [], + const I Bp [], const I Bj [], const T Bx [], + std::vector* Cp, std::vector* Cj, std::vector* Cx) +{ + bsr_binop_bsr(n_row,n_col,R,C,Ap,Aj,Ax,Bp,Bj,Bx,Cp,Cj,Cx,std::multiplies()); +} + +template +void bsr_eldiv_bsr(const I n_row, const I n_col, const I R, const I C, + const I Ap [], const I Aj [], const T Ax [], + const I Bp [], const I Bj [], const T Bx [], + std::vector* Cp, std::vector* Cj, std::vector* Cx) +{ + bsr_binop_bsr(n_row,n_col,R,C,Ap,Aj,Ax,Bp,Bj,Bx,Cp,Cj,Cx,std::divides()); +} + + +template +void bsr_plus_bsr(const I n_row, const I n_col, const I R, const I C, + const I Ap [], const I Aj [], const T Ax [], + const I Bp [], const I Bj [], const T Bx [], + std::vector* Cp, std::vector* Cj, std::vector* Cx) +{ + bsr_binop_bsr(n_row,n_col,R,C,Ap,Aj,Ax,Bp,Bj,Bx,Cp,Cj,Cx,std::plus()); +} + +template +void bsr_minus_bsr(const I n_row, const I n_col, const I R, const I C, + const I Ap [], const I Aj [], const T Ax [], + const I Bp [], const I Bj [], const T Bx [], + std::vector* Cp, std::vector* Cj, std::vector* Cx) +{ + bsr_binop_bsr(n_row,n_col,R,C,Ap,Aj,Ax,Bp,Bj,Bx,Cp,Cj,Cx,std::minus()); +} + + + + /* * Compute C = A (bin_op) B for CSR matrices A,B * @@ -392,65 +590,129 @@ std::vector* Cx, const bin_op& op) { - Cp->resize(n_row + 1, 0); - - std::vector next(n_col,-1); - std::vector A_row(n_col, 0); - std::vector B_row(n_col, 0); +// //Method that works for unsorted indices +// Cp->resize(n_row + 1, 0); +// (*Cp)[0] = 0; +// +// for(I i = 0; i < n_row; i++){ +// I A_pos = Ap[i]; +// I B_pos = Bp[i]; +// I A_end = Ap[i+1]; +// I B_end = Bp[i+1]; +// +// I A_j = Aj[A_pos]; +// I B_j = Bj[B_pos]; +// +// //while not finished with either row +// while(A_pos < A_end && B_pos < B_end){ +// if(A_j == B_j){ +// T result = op(Ax[A_pos],Bx[B_pos]); +// if(result != 0){ +// Cj->push_back(A_j); +// Cx->push_back(result); +// } +// A_j = Aj[++A_pos]; +// B_j = Bj[++B_pos]; +// } else if (A_j < B_j) { +// T result = op(Ax[A_pos],0); +// if (result != 0){ +// Cj->push_back(A_j); +// Cx->push_back(result); +// } +// A_j = Aj[++A_pos]; +// } else { +// //B_j < A_j +// T result = op(0,Bx[B_pos]); +// if (result != 0){ +// Cj->push_back(B_j); +// Cx->push_back(result); +// } +// B_j = Bj[++B_pos]; +// } +// } +// +// //tail +// while(A_pos < A_end){ +// T result = op(Ax[A_pos],0); +// if (result != 0){ +// Cj->push_back(A_j); +// Cx->push_back(result); +// } +// A_j = Aj[++A_pos]; +// } +// while(B_pos < B_end){ +// T result = op(0,Bx[B_pos]); +// if (result != 0){ +// Cj->push_back(B_j); +// Cx->push_back(result); +// } +// B_j = Bj[++B_pos]; +// } +// (*Cp)[i+1] = Cx->size(); +// } - for(I i = 0; i < n_row; i++){ - I head = -2; - I length = 0; - - //add a row of A to A_row - I i_start = Ap[i]; - I i_end = Ap[i+1]; - for(I jj = i_start; jj < i_end; jj++){ - I j = Aj[jj]; - A_row[j] += Ax[jj]; - - if(next[j] == -1){ - next[j] = head; - head = j; - length++; - } - } - - //add a row of B to B_row - i_start = Bp[i]; - i_end = Bp[i+1]; - for(I jj = i_start; jj < i_end; jj++){ - I j = Bj[jj]; + //Method that works for unsorted indices - B_row[j] += Bx[jj]; + Cp->resize(n_row + 1, 0); - if(next[j] == -1){ - next[j] = head; - head = j; - length++; - } - } + std::vector next(n_col,-1); + std::vector A_row(n_col, 0); + std::vector B_row(n_col, 0); + for(I i = 0; i < n_row; i++){ + I head = -2; + I length = 0; - for(I jj = 0; jj < length; jj++){ - T result = op(A_row[head],B_row[head]); - - if(result != 0){ - Cj->push_back(head); - Cx->push_back(result); - } - - I temp = head; - head = next[head]; - - next[temp] = -1; - A_row[temp] = 0; - B_row[temp] = 0; + //add a row of A to A_row + I i_start = Ap[i]; + I i_end = Ap[i+1]; + for(I jj = i_start; jj < i_end; jj++){ + I j = Aj[jj]; + + A_row[j] += Ax[jj]; + + if(next[j] == -1){ + next[j] = head; + head = j; + length++; + } + } + + //add a row of B to B_row + i_start = Bp[i]; + i_end = Bp[i+1]; + for(I jj = i_start; jj < i_end; jj++){ + I j = Bj[jj]; + + B_row[j] += Bx[jj]; + + if(next[j] == -1){ + next[j] = head; + head = j; + length++; + } + } + + + for(I jj = 0; jj < length; jj++){ + T result = op(A_row[head],B_row[head]); + + if(result != 0){ + Cj->push_back(head); + Cx->push_back(result); + } + + I temp = head; + head = next[head]; + + next[temp] = -1; + A_row[temp] = 0; + B_row[temp] = 0; + } + + (*Cp)[i+1] = Cj->size(); } - - (*Cp)[i+1] = Cx->size(); - } } /* element-wise binary operations*/ @@ -872,52 +1134,7 @@ -/* - * Sort CSR column indices inplace - * - * Input Arguments: - * I n_row - number of rows in A - * I n_col - number of columns in A - * I Ap[n_row+1] - row pointer - * I Aj[nnz(A)] - column indices - * T Ax[nnz(A)] - nonzeros - * - */ -template< class T1, class T2 > -bool kv_pair_less(const std::pair& x, const std::pair& y){ - return x.first < y.first; -} - template -void csr_sort_indices(const I n_row, - const I n_col, - const I Ap[], - I Aj[], - T Ax[]) -{ - std::vector< std::pair > temp; - - for(I i = 0; i < n_row; i++){ - I row_start = Ap[i]; - I row_end = Ap[i+1]; - - temp.clear(); - - for(I jj = row_start; jj < row_end; jj++){ - temp.push_back(std::make_pair(Aj[jj],Ax[jj])); - } - - std::sort(temp.begin(),temp.end(),kv_pair_less); - - for(I jj = row_start, n = 0; jj < row_end; jj++, n++){ - Aj[jj] = temp[n].first; - Ax[jj] = temp[n].second; - } - } -} - - -template void get_csr_submatrix(const I n_row, const I n_col, const I Ap[], Modified: trunk/scipy/sparse/sparsetools/sparsetools.i =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.i 2007-12-22 17:20:01 UTC (rev 3696) +++ trunk/scipy/sparse/sparsetools/sparsetools.i 2007-12-23 17:42:51 UTC (rev 3697) @@ -200,7 +200,12 @@ INSTANTIATE_ALL(coo_tocsr) INSTANTIATE_ALL(coo_tocsc) +/* + * CSR<->BSR + */ +%template(csr_count_blocks) csr_count_blocks; + /* * CSR*CSR and CSC*CSC */ @@ -229,10 +234,15 @@ INSTANTIATE_ALL(csc_plus_csc) INSTANTIATE_ALL(csc_minus_csc) +INSTANTIATE_ALL(bsr_elmul_bsr) +INSTANTIATE_ALL(bsr_eldiv_bsr) +INSTANTIATE_ALL(bsr_plus_bsr) +INSTANTIATE_ALL(bsr_minus_bsr) /* * Sort CSR/CSC indices. */ +%template(has_sorted_indices) has_sorted_indices; INSTANTIATE_ALL(csr_sort_indices) INSTANTIATE_ALL(csc_sort_indices) Modified: trunk/scipy/sparse/sparsetools/sparsetools.py =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.py 2007-12-22 17:20:01 UTC (rev 3696) +++ trunk/scipy/sparse/sparsetools/sparsetools.py 2007-12-23 17:42:51 UTC (rev 3697) @@ -53,6 +53,10 @@ """expandptr(int n_row, int Ap, int Bi)""" return _sparsetools.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 _sparsetools.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, @@ -67,7 +71,11 @@ """ return _sparsetools.csc_matmat_pass1(*args) +def has_sorted_indices(*args): + """has_sorted_indices(int n_row, int n_col, int Ap, int Aj) -> bool""" + return _sparsetools.has_sorted_indices(*args) + def csr_diagonal(*args): """ csr_diagonal(int n_row, int n_col, int Ap, int Aj, signed char Ax, @@ -597,6 +605,154 @@ """ return _sparsetools.csc_minus_csc(*args) +def bsr_elmul_bsr(*args): + """ + bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + signed char Ax, int Bp, int Bj, signed char Bx, + std::vector<(int)> Cp, std::vector<(int)> Cj, + std::vector<(signed char)> Cx) + bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + unsigned char Ax, int Bp, int Bj, unsigned char Bx, + std::vector<(int)> Cp, std::vector<(int)> Cj, + std::vector<(unsigned char)> Cx) + bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + short Ax, int Bp, int Bj, short Bx, std::vector<(int)> Cp, + std::vector<(int)> Cj, std::vector<(short)> Cx) + bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + int Ax, int Bp, int Bj, int Bx, std::vector<(int)> Cp, + std::vector<(int)> Cj, std::vector<(int)> Cx) + bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + long long Ax, int Bp, int Bj, long long Bx, + std::vector<(int)> Cp, std::vector<(int)> Cj, + std::vector<(long long)> Cx) + bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + float Ax, int Bp, int Bj, float Bx, std::vector<(int)> Cp, + std::vector<(int)> Cj, std::vector<(float)> Cx) + bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + double Ax, int Bp, int Bj, double Bx, std::vector<(int)> Cp, + std::vector<(int)> Cj, std::vector<(double)> Cx) + bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, + std::vector<(int)> Cp, std::vector<(int)> Cj, + std::vector<(npy_cfloat_wrapper)> Cx) + bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, + std::vector<(int)> Cp, std::vector<(int)> Cj, + std::vector<(npy_cdouble_wrapper)> Cx) + """ + return _sparsetools.bsr_elmul_bsr(*args) + +def bsr_eldiv_bsr(*args): + """ + bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + signed char Ax, int Bp, int Bj, signed char Bx, + std::vector<(int)> Cp, std::vector<(int)> Cj, + std::vector<(signed char)> Cx) + bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + unsigned char Ax, int Bp, int Bj, unsigned char Bx, + std::vector<(int)> Cp, std::vector<(int)> Cj, + std::vector<(unsigned char)> Cx) + bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + short Ax, int Bp, int Bj, short Bx, std::vector<(int)> Cp, + std::vector<(int)> Cj, std::vector<(short)> Cx) + bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + int Ax, int Bp, int Bj, int Bx, std::vector<(int)> Cp, + std::vector<(int)> Cj, std::vector<(int)> Cx) + bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + long long Ax, int Bp, int Bj, long long Bx, + std::vector<(int)> Cp, std::vector<(int)> Cj, + std::vector<(long long)> Cx) + bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + float Ax, int Bp, int Bj, float Bx, std::vector<(int)> Cp, + std::vector<(int)> Cj, std::vector<(float)> Cx) + bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + double Ax, int Bp, int Bj, double Bx, std::vector<(int)> Cp, + std::vector<(int)> Cj, std::vector<(double)> Cx) + bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, + std::vector<(int)> Cp, std::vector<(int)> Cj, + std::vector<(npy_cfloat_wrapper)> Cx) + bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, + std::vector<(int)> Cp, std::vector<(int)> Cj, + std::vector<(npy_cdouble_wrapper)> Cx) + """ + return _sparsetools.bsr_eldiv_bsr(*args) + +def bsr_plus_bsr(*args): + """ + bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + signed char Ax, int Bp, int Bj, signed char Bx, + std::vector<(int)> Cp, std::vector<(int)> Cj, + std::vector<(signed char)> Cx) + bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + unsigned char Ax, int Bp, int Bj, unsigned char Bx, + std::vector<(int)> Cp, std::vector<(int)> Cj, + std::vector<(unsigned char)> Cx) + bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + short Ax, int Bp, int Bj, short Bx, std::vector<(int)> Cp, + std::vector<(int)> Cj, std::vector<(short)> Cx) + bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + int Ax, int Bp, int Bj, int Bx, std::vector<(int)> Cp, + std::vector<(int)> Cj, std::vector<(int)> Cx) + bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + long long Ax, int Bp, int Bj, long long Bx, + std::vector<(int)> Cp, std::vector<(int)> Cj, + std::vector<(long long)> Cx) + bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + float Ax, int Bp, int Bj, float Bx, std::vector<(int)> Cp, + std::vector<(int)> Cj, std::vector<(float)> Cx) + bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + double Ax, int Bp, int Bj, double Bx, std::vector<(int)> Cp, + std::vector<(int)> Cj, std::vector<(double)> Cx) + bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, + std::vector<(int)> Cp, std::vector<(int)> Cj, + std::vector<(npy_cfloat_wrapper)> Cx) + bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, + std::vector<(int)> Cp, std::vector<(int)> Cj, + std::vector<(npy_cdouble_wrapper)> Cx) + """ + return _sparsetools.bsr_plus_bsr(*args) + +def bsr_minus_bsr(*args): + """ + bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + signed char Ax, int Bp, int Bj, signed char Bx, + std::vector<(int)> Cp, std::vector<(int)> Cj, + std::vector<(signed char)> Cx) + bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + unsigned char Ax, int Bp, int Bj, unsigned char Bx, + std::vector<(int)> Cp, std::vector<(int)> Cj, + std::vector<(unsigned char)> Cx) + bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + short Ax, int Bp, int Bj, short Bx, std::vector<(int)> Cp, + std::vector<(int)> Cj, std::vector<(short)> Cx) + bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + int Ax, int Bp, int Bj, int Bx, std::vector<(int)> Cp, + std::vector<(int)> Cj, std::vector<(int)> Cx) + bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + long long Ax, int Bp, int Bj, long long Bx, + std::vector<(int)> Cp, std::vector<(int)> Cj, + std::vector<(long long)> Cx) + bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + float Ax, int Bp, int Bj, float Bx, std::vector<(int)> Cp, + std::vector<(int)> Cj, std::vector<(float)> Cx) + bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + double Ax, int Bp, int Bj, double Bx, std::vector<(int)> Cp, + std::vector<(int)> Cj, std::vector<(double)> Cx) + bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, + std::vector<(int)> Cp, std::vector<(int)> Cj, + std::vector<(npy_cfloat_wrapper)> Cx) + bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, + std::vector<(int)> Cp, std::vector<(int)> Cj, + std::vector<(npy_cdouble_wrapper)> Cx) + """ + return _sparsetools.bsr_minus_bsr(*args) + def csr_sort_indices(*args): """ csr_sort_indices(int n_row, int n_col, int Ap, int Aj, signed char Ax) Modified: trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx 2007-12-22 17:20:01 UTC (rev 3696) +++ trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx 2007-12-23 17:42:51 UTC (rev 3697) @@ -3077,6 +3077,23 @@ return res; } + + #define SWIG_From_long PyInt_FromLong + + +SWIGINTERNINLINE PyObject * +SWIG_From_int (int value) +{ + return SWIG_From_long (value); +} + + +SWIGINTERNINLINE PyObject* + SWIG_From_bool (bool value) +{ + return PyBool_FromLong(value ? 1 : 0); +} + #ifdef __cplusplus extern "C" { #endif @@ -11673,6 +11690,95 @@ } +SWIGINTERN PyObject *_wrap_csr_count_blocks(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + int result; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int val3 ; + int ecode3 = 0 ; + int val4 ; + int ecode4 = 0 ; + PyArrayObject *array5 = NULL ; + int is_new_object5 ; + PyArrayObject *array6 = NULL ; + int is_new_object6 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + + 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_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_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 + }; + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + result = (int)csr_count_blocks(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6); + resultobj = SWIG_From_int(static_cast< int >(result)); + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + return NULL; +} + + SWIGINTERN PyObject *_wrap_csr_matmat_pass1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; @@ -37843,6 +37949,9685 @@ } +SWIGINTERN PyObject *_wrap_bsr_elmul_bsr__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + signed char *arg7 ; + int *arg8 ; + int *arg9 ; + signed char *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_BYTE, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (signed char*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_BYTE, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (signed char*) array10->data; + } + bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(signed char const (*))arg7,(int const (*))arg8,(int const (*))arg9,(signed char const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(signed char)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_elmul_bsr__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + unsigned char *arg7 ; + int *arg8 ; + int *arg9 ; + unsigned char *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_UBYTE, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (unsigned char*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_UBYTE, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (unsigned char*) array10->data; + } + bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(unsigned char const (*))arg7,(int const (*))arg8,(int const (*))arg9,(unsigned char const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(unsigned char)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_elmul_bsr__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + short *arg7 ; + int *arg8 ; + int *arg9 ; + short *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_SHORT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (short*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_SHORT, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (short*) array10->data; + } + bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(short const (*))arg7,(int const (*))arg8,(int const (*))arg9,(short const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(short)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_elmul_bsr__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + int *arg7 ; + int *arg8 ; + int *arg9 ; + int *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_INT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (int*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_INT, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (int*) array10->data; + } + bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,(int const (*))arg9,(int const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(int)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_elmul_bsr__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + long long *arg7 ; + int *arg8 ; + int *arg9 ; + long long *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_LONGLONG, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (long long*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_LONGLONG, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (long long*) array10->data; + } + bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(long long const (*))arg7,(int const (*))arg8,(int const (*))arg9,(long long const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(long long)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_elmul_bsr__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + float *arg7 ; + int *arg8 ; + int *arg9 ; + float *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_FLOAT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (float*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_FLOAT, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (float*) array10->data; + } + bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(float const (*))arg7,(int const (*))arg8,(int const (*))arg9,(float const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(float)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_elmul_bsr__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + double *arg7 ; + int *arg8 ; + int *arg9 ; + double *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_DOUBLE, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (double*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_DOUBLE, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (double*) array10->data; + } + bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(double const (*))arg7,(int const (*))arg8,(int const (*))arg9,(double const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(double)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_elmul_bsr__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + npy_cfloat_wrapper *arg7 ; + int *arg8 ; + int *arg9 ; + npy_cfloat_wrapper *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_CFLOAT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (npy_cfloat_wrapper*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_CFLOAT, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (npy_cfloat_wrapper*) array10->data; + } + bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(npy_cfloat_wrapper const (*))arg7,(int const (*))arg8,(int const (*))arg9,(npy_cfloat_wrapper const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(npy_cfloat_wrapper)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_elmul_bsr__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + npy_cdouble_wrapper *arg7 ; + int *arg8 ; + int *arg9 ; + npy_cdouble_wrapper *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', 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 '" "bsr_elmul_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_CDOUBLE, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (npy_cdouble_wrapper*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_CDOUBLE, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (npy_cdouble_wrapper*) array10->data; + } + bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(npy_cdouble_wrapper const (*))arg7,(int const (*))arg8,(int const (*))arg9,(npy_cdouble_wrapper const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(npy_cdouble_wrapper)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_elmul_bsr(PyObject *self, PyObject *args) { + int argc; + PyObject *argv[11]; + int ii; + + if (!PyTuple_Check(args)) SWIG_fail; + argc = (int)PyObject_Length(args); + for (ii = 0; (ii < argc) && (ii < 10); ii++) { + argv[ii] = PyTuple_GET_ITEM(args,ii); + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_elmul_bsr__SWIG_1(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_elmul_bsr__SWIG_2(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_elmul_bsr__SWIG_3(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_elmul_bsr__SWIG_4(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_elmul_bsr__SWIG_5(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_elmul_bsr__SWIG_6(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_elmul_bsr__SWIG_7(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_elmul_bsr__SWIG_8(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_elmul_bsr__SWIG_9(self, args); + } + } + } + } + } + } + } + } + } + } + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_elmul_bsr'.\n Possible C/C++ prototypes are:\n"" bsr_elmul_bsr<(int,signed char)>(int const,int const,int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],std::vector *,std::vector *,std::vector *)\n"" bsr_elmul_bsr<(int,unsigned char)>(int const,int const,int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],std::vector *,std::vector *,std::vector *)\n"" bsr_elmul_bsr<(int,short)>(int const,int const,int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],std::vector *,std::vector *,std::vector *)\n"" bsr_elmul_bsr<(int,int)>(int const,int const,int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],std::vector *,std::vector *,std::vector *)\n"" bsr_elmul_bsr<(int,long long)>(int const,int const,int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],std::vector *,std::vector *,std::vector *)\n"" bsr_elmul_bsr<(int,float)>(int const,int const,int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" bsr_elmul_bsr<(int,double)>(int const,int const,int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"" bsr_elmul_bsr<(int,npy_cfloat_wrapper)>(int const,int const,int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],std::vector *,std::vector *,std::vector *)\n"" bsr_elmul_bsr<(int,npy_cdouble_wrapper)>(int const,int const,int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],std::vector *,std::vector *,std::vector *)\n"); + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_eldiv_bsr__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + signed char *arg7 ; + int *arg8 ; + int *arg9 ; + signed char *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_BYTE, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (signed char*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_BYTE, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (signed char*) array10->data; + } + bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(signed char const (*))arg7,(int const (*))arg8,(int const (*))arg9,(signed char const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(signed char)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_eldiv_bsr__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + unsigned char *arg7 ; + int *arg8 ; + int *arg9 ; + unsigned char *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_UBYTE, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (unsigned char*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_UBYTE, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (unsigned char*) array10->data; + } + bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(unsigned char const (*))arg7,(int const (*))arg8,(int const (*))arg9,(unsigned char const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(unsigned char)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_eldiv_bsr__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + short *arg7 ; + int *arg8 ; + int *arg9 ; + short *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_SHORT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (short*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_SHORT, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (short*) array10->data; + } + bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(short const (*))arg7,(int const (*))arg8,(int const (*))arg9,(short const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(short)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_eldiv_bsr__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + int *arg7 ; + int *arg8 ; + int *arg9 ; + int *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_INT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (int*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_INT, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (int*) array10->data; + } + bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,(int const (*))arg9,(int const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(int)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_eldiv_bsr__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + long long *arg7 ; + int *arg8 ; + int *arg9 ; + long long *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_LONGLONG, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (long long*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_LONGLONG, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (long long*) array10->data; + } + bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(long long const (*))arg7,(int const (*))arg8,(int const (*))arg9,(long long const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(long long)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_eldiv_bsr__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + float *arg7 ; + int *arg8 ; + int *arg9 ; + float *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_FLOAT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (float*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_FLOAT, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (float*) array10->data; + } + bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(float const (*))arg7,(int const (*))arg8,(int const (*))arg9,(float const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(float)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_eldiv_bsr__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + double *arg7 ; + int *arg8 ; + int *arg9 ; + double *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_DOUBLE, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (double*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_DOUBLE, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (double*) array10->data; + } + bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(double const (*))arg7,(int const (*))arg8,(int const (*))arg9,(double const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(double)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_eldiv_bsr__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + npy_cfloat_wrapper *arg7 ; + int *arg8 ; + int *arg9 ; + npy_cfloat_wrapper *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_CFLOAT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (npy_cfloat_wrapper*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_CFLOAT, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (npy_cfloat_wrapper*) array10->data; + } + bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(npy_cfloat_wrapper const (*))arg7,(int const (*))arg8,(int const (*))arg9,(npy_cfloat_wrapper const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(npy_cfloat_wrapper)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_eldiv_bsr__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + npy_cdouble_wrapper *arg7 ; + int *arg8 ; + int *arg9 ; + npy_cdouble_wrapper *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', 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 '" "bsr_eldiv_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_CDOUBLE, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (npy_cdouble_wrapper*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_CDOUBLE, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (npy_cdouble_wrapper*) array10->data; + } + bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(npy_cdouble_wrapper const (*))arg7,(int const (*))arg8,(int const (*))arg9,(npy_cdouble_wrapper const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(npy_cdouble_wrapper)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_eldiv_bsr(PyObject *self, PyObject *args) { + int argc; + PyObject *argv[11]; + int ii; + + if (!PyTuple_Check(args)) SWIG_fail; + argc = (int)PyObject_Length(args); + for (ii = 0; (ii < argc) && (ii < 10); ii++) { + argv[ii] = PyTuple_GET_ITEM(args,ii); + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_eldiv_bsr__SWIG_1(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_eldiv_bsr__SWIG_2(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_eldiv_bsr__SWIG_3(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_eldiv_bsr__SWIG_4(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_eldiv_bsr__SWIG_5(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_eldiv_bsr__SWIG_6(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_eldiv_bsr__SWIG_7(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_eldiv_bsr__SWIG_8(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_eldiv_bsr__SWIG_9(self, args); + } + } + } + } + } + } + } + } + } + } + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_eldiv_bsr'.\n Possible C/C++ prototypes are:\n"" bsr_eldiv_bsr<(int,signed char)>(int const,int const,int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],std::vector *,std::vector *,std::vector *)\n"" bsr_eldiv_bsr<(int,unsigned char)>(int const,int const,int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],std::vector *,std::vector *,std::vector *)\n"" bsr_eldiv_bsr<(int,short)>(int const,int const,int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],std::vector *,std::vector *,std::vector *)\n"" bsr_eldiv_bsr<(int,int)>(int const,int const,int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],std::vector *,std::vector *,std::vector *)\n"" bsr_eldiv_bsr<(int,long long)>(int const,int const,int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],std::vector *,std::vector *,std::vector *)\n"" bsr_eldiv_bsr<(int,float)>(int const,int const,int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" bsr_eldiv_bsr<(int,double)>(int const,int const,int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"" bsr_eldiv_bsr<(int,npy_cfloat_wrapper)>(int const,int const,int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],std::vector *,std::vector *,std::vector *)\n"" bsr_eldiv_bsr<(int,npy_cdouble_wrapper)>(int const,int const,int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],std::vector *,std::vector *,std::vector *)\n"); + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_plus_bsr__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + signed char *arg7 ; + int *arg8 ; + int *arg9 ; + signed char *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_BYTE, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (signed char*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_BYTE, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (signed char*) array10->data; + } + bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(signed char const (*))arg7,(int const (*))arg8,(int const (*))arg9,(signed char const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(signed char)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_plus_bsr__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + unsigned char *arg7 ; + int *arg8 ; + int *arg9 ; + unsigned char *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_UBYTE, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (unsigned char*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_UBYTE, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (unsigned char*) array10->data; + } + bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(unsigned char const (*))arg7,(int const (*))arg8,(int const (*))arg9,(unsigned char const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(unsigned char)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_plus_bsr__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + short *arg7 ; + int *arg8 ; + int *arg9 ; + short *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_SHORT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (short*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_SHORT, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (short*) array10->data; + } + bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(short const (*))arg7,(int const (*))arg8,(int const (*))arg9,(short const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(short)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_plus_bsr__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + int *arg7 ; + int *arg8 ; + int *arg9 ; + int *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_INT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (int*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_INT, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (int*) array10->data; + } + bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,(int const (*))arg9,(int const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(int)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_plus_bsr__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + long long *arg7 ; + int *arg8 ; + int *arg9 ; + long long *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_LONGLONG, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (long long*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_LONGLONG, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (long long*) array10->data; + } + bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(long long const (*))arg7,(int const (*))arg8,(int const (*))arg9,(long long const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(long long)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_plus_bsr__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + float *arg7 ; + int *arg8 ; + int *arg9 ; + float *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_FLOAT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (float*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_FLOAT, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (float*) array10->data; + } + bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(float const (*))arg7,(int const (*))arg8,(int const (*))arg9,(float const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(float)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_plus_bsr__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + double *arg7 ; + int *arg8 ; + int *arg9 ; + double *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_DOUBLE, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (double*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_DOUBLE, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (double*) array10->data; + } + bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(double const (*))arg7,(int const (*))arg8,(int const (*))arg9,(double const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(double)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_plus_bsr__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + npy_cfloat_wrapper *arg7 ; + int *arg8 ; + int *arg9 ; + npy_cfloat_wrapper *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_CFLOAT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (npy_cfloat_wrapper*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_CFLOAT, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (npy_cfloat_wrapper*) array10->data; + } + bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(npy_cfloat_wrapper const (*))arg7,(int const (*))arg8,(int const (*))arg9,(npy_cfloat_wrapper const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(npy_cfloat_wrapper)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_plus_bsr__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + npy_cdouble_wrapper *arg7 ; + int *arg8 ; + int *arg9 ; + npy_cdouble_wrapper *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', 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 '" "bsr_plus_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_CDOUBLE, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (npy_cdouble_wrapper*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_CDOUBLE, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (npy_cdouble_wrapper*) array10->data; + } + bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(npy_cdouble_wrapper const (*))arg7,(int const (*))arg8,(int const (*))arg9,(npy_cdouble_wrapper const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(npy_cdouble_wrapper)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_plus_bsr(PyObject *self, PyObject *args) { + int argc; + PyObject *argv[11]; + int ii; + + if (!PyTuple_Check(args)) SWIG_fail; + argc = (int)PyObject_Length(args); + for (ii = 0; (ii < argc) && (ii < 10); ii++) { + argv[ii] = PyTuple_GET_ITEM(args,ii); + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_plus_bsr__SWIG_1(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_plus_bsr__SWIG_2(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_plus_bsr__SWIG_3(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_plus_bsr__SWIG_4(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_plus_bsr__SWIG_5(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_plus_bsr__SWIG_6(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_plus_bsr__SWIG_7(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_plus_bsr__SWIG_8(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_plus_bsr__SWIG_9(self, args); + } + } + } + } + } + } + } + } + } + } + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_plus_bsr'.\n Possible C/C++ prototypes are:\n"" bsr_plus_bsr<(int,signed char)>(int const,int const,int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],std::vector *,std::vector *,std::vector *)\n"" bsr_plus_bsr<(int,unsigned char)>(int const,int const,int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],std::vector *,std::vector *,std::vector *)\n"" bsr_plus_bsr<(int,short)>(int const,int const,int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],std::vector *,std::vector *,std::vector *)\n"" bsr_plus_bsr<(int,int)>(int const,int const,int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],std::vector *,std::vector *,std::vector *)\n"" bsr_plus_bsr<(int,long long)>(int const,int const,int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],std::vector *,std::vector *,std::vector *)\n"" bsr_plus_bsr<(int,float)>(int const,int const,int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" bsr_plus_bsr<(int,double)>(int const,int const,int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"" bsr_plus_bsr<(int,npy_cfloat_wrapper)>(int const,int const,int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],std::vector *,std::vector *,std::vector *)\n"" bsr_plus_bsr<(int,npy_cdouble_wrapper)>(int const,int const,int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],std::vector *,std::vector *,std::vector *)\n"); + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_minus_bsr__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + signed char *arg7 ; + int *arg8 ; + int *arg9 ; + signed char *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_BYTE, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (signed char*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_BYTE, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (signed char*) array10->data; + } + bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(signed char const (*))arg7,(int const (*))arg8,(int const (*))arg9,(signed char const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(signed char)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_minus_bsr__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + unsigned char *arg7 ; + int *arg8 ; + int *arg9 ; + unsigned char *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_UBYTE, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (unsigned char*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_UBYTE, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (unsigned char*) array10->data; + } + bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(unsigned char const (*))arg7,(int const (*))arg8,(int const (*))arg9,(unsigned char const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(unsigned char)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_minus_bsr__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + short *arg7 ; + int *arg8 ; + int *arg9 ; + short *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_SHORT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (short*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_SHORT, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (short*) array10->data; + } + bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(short const (*))arg7,(int const (*))arg8,(int const (*))arg9,(short const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(short)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_minus_bsr__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + int *arg7 ; + int *arg8 ; + int *arg9 ; + int *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_INT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (int*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_INT, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (int*) array10->data; + } + bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,(int const (*))arg9,(int const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(int)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_minus_bsr__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + long long *arg7 ; + int *arg8 ; + int *arg9 ; + long long *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_LONGLONG, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (long long*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_LONGLONG, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (long long*) array10->data; + } + bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(long long const (*))arg7,(int const (*))arg8,(int const (*))arg9,(long long const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(long long)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_minus_bsr__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + float *arg7 ; + int *arg8 ; + int *arg9 ; + float *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_FLOAT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (float*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_FLOAT, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (float*) array10->data; + } + bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(float const (*))arg7,(int const (*))arg8,(int const (*))arg9,(float const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(float)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_minus_bsr__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + double *arg7 ; + int *arg8 ; + int *arg9 ; + double *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_DOUBLE, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (double*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_DOUBLE, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (double*) array10->data; + } + bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(double const (*))arg7,(int const (*))arg8,(int const (*))arg9,(double const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(double)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_minus_bsr__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + npy_cfloat_wrapper *arg7 ; + int *arg8 ; + int *arg9 ; + npy_cfloat_wrapper *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_CFLOAT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (npy_cfloat_wrapper*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_CFLOAT, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (npy_cfloat_wrapper*) array10->data; + } + bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(npy_cfloat_wrapper const (*))arg7,(int const (*))arg8,(int const (*))arg9,(npy_cfloat_wrapper const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(npy_cfloat_wrapper)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_minus_bsr__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int *arg5 ; + int *arg6 ; + npy_cdouble_wrapper *arg7 ; + int *arg8 ; + int *arg9 ; + npy_cdouble_wrapper *arg10 ; + std::vector *arg11 = (std::vector *) 0 ; + std::vector *arg12 = (std::vector *) 0 ; + std::vector *arg13 = (std::vector *) 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + 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 *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + std::vector *tmp11 ; + std::vector *tmp12 ; + std::vector *tmp13 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + + { + tmp11 = new std::vector(); + arg11 = tmp11; + } + { + tmp12 = new std::vector(); + arg12 = tmp12; + } + { + tmp13 = new std::vector(); + arg13 = tmp13; + } + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', 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 '" "bsr_minus_bsr" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + { + 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; + + arg5 = (int*) array5->data; + } + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_CDOUBLE, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (npy_cdouble_wrapper*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_CDOUBLE, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (npy_cdouble_wrapper*) array10->data; + } + bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(npy_cdouble_wrapper const (*))arg7,(int const (*))arg8,(int const (*))arg9,(npy_cdouble_wrapper const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); + { + int length = (arg11)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); + delete arg11; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg12)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); + memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); + delete arg12; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + int length = (arg13)->size(); + PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); + memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(npy_cdouble_wrapper)*length); + delete arg13; + resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + } + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return resultobj; +fail: + { + if (is_new_object5 && array5) Py_DECREF(array5); + } + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_minus_bsr(PyObject *self, PyObject *args) { + int argc; + PyObject *argv[11]; + int ii; + + if (!PyTuple_Check(args)) SWIG_fail; + argc = (int)PyObject_Length(args); + for (ii = 0; (ii < argc) && (ii < 10); ii++) { + argv[ii] = PyTuple_GET_ITEM(args,ii); + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_minus_bsr__SWIG_1(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_minus_bsr__SWIG_2(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_minus_bsr__SWIG_3(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_minus_bsr__SWIG_4(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_minus_bsr__SWIG_5(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_minus_bsr__SWIG_6(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_minus_bsr__SWIG_7(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_minus_bsr__SWIG_8(self, args); + } + } + } + } + } + } + } + } + } + } + } + if (argc == 10) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_minus_bsr__SWIG_9(self, args); + } + } + } + } + } + } + } + } + } + } + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_minus_bsr'.\n Possible C/C++ prototypes are:\n"" bsr_minus_bsr<(int,signed char)>(int const,int const,int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],std::vector *,std::vector *,std::vector *)\n"" bsr_minus_bsr<(int,unsigned char)>(int const,int const,int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],std::vector *,std::vector *,std::vector *)\n"" bsr_minus_bsr<(int,short)>(int const,int const,int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],std::vector *,std::vector *,std::vector *)\n"" bsr_minus_bsr<(int,int)>(int const,int const,int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],std::vector *,std::vector *,std::vector *)\n"" bsr_minus_bsr<(int,long long)>(int const,int const,int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],std::vector *,std::vector *,std::vector *)\n"" bsr_minus_bsr<(int,float)>(int const,int const,int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" bsr_minus_bsr<(int,double)>(int const,int const,int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"" bsr_minus_bsr<(int,npy_cfloat_wrapper)>(int const,int const,int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],std::vector *,std::vector *,std::vector *)\n"" bsr_minus_bsr<(int,npy_cdouble_wrapper)>(int const,int const,int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],std::vector *,std::vector *,std::vector *)\n"); + return NULL; +} + + +SWIGINTERN PyObject *_wrap_has_sorted_indices(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int *arg3 ; + int *arg4 ; + bool result; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyArrayObject *array3 = NULL ; + int is_new_object3 ; + PyArrayObject *array4 = NULL ; + int is_new_object4 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOO:has_sorted_indices",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "has_sorted_indices" "', argument " "1"" of type '" "int""'"); + } + arg1 = static_cast< int >(val1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "has_sorted_indices" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + { + npy_intp size[1] = { + -1 + }; + array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); + if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) + || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; + + 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; + } + result = (bool)has_sorted_indices(arg1,arg2,(int const (*))arg3,(int const (*))arg4); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + { + if (is_new_object3 && array3) Py_DECREF(array3); + } + { + if (is_new_object4 && array4) Py_DECREF(array4); + } + return resultobj; +fail: + { + if (is_new_object3 && array3) Py_DECREF(array3); + } + { + if (is_new_object4 && array4) Py_DECREF(array4); + } + return NULL; +} + + SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; @@ -43298,6 +53083,7 @@ "coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cdouble_wrapper Ax, \n" " int Bp, int Bi, npy_cdouble_wrapper Bx)\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_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" @@ -43666,6 +53452,143 @@ " std::vector<(int)> Cp, std::vector<(int)> Ci, \n" " std::vector<(npy_cdouble_wrapper)> Cx)\n" ""}, + { (char *)"bsr_elmul_bsr", _wrap_bsr_elmul_bsr, METH_VARARGS, (char *)"\n" + "bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " signed char Ax, int Bp, int Bj, signed char Bx, \n" + " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" + " std::vector<(signed char)> Cx)\n" + "bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " unsigned char Ax, int Bp, int Bj, unsigned char Bx, \n" + " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" + " std::vector<(unsigned char)> Cx)\n" + "bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " short Ax, int Bp, int Bj, short Bx, std::vector<(int)> Cp, \n" + " std::vector<(int)> Cj, std::vector<(short)> Cx)\n" + "bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " int Ax, int Bp, int Bj, int Bx, std::vector<(int)> Cp, \n" + " std::vector<(int)> Cj, std::vector<(int)> Cx)\n" + "bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " long long Ax, int Bp, int Bj, long long Bx, \n" + " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" + " std::vector<(long long)> Cx)\n" + "bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " float Ax, int Bp, int Bj, float Bx, std::vector<(int)> Cp, \n" + " std::vector<(int)> Cj, std::vector<(float)> Cx)\n" + "bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " double Ax, int Bp, int Bj, double Bx, std::vector<(int)> Cp, \n" + " std::vector<(int)> Cj, std::vector<(double)> Cx)\n" + "bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, \n" + " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" + " std::vector<(npy_cfloat_wrapper)> Cx)\n" + "bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, \n" + " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" + " std::vector<(npy_cdouble_wrapper)> Cx)\n" + ""}, + { (char *)"bsr_eldiv_bsr", _wrap_bsr_eldiv_bsr, METH_VARARGS, (char *)"\n" + "bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " signed char Ax, int Bp, int Bj, signed char Bx, \n" + " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" + " std::vector<(signed char)> Cx)\n" + "bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " unsigned char Ax, int Bp, int Bj, unsigned char Bx, \n" + " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" + " std::vector<(unsigned char)> Cx)\n" + "bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " short Ax, int Bp, int Bj, short Bx, std::vector<(int)> Cp, \n" + " std::vector<(int)> Cj, std::vector<(short)> Cx)\n" + "bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " int Ax, int Bp, int Bj, int Bx, std::vector<(int)> Cp, \n" + " std::vector<(int)> Cj, std::vector<(int)> Cx)\n" + "bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " long long Ax, int Bp, int Bj, long long Bx, \n" + " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" + " std::vector<(long long)> Cx)\n" + "bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " float Ax, int Bp, int Bj, float Bx, std::vector<(int)> Cp, \n" + " std::vector<(int)> Cj, std::vector<(float)> Cx)\n" + "bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " double Ax, int Bp, int Bj, double Bx, std::vector<(int)> Cp, \n" + " std::vector<(int)> Cj, std::vector<(double)> Cx)\n" + "bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, \n" + " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" + " std::vector<(npy_cfloat_wrapper)> Cx)\n" + "bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, \n" + " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" + " std::vector<(npy_cdouble_wrapper)> Cx)\n" + ""}, + { (char *)"bsr_plus_bsr", _wrap_bsr_plus_bsr, METH_VARARGS, (char *)"\n" + "bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " signed char Ax, int Bp, int Bj, signed char Bx, \n" + " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" + " std::vector<(signed char)> Cx)\n" + "bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " unsigned char Ax, int Bp, int Bj, unsigned char Bx, \n" + " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" + " std::vector<(unsigned char)> Cx)\n" + "bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " short Ax, int Bp, int Bj, short Bx, std::vector<(int)> Cp, \n" + " std::vector<(int)> Cj, std::vector<(short)> Cx)\n" + "bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " int Ax, int Bp, int Bj, int Bx, std::vector<(int)> Cp, \n" + " std::vector<(int)> Cj, std::vector<(int)> Cx)\n" + "bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " long long Ax, int Bp, int Bj, long long Bx, \n" + " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" + " std::vector<(long long)> Cx)\n" + "bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " float Ax, int Bp, int Bj, float Bx, std::vector<(int)> Cp, \n" + " std::vector<(int)> Cj, std::vector<(float)> Cx)\n" + "bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " double Ax, int Bp, int Bj, double Bx, std::vector<(int)> Cp, \n" + " std::vector<(int)> Cj, std::vector<(double)> Cx)\n" + "bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, \n" + " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" + " std::vector<(npy_cfloat_wrapper)> Cx)\n" + "bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, \n" + " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" + " std::vector<(npy_cdouble_wrapper)> Cx)\n" + ""}, + { (char *)"bsr_minus_bsr", _wrap_bsr_minus_bsr, METH_VARARGS, (char *)"\n" + "bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " signed char Ax, int Bp, int Bj, signed char Bx, \n" + " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" + " std::vector<(signed char)> Cx)\n" + "bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " unsigned char Ax, int Bp, int Bj, unsigned char Bx, \n" + " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" + " std::vector<(unsigned char)> Cx)\n" + "bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " short Ax, int Bp, int Bj, short Bx, std::vector<(int)> Cp, \n" + " std::vector<(int)> Cj, std::vector<(short)> Cx)\n" + "bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " int Ax, int Bp, int Bj, int Bx, std::vector<(int)> Cp, \n" + " std::vector<(int)> Cj, std::vector<(int)> Cx)\n" + "bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " long long Ax, int Bp, int Bj, long long Bx, \n" + " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" + " std::vector<(long long)> Cx)\n" + "bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " float Ax, int Bp, int Bj, float Bx, std::vector<(int)> Cp, \n" + " std::vector<(int)> Cj, std::vector<(float)> Cx)\n" + "bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " double Ax, int Bp, int Bj, double Bx, std::vector<(int)> Cp, \n" + " std::vector<(int)> Cj, std::vector<(double)> Cx)\n" + "bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, \n" + " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" + " std::vector<(npy_cfloat_wrapper)> Cx)\n" + "bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" + " npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, \n" + " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" + " std::vector<(npy_cdouble_wrapper)> Cx)\n" + ""}, + { (char *)"has_sorted_indices", _wrap_has_sorted_indices, METH_VARARGS, (char *)"has_sorted_indices(int n_row, int n_col, int Ap, int Aj) -> bool"}, { (char *)"csr_sort_indices", _wrap_csr_sort_indices, METH_VARARGS, (char *)"\n" "csr_sort_indices(int n_row, int n_col, int Ap, int Aj, signed char Ax)\n" "csr_sort_indices(int n_row, int n_col, int Ap, int Aj, unsigned char Ax)\n" Modified: trunk/scipy/sparse/spfuncs.py =================================================================== --- trunk/scipy/sparse/spfuncs.py 2007-12-22 17:20:01 UTC (rev 3696) +++ trunk/scipy/sparse/spfuncs.py 2007-12-23 17:42:51 UTC (rev 3697) @@ -1,16 +1,17 @@ """ Functions that operate on sparse matrices """ -__all__ = ['extract_diagonal'] +__all__ = ['extract_diagonal','count_blocks','estimate_blocksize'] from numpy import empty from base import isspmatrix -from csr import isspmatrix_csr +from csr import isspmatrix_csr, csr_matrix from csc import isspmatrix_csc from sputils import upcast import sparsetools +from sparsetools import csr_count_blocks def extract_diagonal(A): """ @@ -28,4 +29,67 @@ raise ValueError,'expected sparse matrix' +def estimate_blocksize(A,efficiency=0.7): + """Attempt to determine the blocksize of a sparse matrix + Returns a blocksize=(r,c) such that + A.nnz / A.tobsr( (r,c) ).nnz > efficiency + """ + if not (isspmatrix_csr(A) or isspmatrix_csc(A)): + A = csr_matrix(A) + + if not 0 < efficiency < 1.0: + raise ValueError,'efficiency must satisfy 0.0 < efficiency < 1.0' + + high_efficiency = (1.0 + efficiency) / 2.0 + nnz = float(A.nnz) + M,N = A.shape + + if M % 2 == 0 and N % 2 == 0: + e22 = nnz / ( 4 * count_blocks(A,(2,2)) ) + else: + e22 = 0.0 + + if M % 3 == 0 and N % 3 == 0: + e33 = nnz / ( 9 * count_blocks(A,(3,3)) ) + else: + e33 = 0.0 + + + if e22 > high_efficiency and e33 > high_efficiency: + e66 = nnz / ( 36 * count_blocks(A,(6,6)) ) + if e66 > efficiency: + return (6,6) + else: + return (3,3) + else: + if M % 4 == 0 and N % 4 == 0: + e44 = nnz / ( 16 * count_blocks(A,(4,4)) ) + else: + e44 = 0.0 + + if e44 > efficiency: + return (4,4) + elif e33 > efficiency: + return (3,3) + elif e22 > efficiency: + return (2,2) + else: + return (1,1) + +def count_blocks(A,blocksize): + """For a given blocksize=(r,c) count the number of occupied + blocks in a sparse matrix A using + """ + r,c = blocksize + if r < 1 or c < 1: + raise ValueError,'r and c must be positive' + + if isspmatrix_csr(A): + M,N = A.shape + return csr_count_blocks(M,N,r,c,A.indptr,A.indices) + elif isspmatrix_csc(A): + return count_blocks(A.T,(c,r)) + else: + return count_blocks(csr_matrix(A),blocksize) + Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-22 17:20:01 UTC (rev 3696) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-23 17:42:51 UTC (rev 3697) @@ -7,7 +7,8 @@ from numpy.testing import * set_package_path() from scipy.sparse import csc_matrix, csr_matrix, dok_matrix, \ - coo_matrix, lil_matrix, dia_matrix, spidentity, spdiags + coo_matrix, lil_matrix, dia_matrix, spidentity, spdiags, \ + spkron from scipy.linsolve import splu restore_path() @@ -40,8 +41,9 @@ def test_arithmetic(self,level=4): matrices = [] - matrices.append( ('A','Identity', spidentity(500**2,format='csr')) ) - matrices.append( ('B','Poisson5pt', poisson2d(500,format='csr')) ) + #matrices.append( ('A','Identity', spidentity(500**2,format='csr')) ) + matrices.append( ('A','Poisson5pt', poisson2d(500,format='csr')) ) + matrices.append( ('B','Poisson5pt^2', poisson2d(500,format='csr')**2) ) #matrices = [ (a,b,c.astype('int8')) for (a,b,c) in matrices ] @@ -88,10 +90,20 @@ def test_matvec(self,level=5): matrices = [] - matrices.append(('Identity', spidentity(10**5,format='csr'))) - matrices.append(('Poisson5pt', poisson2d(1000,format='csr'))) - matrices.append(('Poisson5pt', poisson2d(1000,format='dia'))) + matrices.append(('Identity', spidentity(10**4,format='dia'))) + matrices.append(('Identity', spidentity(10**4,format='csr'))) + matrices.append(('Poisson5pt', poisson2d(300,format='dia'))) + matrices.append(('Poisson5pt', poisson2d(300,format='csr'))) + matrices.append(('Poisson5pt', poisson2d(300,format='bsr'))) + A = spkron(poisson2d(150),ones((2,2))).tobsr(blocksize=(2,2)) + matrices.append( ('Block2x2', A.tocsr()) ) + matrices.append( ('Block2x2', A) ) + + A = spkron(poisson2d(100),ones((3,3))).tobsr(blocksize=(3,3)) + matrices.append( ('Block3x3', A.tocsr()) ) + matrices.append( ('Block3x3', A) ) + print print ' Sparse Matrix Vector Product' print '==================================================================' @@ -115,6 +127,8 @@ iter += 1 end = time.clock() + del y + name = name.center(12) shape = ("%s" % (A.shape,)).center(20) MFLOPs = (2*A.nnz*iter/(end-start))/float(1e6) From scipy-svn at scipy.org Sun Dec 23 14:17:56 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 23 Dec 2007 13:17:56 -0600 (CST) Subject: [Scipy-svn] r3698 - in trunk/scipy/sandbox/timeseries: include lib lib/tests src Message-ID: <20071223191756.7318E39C137@new.scipy.org> Author: mattknox_ca Date: 2007-12-23 13:17:49 -0600 (Sun, 23 Dec 2007) New Revision: 3698 Modified: trunk/scipy/sandbox/timeseries/include/c_tseries.h trunk/scipy/sandbox/timeseries/lib/moving_funcs.py trunk/scipy/sandbox/timeseries/lib/tests/test_moving_funcs.py trunk/scipy/sandbox/timeseries/src/c_tseries.c trunk/scipy/sandbox/timeseries/src/cseries.c Log: fixed problem with mov_covar and mov_corr functions Modified: trunk/scipy/sandbox/timeseries/include/c_tseries.h =================================================================== --- trunk/scipy/sandbox/timeseries/include/c_tseries.h 2007-12-23 17:42:51 UTC (rev 3697) +++ trunk/scipy/sandbox/timeseries/include/c_tseries.h 2007-12-23 19:17:49 UTC (rev 3698) @@ -9,8 +9,6 @@ PyObject *MaskedArray_mov_median(PyObject *, PyObject *, PyObject *); PyObject *MaskedArray_mov_min(PyObject *, PyObject *, PyObject *); PyObject *MaskedArray_mov_max(PyObject *, PyObject *, PyObject *); -PyObject *MaskedArray_mov_average(PyObject *, PyObject *, PyObject *); -PyObject *MaskedArray_mov_stddev(PyObject *, PyObject *, PyObject *); void import_c_tseries(PyObject *); Modified: trunk/scipy/sandbox/timeseries/lib/moving_funcs.py =================================================================== --- trunk/scipy/sandbox/timeseries/lib/moving_funcs.py 2007-12-23 17:42:51 UTC (rev 3697) +++ trunk/scipy/sandbox/timeseries/lib/moving_funcs.py 2007-12-23 19:17:49 UTC (rev 3698) @@ -13,13 +13,12 @@ __all__ = ['mov_sum', 'mov_median', 'mov_min', 'mov_max', 'mov_average', 'mov_mean', 'mov_average_expw', - 'mov_stddev', 'mov_var', -# 'mov_covar', 'mov_corr', + 'mov_stddev', 'mov_var', 'mov_covar', 'mov_corr', 'cmov_average', 'cmov_mean', 'cmov_window' ] import numpy as N -from numpy import bool_, float_ +from numpy import bool_, float_, sqrt narray = N.array from scipy.signal import convolve, get_window @@ -28,8 +27,8 @@ from maskedarray import MaskedArray, nomask, getmask, getmaskarray, masked marray = MA.array -from timeseries.cseries import MA_mov_stddev, MA_mov_sum, MA_mov_average, \ - MA_mov_median, MA_mov_min, MA_mov_max +from timeseries.cseries import MA_mov_sum, MA_mov_median, MA_mov_min, \ + MA_mov_max def _process_result_dict(orig_data, result_dict): "process the results from the c function" @@ -49,7 +48,6 @@ if data.ndim == 1: kwargs['array'] = data - result_dict = cfunc(**kwargs) return _process_result_dict(data, result_dict) @@ -74,6 +72,14 @@ raise ValueError, "Data should be at most 2D" #............................................................................... +def _mov_sum(data, span, dtype=None, type_num_double=False): + """ helper function for calculating moving sum. Resulting dtype can be +determined in one of two ways. See C-code for more details.""" + kwargs = {'span':span, 'type_num_double':type_num_double} + if dtype is not None: + kwargs['dtype'] = dtype + return _moving_func(data, MA_mov_sum, kwargs) +#............................................................................... def mov_sum(data, span, dtype=None): """Calculates the moving sum of a series. @@ -82,11 +88,7 @@ $$span$$ $$dtype$$""" - kwargs = {'span':span} - if dtype is not None: - kwargs['dtype'] = dtype - - return _moving_func(data, MA_mov_sum, kwargs) + return _mov_sum(data, span, dtype=dtype) #............................................................................... def mov_median(data, span, dtype=None): """Calculates the moving median of a series. @@ -137,25 +139,9 @@ $$data$$ $$span$$ $$dtype$$""" - - kwargs = {'span':span} - if dtype is not None: - kwargs['dtype'] = dtype - - return _moving_func(data, MA_mov_average, kwargs) + return _mov_sum(data, span, dtype=dtype, type_num_double=True)/span mov_mean = mov_average #............................................................................... -def _mov_var_stddev(data, span, is_variance, bias, dtype): - "helper function for mov_var and mov_stddev functions" - - kwargs = {'span':span, - 'is_variance':is_variance, - 'bias':bias} - if dtype is not None: - kwargs['dtype'] = dtype - - return _moving_func(data, MA_mov_stddev, kwargs) -#............................................................................... def mov_var(data, span, bias=False, dtype=None): """Calculates the moving variance of a 1-D array. @@ -164,9 +150,7 @@ $$span$$ $$bias$$ $$dtype$$""" - - return _mov_var_stddev(data=data, span=span, - is_variance=1, bias=int(bias), dtype=dtype) + return mov_covar(data, data, span, bias=bias, dtype=dtype) #............................................................................... def mov_stddev(data, span, bias=False, dtype=None): """Calculates the moving standard deviation of a 1-D array. @@ -176,42 +160,49 @@ $$span$$ $$bias$$ $$dtype$$""" + return sqrt(mov_var(data, span, bias=bias, dtype=dtype)) +#............................................................................... +def mov_covar(x, y, span, bias=False, dtype=None): + """Calculates the moving covariance of two 1-D arrays. + +*Parameters*: + $$x$$ + $$y$$ + $$span$$ + $$bias$$ + $$dtype$$""" - return _mov_var_stddev(data=data, span=span, - is_variance=0, bias=int(bias), dtype=dtype) + if bias: denom = span + else: denom = span - 1 + + sum_prod = _mov_sum(x*y, span, dtype=dtype, type_num_double=True) + sum_x = _mov_sum(x, span, dtype=dtype, type_num_double=True) + sum_y = _mov_sum(y, span, dtype=dtype, type_num_double=True) + + return sum_prod/denom - (sum_x * sum_y) / (span*denom) #............................................................................... -#def mov_covar(x, y, span, bias=False, dtype=None): -# """Calculates the moving covariance of two 1-D arrays. -# -#*Parameters*: -# $$x$$ -# $$y$$ -# $$span$$ -# $$bias$$ -# $$dtype$$""" -# -# result = x - mov_average(x, span, dtype=dtype) -# result = result * (y - mov_average(y, span, dtype=dtype)) -# -# if bias: denom = span -# else: denom = span - 1 -# -# return result/denom -##............................................................................... -#def mov_corr(x, y, span, dtype=None): -# """Calculates the moving correlation of two 1-D arrays. -# -#*Parameters*: -# $$x$$ -# $$y$$ -# $$span$$ -# $$dtype$$""" -# -# result = mov_covar(x, y, span, bias=True, dtype=dtype) -# result = result / mov_stddev(x, span, bias=True, dtype=dtype) -# result = result / mov_stddev(y, span, bias=True, dtype=dtype) -# -# return result +def mov_corr(x, y, span, dtype=None): + """Calculates the moving correlation of two 1-D arrays. + +*Parameters*: + $$x$$ + $$y$$ + $$span$$ + $$dtype$$""" + + sum_x = _mov_sum(x, span, dtype=dtype, type_num_double=True) + sum_y = _mov_sum(y, span, dtype=dtype, type_num_double=True) + + sum_prod = _mov_sum(x*y, span, dtype=dtype, type_num_double=True) + _covar = sum_prod/span - (sum_x * sum_y) / (span ** 2) + + sum_prod = _mov_sum(x**2, span, dtype=dtype, type_num_double=True) + _stddev_x = sqrt(sum_prod/span - (sum_x ** 2) / (span ** 2)) + + sum_prod = _mov_sum(y**2, span, dtype=dtype, type_num_double=True) + _stddev_y = sqrt(sum_prod/span - (sum_y ** 2) / (span ** 2)) + + return _covar / (_stddev_x * _stddev_y) #............................................................................... def mov_average_expw(data, span, tol=1e-6): """Calculates the exponentially weighted moving average of a series. Modified: trunk/scipy/sandbox/timeseries/lib/tests/test_moving_funcs.py =================================================================== --- trunk/scipy/sandbox/timeseries/lib/tests/test_moving_funcs.py 2007-12-23 17:42:51 UTC (rev 3697) +++ trunk/scipy/sandbox/timeseries/lib/tests/test_moving_funcs.py 2007-12-23 19:17:49 UTC (rev 3698) @@ -140,6 +140,13 @@ assert_equal(result._mask, result_mask) assert_equal(result._dates, data._dates) + def test_covar(self): + # test that covariance of series with itself is equal to variance + data = self.maskeddata + for bias in [True, False]: + covar = MF.mov_covar(data, data, 3, bias=bias) + var = MF.mov_var(data, 3, bias=bias) + assert_equal(covar, var) #------------------------------------------------------------------------------ if __name__ == "__main__": Modified: trunk/scipy/sandbox/timeseries/src/c_tseries.c =================================================================== --- trunk/scipy/sandbox/timeseries/src/c_tseries.c 2007-12-23 17:42:51 UTC (rev 3697) +++ trunk/scipy/sandbox/timeseries/src/c_tseries.c 2007-12-23 19:17:49 UTC (rev 3698) @@ -478,19 +478,26 @@ *result_dict=NULL; PyArray_Descr *dtype=NULL; - int rtype, span; + int rtype, span, type_num_double; - static char *kwlist[] = {"array", "span", "dtype", NULL}; + static char *kwlist[] = {"array", "span", "type_num_double", "dtype", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwds, - "Oi|O&:mov_sum(array, span, dtype)", kwlist, - &orig_arrayobj, &span, + "Oii|O&:mov_sum(array, span, type_num_double , dtype)", kwlist, + &orig_arrayobj, &span, &type_num_double, PyArray_DescrConverter2, &dtype)) return NULL; check_mov_args(orig_arrayobj, span, 1, &orig_ndarray, &result_mask); - rtype = _get_type_num(((PyArrayObject*)orig_ndarray)->descr, dtype); + if (type_num_double) { + /* if the moving sum is being used as an intermediate step in something + like a standard deviation calculation, etc... then _get_type_num_double + should be used to determine the appropriate return type. */ + rtype = _get_type_num_double(((PyArrayObject*)orig_ndarray)->descr, dtype); + } else { + rtype = _get_type_num(((PyArrayObject*)orig_ndarray)->descr, dtype); + } result_ndarray = calc_mov_sum((PyArrayObject*)orig_ndarray, span, rtype); @@ -506,54 +513,6 @@ return result_dict; } -PyObject * -MaskedArray_mov_average(PyObject *self, PyObject *args, PyObject *kwds) -{ - PyObject *orig_arrayobj=NULL, *orig_ndarray=NULL, - *result_ndarray=NULL, *result_mask=NULL, - *result_dict=NULL, - *mov_sum=NULL, *denom=NULL; - PyArray_Descr *dtype=NULL; - - int rtype, span; - - static char *kwlist[] = {"array", "span", "dtype", NULL}; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, - "Oi|O&:mov_average(array, span, dtype)", kwlist, - &orig_arrayobj, &span, - PyArray_DescrConverter2, &dtype)) return NULL; - - - check_mov_args(orig_arrayobj, span, 2, - &orig_ndarray, &result_mask); - - rtype = _get_type_num_double(((PyArrayObject*)orig_ndarray)->descr, dtype); - - mov_sum = calc_mov_sum((PyArrayObject*)orig_ndarray, span, rtype); - ERR_CHECK(mov_sum) - - denom = PyFloat_FromDouble(1.0/(double)(span)); - - result_ndarray = np_multiply(mov_sum, denom); - ERR_CHECK(result_ndarray) - - Py_DECREF(mov_sum); - Py_DECREF(denom); - - result_dict = PyDict_New(); - MEM_CHECK(result_dict) - PyDict_SetItemString(result_dict, "array", result_ndarray); - PyDict_SetItemString(result_dict, "mask", result_mask); - - Py_DECREF(result_ndarray); - Py_DECREF(result_mask); - return result_dict; -} - - - -//calc_mov_median(PyArrayObject *orig_ndarray, int span, int rtype) PyObject* calc_mov_ranked(PyArrayObject *orig_ndarray, int span, int rtype, char rank_type) { @@ -844,94 +803,4 @@ return result_dict; } -PyObject * -MaskedArray_mov_stddev(PyObject *self, PyObject *args, PyObject *kwds) -{ - - PyObject *orig_ndarray=NULL, *orig_arrayobj=NULL, - *result_ndarray=NULL, *result_mask=NULL, - *result_dict=NULL, - *result_temp1=NULL, *result_temp2=NULL, *result_temp3=NULL, - *mov_sum=NULL, *mov_sum_sq=NULL, - *denom1=NULL, *denom2=NULL; - - PyArray_Descr *dtype=NULL; - - int rtype, span, is_variance, bias; - - static char *kwlist[] = {"array", "span", "is_variance", "bias", "dtype", NULL}; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, - "Oiii|O&:mov_stddev(array, span, is_variance, bias, dtype)", - kwlist, &orig_arrayobj, &span, &is_variance, &bias, - PyArray_DescrConverter2, &dtype)) return NULL; - - - check_mov_args(orig_arrayobj, span, 2, - &orig_ndarray, &result_mask); - - rtype = _get_type_num_double(((PyArrayObject*)orig_ndarray)->descr, dtype); - - mov_sum = calc_mov_sum((PyArrayObject*)orig_ndarray, span, rtype); - ERR_CHECK(mov_sum) - - result_temp1 = np_multiply(orig_ndarray, orig_ndarray); - ERR_CHECK(result_temp1) - - mov_sum_sq = calc_mov_sum((PyArrayObject*)result_temp1, span, rtype); - Py_DECREF(result_temp1); - ERR_CHECK(mov_sum_sq) - - - /* - formulas from: - http://en.wikipedia.org/wiki/Standard_deviation#Rapid_calculation_methods - */ - if (bias == 0) { - denom1 = PyFloat_FromDouble(1.0/(double)(span-1)); - denom2 = PyFloat_FromDouble(1.0/(double)(span*(span-1))); - } else { - denom1 = PyFloat_FromDouble(1.0/(double)span); - denom2 = PyFloat_FromDouble(1.0/(double)(span*span)); - } - - result_temp1 = np_multiply(mov_sum_sq, denom1); - ERR_CHECK(result_temp1) - Py_DECREF(mov_sum_sq); - Py_DECREF(denom1); - - result_temp3 = np_multiply(mov_sum, mov_sum); - ERR_CHECK(result_temp3) - Py_DECREF(mov_sum); - - result_temp2 = np_multiply(result_temp3, denom2); - ERR_CHECK(result_temp2) - Py_DECREF(result_temp3); - Py_DECREF(denom2); - - result_temp3 = np_subtract(result_temp1, result_temp2); - ERR_CHECK(result_temp3) - Py_DECREF(result_temp1); - Py_DECREF(result_temp2); - - if (is_variance) { - result_ndarray = result_temp3; - } else { - result_temp1 = np_sqrt(result_temp3); - ERR_CHECK(result_temp1) - Py_DECREF(result_temp3); - result_ndarray = result_temp1; - } - - result_dict = PyDict_New(); - MEM_CHECK(result_dict) - PyDict_SetItemString(result_dict, "array", result_ndarray); - PyDict_SetItemString(result_dict, "mask", result_mask); - - Py_DECREF(result_ndarray); - Py_DECREF(result_mask); - return result_dict; - -} - void import_c_tseries(PyObject *m) { import_array(); } Modified: trunk/scipy/sandbox/timeseries/src/cseries.c =================================================================== --- trunk/scipy/sandbox/timeseries/src/cseries.c 2007-12-23 17:42:51 UTC (rev 3697) +++ trunk/scipy/sandbox/timeseries/src/cseries.c 2007-12-23 19:17:49 UTC (rev 3698) @@ -12,10 +12,6 @@ METH_VARARGS | METH_KEYWORDS, ""}, {"MA_mov_max", (PyCFunction)MaskedArray_mov_max, METH_VARARGS | METH_KEYWORDS, ""}, - {"MA_mov_average", (PyCFunction)MaskedArray_mov_average, - METH_VARARGS | METH_KEYWORDS, ""}, - {"MA_mov_stddev", (PyCFunction)MaskedArray_mov_stddev, - METH_VARARGS | METH_KEYWORDS, ""}, {"TS_convert", (PyCFunction)TimeSeries_convert, METH_VARARGS, ""}, From scipy-svn at scipy.org Sun Dec 23 16:07:04 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 23 Dec 2007 15:07:04 -0600 (CST) Subject: [Scipy-svn] r3699 - trunk/scipy/sparse Message-ID: <20071223210704.7250339C4AC@new.scipy.org> Author: wnbell Date: 2007-12-23 15:07:00 -0600 (Sun, 23 Dec 2007) New Revision: 3699 Modified: trunk/scipy/sparse/dok.py Log: fixed bug with negative indices Modified: trunk/scipy/sparse/dok.py =================================================================== --- trunk/scipy/sparse/dok.py 2007-12-23 19:17:49 UTC (rev 3698) +++ trunk/scipy/sparse/dok.py 2007-12-23 21:07:00 UTC (rev 3699) @@ -217,7 +217,7 @@ # Ensure value is a single element, not a sequence if isinstance(value, float) or isintlike(value) or \ isinstance(value, complex): - dict.__setitem__(self, key, self.dtype.type(value)) + dict.__setitem__(self, (i,j), self.dtype.type(value)) newrows = max(self.shape[0], int(key[0])+1) newcols = max(self.shape[1], int(key[1])+1) self.shape = (newrows, newcols) @@ -558,7 +558,7 @@ return self.tocoo().tocsc() def toarray(self): - return self.tocsr().toarray() + return self.tocoo().toarray() def resize(self, shape): """ Resize the matrix to dimensions given by 'shape', removing any From scipy-svn at scipy.org Sun Dec 23 19:17:01 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 23 Dec 2007 18:17:01 -0600 (CST) Subject: [Scipy-svn] r3700 - in trunk/scipy/sparse: . sparsetools tests Message-ID: <20071224001701.49C9739C128@new.scipy.org> Author: wnbell Date: 2007-12-23 18:16:09 -0600 (Sun, 23 Dec 2007) New Revision: 3700 Modified: trunk/scipy/sparse/block.py trunk/scipy/sparse/compressed.py trunk/scipy/sparse/coo.py trunk/scipy/sparse/csc.py trunk/scipy/sparse/csr.py trunk/scipy/sparse/dia.py trunk/scipy/sparse/sparsetools/sparsetools.h trunk/scipy/sparse/sparsetools/sparsetools.i trunk/scipy/sparse/sparsetools/sparsetools.py trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx trunk/scipy/sparse/tests/test_base.py Log: used sorted indices in arithmetic working towards parallel sparsetools Modified: trunk/scipy/sparse/block.py =================================================================== --- trunk/scipy/sparse/block.py 2007-12-23 21:07:00 UTC (rev 3699) +++ trunk/scipy/sparse/block.py 2007-12-24 00:16:09 UTC (rev 3700) @@ -1,5 +1,7 @@ """base class for block sparse formats""" +from warnings import warn + from numpy import zeros, intc, array, asarray, arange, diff, tile, rank, \ prod, ravel @@ -155,6 +157,9 @@ raise ValueError,'index pointer values must form a " \ "non-decreasing sequence' + if not self.has_sorted_indices(): + warn('Indices were not in sorted order. Sorting indices.') + self.sort_indices(check_first=False) def _get_blocksize(self): return self.data.shape[1:] @@ -313,6 +318,12 @@ # methods that modify the internal data structure + def has_sorted_indices(self): + """Determine whether the matrix has sorted indices + """ + fn = sparsetools.csr_has_sorted_indices + return fn( len(self.indptr) - 1, self.indptr, self.indices) + def sorted_indices(self): """Return a copy of this matrix with sorted indices """ @@ -324,7 +335,7 @@ # typically the previous option is faster #return self.toother().toother() - def sort_indices(self): + def sort_indices(self, check_first=True): """Sort the indices of this matrix *in place* """ from csr import csr_matrix @@ -340,7 +351,7 @@ proxy.sort_indices() self.data[:] = self.data[proxy.data] - self.indices = proxy.indices + self.indices[:] = proxy.indices def prune(self): """ Remove empty space after all non-zero elements. Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-23 21:07:00 UTC (rev 3699) +++ trunk/scipy/sparse/compressed.py 2007-12-24 00:16:09 UTC (rev 3700) @@ -94,8 +94,7 @@ else: self.shape = self._swap((major_dim,minor_dim)) - #self.check_format(full_check=False) - self.check_format(full_check=True) + self.check_format(full_check=False) def getnnz(self): return self.indptr[-1] @@ -122,9 +121,6 @@ False - basic check, O(1) operations """ - #TODO does spmatrix take care of this? - self.shape = tuple([int(x) for x in self.shape]) # for floats etc. - #use _swap to determine proper bounds major_name,minor_name = self._swap(('row','column')) major_dim,minor_dim = self._swap(self.shape) @@ -179,9 +175,14 @@ if numpy.diff(self.indptr).min() < 0: raise ValueError,'index pointer values must form a " \ "non-decreasing sequence' + + #if not self.has_sorted_indices(): + # warn('Indices were not in sorted order. Sorting indices.') + # self.sort_indices() + # assert(self.has_sorted_indices()) + #TODO check for duplicates? - def __add__(self,other): # First check if argument is a scalar if isscalarlike(other): @@ -455,9 +456,8 @@ The is an *in place* operation """ - fn = getattr(sparsetools,self.format + '_sum_duplicates') - - M,N = self.shape + fn = sparsetools.csr_sum_duplicates + M,N = self._swap(self.shape) fn( M, N, self.indptr, self.indices, self.data) self.prune() #nnz may have changed @@ -465,9 +465,8 @@ def has_sorted_indices(self): """Determine whether the matrix has sorted indices """ - fn = sparsetools.has_sorted_indices - M,N = self._swap(self.shape) - return fn( M, N, self.indptr, self.indices) + fn = sparsetools.csr_has_sorted_indices + return fn( len(self.indptr) - 1, self.indptr, self.indices) def sorted_indices(self): """Return a copy of this matrix with sorted indices @@ -480,18 +479,16 @@ # typically the previous option is faster #return self.toother().toother() - def sort_indices(self): + def sort_indices(self,check_first=True): """Sort the indices of this matrix *in place* """ - if self.has_sorted_indices(): - #see if sorting can be avoided + #see if sorting can be avoided + if check_first and self.has_sorted_indices(): return - fn = getattr(sparsetools,self.format + '_sort_indices') + fn = sparsetools.csr_sort_indices + fn( len(self.indptr) - 1, self.indptr, self.indices, self.data) - M,N = self.shape - fn( M, N, self.indptr, self.indices, self.data) - def ensure_sorted_indices(self, inplace=False): """Return a copy of this matrix where the column indices are sorted """ @@ -544,8 +541,8 @@ out_shape = self.shape #only necessary for sorted binopt method - #self.sort_indices() - #other.sort_indices() + self.sort_indices() + other.sort_indices() # e.g. csr_plus_csr, cscmucsc, etc. fn = getattr(sparsetools, self.format + op + self.format) Modified: trunk/scipy/sparse/coo.py =================================================================== --- trunk/scipy/sparse/coo.py 2007-12-23 21:07:00 UTC (rev 3699) +++ trunk/scipy/sparse/coo.py 2007-12-24 00:16:09 UTC (rev 3700) @@ -227,11 +227,12 @@ indices = empty(self.nnz, dtype=intc) data = empty(self.nnz, dtype=upcast(self.dtype)) - coo_tocsc(self.shape[0], self.shape[1], self.nnz, \ - self.row, self.col, self.data, \ + coo_tocsr(self.shape[1], self.shape[0], self.nnz, \ + self.col, self.row, self.data, \ indptr, indices, data) A = csc_matrix((data, indices, indptr), self.shape) + A.sort_indices() A.sum_duplicates() return A @@ -255,7 +256,9 @@ indptr, indices, data) A = csr_matrix((data, indices, indptr), self.shape) - A.sum_duplicates() + if sum_duplicates: + A.sort_indices() + A.sum_duplicates() return A Modified: trunk/scipy/sparse/csc.py =================================================================== --- trunk/scipy/sparse/csc.py 2007-12-23 21:07:00 UTC (rev 3699) +++ trunk/scipy/sparse/csc.py 2007-12-24 00:16:09 UTC (rev 3700) @@ -7,7 +7,8 @@ import numpy from numpy import array, matrix, asarray, asmatrix, zeros, rank, intc, \ - empty, hstack, isscalar, ndarray, shape, searchsorted, where + empty, hstack, isscalar, ndarray, shape, searchsorted, where, \ + concatenate from base import spmatrix,isspmatrix from sparsetools import csc_tocsr @@ -172,18 +173,15 @@ if len(indxs[0]) == 0: #value not present - #TODO handle this with concatenation - self.data = resize1d(self.data, self.nnz + 1) - self.indices = resize1d(self.indices, self.nnz + 1) + newindx = self.indices[self.indptr[col]:self.indptr[col+1]].searchsorted(row) + newindx += self.indptr[col] - newindex = self.indptr[col] - self.data[newindex+1:] = self.data[newindex:-1] - self.indices[newindex+1:] = self.indices[newindex:-1] + val = array([val],dtype=self.data.dtype) + row = array([row],dtype=self.indices.dtype) + self.data = concatenate((self.data[:newindx],val,self.data[newindx:])) + self.indices = concatenate((self.indices[:newindx],row,self.indices[newindx:])) - self.data[newindex] = val - self.indices[newindex] = row self.indptr[col+1:] += 1 - elif len(indxs[0]) == 1: #value already present self.data[self.indptr[col]:self.indptr[col+1]][indxs[0]] = val Modified: trunk/scipy/sparse/csr.py =================================================================== --- trunk/scipy/sparse/csr.py 2007-12-23 21:07:00 UTC (rev 3699) +++ trunk/scipy/sparse/csr.py 2007-12-24 00:16:09 UTC (rev 3700) @@ -8,7 +8,8 @@ import numpy from numpy import array, matrix, asarray, asmatrix, zeros, rank, intc, \ - empty, hstack, isscalar, ndarray, shape, searchsorted, where + empty, hstack, isscalar, ndarray, shape, searchsorted, where, \ + concatenate from base import spmatrix,isspmatrix from sparsetools import csr_tocsc @@ -161,15 +162,14 @@ indxs = numpy.where(col == self.indices[self.indptr[row]:self.indptr[row+1]]) if len(indxs[0]) == 0: #value not present - self.data = resize1d(self.data, self.nnz + 1) - self.indices = resize1d(self.indices, self.nnz + 1) + newindx = self.indices[self.indptr[row]:self.indptr[row+1]].searchsorted(col) + newindx += self.indptr[row] - newindex = self.indptr[row] - self.data[newindex+1:] = self.data[newindex:-1] - self.indices[newindex+1:] = self.indices[newindex:-1] + val = array([val],dtype=self.data.dtype) + col = array([col],dtype=self.indices.dtype) + self.data = concatenate((self.data[:newindx],val,self.data[newindx:])) + self.indices = concatenate((self.indices[:newindx],col,self.indices[newindx:])) - self.data[newindex] = val - self.indices[newindex] = col self.indptr[row+1:] += 1 elif len(indxs[0]) == 1: @@ -178,7 +178,7 @@ else: raise IndexError, "row index occurs more than once" - self.check_format(full_check=False) + self.check_format(full_check=True) else: # We should allow slices here! raise IndexError, "invalid index" Modified: trunk/scipy/sparse/dia.py =================================================================== --- trunk/scipy/sparse/dia.py 2007-12-23 21:07:00 UTC (rev 3699) +++ trunk/scipy/sparse/dia.py 2007-12-24 00:16:09 UTC (rev 3700) @@ -224,7 +224,10 @@ for i,k in enumerate(self.diags): row[i,:] -= k - mask = (row >= 0) & (row < self.shape[0]) & (col < self.shape[1]) + mask = (row >= 0) + mask &= (row < self.shape[0]) + mask &= (col < self.shape[1]) + mask &= self.data != 0 row,col,data = row[mask],col[mask],self.data[mask] row,col,data = row.reshape(-1),col.reshape(-1),data.reshape(-1) Modified: trunk/scipy/sparse/sparsetools/sparsetools.h =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.h 2007-12-23 21:07:00 UTC (rev 3699) +++ trunk/scipy/sparse/sparsetools/sparsetools.h 2007-12-24 00:16:09 UTC (rev 3700) @@ -140,17 +140,15 @@ * * Input Arguments: * I n_row - number of rows in A - * I n_col - number of columns in A * I Ap[n_row+1] - row pointer * I Aj[nnz(A)] - column indices * T Ax[nnz(A)] - nonzeros * */ template -bool has_sorted_indices(const I n_row, - const I n_col, - const I Ap[], - const I Aj[]) +bool csr_has_sorted_indices(const I n_row, + const I Ap[], + const I Aj[]) { for(I i = 0; i < n_row; i++){ for(I jj = Ap[i]; jj < Ap[i+1] - 1; jj++){ @@ -168,7 +166,6 @@ template void csr_sort_indices(const I n_row, - const I n_col, const I Ap[], I Aj[], T Ax[]) @@ -420,10 +417,18 @@ +template +bool is_nonzero_block(const T block[], const I blocksize){ + for(I i = 0; i < blocksize; i++){ + if(block[i] != 0){ + return true; + } + } + return false; +} - template void bsr_binop_bsr(const I n_brow, const I n_bcol, const I R, const I C, @@ -434,76 +439,180 @@ std::vector* Cx, const bin_op& op) { - Cp->resize(n_brow + 1, 0); + //Method that works for unsorted indices + assert( csr_has_sorted_indices(n_brow,Ap,Aj) ); + assert( csr_has_sorted_indices(n_brow,Bp,Bj) ); const I RC = R*C; + T result[8*8]; + //T zeros[8*8]; + Cp->resize(n_brow + 1, 0); + (*Cp)[0] = 0; - std::vector next(n_bcol,-1); - std::vector A_row(n_bcol*RC, 0); - std::vector B_row(n_bcol*RC, 0); - for(I i = 0; i < n_brow; i++){ - I head = -2; - I length = 0; + I A_pos = RC*Ap[i]; + I B_pos = RC*Bp[i]; + I A_end = RC*Ap[i+1]; + I B_end = RC*Bp[i+1]; - //add a row of A to A_row - for(I jj = Ap[i]; jj < Ap[i+1]; jj++){ - I j = Aj[jj]; + I A_j = Aj[A_pos]; + I B_j = Bj[B_pos]; + + //while not finished with either row + while(A_pos < A_end && B_pos < B_end){ + if(A_j == B_j){ + for(I n = 0; n < RC; n++){ + result[n] = op(Ax[A_pos + n],Bx[B_pos + n]); + } + //vec_binop(Ax[RC*A_pos],Bx[RC*B_pos],result,op); - for(I n = 0; n < RC; n++) - A_row[RC*j + n] += Ax[RC*jj + n]; + if( is_nonzero_block(result,RC) ){ + Cj->push_back(A_j); + for(I n = 0; n < RC; n++){ + Cx->push_back(result[n]); + } + } - if(next[j] == -1){ - next[j] = head; - head = j; - length++; - } - } + A_j = Aj[++A_pos]; + B_j = Bj[++B_pos]; - //add a row of B to B_row - for(I jj = Bp[i]; jj < Bp[i+1]; jj++){ - I j = Bj[jj]; + } else if (A_j < B_j) { + for(I n = 0; n < RC; n++){ + result[n] = op(Ax[A_pos + n],0); + } - for(I n = 0; n < RC; n++) - B_row[RC*j + n] += Bx[RC*jj + n]; + if(is_nonzero_block(result,RC)){ + Cj->push_back(A_j); + for(I n = 0; n < RC; n++){ + Cx->push_back(result[n]); + } + } - if(next[j] == -1){ - next[j] = head; - head = j; - length++; + A_j = Aj[++A_pos]; + + } else { + //B_j < A_j + for(I n = 0; n < RC; n++){ + result[n] = op(0,Bx[B_pos + n]); + } + + if(is_nonzero_block(result,RC)){ + Cj->push_back(B_j); + for(I n = 0; n < RC; n++){ + Cx->push_back(result[n]); + } + } + + B_j = Bj[++B_pos]; + } } - - for(I jj = 0; jj < length; jj++){ - bool nonzero_block = false; + //tail + while(A_pos < A_end){ for(I n = 0; n < RC; n++){ - T result = op(A_row[RC*head + n],B_row[RC*head + n]); - A_row[RC*head + n] = result; - if(result != 0) - nonzero_block = true; + result[n] = op(Ax[A_pos + n],0); } - - if(nonzero_block){ - Cj->push_back(head); + if(is_nonzero_block(result,RC)){ + Cj->push_back(A_j); for(I n = 0; n < RC; n++){ - Cx->push_back(A_row[RC*head + n]); + Cx->push_back(result[n]); } } + A_j = Aj[++A_pos]; + } + while(B_pos < B_end){ for(I n = 0; n < RC; n++){ - A_row[RC*head + n] = 0; - B_row[RC*head + n] = 0; + result[n] = op(0,Bx[B_pos + n]); } - I temp = head; - head = next[head]; - next[temp] = -1; + if(is_nonzero_block(result,RC)){ + Cj->push_back(B_j); + for(I n = 0; n < RC; n++){ + Cx->push_back(result[n]); + } + } + + B_j = Bj[++B_pos]; } + (*Cp)[i+1] = Cx->size(); + } - (*Cp)[i+1] = Cj->size(); - } + +// //Method that works for unsorted indices +// +// Cp->resize(n_brow + 1, 0); +// +// const I RC = R*C; +// +// std::vector next(n_bcol,-1); +// std::vector A_row(n_bcol*RC, 0); +// std::vector B_row(n_bcol*RC, 0); +// +// for(I i = 0; i < n_brow; i++){ +// I head = -2; +// I length = 0; +// +// //add a row of A to A_row +// for(I jj = Ap[i]; jj < Ap[i+1]; jj++){ +// I j = Aj[jj]; +// +// for(I n = 0; n < RC; n++) +// A_row[RC*j + n] += Ax[RC*jj + n]; +// +// if(next[j] == -1){ +// next[j] = head; +// head = j; +// length++; +// } +// } +// +// //add a row of B to B_row +// for(I jj = Bp[i]; jj < Bp[i+1]; jj++){ +// I j = Bj[jj]; +// +// for(I n = 0; n < RC; n++) +// B_row[RC*j + n] += Bx[RC*jj + n]; +// +// if(next[j] == -1){ +// next[j] = head; +// head = j; +// length++; +// } +// } +// +// +// for(I jj = 0; jj < length; jj++){ +// bool nonzero_block = false; +// for(I n = 0; n < RC; n++){ +// T result = op(A_row[RC*head + n],B_row[RC*head + n]); +// A_row[RC*head + n] = result; +// if(result != 0) +// nonzero_block = true; +// } +// +// +// if(nonzero_block){ +// Cj->push_back(head); +// for(I n = 0; n < RC; n++){ +// Cx->push_back(A_row[RC*head + n]); +// } +// } +// +// for(I n = 0; n < RC; n++){ +// A_row[RC*head + n] = 0; +// B_row[RC*head + n] = 0; +// } +// +// I temp = head; +// head = next[head]; +// next[temp] = -1; +// } +// +// (*Cp)[i+1] = Cj->size(); +// } } /* element-wise binary operations*/ @@ -590,129 +699,131 @@ std::vector* Cx, const bin_op& op) { + //Method that works for sorted indices + assert( csr_has_sorted_indices(n_row,Ap,Aj) ); + assert( csr_has_sorted_indices(n_row,Bp,Bj) ); + + Cp->resize(n_row + 1, 0); + (*Cp)[0] = 0; + + for(I i = 0; i < n_row; i++){ + I A_pos = Ap[i]; + I B_pos = Bp[i]; + I A_end = Ap[i+1]; + I B_end = Bp[i+1]; + + I A_j = Aj[A_pos]; + I B_j = Bj[B_pos]; + + //while not finished with either row + while(A_pos < A_end && B_pos < B_end){ + if(A_j == B_j){ + T result = op(Ax[A_pos],Bx[B_pos]); + if(result != 0){ + Cj->push_back(A_j); + Cx->push_back(result); + } + A_j = Aj[++A_pos]; + B_j = Bj[++B_pos]; + } else if (A_j < B_j) { + T result = op(Ax[A_pos],0); + if (result != 0){ + Cj->push_back(A_j); + Cx->push_back(result); + } + A_j = Aj[++A_pos]; + } else { + //B_j < A_j + T result = op(0,Bx[B_pos]); + if (result != 0){ + Cj->push_back(B_j); + Cx->push_back(result); + } + B_j = Bj[++B_pos]; + } + } + + //tail + while(A_pos < A_end){ + T result = op(Ax[A_pos],0); + if (result != 0){ + Cj->push_back(A_j); + Cx->push_back(result); + } + A_j = Aj[++A_pos]; + } + while(B_pos < B_end){ + T result = op(0,Bx[B_pos]); + if (result != 0){ + Cj->push_back(B_j); + Cx->push_back(result); + } + B_j = Bj[++B_pos]; + } + (*Cp)[i+1] = Cx->size(); + } + + // //Method that works for unsorted indices // Cp->resize(n_row + 1, 0); -// (*Cp)[0] = 0; // +// std::vector next(n_col,-1); +// std::vector A_row(n_col, 0); +// std::vector B_row(n_col, 0); +// // for(I i = 0; i < n_row; i++){ -// I A_pos = Ap[i]; -// I B_pos = Bp[i]; -// I A_end = Ap[i+1]; -// I B_end = Bp[i+1]; +// I head = -2; +// I length = 0; // -// I A_j = Aj[A_pos]; -// I B_j = Bj[B_pos]; -// -// //while not finished with either row -// while(A_pos < A_end && B_pos < B_end){ -// if(A_j == B_j){ -// T result = op(Ax[A_pos],Bx[B_pos]); -// if(result != 0){ -// Cj->push_back(A_j); -// Cx->push_back(result); -// } -// A_j = Aj[++A_pos]; -// B_j = Bj[++B_pos]; -// } else if (A_j < B_j) { -// T result = op(Ax[A_pos],0); -// if (result != 0){ -// Cj->push_back(A_j); -// Cx->push_back(result); -// } -// A_j = Aj[++A_pos]; -// } else { -// //B_j < A_j -// T result = op(0,Bx[B_pos]); -// if (result != 0){ -// Cj->push_back(B_j); -// Cx->push_back(result); -// } -// B_j = Bj[++B_pos]; +// //add a row of A to A_row +// I i_start = Ap[i]; +// I i_end = Ap[i+1]; +// for(I jj = i_start; jj < i_end; jj++){ +// I j = Aj[jj]; +// +// A_row[j] += Ax[jj]; +// +// if(next[j] == -1){ +// next[j] = head; +// head = j; +// length++; // } // } // -// //tail -// while(A_pos < A_end){ -// T result = op(Ax[A_pos],0); -// if (result != 0){ -// Cj->push_back(A_j); -// Cx->push_back(result); +// //add a row of B to B_row +// i_start = Bp[i]; +// i_end = Bp[i+1]; +// for(I jj = i_start; jj < i_end; jj++){ +// I j = Bj[jj]; +// +// B_row[j] += Bx[jj]; +// +// if(next[j] == -1){ +// next[j] = head; +// head = j; +// length++; // } -// A_j = Aj[++A_pos]; // } -// while(B_pos < B_end){ -// T result = op(0,Bx[B_pos]); -// if (result != 0){ -// Cj->push_back(B_j); +// +// +// for(I jj = 0; jj < length; jj++){ +// T result = op(A_row[head],B_row[head]); +// +// if(result != 0){ +// Cj->push_back(head); // Cx->push_back(result); // } -// B_j = Bj[++B_pos]; +// +// I temp = head; +// head = next[head]; +// +// next[temp] = -1; +// A_row[temp] = 0; +// B_row[temp] = 0; // } -// (*Cp)[i+1] = Cx->size(); +// +// (*Cp)[i+1] = Cj->size(); // } - - - //Method that works for unsorted indices - - Cp->resize(n_row + 1, 0); - - std::vector next(n_col,-1); - std::vector A_row(n_col, 0); - std::vector B_row(n_col, 0); - - for(I i = 0; i < n_row; i++){ - I head = -2; - I length = 0; - - //add a row of A to A_row - I i_start = Ap[i]; - I i_end = Ap[i+1]; - for(I jj = i_start; jj < i_end; jj++){ - I j = Aj[jj]; - - A_row[j] += Ax[jj]; - - if(next[j] == -1){ - next[j] = head; - head = j; - length++; - } - } - - //add a row of B to B_row - i_start = Bp[i]; - i_end = Bp[i+1]; - for(I jj = i_start; jj < i_end; jj++){ - I j = Bj[jj]; - - B_row[j] += Bx[jj]; - - if(next[j] == -1){ - next[j] = head; - head = j; - length++; - } - } - - - for(I jj = 0; jj < length; jj++){ - T result = op(A_row[head],B_row[head]); - - if(result != 0){ - Cj->push_back(head); - Cx->push_back(result); - } - - I temp = head; - head = next[head]; - - next[temp] = -1; - A_row[temp] = 0; - B_row[temp] = 0; - } - - (*Cp)[i+1] = Cj->size(); - } } /* element-wise binary operations*/ @@ -777,46 +888,68 @@ I Aj[], T Ax[]) { - std::vector next(n_col,-1); - std::vector sums(n_col, 0); - - I nnz = 0; - - I row_start = 0; - I row_end = 0; - - for(I i = 0; i < n_row; i++){ - I head = -2; - - row_start = row_end; //Ap[i] may have been changed - row_end = Ap[i+1]; //Ap[i+1] is safe - - for(I jj = row_start; jj < row_end; jj++){ - I j = Aj[jj]; - - sums[j] += Ax[jj]; - - if(next[j] == -1){ - next[j] = head; - head = j; - } - } - - while(head != -2){ - I curr = head; //current column - head = next[curr]; - - if(sums[curr] != 0){ - Aj[nnz] = curr; - Ax[nnz] = sums[curr]; + I nnz = 0; + I row_end = 0; + for(I i = 0; i < n_row; i++){ + I jj = row_end; + row_end = Ap[i+1]; + while( jj < row_end ){ + I j = Aj[jj]; + T x = Ax[jj]; + jj++; + while( Aj[jj] == j && jj < row_end ){ + x += Ax[jj]; + jj++; + } + Aj[nnz] = j; + Ax[nnz] = x; nnz++; } - - next[curr] = -1; - sums[curr] = 0; + Ap[i+1] = nnz; } - Ap[i+1] = nnz; - } + + + //method that works on unsorted indices +// std::vector next(n_col,-1); +// std::vector sums(n_col, 0); +// +// I nnz = 0; +// +// I row_start = 0; +// I row_end = 0; +// +// for(I i = 0; i < n_row; i++){ +// I head = -2; +// +// row_start = row_end; //Ap[i] may have been changed +// row_end = Ap[i+1]; //Ap[i+1] is safe +// +// for(I jj = row_start; jj < row_end; jj++){ +// I j = Aj[jj]; +// +// sums[j] += Ax[jj]; +// +// if(next[j] == -1){ +// next[j] = head; +// head = j; +// } +// } +// +// while(head != -2){ +// I curr = head; //current column +// head = next[curr]; +// +// if(sums[curr] != 0){ +// Aj[nnz] = curr; +// Ax[nnz] = sums[curr]; +// nnz++; +// } +// +// next[curr] = -1; +// sums[curr] = 0; +// } +// Ap[i+1] = nnz; +// } } @@ -1294,28 +1427,7 @@ -template -void csc_sum_duplicates(const I n_row, - const I n_col, - I Ap[], - I Ai[], - T Ax[]) -{ csr_sum_duplicates(n_col, n_row, Ap, Ai, Ax); } - -template -void csc_sort_indices(const I n_row, - const I n_col, - const I Ap[], - I Ai[], - T Ax[]) -{ csr_sort_indices(n_col, n_row, Ap, Ai, Ax); } - - - - - - /* * These are sparsetools functions that are not currently used * Modified: trunk/scipy/sparse/sparsetools/sparsetools.i =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.i 2007-12-23 21:07:00 UTC (rev 3699) +++ trunk/scipy/sparse/sparsetools/sparsetools.i 2007-12-24 00:16:09 UTC (rev 3700) @@ -240,18 +240,16 @@ INSTANTIATE_ALL(bsr_minus_bsr) /* - * Sort CSR/CSC indices. + * Sort indices. */ -%template(has_sorted_indices) has_sorted_indices; +%template(csr_has_sorted_indices) csr_has_sorted_indices; INSTANTIATE_ALL(csr_sort_indices) -INSTANTIATE_ALL(csc_sort_indices) /* - * Sum duplicate CSR/CSC entries. + * Sum duplicate entries. */ INSTANTIATE_ALL(csr_sum_duplicates) -INSTANTIATE_ALL(csc_sum_duplicates) /* * Extract submatrices Modified: trunk/scipy/sparse/sparsetools/sparsetools.py =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.py 2007-12-23 21:07:00 UTC (rev 3699) +++ trunk/scipy/sparse/sparsetools/sparsetools.py 2007-12-24 00:16:09 UTC (rev 3700) @@ -71,9 +71,9 @@ """ return _sparsetools.csc_matmat_pass1(*args) -def has_sorted_indices(*args): - """has_sorted_indices(int n_row, int n_col, int Ap, int Aj) -> bool""" - return _sparsetools.has_sorted_indices(*args) +def csr_has_sorted_indices(*args): + """csr_has_sorted_indices(int n_row, int Ap, int Aj) -> bool""" + return _sparsetools.csr_has_sorted_indices(*args) def csr_diagonal(*args): @@ -755,32 +755,18 @@ def csr_sort_indices(*args): """ - csr_sort_indices(int n_row, int n_col, int Ap, int Aj, signed char Ax) - csr_sort_indices(int n_row, int n_col, int Ap, int Aj, unsigned char Ax) - csr_sort_indices(int n_row, int n_col, int Ap, int Aj, short Ax) - csr_sort_indices(int n_row, int n_col, int Ap, int Aj, int Ax) - csr_sort_indices(int n_row, int n_col, int Ap, int Aj, long long Ax) - csr_sort_indices(int n_row, int n_col, int Ap, int Aj, float Ax) - csr_sort_indices(int n_row, int n_col, int Ap, int Aj, double Ax) - csr_sort_indices(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax) - csr_sort_indices(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax) + csr_sort_indices(int n_row, int Ap, int Aj, signed char Ax) + csr_sort_indices(int n_row, int Ap, int Aj, unsigned char Ax) + csr_sort_indices(int n_row, int Ap, int Aj, short Ax) + csr_sort_indices(int n_row, int Ap, int Aj, int Ax) + csr_sort_indices(int n_row, int Ap, int Aj, long long Ax) + csr_sort_indices(int n_row, int Ap, int Aj, float Ax) + csr_sort_indices(int n_row, int Ap, int Aj, double Ax) + csr_sort_indices(int n_row, int Ap, int Aj, npy_cfloat_wrapper Ax) + csr_sort_indices(int n_row, int Ap, int Aj, npy_cdouble_wrapper Ax) """ return _sparsetools.csr_sort_indices(*args) -def csc_sort_indices(*args): - """ - csc_sort_indices(int n_row, int n_col, int Ap, int Ai, signed char Ax) - csc_sort_indices(int n_row, int n_col, int Ap, int Ai, unsigned char Ax) - csc_sort_indices(int n_row, int n_col, int Ap, int Ai, short Ax) - csc_sort_indices(int n_row, int n_col, int Ap, int Ai, int Ax) - csc_sort_indices(int n_row, int n_col, int Ap, int Ai, long long Ax) - csc_sort_indices(int n_row, int n_col, int Ap, int Ai, float Ax) - csc_sort_indices(int n_row, int n_col, int Ap, int Ai, double Ax) - csc_sort_indices(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax) - csc_sort_indices(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax) - """ - return _sparsetools.csc_sort_indices(*args) - def csr_sum_duplicates(*args): """ csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, signed char Ax) @@ -795,20 +781,6 @@ """ return _sparsetools.csr_sum_duplicates(*args) -def csc_sum_duplicates(*args): - """ - csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, signed char Ax) - csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, unsigned char Ax) - csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, short Ax) - csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, int Ax) - csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, long long Ax) - csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, float Ax) - csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, double Ax) - csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax) - csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax) - """ - return _sparsetools.csc_sum_duplicates(*args) - def get_csr_submatrix(*args): """ get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, signed char Ax, Modified: trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx 2007-12-23 21:07:00 UTC (rev 3699) +++ trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx 2007-12-24 00:16:09 UTC (rev 3700) @@ -47557,72 +47557,63 @@ } -SWIGINTERN PyObject *_wrap_has_sorted_indices(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_csr_has_sorted_indices(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; - int arg2 ; + int *arg2 ; int *arg3 ; - int *arg4 ; bool result; int val1 ; int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; + PyArrayObject *array2 = NULL ; + int is_new_object2 ; PyArrayObject *array3 = NULL ; int is_new_object3 ; - PyArrayObject *array4 = NULL ; - int is_new_object4 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOO:has_sorted_indices",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOO:csr_has_sorted_indices",&obj0,&obj1,&obj2)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "has_sorted_indices" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_has_sorted_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "has_sorted_indices" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); { npy_intp size[1] = { -1 }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; + array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_INT, &is_new_object2); + if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1) + || !require_contiguous(array2) || !require_native(array2)) SWIG_fail; - arg3 = (int*) array3->data; + arg2 = (int*) array2->data; } { npy_intp size[1] = { -1 }; - array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4); - if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1) - || !require_contiguous(array4) || !require_native(array4)) SWIG_fail; + array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); + if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) + || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - arg4 = (int*) array4->data; + arg3 = (int*) array3->data; } - result = (bool)has_sorted_indices(arg1,arg2,(int const (*))arg3,(int const (*))arg4); + result = (bool)csr_has_sorted_indices(arg1,(int const (*))arg2,(int const (*))arg3); resultobj = SWIG_From_bool(static_cast< bool >(result)); { - if (is_new_object3 && array3) Py_DECREF(array3); + if (is_new_object2 && array2) Py_DECREF(array2); } { - if (is_new_object4 && array4) Py_DECREF(array4); + if (is_new_object3 && array3) Py_DECREF(array3); } return resultobj; fail: { - if (is_new_object3 && array3) Py_DECREF(array3); + if (is_new_object2 && array2) Py_DECREF(array2); } { - if (is_new_object4 && array4) Py_DECREF(array4); + if (is_new_object3 && array3) Py_DECREF(array3); } return NULL; } @@ -47631,64 +47622,55 @@ SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; - int arg2 ; + int *arg2 ; int *arg3 ; - int *arg4 ; - signed char *arg5 ; + signed char *arg4 ; int val1 ; int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; + PyArrayObject *array2 = NULL ; + int is_new_object2 ; + PyArrayObject *temp3 = NULL ; PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sort_indices" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); { npy_intp size[1] = { -1 }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; + array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_INT, &is_new_object2); + if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1) + || !require_contiguous(array2) || !require_native(array2)) SWIG_fail; - arg3 = (int*) array3->data; + arg2 = (int*) array2->data; } { - temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); - if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; - arg4 = (int*) array_data(temp4); + temp3 = obj_to_array_no_conversion(obj2,PyArray_INT); + if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; + arg3 = (int*) array_data(temp3); } { - temp5 = obj_to_array_no_conversion(obj4,PyArray_BYTE); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (signed char*) array_data(temp5); + temp4 = obj_to_array_no_conversion(obj3,PyArray_BYTE); + if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; + arg4 = (signed char*) array_data(temp4); } - csr_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csr_sort_indices(arg1,(int const (*))arg2,arg3,arg4); resultobj = SWIG_Py_Void(); { - if (is_new_object3 && array3) Py_DECREF(array3); + if (is_new_object2 && array2) Py_DECREF(array2); } return resultobj; fail: { - if (is_new_object3 && array3) Py_DECREF(array3); + if (is_new_object2 && array2) Py_DECREF(array2); } return NULL; } @@ -47697,64 +47679,55 @@ SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; - int arg2 ; + int *arg2 ; int *arg3 ; - int *arg4 ; - unsigned char *arg5 ; + unsigned char *arg4 ; int val1 ; int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; + PyArrayObject *array2 = NULL ; + int is_new_object2 ; + PyArrayObject *temp3 = NULL ; PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sort_indices" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); { npy_intp size[1] = { -1 }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; + array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_INT, &is_new_object2); + if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1) + || !require_contiguous(array2) || !require_native(array2)) SWIG_fail; - arg3 = (int*) array3->data; + arg2 = (int*) array2->data; } { - temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); - if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; - arg4 = (int*) array_data(temp4); + temp3 = obj_to_array_no_conversion(obj2,PyArray_INT); + if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; + arg3 = (int*) array_data(temp3); } { - temp5 = obj_to_array_no_conversion(obj4,PyArray_UBYTE); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (unsigned char*) array_data(temp5); + temp4 = obj_to_array_no_conversion(obj3,PyArray_UBYTE); + if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; + arg4 = (unsigned char*) array_data(temp4); } - csr_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csr_sort_indices(arg1,(int const (*))arg2,arg3,arg4); resultobj = SWIG_Py_Void(); { - if (is_new_object3 && array3) Py_DECREF(array3); + if (is_new_object2 && array2) Py_DECREF(array2); } return resultobj; fail: { - if (is_new_object3 && array3) Py_DECREF(array3); + if (is_new_object2 && array2) Py_DECREF(array2); } return NULL; } @@ -47763,64 +47736,55 @@ SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; - int arg2 ; + int *arg2 ; int *arg3 ; - int *arg4 ; - short *arg5 ; + short *arg4 ; int val1 ; int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; + PyArrayObject *array2 = NULL ; + int is_new_object2 ; + PyArrayObject *temp3 = NULL ; PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sort_indices" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); { npy_intp size[1] = { -1 }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; + array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_INT, &is_new_object2); + if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1) + || !require_contiguous(array2) || !require_native(array2)) SWIG_fail; - arg3 = (int*) array3->data; + arg2 = (int*) array2->data; } { - temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); - if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; - arg4 = (int*) array_data(temp4); + temp3 = obj_to_array_no_conversion(obj2,PyArray_INT); + if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; + arg3 = (int*) array_data(temp3); } { - temp5 = obj_to_array_no_conversion(obj4,PyArray_SHORT); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (short*) array_data(temp5); + temp4 = obj_to_array_no_conversion(obj3,PyArray_SHORT); + if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; + arg4 = (short*) array_data(temp4); } - csr_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csr_sort_indices(arg1,(int const (*))arg2,arg3,arg4); resultobj = SWIG_Py_Void(); { - if (is_new_object3 && array3) Py_DECREF(array3); + if (is_new_object2 && array2) Py_DECREF(array2); } return resultobj; fail: { - if (is_new_object3 && array3) Py_DECREF(array3); + if (is_new_object2 && array2) Py_DECREF(array2); } return NULL; } @@ -47829,64 +47793,55 @@ SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; - int arg2 ; + int *arg2 ; int *arg3 ; int *arg4 ; - int *arg5 ; int val1 ; int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; + PyArrayObject *array2 = NULL ; + int is_new_object2 ; + PyArrayObject *temp3 = NULL ; PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sort_indices" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); { npy_intp size[1] = { -1 }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; + array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_INT, &is_new_object2); + if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1) + || !require_contiguous(array2) || !require_native(array2)) SWIG_fail; - arg3 = (int*) array3->data; + arg2 = (int*) array2->data; } { + temp3 = obj_to_array_no_conversion(obj2,PyArray_INT); + if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; + arg3 = (int*) array_data(temp3); + } + { temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; arg4 = (int*) array_data(temp4); } - { - temp5 = obj_to_array_no_conversion(obj4,PyArray_INT); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (int*) array_data(temp5); - } - csr_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csr_sort_indices(arg1,(int const (*))arg2,arg3,arg4); resultobj = SWIG_Py_Void(); { - if (is_new_object3 && array3) Py_DECREF(array3); + if (is_new_object2 && array2) Py_DECREF(array2); } return resultobj; fail: { - if (is_new_object3 && array3) Py_DECREF(array3); + if (is_new_object2 && array2) Py_DECREF(array2); } return NULL; } @@ -47895,64 +47850,55 @@ SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; - int arg2 ; + int *arg2 ; int *arg3 ; - int *arg4 ; - long long *arg5 ; + long long *arg4 ; int val1 ; int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; + PyArrayObject *array2 = NULL ; + int is_new_object2 ; + PyArrayObject *temp3 = NULL ; PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sort_indices" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); { npy_intp size[1] = { -1 }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; + array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_INT, &is_new_object2); + if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1) + || !require_contiguous(array2) || !require_native(array2)) SWIG_fail; - arg3 = (int*) array3->data; + arg2 = (int*) array2->data; } { - temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); - if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; - arg4 = (int*) array_data(temp4); + temp3 = obj_to_array_no_conversion(obj2,PyArray_INT); + if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; + arg3 = (int*) array_data(temp3); } { - temp5 = obj_to_array_no_conversion(obj4,PyArray_LONGLONG); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (long long*) array_data(temp5); + temp4 = obj_to_array_no_conversion(obj3,PyArray_LONGLONG); + if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; + arg4 = (long long*) array_data(temp4); } - csr_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csr_sort_indices(arg1,(int const (*))arg2,arg3,arg4); resultobj = SWIG_Py_Void(); { - if (is_new_object3 && array3) Py_DECREF(array3); + if (is_new_object2 && array2) Py_DECREF(array2); } return resultobj; fail: { - if (is_new_object3 && array3) Py_DECREF(array3); + if (is_new_object2 && array2) Py_DECREF(array2); } return NULL; } @@ -47961,64 +47907,55 @@ SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; - int arg2 ; + int *arg2 ; int *arg3 ; - int *arg4 ; - float *arg5 ; + float *arg4 ; int val1 ; int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; + PyArrayObject *array2 = NULL ; + int is_new_object2 ; + PyArrayObject *temp3 = NULL ; PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sort_indices" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); { npy_intp size[1] = { -1 }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; + array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_INT, &is_new_object2); + if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1) + || !require_contiguous(array2) || !require_native(array2)) SWIG_fail; - arg3 = (int*) array3->data; + arg2 = (int*) array2->data; } { - temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); - if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; - arg4 = (int*) array_data(temp4); + temp3 = obj_to_array_no_conversion(obj2,PyArray_INT); + if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; + arg3 = (int*) array_data(temp3); } { - temp5 = obj_to_array_no_conversion(obj4,PyArray_FLOAT); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (float*) array_data(temp5); + temp4 = obj_to_array_no_conversion(obj3,PyArray_FLOAT); + if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; + arg4 = (float*) array_data(temp4); } - csr_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csr_sort_indices(arg1,(int const (*))arg2,arg3,arg4); resultobj = SWIG_Py_Void(); { - if (is_new_object3 && array3) Py_DECREF(array3); + if (is_new_object2 && array2) Py_DECREF(array2); } return resultobj; fail: { - if (is_new_object3 && array3) Py_DECREF(array3); + if (is_new_object2 && array2) Py_DECREF(array2); } return NULL; } @@ -48027,64 +47964,55 @@ SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; - int arg2 ; + int *arg2 ; int *arg3 ; - int *arg4 ; - double *arg5 ; + double *arg4 ; int val1 ; int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; + PyArrayObject *array2 = NULL ; + int is_new_object2 ; + PyArrayObject *temp3 = NULL ; PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sort_indices" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); { npy_intp size[1] = { -1 }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; + array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_INT, &is_new_object2); + if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1) + || !require_contiguous(array2) || !require_native(array2)) SWIG_fail; - arg3 = (int*) array3->data; + arg2 = (int*) array2->data; } { - temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); - if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; - arg4 = (int*) array_data(temp4); + temp3 = obj_to_array_no_conversion(obj2,PyArray_INT); + if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; + arg3 = (int*) array_data(temp3); } { - temp5 = obj_to_array_no_conversion(obj4,PyArray_DOUBLE); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (double*) array_data(temp5); + temp4 = obj_to_array_no_conversion(obj3,PyArray_DOUBLE); + if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; + arg4 = (double*) array_data(temp4); } - csr_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csr_sort_indices(arg1,(int const (*))arg2,arg3,arg4); resultobj = SWIG_Py_Void(); { - if (is_new_object3 && array3) Py_DECREF(array3); + if (is_new_object2 && array2) Py_DECREF(array2); } return resultobj; fail: { - if (is_new_object3 && array3) Py_DECREF(array3); + if (is_new_object2 && array2) Py_DECREF(array2); } return NULL; } @@ -48093,64 +48021,55 @@ SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; - int arg2 ; + int *arg2 ; int *arg3 ; - int *arg4 ; - npy_cfloat_wrapper *arg5 ; + npy_cfloat_wrapper *arg4 ; int val1 ; int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; + PyArrayObject *array2 = NULL ; + int is_new_object2 ; + PyArrayObject *temp3 = NULL ; PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sort_indices" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); { npy_intp size[1] = { -1 }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; + array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_INT, &is_new_object2); + if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1) + || !require_contiguous(array2) || !require_native(array2)) SWIG_fail; - arg3 = (int*) array3->data; + arg2 = (int*) array2->data; } { - temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); - if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; - arg4 = (int*) array_data(temp4); + temp3 = obj_to_array_no_conversion(obj2,PyArray_INT); + if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; + arg3 = (int*) array_data(temp3); } { - temp5 = obj_to_array_no_conversion(obj4,PyArray_CFLOAT); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (npy_cfloat_wrapper*) array_data(temp5); + temp4 = obj_to_array_no_conversion(obj3,PyArray_CFLOAT); + if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; + arg4 = (npy_cfloat_wrapper*) array_data(temp4); } - csr_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csr_sort_indices(arg1,(int const (*))arg2,arg3,arg4); resultobj = SWIG_Py_Void(); { - if (is_new_object3 && array3) Py_DECREF(array3); + if (is_new_object2 && array2) Py_DECREF(array2); } return resultobj; fail: { - if (is_new_object3 && array3) Py_DECREF(array3); + if (is_new_object2 && array2) Py_DECREF(array2); } return NULL; } @@ -48159,64 +48078,55 @@ SWIGINTERN PyObject *_wrap_csr_sort_indices__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; - int arg2 ; + int *arg2 ; int *arg3 ; - int *arg4 ; - npy_cdouble_wrapper *arg5 ; + npy_cdouble_wrapper *arg4 ; int val1 ; int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; + PyArrayObject *array2 = NULL ; + int is_new_object2 ; + PyArrayObject *temp3 = NULL ; PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOO:csr_sort_indices",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_sort_indices" "', argument " "1"" of type '" "int""'"); } arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_sort_indices" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); { npy_intp size[1] = { -1 }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; + array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_INT, &is_new_object2); + if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1) + || !require_contiguous(array2) || !require_native(array2)) SWIG_fail; - arg3 = (int*) array3->data; + arg2 = (int*) array2->data; } { - temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); - if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; - arg4 = (int*) array_data(temp4); + temp3 = obj_to_array_no_conversion(obj2,PyArray_INT); + if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; + arg3 = (int*) array_data(temp3); } { - temp5 = obj_to_array_no_conversion(obj4,PyArray_CDOUBLE); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (npy_cdouble_wrapper*) array_data(temp5); + temp4 = obj_to_array_no_conversion(obj3,PyArray_CDOUBLE); + if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; + arg4 = (npy_cdouble_wrapper*) array_data(temp4); } - csr_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); + csr_sort_indices(arg1,(int const (*))arg2,arg3,arg4); resultobj = SWIG_Py_Void(); { - if (is_new_object3 && array3) Py_DECREF(array3); + if (is_new_object2 && array2) Py_DECREF(array2); } return resultobj; fail: { - if (is_new_object3 && array3) Py_DECREF(array3); + if (is_new_object2 && array2) Py_DECREF(array2); } return NULL; } @@ -48224,15 +48134,15 @@ SWIGINTERN PyObject *_wrap_csr_sort_indices(PyObject *self, PyObject *args) { int argc; - PyObject *argv[6]; + PyObject *argv[5]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 5); ii++) { + for (ii = 0; (ii < argc) && (ii < 4); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } - if (argc == 5) { + if (argc == 4) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -48240,8 +48150,7 @@ } if (_v) { { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); + _v = (is_array(argv[1]) && PyArray_CanCastSafely(PyArray_TYPE(argv[1]),PyArray_INT)) ? 1 : 0; } if (_v) { { @@ -48249,21 +48158,16 @@ } if (_v) { { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; + _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_BYTE)) ? 1 : 0; - } - if (_v) { - return _wrap_csr_sort_indices__SWIG_1(self, args); - } + return _wrap_csr_sort_indices__SWIG_1(self, args); } } } } } - if (argc == 5) { + if (argc == 4) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -48271,8 +48175,7 @@ } if (_v) { { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); + _v = (is_array(argv[1]) && PyArray_CanCastSafely(PyArray_TYPE(argv[1]),PyArray_INT)) ? 1 : 0; } if (_v) { { @@ -48280,21 +48183,16 @@ } if (_v) { { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; + _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_UBYTE)) ? 1 : 0; - } - if (_v) { - return _wrap_csr_sort_indices__SWIG_2(self, args); - } + return _wrap_csr_sort_indices__SWIG_2(self, args); } } } } } - if (argc == 5) { + if (argc == 4) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -48302,8 +48200,7 @@ } if (_v) { { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); + _v = (is_array(argv[1]) && PyArray_CanCastSafely(PyArray_TYPE(argv[1]),PyArray_INT)) ? 1 : 0; } if (_v) { { @@ -48311,21 +48208,16 @@ } if (_v) { { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; + _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_SHORT)) ? 1 : 0; - } - if (_v) { - return _wrap_csr_sort_indices__SWIG_3(self, args); - } + return _wrap_csr_sort_indices__SWIG_3(self, args); } } } } } - if (argc == 5) { + if (argc == 4) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -48333,8 +48225,7 @@ } if (_v) { { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); + _v = (is_array(argv[1]) && PyArray_CanCastSafely(PyArray_TYPE(argv[1]),PyArray_INT)) ? 1 : 0; } if (_v) { { @@ -48345,18 +48236,13 @@ _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; } if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - return _wrap_csr_sort_indices__SWIG_4(self, args); - } + return _wrap_csr_sort_indices__SWIG_4(self, args); } } } } } - if (argc == 5) { + if (argc == 4) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -48364,8 +48250,7 @@ } if (_v) { { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); + _v = (is_array(argv[1]) && PyArray_CanCastSafely(PyArray_TYPE(argv[1]),PyArray_INT)) ? 1 : 0; } if (_v) { { @@ -48373,21 +48258,16 @@ } if (_v) { { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; + _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_LONGLONG)) ? 1 : 0; - } - if (_v) { - return _wrap_csr_sort_indices__SWIG_5(self, args); - } + return _wrap_csr_sort_indices__SWIG_5(self, args); } } } } } - if (argc == 5) { + if (argc == 4) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -48395,8 +48275,7 @@ } if (_v) { { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); + _v = (is_array(argv[1]) && PyArray_CanCastSafely(PyArray_TYPE(argv[1]),PyArray_INT)) ? 1 : 0; } if (_v) { { @@ -48404,21 +48283,16 @@ } if (_v) { { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; + _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0; - } - if (_v) { - return _wrap_csr_sort_indices__SWIG_6(self, args); - } + return _wrap_csr_sort_indices__SWIG_6(self, args); } } } } } - if (argc == 5) { + if (argc == 4) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -48426,8 +48300,7 @@ } if (_v) { { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); + _v = (is_array(argv[1]) && PyArray_CanCastSafely(PyArray_TYPE(argv[1]),PyArray_INT)) ? 1 : 0; } if (_v) { { @@ -48435,21 +48308,16 @@ } if (_v) { { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; + _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0; - } - if (_v) { - return _wrap_csr_sort_indices__SWIG_7(self, args); - } + return _wrap_csr_sort_indices__SWIG_7(self, args); } } } } } - if (argc == 5) { + if (argc == 4) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -48457,8 +48325,7 @@ } if (_v) { { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); + _v = (is_array(argv[1]) && PyArray_CanCastSafely(PyArray_TYPE(argv[1]),PyArray_INT)) ? 1 : 0; } if (_v) { { @@ -48466,21 +48333,16 @@ } if (_v) { { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; + _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CFLOAT)) ? 1 : 0; - } - if (_v) { - return _wrap_csr_sort_indices__SWIG_8(self, args); - } + return _wrap_csr_sort_indices__SWIG_8(self, args); } } } } } - if (argc == 5) { + if (argc == 4) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -48488,8 +48350,7 @@ } if (_v) { { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); + _v = (is_array(argv[1]) && PyArray_CanCastSafely(PyArray_TYPE(argv[1]),PyArray_INT)) ? 1 : 0; } if (_v) { { @@ -48497,15 +48358,10 @@ } if (_v) { { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; + _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CDOUBLE)) ? 1 : 0; - } - if (_v) { - return _wrap_csr_sort_indices__SWIG_9(self, args); - } + return _wrap_csr_sort_indices__SWIG_9(self, args); } } } @@ -48513,901 +48369,11 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_sort_indices'.\n Possible C/C++ prototypes are:\n"" csr_sort_indices<(int,signed char)>(int const,int const,int const [],int [],signed char [])\n"" csr_sort_indices<(int,unsigned char)>(int const,int const,int const [],int [],unsigned char [])\n"" csr_sort_indices<(int,short)>(int const,int const,int const [],int [],short [])\n"" csr_sort_indices<(int,int)>(int const,int const,int const [],int [],int [])\n"" csr_sort_indices<(int,long long)>(int const,int const,int const [],int [],long long [])\n"" csr_sort_indices<(int,float)>(int const,int const,int const [],int [],float [])\n"" csr_sort_indices<(int,double)>(int const,int const,int const [],int [],double [])\n"" csr_sort_indices<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int [],npy_cfloat_wrapper [])\n"" csr_sort_indices<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int [],npy_cdouble_wrapper [])\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_sort_indices'.\n Possible C/C++ prototypes are:\n"" csr_sort_indices<(int,signed char)>(int const,int const [],int [],signed char [])\n"" csr_sort_indices<(int,unsigned char)>(int const,int const [],int [],unsigned char [])\n"" csr_sort_indices<(int,short)>(int const,int const [],int [],short [])\n"" csr_sort_indices<(int,int)>(int const,int const [],int [],int [])\n"" csr_sort_indices<(int,long long)>(int const,int const [],int [],long long [])\n"" csr_sort_indices<(int,float)>(int const,int const [],int [],float [])\n"" csr_sort_indices<(int,double)>(int const,int const [],int [],double [])\n"" csr_sort_indices<(int,npy_cfloat_wrapper)>(int const,int const [],int [],npy_cfloat_wrapper [])\n"" csr_sort_indices<(int,npy_cdouble_wrapper)>(int const,int const [],int [],npy_cdouble_wrapper [])\n"); return NULL; } -SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - signed char *arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sort_indices" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); - if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; - arg4 = (int*) array_data(temp4); - } - { - temp5 = obj_to_array_no_conversion(obj4,PyArray_BYTE); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (signed char*) array_data(temp5); - } - csc_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - unsigned char *arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sort_indices" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); - if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; - arg4 = (int*) array_data(temp4); - } - { - temp5 = obj_to_array_no_conversion(obj4,PyArray_UBYTE); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (unsigned char*) array_data(temp5); - } - csc_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - short *arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sort_indices" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); - if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; - arg4 = (int*) array_data(temp4); - } - { - temp5 = obj_to_array_no_conversion(obj4,PyArray_SHORT); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (short*) array_data(temp5); - } - csc_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - int *arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sort_indices" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); - if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; - arg4 = (int*) array_data(temp4); - } - { - temp5 = obj_to_array_no_conversion(obj4,PyArray_INT); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (int*) array_data(temp5); - } - csc_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - long long *arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sort_indices" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); - if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; - arg4 = (int*) array_data(temp4); - } - { - temp5 = obj_to_array_no_conversion(obj4,PyArray_LONGLONG); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (long long*) array_data(temp5); - } - csc_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - float *arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sort_indices" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); - if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; - arg4 = (int*) array_data(temp4); - } - { - temp5 = obj_to_array_no_conversion(obj4,PyArray_FLOAT); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (float*) array_data(temp5); - } - csc_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - double *arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sort_indices" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); - if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; - arg4 = (int*) array_data(temp4); - } - { - temp5 = obj_to_array_no_conversion(obj4,PyArray_DOUBLE); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (double*) array_data(temp5); - } - csc_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - npy_cfloat_wrapper *arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sort_indices" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); - if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; - arg4 = (int*) array_data(temp4); - } - { - temp5 = obj_to_array_no_conversion(obj4,PyArray_CFLOAT); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (npy_cfloat_wrapper*) array_data(temp5); - } - csc_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csc_sort_indices__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - npy_cdouble_wrapper *arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *array3 = NULL ; - int is_new_object3 ; - PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sort_indices",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sort_indices" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sort_indices" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - npy_intp size[1] = { - -1 - }; - array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3); - if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1) - || !require_contiguous(array3) || !require_native(array3)) SWIG_fail; - - arg3 = (int*) array3->data; - } - { - temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); - if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; - arg4 = (int*) array_data(temp4); - } - { - temp5 = obj_to_array_no_conversion(obj4,PyArray_CDOUBLE); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (npy_cdouble_wrapper*) array_data(temp5); - } - csc_sort_indices(arg1,arg2,(int const (*))arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - return resultobj; -fail: - { - if (is_new_object3 && array3) Py_DECREF(array3); - } - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csc_sort_indices(PyObject *self, PyObject *args) { - int argc; - PyObject *argv[6]; - int ii; - - if (!PyTuple_Check(args)) SWIG_fail; - argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 5); ii++) { - argv[ii] = PyTuple_GET_ITEM(args,ii); - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_BYTE)) ? 1 : 0; - } - if (_v) { - return _wrap_csc_sort_indices__SWIG_1(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_UBYTE)) ? 1 : 0; - } - if (_v) { - return _wrap_csc_sort_indices__SWIG_2(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_SHORT)) ? 1 : 0; - } - if (_v) { - return _wrap_csc_sort_indices__SWIG_3(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - return _wrap_csc_sort_indices__SWIG_4(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_LONGLONG)) ? 1 : 0; - } - if (_v) { - return _wrap_csc_sort_indices__SWIG_5(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0; - } - if (_v) { - return _wrap_csc_sort_indices__SWIG_6(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0; - } - if (_v) { - return _wrap_csc_sort_indices__SWIG_7(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CFLOAT)) ? 1 : 0; - } - if (_v) { - return _wrap_csc_sort_indices__SWIG_8(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CDOUBLE)) ? 1 : 0; - } - if (_v) { - return _wrap_csc_sort_indices__SWIG_9(self, args); - } - } - } - } - } - } - -fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_sort_indices'.\n Possible C/C++ prototypes are:\n"" csc_sort_indices<(int,signed char)>(int const,int const,int const [],int [],signed char [])\n"" csc_sort_indices<(int,unsigned char)>(int const,int const,int const [],int [],unsigned char [])\n"" csc_sort_indices<(int,short)>(int const,int const,int const [],int [],short [])\n"" csc_sort_indices<(int,int)>(int const,int const,int const [],int [],int [])\n"" csc_sort_indices<(int,long long)>(int const,int const,int const [],int [],long long [])\n"" csc_sort_indices<(int,float)>(int const,int const,int const [],int [],float [])\n"" csc_sort_indices<(int,double)>(int const,int const,int const [],int [],double [])\n"" csc_sort_indices<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int [],npy_cfloat_wrapper [])\n"" csc_sort_indices<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int [],npy_cdouble_wrapper [])\n"); - return NULL; -} - - SWIGINTERN PyObject *_wrap_csr_sum_duplicates__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; @@ -50190,788 +49156,6 @@ } -SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - signed char *arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *temp3 = NULL ; - PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - temp3 = obj_to_array_no_conversion(obj2,PyArray_INT); - if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; - arg3 = (int*) array_data(temp3); - } - { - temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); - if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; - arg4 = (int*) array_data(temp4); - } - { - temp5 = obj_to_array_no_conversion(obj4,PyArray_BYTE); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (signed char*) array_data(temp5); - } - csc_sum_duplicates(arg1,arg2,arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - unsigned char *arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *temp3 = NULL ; - PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - temp3 = obj_to_array_no_conversion(obj2,PyArray_INT); - if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; - arg3 = (int*) array_data(temp3); - } - { - temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); - if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; - arg4 = (int*) array_data(temp4); - } - { - temp5 = obj_to_array_no_conversion(obj4,PyArray_UBYTE); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (unsigned char*) array_data(temp5); - } - csc_sum_duplicates(arg1,arg2,arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - short *arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *temp3 = NULL ; - PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - temp3 = obj_to_array_no_conversion(obj2,PyArray_INT); - if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; - arg3 = (int*) array_data(temp3); - } - { - temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); - if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; - arg4 = (int*) array_data(temp4); - } - { - temp5 = obj_to_array_no_conversion(obj4,PyArray_SHORT); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (short*) array_data(temp5); - } - csc_sum_duplicates(arg1,arg2,arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - int *arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *temp3 = NULL ; - PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - temp3 = obj_to_array_no_conversion(obj2,PyArray_INT); - if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; - arg3 = (int*) array_data(temp3); - } - { - temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); - if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; - arg4 = (int*) array_data(temp4); - } - { - temp5 = obj_to_array_no_conversion(obj4,PyArray_INT); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (int*) array_data(temp5); - } - csc_sum_duplicates(arg1,arg2,arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - long long *arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *temp3 = NULL ; - PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - temp3 = obj_to_array_no_conversion(obj2,PyArray_INT); - if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; - arg3 = (int*) array_data(temp3); - } - { - temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); - if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; - arg4 = (int*) array_data(temp4); - } - { - temp5 = obj_to_array_no_conversion(obj4,PyArray_LONGLONG); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (long long*) array_data(temp5); - } - csc_sum_duplicates(arg1,arg2,arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - float *arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *temp3 = NULL ; - PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - temp3 = obj_to_array_no_conversion(obj2,PyArray_INT); - if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; - arg3 = (int*) array_data(temp3); - } - { - temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); - if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; - arg4 = (int*) array_data(temp4); - } - { - temp5 = obj_to_array_no_conversion(obj4,PyArray_FLOAT); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (float*) array_data(temp5); - } - csc_sum_duplicates(arg1,arg2,arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - double *arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *temp3 = NULL ; - PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - temp3 = obj_to_array_no_conversion(obj2,PyArray_INT); - if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; - arg3 = (int*) array_data(temp3); - } - { - temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); - if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; - arg4 = (int*) array_data(temp4); - } - { - temp5 = obj_to_array_no_conversion(obj4,PyArray_DOUBLE); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (double*) array_data(temp5); - } - csc_sum_duplicates(arg1,arg2,arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - npy_cfloat_wrapper *arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *temp3 = NULL ; - PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - temp3 = obj_to_array_no_conversion(obj2,PyArray_INT); - if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; - arg3 = (int*) array_data(temp3); - } - { - temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); - if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; - arg4 = (int*) array_data(temp4); - } - { - temp5 = obj_to_array_no_conversion(obj4,PyArray_CFLOAT); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (npy_cfloat_wrapper*) array_data(temp5); - } - csc_sum_duplicates(arg1,arg2,arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csc_sum_duplicates__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int *arg4 ; - npy_cdouble_wrapper *arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyArrayObject *temp3 = NULL ; - PyArrayObject *temp4 = NULL ; - PyArrayObject *temp5 = NULL ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOO:csc_sum_duplicates",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_sum_duplicates" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csc_sum_duplicates" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - { - temp3 = obj_to_array_no_conversion(obj2,PyArray_INT); - if (!temp3 || !require_contiguous(temp3) || !require_native(temp3)) SWIG_fail; - arg3 = (int*) array_data(temp3); - } - { - temp4 = obj_to_array_no_conversion(obj3,PyArray_INT); - if (!temp4 || !require_contiguous(temp4) || !require_native(temp4)) SWIG_fail; - arg4 = (int*) array_data(temp4); - } - { - temp5 = obj_to_array_no_conversion(obj4,PyArray_CDOUBLE); - if (!temp5 || !require_contiguous(temp5) || !require_native(temp5)) SWIG_fail; - arg5 = (npy_cdouble_wrapper*) array_data(temp5); - } - csc_sum_duplicates(arg1,arg2,arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_csc_sum_duplicates(PyObject *self, PyObject *args) { - int argc; - PyObject *argv[6]; - int ii; - - if (!PyTuple_Check(args)) SWIG_fail; - argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 5); ii++) { - argv[ii] = PyTuple_GET_ITEM(args,ii); - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_BYTE)) ? 1 : 0; - } - if (_v) { - return _wrap_csc_sum_duplicates__SWIG_1(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_UBYTE)) ? 1 : 0; - } - if (_v) { - return _wrap_csc_sum_duplicates__SWIG_2(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_SHORT)) ? 1 : 0; - } - if (_v) { - return _wrap_csc_sum_duplicates__SWIG_3(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - return _wrap_csc_sum_duplicates__SWIG_4(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_LONGLONG)) ? 1 : 0; - } - if (_v) { - return _wrap_csc_sum_duplicates__SWIG_5(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_FLOAT)) ? 1 : 0; - } - if (_v) { - return _wrap_csc_sum_duplicates__SWIG_6(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_DOUBLE)) ? 1 : 0; - } - if (_v) { - return _wrap_csc_sum_duplicates__SWIG_7(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CFLOAT)) ? 1 : 0; - } - if (_v) { - return _wrap_csc_sum_duplicates__SWIG_8(self, args); - } - } - } - } - } - } - if (argc == 5) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - _v = (is_array(argv[2]) && PyArray_CanCastSafely(PyArray_TYPE(argv[2]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[3]) && PyArray_CanCastSafely(PyArray_TYPE(argv[3]),PyArray_INT)) ? 1 : 0; - } - if (_v) { - { - _v = (is_array(argv[4]) && PyArray_CanCastSafely(PyArray_TYPE(argv[4]),PyArray_CDOUBLE)) ? 1 : 0; - } - if (_v) { - return _wrap_csc_sum_duplicates__SWIG_9(self, args); - } - } - } - } - } - } - -fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_sum_duplicates'.\n Possible C/C++ prototypes are:\n"" csc_sum_duplicates<(int,signed char)>(int const,int const,int [],int [],signed char [])\n"" csc_sum_duplicates<(int,unsigned char)>(int const,int const,int [],int [],unsigned char [])\n"" csc_sum_duplicates<(int,short)>(int const,int const,int [],int [],short [])\n"" csc_sum_duplicates<(int,int)>(int const,int const,int [],int [],int [])\n"" csc_sum_duplicates<(int,long long)>(int const,int const,int [],int [],long long [])\n"" csc_sum_duplicates<(int,float)>(int const,int const,int [],int [],float [])\n"" csc_sum_duplicates<(int,double)>(int const,int const,int [],int [],double [])\n"" csc_sum_duplicates<(int,npy_cfloat_wrapper)>(int const,int const,int [],int [],npy_cfloat_wrapper [])\n"" csc_sum_duplicates<(int,npy_cdouble_wrapper)>(int const,int const,int [],int [],npy_cdouble_wrapper [])\n"); - return NULL; -} - - SWIGINTERN PyObject *_wrap_get_csr_submatrix__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; @@ -53588,29 +51772,18 @@ " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" " std::vector<(npy_cdouble_wrapper)> Cx)\n" ""}, - { (char *)"has_sorted_indices", _wrap_has_sorted_indices, METH_VARARGS, (char *)"has_sorted_indices(int n_row, int n_col, int Ap, int Aj) -> bool"}, + { (char *)"csr_has_sorted_indices", _wrap_csr_has_sorted_indices, METH_VARARGS, (char *)"csr_has_sorted_indices(int n_row, int Ap, int Aj) -> bool"}, { (char *)"csr_sort_indices", _wrap_csr_sort_indices, METH_VARARGS, (char *)"\n" - "csr_sort_indices(int n_row, int n_col, int Ap, int Aj, signed char Ax)\n" - "csr_sort_indices(int n_row, int n_col, int Ap, int Aj, unsigned char Ax)\n" - "csr_sort_indices(int n_row, int n_col, int Ap, int Aj, short Ax)\n" - "csr_sort_indices(int n_row, int n_col, int Ap, int Aj, int Ax)\n" - "csr_sort_indices(int n_row, int n_col, int Ap, int Aj, long long Ax)\n" - "csr_sort_indices(int n_row, int n_col, int Ap, int Aj, float Ax)\n" - "csr_sort_indices(int n_row, int n_col, int Ap, int Aj, double Ax)\n" - "csr_sort_indices(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax)\n" - "csr_sort_indices(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax)\n" + "csr_sort_indices(int n_row, int Ap, int Aj, signed char Ax)\n" + "csr_sort_indices(int n_row, int Ap, int Aj, unsigned char Ax)\n" + "csr_sort_indices(int n_row, int Ap, int Aj, short Ax)\n" + "csr_sort_indices(int n_row, int Ap, int Aj, int Ax)\n" + "csr_sort_indices(int n_row, int Ap, int Aj, long long Ax)\n" + "csr_sort_indices(int n_row, int Ap, int Aj, float Ax)\n" + "csr_sort_indices(int n_row, int Ap, int Aj, double Ax)\n" + "csr_sort_indices(int n_row, int Ap, int Aj, npy_cfloat_wrapper Ax)\n" + "csr_sort_indices(int n_row, int Ap, int Aj, npy_cdouble_wrapper Ax)\n" ""}, - { (char *)"csc_sort_indices", _wrap_csc_sort_indices, METH_VARARGS, (char *)"\n" - "csc_sort_indices(int n_row, int n_col, int Ap, int Ai, signed char Ax)\n" - "csc_sort_indices(int n_row, int n_col, int Ap, int Ai, unsigned char Ax)\n" - "csc_sort_indices(int n_row, int n_col, int Ap, int Ai, short Ax)\n" - "csc_sort_indices(int n_row, int n_col, int Ap, int Ai, int Ax)\n" - "csc_sort_indices(int n_row, int n_col, int Ap, int Ai, long long Ax)\n" - "csc_sort_indices(int n_row, int n_col, int Ap, int Ai, float Ax)\n" - "csc_sort_indices(int n_row, int n_col, int Ap, int Ai, double Ax)\n" - "csc_sort_indices(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax)\n" - "csc_sort_indices(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax)\n" - ""}, { (char *)"csr_sum_duplicates", _wrap_csr_sum_duplicates, METH_VARARGS, (char *)"\n" "csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, signed char Ax)\n" "csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, unsigned char Ax)\n" @@ -53622,17 +51795,6 @@ "csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax)\n" "csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax)\n" ""}, - { (char *)"csc_sum_duplicates", _wrap_csc_sum_duplicates, METH_VARARGS, (char *)"\n" - "csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, signed char Ax)\n" - "csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, unsigned char Ax)\n" - "csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, short Ax)\n" - "csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, int Ax)\n" - "csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, long long Ax)\n" - "csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, float Ax)\n" - "csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, double Ax)\n" - "csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax)\n" - "csc_sum_duplicates(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax)\n" - ""}, { (char *)"get_csr_submatrix", _wrap_get_csr_submatrix, METH_VARARGS, (char *)"\n" "get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n" " int ir0, int ir1, int ic0, int ic1, std::vector<(int)> Bp, \n" Modified: trunk/scipy/sparse/tests/test_base.py =================================================================== --- trunk/scipy/sparse/tests/test_base.py 2007-12-23 21:07:00 UTC (rev 3699) +++ trunk/scipy/sparse/tests/test_base.py 2007-12-24 00:16:09 UTC (rev 3700) @@ -163,7 +163,8 @@ assert_array_equal(c.todense(),[[1,0,0,4],[9,0,1,0],[0,4,0,0]]) def check_eldiv(self): - assert_array_equal((self.datsp / self.datsp).todense(),[[1,0,0,1],[1,0,1,0],[0,1,0,0]]) + expected = [[1,0,0,1],[1,0,1,0],[0,1,0,0]] + assert_array_equal((self.datsp / self.datsp).todense(),expected) denom = self.spmatrix(matrix([[1,0,0,4],[-1,0,0,0],[0,8,0,-5]],'d')) res = matrix([[1,0,0,0.5],[-3,0,numpy.inf,0],[0,0.25,0,0]],'d') @@ -340,7 +341,8 @@ def check_large(self): # Create a 100x100 matrix with 100 non-zero elements # and play around with it - #TODO make this use self.spmatrix or move it elsewhere + #TODO move this out of Common since it doesn't use spmatrix + random.seed(0) A = dok_matrix((100,100)) for k in range(100): i = random.randrange(100) @@ -496,7 +498,7 @@ class _TestGetSet: def check_setelement(self): - a = self.datsp - self.datsp + a = self.spmatrix((3,4)) a[1,2] = 4.0 a[0,1] = 3 a[2,0] = 2.0 From scipy-svn at scipy.org Mon Dec 24 00:07:15 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 23 Dec 2007 23:07:15 -0600 (CST) Subject: [Scipy-svn] r3701 - in trunk/scipy/sparse: . sparsetools Message-ID: <20071224050715.D3DDB39C4D8@new.scipy.org> Author: wnbell Date: 2007-12-23 23:05:51 -0600 (Sun, 23 Dec 2007) New Revision: 3701 Modified: trunk/scipy/sparse/compressed.py trunk/scipy/sparse/sparsetools/sparsetools.h trunk/scipy/sparse/sparsetools/sparsetools.py trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx Log: use preallocated memory for sparse arithmetic Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-24 00:16:09 UTC (rev 3700) +++ trunk/scipy/sparse/compressed.py 2007-12-24 05:05:51 UTC (rev 3701) @@ -7,7 +7,7 @@ import numpy from numpy import array, matrix, asarray, asmatrix, zeros, rank, intc, \ - empty, hstack, isscalar, ndarray, shape, searchsorted + empty, hstack, isscalar, ndarray, shape, searchsorted, empty_like from base import spmatrix, isspmatrix from data import _data_matrix @@ -547,11 +547,23 @@ # e.g. csr_plus_csr, cscmucsc, etc. fn = getattr(sparsetools, self.format + op + self.format) - indptr, ind, data = fn(in_shape[0], in_shape[1], \ - self.indptr, self.indices, self.data, - other.indptr, other.indices, other.data) - return self.__class__((data, ind, indptr), shape=out_shape) + maxnnz = self.nnz + other.nnz + indptr = empty_like(self.indptr) + indices = empty( maxnnz, dtype=intc ) + data = empty( maxnnz, dtype=upcast(self.dtype,other.dtype) ) + fn(in_shape[0], in_shape[1], \ + self.indptr, self.indices, self.data, + other.indptr, other.indices, other.data, + indptr, indices, data) + + actual_nnz = indptr[-1] + if actual_nnz < maxnnz / 2: + #too much waste, trim arrays + indices = indices[:actual_nnz].copy() + data = data[:actual_nnz].copy() + return self.__class__((data, indices, indptr), shape=out_shape) + def _get_submatrix( self, shape0, shape1, slice0, slice1 ): """Return a submatrix of this matrix (new matrix is created).""" def _process_slice( sl, num ): Modified: trunk/scipy/sparse/sparsetools/sparsetools.h =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.h 2007-12-24 00:16:09 UTC (rev 3700) +++ trunk/scipy/sparse/sparsetools/sparsetools.h 2007-12-24 05:05:51 UTC (rev 3701) @@ -694,17 +694,19 @@ const I Bp[], const I Bj[], const T Bx[], - std::vector* Cp, - std::vector* Cj, - std::vector* Cx, + I Cp[], + I Cj[], + T Cx[], const bin_op& op) { //Method that works for sorted indices assert( csr_has_sorted_indices(n_row,Ap,Aj) ); assert( csr_has_sorted_indices(n_row,Bp,Bj) ); - Cp->resize(n_row + 1, 0); - (*Cp)[0] = 0; + //Cp->resize(n_row + 1, 0); + //(*Cp)[0] = 0; + Cp[0] = 0; + I nnz = 0; for(I i = 0; i < n_row; i++){ I A_pos = Ap[i]; @@ -720,24 +722,27 @@ if(A_j == B_j){ T result = op(Ax[A_pos],Bx[B_pos]); if(result != 0){ - Cj->push_back(A_j); - Cx->push_back(result); + Cj[nnz] = A_j; + Cx[nnz] = result; + nnz++; } A_j = Aj[++A_pos]; B_j = Bj[++B_pos]; } else if (A_j < B_j) { T result = op(Ax[A_pos],0); if (result != 0){ - Cj->push_back(A_j); - Cx->push_back(result); + Cj[nnz] = A_j; + Cx[nnz] = result; + nnz++; } A_j = Aj[++A_pos]; } else { //B_j < A_j T result = op(0,Bx[B_pos]); if (result != 0){ - Cj->push_back(B_j); - Cx->push_back(result); + Cj[nnz] = B_j; + Cx[nnz] = result; + nnz++; } B_j = Bj[++B_pos]; } @@ -747,20 +752,22 @@ while(A_pos < A_end){ T result = op(Ax[A_pos],0); if (result != 0){ - Cj->push_back(A_j); - Cx->push_back(result); + Cj[nnz] = Aj[A_pos]; + Cx[nnz] = result; + nnz++; } - A_j = Aj[++A_pos]; + A_pos++; } while(B_pos < B_end){ T result = op(0,Bx[B_pos]); if (result != 0){ - Cj->push_back(B_j); - Cx->push_back(result); + Cj[nnz] = Bj[B_pos]; + Cx[nnz] = result; + nnz++; } - B_j = Bj[++B_pos]; + B_pos++; } - (*Cp)[i+1] = Cx->size(); + Cp[i+1] = nnz; } @@ -831,7 +838,7 @@ void csr_elmul_csr(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* Cp, std::vector* Cj, std::vector* Cx) + I Cp[], I Cj[], T Cx[]) { csr_binop_csr(n_row,n_col,Ap,Aj,Ax,Bp,Bj,Bx,Cp,Cj,Cx,std::multiplies()); } @@ -840,7 +847,7 @@ void csr_eldiv_csr(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* Cp, std::vector* Cj, std::vector* Cx) + I Cp[], I Cj[], T Cx[]) { csr_binop_csr(n_row,n_col,Ap,Aj,Ax,Bp,Bj,Bx,Cp,Cj,Cx,std::divides()); } @@ -850,16 +857,16 @@ void csr_plus_csr(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* Cp, std::vector* Cj, std::vector* Cx) + I Cp[], I Cj[], T Cx[]) { csr_binop_csr(n_row,n_col,Ap,Aj,Ax,Bp,Bj,Bx,Cp,Cj,Cx,std::plus()); } template void csr_minus_csr(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* Cp, std::vector* Cj, std::vector* Cx) + const I Ap[], const I Aj [], const T Ax [], + const I Bp[], const I Bj [], const T Bx [], + I Cp[], I Cj[], T Cx[]) { csr_binop_csr(n_row,n_col,Ap,Aj,Ax,Bp,Bj,Bx,Cp,Cj,Cx,std::minus()); } @@ -1390,18 +1397,18 @@ template void csc_elmul_csc(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* Cp, std::vector* Ci, std::vector* Cx) + const I Ap[], const I Ai[], const T Ax[], + const I Bp[], const I Bi[], const T Bx[], + I Cp[], I Ci[], T Cx[]) { csr_elmul_csr(n_col, n_row, Ap, Ai, Ax, Bp, Bi, Bx, Cp, Ci, Cx); } template void csc_eldiv_csc(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* Cp, std::vector* Ci, std::vector* Cx) + const I Ap[], const I Ai[], const T Ax[], + const I Bp[], const I Bi[], const T Bx[], + I Cp[], I Ci[], T Cx[]) { csr_eldiv_csr(n_col, n_row, Ap, Ai, Ax, Bp, Bi, Bx, Cp, Ci, Cx); } @@ -1409,18 +1416,18 @@ template void csc_plus_csc(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* Cp, std::vector* Ci, std::vector* Cx) + const I Ap[], const I Ai[], const T Ax[], + const I Bp[], const I Bi[], const T Bx[], + I Cp[], I Ci[], T Cx[]) { csr_plus_csr(n_col, n_row, Ap, Ai, Ax, Bp, Bi, Bx, Cp, Ci, Cx); } template void csc_minus_csc(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* Cp, std::vector* Ci, std::vector* Cx) + const I Ap[], const I Ai[], const T Ax[], + const I Bp[], const I Bi[], const T Bx[], + I Cp[], I Ci[], T Cx[]) { csr_minus_csr(n_col, n_row, Ap, Ai, Ax, Bp, Bi, Bx, Cp, Ci, Cx); } Modified: trunk/scipy/sparse/sparsetools/sparsetools.py =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.py 2007-12-24 00:16:09 UTC (rev 3700) +++ trunk/scipy/sparse/sparsetools/sparsetools.py 2007-12-24 05:05:51 UTC (rev 3701) @@ -336,272 +336,224 @@ def csr_elmul_csr(*args): """ csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, signed char Ax, - int Bp, int Bj, signed char Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(signed char)> Cx) + int Bp, int Bj, signed char Bx, int Cp, int Cj, + signed char Cx) csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, - int Bp, int Bj, unsigned char Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(unsigned char)> Cx) + int Bp, int Bj, unsigned char Bx, int Cp, + int Cj, unsigned char Cx) csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, - int Bj, short Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(short)> Cx) + int Bj, short Bx, int Cp, int Cj, short Cx) csr_elmul_csr(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) + int Bj, int Bx, int Cp, int Cj, int Cx) csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, long long Ax, - int Bp, int Bj, long long Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(long long)> Cx) + int Bp, int Bj, long long Bx, int Cp, int Cj, + long long Cx) csr_elmul_csr(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) + int Bj, float Bx, int Cp, int Cj, float Cx) csr_elmul_csr(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) + int Bj, double Bx, int Cp, int Cj, double Cx) csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(npy_cfloat_wrapper)> Cx) + int Cp, int Cj, npy_cfloat_wrapper Cx) csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(npy_cdouble_wrapper)> Cx) + int Cp, int Cj, npy_cdouble_wrapper Cx) """ return _sparsetools.csr_elmul_csr(*args) def csr_eldiv_csr(*args): """ csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, signed char Ax, - int Bp, int Bj, signed char Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(signed char)> Cx) + int Bp, int Bj, signed char Bx, int Cp, int Cj, + signed char Cx) csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, - int Bp, int Bj, unsigned char Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(unsigned char)> Cx) + int Bp, int Bj, unsigned char Bx, int Cp, + int Cj, unsigned char Cx) csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, - int Bj, short Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(short)> Cx) + int Bj, short Bx, int Cp, int Cj, short Cx) csr_eldiv_csr(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) + int Bj, int Bx, int Cp, int Cj, int Cx) csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, long long Ax, - int Bp, int Bj, long long Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(long long)> Cx) + int Bp, int Bj, long long Bx, int Cp, int Cj, + long long Cx) csr_eldiv_csr(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) + int Bj, float Bx, int Cp, int Cj, float Cx) csr_eldiv_csr(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) + int Bj, double Bx, int Cp, int Cj, double Cx) csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(npy_cfloat_wrapper)> Cx) + int Cp, int Cj, npy_cfloat_wrapper Cx) csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(npy_cdouble_wrapper)> Cx) + int Cp, int Cj, npy_cdouble_wrapper Cx) """ return _sparsetools.csr_eldiv_csr(*args) def csr_plus_csr(*args): """ csr_plus_csr(int n_row, int n_col, int Ap, int Aj, signed char Ax, - int Bp, int Bj, signed char Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(signed char)> Cx) + int Bp, int Bj, signed char Bx, int Cp, int Cj, + signed char Cx) csr_plus_csr(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, - int Bp, int Bj, unsigned char Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(unsigned char)> Cx) + int Bp, int Bj, unsigned char Bx, int Cp, + int Cj, unsigned char Cx) csr_plus_csr(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, - int Bj, short Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(short)> Cx) + int Bj, short Bx, int Cp, int Cj, short Cx) csr_plus_csr(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) + int Bj, int Bx, int Cp, int Cj, int Cx) csr_plus_csr(int n_row, int n_col, int Ap, int Aj, long long Ax, - int Bp, int Bj, long long Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(long long)> Cx) + int Bp, int Bj, long long Bx, int Cp, int Cj, + long long Cx) csr_plus_csr(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) + int Bj, float Bx, int Cp, int Cj, float Cx) csr_plus_csr(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) + int Bj, double Bx, int Cp, int Cj, double Cx) csr_plus_csr(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(npy_cfloat_wrapper)> Cx) + int Cp, int Cj, npy_cfloat_wrapper Cx) csr_plus_csr(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(npy_cdouble_wrapper)> Cx) + int Cp, int Cj, npy_cdouble_wrapper Cx) """ return _sparsetools.csr_plus_csr(*args) def csr_minus_csr(*args): """ csr_minus_csr(int n_row, int n_col, int Ap, int Aj, signed char Ax, - int Bp, int Bj, signed char Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(signed char)> Cx) + int Bp, int Bj, signed char Bx, int Cp, int Cj, + signed char Cx) csr_minus_csr(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, - int Bp, int Bj, unsigned char Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(unsigned char)> Cx) + int Bp, int Bj, unsigned char Bx, int Cp, + int Cj, unsigned char Cx) csr_minus_csr(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, - int Bj, short Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(short)> Cx) + int Bj, short Bx, int Cp, int Cj, short Cx) csr_minus_csr(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) + int Bj, int Bx, int Cp, int Cj, int Cx) csr_minus_csr(int n_row, int n_col, int Ap, int Aj, long long Ax, - int Bp, int Bj, long long Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(long long)> Cx) + int Bp, int Bj, long long Bx, int Cp, int Cj, + long long Cx) csr_minus_csr(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) + int Bj, float Bx, int Cp, int Cj, float Cx) csr_minus_csr(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) + int Bj, double Bx, int Cp, int Cj, double Cx) csr_minus_csr(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(npy_cfloat_wrapper)> Cx) + int Cp, int Cj, npy_cfloat_wrapper Cx) csr_minus_csr(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(npy_cdouble_wrapper)> Cx) + int Cp, int Cj, npy_cdouble_wrapper Cx) """ return _sparsetools.csr_minus_csr(*args) def csc_elmul_csc(*args): """ csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, signed char Ax, - int Bp, int Bi, signed char Bx, std::vector<(int)> Cp, - std::vector<(int)> Ci, std::vector<(signed char)> Cx) + int Bp, int Bi, signed char Bx, int Cp, int Ci, + signed char Cx) csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, - int Bp, int Bi, unsigned char Bx, std::vector<(int)> Cp, - std::vector<(int)> Ci, std::vector<(unsigned char)> Cx) + int Bp, int Bi, unsigned char Bx, int Cp, + int Ci, unsigned char Cx) csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, - int Bi, short Bx, std::vector<(int)> Cp, - std::vector<(int)> Ci, std::vector<(short)> Cx) + int Bi, short Bx, int Cp, int Ci, short Cx) csc_elmul_csc(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) + int Bi, int Bx, int Cp, int Ci, int Cx) csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, long long Ax, - int Bp, int Bi, long long Bx, std::vector<(int)> Cp, - std::vector<(int)> Ci, std::vector<(long long)> Cx) + int Bp, int Bi, long long Bx, int Cp, int Ci, + long long Cx) csc_elmul_csc(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) + int Bi, float Bx, int Cp, int Ci, float Cx) csc_elmul_csc(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) + int Bi, double Bx, int Cp, int Ci, double Cx) csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, int Bp, int Bi, npy_cfloat_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Ci, - std::vector<(npy_cfloat_wrapper)> Cx) + int Cp, int Ci, npy_cfloat_wrapper Cx) csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, int Bp, int Bi, npy_cdouble_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Ci, - std::vector<(npy_cdouble_wrapper)> Cx) + int Cp, int Ci, npy_cdouble_wrapper Cx) """ return _sparsetools.csc_elmul_csc(*args) def csc_eldiv_csc(*args): """ csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, signed char Ax, - int Bp, int Bi, signed char Bx, std::vector<(int)> Cp, - std::vector<(int)> Ci, std::vector<(signed char)> Cx) + int Bp, int Bi, signed char Bx, int Cp, int Ci, + signed char Cx) csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, - int Bp, int Bi, unsigned char Bx, std::vector<(int)> Cp, - std::vector<(int)> Ci, std::vector<(unsigned char)> Cx) + int Bp, int Bi, unsigned char Bx, int Cp, + int Ci, unsigned char Cx) csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, - int Bi, short Bx, std::vector<(int)> Cp, - std::vector<(int)> Ci, std::vector<(short)> Cx) + int Bi, short Bx, int Cp, int Ci, short Cx) csc_eldiv_csc(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) + int Bi, int Bx, int Cp, int Ci, int Cx) csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, long long Ax, - int Bp, int Bi, long long Bx, std::vector<(int)> Cp, - std::vector<(int)> Ci, std::vector<(long long)> Cx) + int Bp, int Bi, long long Bx, int Cp, int Ci, + long long Cx) csc_eldiv_csc(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) + int Bi, float Bx, int Cp, int Ci, float Cx) csc_eldiv_csc(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) + int Bi, double Bx, int Cp, int Ci, double Cx) csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, int Bp, int Bi, npy_cfloat_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Ci, - std::vector<(npy_cfloat_wrapper)> Cx) + int Cp, int Ci, npy_cfloat_wrapper Cx) csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, int Bp, int Bi, npy_cdouble_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Ci, - std::vector<(npy_cdouble_wrapper)> Cx) + int Cp, int Ci, npy_cdouble_wrapper Cx) """ return _sparsetools.csc_eldiv_csc(*args) def csc_plus_csc(*args): """ csc_plus_csc(int n_row, int n_col, int Ap, int Ai, signed char Ax, - int Bp, int Bi, signed char Bx, std::vector<(int)> Cp, - std::vector<(int)> Ci, std::vector<(signed char)> Cx) + int Bp, int Bi, signed char Bx, int Cp, int Ci, + signed char Cx) csc_plus_csc(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, - int Bp, int Bi, unsigned char Bx, std::vector<(int)> Cp, - std::vector<(int)> Ci, std::vector<(unsigned char)> Cx) + int Bp, int Bi, unsigned char Bx, int Cp, + int Ci, unsigned char Cx) csc_plus_csc(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, - int Bi, short Bx, std::vector<(int)> Cp, - std::vector<(int)> Ci, std::vector<(short)> Cx) + int Bi, short Bx, int Cp, int Ci, short Cx) csc_plus_csc(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) + int Bi, int Bx, int Cp, int Ci, int Cx) csc_plus_csc(int n_row, int n_col, int Ap, int Ai, long long Ax, - int Bp, int Bi, long long Bx, std::vector<(int)> Cp, - std::vector<(int)> Ci, std::vector<(long long)> Cx) + int Bp, int Bi, long long Bx, int Cp, int Ci, + long long Cx) csc_plus_csc(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) + int Bi, float Bx, int Cp, int Ci, float Cx) csc_plus_csc(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) + int Bi, double Bx, int Cp, int Ci, double Cx) csc_plus_csc(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, int Bp, int Bi, npy_cfloat_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Ci, - std::vector<(npy_cfloat_wrapper)> Cx) + int Cp, int Ci, npy_cfloat_wrapper Cx) csc_plus_csc(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, int Bp, int Bi, npy_cdouble_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Ci, - std::vector<(npy_cdouble_wrapper)> Cx) + int Cp, int Ci, npy_cdouble_wrapper Cx) """ return _sparsetools.csc_plus_csc(*args) def csc_minus_csc(*args): """ csc_minus_csc(int n_row, int n_col, int Ap, int Ai, signed char Ax, - int Bp, int Bi, signed char Bx, std::vector<(int)> Cp, - std::vector<(int)> Ci, std::vector<(signed char)> Cx) + int Bp, int Bi, signed char Bx, int Cp, int Ci, + signed char Cx) csc_minus_csc(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, - int Bp, int Bi, unsigned char Bx, std::vector<(int)> Cp, - std::vector<(int)> Ci, std::vector<(unsigned char)> Cx) + int Bp, int Bi, unsigned char Bx, int Cp, + int Ci, unsigned char Cx) csc_minus_csc(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, - int Bi, short Bx, std::vector<(int)> Cp, - std::vector<(int)> Ci, std::vector<(short)> Cx) + int Bi, short Bx, int Cp, int Ci, short Cx) csc_minus_csc(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) + int Bi, int Bx, int Cp, int Ci, int Cx) csc_minus_csc(int n_row, int n_col, int Ap, int Ai, long long Ax, - int Bp, int Bi, long long Bx, std::vector<(int)> Cp, - std::vector<(int)> Ci, std::vector<(long long)> Cx) + int Bp, int Bi, long long Bx, int Cp, int Ci, + long long Cx) csc_minus_csc(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) + int Bi, float Bx, int Cp, int Ci, float Cx) csc_minus_csc(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) + int Bi, double Bx, int Cp, int Ci, double Cx) csc_minus_csc(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, int Bp, int Bi, npy_cfloat_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Ci, - std::vector<(npy_cfloat_wrapper)> Cx) + int Cp, int Ci, npy_cfloat_wrapper Cx) csc_minus_csc(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, int Bp, int Bi, npy_cdouble_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Ci, - std::vector<(npy_cdouble_wrapper)> Cx) + int Cp, int Ci, npy_cdouble_wrapper Cx) """ return _sparsetools.csc_minus_csc(*args) Modified: trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx 2007-12-24 00:16:09 UTC (rev 3700) +++ trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx 2007-12-24 05:05:51 UTC (rev 3701) @@ -20903,9 +20903,9 @@ int *arg6 ; int *arg7 ; signed char *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + signed char *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -20922,9 +20922,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -20933,20 +20933,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_elmul_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_elmul_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_elmul_csr" "', argument " "1"" of type '" "int""'"); @@ -21017,29 +21008,23 @@ arg8 = (signed char*) array8->data; } - csr_elmul_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(signed char const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(signed char)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_BYTE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (signed char*) array_data(temp11); } + csr_elmul_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(signed char const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -21092,9 +21077,9 @@ int *arg6 ; int *arg7 ; unsigned char *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + unsigned char *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -21111,9 +21096,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -21122,20 +21107,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_elmul_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_elmul_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_elmul_csr" "', argument " "1"" of type '" "int""'"); @@ -21206,29 +21182,23 @@ arg8 = (unsigned char*) array8->data; } - csr_elmul_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(unsigned char const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(unsigned char)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_UBYTE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (unsigned char*) array_data(temp11); } + csr_elmul_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(unsigned char const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -21281,9 +21251,9 @@ int *arg6 ; int *arg7 ; short *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + short *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -21300,9 +21270,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -21311,20 +21281,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_elmul_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_elmul_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_elmul_csr" "', argument " "1"" of type '" "int""'"); @@ -21395,29 +21356,23 @@ arg8 = (short*) array8->data; } - csr_elmul_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,(int const (*))arg6,(int const (*))arg7,(short const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(short)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_SHORT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (short*) array_data(temp11); } + csr_elmul_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,(int const (*))arg6,(int const (*))arg7,(short const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -21470,9 +21425,9 @@ int *arg6 ; int *arg7 ; int *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + int *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -21489,9 +21444,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -21500,20 +21455,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_elmul_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_elmul_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_elmul_csr" "', argument " "1"" of type '" "int""'"); @@ -21584,29 +21530,23 @@ arg8 = (int*) array8->data; } - csr_elmul_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } + csr_elmul_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -21659,9 +21599,9 @@ int *arg6 ; int *arg7 ; long long *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + long long *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -21678,9 +21618,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -21689,20 +21629,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_elmul_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_elmul_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_elmul_csr" "', argument " "1"" of type '" "int""'"); @@ -21773,29 +21704,23 @@ arg8 = (long long*) array8->data; } - csr_elmul_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,(int const (*))arg6,(int const (*))arg7,(long long const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(long long)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_LONGLONG); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (long long*) array_data(temp11); } + csr_elmul_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,(int const (*))arg6,(int const (*))arg7,(long long const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -21848,9 +21773,9 @@ int *arg6 ; int *arg7 ; float *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + float *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -21867,9 +21792,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -21878,20 +21803,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_elmul_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_elmul_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_elmul_csr" "', argument " "1"" of type '" "int""'"); @@ -21962,29 +21878,23 @@ arg8 = (float*) array8->data; } - csr_elmul_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(int const (*))arg6,(int const (*))arg7,(float const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(float)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_FLOAT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (float*) array_data(temp11); } + csr_elmul_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(int const (*))arg6,(int const (*))arg7,(float const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -22037,9 +21947,9 @@ int *arg6 ; int *arg7 ; double *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + double *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -22056,9 +21966,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -22067,20 +21977,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_elmul_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_elmul_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_elmul_csr" "', argument " "1"" of type '" "int""'"); @@ -22151,29 +22052,23 @@ arg8 = (double*) array8->data; } - csr_elmul_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(int const (*))arg6,(int const (*))arg7,(double const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(double)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_DOUBLE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (double*) array_data(temp11); } + csr_elmul_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(int const (*))arg6,(int const (*))arg7,(double const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -22226,9 +22121,9 @@ int *arg6 ; int *arg7 ; npy_cfloat_wrapper *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + npy_cfloat_wrapper *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -22245,9 +22140,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -22256,20 +22151,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_elmul_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_elmul_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_elmul_csr" "', argument " "1"" of type '" "int""'"); @@ -22340,29 +22226,23 @@ arg8 = (npy_cfloat_wrapper*) array8->data; } - csr_elmul_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cfloat_wrapper const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(npy_cfloat_wrapper)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_CFLOAT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (npy_cfloat_wrapper*) array_data(temp11); } + csr_elmul_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cfloat_wrapper const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -22415,9 +22295,9 @@ int *arg6 ; int *arg7 ; npy_cdouble_wrapper *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + npy_cdouble_wrapper *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -22434,9 +22314,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -22445,20 +22325,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_elmul_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_elmul_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_elmul_csr" "', argument " "1"" of type '" "int""'"); @@ -22529,29 +22400,23 @@ arg8 = (npy_cdouble_wrapper*) array8->data; } - csr_elmul_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cdouble_wrapper const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(npy_cdouble_wrapper)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_CDOUBLE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (npy_cdouble_wrapper*) array_data(temp11); } + csr_elmul_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cdouble_wrapper const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -22596,15 +22461,15 @@ SWIGINTERN PyObject *_wrap_csr_elmul_csr(PyObject *self, PyObject *args) { int argc; - PyObject *argv[9]; + PyObject *argv[12]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 8); ii++) { + for (ii = 0; (ii < argc) && (ii < 11); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -22640,7 +22505,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_csr_elmul_csr__SWIG_1(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_elmul_csr__SWIG_1(self, args); + } + } + } } } } @@ -22650,7 +22530,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -22686,7 +22566,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_csr_elmul_csr__SWIG_2(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_elmul_csr__SWIG_2(self, args); + } + } + } } } } @@ -22696,7 +22591,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -22732,7 +22627,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_csr_elmul_csr__SWIG_3(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_elmul_csr__SWIG_3(self, args); + } + } + } } } } @@ -22742,7 +22652,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -22778,7 +22688,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_csr_elmul_csr__SWIG_4(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_elmul_csr__SWIG_4(self, args); + } + } + } } } } @@ -22788,7 +22713,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -22824,7 +22749,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_csr_elmul_csr__SWIG_5(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_elmul_csr__SWIG_5(self, args); + } + } + } } } } @@ -22834,7 +22774,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -22870,7 +22810,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csr_elmul_csr__SWIG_6(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_elmul_csr__SWIG_6(self, args); + } + } + } } } } @@ -22880,7 +22835,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -22916,7 +22871,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csr_elmul_csr__SWIG_7(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_elmul_csr__SWIG_7(self, args); + } + } + } } } } @@ -22926,7 +22896,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -22962,7 +22932,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csr_elmul_csr__SWIG_8(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_elmul_csr__SWIG_8(self, args); + } + } + } } } } @@ -22972,7 +22957,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -23008,7 +22993,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csr_elmul_csr__SWIG_9(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_elmul_csr__SWIG_9(self, args); + } + } + } } } } @@ -23020,7 +23020,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_elmul_csr'.\n Possible C/C++ prototypes are:\n"" csr_elmul_csr<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],std::vector *,std::vector *,std::vector *)\n"" csr_elmul_csr<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],std::vector *,std::vector *,std::vector *)\n"" csr_elmul_csr<(int,short)>(int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],std::vector *,std::vector *,std::vector *)\n"" csr_elmul_csr<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],std::vector *,std::vector *,std::vector *)\n"" csr_elmul_csr<(int,long long)>(int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],std::vector *,std::vector *,std::vector *)\n"" csr_elmul_csr<(int,float)>(int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" csr_elmul_csr<(int,double)>(int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"" csr_elmul_csr<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],std::vector *,std::vector *,std::vector *)\n"" csr_elmul_csr<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],std::vector *,std::vector *,std::vector *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_elmul_csr'.\n Possible C/C++ prototypes are:\n"" csr_elmul_csr<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],int [],int [],signed char [])\n"" csr_elmul_csr<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" csr_elmul_csr<(int,short)>(int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],int [],int [],short [])\n"" csr_elmul_csr<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],int [],int [],int [])\n"" csr_elmul_csr<(int,long long)>(int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],int [],int [],long long [])\n"" csr_elmul_csr<(int,float)>(int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],int [],int [],float [])\n"" csr_elmul_csr<(int,double)>(int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],int [],int [],double [])\n"" csr_elmul_csr<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" csr_elmul_csr<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); return NULL; } @@ -23035,9 +23035,9 @@ int *arg6 ; int *arg7 ; signed char *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + signed char *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -23054,9 +23054,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -23065,20 +23065,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_eldiv_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_eldiv_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_eldiv_csr" "', argument " "1"" of type '" "int""'"); @@ -23149,29 +23140,23 @@ arg8 = (signed char*) array8->data; } - csr_eldiv_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(signed char const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(signed char)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_BYTE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (signed char*) array_data(temp11); } + csr_eldiv_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(signed char const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -23224,9 +23209,9 @@ int *arg6 ; int *arg7 ; unsigned char *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + unsigned char *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -23243,9 +23228,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -23254,20 +23239,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_eldiv_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_eldiv_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_eldiv_csr" "', argument " "1"" of type '" "int""'"); @@ -23338,29 +23314,23 @@ arg8 = (unsigned char*) array8->data; } - csr_eldiv_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(unsigned char const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(unsigned char)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_UBYTE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (unsigned char*) array_data(temp11); } + csr_eldiv_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(unsigned char const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -23413,9 +23383,9 @@ int *arg6 ; int *arg7 ; short *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + short *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -23432,9 +23402,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -23443,20 +23413,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_eldiv_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_eldiv_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_eldiv_csr" "', argument " "1"" of type '" "int""'"); @@ -23527,29 +23488,23 @@ arg8 = (short*) array8->data; } - csr_eldiv_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,(int const (*))arg6,(int const (*))arg7,(short const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(short)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_SHORT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (short*) array_data(temp11); } + csr_eldiv_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,(int const (*))arg6,(int const (*))arg7,(short const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -23602,9 +23557,9 @@ int *arg6 ; int *arg7 ; int *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + int *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -23621,9 +23576,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -23632,20 +23587,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_eldiv_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_eldiv_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_eldiv_csr" "', argument " "1"" of type '" "int""'"); @@ -23716,29 +23662,23 @@ arg8 = (int*) array8->data; } - csr_eldiv_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } + csr_eldiv_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -23791,9 +23731,9 @@ int *arg6 ; int *arg7 ; long long *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + long long *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -23810,9 +23750,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -23821,20 +23761,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_eldiv_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_eldiv_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_eldiv_csr" "', argument " "1"" of type '" "int""'"); @@ -23905,29 +23836,23 @@ arg8 = (long long*) array8->data; } - csr_eldiv_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,(int const (*))arg6,(int const (*))arg7,(long long const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(long long)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_LONGLONG); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (long long*) array_data(temp11); } + csr_eldiv_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,(int const (*))arg6,(int const (*))arg7,(long long const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -23980,9 +23905,9 @@ int *arg6 ; int *arg7 ; float *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + float *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -23999,9 +23924,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -24010,20 +23935,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_eldiv_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_eldiv_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_eldiv_csr" "', argument " "1"" of type '" "int""'"); @@ -24094,29 +24010,23 @@ arg8 = (float*) array8->data; } - csr_eldiv_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(int const (*))arg6,(int const (*))arg7,(float const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(float)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_FLOAT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (float*) array_data(temp11); } + csr_eldiv_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(int const (*))arg6,(int const (*))arg7,(float const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -24169,9 +24079,9 @@ int *arg6 ; int *arg7 ; double *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + double *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -24188,9 +24098,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -24199,20 +24109,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_eldiv_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_eldiv_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_eldiv_csr" "', argument " "1"" of type '" "int""'"); @@ -24283,29 +24184,23 @@ arg8 = (double*) array8->data; } - csr_eldiv_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(int const (*))arg6,(int const (*))arg7,(double const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(double)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_DOUBLE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (double*) array_data(temp11); } + csr_eldiv_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(int const (*))arg6,(int const (*))arg7,(double const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -24358,9 +24253,9 @@ int *arg6 ; int *arg7 ; npy_cfloat_wrapper *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + npy_cfloat_wrapper *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -24377,9 +24272,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -24388,20 +24283,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_eldiv_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_eldiv_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_eldiv_csr" "', argument " "1"" of type '" "int""'"); @@ -24472,29 +24358,23 @@ arg8 = (npy_cfloat_wrapper*) array8->data; } - csr_eldiv_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cfloat_wrapper const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(npy_cfloat_wrapper)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_CFLOAT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (npy_cfloat_wrapper*) array_data(temp11); } + csr_eldiv_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cfloat_wrapper const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -24547,9 +24427,9 @@ int *arg6 ; int *arg7 ; npy_cdouble_wrapper *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + npy_cdouble_wrapper *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -24566,9 +24446,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -24577,20 +24457,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_eldiv_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_eldiv_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_eldiv_csr" "', argument " "1"" of type '" "int""'"); @@ -24661,29 +24532,23 @@ arg8 = (npy_cdouble_wrapper*) array8->data; } - csr_eldiv_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cdouble_wrapper const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(npy_cdouble_wrapper)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_CDOUBLE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (npy_cdouble_wrapper*) array_data(temp11); } + csr_eldiv_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cdouble_wrapper const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -24728,15 +24593,15 @@ SWIGINTERN PyObject *_wrap_csr_eldiv_csr(PyObject *self, PyObject *args) { int argc; - PyObject *argv[9]; + PyObject *argv[12]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 8); ii++) { + for (ii = 0; (ii < argc) && (ii < 11); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -24772,7 +24637,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_csr_eldiv_csr__SWIG_1(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_eldiv_csr__SWIG_1(self, args); + } + } + } } } } @@ -24782,7 +24662,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -24818,7 +24698,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_csr_eldiv_csr__SWIG_2(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_eldiv_csr__SWIG_2(self, args); + } + } + } } } } @@ -24828,7 +24723,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -24864,7 +24759,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_csr_eldiv_csr__SWIG_3(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_eldiv_csr__SWIG_3(self, args); + } + } + } } } } @@ -24874,7 +24784,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -24910,7 +24820,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_csr_eldiv_csr__SWIG_4(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_eldiv_csr__SWIG_4(self, args); + } + } + } } } } @@ -24920,7 +24845,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -24956,7 +24881,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_csr_eldiv_csr__SWIG_5(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_eldiv_csr__SWIG_5(self, args); + } + } + } } } } @@ -24966,7 +24906,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -25002,7 +24942,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csr_eldiv_csr__SWIG_6(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_eldiv_csr__SWIG_6(self, args); + } + } + } } } } @@ -25012,7 +24967,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -25048,7 +25003,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csr_eldiv_csr__SWIG_7(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_eldiv_csr__SWIG_7(self, args); + } + } + } } } } @@ -25058,7 +25028,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -25094,7 +25064,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csr_eldiv_csr__SWIG_8(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_eldiv_csr__SWIG_8(self, args); + } + } + } } } } @@ -25104,7 +25089,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -25140,7 +25125,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csr_eldiv_csr__SWIG_9(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_eldiv_csr__SWIG_9(self, args); + } + } + } } } } @@ -25152,7 +25152,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_eldiv_csr'.\n Possible C/C++ prototypes are:\n"" csr_eldiv_csr<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],std::vector *,std::vector *,std::vector *)\n"" csr_eldiv_csr<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],std::vector *,std::vector *,std::vector *)\n"" csr_eldiv_csr<(int,short)>(int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],std::vector *,std::vector *,std::vector *)\n"" csr_eldiv_csr<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],std::vector *,std::vector *,std::vector *)\n"" csr_eldiv_csr<(int,long long)>(int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],std::vector *,std::vector *,std::vector *)\n"" csr_eldiv_csr<(int,float)>(int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" csr_eldiv_csr<(int,double)>(int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"" csr_eldiv_csr<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],std::vector *,std::vector *,std::vector *)\n"" csr_eldiv_csr<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],std::vector *,std::vector *,std::vector *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_eldiv_csr'.\n Possible C/C++ prototypes are:\n"" csr_eldiv_csr<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],int [],int [],signed char [])\n"" csr_eldiv_csr<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" csr_eldiv_csr<(int,short)>(int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],int [],int [],short [])\n"" csr_eldiv_csr<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],int [],int [],int [])\n"" csr_eldiv_csr<(int,long long)>(int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],int [],int [],long long [])\n"" csr_eldiv_csr<(int,float)>(int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],int [],int [],float [])\n"" csr_eldiv_csr<(int,double)>(int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],int [],int [],double [])\n"" csr_eldiv_csr<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" csr_eldiv_csr<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); return NULL; } @@ -25167,9 +25167,9 @@ int *arg6 ; int *arg7 ; signed char *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + signed char *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -25186,9 +25186,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -25197,20 +25197,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_plus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_plus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_plus_csr" "', argument " "1"" of type '" "int""'"); @@ -25281,29 +25272,23 @@ arg8 = (signed char*) array8->data; } - csr_plus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(signed char const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(signed char)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_BYTE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (signed char*) array_data(temp11); } + csr_plus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(signed char const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -25356,9 +25341,9 @@ int *arg6 ; int *arg7 ; unsigned char *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + unsigned char *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -25375,9 +25360,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -25386,20 +25371,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_plus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_plus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_plus_csr" "', argument " "1"" of type '" "int""'"); @@ -25470,29 +25446,23 @@ arg8 = (unsigned char*) array8->data; } - csr_plus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(unsigned char const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(unsigned char)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_UBYTE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (unsigned char*) array_data(temp11); } + csr_plus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(unsigned char const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -25545,9 +25515,9 @@ int *arg6 ; int *arg7 ; short *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + short *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -25564,9 +25534,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -25575,20 +25545,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_plus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_plus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_plus_csr" "', argument " "1"" of type '" "int""'"); @@ -25659,29 +25620,23 @@ arg8 = (short*) array8->data; } - csr_plus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,(int const (*))arg6,(int const (*))arg7,(short const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(short)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_SHORT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (short*) array_data(temp11); } + csr_plus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,(int const (*))arg6,(int const (*))arg7,(short const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -25734,9 +25689,9 @@ int *arg6 ; int *arg7 ; int *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + int *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -25753,9 +25708,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -25764,20 +25719,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_plus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_plus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_plus_csr" "', argument " "1"" of type '" "int""'"); @@ -25848,29 +25794,23 @@ arg8 = (int*) array8->data; } - csr_plus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } + csr_plus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -25923,9 +25863,9 @@ int *arg6 ; int *arg7 ; long long *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + long long *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -25942,9 +25882,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -25953,20 +25893,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_plus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_plus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_plus_csr" "', argument " "1"" of type '" "int""'"); @@ -26037,29 +25968,23 @@ arg8 = (long long*) array8->data; } - csr_plus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,(int const (*))arg6,(int const (*))arg7,(long long const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(long long)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_LONGLONG); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (long long*) array_data(temp11); } + csr_plus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,(int const (*))arg6,(int const (*))arg7,(long long const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -26112,9 +26037,9 @@ int *arg6 ; int *arg7 ; float *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + float *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -26131,9 +26056,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -26142,20 +26067,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_plus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_plus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_plus_csr" "', argument " "1"" of type '" "int""'"); @@ -26226,29 +26142,23 @@ arg8 = (float*) array8->data; } - csr_plus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(int const (*))arg6,(int const (*))arg7,(float const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(float)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_FLOAT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (float*) array_data(temp11); } + csr_plus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(int const (*))arg6,(int const (*))arg7,(float const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -26301,9 +26211,9 @@ int *arg6 ; int *arg7 ; double *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + double *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -26320,9 +26230,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -26331,20 +26241,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_plus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_plus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_plus_csr" "', argument " "1"" of type '" "int""'"); @@ -26415,29 +26316,23 @@ arg8 = (double*) array8->data; } - csr_plus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(int const (*))arg6,(int const (*))arg7,(double const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(double)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_DOUBLE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (double*) array_data(temp11); } + csr_plus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(int const (*))arg6,(int const (*))arg7,(double const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -26490,9 +26385,9 @@ int *arg6 ; int *arg7 ; npy_cfloat_wrapper *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + npy_cfloat_wrapper *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -26509,9 +26404,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -26520,20 +26415,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_plus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_plus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_plus_csr" "', argument " "1"" of type '" "int""'"); @@ -26604,29 +26490,23 @@ arg8 = (npy_cfloat_wrapper*) array8->data; } - csr_plus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cfloat_wrapper const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(npy_cfloat_wrapper)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_CFLOAT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (npy_cfloat_wrapper*) array_data(temp11); } + csr_plus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cfloat_wrapper const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -26679,9 +26559,9 @@ int *arg6 ; int *arg7 ; npy_cdouble_wrapper *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + npy_cdouble_wrapper *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -26698,9 +26578,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -26709,20 +26589,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_plus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_plus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_plus_csr" "', argument " "1"" of type '" "int""'"); @@ -26793,29 +26664,23 @@ arg8 = (npy_cdouble_wrapper*) array8->data; } - csr_plus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cdouble_wrapper const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(npy_cdouble_wrapper)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_CDOUBLE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (npy_cdouble_wrapper*) array_data(temp11); } + csr_plus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cdouble_wrapper const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -26860,15 +26725,15 @@ SWIGINTERN PyObject *_wrap_csr_plus_csr(PyObject *self, PyObject *args) { int argc; - PyObject *argv[9]; + PyObject *argv[12]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 8); ii++) { + for (ii = 0; (ii < argc) && (ii < 11); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -26904,7 +26769,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_csr_plus_csr__SWIG_1(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_plus_csr__SWIG_1(self, args); + } + } + } } } } @@ -26914,7 +26794,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -26950,7 +26830,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_csr_plus_csr__SWIG_2(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_plus_csr__SWIG_2(self, args); + } + } + } } } } @@ -26960,7 +26855,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -26996,7 +26891,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_csr_plus_csr__SWIG_3(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_plus_csr__SWIG_3(self, args); + } + } + } } } } @@ -27006,7 +26916,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -27042,7 +26952,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_csr_plus_csr__SWIG_4(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_plus_csr__SWIG_4(self, args); + } + } + } } } } @@ -27052,7 +26977,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -27088,7 +27013,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_csr_plus_csr__SWIG_5(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_plus_csr__SWIG_5(self, args); + } + } + } } } } @@ -27098,7 +27038,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -27134,7 +27074,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csr_plus_csr__SWIG_6(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_plus_csr__SWIG_6(self, args); + } + } + } } } } @@ -27144,7 +27099,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -27180,7 +27135,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csr_plus_csr__SWIG_7(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_plus_csr__SWIG_7(self, args); + } + } + } } } } @@ -27190,7 +27160,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -27226,7 +27196,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csr_plus_csr__SWIG_8(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_plus_csr__SWIG_8(self, args); + } + } + } } } } @@ -27236,7 +27221,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -27272,7 +27257,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csr_plus_csr__SWIG_9(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_plus_csr__SWIG_9(self, args); + } + } + } } } } @@ -27284,7 +27284,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_plus_csr'.\n Possible C/C++ prototypes are:\n"" csr_plus_csr<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],std::vector *,std::vector *,std::vector *)\n"" csr_plus_csr<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],std::vector *,std::vector *,std::vector *)\n"" csr_plus_csr<(int,short)>(int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],std::vector *,std::vector *,std::vector *)\n"" csr_plus_csr<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],std::vector *,std::vector *,std::vector *)\n"" csr_plus_csr<(int,long long)>(int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],std::vector *,std::vector *,std::vector *)\n"" csr_plus_csr<(int,float)>(int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" csr_plus_csr<(int,double)>(int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"" csr_plus_csr<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],std::vector *,std::vector *,std::vector *)\n"" csr_plus_csr<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],std::vector *,std::vector *,std::vector *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_plus_csr'.\n Possible C/C++ prototypes are:\n"" csr_plus_csr<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],int [],int [],signed char [])\n"" csr_plus_csr<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" csr_plus_csr<(int,short)>(int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],int [],int [],short [])\n"" csr_plus_csr<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],int [],int [],int [])\n"" csr_plus_csr<(int,long long)>(int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],int [],int [],long long [])\n"" csr_plus_csr<(int,float)>(int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],int [],int [],float [])\n"" csr_plus_csr<(int,double)>(int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],int [],int [],double [])\n"" csr_plus_csr<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" csr_plus_csr<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); return NULL; } @@ -27299,9 +27299,9 @@ int *arg6 ; int *arg7 ; signed char *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + signed char *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -27318,9 +27318,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -27329,20 +27329,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_minus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_minus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_minus_csr" "', argument " "1"" of type '" "int""'"); @@ -27413,29 +27404,23 @@ arg8 = (signed char*) array8->data; } - csr_minus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(signed char const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(signed char)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_BYTE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (signed char*) array_data(temp11); } + csr_minus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(signed char const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -27488,9 +27473,9 @@ int *arg6 ; int *arg7 ; unsigned char *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + unsigned char *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -27507,9 +27492,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -27518,20 +27503,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_minus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_minus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_minus_csr" "', argument " "1"" of type '" "int""'"); @@ -27602,29 +27578,23 @@ arg8 = (unsigned char*) array8->data; } - csr_minus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(unsigned char const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(unsigned char)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_UBYTE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (unsigned char*) array_data(temp11); } + csr_minus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(unsigned char const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -27677,9 +27647,9 @@ int *arg6 ; int *arg7 ; short *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + short *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -27696,9 +27666,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -27707,20 +27677,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_minus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_minus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_minus_csr" "', argument " "1"" of type '" "int""'"); @@ -27791,29 +27752,23 @@ arg8 = (short*) array8->data; } - csr_minus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,(int const (*))arg6,(int const (*))arg7,(short const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(short)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_SHORT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (short*) array_data(temp11); } + csr_minus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,(int const (*))arg6,(int const (*))arg7,(short const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -27866,9 +27821,9 @@ int *arg6 ; int *arg7 ; int *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + int *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -27885,9 +27840,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -27896,20 +27851,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_minus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_minus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_minus_csr" "', argument " "1"" of type '" "int""'"); @@ -27980,29 +27926,23 @@ arg8 = (int*) array8->data; } - csr_minus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } + csr_minus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -28055,9 +27995,9 @@ int *arg6 ; int *arg7 ; long long *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + long long *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -28074,9 +28014,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -28085,20 +28025,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_minus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_minus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_minus_csr" "', argument " "1"" of type '" "int""'"); @@ -28169,29 +28100,23 @@ arg8 = (long long*) array8->data; } - csr_minus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,(int const (*))arg6,(int const (*))arg7,(long long const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(long long)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_LONGLONG); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (long long*) array_data(temp11); } + csr_minus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,(int const (*))arg6,(int const (*))arg7,(long long const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -28244,9 +28169,9 @@ int *arg6 ; int *arg7 ; float *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + float *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -28263,9 +28188,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -28274,20 +28199,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_minus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_minus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_minus_csr" "', argument " "1"" of type '" "int""'"); @@ -28358,29 +28274,23 @@ arg8 = (float*) array8->data; } - csr_minus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(int const (*))arg6,(int const (*))arg7,(float const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(float)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_FLOAT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (float*) array_data(temp11); } + csr_minus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(int const (*))arg6,(int const (*))arg7,(float const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -28433,9 +28343,9 @@ int *arg6 ; int *arg7 ; double *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + double *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -28452,9 +28362,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -28463,20 +28373,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_minus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_minus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_minus_csr" "', argument " "1"" of type '" "int""'"); @@ -28547,29 +28448,23 @@ arg8 = (double*) array8->data; } - csr_minus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(int const (*))arg6,(int const (*))arg7,(double const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(double)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_DOUBLE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (double*) array_data(temp11); } + csr_minus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(int const (*))arg6,(int const (*))arg7,(double const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -28622,9 +28517,9 @@ int *arg6 ; int *arg7 ; npy_cfloat_wrapper *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + npy_cfloat_wrapper *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -28641,9 +28536,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -28652,20 +28547,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_minus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_minus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_minus_csr" "', argument " "1"" of type '" "int""'"); @@ -28736,29 +28622,23 @@ arg8 = (npy_cfloat_wrapper*) array8->data; } - csr_minus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cfloat_wrapper const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(npy_cfloat_wrapper)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_CFLOAT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (npy_cfloat_wrapper*) array_data(temp11); } + csr_minus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cfloat_wrapper const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -28811,9 +28691,9 @@ int *arg6 ; int *arg7 ; npy_cdouble_wrapper *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + npy_cdouble_wrapper *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -28830,9 +28710,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -28841,20 +28721,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csr_minus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csr_minus_csr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_minus_csr" "', argument " "1"" of type '" "int""'"); @@ -28925,29 +28796,23 @@ arg8 = (npy_cdouble_wrapper*) array8->data; } - csr_minus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cdouble_wrapper const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(npy_cdouble_wrapper)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_CDOUBLE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (npy_cdouble_wrapper*) array_data(temp11); } + csr_minus_csr(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cdouble_wrapper const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -28992,15 +28857,15 @@ SWIGINTERN PyObject *_wrap_csr_minus_csr(PyObject *self, PyObject *args) { int argc; - PyObject *argv[9]; + PyObject *argv[12]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 8); ii++) { + for (ii = 0; (ii < argc) && (ii < 11); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -29036,7 +28901,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_csr_minus_csr__SWIG_1(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_minus_csr__SWIG_1(self, args); + } + } + } } } } @@ -29046,7 +28926,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -29082,7 +28962,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_csr_minus_csr__SWIG_2(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_minus_csr__SWIG_2(self, args); + } + } + } } } } @@ -29092,7 +28987,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -29128,7 +29023,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_csr_minus_csr__SWIG_3(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_minus_csr__SWIG_3(self, args); + } + } + } } } } @@ -29138,7 +29048,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -29174,7 +29084,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_csr_minus_csr__SWIG_4(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_minus_csr__SWIG_4(self, args); + } + } + } } } } @@ -29184,7 +29109,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -29220,7 +29145,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_csr_minus_csr__SWIG_5(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_minus_csr__SWIG_5(self, args); + } + } + } } } } @@ -29230,7 +29170,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -29266,7 +29206,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csr_minus_csr__SWIG_6(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_minus_csr__SWIG_6(self, args); + } + } + } } } } @@ -29276,7 +29231,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -29312,7 +29267,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csr_minus_csr__SWIG_7(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_minus_csr__SWIG_7(self, args); + } + } + } } } } @@ -29322,7 +29292,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -29358,7 +29328,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csr_minus_csr__SWIG_8(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_minus_csr__SWIG_8(self, args); + } + } + } } } } @@ -29368,7 +29353,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -29404,7 +29389,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csr_minus_csr__SWIG_9(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_csr_minus_csr__SWIG_9(self, args); + } + } + } } } } @@ -29416,7 +29416,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_minus_csr'.\n Possible C/C++ prototypes are:\n"" csr_minus_csr<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],std::vector *,std::vector *,std::vector *)\n"" csr_minus_csr<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],std::vector *,std::vector *,std::vector *)\n"" csr_minus_csr<(int,short)>(int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],std::vector *,std::vector *,std::vector *)\n"" csr_minus_csr<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],std::vector *,std::vector *,std::vector *)\n"" csr_minus_csr<(int,long long)>(int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],std::vector *,std::vector *,std::vector *)\n"" csr_minus_csr<(int,float)>(int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" csr_minus_csr<(int,double)>(int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"" csr_minus_csr<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],std::vector *,std::vector *,std::vector *)\n"" csr_minus_csr<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],std::vector *,std::vector *,std::vector *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_minus_csr'.\n Possible C/C++ prototypes are:\n"" csr_minus_csr<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],int [],int [],signed char [])\n"" csr_minus_csr<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" csr_minus_csr<(int,short)>(int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],int [],int [],short [])\n"" csr_minus_csr<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],int [],int [],int [])\n"" csr_minus_csr<(int,long long)>(int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],int [],int [],long long [])\n"" csr_minus_csr<(int,float)>(int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],int [],int [],float [])\n"" csr_minus_csr<(int,double)>(int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],int [],int [],double [])\n"" csr_minus_csr<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" csr_minus_csr<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); return NULL; } @@ -29431,9 +29431,9 @@ int *arg6 ; int *arg7 ; signed char *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + signed char *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -29450,9 +29450,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -29461,20 +29461,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_elmul_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_elmul_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_elmul_csc" "', argument " "1"" of type '" "int""'"); @@ -29545,29 +29536,23 @@ arg8 = (signed char*) array8->data; } - csc_elmul_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(signed char const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(signed char)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_BYTE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (signed char*) array_data(temp11); } + csc_elmul_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(signed char const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -29620,9 +29605,9 @@ int *arg6 ; int *arg7 ; unsigned char *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + unsigned char *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -29639,9 +29624,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -29650,20 +29635,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_elmul_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_elmul_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_elmul_csc" "', argument " "1"" of type '" "int""'"); @@ -29734,29 +29710,23 @@ arg8 = (unsigned char*) array8->data; } - csc_elmul_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(unsigned char const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(unsigned char)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_UBYTE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (unsigned char*) array_data(temp11); } + csc_elmul_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(unsigned char const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -29809,9 +29779,9 @@ int *arg6 ; int *arg7 ; short *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + short *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -29828,9 +29798,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -29839,20 +29809,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_elmul_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_elmul_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_elmul_csc" "', argument " "1"" of type '" "int""'"); @@ -29923,29 +29884,23 @@ arg8 = (short*) array8->data; } - csc_elmul_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,(int const (*))arg6,(int const (*))arg7,(short const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(short)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_SHORT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (short*) array_data(temp11); } + csc_elmul_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,(int const (*))arg6,(int const (*))arg7,(short const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -29998,9 +29953,9 @@ int *arg6 ; int *arg7 ; int *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + int *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -30017,9 +29972,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -30028,20 +29983,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_elmul_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_elmul_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_elmul_csc" "', argument " "1"" of type '" "int""'"); @@ -30112,29 +30058,23 @@ arg8 = (int*) array8->data; } - csc_elmul_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } + csc_elmul_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -30187,9 +30127,9 @@ int *arg6 ; int *arg7 ; long long *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + long long *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -30206,9 +30146,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -30217,20 +30157,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_elmul_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_elmul_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_elmul_csc" "', argument " "1"" of type '" "int""'"); @@ -30301,29 +30232,23 @@ arg8 = (long long*) array8->data; } - csc_elmul_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,(int const (*))arg6,(int const (*))arg7,(long long const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(long long)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_LONGLONG); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (long long*) array_data(temp11); } + csc_elmul_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,(int const (*))arg6,(int const (*))arg7,(long long const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -30376,9 +30301,9 @@ int *arg6 ; int *arg7 ; float *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + float *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -30395,9 +30320,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -30406,20 +30331,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_elmul_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_elmul_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_elmul_csc" "', argument " "1"" of type '" "int""'"); @@ -30490,29 +30406,23 @@ arg8 = (float*) array8->data; } - csc_elmul_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(int const (*))arg6,(int const (*))arg7,(float const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(float)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_FLOAT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (float*) array_data(temp11); } + csc_elmul_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(int const (*))arg6,(int const (*))arg7,(float const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -30565,9 +30475,9 @@ int *arg6 ; int *arg7 ; double *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + double *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -30584,9 +30494,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -30595,20 +30505,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_elmul_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_elmul_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_elmul_csc" "', argument " "1"" of type '" "int""'"); @@ -30679,29 +30580,23 @@ arg8 = (double*) array8->data; } - csc_elmul_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(int const (*))arg6,(int const (*))arg7,(double const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(double)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_DOUBLE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (double*) array_data(temp11); } + csc_elmul_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(int const (*))arg6,(int const (*))arg7,(double const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -30754,9 +30649,9 @@ int *arg6 ; int *arg7 ; npy_cfloat_wrapper *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + npy_cfloat_wrapper *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -30773,9 +30668,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -30784,20 +30679,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_elmul_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_elmul_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_elmul_csc" "', argument " "1"" of type '" "int""'"); @@ -30868,29 +30754,23 @@ arg8 = (npy_cfloat_wrapper*) array8->data; } - csc_elmul_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cfloat_wrapper const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(npy_cfloat_wrapper)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_CFLOAT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (npy_cfloat_wrapper*) array_data(temp11); } + csc_elmul_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cfloat_wrapper const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -30943,9 +30823,9 @@ int *arg6 ; int *arg7 ; npy_cdouble_wrapper *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + npy_cdouble_wrapper *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -30962,9 +30842,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -30973,20 +30853,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_elmul_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_elmul_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_elmul_csc" "', argument " "1"" of type '" "int""'"); @@ -31057,29 +30928,23 @@ arg8 = (npy_cdouble_wrapper*) array8->data; } - csc_elmul_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cdouble_wrapper const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(npy_cdouble_wrapper)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_CDOUBLE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (npy_cdouble_wrapper*) array_data(temp11); } + csc_elmul_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cdouble_wrapper const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -31124,15 +30989,15 @@ SWIGINTERN PyObject *_wrap_csc_elmul_csc(PyObject *self, PyObject *args) { int argc; - PyObject *argv[9]; + PyObject *argv[12]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 8); ii++) { + for (ii = 0; (ii < argc) && (ii < 11); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -31168,7 +31033,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_csc_elmul_csc__SWIG_1(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_elmul_csc__SWIG_1(self, args); + } + } + } } } } @@ -31178,7 +31058,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -31214,7 +31094,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_csc_elmul_csc__SWIG_2(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_elmul_csc__SWIG_2(self, args); + } + } + } } } } @@ -31224,7 +31119,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -31260,7 +31155,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_csc_elmul_csc__SWIG_3(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_elmul_csc__SWIG_3(self, args); + } + } + } } } } @@ -31270,7 +31180,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -31306,7 +31216,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_csc_elmul_csc__SWIG_4(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_elmul_csc__SWIG_4(self, args); + } + } + } } } } @@ -31316,7 +31241,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -31352,7 +31277,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_csc_elmul_csc__SWIG_5(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_elmul_csc__SWIG_5(self, args); + } + } + } } } } @@ -31362,7 +31302,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -31398,7 +31338,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csc_elmul_csc__SWIG_6(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_elmul_csc__SWIG_6(self, args); + } + } + } } } } @@ -31408,7 +31363,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -31444,7 +31399,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csc_elmul_csc__SWIG_7(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_elmul_csc__SWIG_7(self, args); + } + } + } } } } @@ -31454,7 +31424,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -31490,7 +31460,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csc_elmul_csc__SWIG_8(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_elmul_csc__SWIG_8(self, args); + } + } + } } } } @@ -31500,7 +31485,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -31536,7 +31521,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csc_elmul_csc__SWIG_9(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_elmul_csc__SWIG_9(self, args); + } + } + } } } } @@ -31548,7 +31548,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_elmul_csc'.\n Possible C/C++ prototypes are:\n"" csc_elmul_csc<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],std::vector *,std::vector *,std::vector *)\n"" csc_elmul_csc<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],std::vector *,std::vector *,std::vector *)\n"" csc_elmul_csc<(int,short)>(int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],std::vector *,std::vector *,std::vector *)\n"" csc_elmul_csc<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],std::vector *,std::vector *,std::vector *)\n"" csc_elmul_csc<(int,long long)>(int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],std::vector *,std::vector *,std::vector *)\n"" csc_elmul_csc<(int,float)>(int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" csc_elmul_csc<(int,double)>(int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"" csc_elmul_csc<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],std::vector *,std::vector *,std::vector *)\n"" csc_elmul_csc<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],std::vector *,std::vector *,std::vector *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_elmul_csc'.\n Possible C/C++ prototypes are:\n"" csc_elmul_csc<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],int [],int [],signed char [])\n"" csc_elmul_csc<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" csc_elmul_csc<(int,short)>(int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],int [],int [],short [])\n"" csc_elmul_csc<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],int [],int [],int [])\n"" csc_elmul_csc<(int,long long)>(int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],int [],int [],long long [])\n"" csc_elmul_csc<(int,float)>(int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],int [],int [],float [])\n"" csc_elmul_csc<(int,double)>(int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],int [],int [],double [])\n"" csc_elmul_csc<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" csc_elmul_csc<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); return NULL; } @@ -31563,9 +31563,9 @@ int *arg6 ; int *arg7 ; signed char *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + signed char *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -31582,9 +31582,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -31593,20 +31593,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_eldiv_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_eldiv_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_eldiv_csc" "', argument " "1"" of type '" "int""'"); @@ -31677,29 +31668,23 @@ arg8 = (signed char*) array8->data; } - csc_eldiv_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(signed char const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(signed char)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_BYTE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (signed char*) array_data(temp11); } + csc_eldiv_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(signed char const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -31752,9 +31737,9 @@ int *arg6 ; int *arg7 ; unsigned char *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + unsigned char *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -31771,9 +31756,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -31782,20 +31767,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_eldiv_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_eldiv_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_eldiv_csc" "', argument " "1"" of type '" "int""'"); @@ -31866,29 +31842,23 @@ arg8 = (unsigned char*) array8->data; } - csc_eldiv_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(unsigned char const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(unsigned char)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_UBYTE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (unsigned char*) array_data(temp11); } + csc_eldiv_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(unsigned char const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -31941,9 +31911,9 @@ int *arg6 ; int *arg7 ; short *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + short *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -31960,9 +31930,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -31971,20 +31941,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_eldiv_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_eldiv_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_eldiv_csc" "', argument " "1"" of type '" "int""'"); @@ -32055,29 +32016,23 @@ arg8 = (short*) array8->data; } - csc_eldiv_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,(int const (*))arg6,(int const (*))arg7,(short const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(short)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_SHORT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (short*) array_data(temp11); } + csc_eldiv_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,(int const (*))arg6,(int const (*))arg7,(short const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -32130,9 +32085,9 @@ int *arg6 ; int *arg7 ; int *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + int *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -32149,9 +32104,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -32160,20 +32115,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_eldiv_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_eldiv_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_eldiv_csc" "', argument " "1"" of type '" "int""'"); @@ -32244,29 +32190,23 @@ arg8 = (int*) array8->data; } - csc_eldiv_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } + csc_eldiv_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -32319,9 +32259,9 @@ int *arg6 ; int *arg7 ; long long *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + long long *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -32338,9 +32278,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -32349,20 +32289,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_eldiv_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_eldiv_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_eldiv_csc" "', argument " "1"" of type '" "int""'"); @@ -32433,29 +32364,23 @@ arg8 = (long long*) array8->data; } - csc_eldiv_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,(int const (*))arg6,(int const (*))arg7,(long long const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(long long)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_LONGLONG); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (long long*) array_data(temp11); } + csc_eldiv_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,(int const (*))arg6,(int const (*))arg7,(long long const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -32508,9 +32433,9 @@ int *arg6 ; int *arg7 ; float *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + float *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -32527,9 +32452,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -32538,20 +32463,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_eldiv_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_eldiv_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_eldiv_csc" "', argument " "1"" of type '" "int""'"); @@ -32622,29 +32538,23 @@ arg8 = (float*) array8->data; } - csc_eldiv_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(int const (*))arg6,(int const (*))arg7,(float const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(float)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_FLOAT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (float*) array_data(temp11); } + csc_eldiv_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(int const (*))arg6,(int const (*))arg7,(float const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -32697,9 +32607,9 @@ int *arg6 ; int *arg7 ; double *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + double *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -32716,9 +32626,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -32727,20 +32637,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_eldiv_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_eldiv_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_eldiv_csc" "', argument " "1"" of type '" "int""'"); @@ -32811,29 +32712,23 @@ arg8 = (double*) array8->data; } - csc_eldiv_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(int const (*))arg6,(int const (*))arg7,(double const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(double)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_DOUBLE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (double*) array_data(temp11); } + csc_eldiv_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(int const (*))arg6,(int const (*))arg7,(double const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -32886,9 +32781,9 @@ int *arg6 ; int *arg7 ; npy_cfloat_wrapper *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + npy_cfloat_wrapper *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -32905,9 +32800,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -32916,20 +32811,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_eldiv_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_eldiv_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_eldiv_csc" "', argument " "1"" of type '" "int""'"); @@ -33000,29 +32886,23 @@ arg8 = (npy_cfloat_wrapper*) array8->data; } - csc_eldiv_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cfloat_wrapper const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(npy_cfloat_wrapper)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_CFLOAT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (npy_cfloat_wrapper*) array_data(temp11); } + csc_eldiv_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cfloat_wrapper const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -33075,9 +32955,9 @@ int *arg6 ; int *arg7 ; npy_cdouble_wrapper *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + npy_cdouble_wrapper *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -33094,9 +32974,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -33105,20 +32985,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_eldiv_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_eldiv_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_eldiv_csc" "', argument " "1"" of type '" "int""'"); @@ -33189,29 +33060,23 @@ arg8 = (npy_cdouble_wrapper*) array8->data; } - csc_eldiv_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cdouble_wrapper const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(npy_cdouble_wrapper)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_CDOUBLE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (npy_cdouble_wrapper*) array_data(temp11); } + csc_eldiv_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cdouble_wrapper const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -33256,15 +33121,15 @@ SWIGINTERN PyObject *_wrap_csc_eldiv_csc(PyObject *self, PyObject *args) { int argc; - PyObject *argv[9]; + PyObject *argv[12]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 8); ii++) { + for (ii = 0; (ii < argc) && (ii < 11); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -33300,7 +33165,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_csc_eldiv_csc__SWIG_1(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_eldiv_csc__SWIG_1(self, args); + } + } + } } } } @@ -33310,7 +33190,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -33346,7 +33226,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_csc_eldiv_csc__SWIG_2(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_eldiv_csc__SWIG_2(self, args); + } + } + } } } } @@ -33356,7 +33251,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -33392,7 +33287,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_csc_eldiv_csc__SWIG_3(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_eldiv_csc__SWIG_3(self, args); + } + } + } } } } @@ -33402,7 +33312,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -33438,7 +33348,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_csc_eldiv_csc__SWIG_4(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_eldiv_csc__SWIG_4(self, args); + } + } + } } } } @@ -33448,7 +33373,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -33484,7 +33409,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_csc_eldiv_csc__SWIG_5(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_eldiv_csc__SWIG_5(self, args); + } + } + } } } } @@ -33494,7 +33434,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -33530,7 +33470,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csc_eldiv_csc__SWIG_6(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_eldiv_csc__SWIG_6(self, args); + } + } + } } } } @@ -33540,7 +33495,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -33576,7 +33531,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csc_eldiv_csc__SWIG_7(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_eldiv_csc__SWIG_7(self, args); + } + } + } } } } @@ -33586,7 +33556,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -33622,7 +33592,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csc_eldiv_csc__SWIG_8(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_eldiv_csc__SWIG_8(self, args); + } + } + } } } } @@ -33632,7 +33617,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -33668,7 +33653,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csc_eldiv_csc__SWIG_9(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_eldiv_csc__SWIG_9(self, args); + } + } + } } } } @@ -33680,7 +33680,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_eldiv_csc'.\n Possible C/C++ prototypes are:\n"" csc_eldiv_csc<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],std::vector *,std::vector *,std::vector *)\n"" csc_eldiv_csc<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],std::vector *,std::vector *,std::vector *)\n"" csc_eldiv_csc<(int,short)>(int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],std::vector *,std::vector *,std::vector *)\n"" csc_eldiv_csc<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],std::vector *,std::vector *,std::vector *)\n"" csc_eldiv_csc<(int,long long)>(int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],std::vector *,std::vector *,std::vector *)\n"" csc_eldiv_csc<(int,float)>(int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" csc_eldiv_csc<(int,double)>(int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"" csc_eldiv_csc<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],std::vector *,std::vector *,std::vector *)\n"" csc_eldiv_csc<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],std::vector *,std::vector *,std::vector *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_eldiv_csc'.\n Possible C/C++ prototypes are:\n"" csc_eldiv_csc<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],int [],int [],signed char [])\n"" csc_eldiv_csc<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" csc_eldiv_csc<(int,short)>(int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],int [],int [],short [])\n"" csc_eldiv_csc<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],int [],int [],int [])\n"" csc_eldiv_csc<(int,long long)>(int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],int [],int [],long long [])\n"" csc_eldiv_csc<(int,float)>(int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],int [],int [],float [])\n"" csc_eldiv_csc<(int,double)>(int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],int [],int [],double [])\n"" csc_eldiv_csc<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" csc_eldiv_csc<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); return NULL; } @@ -33695,9 +33695,9 @@ int *arg6 ; int *arg7 ; signed char *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + signed char *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -33714,9 +33714,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -33725,20 +33725,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_plus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_plus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_plus_csc" "', argument " "1"" of type '" "int""'"); @@ -33809,29 +33800,23 @@ arg8 = (signed char*) array8->data; } - csc_plus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(signed char const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(signed char)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_BYTE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (signed char*) array_data(temp11); } + csc_plus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(signed char const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -33884,9 +33869,9 @@ int *arg6 ; int *arg7 ; unsigned char *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + unsigned char *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -33903,9 +33888,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -33914,20 +33899,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_plus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_plus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_plus_csc" "', argument " "1"" of type '" "int""'"); @@ -33998,29 +33974,23 @@ arg8 = (unsigned char*) array8->data; } - csc_plus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(unsigned char const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(unsigned char)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_UBYTE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (unsigned char*) array_data(temp11); } + csc_plus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(unsigned char const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -34073,9 +34043,9 @@ int *arg6 ; int *arg7 ; short *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + short *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -34092,9 +34062,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -34103,20 +34073,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_plus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_plus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_plus_csc" "', argument " "1"" of type '" "int""'"); @@ -34187,29 +34148,23 @@ arg8 = (short*) array8->data; } - csc_plus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,(int const (*))arg6,(int const (*))arg7,(short const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(short)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_SHORT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (short*) array_data(temp11); } + csc_plus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,(int const (*))arg6,(int const (*))arg7,(short const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -34262,9 +34217,9 @@ int *arg6 ; int *arg7 ; int *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + int *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -34281,9 +34236,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -34292,20 +34247,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_plus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_plus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_plus_csc" "', argument " "1"" of type '" "int""'"); @@ -34376,29 +34322,23 @@ arg8 = (int*) array8->data; } - csc_plus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } + csc_plus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -34451,9 +34391,9 @@ int *arg6 ; int *arg7 ; long long *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + long long *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -34470,9 +34410,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -34481,20 +34421,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_plus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_plus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_plus_csc" "', argument " "1"" of type '" "int""'"); @@ -34565,29 +34496,23 @@ arg8 = (long long*) array8->data; } - csc_plus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,(int const (*))arg6,(int const (*))arg7,(long long const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(long long)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_LONGLONG); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (long long*) array_data(temp11); } + csc_plus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,(int const (*))arg6,(int const (*))arg7,(long long const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -34640,9 +34565,9 @@ int *arg6 ; int *arg7 ; float *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + float *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -34659,9 +34584,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -34670,20 +34595,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_plus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_plus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_plus_csc" "', argument " "1"" of type '" "int""'"); @@ -34754,29 +34670,23 @@ arg8 = (float*) array8->data; } - csc_plus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(int const (*))arg6,(int const (*))arg7,(float const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(float)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_FLOAT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (float*) array_data(temp11); } + csc_plus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(int const (*))arg6,(int const (*))arg7,(float const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -34829,9 +34739,9 @@ int *arg6 ; int *arg7 ; double *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + double *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -34848,9 +34758,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -34859,20 +34769,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_plus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_plus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_plus_csc" "', argument " "1"" of type '" "int""'"); @@ -34943,29 +34844,23 @@ arg8 = (double*) array8->data; } - csc_plus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(int const (*))arg6,(int const (*))arg7,(double const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(double)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_DOUBLE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (double*) array_data(temp11); } + csc_plus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(int const (*))arg6,(int const (*))arg7,(double const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -35018,9 +34913,9 @@ int *arg6 ; int *arg7 ; npy_cfloat_wrapper *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + npy_cfloat_wrapper *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -35037,9 +34932,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -35048,20 +34943,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_plus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_plus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_plus_csc" "', argument " "1"" of type '" "int""'"); @@ -35132,29 +35018,23 @@ arg8 = (npy_cfloat_wrapper*) array8->data; } - csc_plus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cfloat_wrapper const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(npy_cfloat_wrapper)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_CFLOAT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (npy_cfloat_wrapper*) array_data(temp11); } + csc_plus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cfloat_wrapper const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -35207,9 +35087,9 @@ int *arg6 ; int *arg7 ; npy_cdouble_wrapper *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + npy_cdouble_wrapper *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -35226,9 +35106,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -35237,20 +35117,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_plus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_plus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_plus_csc" "', argument " "1"" of type '" "int""'"); @@ -35321,29 +35192,23 @@ arg8 = (npy_cdouble_wrapper*) array8->data; } - csc_plus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cdouble_wrapper const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(npy_cdouble_wrapper)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_CDOUBLE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (npy_cdouble_wrapper*) array_data(temp11); } + csc_plus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cdouble_wrapper const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -35388,15 +35253,15 @@ SWIGINTERN PyObject *_wrap_csc_plus_csc(PyObject *self, PyObject *args) { int argc; - PyObject *argv[9]; + PyObject *argv[12]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 8); ii++) { + for (ii = 0; (ii < argc) && (ii < 11); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -35432,7 +35297,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_csc_plus_csc__SWIG_1(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_plus_csc__SWIG_1(self, args); + } + } + } } } } @@ -35442,7 +35322,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -35478,7 +35358,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_csc_plus_csc__SWIG_2(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_plus_csc__SWIG_2(self, args); + } + } + } } } } @@ -35488,7 +35383,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -35524,7 +35419,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_csc_plus_csc__SWIG_3(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_plus_csc__SWIG_3(self, args); + } + } + } } } } @@ -35534,7 +35444,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -35570,7 +35480,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_csc_plus_csc__SWIG_4(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_plus_csc__SWIG_4(self, args); + } + } + } } } } @@ -35580,7 +35505,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -35616,7 +35541,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_csc_plus_csc__SWIG_5(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_plus_csc__SWIG_5(self, args); + } + } + } } } } @@ -35626,7 +35566,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -35662,7 +35602,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csc_plus_csc__SWIG_6(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_plus_csc__SWIG_6(self, args); + } + } + } } } } @@ -35672,7 +35627,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -35708,7 +35663,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csc_plus_csc__SWIG_7(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_plus_csc__SWIG_7(self, args); + } + } + } } } } @@ -35718,7 +35688,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -35754,7 +35724,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csc_plus_csc__SWIG_8(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_plus_csc__SWIG_8(self, args); + } + } + } } } } @@ -35764,7 +35749,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -35800,7 +35785,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csc_plus_csc__SWIG_9(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_plus_csc__SWIG_9(self, args); + } + } + } } } } @@ -35812,7 +35812,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_plus_csc'.\n Possible C/C++ prototypes are:\n"" csc_plus_csc<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],std::vector *,std::vector *,std::vector *)\n"" csc_plus_csc<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],std::vector *,std::vector *,std::vector *)\n"" csc_plus_csc<(int,short)>(int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],std::vector *,std::vector *,std::vector *)\n"" csc_plus_csc<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],std::vector *,std::vector *,std::vector *)\n"" csc_plus_csc<(int,long long)>(int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],std::vector *,std::vector *,std::vector *)\n"" csc_plus_csc<(int,float)>(int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" csc_plus_csc<(int,double)>(int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"" csc_plus_csc<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],std::vector *,std::vector *,std::vector *)\n"" csc_plus_csc<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],std::vector *,std::vector *,std::vector *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_plus_csc'.\n Possible C/C++ prototypes are:\n"" csc_plus_csc<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],int [],int [],signed char [])\n"" csc_plus_csc<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" csc_plus_csc<(int,short)>(int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],int [],int [],short [])\n"" csc_plus_csc<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],int [],int [],int [])\n"" csc_plus_csc<(int,long long)>(int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],int [],int [],long long [])\n"" csc_plus_csc<(int,float)>(int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],int [],int [],float [])\n"" csc_plus_csc<(int,double)>(int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],int [],int [],double [])\n"" csc_plus_csc<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" csc_plus_csc<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); return NULL; } @@ -35827,9 +35827,9 @@ int *arg6 ; int *arg7 ; signed char *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + signed char *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -35846,9 +35846,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -35857,20 +35857,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_minus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_minus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_minus_csc" "', argument " "1"" of type '" "int""'"); @@ -35941,29 +35932,23 @@ arg8 = (signed char*) array8->data; } - csc_minus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(signed char const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(signed char)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_BYTE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (signed char*) array_data(temp11); } + csc_minus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(signed char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(signed char const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -36016,9 +36001,9 @@ int *arg6 ; int *arg7 ; unsigned char *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + unsigned char *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -36035,9 +36020,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -36046,20 +36031,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_minus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_minus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_minus_csc" "', argument " "1"" of type '" "int""'"); @@ -36130,29 +36106,23 @@ arg8 = (unsigned char*) array8->data; } - csc_minus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(unsigned char const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(unsigned char)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_UBYTE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (unsigned char*) array_data(temp11); } + csc_minus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(unsigned char const (*))arg5,(int const (*))arg6,(int const (*))arg7,(unsigned char const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -36205,9 +36175,9 @@ int *arg6 ; int *arg7 ; short *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + short *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -36224,9 +36194,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -36235,20 +36205,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_minus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_minus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_minus_csc" "', argument " "1"" of type '" "int""'"); @@ -36319,29 +36280,23 @@ arg8 = (short*) array8->data; } - csc_minus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,(int const (*))arg6,(int const (*))arg7,(short const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(short)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_SHORT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (short*) array_data(temp11); } + csc_minus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(short const (*))arg5,(int const (*))arg6,(int const (*))arg7,(short const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -36394,9 +36349,9 @@ int *arg6 ; int *arg7 ; int *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + int *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -36413,9 +36368,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -36424,20 +36379,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_minus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_minus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_minus_csc" "', argument " "1"" of type '" "int""'"); @@ -36508,29 +36454,23 @@ arg8 = (int*) array8->data; } - csc_minus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } + csc_minus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -36583,9 +36523,9 @@ int *arg6 ; int *arg7 ; long long *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + long long *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -36602,9 +36542,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -36613,20 +36553,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_minus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_minus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_minus_csc" "', argument " "1"" of type '" "int""'"); @@ -36697,29 +36628,23 @@ arg8 = (long long*) array8->data; } - csc_minus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,(int const (*))arg6,(int const (*))arg7,(long long const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(long long)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_LONGLONG); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (long long*) array_data(temp11); } + csc_minus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(long long const (*))arg5,(int const (*))arg6,(int const (*))arg7,(long long const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -36772,9 +36697,9 @@ int *arg6 ; int *arg7 ; float *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + float *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -36791,9 +36716,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -36802,20 +36727,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_minus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_minus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_minus_csc" "', argument " "1"" of type '" "int""'"); @@ -36886,29 +36802,23 @@ arg8 = (float*) array8->data; } - csc_minus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(int const (*))arg6,(int const (*))arg7,(float const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(float)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_FLOAT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (float*) array_data(temp11); } + csc_minus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(float const (*))arg5,(int const (*))arg6,(int const (*))arg7,(float const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -36961,9 +36871,9 @@ int *arg6 ; int *arg7 ; double *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + double *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -36980,9 +36890,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -36991,20 +36901,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_minus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_minus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_minus_csc" "', argument " "1"" of type '" "int""'"); @@ -37075,29 +36976,23 @@ arg8 = (double*) array8->data; } - csc_minus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(int const (*))arg6,(int const (*))arg7,(double const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(double)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_DOUBLE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (double*) array_data(temp11); } + csc_minus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(double const (*))arg5,(int const (*))arg6,(int const (*))arg7,(double const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -37150,9 +37045,9 @@ int *arg6 ; int *arg7 ; npy_cfloat_wrapper *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + npy_cfloat_wrapper *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -37169,9 +37064,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -37180,20 +37075,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_minus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_minus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_minus_csc" "', argument " "1"" of type '" "int""'"); @@ -37264,29 +37150,23 @@ arg8 = (npy_cfloat_wrapper*) array8->data; } - csc_minus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cfloat_wrapper const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(npy_cfloat_wrapper)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_CFLOAT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (npy_cfloat_wrapper*) array_data(temp11); } + csc_minus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cfloat_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cfloat_wrapper const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -37339,9 +37219,9 @@ int *arg6 ; int *arg7 ; npy_cdouble_wrapper *arg8 ; - std::vector *arg9 = (std::vector *) 0 ; - std::vector *arg10 = (std::vector *) 0 ; - std::vector *arg11 = (std::vector *) 0 ; + int *arg9 ; + int *arg10 ; + npy_cdouble_wrapper *arg11 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -37358,9 +37238,9 @@ int is_new_object7 ; PyArrayObject *array8 = NULL ; int is_new_object8 ; - std::vector *tmp9 ; - std::vector *tmp10 ; - std::vector *tmp11 ; + PyArrayObject *temp9 = NULL ; + PyArrayObject *temp10 = NULL ; + PyArrayObject *temp11 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -37369,20 +37249,11 @@ PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - { - tmp9 = new std::vector(); - arg9 = tmp9; - } - { - tmp10 = new std::vector(); - arg10 = tmp10; - } - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:csc_minus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOO:csc_minus_csc",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csc_minus_csc" "', argument " "1"" of type '" "int""'"); @@ -37453,29 +37324,23 @@ arg8 = (npy_cdouble_wrapper*) array8->data; } - csc_minus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cdouble_wrapper const (*))arg8,arg9,arg10,arg11); - resultobj = SWIG_Py_Void(); { - int length = (arg9)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg9))[0]),sizeof(int)*length); - delete arg9; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp9 = obj_to_array_no_conversion(obj8,PyArray_INT); + if (!temp9 || !require_contiguous(temp9) || !require_native(temp9)) SWIG_fail; + arg9 = (int*) array_data(temp9); } { - int length = (arg10)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg10))[0]),sizeof(int)*length); - delete arg10; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp10 = obj_to_array_no_conversion(obj9,PyArray_INT); + if (!temp10 || !require_contiguous(temp10) || !require_native(temp10)) SWIG_fail; + arg10 = (int*) array_data(temp10); } { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(npy_cdouble_wrapper)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_CDOUBLE); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (npy_cdouble_wrapper*) array_data(temp11); } + csc_minus_csc(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(npy_cdouble_wrapper const (*))arg5,(int const (*))arg6,(int const (*))arg7,(npy_cdouble_wrapper const (*))arg8,arg9,arg10,arg11); + resultobj = SWIG_Py_Void(); { if (is_new_object3 && array3) Py_DECREF(array3); } @@ -37520,15 +37385,15 @@ SWIGINTERN PyObject *_wrap_csc_minus_csc(PyObject *self, PyObject *args) { int argc; - PyObject *argv[9]; + PyObject *argv[12]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 8); ii++) { + for (ii = 0; (ii < argc) && (ii < 11); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -37564,7 +37429,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_csc_minus_csc__SWIG_1(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_minus_csc__SWIG_1(self, args); + } + } + } } } } @@ -37574,7 +37454,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -37610,7 +37490,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_csc_minus_csc__SWIG_2(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_minus_csc__SWIG_2(self, args); + } + } + } } } } @@ -37620,7 +37515,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -37656,7 +37551,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_csc_minus_csc__SWIG_3(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_minus_csc__SWIG_3(self, args); + } + } + } } } } @@ -37666,7 +37576,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -37702,7 +37612,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_csc_minus_csc__SWIG_4(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_minus_csc__SWIG_4(self, args); + } + } + } } } } @@ -37712,7 +37637,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -37748,7 +37673,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_csc_minus_csc__SWIG_5(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_minus_csc__SWIG_5(self, args); + } + } + } } } } @@ -37758,7 +37698,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -37794,7 +37734,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csc_minus_csc__SWIG_6(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_minus_csc__SWIG_6(self, args); + } + } + } } } } @@ -37804,7 +37759,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -37840,7 +37795,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csc_minus_csc__SWIG_7(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_minus_csc__SWIG_7(self, args); + } + } + } } } } @@ -37850,7 +37820,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -37886,7 +37856,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_csc_minus_csc__SWIG_8(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_minus_csc__SWIG_8(self, args); + } + } + } } } } @@ -37896,7 +37881,7 @@ } } } - if (argc == 8) { + if (argc == 11) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -37932,7 +37917,22 @@ _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_csc_minus_csc__SWIG_9(self, args); + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_csc_minus_csc__SWIG_9(self, args); + } + } + } } } } @@ -37944,7 +37944,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_minus_csc'.\n Possible C/C++ prototypes are:\n"" csc_minus_csc<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],std::vector *,std::vector *,std::vector *)\n"" csc_minus_csc<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],std::vector *,std::vector *,std::vector *)\n"" csc_minus_csc<(int,short)>(int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],std::vector *,std::vector *,std::vector *)\n"" csc_minus_csc<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],std::vector *,std::vector *,std::vector *)\n"" csc_minus_csc<(int,long long)>(int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],std::vector *,std::vector *,std::vector *)\n"" csc_minus_csc<(int,float)>(int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" csc_minus_csc<(int,double)>(int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"" csc_minus_csc<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],std::vector *,std::vector *,std::vector *)\n"" csc_minus_csc<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],std::vector *,std::vector *,std::vector *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_minus_csc'.\n Possible C/C++ prototypes are:\n"" csc_minus_csc<(int,signed char)>(int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],int [],int [],signed char [])\n"" csc_minus_csc<(int,unsigned char)>(int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" csc_minus_csc<(int,short)>(int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],int [],int [],short [])\n"" csc_minus_csc<(int,int)>(int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],int [],int [],int [])\n"" csc_minus_csc<(int,long long)>(int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],int [],int [],long long [])\n"" csc_minus_csc<(int,float)>(int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],int [],int [],float [])\n"" csc_minus_csc<(int,double)>(int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],int [],int [],double [])\n"" csc_minus_csc<(int,npy_cfloat_wrapper)>(int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" csc_minus_csc<(int,npy_cdouble_wrapper)>(int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); return NULL; } @@ -51390,251 +51390,203 @@ ""}, { (char *)"csr_elmul_csr", _wrap_csr_elmul_csr, METH_VARARGS, (char *)"\n" "csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n" - " int Bp, int Bj, signed char Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(signed char)> Cx)\n" + " int Bp, int Bj, signed char Bx, int Cp, int Cj, \n" + " signed char Cx)\n" "csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, \n" - " int Bp, int Bj, unsigned char Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(unsigned char)> Cx)\n" + " int Bp, int Bj, unsigned char Bx, int Cp, \n" + " int Cj, unsigned char Cx)\n" "csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, \n" - " int Bj, short Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(short)> Cx)\n" + " int Bj, short Bx, int Cp, int Cj, short Cx)\n" "csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, \n" - " int Bj, int Bx, std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(int)> Cx)\n" + " int Bj, int Bx, int Cp, int Cj, int Cx)\n" "csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, long long Ax, \n" - " int Bp, int Bj, long long Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(long long)> Cx)\n" + " int Bp, int Bj, long long Bx, int Cp, int Cj, \n" + " long long Cx)\n" "csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, \n" - " int Bj, float Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(float)> Cx)\n" + " int Bj, float Bx, int Cp, int Cj, float Cx)\n" "csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, \n" - " int Bj, double Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(double)> Cx)\n" + " int Bj, double Bx, int Cp, int Cj, double Cx)\n" "csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, \n" " int Bp, int Bj, npy_cfloat_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(npy_cfloat_wrapper)> Cx)\n" + " int Cp, int Cj, npy_cfloat_wrapper Cx)\n" "csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, \n" " int Bp, int Bj, npy_cdouble_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(npy_cdouble_wrapper)> Cx)\n" + " int Cp, int Cj, npy_cdouble_wrapper Cx)\n" ""}, { (char *)"csr_eldiv_csr", _wrap_csr_eldiv_csr, METH_VARARGS, (char *)"\n" "csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n" - " int Bp, int Bj, signed char Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(signed char)> Cx)\n" + " int Bp, int Bj, signed char Bx, int Cp, int Cj, \n" + " signed char Cx)\n" "csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, \n" - " int Bp, int Bj, unsigned char Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(unsigned char)> Cx)\n" + " int Bp, int Bj, unsigned char Bx, int Cp, \n" + " int Cj, unsigned char Cx)\n" "csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, \n" - " int Bj, short Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(short)> Cx)\n" + " int Bj, short Bx, int Cp, int Cj, short Cx)\n" "csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, \n" - " int Bj, int Bx, std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(int)> Cx)\n" + " int Bj, int Bx, int Cp, int Cj, int Cx)\n" "csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, long long Ax, \n" - " int Bp, int Bj, long long Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(long long)> Cx)\n" + " int Bp, int Bj, long long Bx, int Cp, int Cj, \n" + " long long Cx)\n" "csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, \n" - " int Bj, float Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(float)> Cx)\n" + " int Bj, float Bx, int Cp, int Cj, float Cx)\n" "csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, \n" - " int Bj, double Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(double)> Cx)\n" + " int Bj, double Bx, int Cp, int Cj, double Cx)\n" "csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, \n" " int Bp, int Bj, npy_cfloat_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(npy_cfloat_wrapper)> Cx)\n" + " int Cp, int Cj, npy_cfloat_wrapper Cx)\n" "csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, \n" " int Bp, int Bj, npy_cdouble_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(npy_cdouble_wrapper)> Cx)\n" + " int Cp, int Cj, npy_cdouble_wrapper Cx)\n" ""}, { (char *)"csr_plus_csr", _wrap_csr_plus_csr, METH_VARARGS, (char *)"\n" "csr_plus_csr(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n" - " int Bp, int Bj, signed char Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(signed char)> Cx)\n" + " int Bp, int Bj, signed char Bx, int Cp, int Cj, \n" + " signed char Cx)\n" "csr_plus_csr(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, \n" - " int Bp, int Bj, unsigned char Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(unsigned char)> Cx)\n" + " int Bp, int Bj, unsigned char Bx, int Cp, \n" + " int Cj, unsigned char Cx)\n" "csr_plus_csr(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, \n" - " int Bj, short Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(short)> Cx)\n" + " int Bj, short Bx, int Cp, int Cj, short Cx)\n" "csr_plus_csr(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, \n" - " int Bj, int Bx, std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(int)> Cx)\n" + " int Bj, int Bx, int Cp, int Cj, int Cx)\n" "csr_plus_csr(int n_row, int n_col, int Ap, int Aj, long long Ax, \n" - " int Bp, int Bj, long long Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(long long)> Cx)\n" + " int Bp, int Bj, long long Bx, int Cp, int Cj, \n" + " long long Cx)\n" "csr_plus_csr(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, \n" - " int Bj, float Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(float)> Cx)\n" + " int Bj, float Bx, int Cp, int Cj, float Cx)\n" "csr_plus_csr(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, \n" - " int Bj, double Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(double)> Cx)\n" + " int Bj, double Bx, int Cp, int Cj, double Cx)\n" "csr_plus_csr(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, \n" " int Bp, int Bj, npy_cfloat_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(npy_cfloat_wrapper)> Cx)\n" + " int Cp, int Cj, npy_cfloat_wrapper Cx)\n" "csr_plus_csr(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, \n" " int Bp, int Bj, npy_cdouble_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(npy_cdouble_wrapper)> Cx)\n" + " int Cp, int Cj, npy_cdouble_wrapper Cx)\n" ""}, { (char *)"csr_minus_csr", _wrap_csr_minus_csr, METH_VARARGS, (char *)"\n" "csr_minus_csr(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n" - " int Bp, int Bj, signed char Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(signed char)> Cx)\n" + " int Bp, int Bj, signed char Bx, int Cp, int Cj, \n" + " signed char Cx)\n" "csr_minus_csr(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, \n" - " int Bp, int Bj, unsigned char Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(unsigned char)> Cx)\n" + " int Bp, int Bj, unsigned char Bx, int Cp, \n" + " int Cj, unsigned char Cx)\n" "csr_minus_csr(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, \n" - " int Bj, short Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(short)> Cx)\n" + " int Bj, short Bx, int Cp, int Cj, short Cx)\n" "csr_minus_csr(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, \n" - " int Bj, int Bx, std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(int)> Cx)\n" + " int Bj, int Bx, int Cp, int Cj, int Cx)\n" "csr_minus_csr(int n_row, int n_col, int Ap, int Aj, long long Ax, \n" - " int Bp, int Bj, long long Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(long long)> Cx)\n" + " int Bp, int Bj, long long Bx, int Cp, int Cj, \n" + " long long Cx)\n" "csr_minus_csr(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, \n" - " int Bj, float Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(float)> Cx)\n" + " int Bj, float Bx, int Cp, int Cj, float Cx)\n" "csr_minus_csr(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, \n" - " int Bj, double Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(double)> Cx)\n" + " int Bj, double Bx, int Cp, int Cj, double Cx)\n" "csr_minus_csr(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, \n" " int Bp, int Bj, npy_cfloat_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(npy_cfloat_wrapper)> Cx)\n" + " int Cp, int Cj, npy_cfloat_wrapper Cx)\n" "csr_minus_csr(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, \n" " int Bp, int Bj, npy_cdouble_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(npy_cdouble_wrapper)> Cx)\n" + " int Cp, int Cj, npy_cdouble_wrapper Cx)\n" ""}, { (char *)"csc_elmul_csc", _wrap_csc_elmul_csc, METH_VARARGS, (char *)"\n" "csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, signed char Ax, \n" - " int Bp, int Bi, signed char Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(signed char)> Cx)\n" + " int Bp, int Bi, signed char Bx, int Cp, int Ci, \n" + " signed char Cx)\n" "csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, \n" - " int Bp, int Bi, unsigned char Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(unsigned char)> Cx)\n" + " int Bp, int Bi, unsigned char Bx, int Cp, \n" + " int Ci, unsigned char Cx)\n" "csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, \n" - " int Bi, short Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(short)> Cx)\n" + " int Bi, short Bx, int Cp, int Ci, short Cx)\n" "csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, \n" - " int Bi, int Bx, std::vector<(int)> Cp, std::vector<(int)> Ci, \n" - " std::vector<(int)> Cx)\n" + " int Bi, int Bx, int Cp, int Ci, int Cx)\n" "csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, long long Ax, \n" - " int Bp, int Bi, long long Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(long long)> Cx)\n" + " int Bp, int Bi, long long Bx, int Cp, int Ci, \n" + " long long Cx)\n" "csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, \n" - " int Bi, float Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(float)> Cx)\n" + " int Bi, float Bx, int Cp, int Ci, float Cx)\n" "csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, \n" - " int Bi, double Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(double)> Cx)\n" + " int Bi, double Bx, int Cp, int Ci, double Cx)\n" "csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, \n" " int Bp, int Bi, npy_cfloat_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Ci, \n" - " std::vector<(npy_cfloat_wrapper)> Cx)\n" + " int Cp, int Ci, npy_cfloat_wrapper Cx)\n" "csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, \n" " int Bp, int Bi, npy_cdouble_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Ci, \n" - " std::vector<(npy_cdouble_wrapper)> Cx)\n" + " int Cp, int Ci, npy_cdouble_wrapper Cx)\n" ""}, { (char *)"csc_eldiv_csc", _wrap_csc_eldiv_csc, METH_VARARGS, (char *)"\n" "csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, signed char Ax, \n" - " int Bp, int Bi, signed char Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(signed char)> Cx)\n" + " int Bp, int Bi, signed char Bx, int Cp, int Ci, \n" + " signed char Cx)\n" "csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, \n" - " int Bp, int Bi, unsigned char Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(unsigned char)> Cx)\n" + " int Bp, int Bi, unsigned char Bx, int Cp, \n" + " int Ci, unsigned char Cx)\n" "csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, \n" - " int Bi, short Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(short)> Cx)\n" + " int Bi, short Bx, int Cp, int Ci, short Cx)\n" "csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, \n" - " int Bi, int Bx, std::vector<(int)> Cp, std::vector<(int)> Ci, \n" - " std::vector<(int)> Cx)\n" + " int Bi, int Bx, int Cp, int Ci, int Cx)\n" "csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, long long Ax, \n" - " int Bp, int Bi, long long Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(long long)> Cx)\n" + " int Bp, int Bi, long long Bx, int Cp, int Ci, \n" + " long long Cx)\n" "csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, \n" - " int Bi, float Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(float)> Cx)\n" + " int Bi, float Bx, int Cp, int Ci, float Cx)\n" "csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, \n" - " int Bi, double Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(double)> Cx)\n" + " int Bi, double Bx, int Cp, int Ci, double Cx)\n" "csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, \n" " int Bp, int Bi, npy_cfloat_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Ci, \n" - " std::vector<(npy_cfloat_wrapper)> Cx)\n" + " int Cp, int Ci, npy_cfloat_wrapper Cx)\n" "csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, \n" " int Bp, int Bi, npy_cdouble_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Ci, \n" - " std::vector<(npy_cdouble_wrapper)> Cx)\n" + " int Cp, int Ci, npy_cdouble_wrapper Cx)\n" ""}, { (char *)"csc_plus_csc", _wrap_csc_plus_csc, METH_VARARGS, (char *)"\n" "csc_plus_csc(int n_row, int n_col, int Ap, int Ai, signed char Ax, \n" - " int Bp, int Bi, signed char Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(signed char)> Cx)\n" + " int Bp, int Bi, signed char Bx, int Cp, int Ci, \n" + " signed char Cx)\n" "csc_plus_csc(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, \n" - " int Bp, int Bi, unsigned char Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(unsigned char)> Cx)\n" + " int Bp, int Bi, unsigned char Bx, int Cp, \n" + " int Ci, unsigned char Cx)\n" "csc_plus_csc(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, \n" - " int Bi, short Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(short)> Cx)\n" + " int Bi, short Bx, int Cp, int Ci, short Cx)\n" "csc_plus_csc(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, \n" - " int Bi, int Bx, std::vector<(int)> Cp, std::vector<(int)> Ci, \n" - " std::vector<(int)> Cx)\n" + " int Bi, int Bx, int Cp, int Ci, int Cx)\n" "csc_plus_csc(int n_row, int n_col, int Ap, int Ai, long long Ax, \n" - " int Bp, int Bi, long long Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(long long)> Cx)\n" + " int Bp, int Bi, long long Bx, int Cp, int Ci, \n" + " long long Cx)\n" "csc_plus_csc(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, \n" - " int Bi, float Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(float)> Cx)\n" + " int Bi, float Bx, int Cp, int Ci, float Cx)\n" "csc_plus_csc(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, \n" - " int Bi, double Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(double)> Cx)\n" + " int Bi, double Bx, int Cp, int Ci, double Cx)\n" "csc_plus_csc(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, \n" " int Bp, int Bi, npy_cfloat_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Ci, \n" - " std::vector<(npy_cfloat_wrapper)> Cx)\n" + " int Cp, int Ci, npy_cfloat_wrapper Cx)\n" "csc_plus_csc(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, \n" " int Bp, int Bi, npy_cdouble_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Ci, \n" - " std::vector<(npy_cdouble_wrapper)> Cx)\n" + " int Cp, int Ci, npy_cdouble_wrapper Cx)\n" ""}, { (char *)"csc_minus_csc", _wrap_csc_minus_csc, METH_VARARGS, (char *)"\n" "csc_minus_csc(int n_row, int n_col, int Ap, int Ai, signed char Ax, \n" - " int Bp, int Bi, signed char Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(signed char)> Cx)\n" + " int Bp, int Bi, signed char Bx, int Cp, int Ci, \n" + " signed char Cx)\n" "csc_minus_csc(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, \n" - " int Bp, int Bi, unsigned char Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(unsigned char)> Cx)\n" + " int Bp, int Bi, unsigned char Bx, int Cp, \n" + " int Ci, unsigned char Cx)\n" "csc_minus_csc(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, \n" - " int Bi, short Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(short)> Cx)\n" + " int Bi, short Bx, int Cp, int Ci, short Cx)\n" "csc_minus_csc(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, \n" - " int Bi, int Bx, std::vector<(int)> Cp, std::vector<(int)> Ci, \n" - " std::vector<(int)> Cx)\n" + " int Bi, int Bx, int Cp, int Ci, int Cx)\n" "csc_minus_csc(int n_row, int n_col, int Ap, int Ai, long long Ax, \n" - " int Bp, int Bi, long long Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(long long)> Cx)\n" + " int Bp, int Bi, long long Bx, int Cp, int Ci, \n" + " long long Cx)\n" "csc_minus_csc(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, \n" - " int Bi, float Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(float)> Cx)\n" + " int Bi, float Bx, int Cp, int Ci, float Cx)\n" "csc_minus_csc(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, \n" - " int Bi, double Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Ci, std::vector<(double)> Cx)\n" + " int Bi, double Bx, int Cp, int Ci, double Cx)\n" "csc_minus_csc(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, \n" " int Bp, int Bi, npy_cfloat_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Ci, \n" - " std::vector<(npy_cfloat_wrapper)> Cx)\n" + " int Cp, int Ci, npy_cfloat_wrapper Cx)\n" "csc_minus_csc(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, \n" " int Bp, int Bi, npy_cdouble_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Ci, \n" - " std::vector<(npy_cdouble_wrapper)> Cx)\n" + " int Cp, int Ci, npy_cdouble_wrapper Cx)\n" ""}, { (char *)"bsr_elmul_bsr", _wrap_bsr_elmul_bsr, METH_VARARGS, (char *)"\n" "bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" From scipy-svn at scipy.org Mon Dec 24 01:41:41 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 Dec 2007 00:41:41 -0600 (CST) Subject: [Scipy-svn] r3702 - in trunk/scipy/sparse: . sparsetools tests Message-ID: <20071224064141.22FCE39C563@new.scipy.org> Author: wnbell Date: 2007-12-24 00:41:28 -0600 (Mon, 24 Dec 2007) New Revision: 3702 Modified: trunk/scipy/sparse/compressed.py trunk/scipy/sparse/sparsetools/sparsetools.h trunk/scipy/sparse/tests/test_sparse.py Log: updated sparsetools comments added sort unittest Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-24 05:05:51 UTC (rev 3701) +++ trunk/scipy/sparse/compressed.py 2007-12-24 06:41:28 UTC (rev 3702) @@ -192,7 +192,7 @@ elif isspmatrix(other): if (other.shape != self.shape): raise ValueError, "inconsistent shapes" - + return self._binopt(other,'_plus_') elif isdense(other): # Convert this matrix to a dense matrix and add them Modified: trunk/scipy/sparse/sparsetools/sparsetools.h =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.h 2007-12-24 05:05:51 UTC (rev 3701) +++ trunk/scipy/sparse/sparsetools/sparsetools.h 2007-12-24 06:41:28 UTC (rev 3702) @@ -78,7 +78,7 @@ * Output array Bi must be preallocated * * Note: - * Complexity: Linear. + * Complexity: Linear * */ template @@ -107,7 +107,7 @@ * I num_blocks - number of blocks * * Note: - * Complexity: Linear. + * Complexity: Linear * */ template @@ -287,12 +287,13 @@ * I Bj[nnz(B)] - column indices * T Bx[nnz(B)] - nonzeros * Output Arguments: - * vec Cp - row pointer - * vec Cj - column indices - * vec Cx - nonzeros + * I Cp[n_row+1] - row pointer + * I Cj[nnz(C)] - column indices + * T Cx[nnz(C)] - nonzeros * * Note: * Output arrays Cp, Cj, and Cx must be preallocated + * The value of nnz(C) will be stored in Ap[n_row] after the first pass. * * Note: * Input: A and B column indices *are not* assumed to be in sorted order @@ -347,7 +348,8 @@ } /* - * Pass 2 computes CSR entries for C using the row pointer computed in Pass 1 + * Pass 2 computes CSR entries for matrix C = A*B using the + * row pointer Cp[] computed in Pass 1. * */ template @@ -539,80 +541,6 @@ } (*Cp)[i+1] = Cx->size(); } - - -// //Method that works for unsorted indices -// -// Cp->resize(n_brow + 1, 0); -// -// const I RC = R*C; -// -// std::vector next(n_bcol,-1); -// std::vector A_row(n_bcol*RC, 0); -// std::vector B_row(n_bcol*RC, 0); -// -// for(I i = 0; i < n_brow; i++){ -// I head = -2; -// I length = 0; -// -// //add a row of A to A_row -// for(I jj = Ap[i]; jj < Ap[i+1]; jj++){ -// I j = Aj[jj]; -// -// for(I n = 0; n < RC; n++) -// A_row[RC*j + n] += Ax[RC*jj + n]; -// -// if(next[j] == -1){ -// next[j] = head; -// head = j; -// length++; -// } -// } -// -// //add a row of B to B_row -// for(I jj = Bp[i]; jj < Bp[i+1]; jj++){ -// I j = Bj[jj]; -// -// for(I n = 0; n < RC; n++) -// B_row[RC*j + n] += Bx[RC*jj + n]; -// -// if(next[j] == -1){ -// next[j] = head; -// head = j; -// length++; -// } -// } -// -// -// for(I jj = 0; jj < length; jj++){ -// bool nonzero_block = false; -// for(I n = 0; n < RC; n++){ -// T result = op(A_row[RC*head + n],B_row[RC*head + n]); -// A_row[RC*head + n] = result; -// if(result != 0) -// nonzero_block = true; -// } -// -// -// if(nonzero_block){ -// Cj->push_back(head); -// for(I n = 0; n < RC; n++){ -// Cx->push_back(A_row[RC*head + n]); -// } -// } -// -// for(I n = 0; n < RC; n++){ -// A_row[RC*head + n] = 0; -// B_row[RC*head + n] = 0; -// } -// -// I temp = head; -// head = next[head]; -// next[temp] = -1; -// } -// -// (*Cp)[i+1] = Cj->size(); -// } } /* element-wise binary operations*/ @@ -659,7 +587,7 @@ /* * Compute C = A (bin_op) B for CSR matrices A,B * - * (bin_op) - binary operator to apply elementwise + * bin_op(x,y) - binary operator to apply elementwise * * * Input Arguments: @@ -672,16 +600,18 @@ * I Bj[nnz(B)] - column indices * T Bx[nnz(B)] - nonzeros * Output Arguments: - * vec Cp - row pointer - * vec Cj - column indices - * vec Cx - nonzeros + * I Cp[n_row+1] - row pointer + * I Cj[nnz(C)] - column indices + * T Cx[nnz(C)] - nonzeros * * Note: - * Output arrays Cp, Cj, and Cx will be allocated within in the method + * Output arrays Cp, Cj, and Cx must be preallocated + * If nnz(C) is not known a priori, a conservative bound is: + * nnz(C) <= nnz(A) + nnz(B) * * Note: - * Input: A and B column indices *are not* assumed to be in sorted order - * Output: C column indices *are not* assumed to be in sorted order + * Input: A and B column indices are assumed to be in sorted order + * Output: C column indices are assumed to be in sorted order * Cx will not contain any zero entries * */ @@ -699,12 +629,10 @@ T Cx[], const bin_op& op) { - //Method that works for sorted indices - assert( csr_has_sorted_indices(n_row,Ap,Aj) ); - assert( csr_has_sorted_indices(n_row,Bp,Bj) ); + //Method that works for sorted indices + // assert( csr_has_sorted_indices(n_row,Ap,Aj) ); + // assert( csr_has_sorted_indices(n_row,Bp,Bj) ); - //Cp->resize(n_row + 1, 0); - //(*Cp)[0] = 0; Cp[0] = 0; I nnz = 0; @@ -716,7 +644,7 @@ I A_j = Aj[A_pos]; I B_j = Bj[B_pos]; - + //while not finished with either row while(A_pos < A_end && B_pos < B_end){ if(A_j == B_j){ @@ -769,68 +697,6 @@ } Cp[i+1] = nnz; } - - -// //Method that works for unsorted indices -// Cp->resize(n_row + 1, 0); -// -// std::vector next(n_col,-1); -// std::vector A_row(n_col, 0); -// std::vector B_row(n_col, 0); -// -// for(I i = 0; i < n_row; i++){ -// I head = -2; -// I length = 0; -// -// //add a row of A to A_row -// I i_start = Ap[i]; -// I i_end = Ap[i+1]; -// for(I jj = i_start; jj < i_end; jj++){ -// I j = Aj[jj]; -// -// A_row[j] += Ax[jj]; -// -// if(next[j] == -1){ -// next[j] = head; -// head = j; -// length++; -// } -// } -// -// //add a row of B to B_row -// i_start = Bp[i]; -// i_end = Bp[i+1]; -// for(I jj = i_start; jj < i_end; jj++){ -// I j = Bj[jj]; -// -// B_row[j] += Bx[jj]; -// -// if(next[j] == -1){ -// next[j] = head; -// head = j; -// length++; -// } -// } -// -// -// for(I jj = 0; jj < length; jj++){ -// T result = op(A_row[head],B_row[head]); -// -// if(result != 0){ -// Cj->push_back(head); -// Cx->push_back(result); -// } -// -// I temp = head; -// head = next[head]; -// -// next[temp] = -1; -// A_row[temp] = 0; -// B_row[temp] = 0; -// } -// -// (*Cp)[i+1] = Cj->size(); -// } } /* element-wise binary operations*/ Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-24 05:05:51 UTC (rev 3701) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-24 06:41:28 UTC (rev 3702) @@ -12,6 +12,13 @@ from scipy.linsolve import splu restore_path() +def random_sparse(m,n,nnz_per_row): + rows = numpy.arange(m).repeat(nnz_per_row) + cols = numpy.random.random_integers(low=0,high=n-1,size=nnz_per_row*m) + vals = numpy.random.random_sample(m*nnz_per_row) + return coo_matrix((vals,(rows,cols)),(m,n)).tocsr() + + #TODO move this to a matrix gallery and add unittests def poisson2d(N,dtype='d',format=None): """ @@ -39,14 +46,12 @@ class TestSparseTools(NumpyTestCase): """Simple benchmarks for sparse matrix module""" - def test_arithmetic(self,level=4): + def test_arithmetic(self,level=5): matrices = [] #matrices.append( ('A','Identity', spidentity(500**2,format='csr')) ) matrices.append( ('A','Poisson5pt', poisson2d(500,format='csr')) ) matrices.append( ('B','Poisson5pt^2', poisson2d(500,format='csr')**2) ) - #matrices = [ (a,b,c.astype('int8')) for (a,b,c) in matrices ] - print print ' Sparse Matrix Arithmetic' print '====================================================================' @@ -87,9 +92,43 @@ operation = (X + '.' + op + '(' + Y + ')').center(17) print fmt % (format,operation,msec_per_it) + - def test_matvec(self,level=5): + def bench_sort(self,level=4): + """sort CSR column indices""" matrices = [] + matrices.append( ('Rand10', 1e4, 10) ) + matrices.append( ('Rand25', 1e4, 25) ) + matrices.append( ('Rand50', 1e4, 50) ) + matrices.append( ('Rand100', 1e4, 100) ) + matrices.append( ('Rand200', 1e4, 200) ) + + print + print ' Sparse Matrix Index Sorting' + print '=====================================================================' + print ' type | name | shape | nnz | time (msec) ' + print '---------------------------------------------------------------------' + fmt = ' %3s | %12s | %20s | %8d | %6.2f ' + + for name,N,K in matrices: + N = int(N) + A = random_sparse(N,N,K) + + start = time.clock() + iter = 0 + while iter < 5 and time.clock() - start < 1: + A.sort_indices(check_first =False) + iter += 1 + end = time.clock() + + name = name.center(12) + shape = ("%s" % (A.shape,)).center(20) + + print fmt % (A.format,name,shape,A.nnz,1e3*(end-start)/float(iter) ) + + + def bench_matvec(self,level=5): + matrices = [] matrices.append(('Identity', spidentity(10**4,format='dia'))) matrices.append(('Identity', spidentity(10**4,format='csr'))) matrices.append(('Poisson5pt', poisson2d(300,format='dia'))) From scipy-svn at scipy.org Mon Dec 24 04:20:02 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 Dec 2007 03:20:02 -0600 (CST) Subject: [Scipy-svn] r3703 - trunk/scipy/interpolate/tests Message-ID: <20071224092002.38B1339C5E4@new.scipy.org> Author: jarrod.millman Date: 2007-12-24 03:19:59 -0600 (Mon, 24 Dec 2007) New Revision: 3703 Removed: trunk/scipy/interpolate/tests/demos_xplt.py Log: removing code depending on xplt Deleted: trunk/scipy/interpolate/tests/demos_xplt.py =================================================================== --- trunk/scipy/interpolate/tests/demos_xplt.py 2007-12-24 06:41:28 UTC (rev 3702) +++ trunk/scipy/interpolate/tests/demos_xplt.py 2007-12-24 09:19:59 UTC (rev 3703) @@ -1,54 +0,0 @@ -#!/usr/bin/env python -# Created by Pearu Peterson, Aug 2003 -""" Test xplt based demos for interpolate.fitpack2 module -""" -__usage__ = """ -Build interpolate: - python setup_interpolate.py build -Run demos (assumes that scipy is installed): - python -i tests/demos_xplt.py -""" - -import sys -from numpy.test.testing import set_package_path -set_package_path() -from interpolate.fitpack2 import UnivariateSpline,LSQUnivariateSpline,\ - InterpolatedUnivariateSpline -from interpolate.fitpack2 import LSQBivariateSpline, SmoothBivariateSpline -del sys.path[0] - -from scipy import * - -def demo1(): - x = arange(0,2*pi+pi/4,2*pi/8) - xnew = arange(-pi/10,2*pi+pi/4+pi/10,pi/50) - y = sin(x) - - - def make_plot(): - xplt.plot(x,y,'x',xnew,spline(xnew),x,y,'b',xnew,sin(xnew), - spline.get_knots(),spline(spline.get_knots()),'o') - - spline = UnivariateSpline(x,y,k=1) - assert isinstance(spline,LSQUnivariateSpline) - print 'Linear LSQ approximation of sin(x):',spline.__class__.__name__ - make_plot() - print 'Residual=',spline.get_residual() - raw_input('Press any key to continue..') - - spline.set_smoothing_factor(0) - assert isinstance(spline,InterpolatedUnivariateSpline) - print 'Linear interpolation of sin(x):',spline.__class__.__name__ - make_plot() - print 'Residual=',spline.get_residual() - raw_input('Press any key to continue..') - - spline = UnivariateSpline(x,y,k=1,s=0.1) - print 'Linear smooth approximation of sin(x):',spline.__class__.__name__ - assert isinstance(spline,UnivariateSpline) - make_plot() - print 'Residual=',spline.get_residual() - raw_input('Press any key to continue..') - -if __name__ == "__main__": - demo1() From scipy-svn at scipy.org Mon Dec 24 04:22:31 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 Dec 2007 03:22:31 -0600 (CST) Subject: [Scipy-svn] r3704 - in trunk/scipy: integrate lib/blas linalg optimize special stats Message-ID: <20071224092231.119FC39C5E0@new.scipy.org> Author: jarrod.millman Date: 2007-12-24 03:22:25 -0600 (Mon, 24 Dec 2007) New Revision: 3704 Modified: trunk/scipy/integrate/setup.py trunk/scipy/lib/blas/setup.py trunk/scipy/linalg/setup.py trunk/scipy/optimize/cobyla.py trunk/scipy/special/orthogonal.py trunk/scipy/stats/distributions.py trunk/scipy/stats/morestats.py Log: Python 2.2+ always use nested scopes Modified: trunk/scipy/integrate/setup.py =================================================================== --- trunk/scipy/integrate/setup.py 2007-12-24 09:19:59 UTC (rev 3703) +++ trunk/scipy/integrate/setup.py 2007-12-24 09:22:25 UTC (rev 3704) @@ -1,6 +1,5 @@ #!/usr/bin/env python -from __future__ import nested_scopes from os.path import join def configuration(parent_package='',top_path=None): Modified: trunk/scipy/lib/blas/setup.py =================================================================== --- trunk/scipy/lib/blas/setup.py 2007-12-24 09:19:59 UTC (rev 3703) +++ trunk/scipy/lib/blas/setup.py 2007-12-24 09:22:25 UTC (rev 3704) @@ -1,6 +1,5 @@ #!/usr/bin/env python -from __future__ import nested_scopes import os import sys import re Modified: trunk/scipy/linalg/setup.py =================================================================== --- trunk/scipy/linalg/setup.py 2007-12-24 09:19:59 UTC (rev 3703) +++ trunk/scipy/linalg/setup.py 2007-12-24 09:22:25 UTC (rev 3704) @@ -2,7 +2,6 @@ #!/usr/bin/env python -from __future__ import nested_scopes import os import sys import re Modified: trunk/scipy/optimize/cobyla.py =================================================================== --- trunk/scipy/optimize/cobyla.py 2007-12-24 09:19:59 UTC (rev 3703) +++ trunk/scipy/optimize/cobyla.py 2007-12-24 09:22:25 UTC (rev 3704) @@ -8,7 +8,6 @@ """ -from __future__ import nested_scopes import _cobyla from numpy import copy def fmin_cobyla(func, x0, cons, args=(), consargs=None, rhobeg=1.0, rhoend=1e-4, Modified: trunk/scipy/special/orthogonal.py =================================================================== --- trunk/scipy/special/orthogonal.py 2007-12-24 09:19:59 UTC (rev 3703) +++ trunk/scipy/special/orthogonal.py 2007-12-24 09:22:25 UTC (rev 3704) @@ -57,8 +57,6 @@ l_roots -- Laguerre """ -from __future__ import nested_scopes - # Scipy imports. import numpy as np from numpy import all, any, exp, inf, pi, sqrt Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2007-12-24 09:19:59 UTC (rev 3703) +++ trunk/scipy/stats/distributions.py 2007-12-24 09:22:25 UTC (rev 3704) @@ -4,7 +4,6 @@ # Author: Travis Oliphant 2002-2003 # -from __future__ import nested_scopes import scipy from scipy.misc import comb, derivative from scipy import special Modified: trunk/scipy/stats/morestats.py =================================================================== --- trunk/scipy/stats/morestats.py 2007-12-24 09:19:59 UTC (rev 3703) +++ trunk/scipy/stats/morestats.py 2007-12-24 09:22:25 UTC (rev 3704) @@ -1,8 +1,6 @@ # Author: Travis Oliphant, 2002 # -from __future__ import nested_scopes - import math import statlib import stats From scipy-svn at scipy.org Mon Dec 24 04:28:07 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 Dec 2007 03:28:07 -0600 (CST) Subject: [Scipy-svn] r3705 - trunk/scipy/sandbox Message-ID: <20071224092807.328B839C5E0@new.scipy.org> Author: jarrod.millman Date: 2007-12-24 03:28:04 -0600 (Mon, 24 Dec 2007) New Revision: 3705 Removed: trunk/scipy/sandbox/arraysetops/ Log: functionality already in numpy From scipy-svn at scipy.org Mon Dec 24 04:29:14 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 Dec 2007 03:29:14 -0600 (CST) Subject: [Scipy-svn] r3706 - trunk/scipy/sandbox Message-ID: <20071224092914.211D239C5E0@new.scipy.org> Author: jarrod.millman Date: 2007-12-24 03:29:12 -0600 (Mon, 24 Dec 2007) New Revision: 3706 Removed: trunk/scipy/sandbox/cow/ Log: better functionality using ipython1 From scipy-svn at scipy.org Mon Dec 24 04:31:24 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 Dec 2007 03:31:24 -0600 (CST) Subject: [Scipy-svn] r3707 - trunk/scipy/sandbox Message-ID: <20071224093124.95FCA39C5E0@new.scipy.org> Author: jarrod.millman Date: 2007-12-24 03:31:22 -0600 (Mon, 24 Dec 2007) New Revision: 3707 Removed: trunk/scipy/sandbox/maskedarray/ Log: development moved to numpy branch From scipy-svn at scipy.org Mon Dec 24 04:32:05 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 Dec 2007 03:32:05 -0600 (CST) Subject: [Scipy-svn] r3708 - trunk/scipy/sandbox Message-ID: <20071224093205.2E48239C5E0@new.scipy.org> Author: jarrod.millman Date: 2007-12-24 03:32:01 -0600 (Mon, 24 Dec 2007) New Revision: 3708 Removed: trunk/scipy/sandbox/wavelet/ Log: empty From scipy-svn at scipy.org Mon Dec 24 04:34:43 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 Dec 2007 03:34:43 -0600 (CST) Subject: [Scipy-svn] r3709 - trunk/scipy/sandbox Message-ID: <20071224093443.1385F39C5E0@new.scipy.org> Author: jarrod.millman Date: 2007-12-24 03:34:41 -0600 (Mon, 24 Dec 2007) New Revision: 3709 Removed: trunk/scipy/sandbox/gplt/ trunk/scipy/sandbox/plt/ trunk/scipy/sandbox/xplt/ Log: no longer maintained, take a look at matplotlib or chaco From scipy-svn at scipy.org Mon Dec 24 04:37:19 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 Dec 2007 03:37:19 -0600 (CST) Subject: [Scipy-svn] r3710 - trunk/scipy/sandbox Message-ID: <20071224093719.5971739C5E0@new.scipy.org> Author: jarrod.millman Date: 2007-12-24 03:37:17 -0600 (Mon, 24 Dec 2007) New Revision: 3710 Modified: trunk/scipy/sandbox/setup.py Log: clean up Modified: trunk/scipy/sandbox/setup.py =================================================================== --- trunk/scipy/sandbox/setup.py 2007-12-24 09:34:41 UTC (rev 3709) +++ trunk/scipy/sandbox/setup.py 2007-12-24 09:37:17 UTC (rev 3710) @@ -48,15 +48,9 @@ # Delaunay triangulation and Natural Neighbor interpolation #config.add_subpackage('delaunay') - # Gist-based plotting library for X11 - #config.add_subpackage('xplt') - # elementwise numerical expressions #config.add_subpackage('numexpr') - # Statistical models - #config.add_subpackage('models') - # Adaptation of Scientific.IO (2.4.9) to use NumPy #config.add_subpackage('netcdf') From scipy-svn at scipy.org Mon Dec 24 05:30:11 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 Dec 2007 04:30:11 -0600 (CST) Subject: [Scipy-svn] r3711 - trunk/scipy/sandbox Message-ID: <20071224103011.DB31839C00A@new.scipy.org> Author: jarrod.millman Date: 2007-12-24 04:30:08 -0600 (Mon, 24 Dec 2007) New Revision: 3711 Removed: trunk/scipy/sandbox/ann/ trunk/scipy/sandbox/pyem/ trunk/scipy/sandbox/svm/ Log: moved to scikit.learn From scipy-svn at scipy.org Mon Dec 24 05:34:33 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 Dec 2007 04:34:33 -0600 (CST) Subject: [Scipy-svn] r3712 - in trunk: . scipy/sandbox Message-ID: <20071224103433.77DD239C039@new.scipy.org> Author: jarrod.millman Date: 2007-12-24 04:34:25 -0600 (Mon, 24 Dec 2007) New Revision: 3712 Modified: trunk/MANIFEST.in trunk/scipy/sandbox/setup.py Log: cleaning up Modified: trunk/MANIFEST.in =================================================================== --- trunk/MANIFEST.in 2007-12-24 10:30:08 UTC (rev 3711) +++ trunk/MANIFEST.in 2007-12-24 10:34:25 UTC (rev 3712) @@ -9,26 +9,20 @@ # # The following files are in the sandbox and wouldn't normally get included in sdist: # -include scipy/sandbox/ann/* -include scipy/sandbox/ann/data/* -include scipy/sandbox/ann/doc/* include scipy/sandbox/arpack/* include scipy/sandbox/arpack/ARPACK/* include scipy/sandbox/arpack/ARPACK/LAPACK/* include scipy/sandbox/arpack/ARPACK/SRC/* include scipy/sandbox/arpack/ARPACK/UTIL/* -include scipy/sandbox/arpack/build/* include scipy/sandbox/arpack/tests/* -include scipy/sandbox/arraysetops/* -include scipy/sandbox/arraysetops/tests/* include scipy/sandbox/buildgrid/* include scipy/sandbox/cdavid/* include scipy/sandbox/cdavid/src/* include scipy/sandbox/cdavid/tests/* include scipy/sandbox/constants/* -include scipy/sandbox/cow/* include scipy/sandbox/delaunay/* include scipy/sandbox/delaunay/tests/* +include scipy/sandbox/dhuard/* include scipy/sandbox/exmplpackage/* include scipy/sandbox/exmplpackage/tests/* include scipy/sandbox/exmplpackage/yyy/* @@ -38,64 +32,38 @@ include scipy/sandbox/fdfpack/tests/* include scipy/sandbox/fdfpack/utils/* include scipy/sandbox/ga/* -include scipy/sandbox/gplt/* include scipy/sandbox/image/* -include scipy/sandbox/maskedarray/* -include scipy/sandbox/maskedarray/tests/* +include scipy/sandbox/lobpcg/* +include scipy/sandbox/lobpcg/tests/* include scipy/sandbox/montecarlo/* +include scipy/sandbox/montecarlo/examples/* include scipy/sandbox/montecarlo/src/* include scipy/sandbox/montecarlo/tests/* +include scipy/sandbox/multigrid/* +include scipy/sandbox/multigrid/multigridtools/* +include scipy/sandbox/multigrid/tests/* +include scipy/sandbox/multigrid/tests/sample_data/* include scipy/sandbox/netcdf/* include scipy/sandbox/newoptimize/* +include scipy/sandbox/newoptimize/tnc/* include scipy/sandbox/numexpr/* +include scipy/sandbox/numexpr/bench/* include scipy/sandbox/numexpr/tests/* include scipy/sandbox/oliphant/* -include scipy/sandbox/plt/* -include scipy/sandbox/pyem/* -include scipy/sandbox/pyem/profile_data/* -include scipy/sandbox/pyem/src/* -include scipy/sandbox/pyem/tests/* -include scipy/sandbox/pysparse/* -include scipy/sandbox/pysparse/Tools/* -include scipy/sandbox/pysparse/amd/* -include scipy/sandbox/pysparse/docs/* -include scipy/sandbox/pysparse/examples/* -include scipy/sandbox/pysparse/examples/poisson_test/* -include scipy/sandbox/pysparse/include/* -include scipy/sandbox/pysparse/include/pysparse/* -include scipy/sandbox/pysparse/lib/* -include scipy/sandbox/pysparse/src/* -include scipy/sandbox/pysparse/superlu/* -include scipy/sandbox/pysparse/tests/* -include scipy/sandbox/pysparse/umfpack/* +include scipy/sandbox/pyloess/* +include scipy/sandbox/pyloess/doc/* +include scipy/sandbox/pyloess/src/* +include scipy/sandbox/pyloess/tests/* +include scipy/sandbox/rbf/* +include scipy/sandbox/rbf/tests/* include scipy/sandbox/rkern/* include scipy/sandbox/spline/* include scipy/sandbox/spline/fitpack/* include scipy/sandbox/spline/tests/* include scipy/sandbox/stats/* -include scipy/sandbox/svm/* -include scipy/sandbox/svm/libsvm-2.82/* -include scipy/sandbox/svm/tests/* include scipy/sandbox/timeseries/* -include scipy/sandbox/timeseries/doc/* -include scipy/sandbox/timeseries/examples/* -include scipy/sandbox/timeseries/mtimeseries/* -include scipy/sandbox/timeseries/mtimeseries/tests/* -include scipy/sandbox/timeseries/old/* -include scipy/sandbox/timeseries/plotlib/* +include scipy/sandbox/timeseries/include/* +include scipy/sandbox/timeseries/lib/* +include scipy/sandbox/timeseries/lib/tests/* include scipy/sandbox/timeseries/src/* -include scipy/sandbox/umfpack/* -include scipy/sandbox/umfpack/umfpack/* -include scipy/sandbox/wavelet/* -include scipy/sandbox/xplt/* -include scipy/sandbox/xplt/gistdata/* -include scipy/sandbox/xplt/pygist/* -include scipy/sandbox/xplt/src/* -include scipy/sandbox/xplt/src/g/* -include scipy/sandbox/xplt/src/gist/* -include scipy/sandbox/xplt/src/play/* -include scipy/sandbox/xplt/src/play/all/* -include scipy/sandbox/xplt/src/play/mac/* -include scipy/sandbox/xplt/src/play/unix/* -include scipy/sandbox/xplt/src/play/win/* -include scipy/sandbox/xplt/src/play/x11/* +include scipy/sandbox/timeseries/tests/* Modified: trunk/scipy/sandbox/setup.py =================================================================== --- trunk/scipy/sandbox/setup.py 2007-12-24 10:30:08 UTC (rev 3711) +++ trunk/scipy/sandbox/setup.py 2007-12-24 10:34:25 UTC (rev 3712) @@ -63,12 +63,6 @@ # Interpolating between sparse samples #config.add_subpackage('buildgrid') - # Package for Support Vector Machine - #config.add_subpackage('svm') - - # Package for Gaussian Mixture Models - #config.add_subpackage('pyem') - # David Cournapeau's corner: autocorrelation, lpc, lpc residual #config.add_subpackage('cdavid') From scipy-svn at scipy.org Mon Dec 24 05:38:28 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 Dec 2007 04:38:28 -0600 (CST) Subject: [Scipy-svn] r3713 - trunk/scipy/sandbox Message-ID: <20071224103828.E85A039C00F@new.scipy.org> Author: jarrod.millman Date: 2007-12-24 04:38:25 -0600 (Mon, 24 Dec 2007) New Revision: 3713 Removed: trunk/scipy/sandbox/oliphant/ Log: remove empty package From scipy-svn at scipy.org Mon Dec 24 05:38:52 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 Dec 2007 04:38:52 -0600 (CST) Subject: [Scipy-svn] r3714 - trunk/scipy/sandbox Message-ID: <20071224103852.0CDEC39C00F@new.scipy.org> Author: jarrod.millman Date: 2007-12-24 04:38:50 -0600 (Mon, 24 Dec 2007) New Revision: 3714 Removed: trunk/scipy/sandbox/stats/ Log: removing old code From scipy-svn at scipy.org Mon Dec 24 14:28:58 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 Dec 2007 13:28:58 -0600 (CST) Subject: [Scipy-svn] r3715 - in trunk/scipy/sparse: . sparsetools tests Message-ID: <20071224192858.A73D039C0E1@new.scipy.org> Author: wnbell Date: 2007-12-24 13:28:43 -0600 (Mon, 24 Dec 2007) New Revision: 3715 Modified: trunk/scipy/sparse/block.py trunk/scipy/sparse/bsr.py trunk/scipy/sparse/sparsetools/sparsetools.h trunk/scipy/sparse/tests/test_base.py Log: fixed bsr_matrix.transpose() Modified: trunk/scipy/sparse/block.py =================================================================== --- trunk/scipy/sparse/block.py 2007-12-24 10:38:50 UTC (rev 3714) +++ trunk/scipy/sparse/block.py 2007-12-24 19:28:43 UTC (rev 3715) @@ -16,13 +16,6 @@ def __init__(self, arg1, shape=None, dtype=None, copy=False, blocksize=None): _data_matrix.__init__(self) - #process blocksize - if blocksize is None: - blocksize = (1,1) - else: - if not isshape(blocksize): - raise ValueError,'invalid blocksize=%s',blocksize - blocksize = tuple(blocksize) if isspmatrix(arg1): if arg1.format == self.format and copy: @@ -36,6 +29,13 @@ #it's a tuple of matrix dimensions (M,N) self.shape = arg1 M,N = self.shape + #process blocksize + if blocksize is None: + blocksize = (1,1) + else: + if not isshape(blocksize): + raise ValueError,'invalid blocksize=%s',blocksize + blocksize = tuple(blocksize) self.data = zeros( (0,) + blocksize, getdtype(dtype, default=float) ) self.indices = zeros( 0, dtype=intc ) Modified: trunk/scipy/sparse/bsr.py =================================================================== --- trunk/scipy/sparse/bsr.py 2007-12-24 10:38:50 UTC (rev 3714) +++ trunk/scipy/sparse/bsr.py 2007-12-24 19:28:43 UTC (rev 3715) @@ -123,7 +123,8 @@ proxy = csr_matrix((data,self.indices,self.indptr),shape=(M/X,N/Y)) proxy = proxy.tocsc() - data = self.data[proxy.data] #permute data + data = self.data.swapaxes(1,2)[proxy.data] #permute data + indices = proxy.indices indptr = proxy.indptr Modified: trunk/scipy/sparse/sparsetools/sparsetools.h =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.h 2007-12-24 10:38:50 UTC (rev 3714) +++ trunk/scipy/sparse/sparsetools/sparsetools.h 2007-12-24 19:28:43 UTC (rev 3715) @@ -450,12 +450,13 @@ //T zeros[8*8]; Cp->resize(n_brow + 1, 0); (*Cp)[0] = 0; + I nnz = 0; for(I i = 0; i < n_brow; i++){ - I A_pos = RC*Ap[i]; - I B_pos = RC*Bp[i]; - I A_end = RC*Ap[i+1]; - I B_end = RC*Bp[i+1]; + I A_pos = Ap[i]; + I B_pos = Bp[i]; + I A_end = Ap[i+1]; + I B_end = Bp[i+1]; I A_j = Aj[A_pos]; I B_j = Bj[B_pos]; @@ -464,7 +465,7 @@ while(A_pos < A_end && B_pos < B_end){ if(A_j == B_j){ for(I n = 0; n < RC; n++){ - result[n] = op(Ax[A_pos + n],Bx[B_pos + n]); + result[n] = op(Ax[RC*A_pos + n],Bx[RC*B_pos + n]); } //vec_binop(Ax[RC*A_pos],Bx[RC*B_pos],result,op); @@ -473,6 +474,7 @@ for(I n = 0; n < RC; n++){ Cx->push_back(result[n]); } + nnz++; } A_j = Aj[++A_pos]; @@ -480,7 +482,7 @@ } else if (A_j < B_j) { for(I n = 0; n < RC; n++){ - result[n] = op(Ax[A_pos + n],0); + result[n] = op(Ax[RC*A_pos + n],0); } if(is_nonzero_block(result,RC)){ @@ -488,32 +490,29 @@ for(I n = 0; n < RC; n++){ Cx->push_back(result[n]); } + nnz++; } - A_j = Aj[++A_pos]; - } else { //B_j < A_j for(I n = 0; n < RC; n++){ - result[n] = op(0,Bx[B_pos + n]); + result[n] = op(0,Bx[RC*B_pos + n]); } - if(is_nonzero_block(result,RC)){ Cj->push_back(B_j); for(I n = 0; n < RC; n++){ Cx->push_back(result[n]); } + nnz++; } - B_j = Bj[++B_pos]; - } } //tail while(A_pos < A_end){ for(I n = 0; n < RC; n++){ - result[n] = op(Ax[A_pos + n],0); + result[n] = op(Ax[RC*A_pos + n],0); } if(is_nonzero_block(result,RC)){ @@ -521,25 +520,24 @@ for(I n = 0; n < RC; n++){ Cx->push_back(result[n]); } + nnz++; } - A_j = Aj[++A_pos]; } while(B_pos < B_end){ for(I n = 0; n < RC; n++){ - result[n] = op(0,Bx[B_pos + n]); + result[n] = op(0,Bx[RC*B_pos + n]); } - if(is_nonzero_block(result,RC)){ Cj->push_back(B_j); for(I n = 0; n < RC; n++){ Cx->push_back(result[n]); } + nnz++; } - B_j = Bj[++B_pos]; } - (*Cp)[i+1] = Cx->size(); + (*Cp)[i+1] = nnz; } } Modified: trunk/scipy/sparse/tests/test_base.py =================================================================== --- trunk/scipy/sparse/tests/test_base.py 2007-12-24 10:38:50 UTC (rev 3714) +++ trunk/scipy/sparse/tests/test_base.py 2007-12-24 19:28:43 UTC (rev 3715) @@ -22,7 +22,7 @@ set_package_path() from scipy.sparse import csc_matrix, csr_matrix, dok_matrix, \ coo_matrix, lil_matrix, dia_matrix, bsr_matrix, \ - extract_diagonal, speye + extract_diagonal, speye, spkron from scipy.linsolve import splu restore_path() @@ -303,15 +303,18 @@ assert_equal( result, dot(a,b) ) def check_conversions(self): + A = spkron([[1,0,1],[0,1,1],[1,0,0]], [[1,1],[0,1]] ) + D = A.todense() + A = self.spmatrix(A) for format in ['bsr','coo','csc','csr','dia','dok','lil']: - a = self.datsp.asformat(format) + a = A.asformat(format) assert_equal(a.format,format) - assert_array_almost_equal(a.todense(), self.dat) + assert_array_almost_equal(a.todense(), D) - b = self.spmatrix(self.dat+3j).asformat(format) + b = self.spmatrix(D+3j).asformat(format) assert_equal(b.format,format) - assert_array_almost_equal(b.todense(), self.dat+3j) + assert_array_almost_equal(b.todense(), D+3j) def check_todia(self): @@ -336,7 +339,6 @@ b = self.dat.transpose() assert_array_equal(a.todense(), b) assert_array_equal(a.transpose().todense(), self.dat) - assert_array_equal(a.transpose().todense(), self.datsp.todense()) def check_large(self): # Create a 100x100 matrix with 100 non-zero elements @@ -649,15 +651,18 @@ """ def arith_init(self): #these can be represented exactly in FP (so arithmetic should be exact) - self.A = matrix([[ -1.5, 0, 0, 2.25], - [ 3.125, 0, -0.125, 0], - [ 0, -5.375, 0, 0]],'float64') - self.B = matrix([[ 0.375, 0, -5, 2.5], - [ 0, 7.25, 0, -4.875], - [ 0, -0.0625, 0, 0]],'complex128') - self.B.imag = matrix([[ 1.25, 0, 0, -3.875], - [ 0, 4.125, 0, 2.75], - [ -0.0625, 0, 0, 1]],'float64') + self.A = matrix([[ -1.5, 6.5, 0, 2.25, 0, 0], + [ 3.125, -7.875, 0.625, 0, 0, 0], + [ 0, 0, -0.125, 1.0, 0, 0], + [ 0, 0, 8.375, 0, 0, 0]],'float64') + self.B = matrix([[ 0.375, 0, 0, 0, -5, 2.5], + [ 14.25, -3.75, 0, 0, -0.125, 0], + [ 0, 7.25, 0, 0, 0, 0], + [ 18.5, -0.0625, 0, 0, 0, 0]],'complex128') + self.B.imag = matrix([[ 1.25, 0, 0, 0, 6, -3.875], + [ 2.25, 4.125, 0, 0, 0, 2.75], + [ 0, 4.125, 0, 0, 0, 0], + [ -0.0625, 0, 0, 0, 0, 0]],'float64') #fractions are all x/16ths assert_array_equal((self.A*16).astype('int32'),16*self.A) @@ -724,7 +729,7 @@ self.arith_init() #basic tests - assert_array_equal(self.A*self.B.T,(self.Asp*self.Bsp.T).todense()) + assert_array_equal((self.Asp*self.Bsp.T).todense(),self.A*self.B.T) for x in self.dtypes: for y in self.dtypes: From scipy-svn at scipy.org Mon Dec 24 23:34:31 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 Dec 2007 22:34:31 -0600 (CST) Subject: [Scipy-svn] r3716 - in trunk/scipy/sparse: . sparsetools Message-ID: <20071225043431.72CB439C13F@new.scipy.org> Author: wnbell Date: 2007-12-24 22:34:09 -0600 (Mon, 24 Dec 2007) New Revision: 3716 Modified: trunk/scipy/sparse/block.py trunk/scipy/sparse/compressed.py trunk/scipy/sparse/sparsetools/sparsetools.h trunk/scipy/sparse/sparsetools/sparsetools.py trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx Log: bsr arithmetic to use preallocate memory Modified: trunk/scipy/sparse/block.py =================================================================== --- trunk/scipy/sparse/block.py 2007-12-24 19:28:43 UTC (rev 3715) +++ trunk/scipy/sparse/block.py 2007-12-25 04:34:09 UTC (rev 3716) @@ -3,11 +3,12 @@ from warnings import warn from numpy import zeros, intc, array, asarray, arange, diff, tile, rank, \ - prod, ravel + prod, ravel, empty, empty_like from data import _data_matrix from base import isspmatrix, _formats -from sputils import isshape, getdtype, to_native, isscalarlike, isdense +from sputils import isshape, getdtype, to_native, isscalarlike, isdense, \ + upcast import sparsetools #TODO refactor w/ compressed.py @@ -148,6 +149,7 @@ #check format validity (more expensive) if self.nnz > 0: if self.indices.max() >= minor_dim/minor_blk: + print "max index",self.indices.max() raise ValueError, "%s index values must be < %d" % \ (minor_name,minor_dim) if self.indices.min() < 0: @@ -343,6 +345,9 @@ X,Y = self.blocksize M,N = self.shape + if self.nnz == 0: + return + #use CSR.sort_indices to determine a permutation for BSR<->BSC major,minor = self._swap((M/X,N/Y)) @@ -366,9 +371,11 @@ if self.data.size < self.nnz: raise ValueError, "data array has too few elements" - self.data = self.data[:self.nnz] - self.indices = self.indices[:self.nnz] + nnz = self.indptr[-1] + self.data = self.data[:nnz] + self.indices = self.indices[:nnz] + # utility functions def _binopt(self, other, op, in_shape=None, out_shape=None): """apply the binary operation fn to two sparse matrices""" @@ -378,17 +385,37 @@ in_shape = self.shape if out_shape is None: out_shape = self.shape + + self.sort_indices() + other.sort_indices() - # e.g. csr_plus_csr, cscmucsc, etc. + # e.g. bsr_plus_bsr, etc. fn = getattr(sparsetools, self.format + op + self.format) + + R,C = self.blocksize - R,C = self.blocksize - indptr, ind, data = fn(in_shape[0]/R, in_shape[1]/C, R, C, \ - self.indptr, self.indices, ravel(self.data), - other.indptr, other.indices, ravel(other.data)) + max_bnnz = len(self.data) + len(other.data) + indptr = empty_like(self.indptr) + indices = empty( max_bnnz, dtype=intc ) + data = empty( R*C*max_bnnz, dtype=upcast(self.dtype,other.dtype) ) + + fn(in_shape[0]/R, in_shape[1]/C, R, C, \ + self.indptr, self.indices, ravel(self.data), + other.indptr, other.indices, ravel(other.data), + indptr, indices, data) + + actual_bnnz = indptr[-1] + indices = indices[:actual_bnnz] + data = data[:R*C*actual_bnnz] + + if actual_bnnz < max_bnnz/2: + indices = indices.copy() + data = data.copy() + data = data.reshape(-1,R,C) - return self.__class__((data, ind, indptr), shape=out_shape) + return self.__class__((data, indices, indptr), shape=out_shape) + # needed by _data_matrix def _with_data(self,data,copy=True): """Returns a matrix with the same sparsity structure as self, Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-24 19:28:43 UTC (rev 3715) +++ trunk/scipy/sparse/compressed.py 2007-12-25 04:34:09 UTC (rev 3716) @@ -540,11 +540,10 @@ if out_shape is None: out_shape = self.shape - #only necessary for sorted binopt method self.sort_indices() other.sort_indices() - # e.g. csr_plus_csr, cscmucsc, etc. + # e.g. csr_plus_csr, csr_mat_mat, etc. fn = getattr(sparsetools, self.format + op + self.format) maxnnz = self.nnz + other.nnz @@ -553,15 +552,18 @@ data = empty( maxnnz, dtype=upcast(self.dtype,other.dtype) ) fn(in_shape[0], in_shape[1], \ - self.indptr, self.indices, self.data, + self.indptr, self.indices, self.data, other.indptr, other.indices, other.data, indptr, indices, data) actual_nnz = indptr[-1] + indices = indices[:actual_nnz] + data = data[:actual_nnz] if actual_nnz < maxnnz / 2: #too much waste, trim arrays - indices = indices[:actual_nnz].copy() - data = data[:actual_nnz].copy() + indices = indices.copy() + data = data.copy() + return self.__class__((data, indices, indptr), shape=out_shape) def _get_submatrix( self, shape0, shape1, slice0, slice1 ): Modified: trunk/scipy/sparse/sparsetools/sparsetools.h =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.h 2007-12-24 19:28:43 UTC (rev 3715) +++ trunk/scipy/sparse/sparsetools/sparsetools.h 2007-12-25 04:34:09 UTC (rev 3716) @@ -436,9 +436,7 @@ const I R, const I C, const I Ap[], const I Aj[], const T Ax[], const I Bp[], const I Bj[], const T Bx[], - std::vector* Cp, - std::vector* Cj, - std::vector* Cx, + I Cp[], I Cj[], T Cx[], const bin_op& op) { //Method that works for unsorted indices @@ -448,8 +446,7 @@ const I RC = R*C; T result[8*8]; //T zeros[8*8]; - Cp->resize(n_brow + 1, 0); - (*Cp)[0] = 0; + Cp[0] = 0; I nnz = 0; for(I i = 0; i < n_brow; i++){ @@ -467,12 +464,11 @@ for(I n = 0; n < RC; n++){ result[n] = op(Ax[RC*A_pos + n],Bx[RC*B_pos + n]); } - //vec_binop(Ax[RC*A_pos],Bx[RC*B_pos],result,op); if( is_nonzero_block(result,RC) ){ - Cj->push_back(A_j); + Cj[nnz] = A_j; for(I n = 0; n < RC; n++){ - Cx->push_back(result[n]); + Cx[RC*nnz + n] = result[n]; } nnz++; } @@ -486,26 +482,30 @@ } if(is_nonzero_block(result,RC)){ - Cj->push_back(A_j); + Cj[nnz] = A_j; for(I n = 0; n < RC; n++){ - Cx->push_back(result[n]); + Cx[RC*nnz + n] = result[n]; } nnz++; } + A_j = Aj[++A_pos]; + } else { //B_j < A_j for(I n = 0; n < RC; n++){ result[n] = op(0,Bx[RC*B_pos + n]); } if(is_nonzero_block(result,RC)){ - Cj->push_back(B_j); + Cj[nnz] = B_j; for(I n = 0; n < RC; n++){ - Cx->push_back(result[n]); + Cx[RC*nnz + n] = result[n]; } nnz++; } + B_j = Bj[++B_pos]; + } } @@ -516,46 +516,51 @@ } if(is_nonzero_block(result,RC)){ - Cj->push_back(A_j); + Cj[nnz] = A_j; for(I n = 0; n < RC; n++){ - Cx->push_back(result[n]); + Cx[RC*nnz + n] = result[n]; } nnz++; } + A_j = Aj[++A_pos]; + } while(B_pos < B_end){ for(I n = 0; n < RC; n++){ result[n] = op(0,Bx[RC*B_pos + n]); } if(is_nonzero_block(result,RC)){ - Cj->push_back(B_j); + Cj[nnz] = B_j; for(I n = 0; n < RC; n++){ - Cx->push_back(result[n]); + Cx[RC*nnz + n] = result[n]; } nnz++; } + B_j = Bj[++B_pos]; + } - (*Cp)[i+1] = nnz; + + Cp[i+1] = nnz; } } /* element-wise binary operations*/ template void bsr_elmul_bsr(const I n_row, const I n_col, const I R, const I C, - const I Ap [], const I Aj [], const T Ax [], - const I Bp [], const I Bj [], const T Bx [], - std::vector* Cp, std::vector* Cj, std::vector* Cx) + const I Ap[], const I Aj[], const T Ax[], + const I Bp[], const I Bj[], const T Bx[], + I Cp[], I Cj[], T Cx[]) { bsr_binop_bsr(n_row,n_col,R,C,Ap,Aj,Ax,Bp,Bj,Bx,Cp,Cj,Cx,std::multiplies()); } template void bsr_eldiv_bsr(const I n_row, const I n_col, const I R, const I C, - const I Ap [], const I Aj [], const T Ax [], - const I Bp [], const I Bj [], const T Bx [], - std::vector* Cp, std::vector* Cj, std::vector* Cx) + const I Ap[], const I Aj[], const T Ax[], + const I Bp[], const I Bj[], const T Bx[], + I Cp[], I Cj[], T Cx[]) { bsr_binop_bsr(n_row,n_col,R,C,Ap,Aj,Ax,Bp,Bj,Bx,Cp,Cj,Cx,std::divides()); } @@ -563,18 +568,18 @@ template void bsr_plus_bsr(const I n_row, const I n_col, const I R, const I C, - const I Ap [], const I Aj [], const T Ax [], - const I Bp [], const I Bj [], const T Bx [], - std::vector* Cp, std::vector* Cj, std::vector* Cx) + const I Ap[], const I Aj[], const T Ax[], + const I Bp[], const I Bj[], const T Bx[], + I Cp[], I Cj[], T Cx[]) { bsr_binop_bsr(n_row,n_col,R,C,Ap,Aj,Ax,Bp,Bj,Bx,Cp,Cj,Cx,std::plus()); } template void bsr_minus_bsr(const I n_row, const I n_col, const I R, const I C, - const I Ap [], const I Aj [], const T Ax [], - const I Bp [], const I Bj [], const T Bx [], - std::vector* Cp, std::vector* Cj, std::vector* Cx) + const I Ap[], const I Aj[], const T Ax[], + const I Bp[], const I Bj[], const T Bx[], + I Cp[], I Cj[], T Cx[]) { bsr_binop_bsr(n_row,n_col,R,C,Ap,Aj,Ax,Bp,Bj,Bx,Cp,Cj,Cx,std::minus()); } Modified: trunk/scipy/sparse/sparsetools/sparsetools.py =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.py 2007-12-24 19:28:43 UTC (rev 3715) +++ trunk/scipy/sparse/sparsetools/sparsetools.py 2007-12-25 04:34:09 UTC (rev 3716) @@ -561,36 +561,31 @@ """ bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, signed char Ax, int Bp, int Bj, signed char Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(signed char)> Cx) + int Cp, int Cj, signed char Cx) bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, unsigned char Ax, int Bp, int Bj, unsigned char Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(unsigned char)> Cx) + int Cp, int Cj, unsigned char Cx) bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - short Ax, int Bp, int Bj, short Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(short)> Cx) + short Ax, int Bp, int Bj, short Bx, int Cp, + int Cj, short Cx) bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - int Ax, int Bp, int Bj, int Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(int)> Cx) + int Ax, int Bp, int Bj, int Bx, int Cp, int Cj, + int Cx) bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, long long Ax, int Bp, int Bj, long long Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(long long)> Cx) + int Cp, int Cj, long long Cx) bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - float Ax, int Bp, int Bj, float Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(float)> Cx) + float Ax, int Bp, int Bj, float Bx, int Cp, + int Cj, float Cx) bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - double Ax, int Bp, int Bj, double Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(double)> Cx) + double Ax, int Bp, int Bj, double Bx, int Cp, + int Cj, double Cx) bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(npy_cfloat_wrapper)> Cx) + int Cp, int Cj, npy_cfloat_wrapper Cx) bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(npy_cdouble_wrapper)> Cx) + int Cp, int Cj, npy_cdouble_wrapper Cx) """ return _sparsetools.bsr_elmul_bsr(*args) @@ -598,36 +593,31 @@ """ bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, signed char Ax, int Bp, int Bj, signed char Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(signed char)> Cx) + int Cp, int Cj, signed char Cx) bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, unsigned char Ax, int Bp, int Bj, unsigned char Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(unsigned char)> Cx) + int Cp, int Cj, unsigned char Cx) bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - short Ax, int Bp, int Bj, short Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(short)> Cx) + short Ax, int Bp, int Bj, short Bx, int Cp, + int Cj, short Cx) bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - int Ax, int Bp, int Bj, int Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(int)> Cx) + int Ax, int Bp, int Bj, int Bx, int Cp, int Cj, + int Cx) bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, long long Ax, int Bp, int Bj, long long Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(long long)> Cx) + int Cp, int Cj, long long Cx) bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - float Ax, int Bp, int Bj, float Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(float)> Cx) + float Ax, int Bp, int Bj, float Bx, int Cp, + int Cj, float Cx) bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - double Ax, int Bp, int Bj, double Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(double)> Cx) + double Ax, int Bp, int Bj, double Bx, int Cp, + int Cj, double Cx) bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(npy_cfloat_wrapper)> Cx) + int Cp, int Cj, npy_cfloat_wrapper Cx) bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(npy_cdouble_wrapper)> Cx) + int Cp, int Cj, npy_cdouble_wrapper Cx) """ return _sparsetools.bsr_eldiv_bsr(*args) @@ -635,36 +625,31 @@ """ bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, signed char Ax, int Bp, int Bj, signed char Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(signed char)> Cx) + int Cp, int Cj, signed char Cx) bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, unsigned char Ax, int Bp, int Bj, unsigned char Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(unsigned char)> Cx) + int Cp, int Cj, unsigned char Cx) bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - short Ax, int Bp, int Bj, short Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(short)> Cx) + short Ax, int Bp, int Bj, short Bx, int Cp, + int Cj, short Cx) bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - int Ax, int Bp, int Bj, int Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(int)> Cx) + int Ax, int Bp, int Bj, int Bx, int Cp, int Cj, + int Cx) bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, long long Ax, int Bp, int Bj, long long Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(long long)> Cx) + int Cp, int Cj, long long Cx) bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - float Ax, int Bp, int Bj, float Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(float)> Cx) + float Ax, int Bp, int Bj, float Bx, int Cp, + int Cj, float Cx) bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - double Ax, int Bp, int Bj, double Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(double)> Cx) + double Ax, int Bp, int Bj, double Bx, int Cp, + int Cj, double Cx) bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(npy_cfloat_wrapper)> Cx) + int Cp, int Cj, npy_cfloat_wrapper Cx) bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(npy_cdouble_wrapper)> Cx) + int Cp, int Cj, npy_cdouble_wrapper Cx) """ return _sparsetools.bsr_plus_bsr(*args) @@ -672,36 +657,31 @@ """ bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, signed char Ax, int Bp, int Bj, signed char Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(signed char)> Cx) + int Cp, int Cj, signed char Cx) bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, unsigned char Ax, int Bp, int Bj, unsigned char Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(unsigned char)> Cx) + int Cp, int Cj, unsigned char Cx) bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - short Ax, int Bp, int Bj, short Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(short)> Cx) + short Ax, int Bp, int Bj, short Bx, int Cp, + int Cj, short Cx) bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - int Ax, int Bp, int Bj, int Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(int)> Cx) + int Ax, int Bp, int Bj, int Bx, int Cp, int Cj, + int Cx) bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, long long Ax, int Bp, int Bj, long long Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(long long)> Cx) + int Cp, int Cj, long long Cx) bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - float Ax, int Bp, int Bj, float Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(float)> Cx) + float Ax, int Bp, int Bj, float Bx, int Cp, + int Cj, float Cx) bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - double Ax, int Bp, int Bj, double Bx, std::vector<(int)> Cp, - std::vector<(int)> Cj, std::vector<(double)> Cx) + double Ax, int Bp, int Bj, double Bx, int Cp, + int Cj, double Cx) bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(npy_cfloat_wrapper)> Cx) + int Cp, int Cj, npy_cfloat_wrapper Cx) bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, - std::vector<(int)> Cp, std::vector<(int)> Cj, - std::vector<(npy_cdouble_wrapper)> Cx) + int Cp, int Cj, npy_cdouble_wrapper Cx) """ return _sparsetools.bsr_minus_bsr(*args) Modified: trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx 2007-12-24 19:28:43 UTC (rev 3715) +++ trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx 2007-12-25 04:34:09 UTC (rev 3716) @@ -37961,9 +37961,9 @@ int *arg8 ; int *arg9 ; signed char *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + signed char *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -37984,9 +37984,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -37997,20 +37997,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_elmul_bsr" "', argument " "1"" of type '" "int""'"); @@ -38091,29 +38082,23 @@ arg10 = (signed char*) array10->data; } - bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(signed char const (*))arg7,(int const (*))arg8,(int const (*))arg9,(signed char const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(signed char)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_BYTE); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (signed char*) array_data(temp13); } + bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(signed char const (*))arg7,(int const (*))arg8,(int const (*))arg9,(signed char const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -38168,9 +38153,9 @@ int *arg8 ; int *arg9 ; unsigned char *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + unsigned char *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -38191,9 +38176,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -38204,20 +38189,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_elmul_bsr" "', argument " "1"" of type '" "int""'"); @@ -38298,29 +38274,23 @@ arg10 = (unsigned char*) array10->data; } - bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(unsigned char const (*))arg7,(int const (*))arg8,(int const (*))arg9,(unsigned char const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(unsigned char)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_UBYTE); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (unsigned char*) array_data(temp13); } + bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(unsigned char const (*))arg7,(int const (*))arg8,(int const (*))arg9,(unsigned char const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -38375,9 +38345,9 @@ int *arg8 ; int *arg9 ; short *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + short *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -38398,9 +38368,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -38411,20 +38381,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_elmul_bsr" "', argument " "1"" of type '" "int""'"); @@ -38505,29 +38466,23 @@ arg10 = (short*) array10->data; } - bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(short const (*))arg7,(int const (*))arg8,(int const (*))arg9,(short const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(short)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_SHORT); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (short*) array_data(temp13); } + bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(short const (*))arg7,(int const (*))arg8,(int const (*))arg9,(short const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -38582,9 +38537,9 @@ int *arg8 ; int *arg9 ; int *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + int *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -38605,9 +38560,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -38618,20 +38573,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_elmul_bsr" "', argument " "1"" of type '" "int""'"); @@ -38712,29 +38658,23 @@ arg10 = (int*) array10->data; } - bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,(int const (*))arg9,(int const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(int)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_INT); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (int*) array_data(temp13); } + bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,(int const (*))arg9,(int const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -38789,9 +38729,9 @@ int *arg8 ; int *arg9 ; long long *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + long long *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -38812,9 +38752,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -38825,20 +38765,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_elmul_bsr" "', argument " "1"" of type '" "int""'"); @@ -38919,29 +38850,23 @@ arg10 = (long long*) array10->data; } - bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(long long const (*))arg7,(int const (*))arg8,(int const (*))arg9,(long long const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(long long)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_LONGLONG); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (long long*) array_data(temp13); } + bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(long long const (*))arg7,(int const (*))arg8,(int const (*))arg9,(long long const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -38996,9 +38921,9 @@ int *arg8 ; int *arg9 ; float *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + float *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -39019,9 +38944,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -39032,20 +38957,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_elmul_bsr" "', argument " "1"" of type '" "int""'"); @@ -39126,29 +39042,23 @@ arg10 = (float*) array10->data; } - bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(float const (*))arg7,(int const (*))arg8,(int const (*))arg9,(float const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(float)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_FLOAT); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (float*) array_data(temp13); } + bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(float const (*))arg7,(int const (*))arg8,(int const (*))arg9,(float const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -39203,9 +39113,9 @@ int *arg8 ; int *arg9 ; double *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + double *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -39226,9 +39136,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -39239,20 +39149,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_elmul_bsr" "', argument " "1"" of type '" "int""'"); @@ -39333,29 +39234,23 @@ arg10 = (double*) array10->data; } - bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(double const (*))arg7,(int const (*))arg8,(int const (*))arg9,(double const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(double)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_DOUBLE); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (double*) array_data(temp13); } + bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(double const (*))arg7,(int const (*))arg8,(int const (*))arg9,(double const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -39410,9 +39305,9 @@ int *arg8 ; int *arg9 ; npy_cfloat_wrapper *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + npy_cfloat_wrapper *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -39433,9 +39328,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -39446,20 +39341,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_elmul_bsr" "', argument " "1"" of type '" "int""'"); @@ -39540,29 +39426,23 @@ arg10 = (npy_cfloat_wrapper*) array10->data; } - bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(npy_cfloat_wrapper const (*))arg7,(int const (*))arg8,(int const (*))arg9,(npy_cfloat_wrapper const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(npy_cfloat_wrapper)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_CFLOAT); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (npy_cfloat_wrapper*) array_data(temp13); } + bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(npy_cfloat_wrapper const (*))arg7,(int const (*))arg8,(int const (*))arg9,(npy_cfloat_wrapper const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -39617,9 +39497,9 @@ int *arg8 ; int *arg9 ; npy_cdouble_wrapper *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + npy_cdouble_wrapper *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -39640,9 +39520,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -39653,20 +39533,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_elmul_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_elmul_bsr" "', argument " "1"" of type '" "int""'"); @@ -39747,29 +39618,23 @@ arg10 = (npy_cdouble_wrapper*) array10->data; } - bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(npy_cdouble_wrapper const (*))arg7,(int const (*))arg8,(int const (*))arg9,(npy_cdouble_wrapper const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(npy_cdouble_wrapper)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_CDOUBLE); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (npy_cdouble_wrapper*) array_data(temp13); } + bsr_elmul_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(npy_cdouble_wrapper const (*))arg7,(int const (*))arg8,(int const (*))arg9,(npy_cdouble_wrapper const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -39814,15 +39679,15 @@ SWIGINTERN PyObject *_wrap_bsr_elmul_bsr(PyObject *self, PyObject *args) { int argc; - PyObject *argv[11]; + PyObject *argv[14]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 10); ii++) { + for (ii = 0; (ii < argc) && (ii < 13); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -39868,7 +39733,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_bsr_elmul_bsr__SWIG_1(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_elmul_bsr__SWIG_1(self, args); + } + } + } } } } @@ -39880,7 +39760,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -39926,7 +39806,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_bsr_elmul_bsr__SWIG_2(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_elmul_bsr__SWIG_2(self, args); + } + } + } } } } @@ -39938,7 +39833,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -39984,7 +39879,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_bsr_elmul_bsr__SWIG_3(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_elmul_bsr__SWIG_3(self, args); + } + } + } } } } @@ -39996,7 +39906,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -40042,7 +39952,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_bsr_elmul_bsr__SWIG_4(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_elmul_bsr__SWIG_4(self, args); + } + } + } } } } @@ -40054,7 +39979,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -40100,7 +40025,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_bsr_elmul_bsr__SWIG_5(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_elmul_bsr__SWIG_5(self, args); + } + } + } } } } @@ -40112,7 +40052,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -40158,7 +40098,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_bsr_elmul_bsr__SWIG_6(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_elmul_bsr__SWIG_6(self, args); + } + } + } } } } @@ -40170,7 +40125,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -40216,7 +40171,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_bsr_elmul_bsr__SWIG_7(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_elmul_bsr__SWIG_7(self, args); + } + } + } } } } @@ -40228,7 +40198,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -40274,7 +40244,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_bsr_elmul_bsr__SWIG_8(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_elmul_bsr__SWIG_8(self, args); + } + } + } } } } @@ -40286,7 +40271,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -40332,7 +40317,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_bsr_elmul_bsr__SWIG_9(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_elmul_bsr__SWIG_9(self, args); + } + } + } } } } @@ -40346,7 +40346,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_elmul_bsr'.\n Possible C/C++ prototypes are:\n"" bsr_elmul_bsr<(int,signed char)>(int const,int const,int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],std::vector *,std::vector *,std::vector *)\n"" bsr_elmul_bsr<(int,unsigned char)>(int const,int const,int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],std::vector *,std::vector *,std::vector *)\n"" bsr_elmul_bsr<(int,short)>(int const,int const,int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],std::vector *,std::vector *,std::vector *)\n"" bsr_elmul_bsr<(int,int)>(int const,int const,int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],std::vector *,std::vector *,std::vector *)\n"" bsr_elmul_bsr<(int,long long)>(int const,int const,int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],std::vector *,std::vector *,std::vector *)\n"" bsr_elmul_bsr<(int,float)>(int const,int const,int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" bsr_elmul_bsr<(int,double)>(int const,int const,int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"" bsr_elmul_bsr<(int,npy_cfloat_wrapper)>(int const,int const,int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],std::vector *,std::vector *,std::vector *)\n"" bsr_elmul_bsr<(int,npy_cdouble_wrapper)>(int const,int const,int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],std::vector *,std::vector *,std::vector *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_elmul_bsr'.\n Possible C/C++ prototypes are:\n"" bsr_elmul_bsr<(int,signed char)>(int const,int const,int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],int [],int [],signed char [])\n"" bsr_elmul_bsr<(int,unsigned char)>(int const,int const,int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" bsr_elmul_bsr<(int,short)>(int const,int const,int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],int [],int [],short [])\n"" bsr_elmul_bsr<(int,int)>(int const,int const,int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],int [],int [],int [])\n"" bsr_elmul_bsr<(int,long long)>(int const,int const,int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],int [],int [],long long [])\n"" bsr_elmul_bsr<(int,float)>(int const,int const,int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],int [],int [],float [])\n"" bsr_elmul_bsr<(int,double)>(int const,int const,int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],int [],int [],double [])\n"" bsr_elmul_bsr<(int,npy_cfloat_wrapper)>(int const,int const,int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" bsr_elmul_bsr<(int,npy_cdouble_wrapper)>(int const,int const,int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); return NULL; } @@ -40363,9 +40363,9 @@ int *arg8 ; int *arg9 ; signed char *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + signed char *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -40386,9 +40386,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -40399,20 +40399,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_eldiv_bsr" "', argument " "1"" of type '" "int""'"); @@ -40493,29 +40484,23 @@ arg10 = (signed char*) array10->data; } - bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(signed char const (*))arg7,(int const (*))arg8,(int const (*))arg9,(signed char const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(signed char)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_BYTE); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (signed char*) array_data(temp13); } + bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(signed char const (*))arg7,(int const (*))arg8,(int const (*))arg9,(signed char const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -40570,9 +40555,9 @@ int *arg8 ; int *arg9 ; unsigned char *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + unsigned char *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -40593,9 +40578,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -40606,20 +40591,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_eldiv_bsr" "', argument " "1"" of type '" "int""'"); @@ -40700,29 +40676,23 @@ arg10 = (unsigned char*) array10->data; } - bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(unsigned char const (*))arg7,(int const (*))arg8,(int const (*))arg9,(unsigned char const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(unsigned char)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_UBYTE); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (unsigned char*) array_data(temp13); } + bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(unsigned char const (*))arg7,(int const (*))arg8,(int const (*))arg9,(unsigned char const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -40777,9 +40747,9 @@ int *arg8 ; int *arg9 ; short *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + short *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -40800,9 +40770,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -40813,20 +40783,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_eldiv_bsr" "', argument " "1"" of type '" "int""'"); @@ -40907,29 +40868,23 @@ arg10 = (short*) array10->data; } - bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(short const (*))arg7,(int const (*))arg8,(int const (*))arg9,(short const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(short)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_SHORT); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (short*) array_data(temp13); } + bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(short const (*))arg7,(int const (*))arg8,(int const (*))arg9,(short const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -40984,9 +40939,9 @@ int *arg8 ; int *arg9 ; int *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + int *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -41007,9 +40962,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -41020,20 +40975,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_eldiv_bsr" "', argument " "1"" of type '" "int""'"); @@ -41114,29 +41060,23 @@ arg10 = (int*) array10->data; } - bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,(int const (*))arg9,(int const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(int)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_INT); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (int*) array_data(temp13); } + bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,(int const (*))arg9,(int const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -41191,9 +41131,9 @@ int *arg8 ; int *arg9 ; long long *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + long long *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -41214,9 +41154,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -41227,20 +41167,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_eldiv_bsr" "', argument " "1"" of type '" "int""'"); @@ -41321,29 +41252,23 @@ arg10 = (long long*) array10->data; } - bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(long long const (*))arg7,(int const (*))arg8,(int const (*))arg9,(long long const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(long long)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_LONGLONG); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (long long*) array_data(temp13); } + bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(long long const (*))arg7,(int const (*))arg8,(int const (*))arg9,(long long const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -41398,9 +41323,9 @@ int *arg8 ; int *arg9 ; float *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + float *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -41421,9 +41346,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -41434,20 +41359,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_eldiv_bsr" "', argument " "1"" of type '" "int""'"); @@ -41528,29 +41444,23 @@ arg10 = (float*) array10->data; } - bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(float const (*))arg7,(int const (*))arg8,(int const (*))arg9,(float const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(float)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_FLOAT); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (float*) array_data(temp13); } + bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(float const (*))arg7,(int const (*))arg8,(int const (*))arg9,(float const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -41605,9 +41515,9 @@ int *arg8 ; int *arg9 ; double *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + double *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -41628,9 +41538,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -41641,20 +41551,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_eldiv_bsr" "', argument " "1"" of type '" "int""'"); @@ -41735,29 +41636,23 @@ arg10 = (double*) array10->data; } - bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(double const (*))arg7,(int const (*))arg8,(int const (*))arg9,(double const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(double)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_DOUBLE); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (double*) array_data(temp13); } + bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(double const (*))arg7,(int const (*))arg8,(int const (*))arg9,(double const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -41812,9 +41707,9 @@ int *arg8 ; int *arg9 ; npy_cfloat_wrapper *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + npy_cfloat_wrapper *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -41835,9 +41730,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -41848,20 +41743,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_eldiv_bsr" "', argument " "1"" of type '" "int""'"); @@ -41942,29 +41828,23 @@ arg10 = (npy_cfloat_wrapper*) array10->data; } - bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(npy_cfloat_wrapper const (*))arg7,(int const (*))arg8,(int const (*))arg9,(npy_cfloat_wrapper const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(npy_cfloat_wrapper)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_CFLOAT); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (npy_cfloat_wrapper*) array_data(temp13); } + bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(npy_cfloat_wrapper const (*))arg7,(int const (*))arg8,(int const (*))arg9,(npy_cfloat_wrapper const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -42019,9 +41899,9 @@ int *arg8 ; int *arg9 ; npy_cdouble_wrapper *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + npy_cdouble_wrapper *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -42042,9 +41922,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -42055,20 +41935,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_eldiv_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_eldiv_bsr" "', argument " "1"" of type '" "int""'"); @@ -42149,29 +42020,23 @@ arg10 = (npy_cdouble_wrapper*) array10->data; } - bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(npy_cdouble_wrapper const (*))arg7,(int const (*))arg8,(int const (*))arg9,(npy_cdouble_wrapper const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(npy_cdouble_wrapper)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_CDOUBLE); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (npy_cdouble_wrapper*) array_data(temp13); } + bsr_eldiv_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(npy_cdouble_wrapper const (*))arg7,(int const (*))arg8,(int const (*))arg9,(npy_cdouble_wrapper const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -42216,15 +42081,15 @@ SWIGINTERN PyObject *_wrap_bsr_eldiv_bsr(PyObject *self, PyObject *args) { int argc; - PyObject *argv[11]; + PyObject *argv[14]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 10); ii++) { + for (ii = 0; (ii < argc) && (ii < 13); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -42270,7 +42135,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_bsr_eldiv_bsr__SWIG_1(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_eldiv_bsr__SWIG_1(self, args); + } + } + } } } } @@ -42282,7 +42162,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -42328,7 +42208,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_bsr_eldiv_bsr__SWIG_2(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_eldiv_bsr__SWIG_2(self, args); + } + } + } } } } @@ -42340,7 +42235,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -42386,7 +42281,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_bsr_eldiv_bsr__SWIG_3(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_eldiv_bsr__SWIG_3(self, args); + } + } + } } } } @@ -42398,7 +42308,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -42444,7 +42354,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_bsr_eldiv_bsr__SWIG_4(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_eldiv_bsr__SWIG_4(self, args); + } + } + } } } } @@ -42456,7 +42381,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -42502,7 +42427,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_bsr_eldiv_bsr__SWIG_5(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_eldiv_bsr__SWIG_5(self, args); + } + } + } } } } @@ -42514,7 +42454,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -42560,7 +42500,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_bsr_eldiv_bsr__SWIG_6(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_eldiv_bsr__SWIG_6(self, args); + } + } + } } } } @@ -42572,7 +42527,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -42618,7 +42573,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_bsr_eldiv_bsr__SWIG_7(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_eldiv_bsr__SWIG_7(self, args); + } + } + } } } } @@ -42630,7 +42600,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -42676,7 +42646,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_bsr_eldiv_bsr__SWIG_8(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_eldiv_bsr__SWIG_8(self, args); + } + } + } } } } @@ -42688,7 +42673,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -42734,7 +42719,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_bsr_eldiv_bsr__SWIG_9(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_eldiv_bsr__SWIG_9(self, args); + } + } + } } } } @@ -42748,7 +42748,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_eldiv_bsr'.\n Possible C/C++ prototypes are:\n"" bsr_eldiv_bsr<(int,signed char)>(int const,int const,int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],std::vector *,std::vector *,std::vector *)\n"" bsr_eldiv_bsr<(int,unsigned char)>(int const,int const,int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],std::vector *,std::vector *,std::vector *)\n"" bsr_eldiv_bsr<(int,short)>(int const,int const,int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],std::vector *,std::vector *,std::vector *)\n"" bsr_eldiv_bsr<(int,int)>(int const,int const,int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],std::vector *,std::vector *,std::vector *)\n"" bsr_eldiv_bsr<(int,long long)>(int const,int const,int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],std::vector *,std::vector *,std::vector *)\n"" bsr_eldiv_bsr<(int,float)>(int const,int const,int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" bsr_eldiv_bsr<(int,double)>(int const,int const,int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"" bsr_eldiv_bsr<(int,npy_cfloat_wrapper)>(int const,int const,int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],std::vector *,std::vector *,std::vector *)\n"" bsr_eldiv_bsr<(int,npy_cdouble_wrapper)>(int const,int const,int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],std::vector *,std::vector *,std::vector *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_eldiv_bsr'.\n Possible C/C++ prototypes are:\n"" bsr_eldiv_bsr<(int,signed char)>(int const,int const,int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],int [],int [],signed char [])\n"" bsr_eldiv_bsr<(int,unsigned char)>(int const,int const,int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" bsr_eldiv_bsr<(int,short)>(int const,int const,int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],int [],int [],short [])\n"" bsr_eldiv_bsr<(int,int)>(int const,int const,int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],int [],int [],int [])\n"" bsr_eldiv_bsr<(int,long long)>(int const,int const,int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],int [],int [],long long [])\n"" bsr_eldiv_bsr<(int,float)>(int const,int const,int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],int [],int [],float [])\n"" bsr_eldiv_bsr<(int,double)>(int const,int const,int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],int [],int [],double [])\n"" bsr_eldiv_bsr<(int,npy_cfloat_wrapper)>(int const,int const,int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" bsr_eldiv_bsr<(int,npy_cdouble_wrapper)>(int const,int const,int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); return NULL; } @@ -42765,9 +42765,9 @@ int *arg8 ; int *arg9 ; signed char *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + signed char *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -42788,9 +42788,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -42801,20 +42801,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_plus_bsr" "', argument " "1"" of type '" "int""'"); @@ -42895,29 +42886,23 @@ arg10 = (signed char*) array10->data; } - bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(signed char const (*))arg7,(int const (*))arg8,(int const (*))arg9,(signed char const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(signed char)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_BYTE); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (signed char*) array_data(temp13); } + bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(signed char const (*))arg7,(int const (*))arg8,(int const (*))arg9,(signed char const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -42972,9 +42957,9 @@ int *arg8 ; int *arg9 ; unsigned char *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + unsigned char *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -42995,9 +42980,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -43008,20 +42993,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_plus_bsr" "', argument " "1"" of type '" "int""'"); @@ -43102,29 +43078,23 @@ arg10 = (unsigned char*) array10->data; } - bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(unsigned char const (*))arg7,(int const (*))arg8,(int const (*))arg9,(unsigned char const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(unsigned char)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_UBYTE); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (unsigned char*) array_data(temp13); } + bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(unsigned char const (*))arg7,(int const (*))arg8,(int const (*))arg9,(unsigned char const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -43179,9 +43149,9 @@ int *arg8 ; int *arg9 ; short *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + short *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -43202,9 +43172,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -43215,20 +43185,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_plus_bsr" "', argument " "1"" of type '" "int""'"); @@ -43309,29 +43270,23 @@ arg10 = (short*) array10->data; } - bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(short const (*))arg7,(int const (*))arg8,(int const (*))arg9,(short const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(short)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_SHORT); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (short*) array_data(temp13); } + bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(short const (*))arg7,(int const (*))arg8,(int const (*))arg9,(short const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -43386,9 +43341,9 @@ int *arg8 ; int *arg9 ; int *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + int *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -43409,9 +43364,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -43422,20 +43377,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_plus_bsr" "', argument " "1"" of type '" "int""'"); @@ -43516,29 +43462,23 @@ arg10 = (int*) array10->data; } - bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,(int const (*))arg9,(int const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(int)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_INT); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (int*) array_data(temp13); } + bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,(int const (*))arg9,(int const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -43593,9 +43533,9 @@ int *arg8 ; int *arg9 ; long long *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + long long *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -43616,9 +43556,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -43629,20 +43569,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_plus_bsr" "', argument " "1"" of type '" "int""'"); @@ -43723,29 +43654,23 @@ arg10 = (long long*) array10->data; } - bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(long long const (*))arg7,(int const (*))arg8,(int const (*))arg9,(long long const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(long long)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_LONGLONG); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (long long*) array_data(temp13); } + bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(long long const (*))arg7,(int const (*))arg8,(int const (*))arg9,(long long const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -43800,9 +43725,9 @@ int *arg8 ; int *arg9 ; float *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + float *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -43823,9 +43748,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -43836,20 +43761,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_plus_bsr" "', argument " "1"" of type '" "int""'"); @@ -43930,29 +43846,23 @@ arg10 = (float*) array10->data; } - bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(float const (*))arg7,(int const (*))arg8,(int const (*))arg9,(float const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(float)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_FLOAT); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (float*) array_data(temp13); } + bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(float const (*))arg7,(int const (*))arg8,(int const (*))arg9,(float const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -44007,9 +43917,9 @@ int *arg8 ; int *arg9 ; double *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + double *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -44030,9 +43940,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -44043,20 +43953,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_plus_bsr" "', argument " "1"" of type '" "int""'"); @@ -44137,29 +44038,23 @@ arg10 = (double*) array10->data; } - bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(double const (*))arg7,(int const (*))arg8,(int const (*))arg9,(double const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(double)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_DOUBLE); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (double*) array_data(temp13); } + bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(double const (*))arg7,(int const (*))arg8,(int const (*))arg9,(double const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -44214,9 +44109,9 @@ int *arg8 ; int *arg9 ; npy_cfloat_wrapper *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + npy_cfloat_wrapper *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -44237,9 +44132,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -44250,20 +44145,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_plus_bsr" "', argument " "1"" of type '" "int""'"); @@ -44344,29 +44230,23 @@ arg10 = (npy_cfloat_wrapper*) array10->data; } - bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(npy_cfloat_wrapper const (*))arg7,(int const (*))arg8,(int const (*))arg9,(npy_cfloat_wrapper const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(npy_cfloat_wrapper)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_CFLOAT); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (npy_cfloat_wrapper*) array_data(temp13); } + bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(npy_cfloat_wrapper const (*))arg7,(int const (*))arg8,(int const (*))arg9,(npy_cfloat_wrapper const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -44421,9 +44301,9 @@ int *arg8 ; int *arg9 ; npy_cdouble_wrapper *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + npy_cdouble_wrapper *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -44444,9 +44324,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -44457,20 +44337,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_plus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_plus_bsr" "', argument " "1"" of type '" "int""'"); @@ -44551,29 +44422,23 @@ arg10 = (npy_cdouble_wrapper*) array10->data; } - bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(npy_cdouble_wrapper const (*))arg7,(int const (*))arg8,(int const (*))arg9,(npy_cdouble_wrapper const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(npy_cdouble_wrapper)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_CDOUBLE); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (npy_cdouble_wrapper*) array_data(temp13); } + bsr_plus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(npy_cdouble_wrapper const (*))arg7,(int const (*))arg8,(int const (*))arg9,(npy_cdouble_wrapper const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -44618,15 +44483,15 @@ SWIGINTERN PyObject *_wrap_bsr_plus_bsr(PyObject *self, PyObject *args) { int argc; - PyObject *argv[11]; + PyObject *argv[14]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 10); ii++) { + for (ii = 0; (ii < argc) && (ii < 13); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -44672,7 +44537,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_bsr_plus_bsr__SWIG_1(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_plus_bsr__SWIG_1(self, args); + } + } + } } } } @@ -44684,7 +44564,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -44730,7 +44610,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_bsr_plus_bsr__SWIG_2(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_plus_bsr__SWIG_2(self, args); + } + } + } } } } @@ -44742,7 +44637,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -44788,7 +44683,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_bsr_plus_bsr__SWIG_3(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_plus_bsr__SWIG_3(self, args); + } + } + } } } } @@ -44800,7 +44710,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -44846,7 +44756,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_bsr_plus_bsr__SWIG_4(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_plus_bsr__SWIG_4(self, args); + } + } + } } } } @@ -44858,7 +44783,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -44904,7 +44829,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_bsr_plus_bsr__SWIG_5(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_plus_bsr__SWIG_5(self, args); + } + } + } } } } @@ -44916,7 +44856,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -44962,7 +44902,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_bsr_plus_bsr__SWIG_6(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_plus_bsr__SWIG_6(self, args); + } + } + } } } } @@ -44974,7 +44929,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -45020,7 +44975,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_bsr_plus_bsr__SWIG_7(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_plus_bsr__SWIG_7(self, args); + } + } + } } } } @@ -45032,7 +45002,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -45078,7 +45048,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_bsr_plus_bsr__SWIG_8(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_plus_bsr__SWIG_8(self, args); + } + } + } } } } @@ -45090,7 +45075,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -45136,7 +45121,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_bsr_plus_bsr__SWIG_9(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_plus_bsr__SWIG_9(self, args); + } + } + } } } } @@ -45150,7 +45150,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_plus_bsr'.\n Possible C/C++ prototypes are:\n"" bsr_plus_bsr<(int,signed char)>(int const,int const,int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],std::vector *,std::vector *,std::vector *)\n"" bsr_plus_bsr<(int,unsigned char)>(int const,int const,int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],std::vector *,std::vector *,std::vector *)\n"" bsr_plus_bsr<(int,short)>(int const,int const,int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],std::vector *,std::vector *,std::vector *)\n"" bsr_plus_bsr<(int,int)>(int const,int const,int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],std::vector *,std::vector *,std::vector *)\n"" bsr_plus_bsr<(int,long long)>(int const,int const,int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],std::vector *,std::vector *,std::vector *)\n"" bsr_plus_bsr<(int,float)>(int const,int const,int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" bsr_plus_bsr<(int,double)>(int const,int const,int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"" bsr_plus_bsr<(int,npy_cfloat_wrapper)>(int const,int const,int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],std::vector *,std::vector *,std::vector *)\n"" bsr_plus_bsr<(int,npy_cdouble_wrapper)>(int const,int const,int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],std::vector *,std::vector *,std::vector *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_plus_bsr'.\n Possible C/C++ prototypes are:\n"" bsr_plus_bsr<(int,signed char)>(int const,int const,int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],int [],int [],signed char [])\n"" bsr_plus_bsr<(int,unsigned char)>(int const,int const,int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" bsr_plus_bsr<(int,short)>(int const,int const,int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],int [],int [],short [])\n"" bsr_plus_bsr<(int,int)>(int const,int const,int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],int [],int [],int [])\n"" bsr_plus_bsr<(int,long long)>(int const,int const,int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],int [],int [],long long [])\n"" bsr_plus_bsr<(int,float)>(int const,int const,int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],int [],int [],float [])\n"" bsr_plus_bsr<(int,double)>(int const,int const,int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],int [],int [],double [])\n"" bsr_plus_bsr<(int,npy_cfloat_wrapper)>(int const,int const,int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" bsr_plus_bsr<(int,npy_cdouble_wrapper)>(int const,int const,int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); return NULL; } @@ -45167,9 +45167,9 @@ int *arg8 ; int *arg9 ; signed char *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + signed char *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -45190,9 +45190,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -45203,20 +45203,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_minus_bsr" "', argument " "1"" of type '" "int""'"); @@ -45297,29 +45288,23 @@ arg10 = (signed char*) array10->data; } - bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(signed char const (*))arg7,(int const (*))arg8,(int const (*))arg9,(signed char const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(signed char)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_BYTE); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (signed char*) array_data(temp13); } + bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(signed char const (*))arg7,(int const (*))arg8,(int const (*))arg9,(signed char const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -45374,9 +45359,9 @@ int *arg8 ; int *arg9 ; unsigned char *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + unsigned char *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -45397,9 +45382,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -45410,20 +45395,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_minus_bsr" "', argument " "1"" of type '" "int""'"); @@ -45504,29 +45480,23 @@ arg10 = (unsigned char*) array10->data; } - bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(unsigned char const (*))arg7,(int const (*))arg8,(int const (*))arg9,(unsigned char const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(unsigned char)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_UBYTE); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (unsigned char*) array_data(temp13); } + bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(unsigned char const (*))arg7,(int const (*))arg8,(int const (*))arg9,(unsigned char const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -45581,9 +45551,9 @@ int *arg8 ; int *arg9 ; short *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + short *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -45604,9 +45574,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -45617,20 +45587,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_minus_bsr" "', argument " "1"" of type '" "int""'"); @@ -45711,29 +45672,23 @@ arg10 = (short*) array10->data; } - bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(short const (*))arg7,(int const (*))arg8,(int const (*))arg9,(short const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(short)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_SHORT); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (short*) array_data(temp13); } + bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(short const (*))arg7,(int const (*))arg8,(int const (*))arg9,(short const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -45788,9 +45743,9 @@ int *arg8 ; int *arg9 ; int *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + int *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -45811,9 +45766,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -45824,20 +45779,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_minus_bsr" "', argument " "1"" of type '" "int""'"); @@ -45918,29 +45864,23 @@ arg10 = (int*) array10->data; } - bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,(int const (*))arg9,(int const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(int)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_INT); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (int*) array_data(temp13); } + bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,(int const (*))arg9,(int const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -45995,9 +45935,9 @@ int *arg8 ; int *arg9 ; long long *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + long long *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -46018,9 +45958,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -46031,20 +45971,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_minus_bsr" "', argument " "1"" of type '" "int""'"); @@ -46125,29 +46056,23 @@ arg10 = (long long*) array10->data; } - bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(long long const (*))arg7,(int const (*))arg8,(int const (*))arg9,(long long const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(long long)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_LONGLONG); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (long long*) array_data(temp13); } + bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(long long const (*))arg7,(int const (*))arg8,(int const (*))arg9,(long long const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -46202,9 +46127,9 @@ int *arg8 ; int *arg9 ; float *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + float *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -46225,9 +46150,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -46238,20 +46163,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_minus_bsr" "', argument " "1"" of type '" "int""'"); @@ -46332,29 +46248,23 @@ arg10 = (float*) array10->data; } - bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(float const (*))arg7,(int const (*))arg8,(int const (*))arg9,(float const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(float)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_FLOAT); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (float*) array_data(temp13); } + bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(float const (*))arg7,(int const (*))arg8,(int const (*))arg9,(float const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -46409,9 +46319,9 @@ int *arg8 ; int *arg9 ; double *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + double *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -46432,9 +46342,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -46445,20 +46355,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_minus_bsr" "', argument " "1"" of type '" "int""'"); @@ -46539,29 +46440,23 @@ arg10 = (double*) array10->data; } - bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(double const (*))arg7,(int const (*))arg8,(int const (*))arg9,(double const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(double)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_DOUBLE); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (double*) array_data(temp13); } + bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(double const (*))arg7,(int const (*))arg8,(int const (*))arg9,(double const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -46616,9 +46511,9 @@ int *arg8 ; int *arg9 ; npy_cfloat_wrapper *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + npy_cfloat_wrapper *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -46639,9 +46534,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -46652,20 +46547,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_minus_bsr" "', argument " "1"" of type '" "int""'"); @@ -46746,29 +46632,23 @@ arg10 = (npy_cfloat_wrapper*) array10->data; } - bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(npy_cfloat_wrapper const (*))arg7,(int const (*))arg8,(int const (*))arg9,(npy_cfloat_wrapper const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(npy_cfloat_wrapper)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_CFLOAT); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (npy_cfloat_wrapper*) array_data(temp13); } + bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(npy_cfloat_wrapper const (*))arg7,(int const (*))arg8,(int const (*))arg9,(npy_cfloat_wrapper const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -46823,9 +46703,9 @@ int *arg8 ; int *arg9 ; npy_cdouble_wrapper *arg10 ; - std::vector *arg11 = (std::vector *) 0 ; - std::vector *arg12 = (std::vector *) 0 ; - std::vector *arg13 = (std::vector *) 0 ; + int *arg11 ; + int *arg12 ; + npy_cdouble_wrapper *arg13 ; int val1 ; int ecode1 = 0 ; int val2 ; @@ -46846,9 +46726,9 @@ int is_new_object9 ; PyArrayObject *array10 = NULL ; int is_new_object10 ; - std::vector *tmp11 ; - std::vector *tmp12 ; - std::vector *tmp13 ; + PyArrayObject *temp11 = NULL ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -46859,20 +46739,11 @@ PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; - { - tmp11 = new std::vector(); - arg11 = tmp11; - } - { - tmp12 = new std::vector(); - arg12 = tmp12; - } - { - tmp13 = new std::vector(); - arg13 = tmp13; - } - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:bsr_minus_bsr",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_minus_bsr" "', argument " "1"" of type '" "int""'"); @@ -46953,29 +46824,23 @@ arg10 = (npy_cdouble_wrapper*) array10->data; } - bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(npy_cdouble_wrapper const (*))arg7,(int const (*))arg8,(int const (*))arg9,(npy_cdouble_wrapper const (*))arg10,arg11,arg12,arg13); - resultobj = SWIG_Py_Void(); { - int length = (arg11)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg11))[0]),sizeof(int)*length); - delete arg11; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp11 = obj_to_array_no_conversion(obj10,PyArray_INT); + if (!temp11 || !require_contiguous(temp11) || !require_native(temp11)) SWIG_fail; + arg11 = (int*) array_data(temp11); } { - int length = (arg12)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj),&((*(arg12))[0]),sizeof(int)*length); - delete arg12; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); } { - int length = (arg13)->size(); - PyObject *obj = PyArray_FromDims(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj),&((*(arg13))[0]),sizeof(npy_cdouble_wrapper)*length); - delete arg13; - resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); + temp13 = obj_to_array_no_conversion(obj12,PyArray_CDOUBLE); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (npy_cdouble_wrapper*) array_data(temp13); } + bsr_minus_bsr(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6,(npy_cdouble_wrapper const (*))arg7,(int const (*))arg8,(int const (*))arg9,(npy_cdouble_wrapper const (*))arg10,arg11,arg12,arg13); + resultobj = SWIG_Py_Void(); { if (is_new_object5 && array5) Py_DECREF(array5); } @@ -47020,15 +46885,15 @@ SWIGINTERN PyObject *_wrap_bsr_minus_bsr(PyObject *self, PyObject *args) { int argc; - PyObject *argv[11]; + PyObject *argv[14]; int ii; if (!PyTuple_Check(args)) SWIG_fail; argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 10); ii++) { + for (ii = 0; (ii < argc) && (ii < 13); ii++) { argv[ii] = PyTuple_GET_ITEM(args,ii); } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -47074,7 +46939,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_BYTE)) ? 1 : 0; } if (_v) { - return _wrap_bsr_minus_bsr__SWIG_1(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_minus_bsr__SWIG_1(self, args); + } + } + } } } } @@ -47086,7 +46966,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -47132,7 +47012,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_UBYTE)) ? 1 : 0; } if (_v) { - return _wrap_bsr_minus_bsr__SWIG_2(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_minus_bsr__SWIG_2(self, args); + } + } + } } } } @@ -47144,7 +47039,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -47190,7 +47085,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_SHORT)) ? 1 : 0; } if (_v) { - return _wrap_bsr_minus_bsr__SWIG_3(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_minus_bsr__SWIG_3(self, args); + } + } + } } } } @@ -47202,7 +47112,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -47248,7 +47158,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; } if (_v) { - return _wrap_bsr_minus_bsr__SWIG_4(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_minus_bsr__SWIG_4(self, args); + } + } + } } } } @@ -47260,7 +47185,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -47306,7 +47231,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_LONGLONG)) ? 1 : 0; } if (_v) { - return _wrap_bsr_minus_bsr__SWIG_5(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_minus_bsr__SWIG_5(self, args); + } + } + } } } } @@ -47318,7 +47258,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -47364,7 +47304,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_FLOAT)) ? 1 : 0; } if (_v) { - return _wrap_bsr_minus_bsr__SWIG_6(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_minus_bsr__SWIG_6(self, args); + } + } + } } } } @@ -47376,7 +47331,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -47422,7 +47377,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_DOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_bsr_minus_bsr__SWIG_7(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_minus_bsr__SWIG_7(self, args); + } + } + } } } } @@ -47434,7 +47404,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -47480,7 +47450,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_CFLOAT)) ? 1 : 0; } if (_v) { - return _wrap_bsr_minus_bsr__SWIG_8(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_minus_bsr__SWIG_8(self, args); + } + } + } } } } @@ -47492,7 +47477,7 @@ } } } - if (argc == 10) { + if (argc == 13) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); @@ -47538,7 +47523,22 @@ _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_CDOUBLE)) ? 1 : 0; } if (_v) { - return _wrap_bsr_minus_bsr__SWIG_9(self, args); + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_minus_bsr__SWIG_9(self, args); + } + } + } } } } @@ -47552,7 +47552,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_minus_bsr'.\n Possible C/C++ prototypes are:\n"" bsr_minus_bsr<(int,signed char)>(int const,int const,int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],std::vector *,std::vector *,std::vector *)\n"" bsr_minus_bsr<(int,unsigned char)>(int const,int const,int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],std::vector *,std::vector *,std::vector *)\n"" bsr_minus_bsr<(int,short)>(int const,int const,int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],std::vector *,std::vector *,std::vector *)\n"" bsr_minus_bsr<(int,int)>(int const,int const,int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],std::vector *,std::vector *,std::vector *)\n"" bsr_minus_bsr<(int,long long)>(int const,int const,int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],std::vector *,std::vector *,std::vector *)\n"" bsr_minus_bsr<(int,float)>(int const,int const,int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],std::vector *,std::vector *,std::vector *)\n"" bsr_minus_bsr<(int,double)>(int const,int const,int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],std::vector *,std::vector *,std::vector *)\n"" bsr_minus_bsr<(int,npy_cfloat_wrapper)>(int const,int const,int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],std::vector *,std::vector *,std::vector *)\n"" bsr_minus_bsr<(int,npy_cdouble_wrapper)>(int const,int const,int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],std::vector *,std::vector *,std::vector *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_minus_bsr'.\n Possible C/C++ prototypes are:\n"" bsr_minus_bsr<(int,signed char)>(int const,int const,int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],int [],int [],signed char [])\n"" bsr_minus_bsr<(int,unsigned char)>(int const,int const,int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" bsr_minus_bsr<(int,short)>(int const,int const,int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],int [],int [],short [])\n"" bsr_minus_bsr<(int,int)>(int const,int const,int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],int [],int [],int [])\n"" bsr_minus_bsr<(int,long long)>(int const,int const,int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],int [],int [],long long [])\n"" bsr_minus_bsr<(int,float)>(int const,int const,int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],int [],int [],float [])\n"" bsr_minus_bsr<(int,double)>(int const,int const,int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],int [],int [],double [])\n"" bsr_minus_bsr<(int,npy_cfloat_wrapper)>(int const,int const,int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" bsr_minus_bsr<(int,npy_cdouble_wrapper)>(int const,int const,int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); return NULL; } @@ -51591,138 +51591,118 @@ { (char *)"bsr_elmul_bsr", _wrap_bsr_elmul_bsr, METH_VARARGS, (char *)"\n" "bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" " signed char Ax, int Bp, int Bj, signed char Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(signed char)> Cx)\n" + " int Cp, int Cj, signed char Cx)\n" "bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" " unsigned char Ax, int Bp, int Bj, unsigned char Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(unsigned char)> Cx)\n" + " int Cp, int Cj, unsigned char Cx)\n" "bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" - " short Ax, int Bp, int Bj, short Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(short)> Cx)\n" + " short Ax, int Bp, int Bj, short Bx, int Cp, \n" + " int Cj, short Cx)\n" "bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" - " int Ax, int Bp, int Bj, int Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(int)> Cx)\n" + " int Ax, int Bp, int Bj, int Bx, int Cp, int Cj, \n" + " int Cx)\n" "bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" " long long Ax, int Bp, int Bj, long long Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(long long)> Cx)\n" + " int Cp, int Cj, long long Cx)\n" "bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" - " float Ax, int Bp, int Bj, float Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(float)> Cx)\n" + " float Ax, int Bp, int Bj, float Bx, int Cp, \n" + " int Cj, float Cx)\n" "bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" - " double Ax, int Bp, int Bj, double Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(double)> Cx)\n" + " double Ax, int Bp, int Bj, double Bx, int Cp, \n" + " int Cj, double Cx)\n" "bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" " npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(npy_cfloat_wrapper)> Cx)\n" + " int Cp, int Cj, npy_cfloat_wrapper Cx)\n" "bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" " npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(npy_cdouble_wrapper)> Cx)\n" + " int Cp, int Cj, npy_cdouble_wrapper Cx)\n" ""}, { (char *)"bsr_eldiv_bsr", _wrap_bsr_eldiv_bsr, METH_VARARGS, (char *)"\n" "bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" " signed char Ax, int Bp, int Bj, signed char Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(signed char)> Cx)\n" + " int Cp, int Cj, signed char Cx)\n" "bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" " unsigned char Ax, int Bp, int Bj, unsigned char Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(unsigned char)> Cx)\n" + " int Cp, int Cj, unsigned char Cx)\n" "bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" - " short Ax, int Bp, int Bj, short Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(short)> Cx)\n" + " short Ax, int Bp, int Bj, short Bx, int Cp, \n" + " int Cj, short Cx)\n" "bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" - " int Ax, int Bp, int Bj, int Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(int)> Cx)\n" + " int Ax, int Bp, int Bj, int Bx, int Cp, int Cj, \n" + " int Cx)\n" "bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" " long long Ax, int Bp, int Bj, long long Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(long long)> Cx)\n" + " int Cp, int Cj, long long Cx)\n" "bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" - " float Ax, int Bp, int Bj, float Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(float)> Cx)\n" + " float Ax, int Bp, int Bj, float Bx, int Cp, \n" + " int Cj, float Cx)\n" "bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" - " double Ax, int Bp, int Bj, double Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(double)> Cx)\n" + " double Ax, int Bp, int Bj, double Bx, int Cp, \n" + " int Cj, double Cx)\n" "bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" " npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(npy_cfloat_wrapper)> Cx)\n" + " int Cp, int Cj, npy_cfloat_wrapper Cx)\n" "bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" " npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(npy_cdouble_wrapper)> Cx)\n" + " int Cp, int Cj, npy_cdouble_wrapper Cx)\n" ""}, { (char *)"bsr_plus_bsr", _wrap_bsr_plus_bsr, METH_VARARGS, (char *)"\n" "bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" " signed char Ax, int Bp, int Bj, signed char Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(signed char)> Cx)\n" + " int Cp, int Cj, signed char Cx)\n" "bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" " unsigned char Ax, int Bp, int Bj, unsigned char Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(unsigned char)> Cx)\n" + " int Cp, int Cj, unsigned char Cx)\n" "bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" - " short Ax, int Bp, int Bj, short Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(short)> Cx)\n" + " short Ax, int Bp, int Bj, short Bx, int Cp, \n" + " int Cj, short Cx)\n" "bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" - " int Ax, int Bp, int Bj, int Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(int)> Cx)\n" + " int Ax, int Bp, int Bj, int Bx, int Cp, int Cj, \n" + " int Cx)\n" "bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" " long long Ax, int Bp, int Bj, long long Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(long long)> Cx)\n" + " int Cp, int Cj, long long Cx)\n" "bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" - " float Ax, int Bp, int Bj, float Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(float)> Cx)\n" + " float Ax, int Bp, int Bj, float Bx, int Cp, \n" + " int Cj, float Cx)\n" "bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" - " double Ax, int Bp, int Bj, double Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(double)> Cx)\n" + " double Ax, int Bp, int Bj, double Bx, int Cp, \n" + " int Cj, double Cx)\n" "bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" " npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(npy_cfloat_wrapper)> Cx)\n" + " int Cp, int Cj, npy_cfloat_wrapper Cx)\n" "bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" " npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(npy_cdouble_wrapper)> Cx)\n" + " int Cp, int Cj, npy_cdouble_wrapper Cx)\n" ""}, { (char *)"bsr_minus_bsr", _wrap_bsr_minus_bsr, METH_VARARGS, (char *)"\n" "bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" " signed char Ax, int Bp, int Bj, signed char Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(signed char)> Cx)\n" + " int Cp, int Cj, signed char Cx)\n" "bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" " unsigned char Ax, int Bp, int Bj, unsigned char Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(unsigned char)> Cx)\n" + " int Cp, int Cj, unsigned char Cx)\n" "bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" - " short Ax, int Bp, int Bj, short Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(short)> Cx)\n" + " short Ax, int Bp, int Bj, short Bx, int Cp, \n" + " int Cj, short Cx)\n" "bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" - " int Ax, int Bp, int Bj, int Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(int)> Cx)\n" + " int Ax, int Bp, int Bj, int Bx, int Cp, int Cj, \n" + " int Cx)\n" "bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" " long long Ax, int Bp, int Bj, long long Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(long long)> Cx)\n" + " int Cp, int Cj, long long Cx)\n" "bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" - " float Ax, int Bp, int Bj, float Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(float)> Cx)\n" + " float Ax, int Bp, int Bj, float Bx, int Cp, \n" + " int Cj, float Cx)\n" "bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" - " double Ax, int Bp, int Bj, double Bx, std::vector<(int)> Cp, \n" - " std::vector<(int)> Cj, std::vector<(double)> Cx)\n" + " double Ax, int Bp, int Bj, double Bx, int Cp, \n" + " int Cj, double Cx)\n" "bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" " npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(npy_cfloat_wrapper)> Cx)\n" + " int Cp, int Cj, npy_cfloat_wrapper Cx)\n" "bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, \n" " npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, \n" - " std::vector<(int)> Cp, std::vector<(int)> Cj, \n" - " std::vector<(npy_cdouble_wrapper)> Cx)\n" + " int Cp, int Cj, npy_cdouble_wrapper Cx)\n" ""}, { (char *)"csr_has_sorted_indices", _wrap_csr_has_sorted_indices, METH_VARARGS, (char *)"csr_has_sorted_indices(int n_row, int Ap, int Aj) -> bool"}, { (char *)"csr_sort_indices", _wrap_csr_sort_indices, METH_VARARGS, (char *)"\n" From scipy-svn at scipy.org Tue Dec 25 12:09:39 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 25 Dec 2007 11:09:39 -0600 (CST) Subject: [Scipy-svn] r3717 - trunk/scipy/sandbox/timeseries Message-ID: <20071225170939.5D96339C0CE@new.scipy.org> Author: pierregm Date: 2007-12-25 11:09:35 -0600 (Tue, 25 Dec 2007) New Revision: 3717 Modified: trunk/scipy/sandbox/timeseries/plotlib.py trunk/scipy/sandbox/timeseries/tseries.py Log: tofile() : fixed. Now uses the same arguments as scipy.io.write_array TimeSeries._update_from : Fixed dates update plotlib : ensures that TimeSeriesPlot.tsplot returns the plotted elements Modified: trunk/scipy/sandbox/timeseries/plotlib.py =================================================================== --- trunk/scipy/sandbox/timeseries/plotlib.py 2007-12-25 04:34:09 UTC (rev 3716) +++ trunk/scipy/sandbox/timeseries/plotlib.py 2007-12-25 17:09:35 UTC (rev 3717) @@ -39,6 +39,7 @@ import warnings + #####--------------------------------------------------------------------------- #---- --- Matplotlib extensions --- #####--------------------------------------------------------------------------- @@ -197,6 +198,7 @@ dtype=[('val',int_),('maj',bool_),('min',bool_),('fmt','|S10')]) info['val'] = numpy.arange(vmin, vmax+1) info['fmt'] = '' + info['maj'][[0,-1]] = True def first_label(label_flags): if label_flags[0] == 0: return label_flags[1] @@ -240,18 +242,14 @@ info['fmt'][first_label(month_start)] = '\n\n%b\n%Y' # Case 3. Less than 14 months ............... elif span <= 1.15 * periodsperyear: - d_minus_1 = dates_-1 - - month_diff = numpy.abs(dates_.month - d_minus_1.month) - week_diff = numpy.abs(dates_.week - d_minus_1.week) - minor_idx = (month_diff + week_diff).nonzero()[0] - - info['maj'][month_diff != 0] = True - info['min'][minor_idx] = True + year_start = period_break(dates_,'year') + month_start = period_break(dates_,'month') + week_start = period_break(dates_,'week') + info['maj'][month_start] = True + info['min'][week_start] = True + info['min'][year_start] = False + info['min'][month_start] = False if asformatter: - year_start = period_break(dates_,'year') - month_start = period_break(dates_,'month') - info['fmt'][month_start] = '%b' info['fmt'][year_start] = '%b\n%Y' if not has_level_label(year_start): @@ -259,11 +257,11 @@ # Case 4. Less than 2.5 years ............... elif span <= 2.5 * periodsperyear: year_start = period_break(dates_,'year') - month_start = period_break(dates_, 'quarter') - info['maj'][year_start] = True + quarter_start = period_break(dates_, 'quarter') + month_start = period_break(dates_, 'month') + info['maj'][quarter_start] = True info['min'][month_start] = True if asformatter: - quarter_start = period_break(dates_, 'quarter') info['fmt'][quarter_start] = '%b' info['fmt'][year_start] = '%b\n%Y' # Case 4. Less than 4 years ................. @@ -272,6 +270,7 @@ month_start = period_break(dates_, 'month') info['maj'][year_start] = True info['min'][month_start] = True + info['min'][year_start] = False if asformatter: month_break = dates_[month_start].month jan_or_jul = month_start[(month_break == 1) | (month_break == 7)] @@ -283,6 +282,7 @@ quarter_start = period_break(dates_, 'quarter') info['maj'][year_start] = True info['min'][quarter_start] = True + info['min'][year_start] = False if asformatter: info['fmt'][year_start] = '%Y' # Case 6. More than 12 years ................ @@ -332,6 +332,7 @@ #........................ elif span <= 2.5 * periodsperyear: info['maj'][year_start] = True + info['fmt'][quarter_start] = True info['min'] = True if asformatter: quarter_start = (dates_ % 3 == 1).nonzero() @@ -509,7 +510,7 @@ self.format = None self.freq = freq self.locs = [] - self.formatdict = {} + self.formatdict = None self.isminor = minor_locator self.isdynamic = dynamic_mode self.offset = 0 @@ -536,9 +537,10 @@ def _set_default_format(self, vmin, vmax): "Returns the default ticks spacing." + print "CALLING FINDER",vmin,vmax info = self.finder(vmin, vmax, self.freq, True) if self.isminor: - format = numpy.compress(info['min'] & numpy.logical_not(info['maj']), + format = numpy.compress(info['min'] & numpy.logical_not(info['maj']), info) else: format = numpy.compress(info['maj'], info) @@ -576,7 +578,8 @@ """ # Retrieve the series ................... - _series = kwargs.pop('series',None) + _series = kwargs.pop('series', + getattr(fig,'series',None)) Subplot.__init__(self,fig,*args,**kwargs) # # Force fig to be defined ..... # if fig is None: Modified: trunk/scipy/sandbox/timeseries/tseries.py =================================================================== --- trunk/scipy/sandbox/timeseries/tseries.py 2007-12-25 04:34:09 UTC (rev 3716) +++ trunk/scipy/sandbox/timeseries/tseries.py 2007-12-25 17:09:35 UTC (rev 3717) @@ -29,6 +29,8 @@ from maskedarray import MaskedArray, MAError, masked, nomask, \ filled, getmask, getmaskarray, hsplit, make_mask_none, mask_or, make_mask, \ masked_array + +import scipy.io import const as _c @@ -399,15 +401,24 @@ return _data #......................................................................... def __array_finalize__(self,obj): + self._dates = getattr(obj, '_dates', DateArray([])) MaskedArray.__array_finalize__(self, obj) - self._dates = getattr(obj, '_dates', DateArray([])) return #......................................................................... - def __array_wrap__(self, obj, context=None): - result = super(TimeSeries, self).__array_wrap__(obj, context) - result._dates = self._dates - return result +# def __array_wrap__(self, obj, context=None): +# result = super(TimeSeries, self).__array_wrap__(obj, context) +# result._dates = self._dates +# return result #......................................................................... + def _update_from(self, obj): + super(TimeSeries, self)._update_from(obj) + newdates = getattr(obj, '_dates', DateArray([])) + if self._dates.size == 0: + self._dates = newdates + elif newdates.size > 0: + _timeseriescompat(self,obj) + return + #......................................................................... def _get_series(self): "Returns the series as a regular masked array." if self._mask.ndim == 0 and self._mask: @@ -895,25 +906,54 @@ ##### --------------------------------------------------------------------------- #---- ... Additional methods ... ##### --------------------------------------------------------------------------- -def tofile(self, output, sep='\t', format_dates=None): - """Writes the TimeSeries to a file. +def tofile(self, fileobject, format=None, + separator=" ", linesep='\n', precision=5, + suppress_small=False, keep_open=False): + """Writes the TimeSeries to a file. The series should be 2D at most -:Parameters: - - `output` (String) : Name or handle of the output file. - - `sep` (String) : Column separator *['\t']*. - - `format` (String) : Data format *['%s']*. - """ - if not hasattr(output, 'writeline'): - ofile = open(output,'w') +*Parameters*: + series : {TimeSeries} + The array to write. + fileobject: + An open file object or a string to a valid filename. + format : {string} + Format string for the date. If None, uses the default date format. + separator : {string} + Separator to write between elements of the array. + linesep : {string} + Separator to write between rows of array. + precision : {integer} + Number of digits after the decimal place to write. + suppress_small : {boolean} + Whether on-zero to round small numbers down to 0.0 + keep_open : {boolean} + Whether to close the file or to return the open file. + +*Returns*: + file : {file object} + The open file (if keep_open is non-zero) + """ + (_dates, _data) = (self._dates, self._series) + optpars = dict(separator=separator,linesep=linesep,precision=precision, + suppress_small=suppress_small,keep_open=keep_open) + if _dates.size == _data.size: + # 1D version + tmpfiller = maskedarray.empty((_dates.size,2), dtype=numpy.object_) + _data = _data.reshape(-1) + tmpfiller[:,1:] = maskedarray.atleast_2d(_data).T else: - ofile = output - if format_dates is None: - format_dates = self.dates[0].default_fmtstr() - oformat = "%%s%s%s" % (sep,format_dates) - for (_dates,_data) in numpy.broadcast(self._dates.ravel().asstrings(), - filled(self)): - ofile.write('%s\n' % sep.join([oformat % (_dates, _data) ])) - ofile.close() + sshape = list(_data.shape) + sshape[-1] += 1 + tmpfiller = maskedarray.empty(sshape, dtype=numpy.object_) + tmpfiller[:,1:] = _data + # + if format is None: + tmpfiller[:,0] = _dates.ravel().tostring() + else: + tmpfiller[:,0] = [_.strftime(format) for _ in _dates.ravel()] + return scipy.io.write_array(fileobject, tmpfiller, **optpars) + + TimeSeries.tofile = tofile #............................................ From scipy-svn at scipy.org Tue Dec 25 17:42:24 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 25 Dec 2007 16:42:24 -0600 (CST) Subject: [Scipy-svn] r3718 - in trunk/scipy/sparse: . sparsetools tests Message-ID: <20071225224224.E821F39C0D3@new.scipy.org> Author: wnbell Date: 2007-12-25 16:41:38 -0600 (Tue, 25 Dec 2007) New Revision: 3718 Modified: trunk/scipy/sparse/block.py trunk/scipy/sparse/bsr.py trunk/scipy/sparse/sparsetools/sparsetools.h trunk/scipy/sparse/sparsetools/sparsetools.i trunk/scipy/sparse/sparsetools/sparsetools.py trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx trunk/scipy/sparse/tests/test_sparse.py Log: implemented block CSR multiplication Modified: trunk/scipy/sparse/block.py =================================================================== --- trunk/scipy/sparse/block.py 2007-12-25 17:09:35 UTC (rev 3717) +++ trunk/scipy/sparse/block.py 2007-12-25 22:41:38 UTC (rev 3718) @@ -159,9 +159,9 @@ raise ValueError,'index pointer values must form a " \ "non-decreasing sequence' - if not self.has_sorted_indices(): - warn('Indices were not in sorted order. Sorting indices.') - self.sort_indices(check_first=False) + #if not self.has_sorted_indices(): + # warn('Indices were not in sorted order. Sorting indices.') + # self.sort_indices(check_first=False) def _get_blocksize(self): return self.data.shape[1:] @@ -340,6 +340,9 @@ def sort_indices(self, check_first=True): """Sort the indices of this matrix *in place* """ + if check_first and self.has_sorted_indices(): + return + from csr import csr_matrix X,Y = self.blocksize Modified: trunk/scipy/sparse/bsr.py =================================================================== --- trunk/scipy/sparse/bsr.py 2007-12-25 17:09:35 UTC (rev 3717) +++ trunk/scipy/sparse/bsr.py 2007-12-25 22:41:38 UTC (rev 3718) @@ -4,9 +4,9 @@ __all__ = ['bsr_matrix', 'isspmatrix_bsr'] from numpy import zeros, intc, array, asarray, arange, diff, tile, rank, \ - prod, ravel, empty, matrix, asmatrix + prod, ravel, empty, matrix, asmatrix, empty_like, hstack -from sparsetools import bsr_matvec +from sparsetools import bsr_matvec, csr_matmat_pass1, bsr_matmat_pass2 from block import _block_matrix from base import isspmatrix from sputils import isdense, upcast, isscalarlike @@ -74,7 +74,49 @@ raise TypeError, "need a dense vector" + def matmat(self, other): + if isspmatrix(other): + M, K1 = self.shape + K2, N = other.shape + if (K1 != K2): + raise ValueError, "shape mismatch error" + indptr = empty_like( self.indptr ) + + R,n = self.blocksize + + if isspmatrix_bsr(other): + C = other.blocksize[1] + else: + C = 1 + other = other.tobsr(blocksize=(n,C)) #convert to this format + + csr_matmat_pass1( M/R, N/C, \ + self.indptr, self.indices, \ + other.indptr, other.indices, \ + indptr) + + bnnz = indptr[-1] + indices = empty( bnnz, dtype=intc) + data = empty( R*C*bnnz, dtype=upcast(self.dtype,other.dtype)) + + bsr_matmat_pass2( M/R, N/C, R, C, n, \ + self.indptr, self.indices, ravel(self.data), \ + other.indptr, other.indices, ravel(other.data), \ + indptr, indices, data) + + data = data.reshape(-1,R,C) + #TODO eliminate zeros + + return bsr_matrix((data,indices,indptr),shape=(M,N),blocksize=(R,C)) + elif isdense(other): + # TODO make sparse * dense matrix multiplication more efficient + + # matvec each column of other + return hstack( [ self * col.reshape(-1,1) for col in other.T ] ) + else: + raise TypeError, "need a dense or sparse matrix" + # def transpose(self,copy=False): # M,N = self.shape # @@ -114,8 +156,12 @@ def transpose(self): + X,Y = self.blocksize M,N = self.shape + + if self.nnz == 0: + return bsr_matrix((N,M),blocksize=(Y,X)) #use CSR.T to determine a permutation for BSR.T from csr import csr_matrix Modified: trunk/scipy/sparse/sparsetools/sparsetools.h =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.h 2007-12-25 17:09:35 UTC (rev 3717) +++ trunk/scipy/sparse/sparsetools/sparsetools.h 2007-12-25 22:41:38 UTC (rev 3718) @@ -12,6 +12,7 @@ +#include #include #include @@ -315,6 +316,7 @@ * */ + /* * Pass 1 computes CSR row pointer for the matrix product C = A * B * @@ -328,6 +330,51 @@ const I Bj[], I Cp[]) { +// // method that uses O(n) temp storage +// const I hash_size = 1 << 5; +// I vals[hash_size]; +// I mask[hash_size]; +// +// std::set spill; +// +// for(I i = 0; i < hash_size; i++){ +// vals[i] = -1; +// mask[i] = -1; +// } +// +// Cp[0] = 0; +// +// I slow_inserts = 0; +// I total_inserts = 0; +// I nnz = 0; +// for(I i = 0; i < n_row; i++){ +// spill.clear(); +// 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]; +// // I hash = k & (hash_size - 1); +// I hash = ((I)2654435761 * k) & (hash_size -1 ); +// total_inserts++; +// if(mask[hash] != i){ +// mask[hash] = i; +// vals[hash] = k; +// nnz++; +// } else { +// if (vals[hash] != k){ +// slow_inserts++; +// spill.insert(k); +// } +// } +// } +// } +// nnz += spill.size(); +// Cp[i+1] = nnz; +// } +// +// std::cout << "slow fraction " << ((float) slow_inserts)/ ((float) total_inserts) << std::endl; + + // method that uses O(n) temp storage std::vector mask(n_col,-1); Cp[0] = 0; @@ -415,10 +462,91 @@ Cp[i+1] = nnz; } } +template +void bsr_matmat_pass2(const I n_brow, const I n_bcol, + const I R, const I C, const I N, + const I Ap[], const I Aj[], const T Ax[], + const I Bp[], const I Bj[], const T Bx[], + I Cp[], I Cj[], T Cx[]) +{ + const I RC = R*C; + const I RN = R*N; + const I NC = N*C; + const I SIZE = RC*Cp[n_brow]; + for(I i = 0; i < SIZE; i++){ + Cx[i] = 0; + } + //std::cout << "n_brow " << n_brow << " Cp[-1] " << Cp[n_brow] << " R " << R << " C " << C << " N " << N << std::endl; + + std::vector next(n_bcol,-1); + std::vector mats(n_bcol); + + I nnz = 0; + Cp[0] = 0; + for(I i = 0; i < n_brow; i++){ + I head = -2; + I length = 0; + + I jj_start = Ap[i]; + I jj_end = Ap[i+1]; + for(I jj = jj_start; jj < jj_end; jj++){ + I j = Aj[jj]; + + I kk_start = Bp[j]; + I kk_end = Bp[j+1]; + for(I kk = kk_start; kk < kk_end; kk++){ + I k = Bj[kk]; + + if(next[k] == -1){ + next[k] = head; + head = k; + Cj[nnz] = k; + mats[k] = Cx + RC*nnz; + nnz++; + length++; + } + + const T * A = Ax + jj*RN; + const T * B = Bx + kk*NC; + T * result = mats[k]; + for(I r = 0; r < R; r++){ + for(I c = 0; c < C; c++){ + for(I n = 0; n < N; n++){ + result[C*r + c] += A[N*r + n] * B[C*n + c]; + + } + //std::cout << "result[" << r << "," << c << "] = " << result[C*r + c] << std::endl; + } + } + } + } + + for(I jj = 0; jj < length; jj++){ + + //if(is_nonzero_block(result,RC)){ + // Cj[nnz] = head; + // Cx[nnz] = sums[head]; + // nnz++; + //} + + I temp = head; + head = next[head]; + + next[temp] = -1; //clear arrays + } + + //Cp[i+1] = nnz; + } +} + + + + + template bool is_nonzero_block(const T block[], const I blocksize){ for(I i = 0; i < blocksize; i++){ @@ -440,9 +568,14 @@ const bin_op& op) { //Method that works for unsorted indices - assert( csr_has_sorted_indices(n_brow,Ap,Aj) ); - assert( csr_has_sorted_indices(n_brow,Bp,Bj) ); + // assert( csr_has_sorted_indices(n_brow,Ap,Aj) ); + // assert( csr_has_sorted_indices(n_brow,Bp,Bj) ); + //if (R == 3 && C == 3){ + // bsr_binop_bsr_fixed(n_brow,n_bcol,Ap,Aj,Ax,Bp,Bj,Bx,Cp,Cj,Cx,op); + // return; + //} + const I RC = R*C; T result[8*8]; //T zeros[8*8]; @@ -1029,6 +1162,7 @@ const T Xx[], T Yx[]) { + //TODO make a matvec template for(I i = 0; i < n_brow; i++) { T r0 = 0; T r1 = 0; @@ -1062,7 +1196,6 @@ if (R > 7) Yx[R*i+7] = r7; } } -#define F(X,Y) bsr_matvec_fixed /* * Generate the table below with: @@ -1077,6 +1210,8 @@ * */ +#define F(X,Y) bsr_matvec_fixed + template void bsr_matvec(const I n_brow, const I n_bcol, @@ -1600,5 +1735,77 @@ // } //} // +//template +//void bsr_binop_bsr_fixed(const I n_brow, const I n_bcol, +// const I Ap[], const I Aj[], const T Ax[], +// const I Bp[], const I Bj[], const T Bx[], +// I Cp[], I Cj[], T Cx[], +// const bin_op& op) +//{ +// //Method that works for unsorted indices +// const I RC = R*C; +// T zeros[RC] = {0}; +// Cp[0] = 0; +// I nnz = 0; +// +// std::cout << "using bsr_ fixed" << std::endl; +// for(I i = 0; i < n_brow; i++){ +// I A_pos = Ap[i]; +// I B_pos = Bp[i]; +// I A_end = Ap[i+1]; +// I B_end = Bp[i+1]; +// +// I A_j = Aj[A_pos]; +// I B_j = Bj[B_pos]; +// +// //while not finished with either row +// while(A_pos < A_end && B_pos < B_end){ +// if(A_j == B_j){ +// Cj[nnz] = A_j; +// vec_binop_vec (Ax + RC*A_pos, Bx + RC*B_pos, Cx + RC*nnz, op); +// if( is_nonzero_block(Cx + RC*nnz,RC) ){ +// nnz++; +// } +// A_j = Aj[++A_pos]; +// B_j = Bj[++B_pos]; +// } else if (A_j < B_j) { +// Cj[nnz] = A_j; +// vec_binop_vec (Ax + RC*A_pos, zeros, Cx + RC*nnz, op); +// if( is_nonzero_block(Cx + RC*nnz,RC) ){ +// nnz++; +// } +// A_j = Aj[++A_pos]; +// } else { +// //B_j < A_j +// Cj[nnz] = B_j; +// vec_binop_vec (zeros, Bx + RC*A_pos, Cx + RC*nnz, op); +// if( is_nonzero_block(Cx + RC*nnz,RC) ){ +// nnz++; +// } +// B_j = Bj[++B_pos]; +// } +// } +// +// //tail +// while(A_pos < A_end){ +// Cj[nnz] = A_j; +// vec_binop_vec (Ax + RC*A_pos, zeros, Cx + RC*nnz, op); +// if( is_nonzero_block(Cx + RC*nnz,RC) ){ +// nnz++; +// } +// A_j = Aj[++A_pos]; +// } +// while(B_pos < B_end){ +// Cj[nnz] = B_j; +// vec_binop_vec (zeros, Bx + RC*A_pos, Cx + RC*nnz, op); +// if( is_nonzero_block(Cx + RC*nnz,RC) ){ +// nnz++; +// } +// B_j = Bj[++B_pos]; +// } +// +// Cp[i+1] = nnz; +// } +//} #endif Modified: trunk/scipy/sparse/sparsetools/sparsetools.i =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.i 2007-12-25 17:09:35 UTC (rev 3717) +++ trunk/scipy/sparse/sparsetools/sparsetools.i 2007-12-25 22:41:38 UTC (rev 3718) @@ -213,7 +213,9 @@ %template(csc_matmat_pass1) csc_matmat_pass1; INSTANTIATE_ALL(csr_matmat_pass2) INSTANTIATE_ALL(csc_matmat_pass2) +INSTANTIATE_ALL(bsr_matmat_pass2) + /* * CSR*x and CSC*x */ Modified: trunk/scipy/sparse/sparsetools/sparsetools.py =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools.py 2007-12-25 17:09:35 UTC (rev 3717) +++ trunk/scipy/sparse/sparsetools/sparsetools.py 2007-12-25 22:41:38 UTC (rev 3718) @@ -262,6 +262,39 @@ """ return _sparsetools.csc_matmat_pass2(*args) +def bsr_matmat_pass2(*args): + """ + bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, + int Aj, signed char Ax, int Bp, int Bj, signed char Bx, + int Cp, int Cj, signed char Cx) + bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, + int Aj, unsigned char Ax, int Bp, int Bj, unsigned char Bx, + int Cp, int Cj, unsigned char Cx) + bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, + int Aj, short Ax, int Bp, int Bj, short Bx, + int Cp, int Cj, short Cx) + bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, + int Aj, int Ax, int Bp, int Bj, int Bx, int Cp, + int Cj, int Cx) + bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, + int Aj, long long Ax, int Bp, int Bj, long long Bx, + int Cp, int Cj, long long Cx) + bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, + int Aj, float Ax, int Bp, int Bj, float Bx, + int Cp, int Cj, float Cx) + bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, + int Aj, double Ax, int Bp, int Bj, double Bx, + int Cp, int Cj, double Cx) + bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, + int Aj, npy_cfloat_wrapper Ax, int Bp, int Bj, + npy_cfloat_wrapper Bx, int Cp, int Cj, npy_cfloat_wrapper Cx) + bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, + int Aj, npy_cdouble_wrapper Ax, int Bp, int Bj, + npy_cdouble_wrapper Bx, int Cp, int Cj, + npy_cdouble_wrapper Cx) + """ + return _sparsetools.bsr_matmat_pass2(*args) + def csr_matvec(*args): """ csr_matvec(int n_row, int n_col, int Ap, int Aj, signed char Ax, Modified: trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx =================================================================== --- trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx 2007-12-25 17:09:35 UTC (rev 3717) +++ trunk/scipy/sparse/sparsetools/sparsetools_wrap.cxx 2007-12-25 22:41:38 UTC (rev 3718) @@ -16279,6 +16279,2543 @@ } +SWIGINTERN PyObject *_wrap_bsr_matmat_pass2__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int arg5 ; + int *arg6 ; + int *arg7 ; + signed char *arg8 ; + int *arg9 ; + int *arg10 ; + signed char *arg11 ; + int *arg12 ; + int *arg13 ; + signed char *arg14 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int val3 ; + int ecode3 = 0 ; + int val4 ; + int ecode4 = 0 ; + int val5 ; + int ecode5 = 0 ; + PyArrayObject *array6 = NULL ; + int is_new_object6 ; + PyArrayObject *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + PyArrayObject *array11 = NULL ; + int is_new_object11 ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; + PyArrayObject *temp14 = NULL ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; + PyObject * obj13 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOOO:bsr_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12,&obj13)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + ecode5 = SWIG_AsVal_int(obj4, &val5); + if (!SWIG_IsOK(ecode5)) { + SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "bsr_matmat_pass2" "', argument " "5"" of type '" "int""'"); + } + arg5 = static_cast< int >(val5); + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_INT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (int*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_BYTE, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (signed char*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_INT, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (int*) array10->data; + } + { + npy_intp size[1] = { + -1 + }; + array11 = obj_to_array_contiguous_allow_conversion(obj10, PyArray_BYTE, &is_new_object11); + if (!array11 || !require_dimensions(array11,1) || !require_size(array11,size,1) + || !require_contiguous(array11) || !require_native(array11)) SWIG_fail; + + arg11 = (signed char*) array11->data; + } + { + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); + } + { + temp13 = obj_to_array_no_conversion(obj12,PyArray_INT); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (int*) array_data(temp13); + } + { + temp14 = obj_to_array_no_conversion(obj13,PyArray_BYTE); + if (!temp14 || !require_contiguous(temp14) || !require_native(temp14)) SWIG_fail; + arg14 = (signed char*) array_data(temp14); + } + bsr_matmat_pass2(arg1,arg2,arg3,arg4,arg5,(int const (*))arg6,(int const (*))arg7,(signed char const (*))arg8,(int const (*))arg9,(int const (*))arg10,(signed char const (*))arg11,arg12,arg13,arg14); + resultobj = SWIG_Py_Void(); + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + { + if (is_new_object11 && array11) Py_DECREF(array11); + } + return resultobj; +fail: + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + { + if (is_new_object11 && array11) Py_DECREF(array11); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_matmat_pass2__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int arg5 ; + int *arg6 ; + int *arg7 ; + unsigned char *arg8 ; + int *arg9 ; + int *arg10 ; + unsigned char *arg11 ; + int *arg12 ; + int *arg13 ; + unsigned char *arg14 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int val3 ; + int ecode3 = 0 ; + int val4 ; + int ecode4 = 0 ; + int val5 ; + int ecode5 = 0 ; + PyArrayObject *array6 = NULL ; + int is_new_object6 ; + PyArrayObject *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + PyArrayObject *array11 = NULL ; + int is_new_object11 ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; + PyArrayObject *temp14 = NULL ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; + PyObject * obj13 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOOO:bsr_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12,&obj13)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + ecode5 = SWIG_AsVal_int(obj4, &val5); + if (!SWIG_IsOK(ecode5)) { + SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "bsr_matmat_pass2" "', argument " "5"" of type '" "int""'"); + } + arg5 = static_cast< int >(val5); + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_INT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (int*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_UBYTE, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (unsigned char*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_INT, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (int*) array10->data; + } + { + npy_intp size[1] = { + -1 + }; + array11 = obj_to_array_contiguous_allow_conversion(obj10, PyArray_UBYTE, &is_new_object11); + if (!array11 || !require_dimensions(array11,1) || !require_size(array11,size,1) + || !require_contiguous(array11) || !require_native(array11)) SWIG_fail; + + arg11 = (unsigned char*) array11->data; + } + { + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); + } + { + temp13 = obj_to_array_no_conversion(obj12,PyArray_INT); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (int*) array_data(temp13); + } + { + temp14 = obj_to_array_no_conversion(obj13,PyArray_UBYTE); + if (!temp14 || !require_contiguous(temp14) || !require_native(temp14)) SWIG_fail; + arg14 = (unsigned char*) array_data(temp14); + } + bsr_matmat_pass2(arg1,arg2,arg3,arg4,arg5,(int const (*))arg6,(int const (*))arg7,(unsigned char const (*))arg8,(int const (*))arg9,(int const (*))arg10,(unsigned char const (*))arg11,arg12,arg13,arg14); + resultobj = SWIG_Py_Void(); + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + { + if (is_new_object11 && array11) Py_DECREF(array11); + } + return resultobj; +fail: + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + { + if (is_new_object11 && array11) Py_DECREF(array11); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_matmat_pass2__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int arg5 ; + int *arg6 ; + int *arg7 ; + short *arg8 ; + int *arg9 ; + int *arg10 ; + short *arg11 ; + int *arg12 ; + int *arg13 ; + short *arg14 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int val3 ; + int ecode3 = 0 ; + int val4 ; + int ecode4 = 0 ; + int val5 ; + int ecode5 = 0 ; + PyArrayObject *array6 = NULL ; + int is_new_object6 ; + PyArrayObject *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + PyArrayObject *array11 = NULL ; + int is_new_object11 ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; + PyArrayObject *temp14 = NULL ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; + PyObject * obj13 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOOO:bsr_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12,&obj13)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + ecode5 = SWIG_AsVal_int(obj4, &val5); + if (!SWIG_IsOK(ecode5)) { + SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "bsr_matmat_pass2" "', argument " "5"" of type '" "int""'"); + } + arg5 = static_cast< int >(val5); + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_INT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (int*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_SHORT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (short*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_INT, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (int*) array10->data; + } + { + npy_intp size[1] = { + -1 + }; + array11 = obj_to_array_contiguous_allow_conversion(obj10, PyArray_SHORT, &is_new_object11); + if (!array11 || !require_dimensions(array11,1) || !require_size(array11,size,1) + || !require_contiguous(array11) || !require_native(array11)) SWIG_fail; + + arg11 = (short*) array11->data; + } + { + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); + } + { + temp13 = obj_to_array_no_conversion(obj12,PyArray_INT); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (int*) array_data(temp13); + } + { + temp14 = obj_to_array_no_conversion(obj13,PyArray_SHORT); + if (!temp14 || !require_contiguous(temp14) || !require_native(temp14)) SWIG_fail; + arg14 = (short*) array_data(temp14); + } + bsr_matmat_pass2(arg1,arg2,arg3,arg4,arg5,(int const (*))arg6,(int const (*))arg7,(short const (*))arg8,(int const (*))arg9,(int const (*))arg10,(short const (*))arg11,arg12,arg13,arg14); + resultobj = SWIG_Py_Void(); + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + { + if (is_new_object11 && array11) Py_DECREF(array11); + } + return resultobj; +fail: + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + { + if (is_new_object11 && array11) Py_DECREF(array11); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_matmat_pass2__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int arg5 ; + int *arg6 ; + int *arg7 ; + int *arg8 ; + int *arg9 ; + int *arg10 ; + int *arg11 ; + int *arg12 ; + int *arg13 ; + int *arg14 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int val3 ; + int ecode3 = 0 ; + int val4 ; + int ecode4 = 0 ; + int val5 ; + int ecode5 = 0 ; + PyArrayObject *array6 = NULL ; + int is_new_object6 ; + PyArrayObject *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + PyArrayObject *array11 = NULL ; + int is_new_object11 ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; + PyArrayObject *temp14 = NULL ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; + PyObject * obj13 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOOO:bsr_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12,&obj13)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + ecode5 = SWIG_AsVal_int(obj4, &val5); + if (!SWIG_IsOK(ecode5)) { + SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "bsr_matmat_pass2" "', argument " "5"" of type '" "int""'"); + } + arg5 = static_cast< int >(val5); + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_INT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (int*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_INT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (int*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_INT, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (int*) array10->data; + } + { + npy_intp size[1] = { + -1 + }; + array11 = obj_to_array_contiguous_allow_conversion(obj10, PyArray_INT, &is_new_object11); + if (!array11 || !require_dimensions(array11,1) || !require_size(array11,size,1) + || !require_contiguous(array11) || !require_native(array11)) SWIG_fail; + + arg11 = (int*) array11->data; + } + { + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); + } + { + temp13 = obj_to_array_no_conversion(obj12,PyArray_INT); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (int*) array_data(temp13); + } + { + temp14 = obj_to_array_no_conversion(obj13,PyArray_INT); + if (!temp14 || !require_contiguous(temp14) || !require_native(temp14)) SWIG_fail; + arg14 = (int*) array_data(temp14); + } + bsr_matmat_pass2(arg1,arg2,arg3,arg4,arg5,(int const (*))arg6,(int const (*))arg7,(int const (*))arg8,(int const (*))arg9,(int const (*))arg10,(int const (*))arg11,arg12,arg13,arg14); + resultobj = SWIG_Py_Void(); + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + { + if (is_new_object11 && array11) Py_DECREF(array11); + } + return resultobj; +fail: + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + { + if (is_new_object11 && array11) Py_DECREF(array11); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_matmat_pass2__SWIG_5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int arg5 ; + int *arg6 ; + int *arg7 ; + long long *arg8 ; + int *arg9 ; + int *arg10 ; + long long *arg11 ; + int *arg12 ; + int *arg13 ; + long long *arg14 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int val3 ; + int ecode3 = 0 ; + int val4 ; + int ecode4 = 0 ; + int val5 ; + int ecode5 = 0 ; + PyArrayObject *array6 = NULL ; + int is_new_object6 ; + PyArrayObject *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + PyArrayObject *array11 = NULL ; + int is_new_object11 ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; + PyArrayObject *temp14 = NULL ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; + PyObject * obj13 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOOO:bsr_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12,&obj13)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + ecode5 = SWIG_AsVal_int(obj4, &val5); + if (!SWIG_IsOK(ecode5)) { + SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "bsr_matmat_pass2" "', argument " "5"" of type '" "int""'"); + } + arg5 = static_cast< int >(val5); + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_INT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (int*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_LONGLONG, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (long long*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_INT, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (int*) array10->data; + } + { + npy_intp size[1] = { + -1 + }; + array11 = obj_to_array_contiguous_allow_conversion(obj10, PyArray_LONGLONG, &is_new_object11); + if (!array11 || !require_dimensions(array11,1) || !require_size(array11,size,1) + || !require_contiguous(array11) || !require_native(array11)) SWIG_fail; + + arg11 = (long long*) array11->data; + } + { + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); + } + { + temp13 = obj_to_array_no_conversion(obj12,PyArray_INT); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (int*) array_data(temp13); + } + { + temp14 = obj_to_array_no_conversion(obj13,PyArray_LONGLONG); + if (!temp14 || !require_contiguous(temp14) || !require_native(temp14)) SWIG_fail; + arg14 = (long long*) array_data(temp14); + } + bsr_matmat_pass2(arg1,arg2,arg3,arg4,arg5,(int const (*))arg6,(int const (*))arg7,(long long const (*))arg8,(int const (*))arg9,(int const (*))arg10,(long long const (*))arg11,arg12,arg13,arg14); + resultobj = SWIG_Py_Void(); + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + { + if (is_new_object11 && array11) Py_DECREF(array11); + } + return resultobj; +fail: + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + { + if (is_new_object11 && array11) Py_DECREF(array11); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_matmat_pass2__SWIG_6(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int arg5 ; + int *arg6 ; + int *arg7 ; + float *arg8 ; + int *arg9 ; + int *arg10 ; + float *arg11 ; + int *arg12 ; + int *arg13 ; + float *arg14 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int val3 ; + int ecode3 = 0 ; + int val4 ; + int ecode4 = 0 ; + int val5 ; + int ecode5 = 0 ; + PyArrayObject *array6 = NULL ; + int is_new_object6 ; + PyArrayObject *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + PyArrayObject *array11 = NULL ; + int is_new_object11 ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; + PyArrayObject *temp14 = NULL ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; + PyObject * obj13 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOOO:bsr_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12,&obj13)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + ecode5 = SWIG_AsVal_int(obj4, &val5); + if (!SWIG_IsOK(ecode5)) { + SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "bsr_matmat_pass2" "', argument " "5"" of type '" "int""'"); + } + arg5 = static_cast< int >(val5); + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_INT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (int*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_FLOAT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (float*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_INT, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (int*) array10->data; + } + { + npy_intp size[1] = { + -1 + }; + array11 = obj_to_array_contiguous_allow_conversion(obj10, PyArray_FLOAT, &is_new_object11); + if (!array11 || !require_dimensions(array11,1) || !require_size(array11,size,1) + || !require_contiguous(array11) || !require_native(array11)) SWIG_fail; + + arg11 = (float*) array11->data; + } + { + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); + } + { + temp13 = obj_to_array_no_conversion(obj12,PyArray_INT); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (int*) array_data(temp13); + } + { + temp14 = obj_to_array_no_conversion(obj13,PyArray_FLOAT); + if (!temp14 || !require_contiguous(temp14) || !require_native(temp14)) SWIG_fail; + arg14 = (float*) array_data(temp14); + } + bsr_matmat_pass2(arg1,arg2,arg3,arg4,arg5,(int const (*))arg6,(int const (*))arg7,(float const (*))arg8,(int const (*))arg9,(int const (*))arg10,(float const (*))arg11,arg12,arg13,arg14); + resultobj = SWIG_Py_Void(); + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + { + if (is_new_object11 && array11) Py_DECREF(array11); + } + return resultobj; +fail: + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + { + if (is_new_object11 && array11) Py_DECREF(array11); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_matmat_pass2__SWIG_7(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int arg5 ; + int *arg6 ; + int *arg7 ; + double *arg8 ; + int *arg9 ; + int *arg10 ; + double *arg11 ; + int *arg12 ; + int *arg13 ; + double *arg14 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int val3 ; + int ecode3 = 0 ; + int val4 ; + int ecode4 = 0 ; + int val5 ; + int ecode5 = 0 ; + PyArrayObject *array6 = NULL ; + int is_new_object6 ; + PyArrayObject *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + PyArrayObject *array11 = NULL ; + int is_new_object11 ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; + PyArrayObject *temp14 = NULL ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; + PyObject * obj13 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOOO:bsr_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12,&obj13)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + ecode5 = SWIG_AsVal_int(obj4, &val5); + if (!SWIG_IsOK(ecode5)) { + SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "bsr_matmat_pass2" "', argument " "5"" of type '" "int""'"); + } + arg5 = static_cast< int >(val5); + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_INT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (int*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_DOUBLE, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (double*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_INT, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (int*) array10->data; + } + { + npy_intp size[1] = { + -1 + }; + array11 = obj_to_array_contiguous_allow_conversion(obj10, PyArray_DOUBLE, &is_new_object11); + if (!array11 || !require_dimensions(array11,1) || !require_size(array11,size,1) + || !require_contiguous(array11) || !require_native(array11)) SWIG_fail; + + arg11 = (double*) array11->data; + } + { + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); + } + { + temp13 = obj_to_array_no_conversion(obj12,PyArray_INT); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (int*) array_data(temp13); + } + { + temp14 = obj_to_array_no_conversion(obj13,PyArray_DOUBLE); + if (!temp14 || !require_contiguous(temp14) || !require_native(temp14)) SWIG_fail; + arg14 = (double*) array_data(temp14); + } + bsr_matmat_pass2(arg1,arg2,arg3,arg4,arg5,(int const (*))arg6,(int const (*))arg7,(double const (*))arg8,(int const (*))arg9,(int const (*))arg10,(double const (*))arg11,arg12,arg13,arg14); + resultobj = SWIG_Py_Void(); + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + { + if (is_new_object11 && array11) Py_DECREF(array11); + } + return resultobj; +fail: + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + { + if (is_new_object11 && array11) Py_DECREF(array11); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_matmat_pass2__SWIG_8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int arg5 ; + int *arg6 ; + int *arg7 ; + npy_cfloat_wrapper *arg8 ; + int *arg9 ; + int *arg10 ; + npy_cfloat_wrapper *arg11 ; + int *arg12 ; + int *arg13 ; + npy_cfloat_wrapper *arg14 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int val3 ; + int ecode3 = 0 ; + int val4 ; + int ecode4 = 0 ; + int val5 ; + int ecode5 = 0 ; + PyArrayObject *array6 = NULL ; + int is_new_object6 ; + PyArrayObject *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + PyArrayObject *array11 = NULL ; + int is_new_object11 ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; + PyArrayObject *temp14 = NULL ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; + PyObject * obj13 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOOO:bsr_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12,&obj13)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + ecode5 = SWIG_AsVal_int(obj4, &val5); + if (!SWIG_IsOK(ecode5)) { + SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "bsr_matmat_pass2" "', argument " "5"" of type '" "int""'"); + } + arg5 = static_cast< int >(val5); + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_INT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (int*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_CFLOAT, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (npy_cfloat_wrapper*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_INT, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (int*) array10->data; + } + { + npy_intp size[1] = { + -1 + }; + array11 = obj_to_array_contiguous_allow_conversion(obj10, PyArray_CFLOAT, &is_new_object11); + if (!array11 || !require_dimensions(array11,1) || !require_size(array11,size,1) + || !require_contiguous(array11) || !require_native(array11)) SWIG_fail; + + arg11 = (npy_cfloat_wrapper*) array11->data; + } + { + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); + } + { + temp13 = obj_to_array_no_conversion(obj12,PyArray_INT); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (int*) array_data(temp13); + } + { + temp14 = obj_to_array_no_conversion(obj13,PyArray_CFLOAT); + if (!temp14 || !require_contiguous(temp14) || !require_native(temp14)) SWIG_fail; + arg14 = (npy_cfloat_wrapper*) array_data(temp14); + } + bsr_matmat_pass2(arg1,arg2,arg3,arg4,arg5,(int const (*))arg6,(int const (*))arg7,(npy_cfloat_wrapper const (*))arg8,(int const (*))arg9,(int const (*))arg10,(npy_cfloat_wrapper const (*))arg11,arg12,arg13,arg14); + resultobj = SWIG_Py_Void(); + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + { + if (is_new_object11 && array11) Py_DECREF(array11); + } + return resultobj; +fail: + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + { + if (is_new_object11 && array11) Py_DECREF(array11); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_matmat_pass2__SWIG_9(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + int arg5 ; + int *arg6 ; + int *arg7 ; + npy_cdouble_wrapper *arg8 ; + int *arg9 ; + int *arg10 ; + npy_cdouble_wrapper *arg11 ; + int *arg12 ; + int *arg13 ; + npy_cdouble_wrapper *arg14 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int val3 ; + int ecode3 = 0 ; + int val4 ; + int ecode4 = 0 ; + int val5 ; + int ecode5 = 0 ; + PyArrayObject *array6 = NULL ; + int is_new_object6 ; + PyArrayObject *array7 = NULL ; + int is_new_object7 ; + PyArrayObject *array8 = NULL ; + int is_new_object8 ; + PyArrayObject *array9 = NULL ; + int is_new_object9 ; + PyArrayObject *array10 = NULL ; + int is_new_object10 ; + PyArrayObject *array11 = NULL ; + int is_new_object11 ; + PyArrayObject *temp12 = NULL ; + PyArrayObject *temp13 = NULL ; + PyArrayObject *temp14 = NULL ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; + PyObject * obj13 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOOO:bsr_matmat_pass2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12,&obj13)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', 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 '" "bsr_matmat_pass2" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + ecode5 = SWIG_AsVal_int(obj4, &val5); + if (!SWIG_IsOK(ecode5)) { + SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "bsr_matmat_pass2" "', argument " "5"" of type '" "int""'"); + } + arg5 = static_cast< int >(val5); + { + npy_intp size[1] = { + -1 + }; + array6 = obj_to_array_contiguous_allow_conversion(obj5, PyArray_INT, &is_new_object6); + if (!array6 || !require_dimensions(array6,1) || !require_size(array6,size,1) + || !require_contiguous(array6) || !require_native(array6)) SWIG_fail; + + arg6 = (int*) array6->data; + } + { + npy_intp size[1] = { + -1 + }; + array7 = obj_to_array_contiguous_allow_conversion(obj6, PyArray_INT, &is_new_object7); + if (!array7 || !require_dimensions(array7,1) || !require_size(array7,size,1) + || !require_contiguous(array7) || !require_native(array7)) SWIG_fail; + + arg7 = (int*) array7->data; + } + { + npy_intp size[1] = { + -1 + }; + array8 = obj_to_array_contiguous_allow_conversion(obj7, PyArray_CDOUBLE, &is_new_object8); + if (!array8 || !require_dimensions(array8,1) || !require_size(array8,size,1) + || !require_contiguous(array8) || !require_native(array8)) SWIG_fail; + + arg8 = (npy_cdouble_wrapper*) array8->data; + } + { + npy_intp size[1] = { + -1 + }; + array9 = obj_to_array_contiguous_allow_conversion(obj8, PyArray_INT, &is_new_object9); + if (!array9 || !require_dimensions(array9,1) || !require_size(array9,size,1) + || !require_contiguous(array9) || !require_native(array9)) SWIG_fail; + + arg9 = (int*) array9->data; + } + { + npy_intp size[1] = { + -1 + }; + array10 = obj_to_array_contiguous_allow_conversion(obj9, PyArray_INT, &is_new_object10); + if (!array10 || !require_dimensions(array10,1) || !require_size(array10,size,1) + || !require_contiguous(array10) || !require_native(array10)) SWIG_fail; + + arg10 = (int*) array10->data; + } + { + npy_intp size[1] = { + -1 + }; + array11 = obj_to_array_contiguous_allow_conversion(obj10, PyArray_CDOUBLE, &is_new_object11); + if (!array11 || !require_dimensions(array11,1) || !require_size(array11,size,1) + || !require_contiguous(array11) || !require_native(array11)) SWIG_fail; + + arg11 = (npy_cdouble_wrapper*) array11->data; + } + { + temp12 = obj_to_array_no_conversion(obj11,PyArray_INT); + if (!temp12 || !require_contiguous(temp12) || !require_native(temp12)) SWIG_fail; + arg12 = (int*) array_data(temp12); + } + { + temp13 = obj_to_array_no_conversion(obj12,PyArray_INT); + if (!temp13 || !require_contiguous(temp13) || !require_native(temp13)) SWIG_fail; + arg13 = (int*) array_data(temp13); + } + { + temp14 = obj_to_array_no_conversion(obj13,PyArray_CDOUBLE); + if (!temp14 || !require_contiguous(temp14) || !require_native(temp14)) SWIG_fail; + arg14 = (npy_cdouble_wrapper*) array_data(temp14); + } + bsr_matmat_pass2(arg1,arg2,arg3,arg4,arg5,(int const (*))arg6,(int const (*))arg7,(npy_cdouble_wrapper const (*))arg8,(int const (*))arg9,(int const (*))arg10,(npy_cdouble_wrapper const (*))arg11,arg12,arg13,arg14); + resultobj = SWIG_Py_Void(); + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + { + if (is_new_object11 && array11) Py_DECREF(array11); + } + return resultobj; +fail: + { + if (is_new_object6 && array6) Py_DECREF(array6); + } + { + if (is_new_object7 && array7) Py_DECREF(array7); + } + { + if (is_new_object8 && array8) Py_DECREF(array8); + } + { + if (is_new_object9 && array9) Py_DECREF(array9); + } + { + if (is_new_object10 && array10) Py_DECREF(array10); + } + { + if (is_new_object11 && array11) Py_DECREF(array11); + } + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bsr_matmat_pass2(PyObject *self, PyObject *args) { + int argc; + PyObject *argv[15]; + int ii; + + if (!PyTuple_Check(args)) SWIG_fail; + argc = (int)PyObject_Length(args); + for (ii = 0; (ii < argc) && (ii < 14); ii++) { + argv[ii] = PyTuple_GET_ITEM(args,ii); + } + if (argc == 14) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[4], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[13]) && PyArray_CanCastSafely(PyArray_TYPE(argv[13]),PyArray_BYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_matmat_pass2__SWIG_1(self, args); + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + if (argc == 14) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[4], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[13]) && PyArray_CanCastSafely(PyArray_TYPE(argv[13]),PyArray_UBYTE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_matmat_pass2__SWIG_2(self, args); + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + if (argc == 14) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[4], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[13]) && PyArray_CanCastSafely(PyArray_TYPE(argv[13]),PyArray_SHORT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_matmat_pass2__SWIG_3(self, args); + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + if (argc == 14) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[4], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[13]) && PyArray_CanCastSafely(PyArray_TYPE(argv[13]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_matmat_pass2__SWIG_4(self, args); + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + if (argc == 14) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[4], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[13]) && PyArray_CanCastSafely(PyArray_TYPE(argv[13]),PyArray_LONGLONG)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_matmat_pass2__SWIG_5(self, args); + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + if (argc == 14) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[4], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[13]) && PyArray_CanCastSafely(PyArray_TYPE(argv[13]),PyArray_FLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_matmat_pass2__SWIG_6(self, args); + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + if (argc == 14) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[4], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[13]) && PyArray_CanCastSafely(PyArray_TYPE(argv[13]),PyArray_DOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_matmat_pass2__SWIG_7(self, args); + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + if (argc == 14) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[4], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[13]) && PyArray_CanCastSafely(PyArray_TYPE(argv[13]),PyArray_CFLOAT)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_matmat_pass2__SWIG_8(self, args); + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + if (argc == 14) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[4], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + _v = (is_array(argv[5]) && PyArray_CanCastSafely(PyArray_TYPE(argv[5]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[6]) && PyArray_CanCastSafely(PyArray_TYPE(argv[6]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[7]) && PyArray_CanCastSafely(PyArray_TYPE(argv[7]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[8]) && PyArray_CanCastSafely(PyArray_TYPE(argv[8]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[9]) && PyArray_CanCastSafely(PyArray_TYPE(argv[9]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[10]) && PyArray_CanCastSafely(PyArray_TYPE(argv[10]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[11]) && PyArray_CanCastSafely(PyArray_TYPE(argv[11]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[12]) && PyArray_CanCastSafely(PyArray_TYPE(argv[12]),PyArray_INT)) ? 1 : 0; + } + if (_v) { + { + _v = (is_array(argv[13]) && PyArray_CanCastSafely(PyArray_TYPE(argv[13]),PyArray_CDOUBLE)) ? 1 : 0; + } + if (_v) { + return _wrap_bsr_matmat_pass2__SWIG_9(self, args); + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_matmat_pass2'.\n Possible C/C++ prototypes are:\n"" bsr_matmat_pass2<(int,signed char)>(int const,int const,int const,int const,int const,int const [],int const [],signed char const [],int const [],int const [],signed char const [],int [],int [],signed char [])\n"" bsr_matmat_pass2<(int,unsigned char)>(int const,int const,int const,int const,int const,int const [],int const [],unsigned char const [],int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"" bsr_matmat_pass2<(int,short)>(int const,int const,int const,int const,int const,int const [],int const [],short const [],int const [],int const [],short const [],int [],int [],short [])\n"" bsr_matmat_pass2<(int,int)>(int const,int const,int const,int const,int const,int const [],int const [],int const [],int const [],int const [],int const [],int [],int [],int [])\n"" bsr_matmat_pass2<(int,long long)>(int const,int const,int const,int const,int const,int const [],int const [],long long const [],int const [],int const [],long long const [],int [],int [],long long [])\n"" bsr_matmat_pass2<(int,float)>(int const,int const,int const,int const,int const,int const [],int const [],float const [],int const [],int const [],float const [],int [],int [],float [])\n"" bsr_matmat_pass2<(int,double)>(int const,int const,int const,int const,int const,int const [],int const [],double const [],int const [],int const [],double const [],int [],int [],double [])\n"" bsr_matmat_pass2<(int,npy_cfloat_wrapper)>(int const,int const,int const,int const,int const,int const [],int const [],npy_cfloat_wrapper const [],int const [],int const [],npy_cfloat_wrapper const [],int [],int [],npy_cfloat_wrapper [])\n"" bsr_matmat_pass2<(int,npy_cdouble_wrapper)>(int const,int const,int const,int const,int const,int const [],int const [],npy_cdouble_wrapper const [],int const [],int const [],npy_cdouble_wrapper const [],int [],int [],npy_cdouble_wrapper [])\n"); + return NULL; +} + + SWIGINTERN PyObject *_wrap_csr_matvec__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; @@ -51326,6 +53863,36 @@ " int Bp, int Bi, npy_cdouble_wrapper Bx, \n" " int Cp, int Ci, npy_cdouble_wrapper Cx)\n" ""}, + { (char *)"bsr_matmat_pass2", _wrap_bsr_matmat_pass2, METH_VARARGS, (char *)"\n" + "bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, \n" + " int Aj, signed char Ax, int Bp, int Bj, signed char Bx, \n" + " int Cp, int Cj, signed char Cx)\n" + "bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, \n" + " int Aj, unsigned char Ax, int Bp, int Bj, unsigned char Bx, \n" + " int Cp, int Cj, unsigned char Cx)\n" + "bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, \n" + " int Aj, short Ax, int Bp, int Bj, short Bx, \n" + " int Cp, int Cj, short Cx)\n" + "bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, \n" + " int Aj, int Ax, int Bp, int Bj, int Bx, int Cp, \n" + " int Cj, int Cx)\n" + "bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, \n" + " int Aj, long long Ax, int Bp, int Bj, long long Bx, \n" + " int Cp, int Cj, long long Cx)\n" + "bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, \n" + " int Aj, float Ax, int Bp, int Bj, float Bx, \n" + " int Cp, int Cj, float Cx)\n" + "bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, \n" + " int Aj, double Ax, int Bp, int Bj, double Bx, \n" + " int Cp, int Cj, double Cx)\n" + "bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, \n" + " int Aj, npy_cfloat_wrapper Ax, int Bp, int Bj, \n" + " npy_cfloat_wrapper Bx, int Cp, int Cj, npy_cfloat_wrapper Cx)\n" + "bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, \n" + " int Aj, npy_cdouble_wrapper Ax, int Bp, int Bj, \n" + " npy_cdouble_wrapper Bx, int Cp, int Cj, \n" + " npy_cdouble_wrapper Cx)\n" + ""}, { (char *)"csr_matvec", _wrap_csr_matvec, METH_VARARGS, (char *)"\n" "csr_matvec(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n" " signed char Xx, signed char Yx)\n" Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-25 17:09:35 UTC (rev 3717) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-25 22:41:38 UTC (rev 3718) @@ -46,7 +46,7 @@ class TestSparseTools(NumpyTestCase): """Simple benchmarks for sparse matrix module""" - def test_arithmetic(self,level=5): + def test_arithmetic(self,level=4): matrices = [] #matrices.append( ('A','Identity', spidentity(500**2,format='csr')) ) matrices.append( ('A','Poisson5pt', poisson2d(500,format='csr')) ) @@ -77,7 +77,8 @@ vars = dict( [(var,mat.asformat(format)) for (var,name,mat) in matrices ] ) for X,Y in [ ('A','A'),('A','B'),('B','A'),('B','B') ]: x,y = vars[X],vars[Y] - for op in ['__add__','__sub__','multiply','__div__','__mul__']: + #for op in ['__add__','__sub__','multiply','__div__','__mul__']: + for op in ['__mul__']: fn = getattr(x,op) fn(y) #warmup @@ -94,7 +95,7 @@ - def bench_sort(self,level=4): + def bench_sort(self,level=5): """sort CSR column indices""" matrices = [] matrices.append( ('Rand10', 1e4, 10) ) From scipy-svn at scipy.org Tue Dec 25 18:44:01 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 25 Dec 2007 17:44:01 -0600 (CST) Subject: [Scipy-svn] r3719 - in trunk/scipy/sparse: . tests Message-ID: <20071225234401.3EE0539C04A@new.scipy.org> Author: wnbell Date: 2007-12-25 17:43:46 -0600 (Tue, 25 Dec 2007) New Revision: 3719 Modified: trunk/scipy/sparse/block.py trunk/scipy/sparse/bsr.py trunk/scipy/sparse/compressed.py trunk/scipy/sparse/coo.py trunk/scipy/sparse/tests/test_base.py trunk/scipy/sparse/tests/test_sparse.py Log: added bsr_matrix docstring additional unittests Modified: trunk/scipy/sparse/block.py =================================================================== --- trunk/scipy/sparse/block.py 2007-12-25 22:41:38 UTC (rev 3718) +++ trunk/scipy/sparse/block.py 2007-12-25 23:43:46 UTC (rev 3719) @@ -45,9 +45,13 @@ raise ValueError, 'shape must be multiple of blocksize' self.indptr = zeros(self._swap((M/X,N/Y))[0] + 1, dtype=intc ) + + elif len(arg1) == 2: + # (data,(row,col)) format + self._set_self( coo_matrix(arg1).tobsr(blocksize=blocksize) ) elif len(arg1) == 3: - # data,indices,indptr format + # (data,indices,indptr) format (data, indices, indptr) = arg1 self.indices = array(indices, copy=copy) self.indptr = array(indptr, copy=copy) Modified: trunk/scipy/sparse/bsr.py =================================================================== --- trunk/scipy/sparse/bsr.py 2007-12-25 22:41:38 UTC (rev 3718) +++ trunk/scipy/sparse/bsr.py 2007-12-25 23:43:46 UTC (rev 3719) @@ -12,8 +12,78 @@ from sputils import isdense, upcast, isscalarlike class bsr_matrix(_block_matrix): - #TODO add docstring + """Block Sparse Row matrix + This can be instantiated in several ways: + - bsr_matrix(D, [blocksize=(R,C)]) + with a dense matrix or rank-2 ndarray D + + - bsr_matrix(S, [blocksize=(R,C)]) + with another sparse matrix S (equivalent to S.tocsr()) + + - bsr_matrix((M, N), [blocksize=(R,C), dtype]) + to construct an empty matrix with shape (M, N) + dtype is optional, defaulting to dtype='d'. + + - bsr_matrix((data, ij), [blocksize=(R,C), shape=(M, N)]) + where data, ij satisfy: + a[ij[0, k], ij[1, k]] = data[k] + + - bsr_matrix((data, indices, indptr), [shape=(M, N)]) + is the standard BSR representation where: + the block column indices for row i are stored in + indices[ indptr[i]: indices[i+1] ] + and their corresponding block values are stored in + data[ indptr[i]: indptr[i+1] ] + If the shape parameter is not supplied, the matrix dimensions + are inferred from the index arrays. + + + *Notes* + ------- + The blocksize (R,C) must evenly divide the shape of + the matrix (M,N). That is, R and C must satisfy the + relationship M % R = 0 and N % C = 0. + + The Block Compressed Row (BSR) format is very similar to the + Compressed Sparse Row (CSR) format. BSR is appropriate for + sparse matrices with dense sub matrices like the last example + below. Such matrices often arise, for instance, in finite + element discretizations. + + + *Examples* + ---------- + + >>> from scipy.sparse import * + >>> from scipy import * + >>> bsr_matrix( (3,4), dtype='i' ).todense() + matrix([[0, 0, 0, 0], + [0, 0, 0, 0], + [0, 0, 0, 0]]) + + >>> row = array([0,0,1,2,2,2]) + >>> col = array([0,2,2,0,1,2]) + >>> data = kron([1,2,3,4,5,6]) + >>> bsr_matrix( (data,(row,col)), shape=(3,3) ).todense() + matrix([[1, 0, 2], + [0, 0, 3], + [4, 5, 6]]) + + >>> indptr = array([0,2,3,6]) + >>> indices = array([0,2,2,0,1,2]) + >>> data = array([1,2,3,4,5,6]).repeat(4).reshape(6,2,2) + >>> bsr_matrix( (data,indices,indptr), shape=(6,6) ).todense() + matrix([[1, 1, 0, 0, 2, 2], + [1, 1, 0, 0, 2, 2], + [0, 0, 0, 0, 3, 3], + [0, 0, 0, 0, 3, 3], + [4, 4, 5, 5, 6, 6], + [4, 4, 5, 5, 6, 6]]) + + """ + + def __mul__(self, other): # self * other """ Scalar, vector, or matrix multiplication """ Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-25 22:41:38 UTC (rev 3718) +++ trunk/scipy/sparse/compressed.py 2007-12-25 23:43:46 UTC (rev 3719) @@ -456,6 +456,8 @@ The is an *in place* operation """ + self.sort_indices() + fn = sparsetools.csr_sum_duplicates M,N = self._swap(self.shape) fn( M, N, self.indptr, self.indices, self.data) Modified: trunk/scipy/sparse/coo.py =================================================================== --- trunk/scipy/sparse/coo.py 2007-12-25 22:41:38 UTC (rev 3718) +++ trunk/scipy/sparse/coo.py 2007-12-25 23:43:46 UTC (rev 3719) @@ -232,7 +232,6 @@ indptr, indices, data) A = csc_matrix((data, indices, indptr), self.shape) - A.sort_indices() A.sum_duplicates() return A Modified: trunk/scipy/sparse/tests/test_base.py =================================================================== --- trunk/scipy/sparse/tests/test_base.py 2007-12-25 22:41:38 UTC (rev 3718) +++ trunk/scipy/sparse/tests/test_base.py 2007-12-25 23:43:46 UTC (rev 3719) @@ -27,7 +27,6 @@ restore_path() -#TODO test spmatrix(DENSE) and spmatrix(SPARSE) for all combos #TODO test spmatrix( [[1,2],[3,4]] ) format #TODO check that invalid shape in constructor raises exception #TODO check that spmatrix( ... , copy=X ) is respected @@ -310,12 +309,17 @@ for format in ['bsr','coo','csc','csr','dia','dok','lil']: a = A.asformat(format) assert_equal(a.format,format) - assert_array_almost_equal(a.todense(), D) + assert_array_equal(a.todense(), D) b = self.spmatrix(D+3j).asformat(format) assert_equal(b.format,format) - assert_array_almost_equal(b.todense(), D+3j) + assert_array_equal(b.todense(), D+3j) + c = eval(format + '_matrix')(A) + assert_equal(c.format,format) + assert_array_equal(c.todense(), D) + + def check_todia(self): #TODO, add and test .todia(maxdiags) @@ -339,31 +343,9 @@ b = self.dat.transpose() assert_array_equal(a.todense(), b) assert_array_equal(a.transpose().todense(), self.dat) + + assert_array_equal( self.spmatrix((3,4)).T.todense(), zeros((4,3)) ) - def check_large(self): - # Create a 100x100 matrix with 100 non-zero elements - # and play around with it - #TODO move this out of Common since it doesn't use spmatrix - random.seed(0) - A = dok_matrix((100,100)) - for k in range(100): - i = random.randrange(100) - j = random.randrange(100) - A[i,j] = 1. - csr = A.tocsr() - csc = A.tocsc() - csc2 = csr.tocsc() - coo = A.tocoo() - csr2 = coo.tocsr() - assert_array_equal(A.transpose().todense(), csr.transpose().todense()) - assert_array_equal(csc.todense(), csr.todense()) - assert_array_equal(csr.todense(), csr2.todense()) - assert_array_equal(csr2.todense().transpose(), coo.transpose().todense()) - assert_array_equal(csr2.todense(), csc2.todense()) - csr_plus_csc = csr + csc - csc_plus_csr = csc + csr - assert_array_equal(csr_plus_csc.todense(), (2*A).todense()) - assert_array_equal(csr_plus_csc.todense(), csc_plus_csr.todense()) def check_add_dense(self): """ Check whether adding a dense matrix to a sparse matrix works @@ -1226,8 +1208,10 @@ def check_constructor1(self): pass #TODO add test + -class TestBSR(_TestCommon, _TestArithmetic, NumpyTestCase): +class TestBSR(_TestCommon, _TestArithmetic, _TestInplaceArithmetic, + _TestMatvecOutput, NumpyTestCase): spmatrix = bsr_matrix def check_constructor1(self): @@ -1277,16 +1261,7 @@ A = kron( [[1,0,2,0],[0,1,0,0],[0,0,0,0]], [[0,1,2],[3,0,5]] ) assert_equal(bsr_matrix(A,blocksize=(2,3)).todense(),A) - - - -#class TestBSC(_TestCommon, _TestArithmetic, NumpyTestCase): -# spmatrix = bsc_matrix -# -# def check_constructor1(self): -# pass -# #TODO add test if __name__ == "__main__": NumpyTest().run() Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-25 22:41:38 UTC (rev 3718) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-25 23:43:46 UTC (rev 3719) @@ -252,7 +252,33 @@ print output - +class TestLarge(NumpyTestCase): + def check_large(self): + # Create a 100x100 matrix with 100 non-zero elements + # and play around with it + #TODO move this out of Common since it doesn't use spmatrix + random.seed(0) + A = dok_matrix((100,100)) + for k in range(100): + i = random.randrange(100) + j = random.randrange(100) + A[i,j] = 1. + csr = A.tocsr() + csc = A.tocsc() + csc2 = csr.tocsc() + coo = A.tocoo() + csr2 = coo.tocsr() + assert_array_equal(A.transpose().todense(), csr.transpose().todense()) + assert_array_equal(csc.todense(), csr.todense()) + assert_array_equal(csr.todense(), csr2.todense()) + assert_array_equal(csr2.todense().transpose(), coo.transpose().todense()) + assert_array_equal(csr2.todense(), csc2.todense()) + csr_plus_csc = csr + csc + csc_plus_csr = csc + csr + assert_array_equal(csr_plus_csc.todense(), (2*A).todense()) + assert_array_equal(csr_plus_csc.todense(), csc_plus_csr.todense()) + + if __name__ == "__main__": NumpyTest().run() From scipy-svn at scipy.org Tue Dec 25 19:04:30 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 25 Dec 2007 18:04:30 -0600 (CST) Subject: [Scipy-svn] r3720 - trunk/scipy/sparse Message-ID: <20071226000430.7A25F39C02D@new.scipy.org> Author: wnbell Date: 2007-12-25 18:03:49 -0600 (Tue, 25 Dec 2007) New Revision: 3720 Modified: trunk/scipy/sparse/compressed.py trunk/scipy/sparse/csr.py Log: small edit Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-25 23:43:46 UTC (rev 3719) +++ trunk/scipy/sparse/compressed.py 2007-12-26 00:03:49 UTC (rev 3720) @@ -175,7 +175,7 @@ if numpy.diff(self.indptr).min() < 0: raise ValueError,'index pointer values must form a " \ "non-decreasing sequence' - + #if not self.has_sorted_indices(): # warn('Indices were not in sorted order. Sorting indices.') # self.sort_indices() Modified: trunk/scipy/sparse/csr.py =================================================================== --- trunk/scipy/sparse/csr.py 2007-12-25 23:43:46 UTC (rev 3719) +++ trunk/scipy/sparse/csr.py 2007-12-26 00:03:49 UTC (rev 3720) @@ -160,8 +160,10 @@ self.shape = (M, N) indxs = numpy.where(col == self.indices[self.indptr[row]:self.indptr[row+1]]) + if len(indxs[0]) == 0: #value not present + self.sort_indices() newindx = self.indices[self.indptr[row]:self.indptr[row+1]].searchsorted(col) newindx += self.indptr[row] From scipy-svn at scipy.org Tue Dec 25 20:50:45 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 25 Dec 2007 19:50:45 -0600 (CST) Subject: [Scipy-svn] r3721 - trunk/scipy/sparse Message-ID: <20071226015045.900C639C03A@new.scipy.org> Author: wnbell Date: 2007-12-25 19:50:00 -0600 (Tue, 25 Dec 2007) New Revision: 3721 Modified: trunk/scipy/sparse/compressed.py trunk/scipy/sparse/csc.py trunk/scipy/sparse/csr.py Log: consolidated getitem Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-26 00:03:49 UTC (rev 3720) +++ trunk/scipy/sparse/compressed.py 2007-12-26 01:50:00 UTC (rev 3721) @@ -7,13 +7,14 @@ import numpy from numpy import array, matrix, asarray, asmatrix, zeros, rank, intc, \ - empty, hstack, isscalar, ndarray, shape, searchsorted, empty_like + empty, hstack, isscalar, ndarray, shape, searchsorted, empty_like, \ + where from base import spmatrix, isspmatrix from data import _data_matrix import sparsetools from sputils import upcast, to_native, isdense, isshape, getdtype, \ - isscalarlike + isscalarlike, isintlike @@ -389,7 +390,57 @@ return spmatrix.sum(self,axis) raise ValueError, "axis out of bounds" + def _get_single_element(self,row,col): + M, N = self.shape + if (row < 0): + row = M + row + if (col < 0): + col = N + col + if not (0<=row= 1" + #TODO make [i,:] faster + #TODO implement [i,x:y:z] + indices = [] for ind in xrange(self.indptr[i], self.indptr[i+1]): Modified: trunk/scipy/sparse/csc.py =================================================================== --- trunk/scipy/sparse/csc.py 2007-12-26 00:03:49 UTC (rev 3720) +++ trunk/scipy/sparse/csc.py 2007-12-26 01:50:00 UTC (rev 3721) @@ -92,61 +92,6 @@ for r in xrange(self.shape[0]): yield csr[r,:] - def __getitem__(self, key): - #TODO unify these in _cs_matrix - if isinstance(key, tuple): - row = key[0] - col = key[1] - - if isinstance(col, slice): - # Returns a new matrix! - return self.get_submatrix( row, col ) - elif isinstance(row, slice): - return self._getslice(row, col) - - M, N = self.shape - if (row < 0): - row = M + row - if (col < 0): - col = N + col - if not (0<=row Author: mattknox_ca Date: 2007-12-26 13:34:43 -0600 (Wed, 26 Dec 2007) New Revision: 3722 Modified: trunk/scipy/sandbox/timeseries/plotlib.py Log: removed / commented out some print statements Modified: trunk/scipy/sandbox/timeseries/plotlib.py =================================================================== --- trunk/scipy/sandbox/timeseries/plotlib.py 2007-12-26 01:50:00 UTC (rev 3721) +++ trunk/scipy/sandbox/timeseries/plotlib.py 2007-12-26 19:34:43 UTC (rev 3722) @@ -537,7 +537,6 @@ def _set_default_format(self, vmin, vmax): "Returns the default ticks spacing." - print "CALLING FINDER",vmin,vmax info = self.finder(vmin, vmax, self.freq, True) if self.isminor: format = numpy.compress(info['min'] & numpy.logical_not(info['maj']), @@ -603,8 +602,8 @@ #...................................................... def set_ydata(self, series=None): """Sets the base time series.""" - if self._series is not None: - print "WARNING ! Base series is being changed.""" + #if self._series is not None: + # print "WARNING ! Base series is being changed.""" self._series = series.ravel() if isinstance(series, TimeSeries): self.xdata = self.series.dates @@ -696,9 +695,6 @@ def tsplot(self,*parms,**kwargs): """Plots the data parsed in argument. This command accepts the same keywords as matplotlib.plot.""" -# parms = tuple(list(parms) + kwargs.pop('series',None)) -# print "Parameters: %s - %i" % (parms, len(parms)) -# print "OPtions: %s - %i" % (kwargs, len(kwargs)) parms = self._check_plot_params(*parms) self.legendlabels.append(kwargs.get('label',None)) plotted = Subplot.plot(self, *parms,**kwargs) From scipy-svn at scipy.org Thu Dec 27 02:25:49 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 27 Dec 2007 01:25:49 -0600 (CST) Subject: [Scipy-svn] r3723 - branches/testing_cleanup/scipy/sandbox/exmplpackage/tests Message-ID: <20071227072549.DE13239C060@new.scipy.org> Author: fperez Date: 2007-12-27 01:25:42 -0600 (Thu, 27 Dec 2007) New Revision: 3723 Added: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/README.txt branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/decorators.py branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py Log: Minimal implementation of nose support. Added: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/README.txt =================================================================== --- branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/README.txt 2007-12-26 19:34:43 UTC (rev 3722) +++ branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/README.txt 2007-12-27 07:25:42 UTC (rev 3723) @@ -0,0 +1,42 @@ +============ + Nose tests +============ + +SciPy will use, and require nose for all testing. It will be possible for +users to use all of scipy without nose on their systems, but *not* to run the +test suite. + +Labels +====== + +We are going to use labels for tests, instead of the old level system. For +now, we'll use 'slow' as a label for slow-running tests, and will make more if +needed in the future for speed considerations. + +Labels will be implemented as one decorator per test. All pre-defined labels +are implemented in numpy.testing.decorators + +This would run all tests, since nose by default discovers everything:: + nosetests -s test_foo.py + +this:: + nosetests -s -A slow test_foo.py + +will only run tests labeled 'slow' (for which there's a decorator) and this:: + nosetests -s -A "not slow" test_foo.py + +will *exclude* all slow tests from a run. + +The scipy.test() function call will expose the above with convenient syntax. + +Initially we only have the @slow decorator, later we may provide new ones as +the need for them arises in actual use. + + +Benchmark tests +=============== + +Routines that don't actually test correctness but instead do performance +benchmarking will live in a benchmarks/ directory next to the tests/ directory +of each module. There will be a scipy.benchmark() call that does benchmarking, +similar to scipy.test() but separate from it. Added: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/decorators.py =================================================================== --- branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/decorators.py 2007-12-26 19:34:43 UTC (rev 3722) +++ branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/decorators.py 2007-12-27 07:25:42 UTC (rev 3723) @@ -0,0 +1,13 @@ +"""Decorators for labeling test objects.""" + +def slow(t): + """Labels a test as 'slow'. + + The exact definition of a slow test is obviously both subjective and + hardware-dependent, but in general any individual test that requires more + than a second or two should be labeled as slow (the whole suite consits of + thousands of tests, so even a second is significant).""" + + t.slow = True + return t + Added: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py =================================================================== --- branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py 2007-12-26 19:34:43 UTC (rev 3722) +++ branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py 2007-12-27 07:25:42 UTC (rev 3723) @@ -0,0 +1,38 @@ +""" +Cleaned-up NumpyTestCase class, to be moved into numpy.testing later... +""" + +import unittest + +class NumpyTestCase2(unittest.TestCase): + """New implementation of NumpyTestCase that is nose-friendly. + + It is slated for replacing the base one eventually, but it will be first + used in scipy's testing. Once everything is OK there, it will be used + into all of numpy.""" + + def measure(self,code_str,times=1): + """ Return elapsed time for executing code_str in the + namespace of the caller for given times. + """ + frame = get_frame(1) + locs,globs = frame.f_locals,frame.f_globals + code = compile(code_str, + 'NumpyTestCase runner for '+self.__class__.__name__, + 'exec') + i = 0 + elapsed = jiffies() + while i>sys.stderr,yellow_text('Warning: %s' % (message)) + sys.stderr.flush() + + def info(self, message): + print>>sys.stdout, message + sys.stdout.flush() Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py =================================================================== --- branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py 2007-12-26 19:34:43 UTC (rev 3722) +++ branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py 2007-12-27 07:25:42 UTC (rev 3723) @@ -1,36 +1,94 @@ -#!/usr/bin/env python -# -# Created by: Pearu Peterson, October 2003 -# Adjusted to numpy.distutils: Pearu Peterson, October 2005 -# -__usage__ = """ -First ensure that scipy core modules are installed. +"""Example SciPy test module, using nose features. -Build exmplpackage: - python setup.py build -Run tests locally: - python tests/test_foo.py [-l] [-v] +For information on nose, see: -Run tests if scipy is installed: - python -c 'import scipy;scipy.exmplpackage.test(level=,verbosity=)' + http://somethingaboutorange.com/mrl/projects/nose + +To run it in its simplest form:: + nosetests test_foo.py + + +Labels will be implemented as one decorator per test. All pre-defined labels +are implemented in numpy.testing.decorators + +This would run all tests, since nose by default discovers everything:: + nosetests -s test_foo.py + +this:: + nosetests -s -A slow test_foo.py + +will only run tests labeled 'slow' (for which there's a decorator) and this:: + nosetests -s -A "not slow" test_foo.py + +will *exclude* all slow tests from a run. """ -import sys -from numpy.test.testing import * +from numpy.testing import NumpyTestCase -set_package_path() -from exmplpackage.foo import * -del sys.path[0] +import nose -class TestFooBar(NumpyTestCase): +# These two modules will need to be later put in the right places... +from ntest import NumpyTestCase2 +import decorators as dec - def check_simple(self, level=1): - assert exmplpackage_foo_bar()=='Hello from exmplpackage_foo_bar' +def setup(): + """Module-level setup""" + print 'doing setup' -class TestFooGun(NumpyTestCase): +def teardown(): + """Module-level teardown""" + print 'doing teardown' - def check_simple(self, level=1): - assert foo_gun()=='Hello from foo_gun' -if __name__ == "__main__": - NumpyTest().run() +class ClassicTest(NumpyTestCase2): + """A regular unittest, with the extra Numpy features.""" + def test_1(self): + print 'First test' + + def test_2(self): + print 'Second test' + + # This is how to tag a test as slow + @dec.slow + def test_big(self,level=5): + print 'Big, slow test' + +def test_simplefunction(): + """A simple test function.""" + assert True + +def check_even(n, nn): + """A check function to be used in a test generator.""" + assert n % 2 == 0 or nn % 2 == 0 + +# Test generators are best left without docstring, so nose (in verbose mode) +# shows the actual call they produce automatically, including arguments. +def test_evens(): + for i in range(0,4,2): + yield check_even, i, i*3 + +def setup_func(): + """A trivial setup function.""" + print "In setup_func" + +def teardown_func(): + """A trivial teardown function.""" + print "In teardown_func" + + at nose.with_setup(setup_func, teardown_func) +def test_with_extras(): + """This test uses the setup/teardown functions.""" + print " In test_with_extras" + +# Setup and teardown functions may be used with test generators. The setup and +# teardown attributes must be attached to the generator function: + at nose.with_setup(setup_func, teardown_func) +def test_generator(): + for i in range(6,10,2): + yield check_even, i, i*3 + + at dec.slow +def test_nasty(): + "A difficult test that takes a long time..." + print '*** nasty slow test ***' + From scipy-svn at scipy.org Thu Dec 27 02:46:04 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 27 Dec 2007 01:46:04 -0600 (CST) Subject: [Scipy-svn] r3724 - branches/testing_cleanup/scipy/sandbox/exmplpackage/tests Message-ID: <20071227074604.6C9D739C06A@new.scipy.org> Author: fperez Date: 2007-12-27 01:45:58 -0600 (Thu, 27 Dec 2007) New Revision: 3724 Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py Log: Cleanup. Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py =================================================================== --- branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py 2007-12-27 07:25:42 UTC (rev 3723) +++ branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py 2007-12-27 07:45:58 UTC (rev 3724) @@ -1,38 +1,32 @@ +"""Simple testing utilities, to eventually be put into numpy.testing """ -Cleaned-up NumpyTestCase class, to be moved into numpy.testing later... -""" -import unittest +import sys -class NumpyTestCase2(unittest.TestCase): - """New implementation of NumpyTestCase that is nose-friendly. +from numpy.distutils.misc_util import yellow_text +from numpy.testing.utils import jiffies - It is slated for replacing the base one eventually, but it will be first - used in scipy's testing. Once everything is OK there, it will be used - into all of numpy.""" +def measure(code_str,times=1): + """ Return elapsed time for executing code_str in the + namespace of the caller for given times. + """ + frame = sys.get_frame(1) + locs,globs = frame.f_locals,frame.f_globals + code = compile(code_str, + 'NumpyTestCase runner for '+self.__class__.__name__, + 'exec') + i = 0 + elapsed = jiffies() + while i> sys.stderr,yellow_text('Warning: %s' % (message)) + sys.stderr.flush() - def warn(self, message): - from numpy.distutils.misc_util import yellow_text - print>>sys.stderr,yellow_text('Warning: %s' % (message)) - sys.stderr.flush() - - def info(self, message): - print>>sys.stdout, message - sys.stdout.flush() +def info(message): + print >> sys.stdout, message + sys.stdout.flush() From scipy-svn at scipy.org Thu Dec 27 02:49:02 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 27 Dec 2007 01:49:02 -0600 (CST) Subject: [Scipy-svn] r3725 - branches/testing_cleanup/scipy/sandbox/exmplpackage/tests Message-ID: <20071227074902.7964F39C06A@new.scipy.org> Author: fperez Date: 2007-12-27 01:48:58 -0600 (Thu, 27 Dec 2007) New Revision: 3725 Added: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/tstsupport.py Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py Log: Further cleanup Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py =================================================================== --- branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py 2007-12-27 07:45:58 UTC (rev 3724) +++ branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py 2007-12-27 07:48:58 UTC (rev 3725) @@ -23,14 +23,10 @@ will *exclude* all slow tests from a run. """ -from numpy.testing import NumpyTestCase +# This single import statement should provide all the common functionality for +# scipy tests in a single location. +from tstsupport import * -import nose - -# These two modules will need to be later put in the right places... -from ntest import NumpyTestCase2 -import decorators as dec - def setup(): """Module-level setup""" print 'doing setup' @@ -40,7 +36,7 @@ print 'doing teardown' -class ClassicTest(NumpyTestCase2): +class ClassicTest(TestCase): """A regular unittest, with the extra Numpy features.""" def test_1(self): print 'First test' Added: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/tstsupport.py =================================================================== --- branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/tstsupport.py 2007-12-27 07:45:58 UTC (rev 3724) +++ branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/tstsupport.py 2007-12-27 07:48:58 UTC (rev 3725) @@ -0,0 +1,13 @@ +"""Common test support for all scipy test scripts. + +This single module should provide all the common functionality for scipy tests +in a single location, so that test script can just import it and work right +away. +""" + +import nose + +# These two modules will need to be later put in the right places... +import decorators as dec + +from ntest import * From scipy-svn at scipy.org Thu Dec 27 02:49:25 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 27 Dec 2007 01:49:25 -0600 (CST) Subject: [Scipy-svn] r3726 - branches/testing_cleanup/scipy/sandbox/exmplpackage/tests Message-ID: <20071227074925.6036139C150@new.scipy.org> Author: fperez Date: 2007-12-27 01:49:22 -0600 (Thu, 27 Dec 2007) New Revision: 3726 Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/tstsupport.py Log: Further cleanup Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/tstsupport.py =================================================================== --- branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/tstsupport.py 2007-12-27 07:48:58 UTC (rev 3725) +++ branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/tstsupport.py 2007-12-27 07:49:22 UTC (rev 3726) @@ -5,6 +5,8 @@ away. """ +from unittest import TestCase + import nose # These two modules will need to be later put in the right places... From scipy-svn at scipy.org Thu Dec 27 02:56:45 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 27 Dec 2007 01:56:45 -0600 (CST) Subject: [Scipy-svn] r3727 - branches/testing_cleanup/scipy/sandbox/exmplpackage/tests Message-ID: <20071227075645.B148C39C150@new.scipy.org> Author: fperez Date: 2007-12-27 01:56:42 -0600 (Thu, 27 Dec 2007) New Revision: 3727 Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py Log: Further cleanup... Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py =================================================================== --- branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py 2007-12-27 07:49:22 UTC (rev 3726) +++ branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py 2007-12-27 07:56:42 UTC (rev 3727) @@ -6,14 +6,15 @@ from numpy.distutils.misc_util import yellow_text from numpy.testing.utils import jiffies -def measure(code_str,times=1): +def measure(code_str,times=1,test_name=None): """ Return elapsed time for executing code_str in the namespace of the caller for given times. """ frame = sys.get_frame(1) locs,globs = frame.f_locals,frame.f_globals + code = compile(code_str, - 'NumpyTestCase runner for '+self.__class__.__name__, + 'Test name: %s '+test_name, 'exec') i = 0 elapsed = jiffies() From scipy-svn at scipy.org Thu Dec 27 02:58:58 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 27 Dec 2007 01:58:58 -0600 (CST) Subject: [Scipy-svn] r3728 - branches/testing_cleanup/scipy/sandbox/exmplpackage/tests Message-ID: <20071227075858.AF8CF39C15A@new.scipy.org> Author: fperez Date: 2007-12-27 01:58:54 -0600 (Thu, 27 Dec 2007) New Revision: 3728 Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py Log: Further cleanup... Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py =================================================================== --- branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py 2007-12-27 07:56:42 UTC (rev 3727) +++ branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py 2007-12-27 07:58:54 UTC (rev 3728) @@ -10,7 +10,7 @@ """ Return elapsed time for executing code_str in the namespace of the caller for given times. """ - frame = sys.get_frame(1) + frame = sys._get_frame(1) locs,globs = frame.f_locals,frame.f_globals code = compile(code_str, Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py =================================================================== --- branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py 2007-12-27 07:56:42 UTC (rev 3727) +++ branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py 2007-12-27 07:58:54 UTC (rev 3728) @@ -88,3 +88,9 @@ "A difficult test that takes a long time..." print '*** nasty slow test ***' + + +def test_time(): + "A simple test that times things" + x = 1 + measure("x+1",'test_time') From scipy-svn at scipy.org Thu Dec 27 02:59:50 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 27 Dec 2007 01:59:50 -0600 (CST) Subject: [Scipy-svn] r3729 - branches/testing_cleanup/scipy/sandbox/exmplpackage/tests Message-ID: <20071227075950.9067139C1DB@new.scipy.org> Author: fperez Date: 2007-12-27 01:59:45 -0600 (Thu, 27 Dec 2007) New Revision: 3729 Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py Log: Further cleanup... Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py =================================================================== --- branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py 2007-12-27 07:58:54 UTC (rev 3728) +++ branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py 2007-12-27 07:59:45 UTC (rev 3729) @@ -10,11 +10,11 @@ """ Return elapsed time for executing code_str in the namespace of the caller for given times. """ - frame = sys._get_frame(1) + frame = sys._getframe(1) locs,globs = frame.f_locals,frame.f_globals code = compile(code_str, - 'Test name: %s '+test_name, + 'Test name: %s ' % test_name, 'exec') i = 0 elapsed = jiffies() From scipy-svn at scipy.org Thu Dec 27 03:02:22 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 27 Dec 2007 02:02:22 -0600 (CST) Subject: [Scipy-svn] r3730 - branches/testing_cleanup/scipy/sandbox/exmplpackage/tests Message-ID: <20071227080222.6832139C15A@new.scipy.org> Author: fperez Date: 2007-12-27 02:02:19 -0600 (Thu, 27 Dec 2007) New Revision: 3730 Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py Log: Fix a few small problems Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py =================================================================== --- branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py 2007-12-27 07:59:45 UTC (rev 3729) +++ branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py 2007-12-27 08:02:19 UTC (rev 3730) @@ -89,8 +89,8 @@ print '*** nasty slow test ***' - def test_time(): "A simple test that times things" x = 1 - measure("x+1",'test_time') + time=measure("x+1",test_name='test_time') + info('Time taken: %s' % time) From scipy-svn at scipy.org Thu Dec 27 03:05:06 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 27 Dec 2007 02:05:06 -0600 (CST) Subject: [Scipy-svn] r3731 - branches/testing_cleanup/scipy/sandbox/exmplpackage/tests Message-ID: <20071227080506.00C3839C09E@new.scipy.org> Author: fperez Date: 2007-12-27 02:05:04 -0600 (Thu, 27 Dec 2007) New Revision: 3731 Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py Log: API cleanup Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py =================================================================== --- branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py 2007-12-27 08:02:19 UTC (rev 3730) +++ branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py 2007-12-27 08:05:04 UTC (rev 3731) @@ -6,7 +6,7 @@ from numpy.distutils.misc_util import yellow_text from numpy.testing.utils import jiffies -def measure(code_str,times=1,test_name=None): +def measure(code_str,times=1,label=None): """ Return elapsed time for executing code_str in the namespace of the caller for given times. """ Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py =================================================================== --- branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py 2007-12-27 08:02:19 UTC (rev 3730) +++ branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py 2007-12-27 08:05:04 UTC (rev 3731) @@ -92,5 +92,5 @@ def test_time(): "A simple test that times things" x = 1 - time=measure("x+1",test_name='test_time') + time = measure("x+1",times=100,label='test_time') info('Time taken: %s' % time) From scipy-svn at scipy.org Thu Dec 27 03:06:03 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 27 Dec 2007 02:06:03 -0600 (CST) Subject: [Scipy-svn] r3732 - branches/testing_cleanup/scipy/sandbox/exmplpackage/tests Message-ID: <20071227080603.F1B0739C09E@new.scipy.org> Author: fperez Date: 2007-12-27 02:06:01 -0600 (Thu, 27 Dec 2007) New Revision: 3732 Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py Log: API cleanup Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py =================================================================== --- branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py 2007-12-27 08:05:04 UTC (rev 3731) +++ branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py 2007-12-27 08:06:01 UTC (rev 3732) @@ -94,3 +94,8 @@ x = 1 time = measure("x+1",times=100,label='test_time') info('Time taken: %s' % time) + +def test_warn(): + "A simple test that prints a warning." + warn('Bad things are happening...') + From scipy-svn at scipy.org Thu Dec 27 03:07:02 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 27 Dec 2007 02:07:02 -0600 (CST) Subject: [Scipy-svn] r3733 - branches/testing_cleanup/scipy/sandbox/exmplpackage/tests Message-ID: <20071227080702.2B5D339C09E@new.scipy.org> Author: fperez Date: 2007-12-27 02:07:00 -0600 (Thu, 27 Dec 2007) New Revision: 3733 Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py Log: Small fix Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py =================================================================== --- branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py 2007-12-27 08:06:01 UTC (rev 3732) +++ branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py 2007-12-27 08:07:00 UTC (rev 3733) @@ -14,7 +14,7 @@ locs,globs = frame.f_locals,frame.f_globals code = compile(code_str, - 'Test name: %s ' % test_name, + 'Test name: %s ' % label, 'exec') i = 0 elapsed = jiffies() From scipy-svn at scipy.org Thu Dec 27 03:11:27 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 27 Dec 2007 02:11:27 -0600 (CST) Subject: [Scipy-svn] r3734 - branches/testing_cleanup/scipy/sandbox/exmplpackage/tests Message-ID: <20071227081127.34C3A39C11F@new.scipy.org> Author: fperez Date: 2007-12-27 02:11:24 -0600 (Thu, 27 Dec 2007) New Revision: 3734 Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py Log: Add error() function Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py =================================================================== --- branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py 2007-12-27 08:07:00 UTC (rev 3733) +++ branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/ntest.py 2007-12-27 08:11:24 UTC (rev 3734) @@ -3,7 +3,7 @@ import sys -from numpy.distutils.misc_util import yellow_text +from numpy.distutils.misc_util import yellow_text, red_text from numpy.testing.utils import jiffies def measure(code_str,times=1,label=None): @@ -24,10 +24,14 @@ elapsed = jiffies() - elapsed return 0.01*elapsed +def info(message): + print >> sys.stdout, message + sys.stdout.flush() + def warn(message): print >> sys.stderr,yellow_text('Warning: %s' % (message)) sys.stderr.flush() -def info(message): - print >> sys.stdout, message - sys.stdout.flush() +def error(message): + print >> sys.stderr,red_text('Error: %s' % (message)) + sys.stderr.flush() Modified: branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py =================================================================== --- branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py 2007-12-27 08:07:00 UTC (rev 3733) +++ branches/testing_cleanup/scipy/sandbox/exmplpackage/tests/test_foo.py 2007-12-27 08:11:24 UTC (rev 3734) @@ -99,3 +99,7 @@ "A simple test that prints a warning." warn('Bad things are happening...') +def test_error(): + "A simple test that prints an error message." + error('Really bad things are happening...') + From scipy-svn at scipy.org Thu Dec 27 17:53:41 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 27 Dec 2007 16:53:41 -0600 (CST) Subject: [Scipy-svn] r3736 - in trunk/scipy/weave: . scxx tests Message-ID: <20071227225341.47ADB39C30D@new.scipy.org> Author: fperez Date: 2007-12-27 16:53:35 -0600 (Thu, 27 Dec 2007) New Revision: 3736 Modified: trunk/scipy/weave/c_spec.py trunk/scipy/weave/inline_tools.py trunk/scipy/weave/scxx/object.h trunk/scipy/weave/tests/test_c_spec.py trunk/scipy/weave/tests/test_numpy_scalar_spec.py trunk/scipy/weave/tests/test_scxx_dict.py trunk/scipy/weave/tests/test_scxx_object.py trunk/scipy/weave/tests/test_scxx_sequence.py trunk/scipy/weave/tests/test_wx_spec.py trunk/scipy/weave/wx_spec.py Log: Merge into trunk all the work done by Min (Benjamin Ragan Kelley) on the weave cleanup branch. Revisions merged: 3652:3734. Note that there is still a wx test failing, and the weave.test(10) behavior is still not fully correct, as it seems to be compiling some files in directories it shouldn't. But considering how when Min started there were upwards of 30 failures of all kinds, the situation is much improved. After Matthew commits all the testing updates to make it easier to write more tests, the weave cleanup work should be continued. Modified: trunk/scipy/weave/c_spec.py =================================================================== --- trunk/scipy/weave/c_spec.py 2007-12-27 22:48:27 UTC (rev 3735) +++ trunk/scipy/weave/c_spec.py 2007-12-27 22:53:35 UTC (rev 3736) @@ -310,7 +310,7 @@ num_to_c_types['H'] = 'npy_ushort' num_to_c_types['i'] = 'int' num_to_c_types['I'] = 'npy_uint' - +num_to_c_types['?'] = 'bool' num_to_c_types['l'] = 'long' num_to_c_types['L'] = 'npy_ulong' Modified: trunk/scipy/weave/inline_tools.py =================================================================== --- trunk/scipy/weave/inline_tools.py 2007-12-27 22:48:27 UTC (rev 3735) +++ trunk/scipy/weave/inline_tools.py 2007-12-27 22:53:35 UTC (rev 3736) @@ -340,7 +340,25 @@ # we try 3 levels here -- a local cache first, then the # catalog cache, and then persistent catalog. # - global function_cache + global function_catalog + # 1. try local cache + try: + results = apply(function_cache[code],(local_dict,global_dict)) + return results + except TypeError, msg: + msg = str(msg).strip() + if msg[:16] == "Conversion Error": + pass + else: + raise TypeError, msg + except NameError, msg: + msg = str(msg).strip() + if msg[:16] == "Conversion Error": + pass + else: + raise NameError, msg + except KeyError: + pass # 2. try catalog cache. function_list = function_catalog.get_functions_fast(code) for func in function_list: Modified: trunk/scipy/weave/scxx/object.h =================================================================== --- trunk/scipy/weave/scxx/object.h 2007-12-27 22:48:27 UTC (rev 3735) +++ trunk/scipy/weave/scxx/object.h 2007-12-27 22:53:35 UTC (rev 3736) @@ -866,6 +866,10 @@ object _other = object(other); return operator=(_other); } + keyed_ref& operator=(const keyed_ref& other) { + object _other = object(other); + return operator=(_other); + } }; } // namespace Modified: trunk/scipy/weave/tests/test_c_spec.py =================================================================== --- trunk/scipy/weave/tests/test_c_spec.py 2007-12-27 22:48:27 UTC (rev 3735) +++ trunk/scipy/weave/tests/test_c_spec.py 2007-12-27 22:53:35 UTC (rev 3736) @@ -17,6 +17,7 @@ restore_path() + def unique_mod(d,file_name): f = os.path.basename(unique_file(d,file_name)) m = os.path.splitext(f)[0] @@ -48,7 +49,24 @@ # Scalar conversion test classes # int, float, complex #---------------------------------------------------------------------------- -class TestIntConverter(NumpyTestCase): +# compilers = [] +# for c in ('gcc','msvc'): +# mod_name = 'empty' + c +# mod_name = unique_mod(test_dir,mod_name) +# mod = ext_tools.ext_module(mod_name) +# # a = 1 +# # code = "a=2;" +# # test = ext_tools.ext_function('test',code,['a']) +# # mod.add_function(test) +# try: +# mod.compile(location = test_dir, compiler = c) +# except CompileError: +# print "Probably don't have Compiler: %s"%c +# else: +# compilers.append(c) + + +class IntConverter(NumpyTestCase): compiler = '' def check_type_match_string(self,level=5): s = c_spec.int_converter() @@ -103,11 +121,11 @@ assert( c == 3) -class TestFloatConverter(NumpyTestCase): +class FloatConverter(NumpyTestCase): compiler = '' def check_type_match_string(self,level=5): s = c_spec.float_converter() - assert( not s.type_match('string') ) + assert( not s.type_match('string')) def check_type_match_int(self,level=5): s = c_spec.float_converter() assert(not s.type_match(5)) @@ -158,7 +176,7 @@ c = test(b) assert( c == 3.) -class TestComplexConverter(NumpyTestCase): +class ComplexConverter(NumpyTestCase): compiler = '' def check_type_match_string(self,level=5): s = c_spec.complex_converter() @@ -216,7 +234,7 @@ # File conversion tests #---------------------------------------------------------------------------- -class TestFileConverter(NumpyTestCase): +class FileConverter(NumpyTestCase): compiler = '' def check_py_to_file(self,level=5): import tempfile @@ -250,14 +268,14 @@ # Instance conversion tests #---------------------------------------------------------------------------- -class TestInstanceConverter(NumpyTestCase): +class InstanceConverter(NumpyTestCase): pass #---------------------------------------------------------------------------- # Callable object conversion tests #---------------------------------------------------------------------------- -class TestCallableConverter(NumpyTestCase): +class CallableConverter(NumpyTestCase): compiler='' def check_call_function(self,level=5): import string @@ -277,7 +295,7 @@ desired = func(search_str,sub_str) assert(desired == actual) -class TestSequenceConverter(NumpyTestCase): +class SequenceConverter(NumpyTestCase): compiler = '' def check_convert_to_dict(self,level=5): d = {} @@ -292,7 +310,7 @@ t = () inline_tools.inline("",['t'],compiler=self.compiler,force=1) -class TestStringConverter(NumpyTestCase): +class StringConverter(NumpyTestCase): compiler = '' def check_type_match_string(self,level=5): s = c_spec.string_converter() @@ -347,7 +365,7 @@ c = test(b) assert( c == 'hello') -class TestListConverter(NumpyTestCase): +class ListConverter(NumpyTestCase): compiler = '' def check_type_match_bad(self,level=5): s = c_spec.list_converter() @@ -458,7 +476,7 @@ print 'python:', t2 - t1 assert( sum1 == sum2 and sum1 == sum3) -class TestTupleConverter(NumpyTestCase): +class TupleConverter(NumpyTestCase): compiler = '' def check_type_match_bad(self,level=5): s = c_spec.tuple_converter() @@ -511,7 +529,7 @@ assert( c == ('hello',None)) -class TestDictConverter(NumpyTestCase): +class DictConverter(NumpyTestCase): """ Base Class for dictionary conversion tests. """ @@ -570,86 +588,100 @@ c = test(b) assert( c['hello'] == 5) -class TestMsvcIntConverter(TestIntConverter): - compiler = 'msvc' -class TestUnixIntConverter(TestIntConverter): - compiler = '' -class TestGccIntConverter(TestIntConverter): - compiler = 'gcc' +# for compiler in compilers: + # for name,klass in globals().iteritems(): + # if name[:4]=="Test" and name[-9:] == "Converter": + # exec("class %s%s(%s):\n compiler = '%s'"%(name,compiler,name,compiler)) +# for converter in +for _n in dir(): + if _n[-9:]=='Converter': + if msvc_exists(): + exec "class Test%sMsvc(%s):\n compiler = 'msvc'"%(_n,_n) + else: + exec "class Test%sUnix(%s):\n compiler = ''"%(_n,_n) + if gcc_exists(): + exec "class Test%sGcc(%s):\n compiler = 'gcc'"%(_n,_n) -class TestMsvcFloatConverter(TestFloatConverter): - compiler = 'msvc' +# class TestMsvcIntConverter(TestIntConverter): +# compiler = 'msvc' +# class TestUnixIntConverter(TestIntConverter): +# compiler = '' +# class TestGccIntConverter(TestIntConverter): +# compiler = 'gcc' +# +# class TestMsvcFloatConverter(TestFloatConverter): +# compiler = 'msvc' +# +# class TestMsvcFloatConverter(TestFloatConverter): +# compiler = 'msvc' +# class TestUnixFloatConverter(TestFloatConverter): +# compiler = '' +# class TestGccFloatConverter(TestFloatConverter): +# compiler = 'gcc' +# +# class TestMsvcComplexConverter(TestComplexConverter): +# compiler = 'msvc' +# class TestUnixComplexConverter(TestComplexConverter): +# compiler = '' +# class TestGccComplexConverter(TestComplexConverter): +# compiler = 'gcc' +# +# class TestMsvcFileConverter(TestFileConverter): +# compiler = 'msvc' +# class TestUnixFileConverter(TestFileConverter): +# compiler = '' +# class TestGccFileConverter(TestFileConverter): +# compiler = 'gcc' +# +# class TestMsvcCallableConverter(TestCallableConverter): +# compiler = 'msvc' +# class TestUnixCallableConverter(TestCallableConverter): +# compiler = '' +# class TestGccCallableConverter(TestCallableConverter): +# compiler = 'gcc' +# +# class TestMsvcSequenceConverter(TestSequenceConverter): +# compiler = 'msvc' +# class TestUnixSequenceConverter(TestSequenceConverter): +# compiler = '' +# class TestGccSequenceConverter(TestSequenceConverter): +# compiler = 'gcc' +# +# class TestMsvcStringConverter(TestStringConverter): +# compiler = 'msvc' +# class TestUnixStringConverter(TestStringConverter): +# compiler = '' +# class TestGccStringConverter(TestStringConverter): +# compiler = 'gcc' +# +# class TestMsvcListConverter(TestListConverter): +# compiler = 'msvc' +# class TestUnixListConverter(TestListConverter): +# compiler = '' +# class TestGccListConverter(TestListConverter): +# compiler = 'gcc' +# +# class TestMsvcTupleConverter(TestTupleConverter): +# compiler = 'msvc' +# class TestUnixTupleConverter(TestTupleConverter): +# compiler = '' +# class TestGccTupleConverter(TestTupleConverter): +# compiler = 'gcc' +# +# class TestMsvcDictConverter(TestDictConverter): +# compiler = 'msvc' +# class TestUnixDictConverter(TestDictConverter): +# compiler = '' +# class TestGccDictConverter(TestDictConverter): +# compiler = 'gcc' +# +# class TestMsvcInstanceConverter(TestInstanceConverter): +# compiler = 'msvc' +# class TestUnixInstanceConverter(TestInstanceConverter): +# compiler = '' +# class TestGccInstanceConverter(TestInstanceConverter): +# compiler = 'gcc' -class TestMsvcFloatConverter(TestFloatConverter): - compiler = 'msvc' -class TestUnixFloatConverter(TestFloatConverter): - compiler = '' -class TestGccFloatConverter(TestFloatConverter): - compiler = 'gcc' - -class TestMsvcComplexConverter(TestComplexConverter): - compiler = 'msvc' -class TestUnixComplexConverter(TestComplexConverter): - compiler = '' -class TestGccComplexConverter(TestComplexConverter): - compiler = 'gcc' - -class TestMsvcFileConverter(TestFileConverter): - compiler = 'msvc' -class TestUnixFileConverter(TestFileConverter): - compiler = '' -class TestGccFileConverter(TestFileConverter): - compiler = 'gcc' - -class TestMsvcCallableConverter(TestCallableConverter): - compiler = 'msvc' -class TestUnixCallableConverter(TestCallableConverter): - compiler = '' -class TestGccCallableConverter(TestCallableConverter): - compiler = 'gcc' - -class TestMsvcSequenceConverter(TestSequenceConverter): - compiler = 'msvc' -class TestUnixSequenceConverter(TestSequenceConverter): - compiler = '' -class TestGccSequenceConverter(TestSequenceConverter): - compiler = 'gcc' - -class TestMsvcStringConverter(TestStringConverter): - compiler = 'msvc' -class TestUnixStringConverter(TestStringConverter): - compiler = '' -class TestGccStringConverter(TestStringConverter): - compiler = 'gcc' - -class TestMsvcListConverter(TestListConverter): - compiler = 'msvc' -class TestUnixListConverter(TestListConverter): - compiler = '' -class TestGccListConverter(TestListConverter): - compiler = 'gcc' - -class TestMsvcTupleConverter(TestTupleConverter): - compiler = 'msvc' -class TestUnixTupleConverter(TestTupleConverter): - compiler = '' -class TestGccTupleConverter(TestTupleConverter): - compiler = 'gcc' - -class TestMsvcDictConverter(TestDictConverter): - compiler = 'msvc' -class TestUnixDictConverter(TestDictConverter): - compiler = '' -class TestGccDictConverter(TestDictConverter): - compiler = 'gcc' - -class TestMsvcInstanceConverter(TestInstanceConverter): - compiler = 'msvc' -class TestUnixInstanceConverter(TestInstanceConverter): - compiler = '' -class TestGccInstanceConverter(TestInstanceConverter): - compiler = 'gcc' - def setup_test_location(): import tempfile #test_dir = os.path.join(tempfile.gettempdir(),'test_files') @@ -671,16 +703,16 @@ def remove_file(name): test_dir = os.path.abspath(name) -if not msvc_exists(): - for _n in dir(): - if _n[:10]=='test_msvc_': exec 'del '+_n -else: - for _n in dir(): - if _n[:10]=='test_unix_': exec 'del '+_n - -if not (gcc_exists() and msvc_exists() and sys.platform == 'win32'): - for _n in dir(): - if _n[:9]=='test_gcc_': exec 'del '+_n - +# if not msvc_exists(): +# for _n in dir(): +# if _n[:8]=='TestMsvc': exec 'del '+_n +# else: +# for _n in dir(): +# if _n[:8]=='TestUnix': exec 'del '+_n +# +# if not (gcc_exists() and msvc_exists() and sys.platform == 'win32'): +# for _n in dir(): +# if _n[:7]=='TestGcc': exec 'del '+_n +# if __name__ == "__main__": NumpyTest('weave.c_spec').run() Modified: trunk/scipy/weave/tests/test_numpy_scalar_spec.py =================================================================== --- trunk/scipy/weave/tests/test_numpy_scalar_spec.py 2007-12-27 22:48:27 UTC (rev 3735) +++ trunk/scipy/weave/tests/test_numpy_scalar_spec.py 2007-12-27 22:53:35 UTC (rev 3736) @@ -52,7 +52,7 @@ # int, float, complex #---------------------------------------------------------------------------- -class TestNumpyComplexScalarConverter(NumpyTestCase): +class NumpyComplexScalarConverter(NumpyTestCase): compiler = '' def setUp(self): @@ -112,15 +112,23 @@ result = inline_tools.inline("return_val=1.0/a;",['a']) assert( result==.5-.5j) -class TestMsvcNumpyComplexScalarConverter( - TestNumpyComplexScalarConverter): - compiler = 'msvc' -class TestUnixNumpyComplexScalarConverter( - TestNumpyComplexScalarConverter): - compiler = '' -class TestGccNumpyComplexScalarConverter( - TestNumpyComplexScalarConverter): - compiler = 'gcc' +# class TestMsvcNumpyComplexScalarConverter( +# TestNumpyComplexScalarConverter): +# compiler = 'msvc' +# class TestUnixNumpyComplexScalarConverter( +# TestNumpyComplexScalarConverter): +# compiler = '' +# class TestGccNumpyComplexScalarConverter( +# TestNumpyComplexScalarConverter): +# compiler = 'gcc' +for _n in dir(): + if _n[-9:]=='Converter': + if msvc_exists(): + exec "class Test%sMsvc(%s):\n compiler = 'msvc'"%(_n,_n) + else: + exec "class Test%sUnix(%s):\n compiler = ''"%(_n,_n) + if gcc_exists(): + exec "class Test%sGcc(%s):\n compiler = 'gcc'"%(_n,_n) def setup_test_location(): @@ -146,14 +154,14 @@ if not msvc_exists(): for _n in dir(): - if _n[:10]=='test_msvc_': exec 'del '+_n + if _n[:8]=='TestMsvc': exec 'del '+_n else: for _n in dir(): - if _n[:10]=='test_unix_': exec 'del '+_n + if _n[:8]=='TestUnix': exec 'del '+_n if not (gcc_exists() and msvc_exists() and sys.platform == 'win32'): for _n in dir(): - if _n[:9]=='test_gcc_': exec 'del '+_n + if _n[:7]=='TestGcc': exec 'del '+_n if __name__ == "__main__": NumpyTest('weave.numpy_scalar_spec').run() Modified: trunk/scipy/weave/tests/test_scxx_dict.py =================================================================== --- trunk/scipy/weave/tests/test_scxx_dict.py 2007-12-27 22:48:27 UTC (rev 3735) +++ trunk/scipy/weave/tests/test_scxx_dict.py 2007-12-27 22:53:35 UTC (rev 3736) @@ -34,7 +34,7 @@ a = {} a[key] = 12345 code = """ - return_val = key in a; + return_val = a.has_key(key); """ res = inline_tools.inline(code,['a','key']) assert res @@ -42,7 +42,7 @@ a = {} a[1234] = 12345 code = """ - return_val = 1234 in a; + return_val = a.has_key(1234); """ res = inline_tools.inline(code,['a']) assert res @@ -50,7 +50,7 @@ a = {} a[1234.] = 12345 code = """ - return_val = 1234. in a; + return_val = a.has_key(1234.); """ res = inline_tools.inline(code,['a']) assert res @@ -59,7 +59,7 @@ a[1+1j] = 12345 key = 1+1j code = """ - return_val = key in a; + return_val = a.has_key(key); """ res = inline_tools.inline(code,['a','key']) assert res @@ -68,7 +68,7 @@ a = {} a["b"] = 12345 code = """ - return_val = "b" in a; + return_val = a.has_key("b"); """ res = inline_tools.inline(code,['a']) assert res @@ -77,7 +77,7 @@ a["b"] = 12345 key_name = "b" code = """ - return_val = key_name in a; + return_val = a.has_key(key_name); """ res = inline_tools.inline(code,['a','key_name']) assert res @@ -85,7 +85,7 @@ a = {} a["b"] = 12345 code = """ - return_val = "c" in a; + return_val = a.has_key("c"); """ res = inline_tools.inline(code,['a']) assert not res Modified: trunk/scipy/weave/tests/test_scxx_object.py =================================================================== --- trunk/scipy/weave/tests/test_scxx_object.py 2007-12-27 22:48:27 UTC (rev 3735) +++ trunk/scipy/weave/tests/test_scxx_object.py 2007-12-27 22:53:35 UTC (rev 3736) @@ -483,7 +483,7 @@ return (1,2,3) res = inline_tools.inline('return_val = Foo.call();',['Foo']) assert_equal(res,(1,2,3)) - assert_equal(sys.getrefcount(res),2) + assert_equal(sys.getrefcount(res),3) # should be 2? def check_args(self,level=5): def Foo(val1,val2): return (val1,val2) @@ -649,18 +649,6 @@ res = inline_tools.inline('return_val = a.is_true();',['a']) assert_equal(res,0) -class TestObjectIsTrue(NumpyTestCase): - def check_false(self,level=5): - class Foo: - pass - a= Foo() - res = inline_tools.inline('return_val = a.mcall("not");',['a']) - assert_equal(res,0) - def check_true(self,level=5): - a= None - res = inline_tools.inline('return_val = a.mcall("not");',['a']) - assert_equal(res,1) - class TestObjectType(NumpyTestCase): def check_type(self,level=5): class Foo: @@ -787,7 +775,7 @@ a = UserDict() key = 1+1j inline_tools.inline("a[key] = 1234;",['a','key']) - assert_equal(sys.getrefcount(key),3) + assert_equal(sys.getrefcount(key),4) # should be 3 assert_equal(sys.getrefcount(a[key]),2) assert_equal(a[key],1234) def check_set_char(self,level=5): Modified: trunk/scipy/weave/tests/test_scxx_sequence.py =================================================================== --- trunk/scipy/weave/tests/test_scxx_sequence.py 2007-12-27 22:48:27 UTC (rev 3735) +++ trunk/scipy/weave/tests/test_scxx_sequence.py 2007-12-27 22:53:35 UTC (rev 3736) @@ -24,14 +24,13 @@ seq_type = None def check_conversion(self,level=5): - a = self.seq_type([]) + a = self.seq_type([1]) before = sys.getrefcount(a) - import weave - weave.inline("",['a']) + inline_tools.inline(" ",['a']) #print 'first:',before # first call is goofing up refcount. before = sys.getrefcount(a) - weave.inline("",['a']) + inline_tools.inline(" ",['a']) after = sys.getrefcount(a) #print '2nd,3rd:', before, after assert(after == before) @@ -399,7 +398,7 @@ const int N = a.length(); std::string blah = std::string("blah"); for(int i=0; i < N; i++) - b[i] = (std::string)a[i] + blah; + b[i] = convert_to_string(a[i],"a") + blah; """ # compile not included in timing inline_tools.inline(code,['a','b']) @@ -435,4 +434,4 @@ assert b == desired if __name__ == "__main__": - NumpyTest().run() + NumpyTest().test(10,10) Modified: trunk/scipy/weave/tests/test_wx_spec.py =================================================================== --- trunk/scipy/weave/tests/test_wx_spec.py 2007-12-27 22:48:27 UTC (rev 3735) +++ trunk/scipy/weave/tests/test_wx_spec.py 2007-12-27 22:53:35 UTC (rev 3736) @@ -40,7 +40,7 @@ assert(self.s.type_match(f)) def check_var_in(self,level=5): - mod = ext_tools.ext_module('wx_var_in',compiler='msvc') + mod = ext_tools.ext_module('wx_var_in',compiler='') mod.customize.add_header('') mod.customize.add_extra_compile_arg(' '.join(self.s.extra_compile_args)) mod.customize.add_extra_link_arg(' '.join(self.s.extra_link_args)) @@ -61,12 +61,12 @@ try: b = 1. wx_var_in.test(b) - except TypeError: + except AttributeError: pass try: b = 1 wx_var_in.test(b) - except TypeError: + except AttributeError: pass def no_check_var_local(self,level=5): @@ -102,4 +102,4 @@ import sys if len(sys.argv) == 1: sys.argv.extend(["--level=5"]) - NumpyTest().run() + NumpyTest().test(10,10) Modified: trunk/scipy/weave/wx_spec.py =================================================================== --- trunk/scipy/weave/wx_spec.py 2007-12-27 22:48:27 UTC (rev 3735) +++ trunk/scipy/weave/wx_spec.py 2007-12-27 22:53:35 UTC (rev 3736) @@ -141,7 +141,7 @@ def type_match(self,value): is_match = 0 try: - wx_class = value.this.split('_')[-2] + wx_class = str(value.this).split('_')[-1] if wx_class[:2] == 'wx': is_match = 1 except AttributeError: @@ -166,7 +166,7 @@ def type_spec(self,name,value): # factory - class_name = value.this.split('_')[-2] + class_name = str(value.this).split('_')[-1] new_spec = self.__class__(class_name) new_spec.name = name return new_spec From scipy-svn at scipy.org Fri Dec 28 14:27:28 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 28 Dec 2007 13:27:28 -0600 (CST) Subject: [Scipy-svn] r3737 - trunk/scipy/sandbox/timeseries Message-ID: <20071228192728.5196239C210@new.scipy.org> Author: pierregm Date: 2007-12-28 13:27:25 -0600 (Fri, 28 Dec 2007) New Revision: 3737 Modified: trunk/scipy/sandbox/timeseries/tseries.py Log: fixed convert & adjust_endpoints Modified: trunk/scipy/sandbox/timeseries/tseries.py =================================================================== --- trunk/scipy/sandbox/timeseries/tseries.py 2007-12-27 22:53:35 UTC (rev 3736) +++ trunk/scipy/sandbox/timeseries/tseries.py 2007-12-28 19:27:25 UTC (rev 3737) @@ -1234,12 +1234,12 @@ newseries = numeric.empty(newshape, dtype=a.dtype).view(type(a)) newseries.__setmask__(numeric.ones(newseries.shape, dtype=bool_)) + newseries._update_from(a) newseries._dates = newdates if dstart is not None: start_date = max(start_date, dstart) end_date = min(end_date, dend) + 1 newseries[start_date:end_date] = a[start_date:end_date] - newseries._update_from(a) return newseries #..................................................... def align_series(*series, **kwargs): @@ -1339,9 +1339,9 @@ tempData = maskedarray.apply_along_axis(func, -1, tempData, *args, **kwargs) newseries = tempData.view(type(series)) + newseries._update_from(series) newseries._dates = date_array(start_date=start_date, length=len(newseries), freq=toFreq) - newseries._update_from(series) return newseries def convert(series, freq, func=None, position='END', *args, **kwargs): @@ -1751,3 +1751,7 @@ import dates tt = time_series([.2,.2,.3],start_date=dates.Date('T',string='2007-10-10 01:10')) tt._dates += [0, 9, 18] + + if 1: + series = time_series(maskedarray.arange(48), start_date=now('M')) + aseries = series.convert('A') From scipy-svn at scipy.org Fri Dec 28 17:02:23 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 28 Dec 2007 16:02:23 -0600 (CST) Subject: [Scipy-svn] r3739 - in trunk/scipy/sparse: . tests Message-ID: <20071228220223.7BE9439C176@new.scipy.org> Author: wnbell Date: 2007-12-28 16:02:11 -0600 (Fri, 28 Dec 2007) New Revision: 3739 Added: trunk/scipy/sparse/tests/test_spfuncs.py Modified: trunk/scipy/sparse/base.py trunk/scipy/sparse/bsr.py trunk/scipy/sparse/compressed.py trunk/scipy/sparse/construct.py trunk/scipy/sparse/coo.py trunk/scipy/sparse/csc.py trunk/scipy/sparse/csr.py trunk/scipy/sparse/dia.py trunk/scipy/sparse/info.py trunk/scipy/sparse/lil.py trunk/scipy/sparse/spfuncs.py trunk/scipy/sparse/sputils.py Log: updated sparse docstrings Modified: trunk/scipy/sparse/base.py =================================================================== --- trunk/scipy/sparse/base.py 2007-12-28 20:42:45 UTC (rev 3738) +++ trunk/scipy/sparse/base.py 2007-12-28 22:02:11 UTC (rev 3739) @@ -174,13 +174,15 @@ def asformat(self, format): """Return this matrix in a given sparse format - *Parameters*: - format : desired sparse matrix format - If format is None then no conversion is performed - Other possible values include: - "csr" for csr_matrix format - "csc" for csc_matrix format - "dok" for dok_matrix format and so on + Parameters + ========== + - format : desired sparse matrix format + - If format is None then no conversion is performed + - Other possible values include: + - "csr" for csr_matrix format + - "csc" for csc_matrix format + - "dok" for dok_matrix format and so on + """ if format is None or format == self.format: @@ -369,11 +371,12 @@ def rmatvec(self, other, conjugate=True): """Multiplies the vector 'other' by the sparse matrix, returning a dense vector as a result. - + If 'conjugate' is True: - returns A.transpose().conj() * other + - returns A.transpose().conj() * other Otherwise: - returns A.transpose() * other. + - returns A.transpose() * other. + """ return self.tocsr().rmatvec(other, conjugate=conjugate) Modified: trunk/scipy/sparse/bsr.py =================================================================== --- trunk/scipy/sparse/bsr.py 2007-12-28 20:42:45 UTC (rev 3738) +++ trunk/scipy/sparse/bsr.py 2007-12-28 22:02:11 UTC (rev 3739) @@ -1,5 +1,4 @@ -"""Compressed Block Sparse Row matrix format -""" +"""Compressed Block Sparse Row matrix format""" __all__ = ['bsr_matrix', 'isspmatrix_bsr'] @@ -16,44 +15,45 @@ This can be instantiated in several ways: - bsr_matrix(D, [blocksize=(R,C)]) - with a dense matrix or rank-2 ndarray D + - with a dense matrix or rank-2 ndarray D - bsr_matrix(S, [blocksize=(R,C)]) - with another sparse matrix S (equivalent to S.tocsr()) + - with another sparse matrix S (equivalent to S.tobsr()) - bsr_matrix((M, N), [blocksize=(R,C), dtype]) - to construct an empty matrix with shape (M, N) - dtype is optional, defaulting to dtype='d'. + - to construct an empty matrix with shape (M, N) + - dtype is optional, defaulting to dtype='d'. - bsr_matrix((data, ij), [blocksize=(R,C), shape=(M, N)]) - where data, ij satisfy: - a[ij[0, k], ij[1, k]] = data[k] + - where data, ij satisfy: + - a[ij[0, k], ij[1, k]] = data[k] - bsr_matrix((data, indices, indptr), [shape=(M, N)]) - is the standard BSR representation where: - the block column indices for row i are stored in - indices[ indptr[i]: indices[i+1] ] - and their corresponding block values are stored in - data[ indptr[i]: indptr[i+1] ] - If the shape parameter is not supplied, the matrix dimensions - are inferred from the index arrays. + - is the standard BSR representation where: + the block column indices for row i are stored in + - indices[ indptr[i]: indices[i+1] ] + and their corresponding block values are stored in + - data[ indptr[i]: indptr[i+1] ] + - if the shape parameter is not supplied, the matrix dimensions + are inferred from the index arrays. - *Notes* - ------- - The blocksize (R,C) must evenly divide the shape of - the matrix (M,N). That is, R and C must satisfy the - relationship M % R = 0 and N % C = 0. + Notes + ===== + + - The blocksize (R,C) must evenly divide the shape of + the matrix (M,N). That is, R and C must satisfy the + relationship M % R = 0 and N % C = 0. - The Block Compressed Row (BSR) format is very similar to the - Compressed Sparse Row (CSR) format. BSR is appropriate for - sparse matrices with dense sub matrices like the last example - below. Such matrices often arise, for instance, in finite - element discretizations. + - The Block Compressed Row (BSR) format is very similar to the + Compressed Sparse Row (CSR) format. BSR is appropriate for + sparse matrices with dense sub matrices like the last example + below. Such matrices often arise, for instance, in finite + element discretizations. - *Examples* - ---------- + Examples + ======== >>> from scipy.sparse import * >>> from scipy import * Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-28 20:42:45 UTC (rev 3738) +++ trunk/scipy/sparse/compressed.py 2007-12-28 22:02:11 UTC (rev 3739) @@ -116,11 +116,13 @@ def check_format(self, full_check=True): """check whether the matrix format is valid - *Parameters*: - full_check: - True - rigorous check, O(N) operations : default - False - basic check, O(1) operations + Parameters + ========== + - full_check : {bool} + - True - rigorous check, O(N) operations : default + - False - basic check, O(1) operations + """ #use _swap to determine proper bounds major_name,minor_name = self._swap(('row','column')) Modified: trunk/scipy/sparse/construct.py =================================================================== --- trunk/scipy/sparse/construct.py 2007-12-28 20:42:45 UTC (rev 3738) +++ trunk/scipy/sparse/construct.py 2007-12-28 22:02:11 UTC (rev 3739) @@ -24,19 +24,24 @@ B = spdiags(diags, offsets, m, n) - *Parameters*: - data : matrix whose rows contain the diagonal values - diags : diagonals to set - k = 0 - the main diagonal - k > 0 - the k-th upper diagonal - k < 0 - the k-th lower diagonal - m, n : dimensions of the result - format : format of the result (e.g. "csr") - By default (format=None) an appropriate sparse matrix - format is returned. This choice is subject to change. + Parameters + ========== + - data : matrix whose rows contain the diagonal values + - diags : diagonals to set + - k = 0 - the main diagonal + - k > 0 - the k-th upper diagonal + - k < 0 - the k-th lower diagonal + - m, n : dimensions of the result + - format : format of the result (e.g. "csr") + - By default (format=None) an appropriate sparse matrix + format is returned. This choice is subject to change. - *Example* - ------- + See Also + ======== + The dia_matrix class which implements the DIAgonal format. + + Example + ======= >>> data = array([[1,2,3,4]]).repeat(3,axis=0) >>> diags = array([0,-1,2]) >>> spdiags(data,diags,4,4).todense() @@ -75,16 +80,19 @@ def spkron(A, B, format=None): """kronecker product of sparse matrices A and B - *Parameters*: - A,B : sparse matrices - E.g. csr_matrix, csc_matrix, coo_matrix, etc. + Parameters + ========== + A,B : dense or sparse matrices + format : format of the result (e.g. "csr") + - By default (format=None) an appropriate sparse matrix + format is returned. This choice is subject to change. - *Returns*: - coo_matrix - kronecker product in COOrdinate format + Returns + ======= + kronecker product in a sparse matrix format - *Example*: - ------- + Examples + ======== >>> A = csr_matrix(array([[0,2],[5,0]])) >>> B = csr_matrix(array([[1,2],[3,4]])) @@ -94,8 +102,14 @@ [ 5., 10., 0., 0.], [ 15., 20., 0., 0.]]) + >>> spkron(A,[[1,2],[3,4]]).todense() + matrix([[ 0., 0., 2., 4.], + [ 0., 0., 6., 8.], + [ 5., 10., 0., 0.], + [ 15., 20., 0., 0.]]) + """ - #TODO optimize for small dense B and CSR A + #TODO optimize for small dense B and CSR A -> BSR A,B = coo_matrix(A),coo_matrix(B) output_shape = (A.shape[0]*B.shape[0],A.shape[1]*B.shape[1]) @@ -130,14 +144,15 @@ """Generate a lil_matrix of dimensions (r,c) with the k-th diagonal set to 1. - :Parameters: - r,c : int - Row and column-dimensions of the output. - k : int - Diagonal offset. In the output matrix, - out[m,m+k] == 1 for all m. - dtype : dtype - Data-type of the output array. + Parameters + ========== + - r,c : int + - row and column-dimensions of the output. + - k : int + - diagonal offset. In the output matrix, + - out[m,m+k] == 1 for all m. + - dtype : dtype + - data-type of the output array. """ warn("lil_eye is deprecated. use speye(... , format='lil') instead", \ @@ -150,19 +165,20 @@ def lil_diags(diags,offsets,(m,n),dtype='d'): """Generate a lil_matrix with the given diagonals. - :Parameters: - diags : list of list of values e.g. [[1,2,3],[4,5]] - Values to be placed on each indicated diagonal. - offsets : list of ints - Diagonal offsets. This indicates the diagonal on which - the given values should be placed. - (r,c) : tuple of ints - Row and column dimensions of the output. - dtype : dtype - Output data-type. + Parameters + ========== + - diags : list of list of values e.g. [[1,2,3],[4,5]] + - values to be placed on each indicated diagonal. + - offsets : list of ints + - diagonal offsets. This indicates the diagonal on which + the given values should be placed. + - (r,c) : tuple of ints + - row and column dimensions of the output. + - dtype : dtype + - output data-type. - Example: - ------- + Example + ======= >>> lil_diags([[1,2,3],[4,5],[6]],[0,1,2],(3,3)).todense() matrix([[ 1., 4., 6.], Modified: trunk/scipy/sparse/coo.py =================================================================== --- trunk/scipy/sparse/coo.py 2007-12-28 20:42:45 UTC (rev 3738) +++ trunk/scipy/sparse/coo.py 2007-12-28 22:02:11 UTC (rev 3739) @@ -1,4 +1,4 @@ -""" A sparse matrix in COOrdinate format """ +""" A sparse matrix in COOrdinate or 'triplet' format""" __all__ = ['coo_matrix', 'isspmatrix_coo'] @@ -21,34 +21,52 @@ This can be instantiated in several ways: - coo_matrix(D) - with a dense matrix D + - with a dense matrix D - coo_matrix(S) - with another sparse matrix S (equivalent to S.tocoo()) + - with another sparse matrix S (equivalent to S.tocoo()) - coo_matrix((M, N), [dtype]) - to construct an empty matrix with shape (M, N) - dtype is optional, defaulting to dtype='d'. + - to construct an empty matrix with shape (M, N) + dtype is optional, defaulting to dtype='d'. - coo_matrix((data, ij), [shape=(M, N)]) - When shape is not specified, it is inferred from the index arrays: - ij[0][:] and ij[1][:] + - When shape is not specified, it is inferred from the index arrays: + - ij[0][:] and ij[1][:] - The arguments 'data' and 'ij' represent three arrays: - 1. data[:] the entries of the matrix, in any order - 2. ij[0][:] the row indices of the matrix entries - 3. ij[1][:] the column indices of the matrix entries - - So the following holds: - A[ij[0][k], ij[1][k] = data[k] + - The arguments 'data' and 'ij' represent three arrays: + 1. data[:] the entries of the matrix, in any order + 2. ij[0][:] the row indices of the matrix entries + 3. ij[1][:] the column indices of the matrix entries + So the following holds: + - A[ij[0][k], ij[1][k] = data[k] - Note: - When converting to CSR or CSC format, duplicate (i,j) entries - will be summed together. This facilitates efficient construction - of finite element matrices and the like. + Notes + ===== + Advantages of the COO format + ---------------------------- + - facilitates fast conversion among sparse formats + - permits duplicate entries (see example) + - faster conversion to CSR/CSC than LIL + + Disadvantages of the COO format + ------------------------------- + - does not currently support (forces COO->CSR conversion) + - arithmetic operations + - slicing + - matrix vector products + + Usage + ----- + - COO is a fast format for constructing sparse matrices + - once a matrix has been constructed, convert to CSR or + CSC format for fast arithmetic and matrix vector operations + - By default when converting to CSR or CSC format, duplicate (i,j) + entries will be summed together. This facilitates efficient + construction of finite element matrices and the like. (see example) - *Examples* - ---------- + Examples + ======== >>> from scipy.sparse import * >>> from scipy import * Modified: trunk/scipy/sparse/csc.py =================================================================== --- trunk/scipy/sparse/csc.py 2007-12-28 20:42:45 UTC (rev 3738) +++ trunk/scipy/sparse/csc.py 2007-12-28 22:02:11 UTC (rev 3739) @@ -1,5 +1,4 @@ -"""Compressed Sparse Column matrix format -""" +"""Compressed Sparse Column matrix format""" __all__ = ['csc_matrix', 'isspmatrix_csc'] @@ -23,32 +22,45 @@ This can be instantiated in several ways: - csc_matrix(D) - with a dense matrix or rank-2 ndarray D + - with a dense matrix or rank-2 ndarray D - csc_matrix(S) - with another sparse matrix S (equivalent to S.tocsc()) + - with another sparse matrix S (equivalent to S.tocsc()) - csc_matrix((M, N), [dtype]) - to construct an empty matrix with shape (M, N) - dtype is optional, defaulting to dtype='d'. + - to construct an empty matrix with shape (M, N) + - dtype is optional, defaulting to dtype='d'. - csc_matrix((data, ij), [shape=(M, N)]) - where data, ij satisfy: - a[ij[0, k], ij[1, k]] = data[k] + - where data, ij satisfy: + - a[ij[0, k], ij[1, k]] = data[k] - csc_matrix((data, indices, indptr), [shape=(M, N)]) - is the native CSC representation where: - the row indices for column i are stored in - indices[ indptr[i]: indices[i+1] ] - and their corresponding values are stored in - data[ indptr[i]: indptr[i+1] ] - If the shape parameter is not supplied, the matrix dimensions - are inferred from the index arrays. + - is the standard CSC representation where + the row indices for column i are stored in + - indices[ indptr[i]: indices[i+1] ] + and their corresponding values are stored in + - data[ indptr[i]: indptr[i+1] ] + - If the shape parameter is not supplied, the matrix dimensions + are inferred from the index arrays. + Notes + ===== + Advantages of the CSC format + ---------------------------- + - efficient arithmetic operations CSC + CSC, CSC * CSC, etc. + - efficient column slicing + - fast matrix vector products (CSR,BSR may be faster) + + Disadvantages of the CSC format + ------------------------------- + - slow row slicing operations (prefer CSR) + - changes to the sparsity structure are expensive (prefer LIL, DOK) - *Examples* - ---------- + Examples + ======== + >>> from scipy.sparse import * >>> from scipy import * >>> csc_matrix( (3,4), dtype='i' ).todense() @@ -183,9 +195,9 @@ def get_submatrix( self, slice0, slice1 ): """Return a submatrix of this matrix (new matrix is created). Contigous range of rows and columns can be selected using: - 1. a slice object - 2. a tuple (from, to) - 3. a scalar for single row/column selection.""" + 1. a slice object + 2. a tuple (from, to) + 3. a scalar for single row/column selection.""" aux = _cs_matrix._get_submatrix( self, self.shape[1], self.shape[0], slice1, slice0 ) nr, nc = aux[3:] Modified: trunk/scipy/sparse/csr.py =================================================================== --- trunk/scipy/sparse/csr.py 2007-12-28 20:42:45 UTC (rev 3738) +++ trunk/scipy/sparse/csr.py 2007-12-28 22:02:11 UTC (rev 3739) @@ -1,5 +1,4 @@ -"""Compressed Sparse Row matrix format -""" +"""Compressed Sparse Row matrix format""" __all__ = ['csr_matrix', 'isspmatrix_csr'] @@ -23,32 +22,47 @@ This can be instantiated in several ways: - csr_matrix(D) - with a dense matrix or rank-2 ndarray D + - with a dense matrix or rank-2 ndarray D - csr_matrix(S) - with another sparse matrix S (equivalent to S.tocsr()) + - with another sparse matrix S (equivalent to S.tocsr()) - csr_matrix((M, N), [dtype]) - to construct an empty matrix with shape (M, N) - dtype is optional, defaulting to dtype='d'. + - to construct an empty matrix with shape (M, N) + - dtype is optional, defaulting to dtype='d'. - csr_matrix((data, ij), [shape=(M, N)]) - where data, ij satisfy: - a[ij[0, k], ij[1, k]] = data[k] + - where data, ij satisfy: + - a[ij[0, k], ij[1, k]] = data[k] - csr_matrix((data, indices, indptr), [shape=(M, N)]) - is the native CSR representation where: - the column indices for row i are stored in - indices[ indptr[i]: indices[i+1] ] - and their corresponding values are stored in - data[ indptr[i]: indptr[i+1] ] - If the shape parameter is not supplied, the matrix dimensions - are inferred from the index arrays. + - is the standard CSR representation where + the column indices for row i are stored in + - indices[ indptr[i]: indices[i+1] ] + and their corresponding values are stored in + - data[ indptr[i]: indptr[i+1] ] + - If the shape parameter is not supplied, the matrix dimensions + are inferred from the index arrays. - *Examples* - ---------- + Notes + ===== + Advantages of the CSR format + ---------------------------- + - efficient arithmetic operations CSR + CSR, CSR * CSR, etc. + - efficient row slicing + - fast matrix vector products + + Disadvantages of the CSR format + ------------------------------- + - slow column slicing operations (prefer CSC) + - changes to the sparsity structure are expensive (prefer LIL, DOK) + + + Examples + ======== + >>> from scipy.sparse import * >>> from scipy import * >>> csr_matrix( (3,4), dtype='i' ).todense() @@ -190,10 +204,12 @@ def get_submatrix( self, slice0, slice1 ): """Return a submatrix of this matrix (new matrix is created). Contigous range of rows and columns can be selected using: - 1. a slice object - 2. a tuple (from, to) - 3. a scalar for single row/column selection.""" + 1. a slice object + 2. a tuple (from, to) + 3. a scalar for single row/column selection. + """ + aux = _cs_matrix._get_submatrix( self, self.shape[0], self.shape[1], slice0, slice1 ) nr, nc = aux[3:] Modified: trunk/scipy/sparse/dia.py =================================================================== --- trunk/scipy/sparse/dia.py 2007-12-28 20:42:45 UTC (rev 3738) +++ trunk/scipy/sparse/dia.py 2007-12-28 22:02:11 UTC (rev 3739) @@ -15,23 +15,24 @@ This can be instantiated in several ways: - dia_matrix(D) - with a dense matrix + - with a dense matrix - dia_matrix(S) - with another sparse matrix S (equivalent to S.todia()) + - with another sparse matrix S (equivalent to S.todia()) - dia_matrix((M, N), [dtype]) - to construct an empty matrix with shape (M, N) - dtype is optional, defaulting to dtype='d'. + - to construct an empty matrix with shape (M, N) + dtype is optional, defaulting to dtype='d'. - dia_matrix((data, diags), shape=(M, N)) - where the data[k,:] stores the diagonal entries for - diagonal diag[k] (See example below) + - where the data[k,:] stores the diagonal entries for + diagonal diag[k] (See example below) - *Examples* - ---------- + Examples + ======== + >>> from scipy.sparse import * >>> from scipy import * >>> dia_matrix( (3,4), dtype='i').todense() Modified: trunk/scipy/sparse/info.py =================================================================== --- trunk/scipy/sparse/info.py 2007-12-28 20:42:45 UTC (rev 3738) +++ trunk/scipy/sparse/info.py 2007-12-28 22:02:11 UTC (rev 3739) @@ -7,12 +7,14 @@ Original code by Travis Oliphant. Modified and extended by Ed Schofield, Robert Cimrman, and Nathan Bell. -There are five available sparse matrix types: - (1) csc_matrix: Compressed Sparse Column format - (2) csr_matrix: Compressed Sparse Row format - (3) lil_matrix: List of Lists format - (4) dok_matrix: Dictionary of Keys format - (5) coo_matrix: COOrdinate format (aka IJV, triplet format) +There are seven available sparse matrix types: + 1. csc_matrix: Compressed Sparse Column format + 2. csr_matrix: Compressed Sparse Row format + 3. bsr_matrix: Block Sparse Row format + 4. lil_matrix: List of Lists format + 5. dok_matrix: Dictionary of Keys format + 6. coo_matrix: COOrdinate format (aka IJV, triplet format) + 7. dig_matrix: DIAgonal format To construct a matrix efficiently, use either lil_matrix (recommended) or dok_matrix. The lil_matrix class supports basic slicing and fancy @@ -27,8 +29,10 @@ All conversions among the CSR, CSC, and COO formats are efficient, linear-time operations. -Example: +Example +======= Construct a 1000x1000 lil_matrix and add some values to it: + >>> from scipy import sparse, linsolve >>> from numpy import linalg >>> from numpy.random import rand @@ -38,22 +42,28 @@ >>> A.setdiag(rand(1000)) Now convert it to CSR format and solve (A A^T) x = b for x: + >>> A = A.tocsr() >>> b = rand(1000) >>> x = linsolve.spsolve(A * A.T, b) Convert it to a dense matrix and solve, and check that the result is the same: + >>> A_ = A.todense() >>> x_ = linalg.solve(A_ * A_.T, b) >>> err = linalg.norm(x-x_) Now we can print the error norm with: - print "Norm error =", err + + >>> print "Norm error =", err + It should be small :) -Example: +Example +======= Construct a matrix in COO format: + >>> from scipy import sparse >>> from numpy import array >>> I = array([0,3,1,0]) @@ -64,6 +74,7 @@ Notice that the indices do not need to be sorted. Duplicate (i,j) entries are summed when converting to CSR or CSC. + >>> I = array([0,0,1,3,1,0,0]) >>> J = array([0,2,1,3,1,0,0]) >>> V = array([1,1,1,1,1,1,1]) @@ -72,13 +83,13 @@ This is useful for constructing finite-element stiffness and mass matrices. -Further Details: +Further Details +=============== + CSR column indices are not necessarily sorted. Likewise for CSC row indices. Use the .sorted_indices() and .sort_indices() methods when - sorted indices are necessary. Note that there is no expectation for - sorted indices in the sparsetools module. Furthermore some sparsetools - functions produce matrices with unsorted indices even when sorted - input is given. + sorted indices are required (e.g. when passing data to other libraries). + """ postpone_import = 1 Modified: trunk/scipy/sparse/lil.py =================================================================== --- trunk/scipy/sparse/lil.py 2007-12-28 20:42:45 UTC (rev 3738) +++ trunk/scipy/sparse/lil.py 2007-12-28 22:02:11 UTC (rev 3739) @@ -21,6 +21,27 @@ This contains a list (self.rows) of rows, each of which is a sorted list of column indices of non-zero elements. It also contains a list (self.data) of lists of these elements. + + Notes + ===== + Advantages of the LIL format + ---------------------------- + - supports flexible slicing + - changes to the matrix sparsity structure are efficient + + Disadvantages of the LIL format + ------------------------------- + - arithmetic operations LIL + LIL are slower than CSR/CSC + - slow column slicing + - matrix vector products are slower than CSR/CSC + + Usage + ----- + - LIL is a convenient format for constructing sparse matrices + - once a matrix has been constructed, convert to CSR or + CSC format for fast arithmetic and matrix vector operations + - consider using the COO format when constructing large matrices + """ def __init__(self, A=None, shape=None, dtype=None, copy=False): Modified: trunk/scipy/sparse/spfuncs.py =================================================================== --- trunk/scipy/sparse/spfuncs.py 2007-12-28 20:42:45 UTC (rev 3738) +++ trunk/scipy/sparse/spfuncs.py 2007-12-28 22:02:11 UTC (rev 3739) @@ -14,9 +14,7 @@ from sparsetools import csr_count_blocks def extract_diagonal(A): - """ - extract_diagonal(A) returns the main diagonal of A. - """ + """extract_diagonal(A) returns the main diagonal of A.""" #TODO extract k-th diagonal if isspmatrix_csr(A) or isspmatrix_csc(A): fn = getattr(sparsetools, A.format + "_diagonal") @@ -33,7 +31,7 @@ """Attempt to determine the blocksize of a sparse matrix Returns a blocksize=(r,c) such that - A.nnz / A.tobsr( (r,c) ).nnz > efficiency + - A.nnz / A.tobsr( (r,c) ).nnz > efficiency """ if not (isspmatrix_csr(A) or isspmatrix_csc(A)): A = csr_matrix(A) Modified: trunk/scipy/sparse/sputils.py =================================================================== --- trunk/scipy/sparse/sputils.py 2007-12-28 20:42:45 UTC (rev 3738) +++ trunk/scipy/sparse/sputils.py 2007-12-28 22:02:11 UTC (rev 3739) @@ -17,8 +17,8 @@ upcast(t0, t1, ..., tn) -> T where T is a supported dtype - *Example* - ------- + Example + ======= >>> upcast('int32') Added: trunk/scipy/sparse/tests/test_spfuncs.py =================================================================== --- trunk/scipy/sparse/tests/test_spfuncs.py 2007-12-28 20:42:45 UTC (rev 3738) +++ trunk/scipy/sparse/tests/test_spfuncs.py 2007-12-28 22:02:11 UTC (rev 3739) @@ -0,0 +1,64 @@ +from numpy import array, kron +from numpy.testing import * + +set_package_path() +from scipy.sparse.spfuncs import * +from scipy.sparse import csr_matrix, csc_matrix +restore_path() + +class TestSparseFunctions(NumpyTestCase): + def check_estimate_blocksize(self): + + mats = [] + mats.append( [[0,1],[1,0]] ) + mats.append( [[1,1,0],[0,0,1],[1,0,1]] ) + mats.append( [[0],[0],[1]] ) + mats = [array(x) for x in mats] + + blks = [] + blks.append( [[1]] ) + blks.append( [[1,1],[1,1]] ) + blks.append( [[1,1],[0,1]] ) + blks.append( [[1,1,0],[1,0,1],[1,1,1]] ) + blks = [array(x) for x in blks] + + for A in mats: + for B in blks: + X = kron(A,B) + r,c = estimate_blocksize(X) + assert(r >= B.shape[0]) + assert(c >= B.shape[1]) + + def check_count_blocks(self): + def gold(A,bs): + R,C = bs + I,J = A.nonzero() + return len( set( zip(I/R,J/C) ) ) + + mats = [] + mats.append( [[0]] ) + mats.append( [[1]] ) + mats.append( [[1,0]] ) + mats.append( [[1,1]] ) + mats.append( [[0,1],[1,0]] ) + mats.append( [[1,1,0],[0,0,1],[1,0,1]] ) + mats.append( [[0],[0],[1]] ) + + for A in mats: + for B in mats: + X = kron(A,B) + Y = csr_matrix(X) + for R in range(1,6): + for C in range(1,6): + assert_equal(count_blocks(Y,(R,C)),gold(X,(R,C))) + + X = kron([[1,1,0],[0,0,1],[1,0,1]],[[1,1]]) + Y = csc_matrix(X) + assert_equal(count_blocks(X,(1,2)),gold(X,(1,2))) + assert_equal(count_blocks(Y,(1,2)),gold(X,(1,2))) + + + +if __name__ == "__main__": + NumpyTest().run() + From scipy-svn at scipy.org Fri Dec 28 18:40:01 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 28 Dec 2007 17:40:01 -0600 (CST) Subject: [Scipy-svn] r3740 - trunk/scipy/sparse/tests Message-ID: <20071228234001.3AE8739C08A@new.scipy.org> Author: wnbell Date: 2007-12-28 17:39:51 -0600 (Fri, 28 Dec 2007) New Revision: 3740 Modified: trunk/scipy/sparse/tests/test_sparse.py Log: small edit to tests Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2007-12-28 22:02:11 UTC (rev 3739) +++ trunk/scipy/sparse/tests/test_sparse.py 2007-12-28 23:39:51 UTC (rev 3740) @@ -77,8 +77,7 @@ vars = dict( [(var,mat.asformat(format)) for (var,name,mat) in matrices ] ) for X,Y in [ ('A','A'),('A','B'),('B','A'),('B','B') ]: x,y = vars[X],vars[Y] - #for op in ['__add__','__sub__','multiply','__div__','__mul__']: - for op in ['__mul__']: + for op in ['__add__','__sub__','multiply','__div__','__mul__']: fn = getattr(x,op) fn(y) #warmup From scipy-svn at scipy.org Fri Dec 28 19:37:05 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 28 Dec 2007 18:37:05 -0600 (CST) Subject: [Scipy-svn] r3741 - trunk Message-ID: <20071229003705.6D7AF39C047@new.scipy.org> Author: jarrod.millman Date: 2007-12-28 18:37:02 -0600 (Fri, 28 Dec 2007) New Revision: 3741 Modified: trunk/INSTALL.txt Log: update to reflect dep on python 2.4+ for next scipy release Modified: trunk/INSTALL.txt =================================================================== --- trunk/INSTALL.txt 2007-12-28 23:39:51 UTC (rev 3740) +++ trunk/INSTALL.txt 2007-12-29 00:37:02 UTC (rev 3741) @@ -20,7 +20,7 @@ SciPy requires the following software installed: -1) Python__ 2.3.x or newer +1) Python__ 2.4.x or newer Debian packages: python python-dev From scipy-svn at scipy.org Fri Dec 28 19:42:51 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 28 Dec 2007 18:42:51 -0600 (CST) Subject: [Scipy-svn] r3742 - trunk Message-ID: <20071229004251.AD3E139C047@new.scipy.org> Author: jarrod.millman Date: 2007-12-28 18:42:47 -0600 (Fri, 28 Dec 2007) New Revision: 3742 Modified: trunk/INSTALL.txt Log: updating for NumPy 1.0.5 dep Modified: trunk/INSTALL.txt =================================================================== --- trunk/INSTALL.txt 2007-12-29 00:37:02 UTC (rev 3741) +++ trunk/INSTALL.txt 2007-12-29 00:42:47 UTC (rev 3742) @@ -32,7 +32,7 @@ __ http://www.python.org -2) NumPy__ 1.0b1 or newer +2) NumPy__ 1.0.5 or newer Debian package: python-numpy From scipy-svn at scipy.org Fri Dec 28 21:48:23 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 28 Dec 2007 20:48:23 -0600 (CST) Subject: [Scipy-svn] r3743 - trunk/scipy/sandbox/timeseries Message-ID: <20071229024823.9BC9539C283@new.scipy.org> Author: mattknox_ca Date: 2007-12-28 20:48:19 -0600 (Fri, 28 Dec 2007) New Revision: 3743 Modified: trunk/scipy/sandbox/timeseries/dates.py Log: updated __doc__ string for date_array function Modified: trunk/scipy/sandbox/timeseries/dates.py =================================================================== --- trunk/scipy/sandbox/timeseries/dates.py 2007-12-29 00:42:47 UTC (rev 3742) +++ trunk/scipy/sandbox/timeseries/dates.py 2007-12-29 02:48:19 UTC (rev 3743) @@ -617,9 +617,26 @@ def date_array(dlist=None, start_date=None, end_date=None, length=None, freq=None): - """Constructs a DateArray from: - - a starting date and either an ending date or a given length. - - a list of dates. + """Factory function for constructing a DateArray + +*Parameters*: + dlist : {list of dates or DateArray} (optional) + may be a list of dates, integer representations of dates for a given + frequency, datetime objects, or an existing DateArray. If specifying + a list of dates, you must also specify the `freq` parameter. + + start_date : {Date} (optional) + if you want a continuous DateArray, specify a start_date and either an + `end_date` or a `length`. Frequency of the resulting DateArray will be + automatically determined based on the frequency of this parameter. + + end_date : {Date} (optional) + last date in resulting DateArray. Specify this parameter or `length` + in combination with `start_date` for a continuous DateArray. + + length : {int} (optional) + the length of the resulting DateArray. Specify this parameter or + `end_date` in combination with `start_date` for a continuous DateArray. """ freq = check_freq(freq) # Case #1: we have a list ................... From scipy-svn at scipy.org Fri Dec 28 21:53:52 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 28 Dec 2007 20:53:52 -0600 (CST) Subject: [Scipy-svn] r3744 - in branches/testing_cleanup: . scipy/cluster/tests scipy/fftpack/tests scipy/integrate/tests scipy/interpolate/tests scipy/io/tests scipy/lib/blas/tests scipy/lib/lapack/tests Message-ID: <20071229025352.D619739C3AE@new.scipy.org> Author: matthew.brett at gmail.com Date: 2007-12-28 20:53:36 -0600 (Fri, 28 Dec 2007) New Revision: 3744 Modified: branches/testing_cleanup/MANIFEST.in branches/testing_cleanup/scipy/cluster/tests/test_vq.py branches/testing_cleanup/scipy/fftpack/tests/test_basic.py branches/testing_cleanup/scipy/fftpack/tests/test_helper.py branches/testing_cleanup/scipy/fftpack/tests/test_pseudo_diffs.py branches/testing_cleanup/scipy/integrate/tests/test_integrate.py branches/testing_cleanup/scipy/integrate/tests/test_quadpack.py branches/testing_cleanup/scipy/integrate/tests/test_quadrature.py branches/testing_cleanup/scipy/interpolate/tests/test_fitpack.py branches/testing_cleanup/scipy/interpolate/tests/test_interpolate.py branches/testing_cleanup/scipy/io/tests/test_array_import.py branches/testing_cleanup/scipy/io/tests/test_datasource.py branches/testing_cleanup/scipy/io/tests/test_mio.py branches/testing_cleanup/scipy/io/tests/test_mmio.py branches/testing_cleanup/scipy/io/tests/test_npfile.py branches/testing_cleanup/scipy/io/tests/test_recaster.py branches/testing_cleanup/scipy/lib/blas/tests/test_blas.py branches/testing_cleanup/scipy/lib/blas/tests/test_fblas.py branches/testing_cleanup/scipy/lib/lapack/tests/test_lapack.py Log: Bashing throught the test conversion Modified: branches/testing_cleanup/MANIFEST.in =================================================================== --- branches/testing_cleanup/MANIFEST.in 2007-12-29 02:48:19 UTC (rev 3743) +++ branches/testing_cleanup/MANIFEST.in 2007-12-29 02:53:36 UTC (rev 3744) @@ -9,26 +9,20 @@ # # The following files are in the sandbox and wouldn't normally get included in sdist: # -include scipy/sandbox/ann/* -include scipy/sandbox/ann/data/* -include scipy/sandbox/ann/doc/* include scipy/sandbox/arpack/* include scipy/sandbox/arpack/ARPACK/* include scipy/sandbox/arpack/ARPACK/LAPACK/* include scipy/sandbox/arpack/ARPACK/SRC/* include scipy/sandbox/arpack/ARPACK/UTIL/* -include scipy/sandbox/arpack/build/* include scipy/sandbox/arpack/tests/* -include scipy/sandbox/arraysetops/* -include scipy/sandbox/arraysetops/tests/* include scipy/sandbox/buildgrid/* include scipy/sandbox/cdavid/* include scipy/sandbox/cdavid/src/* include scipy/sandbox/cdavid/tests/* include scipy/sandbox/constants/* -include scipy/sandbox/cow/* include scipy/sandbox/delaunay/* include scipy/sandbox/delaunay/tests/* +include scipy/sandbox/dhuard/* include scipy/sandbox/exmplpackage/* include scipy/sandbox/exmplpackage/tests/* include scipy/sandbox/exmplpackage/yyy/* @@ -38,64 +32,38 @@ include scipy/sandbox/fdfpack/tests/* include scipy/sandbox/fdfpack/utils/* include scipy/sandbox/ga/* -include scipy/sandbox/gplt/* include scipy/sandbox/image/* -include scipy/sandbox/maskedarray/* -include scipy/sandbox/maskedarray/tests/* +include scipy/sandbox/lobpcg/* +include scipy/sandbox/lobpcg/tests/* include scipy/sandbox/montecarlo/* +include scipy/sandbox/montecarlo/examples/* include scipy/sandbox/montecarlo/src/* include scipy/sandbox/montecarlo/tests/* +include scipy/sandbox/multigrid/* +include scipy/sandbox/multigrid/multigridtools/* +include scipy/sandbox/multigrid/tests/* +include scipy/sandbox/multigrid/tests/sample_data/* include scipy/sandbox/netcdf/* include scipy/sandbox/newoptimize/* +include scipy/sandbox/newoptimize/tnc/* include scipy/sandbox/numexpr/* +include scipy/sandbox/numexpr/bench/* include scipy/sandbox/numexpr/tests/* include scipy/sandbox/oliphant/* -include scipy/sandbox/plt/* -include scipy/sandbox/pyem/* -include scipy/sandbox/pyem/profile_data/* -include scipy/sandbox/pyem/src/* -include scipy/sandbox/pyem/tests/* -include scipy/sandbox/pysparse/* -include scipy/sandbox/pysparse/Tools/* -include scipy/sandbox/pysparse/amd/* -include scipy/sandbox/pysparse/docs/* -include scipy/sandbox/pysparse/examples/* -include scipy/sandbox/pysparse/examples/poisson_test/* -include scipy/sandbox/pysparse/include/* -include scipy/sandbox/pysparse/include/pysparse/* -include scipy/sandbox/pysparse/lib/* -include scipy/sandbox/pysparse/src/* -include scipy/sandbox/pysparse/superlu/* -include scipy/sandbox/pysparse/tests/* -include scipy/sandbox/pysparse/umfpack/* +include scipy/sandbox/pyloess/* +include scipy/sandbox/pyloess/doc/* +include scipy/sandbox/pyloess/src/* +include scipy/sandbox/pyloess/tests/* +include scipy/sandbox/rbf/* +include scipy/sandbox/rbf/tests/* include scipy/sandbox/rkern/* include scipy/sandbox/spline/* include scipy/sandbox/spline/fitpack/* include scipy/sandbox/spline/tests/* include scipy/sandbox/stats/* -include scipy/sandbox/svm/* -include scipy/sandbox/svm/libsvm-2.82/* -include scipy/sandbox/svm/tests/* include scipy/sandbox/timeseries/* -include scipy/sandbox/timeseries/doc/* -include scipy/sandbox/timeseries/examples/* -include scipy/sandbox/timeseries/mtimeseries/* -include scipy/sandbox/timeseries/mtimeseries/tests/* -include scipy/sandbox/timeseries/old/* -include scipy/sandbox/timeseries/plotlib/* +include scipy/sandbox/timeseries/include/* +include scipy/sandbox/timeseries/lib/* +include scipy/sandbox/timeseries/lib/tests/* include scipy/sandbox/timeseries/src/* -include scipy/sandbox/umfpack/* -include scipy/sandbox/umfpack/umfpack/* -include scipy/sandbox/wavelet/* -include scipy/sandbox/xplt/* -include scipy/sandbox/xplt/gistdata/* -include scipy/sandbox/xplt/pygist/* -include scipy/sandbox/xplt/src/* -include scipy/sandbox/xplt/src/g/* -include scipy/sandbox/xplt/src/gist/* -include scipy/sandbox/xplt/src/play/* -include scipy/sandbox/xplt/src/play/all/* -include scipy/sandbox/xplt/src/play/mac/* -include scipy/sandbox/xplt/src/play/unix/* -include scipy/sandbox/xplt/src/play/win/* -include scipy/sandbox/xplt/src/play/x11/* +include scipy/sandbox/timeseries/tests/* Modified: branches/testing_cleanup/scipy/cluster/tests/test_vq.py =================================================================== --- branches/testing_cleanup/scipy/cluster/tests/test_vq.py 2007-12-29 02:48:19 UTC (rev 3743) +++ branches/testing_cleanup/scipy/cluster/tests/test_vq.py 2007-12-29 02:53:36 UTC (rev 3744) @@ -7,26 +7,22 @@ # kmeans works OK for trivial examples. import sys -from numpy.testing import * +import os.path +from scipy.testing import * import numpy as N -set_package_path() -from cluster.vq import kmeans, kmeans2, py_vq, py_vq2, _py_vq_1d, vq, ClusterError +from scipy.cluster.vq import kmeans, kmeans2, py_vq, py_vq2, _py_vq_1d, vq, ClusterError try: - from cluster import _vq + from scipy.cluster import _vq TESTC=True except ImportError: print "== Error while importing _vq, not testing C imp of vq ==" TESTC=False -restore_path() -import os.path #Optional: -set_local_path() # import modules that are located in the same directory as this file. -DATAFILE1 = os.path.join(sys.path[0], "data.txt") -restore_path() +DATAFILE1 = os.path.join(os.path.dirname(__file__), "data.txt") # Global data X = N.array([[3.0, 3], [4, 3], [4, 2], @@ -43,20 +39,20 @@ LABEL1 = N.array([0, 1, 2, 2, 2, 2, 1, 2, 1, 1, 1]) -class TestVq(NumpyTestCase): - def check_py_vq(self, level=1): +class TestVq(TestCase): + def test_py_vq(self, level=1): initc = N.concatenate(([[X[0]], [X[1]], [X[2]]])) code = initc.copy() label1 = py_vq(X, initc)[0] assert_array_equal(label1, LABEL1) - def check_py_vq2(self, level=1): + def test_py_vq2(self, level=1): initc = N.concatenate(([[X[0]], [X[1]], [X[2]]])) code = initc.copy() label1 = py_vq2(X, initc)[0] assert_array_equal(label1, LABEL1) - def check_vq(self, level=1): + def test_vq(self, level=1): initc = N.concatenate(([[X[0]], [X[1]], [X[2]]])) code = initc.copy() if TESTC: @@ -66,7 +62,7 @@ else: print "== not testing C imp of vq ==" - #def check_py_vq_1d(self, level=1): + #def test_py_vq_1d(self, level=1): # """Test special rank 1 vq algo, python implementation.""" # data = X[:, 0] # initc = data[:3] @@ -76,7 +72,7 @@ # assert_array_equal(a, ta) # assert_array_equal(b, tb) - def check_vq_1d(self, level=1): + def test_vq_1d(self, level=1): """Test special rank 1 vq algo, python implementation.""" data = X[:, 0] initc = data[:3] @@ -89,15 +85,15 @@ else: print "== not testing C imp of vq (rank 1) ==" -class TestKMean(NumpyTestCase): - def check_kmeans_simple(self, level=1): +class TestKMean(TestCase): + def test_kmeans_simple(self, level=1): initc = N.concatenate(([[X[0]], [X[1]], [X[2]]])) code = initc.copy() code1 = kmeans(X, code, iter = 1)[0] assert_array_almost_equal(code1, CODET2) - def check_kmeans_lost_cluster(self, level=1): + def test_kmeans_lost_cluster(self, level=1): """This will cause kmean to have a cluster with no points.""" data = N.fromfile(open(DATAFILE1), sep = ", ") data = data.reshape((200, 2)) @@ -113,7 +109,7 @@ except ClusterError, e: print "exception raised as expected: " + str(e) - def check_kmeans2_simple(self, level=1): + def test_kmeans2_simple(self, level=1): """Testing simple call to kmeans2 and its results.""" initc = N.concatenate(([[X[0]], [X[1]], [X[2]]])) code = initc.copy() @@ -123,7 +119,7 @@ assert_array_almost_equal(code1, CODET1) assert_array_almost_equal(code2, CODET2) - def check_kmeans2_rank1(self, level=1): + def test_kmeans2_rank1(self, level=1): """Testing simple call to kmeans2 with rank 1 data.""" data = N.fromfile(open(DATAFILE1), sep = ", ") data = data.reshape((200, 2)) @@ -135,7 +131,7 @@ code1 = kmeans2(data1, code, iter = 1)[0] code2 = kmeans2(data1, code, iter = 2)[0] - def check_kmeans2_init(self, level = 1): + def test_kmeans2_init(self, level = 1): """Testing that kmeans2 init methods work.""" data = N.fromfile(open(DATAFILE1), sep = ", ") data = data.reshape((200, 2)) @@ -149,4 +145,4 @@ kmeans2(data, 3, minit = 'points') if __name__ == "__main__": - NumpyTest().run() + unittest.main() Modified: branches/testing_cleanup/scipy/fftpack/tests/test_basic.py =================================================================== --- branches/testing_cleanup/scipy/fftpack/tests/test_basic.py 2007-12-29 02:48:19 UTC (rev 3743) +++ branches/testing_cleanup/scipy/fftpack/tests/test_basic.py 2007-12-29 02:53:36 UTC (rev 3744) @@ -11,11 +11,9 @@ python tests/test_basic.py [] """ import sys -from numpy.testing import * -set_package_path() -from fftpack import ifft,fft,fftn,ifftn,rfft,irfft -from fftpack import _fftpack as fftpack -restore_path() +from scipy.testing import * +from scipy.fftpack import ifft,fft,fftn,ifftn,rfft,irfft +from scipy.fftpack import _fftpack as fftpack from numpy import arange, add, array, asarray, zeros, dot, exp, pi,\ swapaxes, double, cdouble @@ -90,9 +88,9 @@ x1[0] = x[0] return direct_idft(x1).real -class TestFft(NumpyTestCase): +class TestFft(TestCase): - def check_definition(self): + def test_definition(self): x = [1,2,3,4+1j,1,2,3,4+2j] y = fft(x) y1 = direct_dft(x) @@ -100,7 +98,7 @@ x = [1,2,3,4+0j,5] assert_array_almost_equal(fft(x),direct_dft(x)) - def check_n_argument_real(self): + def test_n_argument_real(self): x1 = [1,2,3,4] x2 = [1,2,3,4] y = fft([x1,x2],n=4) @@ -108,7 +106,7 @@ assert_array_almost_equal(y[0],direct_dft(x1)) assert_array_almost_equal(y[1],direct_dft(x2)) - def _check_n_argument_complex(self): + def _test_n_argument_complex(self): x1 = [1,2,3,4+1j] x2 = [1,2,3,4+1j] y = fft([x1,x2],n=4) @@ -116,7 +114,7 @@ assert_array_almost_equal(y[0],direct_dft(x1)) assert_array_almost_equal(y[1],direct_dft(x2)) - def check_djbfft(self): + def test_djbfft(self): for i in range(2,14): n = 2**i x = range(n) @@ -162,9 +160,9 @@ print ' (secs for %s calls)' % (repeat) sys.stdout.flush() -class TestIfft(NumpyTestCase): +class TestIfft(TestCase): - def check_definition(self): + def test_definition(self): x = [1,2,3,4+1j,1,2,3,4+2j] y = ifft(x) y1 = direct_idft(x) @@ -178,7 +176,7 @@ x = [1,2,3,4,5] assert_array_almost_equal(ifft(x),direct_idft(x)) - def check_djbfft(self): + def test_djbfft(self): for i in range(2,14): n = 2**i x = range(n) @@ -188,14 +186,14 @@ y = fftpack.zrfft(x,direction=-1) assert_array_almost_equal(y,y2) - def check_random_complex(self): + def test_random_complex(self): for size in [1,51,111,100,200,64,128,256,1024]: x = random([size]).astype(cdouble) x = random([size]).astype(cdouble) +1j*x assert_array_almost_equal (ifft(fft(x)),x) assert_array_almost_equal (fft(ifft(x)),x) - def check_random_real(self): + def test_random_real(self): for size in [1,51,111,100,200,64,128,256,1024]: x = random([size]).astype(double) assert_array_almost_equal (ifft(fft(x)),x) @@ -237,9 +235,9 @@ print ' (secs for %s calls)' % (repeat) sys.stdout.flush() -class TestRfft(NumpyTestCase): +class TestRfft(TestCase): - def check_definition(self): + def test_definition(self): x = [1,2,3,4,1,2,3,4] y = rfft(x) y1 = direct_rdft(x) @@ -249,7 +247,7 @@ y1 = direct_rdft(x) assert_array_almost_equal(y,y1) - def check_djbfft(self): + def test_djbfft(self): from numpy.fft import fft as numpy_fft for i in range(2,14): n = 2**i @@ -292,9 +290,9 @@ print ' (secs for %s calls)' % (repeat) sys.stdout.flush() -class TestIrfft(NumpyTestCase): +class TestIrfft(TestCase): - def check_definition(self): + def test_definition(self): x = [1,2,3,4,1,2,3,4] x1 = [1,2+3j,4+1j,2+3j,4,2-3j,4-1j,2-3j] y = irfft(x) @@ -308,7 +306,7 @@ assert_array_almost_equal(y,y1) assert_array_almost_equal(y,ifft(x1)) - def check_djbfft(self): + def test_djbfft(self): from numpy.fft import ifft as numpy_ifft for i in range(2,14): n = 2**i @@ -323,7 +321,7 @@ y = fftpack.drfft(x,direction=-1) assert_array_almost_equal(y,y1) - def check_random_real(self): + def test_random_real(self): for size in [1,51,111,100,200,64,128,256,1024]: x = random([size]).astype(double) assert_array_almost_equal (irfft(rfft(x)),x) @@ -368,9 +366,9 @@ sys.stdout.flush() -class TestFftn(NumpyTestCase): +class TestFftn(TestCase): - def check_definition(self): + def test_definition(self): x = [[1,2,3],[4,5,6],[7,8,9]] y = fftn(x) assert_array_almost_equal(y,direct_dftn(x)) @@ -379,7 +377,7 @@ x = random((5,4,3,20)) assert_array_almost_equal(fftn(x),direct_dftn(x)) - def check_axes_argument(self): + def test_axes_argument(self): #plane == ji_plane, x== kji_space plane1 = [[1,2,3],[4,5,6],[7,8,9]] plane2 = [[10,11,12],[13,14,15],[16,17,18]] @@ -469,7 +467,7 @@ y = fftn(x,axes=()) # point assert_array_almost_equal(y,x) - def check_shape_argument(self): + def test_shape_argument(self): small_x = [[1,2,3],[4,5,6]] large_x1 = [[1,2,3,0],[4,5,6,0],[0,0,0,0],[0,0,0,0]] y = fftn(small_x,shape=(4,4)) @@ -477,7 +475,7 @@ y = fftn(small_x,shape=(3,4)) assert_array_almost_equal (y,fftn(large_x1[:-1])) - def check_shape_axes_argument(self): + def test_shape_axes_argument(self): small_x = [[1,2,3],[4,5,6],[7,8,9]] large_x1 = array([[1,2,3,0], [4,5,6,0], @@ -529,9 +527,9 @@ sys.stdout.flush() -class TestIfftn(NumpyTestCase): +class TestIfftn(TestCase): - def check_definition(self): + def test_definition(self): x = [[1,2,3],[4,5,6],[7,8,9]] y = ifftn(x) assert_array_almost_equal(y,direct_idftn(x)) @@ -540,11 +538,11 @@ x = random((5,4,3,20)) assert_array_almost_equal(ifftn(x),direct_idftn(x)) - def check_random_complex(self): + def test_random_complex(self): for size in [1,2,51,32,64,92]: x = random([size,size]) + 1j*random([size,size]) assert_array_almost_equal (ifftn(fftn(x)),x) assert_array_almost_equal (fftn(ifftn(x)),x) if __name__ == "__main__": - NumpyTest().run() + unittest.main() Modified: branches/testing_cleanup/scipy/fftpack/tests/test_helper.py =================================================================== --- branches/testing_cleanup/scipy/fftpack/tests/test_helper.py 2007-12-29 02:48:19 UTC (rev 3743) +++ branches/testing_cleanup/scipy/fftpack/tests/test_helper.py 2007-12-29 02:53:36 UTC (rev 3744) @@ -12,19 +12,17 @@ """ import sys -from numpy.testing import * -set_package_path() -from fftpack import fftshift,ifftshift,fftfreq,rfftfreq -restore_path() +from scipy.testing import * +from scipy.fftpack import fftshift,ifftshift,fftfreq,rfftfreq from numpy import pi def random(size): return rand(*size) -class TestFFTShift(NumpyTestCase): +class TestFFTShift(TestCase): - def check_definition(self): + def test_definition(self): x = [0,1,2,3,4,-4,-3,-2,-1] y = [-4,-3,-2,-1,0,1,2,3,4] assert_array_almost_equal(fftshift(x),y) @@ -34,14 +32,14 @@ assert_array_almost_equal(fftshift(x),y) assert_array_almost_equal(ifftshift(y),x) - def check_inverse(self): + def test_inverse(self): for n in [1,4,9,100,211]: x = random((n,)) assert_array_almost_equal(ifftshift(fftshift(x)),x) -class TestFFTFreq(NumpyTestCase): +class TestFFTFreq(TestCase): - def check_definition(self): + def test_definition(self): x = [0,1,2,3,4,-4,-3,-2,-1] assert_array_almost_equal(9*fftfreq(9),x) assert_array_almost_equal(9*pi*fftfreq(9,pi),x) @@ -49,9 +47,9 @@ assert_array_almost_equal(10*fftfreq(10),x) assert_array_almost_equal(10*pi*fftfreq(10,pi),x) -class TestRFFTFreq(NumpyTestCase): +class TestRFFTFreq(TestCase): - def check_definition(self): + def test_definition(self): x = [0,1,1,2,2,3,3,4,4] assert_array_almost_equal(9*rfftfreq(9),x) assert_array_almost_equal(9*pi*rfftfreq(9,pi),x) @@ -60,4 +58,4 @@ assert_array_almost_equal(10*pi*rfftfreq(10,pi),x) if __name__ == "__main__": - NumpyTest().run() + unittest.main() Modified: branches/testing_cleanup/scipy/fftpack/tests/test_pseudo_diffs.py =================================================================== --- branches/testing_cleanup/scipy/fftpack/tests/test_pseudo_diffs.py 2007-12-29 02:48:19 UTC (rev 3743) +++ branches/testing_cleanup/scipy/fftpack/tests/test_pseudo_diffs.py 2007-12-29 02:53:36 UTC (rev 3744) @@ -11,12 +11,10 @@ python tests/test_pseudo_diffs.py [] """ import sys -from numpy.testing import * -set_package_path() -from fftpack import diff,fft,ifft,tilbert,itilbert,hilbert,ihilbert,rfft -from fftpack import shift -from fftpack import fftfreq -restore_path() +from scipy.testing import * +from scipy.fftpack import diff,fft,ifft,tilbert,itilbert,hilbert,ihilbert,rfft +from scipy.fftpack import shift +from scipy.fftpack import fftfreq from numpy import arange, add, array, sin, cos, pi,exp,tanh,sum,sign @@ -77,9 +75,9 @@ return ifft(fft(x)*exp(k*a)).real -class TestDiff(NumpyTestCase): +class TestDiff(TestCase): - def check_definition(self): + def test_definition(self): for n in [16,17,64,127,32]: x = arange(n)*2*pi/n assert_array_almost_equal(diff(sin(x)),direct_diff(sin(x))) @@ -100,7 +98,7 @@ assert_array_almost_equal(diff(sin(4*x),k),direct_diff(sin(4*x),k)) assert_array_almost_equal(diff(cos(4*x),k),direct_diff(cos(4*x),k)) - def check_period(self): + def test_period(self): for n in [17,64]: x = arange(n)/float(n) assert_array_almost_equal(diff(sin(2*pi*x),period=1), @@ -108,7 +106,7 @@ assert_array_almost_equal(diff(sin(2*pi*x),3,period=1), -(2*pi)**3*cos(2*pi*x)) - def check_sin(self): + def test_sin(self): for n in [32,64,77]: x = arange(n)*2*pi/n assert_array_almost_equal(diff(sin(x)),cos(x)) @@ -118,7 +116,7 @@ assert_array_almost_equal(diff(sin(4*x)),4*cos(4*x)) assert_array_almost_equal(diff(sin(sin(x))),cos(x)*cos(sin(x))) - def check_expr(self): + def test_expr(self): for n in [64,77,100,128,256,512,1024,2048,4096,8192][:5]: x = arange(n)*2*pi/n f=sin(x)*cos(4*x)+exp(sin(3*x)) @@ -132,7 +130,7 @@ assert_array_almost_equal(diff(ddf,-1),df) #print max(abs(d1-df)) - def check_expr_large(self): + def test_expr_large(self): for n in [2048,4096]: x = arange(n)*2*pi/n f=sin(x)*cos(4*x)+exp(sin(3*x)) @@ -144,7 +142,7 @@ assert_array_almost_equal(diff(ddf,-1),df) assert_array_almost_equal(diff(f,2),ddf) - def check_int(self): + def test_int(self): n = 64 x = arange(n)*2*pi/n assert_array_almost_equal(diff(sin(x),-1),-cos(x)) @@ -152,7 +150,7 @@ assert_array_almost_equal(diff(sin(x),-4),sin(x)) assert_array_almost_equal(diff(2*cos(2*x),-1),sin(2*x)) - def check_random_even(self): + def test_random_even(self): for k in [0,2,4,6]: for n in [60,32,64,56,55]: f=random ((n,)) @@ -164,7 +162,7 @@ assert_array_almost_equal(diff(diff(f,k),-k),f) assert_array_almost_equal(diff(diff(f,-k),k),f) - def check_random_odd(self): + def test_random_odd(self): for k in [0,1,2,3,4,5,6]: for n in [33,65,55]: f=random ((n,)) @@ -174,7 +172,7 @@ assert_array_almost_equal(diff(diff(f,k),-k),f) assert_array_almost_equal(diff(diff(f,-k),k),f) - def check_zero_nyquist (self): + def test_zero_nyquist (self): for k in [0,1,2,3,4,5,6]: for n in [32,33,64,56,55]: f=random ((n,)) @@ -216,9 +214,9 @@ print ' (secs for %s calls)' % (repeat) -class TestTilbert(NumpyTestCase): +class TestTilbert(TestCase): - def check_definition(self): + def test_definition(self): for h in [0.1,0.5,1,5.5,10]: for n in [16,17,64,127]: x = arange(n)*2*pi/n @@ -230,7 +228,7 @@ assert_array_almost_equal(tilbert(sin(2*x),h), direct_tilbert(sin(2*x),h)) - def check_random_even(self): + def test_random_even(self): for h in [0.1,0.5,1,5.5,10]: for n in [32,64,56]: f=random ((n,)) @@ -239,7 +237,7 @@ assert_almost_equal(sum(f,axis=0),0.0) assert_array_almost_equal(direct_tilbert(direct_itilbert(f,h),h),f) - def check_random_odd(self): + def test_random_odd(self): for h in [0.1,0.5,1,5.5,10]: for n in [33,65,55]: f=random ((n,)) @@ -277,9 +275,9 @@ sys.stdout.flush() print ' (secs for %s calls)' % (repeat) -class TestITilbert(NumpyTestCase): +class TestITilbert(TestCase): - def check_definition(self): + def test_definition(self): for h in [0.1,0.5,1,5.5,10]: for n in [16,17,64,127]: x = arange(n)*2*pi/n @@ -291,9 +289,9 @@ assert_array_almost_equal(itilbert(sin(2*x),h), direct_itilbert(sin(2*x),h)) -class TestHilbert(NumpyTestCase): +class TestHilbert(TestCase): - def check_definition(self): + def test_definition(self): for n in [16,17,64,127]: x = arange(n)*2*pi/n y = hilbert(sin(x)) @@ -302,7 +300,7 @@ assert_array_almost_equal(hilbert(sin(2*x)), direct_hilbert(sin(2*x))) - def check_tilbert_relation(self): + def test_tilbert_relation(self): for n in [16,17,64,127]: x = arange(n)*2*pi/n f = sin (x)+cos (2*x)*sin(x) @@ -312,7 +310,7 @@ y2 = tilbert(f,h=10) assert_array_almost_equal (y,y2) - def check_random_odd(self): + def test_random_odd(self): for n in [33,65,55]: f=random ((n,)) af=sum(f,axis=0)/n @@ -321,7 +319,7 @@ assert_array_almost_equal(ihilbert(hilbert(f)),f) assert_array_almost_equal(hilbert(ihilbert(f)),f) - def check_random_even(self): + def test_random_even(self): for n in [32,64,56]: f=random ((n,)) af=sum(f,axis=0)/n @@ -360,9 +358,9 @@ sys.stdout.flush() print ' (secs for %s calls)' % (repeat) -class TestIHilbert(NumpyTestCase): +class TestIHilbert(TestCase): - def check_definition(self): + def test_definition(self): for n in [16,17,64,127]: x = arange(n)*2*pi/n y = ihilbert(sin(x)) @@ -371,7 +369,7 @@ assert_array_almost_equal(ihilbert(sin(2*x)), direct_ihilbert(sin(2*x))) - def check_itilbert_relation(self): + def test_itilbert_relation(self): for n in [16,17,64,127]: x = arange(n)*2*pi/n f = sin (x)+cos (2*x)*sin(x) @@ -381,9 +379,9 @@ y2 = itilbert(f,h=10) assert_array_almost_equal (y,y2) -class TestShift(NumpyTestCase): +class TestShift(TestCase): - def check_definition(self): + def test_definition(self): for n in [18,17,64,127,32,2048,256]: x = arange(n)*2*pi/n for a in [0.1,3]: @@ -430,4 +428,4 @@ print ' (secs for %s calls)' % (repeat) if __name__ == "__main__": - NumpyTest('fftpack.pseudo_diffs').run() + unittest.main() Modified: branches/testing_cleanup/scipy/integrate/tests/test_integrate.py =================================================================== --- branches/testing_cleanup/scipy/integrate/tests/test_integrate.py 2007-12-29 02:48:19 UTC (rev 3743) +++ branches/testing_cleanup/scipy/integrate/tests/test_integrate.py 2007-12-29 02:53:36 UTC (rev 3744) @@ -9,12 +9,10 @@ import numpy from numpy import arange, zeros, array, dot, sqrt, cos, sin from scipy.linalg import norm -from numpy.testing import * -set_package_path() +from scipy.testing import * from scipy.integrate import odeint -restore_path() -class TestODEInt(NumpyTestCase): +class TestODEInt(TestCase): """ Test odeint: free vibration of a simple oscillator m \ddot{u} + k u = 0, u(0) = u_0 \dot{u}(0) \dot{u}_0 @@ -32,7 +30,7 @@ tmp[1,0] = -self.k / self.m return dot(tmp,z) - def check_odeint1(self): + def test_odeint1(self): omega = sqrt(self.k / self.m) z0 = zeros(2, float) z0[0] = 1.0 # initial displacement @@ -51,4 +49,4 @@ assert res < 1.0e-6 if __name__ == "__main__": - NumpyTest().run() + unittest.main() Modified: branches/testing_cleanup/scipy/integrate/tests/test_quadpack.py =================================================================== --- branches/testing_cleanup/scipy/integrate/tests/test_quadpack.py 2007-12-29 02:48:19 UTC (rev 3743) +++ branches/testing_cleanup/scipy/integrate/tests/test_quadpack.py 2007-12-29 02:53:36 UTC (rev 3744) @@ -1,29 +1,27 @@ import numpy from numpy import sqrt, cos, sin, arctan, exp, log, pi, Inf -from numpy.testing import * -set_package_path() +from scipy.testing import * from scipy.integrate import quad, dblquad, tplquad -restore_path() def assert_quad((value, err), tabledValue, errTol=1.5e-8): assert abs(value-tabledValue) < err, (value, tabledValue, err) if errTol is not None: assert err < errTol, (err, errTol) -class TestQuad(NumpyTestCase): - def check_typical(self): +class TestQuad(TestCase): + def test_typical(self): # 1) Typical function with two extra arguments: def myfunc(x,n,z): # Bessel function integrand return cos(n*x-z*sin(x))/pi assert_quad(quad(myfunc,0,pi,(2,1.8)), 0.30614353532540296487) - def check_indefinite(self): + def test_indefinite(self): # 2) Infinite integration limits --- Euler's constant def myfunc(x): # Euler's constant integrand return -exp(-x)*log(x) assert_quad(quad(myfunc,0,Inf), 0.577215664901532860606512) - def check_singular(self): + def test_singular(self): # 3) Singular points in region of integration. def myfunc(x): if x > 0 and x < 2.5: @@ -36,7 +34,7 @@ assert_quad(quad(myfunc,0,10,points=[2.5,5.0]), 1 - cos(2.5) + exp(-2.5) - exp(-5.0)) - def check_sine_weighted_finite(self): + def test_sine_weighted_finite(self): # 4) Sine weighted integral (finite limits) def myfunc(x,a): return exp(a*(x-1)) @@ -45,7 +43,7 @@ assert_quad(quad(myfunc,0,1,args=20,weight='sin',wvar=ome), (20*sin(ome)-ome*cos(ome)+ome*exp(-20))/(20**2 + ome**2)) - def check_sine_weighted_infinite(self): + def test_sine_weighted_infinite(self): # 5) Sine weighted integral (infinite limits) def myfunc(x,a): return exp(-x*a) @@ -55,7 +53,7 @@ assert_quad(quad(myfunc,0,Inf,args=a,weight='sin',wvar=ome), ome/(a**2 + ome**2)) - def check_cosine_weighted_infinite(self): + def test_cosine_weighted_infinite(self): # 6) Cosine weighted integral (negative infinite limits) def myfunc(x,a): return exp(x*a) @@ -65,7 +63,7 @@ assert_quad(quad(myfunc,-Inf,0,args=a,weight='cos',wvar=ome), a/(a**2 + ome**2)) - def check_algebraic_log_weight(self): + def test_algebraic_log_weight(self): # 6) Algebraic-logarithmic weight. def myfunc(x,a): return 1/(1+x+2**(-a)) @@ -74,7 +72,7 @@ assert_quad(quad(myfunc,-1,1,args=a,weight='alg',wvar=(-0.5,-0.5)), pi/sqrt((1+2**(-a))**2 - 1)) - def check_cauchypv_weight(self): + def test_cauchypv_weight(self): # 7) Cauchy prinicpal value weighting w(x) = 1/(x-c) def myfunc(x,a): return 2.0**(-a)/((x-1)**2+4.0**(-a)) @@ -85,7 +83,7 @@ assert_quad(quad(myfunc,0,5,args=0.4,weight='cauchy',wvar=2.0), tabledValue, errTol=1.9e-8) - def check_double_integral(self): + def test_double_integral(self): # 8) Double Integral test def simpfunc(y,x): # Note order of arguments. return x+y @@ -94,7 +92,7 @@ assert_quad(dblquad(simpfunc,a,b,lambda x: x, lambda x: 2*x), 5/6.0 * (b**3.0-a**3.0)) - def check_triple_integral(self): + def test_triple_integral(self): # 9) Triple Integral test def simpfunc(z,y,x): # Note order of arguments. return x+y+z @@ -106,4 +104,4 @@ 8/3.0 * (b**4.0 - a**4.0)) if __name__ == "__main__": - NumpyTest().run() + unittest.main() Modified: branches/testing_cleanup/scipy/integrate/tests/test_quadrature.py =================================================================== --- branches/testing_cleanup/scipy/integrate/tests/test_quadrature.py 2007-12-29 02:48:19 UTC (rev 3743) +++ branches/testing_cleanup/scipy/integrate/tests/test_quadrature.py 2007-12-29 02:53:36 UTC (rev 3744) @@ -1,17 +1,15 @@ import numpy from numpy import cos, sin, pi -from numpy.testing import * +from scipy.testing import * -set_package_path() from scipy.integrate import quadrature, romberg, romb -restore_path() -class TestQuadrature(NumpyTestCase): +class TestQuadrature(TestCase): def quad(self, x, a, b, args): raise NotImplementedError - def check_quadrature(self): + def test_quadrature(self): # Typical function with two extra arguments: def myfunc(x,n,z): # Bessel function integrand return cos(n*x-z*sin(x))/pi @@ -19,7 +17,7 @@ table_val = 0.30614353532540296487 assert_almost_equal(val, table_val, decimal=7) - def check_romberg(self): + def test_romberg(self): # Typical function with two extra arguments: def myfunc(x, n, z): # Bessel function integrand return cos(n*x-z*sin(x))/pi @@ -27,8 +25,8 @@ table_val = 0.30614353532540296487 assert_almost_equal(val, table_val, decimal=7) - def check_romb(self): + def test_romb(self): assert_equal(romb(numpy.arange(17)),128) if __name__ == "__main__": - NumpyTest().run() + unittest.main() Modified: branches/testing_cleanup/scipy/interpolate/tests/test_fitpack.py =================================================================== --- branches/testing_cleanup/scipy/interpolate/tests/test_fitpack.py 2007-12-29 02:48:19 UTC (rev 3743) +++ branches/testing_cleanup/scipy/interpolate/tests/test_fitpack.py 2007-12-29 02:53:36 UTC (rev 3744) @@ -13,17 +13,15 @@ #import libwadpy import sys -from numpy.testing import * +from scipy.testing import * from numpy import array -set_package_path() -from interpolate.fitpack2 import UnivariateSpline,LSQUnivariateSpline,\ +from scipy.interpolate.fitpack2 import UnivariateSpline,LSQUnivariateSpline,\ InterpolatedUnivariateSpline -from interpolate.fitpack2 import LSQBivariateSpline, SmoothBivariateSpline,\ - RectBivariateSpline -restore_path() +from scipy.interpolate.fitpack2 import LSQBivariateSpline, \ + SmoothBivariateSpline, RectBivariateSpline -class TestUnivariateSpline(NumpyTestCase): - def check_linear_constant(self): +class TestUnivariateSpline(TestCase): + def test_linear_constant(self): x = [1,2,3] y = [3,3,3] lut = UnivariateSpline(x,y,k=1) @@ -32,7 +30,7 @@ assert_almost_equal(lut.get_residual(),0.0) assert_array_almost_equal(lut([1,1.5,2]),[3,3,3]) - def check_linear_1d(self): + def test_linear_1d(self): x = [1,2,3] y = [0,2,4] lut = UnivariateSpline(x,y,k=1) @@ -41,8 +39,8 @@ assert_almost_equal(lut.get_residual(),0.0) assert_array_almost_equal(lut([1,1.5,2]),[0,1,2]) -class TestLSQBivariateSpline(NumpyTestCase): - def check_linear_constant(self): +class TestLSQBivariateSpline(TestCase): + def test_linear_constant(self): x = [1,1,1,2,2,2,3,3,3] y = [1,2,3,1,2,3,1,2,3] z = [3,3,3,3,3,3,3,3,3] @@ -54,8 +52,8 @@ #print lut.get_coeffs() #print lut.get_residual() -class TestSmoothBivariateSpline(NumpyTestCase): - def check_linear_constant(self): +class TestSmoothBivariateSpline(TestCase): + def test_linear_constant(self): x = [1,1,1,2,2,2,3,3,3] y = [1,2,3,1,2,3,1,2,3] z = [3,3,3,3,3,3,3,3,3] @@ -65,7 +63,7 @@ assert_almost_equal(lut.get_residual(),0.0) assert_array_almost_equal(lut([1,1.5,2],[1,1.5]),[[3,3],[3,3],[3,3]]) - def check_linear_1d(self): + def test_linear_1d(self): x = [1,1,1,2,2,2,3,3,3] y = [1,2,3,1,2,3,1,2,3] z = [0,0,0,2,2,2,4,4,4] @@ -75,8 +73,8 @@ assert_almost_equal(lut.get_residual(),0.0) assert_array_almost_equal(lut([1,1.5,2],[1,1.5]),[[0,0],[1,1],[2,2]]) -class TestRectBivariateSpline(NumpyTestCase): - def check_defaults(self): +class TestRectBivariateSpline(TestCase): + def test_defaults(self): x = array([1,2,3,4,5]) y = array([1,2,3,4,5]) z = array([[1,2,1,2,1],[1,2,1,2,1],[1,2,3,2,1],[1,2,2,2,1],[1,2,1,2,1]]) @@ -84,4 +82,4 @@ assert_array_almost_equal(lut(x,y),z) if __name__ == "__main__": - NumpyTest().run() + unittest.main() Modified: branches/testing_cleanup/scipy/interpolate/tests/test_interpolate.py =================================================================== --- branches/testing_cleanup/scipy/interpolate/tests/test_interpolate.py 2007-12-29 02:48:19 UTC (rev 3743) +++ branches/testing_cleanup/scipy/interpolate/tests/test_interpolate.py 2007-12-29 02:53:36 UTC (rev 3744) @@ -1,13 +1,11 @@ -from numpy.testing import * +from scipy.testing import * from numpy import mgrid, pi, sin, ogrid import numpy as np -set_package_path() -from interpolate import interp1d, interp2d -restore_path() +from scipy.interpolate import interp1d, interp2d -class TestInterp2D(NumpyTestCase): +class TestInterp2D(TestCase): def test_interp2d(self): y, x = mgrid[0:pi:20j, 0:pi:21j] z = sin(x+y) @@ -18,7 +16,7 @@ assert_almost_equal(I(u.ravel(), v.ravel()), sin(v+u), decimal=2) -class TestInterp1D(NumpyTestCase): +class TestInterp1D(TestCase): def setUp(self): self.x10 = np.arange(10.) @@ -202,4 +200,4 @@ if __name__ == "__main__": - NumpyTest().run() + unittest.main() Modified: branches/testing_cleanup/scipy/io/tests/test_array_import.py =================================================================== --- branches/testing_cleanup/scipy/io/tests/test_array_import.py 2007-12-29 02:48:19 UTC (rev 3743) +++ branches/testing_cleanup/scipy/io/tests/test_array_import.py 2007-12-29 02:53:36 UTC (rev 3744) @@ -6,18 +6,15 @@ # also check out numpyio.fread.__doc__ and other method docstrings. import os -from numpy.testing import * -set_package_path() -import io -from io import numpyio -restore_path() +from scipy.testing import * +import scipy.io as io +from scipy.io import numpyio - import numpy.oldnumeric as N import tempfile -class TestNumpyio(NumpyTestCase): - def check_basic(self): +class TestNumpyio(TestCase): + def test_basic(self): # Generate some data a = 255*rand(20) # Open a file @@ -34,8 +31,8 @@ assert(N.product(a.astype(N.Int16) == b,axis=0)) os.remove(fname) -class TestReadArray(NumpyTestCase): - def check_complex(self): +class TestReadArray(TestCase): + def test_complex(self): a = rand(13,4) + 1j*rand(13,4) fname = tempfile.mktemp('.dat') io.write_array(fname,a) @@ -43,7 +40,7 @@ assert_array_almost_equal(a,b,decimal=4) os.remove(fname) - def check_float(self): + def test_float(self): a = rand(3,4)*30 fname = tempfile.mktemp('.dat') io.write_array(fname,a) @@ -51,7 +48,7 @@ assert_array_almost_equal(a,b,decimal=4) os.remove(fname) - def check_integer(self): + def test_integer(self): from scipy import stats a = stats.randint.rvs(1,20,size=(3,4)) fname = tempfile.mktemp('.dat') @@ -61,4 +58,4 @@ os.remove(fname) if __name__ == "__main__": - NumpyTest().run() + unittest.main() Modified: branches/testing_cleanup/scipy/io/tests/test_datasource.py =================================================================== --- branches/testing_cleanup/scipy/io/tests/test_datasource.py 2007-12-29 02:48:19 UTC (rev 3743) +++ branches/testing_cleanup/scipy/io/tests/test_datasource.py 2007-12-29 02:53:36 UTC (rev 3744) @@ -1,25 +1,20 @@ - -import bz2 -import gzip import os import sys import struct +import bz2 +import gzip from tempfile import mkdtemp, mkstemp, NamedTemporaryFile from shutil import rmtree from urlparse import urlparse -from numpy.testing import * +from scipy.testing import * # HACK: import the src datasource # Until datasource is robust enough to include in scipy.io package sys.path.insert(0, os.path.abspath('..')) -import datasource +import scipy.io.datasource as datasource del sys.path[0] -#set_package_path() -#from scipy.io import datasource -#restore_path() - def urlopen_stub(url, data=None): '''Stub to replace urlopen for testing.''' if url == valid_httpurl(): @@ -74,7 +69,7 @@ def invalid_httpfile(): return http_fakefile -class TestDataSourceOpen(NumpyTestCase): +class TestDataSourceOpen(TestCase): def setUp(self): self.tmpdir = mkdtemp() self.ds = datasource.DataSource(self.tmpdir) @@ -120,7 +115,7 @@ self.assertEqual(magic_line, result) -class TestDataSourceExists(NumpyTestCase): +class TestDataSourceExists(TestCase): def setUp(self): self.tmpdir = mkdtemp() self.ds = datasource.DataSource(self.tmpdir) @@ -150,7 +145,7 @@ self.assertEqual(self.ds.exists(tmpfile), False) -class TestDataSourceAbspath(NumpyTestCase): +class TestDataSourceAbspath(TestCase): def setUp(self): self.tmpdir = mkdtemp() self.ds = datasource.DataSource(self.tmpdir) @@ -187,7 +182,7 @@ self.assertNotEqual(invalidfile, self.ds.abspath(tmpfile)) -class TestRespositoryAbspath(NumpyTestCase): +class TestRespositoryAbspath(TestCase): def setUp(self): self.tmpdir = mkdtemp() self.repos = datasource.Repository(valid_baseurl(), self.tmpdir) @@ -204,7 +199,7 @@ self.assertEqual(local_path, filepath) -class TestRepositoryExists(NumpyTestCase): +class TestRepositoryExists(TestCase): def setUp(self): self.tmpdir = mkdtemp() self.repos = datasource.Repository(valid_baseurl(), self.tmpdir) @@ -237,7 +232,7 @@ assert self.repos.exists(tmpfile) -class TestOpenFunc(NumpyTestCase): +class TestOpenFunc(TestCase): def setUp(self): self.tmpdir = mkdtemp() @@ -253,4 +248,4 @@ if __name__ == "__main__": - NumpyTest().run() + unittest.main() Modified: branches/testing_cleanup/scipy/io/tests/test_mio.py =================================================================== --- branches/testing_cleanup/scipy/io/tests/test_mio.py 2007-12-29 02:48:19 UTC (rev 3743) +++ branches/testing_cleanup/scipy/io/tests/test_mio.py 2007-12-29 02:53:36 UTC (rev 3744) @@ -4,16 +4,14 @@ from glob import glob from cStringIO import StringIO from tempfile import mkstemp -from numpy.testing import set_package_path, restore_path, NumpyTestCase, NumpyTest -from numpy.testing import assert_equal, assert_array_almost_equal from numpy import arange, array, eye, pi, cos, exp, sin, sqrt, ndarray, \ zeros, reshape, transpose, empty import scipy.sparse as SP -set_package_path() +from scipy.testing import * + from scipy.io.mio import loadmat, savemat from scipy.io.mio5 import mat_obj, mat_struct -restore_path() try: # Python 2.3 support from sets import Set as set @@ -22,220 +20,215 @@ test_data_path = os.path.join(os.path.dirname(__file__), './data') -class TestMIOArray(NumpyTestCase): - def __init__(self, *args, **kwargs): - super(TestMIOArray, self).__init__(*args, **kwargs) +def _check_level(self, label, expected, actual): + """ Check one level of a potentially nested object / list """ + # object array is returned from cell array in mat file + typex = type(expected) + typac = type(actual) + if isinstance(expected, ndarray) and expected.dtype.hasobject: + assert typex is typac, "Different types at %s" % label + assert len(expected) == len(actual), "Different list lengths at %s" % label + for i, ev in enumerate(expected): + level_label = "%s, [%d], " % (label, i) + self._check_level(level_label, ev, actual[i]) + return + # object, as container for matlab structs and objects + elif isinstance(expected, mat_struct) or isinstance(expected, mat_obj): + assert isinstance(actual, typex), \ + "Different types %s and %s at %s" % (typex, typac, label) + ex_fields = dir(expected) + ac_fields = dir(actual) + for k in ex_fields: + if k.startswith('__') and k.endswith('__'): + continue + assert k in ac_fields, "Missing property at %s" % label + ev = expected.__dict__[k] + v = actual.__dict__[k] + level_label = "%s, property %s, " % (label, k) + self._check_level(level_label, ev, v) + return + # hoping this is a single value, which might be an array + if SP.issparse(expected): + assert SP.issparse(actual), "Expected sparse at %s" % label + assert_array_almost_equal(actual.todense(), + expected.todense(), + err_msg = label, + decimal = 5) + elif isinstance(expected, ndarray): + if expected.shape: # allow scalar and 0d array comparisons + assert isinstance(actual, ndarray), "Expected ndarray at %s" % label + assert_array_almost_equal(actual, expected, err_msg=label, decimal=5) + else: + assert isinstance(expected, typac), \ + "Types %s and %s do not match at %s" % (typex, typac, label) + assert_equal(actual, expected, err_msg=label) - def _check_level(self, label, expected, actual): - """ Check one level of a potentially nested object / list """ - # object array is returned from cell array in mat file - typex = type(expected) - typac = type(actual) - if isinstance(expected, ndarray) and expected.dtype.hasobject: - assert typex is typac, "Different types at %s" % label - assert len(expected) == len(actual), "Different list lengths at %s" % label - for i, ev in enumerate(expected): - level_label = "%s, [%d], " % (label, i) - self._check_level(level_label, ev, actual[i]) - return - # object, as container for matlab structs and objects - elif isinstance(expected, mat_struct) or isinstance(expected, mat_obj): - assert isinstance(actual, typex), \ - "Different types %s and %s at %s" % (typex, typac, label) - ex_fields = dir(expected) - ac_fields = dir(actual) - for k in ex_fields: - if k.startswith('__') and k.endswith('__'): - continue - assert k in ac_fields, "Missing property at %s" % label - ev = expected.__dict__[k] - v = actual.__dict__[k] - level_label = "%s, property %s, " % (label, k) - self._check_level(level_label, ev, v) - return - # hoping this is a single value, which might be an array - if SP.issparse(expected): - assert SP.issparse(actual), "Expected sparse at %s" % label - assert_array_almost_equal(actual.todense(), - expected.todense(), - err_msg = label, - decimal = 5) - elif isinstance(expected, ndarray): - if expected.shape: # allow scalar and 0d array comparisons - assert isinstance(actual, ndarray), "Expected ndarray at %s" % label - assert_array_almost_equal(actual, expected, err_msg=label, decimal=5) - else: - assert isinstance(expected, typac), \ - "Types %s and %s do not match at %s" % (typex, typac, label) - assert_equal(actual, expected, err_msg=label) +def _check_case(self, name, files, case): + for file_name in files: + matdict = loadmat(file_name) + label = "test %s; file %s" % (name, file_name) + for k, expected in case.items(): + k_label = "%s, variable %s" % (label, k) + assert k in matdict, "Missing key at %s" % k_label + self._check_level(k_label, expected, matdict[k]) - def _check_case(self, name, files, case): - for file_name in files: - matdict = loadmat(file_name) - label = "test %s; file %s" % (name, file_name) - for k, expected in case.items(): - k_label = "%s, variable %s" % (label, k) - assert k in matdict, "Missing key at %s" % k_label - self._check_level(k_label, expected, matdict[k]) +# Add the load tests dynamically, with given parameters +def _make_check_case(name, files, expected): + def cc(self): + self._check_case(name, files, expected) + cc.__doc__ = "check loadmat case %s" % name + return cc - # Add the load tests dynamically, with given parameters - def _make_check_case(name, files, expected): - def cc(self): - self._check_case(name, files, expected) - cc.__doc__ = "check loadmat case %s" % name - return cc +# Add the round trip tests dynamically, with given parameters +def _make_rt_check_case(name, expected, format): + def cc(self): + mat_stream = StringIO() + savemat(mat_stream, expected, format=format) + mat_stream.seek(0) + self._check_case(name, [mat_stream], expected) + cc.__doc__ = "check loadmat case %s" % name + return cc - # Add the round trip tests dynamically, with given parameters - def _make_rt_check_case(name, expected, format): - def cc(self): - mat_stream = StringIO() - savemat(mat_stream, expected, format=format) - mat_stream.seek(0) - self._check_case(name, [mat_stream], expected) - cc.__doc__ = "check loadmat case %s" % name - return cc +# Define cases to test +theta = pi/4*arange(9,dtype=float) +case_table4 = [ + {'name': 'double', + 'expected': {'testdouble': theta} + }] +case_table4.append( + {'name': 'string', + 'expected': {'teststring': u'"Do nine men interpret?" "Nine men," I nod.'}, + }) +case_table4.append( + {'name': 'complex', + 'expected': {'testcomplex': cos(theta) + 1j*sin(theta)} + }) +A = zeros((3,5)) +A[0] = range(1,6) +A[:,0] = range(1,4) +case_table4.append( + {'name': 'matrix', + 'expected': {'testmatrix': A}, + }) +case_table4.append( + {'name': 'sparse', + 'expected': {'testsparse': SP.csc_matrix(A)}, + }) +B = A.astype(complex) +B[0,0] += 1j +case_table4.append( + {'name': 'sparsecomplex', + 'expected': {'testsparsecomplex': SP.csc_matrix(B)}, + }) +case_table4.append( + {'name': 'multi', + 'expected': {'theta': theta, + 'a': A}, + }) +case_table4.append( + {'name': 'minus', + 'expected': {'testminus': array(-1)}, + }) +case_table4.append( + {'name': 'onechar', + 'expected': {'testonechar': u'r'}, + }) +case_table5 = [ + {'name': 'cell', + 'expected': {'testcell': + array([u'This cell contains this string and 3 arrays of '+\ + 'increasing length', + array(1), array([1,2]), array([1,2,3])], + dtype=object)} + }] +case_table5.append( + {'name': 'emptycell', + 'expected': {'testemptycell': + array([array(1), array(2), array([]), + array([]), array(3)], dtype=object)} + }) +case_table5.append( + {'name': 'stringarray', + 'expected': {'teststringarray': array( + [u'one ', u'two ', u'three'], dtype=object)}, + }) +case_table5.append( + {'name': '3dmatrix', + 'expected': {'test3dmatrix': transpose(reshape(range(1,25), (4,3,2)))} + }) +case_table5_rt = [ + {'name': '3dmatrix', + 'expected': {'test3dmatrix': transpose(reshape(range(1,25), (4,3,2)))} + }] +st = mat_struct() +st.stringfield = u'Rats live on no evil star.' +st.doublefield = array([sqrt(2),exp(1),pi]) +st.complexfield = (1+1j)*array([sqrt(2),exp(1),pi]) +case_table5.append( + {'name': 'struct', + 'expected': {'teststruct': st} + }) +a = array([array(1), + array([array(2), array(3), + array([array(4), array(5)], + dtype=object)], + dtype=object)], + dtype=object) +case_table5.append( + {'name': 'cellnest', + 'expected': {'testcellnest': a}, + }) +st = mat_struct() +st.one = array(1) +st.two = mat_struct() +st.two.three = u'number 3' +case_table5.append( + {'name': 'structnest', + 'expected': {'teststructnest': st} + }) +a = array([mat_struct(), mat_struct()]) +a[0].one = array(1) +a[0].two = array(2) +a[1].one = u'number 1' +a[1].two = u'number 2' +case_table5.append( + {'name': 'structarr', + 'expected': {'teststructarr': a} + }) +a = mat_obj() +a._classname = 'inline' +a.expr = u'x' +a.inputExpr = u' x = INLINE_INPUTS_{1};' +a.args = u'x' +a.isEmpty = array(0) +a.numArgs = array(1) +a.version = array(1) +case_table5.append( + {'name': 'object', + 'expected': {'testobject': a} + }) +u_str = file( + os.path.join(test_data_path, 'japanese_utf8.txt'), + 'rb').read().decode('utf-8') +case_table5.append( + {'name': 'unicode', + 'expected': {'testunicode': u_str} + }) +# add load tests - # Define cases to test - theta = pi/4*arange(9,dtype=float) - case_table4 = [ - {'name': 'double', - 'expected': {'testdouble': theta} - }] - case_table4.append( - {'name': 'string', - 'expected': {'teststring': u'"Do nine men interpret?" "Nine men," I nod.'}, - }) - case_table4.append( - {'name': 'complex', - 'expected': {'testcomplex': cos(theta) + 1j*sin(theta)} - }) - A = zeros((3,5)) - A[0] = range(1,6) - A[:,0] = range(1,4) - case_table4.append( - {'name': 'matrix', - 'expected': {'testmatrix': A}, - }) - case_table4.append( - {'name': 'sparse', - 'expected': {'testsparse': SP.csc_matrix(A)}, - }) - B = A.astype(complex) - B[0,0] += 1j - case_table4.append( - {'name': 'sparsecomplex', - 'expected': {'testsparsecomplex': SP.csc_matrix(B)}, - }) - case_table4.append( - {'name': 'multi', - 'expected': {'theta': theta, - 'a': A}, - }) - case_table4.append( - {'name': 'minus', - 'expected': {'testminus': array(-1)}, - }) - case_table4.append( - {'name': 'onechar', - 'expected': {'testonechar': u'r'}, - }) - case_table5 = [ - {'name': 'cell', - 'expected': {'testcell': - array([u'This cell contains this string and 3 arrays of '+\ - 'increasing length', - array(1), array([1,2]), array([1,2,3])], - dtype=object)} - }] - case_table5.append( - {'name': 'emptycell', - 'expected': {'testemptycell': - array([array(1), array(2), array([]), - array([]), array(3)], dtype=object)} - }) - case_table5.append( - {'name': 'stringarray', - 'expected': {'teststringarray': array( - [u'one ', u'two ', u'three'], dtype=object)}, - }) - case_table5.append( - {'name': '3dmatrix', - 'expected': {'test3dmatrix': transpose(reshape(range(1,25), (4,3,2)))} - }) - case_table5_rt = [ - {'name': '3dmatrix', - 'expected': {'test3dmatrix': transpose(reshape(range(1,25), (4,3,2)))} - }] - st = mat_struct() - st.stringfield = u'Rats live on no evil star.' - st.doublefield = array([sqrt(2),exp(1),pi]) - st.complexfield = (1+1j)*array([sqrt(2),exp(1),pi]) - case_table5.append( - {'name': 'struct', - 'expected': {'teststruct': st} - }) - a = array([array(1), - array([array(2), array(3), - array([array(4), array(5)], - dtype=object)], - dtype=object)], - dtype=object) - case_table5.append( - {'name': 'cellnest', - 'expected': {'testcellnest': a}, - }) - st = mat_struct() - st.one = array(1) - st.two = mat_struct() - st.two.three = u'number 3' - case_table5.append( - {'name': 'structnest', - 'expected': {'teststructnest': st} - }) - a = array([mat_struct(), mat_struct()]) - a[0].one = array(1) - a[0].two = array(2) - a[1].one = u'number 1' - a[1].two = u'number 2' - case_table5.append( - {'name': 'structarr', - 'expected': {'teststructarr': a} - }) - a = mat_obj() - a._classname = 'inline' - a.expr = u'x' - a.inputExpr = u' x = INLINE_INPUTS_{1};' - a.args = u'x' - a.isEmpty = array(0) - a.numArgs = array(1) - a.version = array(1) - case_table5.append( - {'name': 'object', - 'expected': {'testobject': a} - }) - u_str = file( - os.path.join(test_data_path, 'japanese_utf8.txt'), - 'rb').read().decode('utf-8') - case_table5.append( - {'name': 'unicode', - 'expected': {'testunicode': u_str} - }) - # add load tests +def test_loads(): for case in case_table4 + case_table5: name = case['name'] expected = case['expected'] filt = os.path.join(test_data_path, 'test%s_*.mat' % name) files = glob(filt) assert files, "No files for test %s using filter %s" % (name, filt) - exec 'check_%s = _make_check_case(name, files, expected)' % name - # round trip tests + yield _make_check_case, name, files, expected + +def test_round_trips(): for case in case_table4 + case_table5_rt: name = case['name'] + '_round_trip' expected = case['expected'] format = case in case_table4 and '4' or '5' - exec 'check_%s = _make_rt_check_case(name, expected, format)' \ - % name + yield _make_rt_check_case, name, expected, format - -if __name__ == "__main__": - NumpyTest().run() Modified: branches/testing_cleanup/scipy/io/tests/test_mmio.py =================================================================== --- branches/testing_cleanup/scipy/io/tests/test_mmio.py 2007-12-29 02:48:19 UTC (rev 3743) +++ branches/testing_cleanup/scipy/io/tests/test_mmio.py 2007-12-29 02:53:36 UTC (rev 3744) @@ -1,17 +1,16 @@ #!/usr/bin/env python from tempfile import mktemp -from numpy.testing import * from numpy import array,transpose +from scipy.testing import * -set_package_path() -from io.mmio import mminfo,mmread,mmwrite import scipy -restore_path() +import scipy.sparse +from scipy.io.mmio import mminfo,mmread,mmwrite -class TestMMIOArray(NumpyTestCase): +class TestMMIOArray(TestCase): - def check_simple(self): + def test_simple(self): a = [[1,2],[3,4]] fn = mktemp() mmwrite(fn,a) @@ -19,7 +18,7 @@ b = mmread(fn) assert_array_almost_equal(a,b) - def check_simple_rectangular(self): + def test_simple_rectangular(self): a = [[1,2,3],[4,5,6]] fn = mktemp() mmwrite(fn,a) @@ -27,7 +26,7 @@ b = mmread(fn) assert_array_almost_equal(a,b) - def check_simple_rectangular_real(self): + def test_simple_rectangular_real(self): a = [[1,2],[3.5,4],[5,6]] fn = mktemp() mmwrite(fn,a) @@ -35,7 +34,7 @@ b = mmread(fn) assert_array_almost_equal(a,b) - def check_simple_real(self): + def test_simple_real(self): a = [[1,2],[3,4.0]] fn = mktemp() mmwrite(fn,a) @@ -43,7 +42,7 @@ b = mmread(fn) assert_array_almost_equal(a,b) - def check_simple_complex(self): + def test_simple_complex(self): a = [[1,2],[3,4j]] fn = mktemp() mmwrite(fn,a) @@ -51,7 +50,7 @@ b = mmread(fn) assert_array_almost_equal(a,b) - def check_simple_symmetric(self): + def test_simple_symmetric(self): a = [[1,2],[2,4]] fn = mktemp() mmwrite(fn,a) @@ -59,7 +58,7 @@ b = mmread(fn) assert_array_almost_equal(a,b) - def check_simple_skew_symmetric(self): + def test_simple_skew_symmetric(self): a = [[1,2],[-2,4]] fn = mktemp() mmwrite(fn,a) @@ -67,7 +66,7 @@ b = mmread(fn) assert_array_almost_equal(a,b) - def check_simple_skew_symmetric_float(self): + def test_simple_skew_symmetric_float(self): a = array([[1,2],[-2.0,4]],'f') fn = mktemp() mmwrite(fn,a) @@ -75,7 +74,7 @@ b = mmread(fn) assert_array_almost_equal(a,b) - def check_simple_hermitian(self): + def test_simple_hermitian(self): a = [[1,2+3j],[2-3j,4]] fn = mktemp() mmwrite(fn,a) @@ -83,7 +82,7 @@ b = mmread(fn) assert_array_almost_equal(a,b) - def check_random_symmetric_real(self): + def test_random_symmetric_real(self): sz = (20,20) a = rand(*sz) a = a + transpose(a) @@ -93,7 +92,7 @@ b = mmread(fn) assert_array_almost_equal(a,b) - def check_random_rect_real(self): + def test_random_rect_real(self): sz = (20,15) a = rand(*sz) fn = mktemp() @@ -184,8 +183,8 @@ 5 4 ''' -class TestMMIOCoordinate(NumpyTestCase): - def check_read_geneal(self): +class TestMMIOCoordinate(TestCase): + def test_read_geneal(self): """read a general matrix""" fn = mktemp() f = open(fn,'w') @@ -200,7 +199,7 @@ b = mmread(fn).todense() assert_array_almost_equal(a,b) - def check_read_hermitian(self): + def test_read_hermitian(self): """read a hermitian matrix""" fn = mktemp() f = open(fn,'w') @@ -215,7 +214,7 @@ b = mmread(fn).todense() assert_array_almost_equal(a,b) - def check_read_skew(self): + def test_read_skew(self): """read a skew-symmetric matrix""" fn = mktemp() f = open(fn,'w') @@ -230,7 +229,7 @@ b = mmread(fn).todense() assert_array_almost_equal(a,b) - def check_read_symmetric(self): + def test_read_symmetric(self): """read a symmetric matrix""" fn = mktemp() f = open(fn,'w') @@ -245,7 +244,7 @@ b = mmread(fn).todense() assert_array_almost_equal(a,b) - def check_read_symmetric(self): + def test_read_symmetric(self): """read a symmetric pattern matrix""" fn = mktemp() f = open(fn,'w') @@ -261,7 +260,7 @@ assert_array_almost_equal(a,b) - def check_real_write_read(self): + def test_real_write_read(self): I = array([0, 0, 1, 2, 3, 3, 3, 4]) J = array([0, 3, 1, 2, 1, 3, 4, 4]) V = array([ 1.0, 6.0, 10.5, 0.015, 250.5, -280.0, 33.32, 12.0 ]) @@ -276,7 +275,7 @@ b = mmread(fn).todense() assert_array_almost_equal(a,b) - def check_complex_write_read(self): + def test_complex_write_read(self): I = array([0, 0, 1, 2, 3, 3, 3, 4]) J = array([0, 3, 1, 2, 1, 3, 4, 4]) V = array([ 1.0 + 3j, 6.0 + 2j, 10.50 + 0.9j, 0.015 + -4.4j, @@ -293,4 +292,4 @@ assert_array_almost_equal(a,b) if __name__ == "__main__": - NumpyTest().run() + unittest.main() Modified: branches/testing_cleanup/scipy/io/tests/test_npfile.py =================================================================== --- branches/testing_cleanup/scipy/io/tests/test_npfile.py 2007-12-29 02:48:19 UTC (rev 3743) +++ branches/testing_cleanup/scipy/io/tests/test_npfile.py 2007-12-29 02:53:36 UTC (rev 3744) @@ -1,14 +1,12 @@ +import os from StringIO import StringIO -import os from tempfile import mkstemp -from numpy.testing import * +from scipy.testing import * import numpy as N -set_package_path() -from io.npfile import npfile, sys_endian_code -restore_path() +from scipy.io.npfile import npfile, sys_endian_code -class TestNpFile(NumpyTestCase): +class TestNpFile(TestCase): def test_init(self): fd, fname = mkstemp() @@ -102,3 +100,6 @@ assert_array_equal(npf.read_array(adt, shp, endian='dtype'), bs_arr) npf.rewind() assert_array_equal(npf.read_array(adt, shp, order='C'), cf_arr) + +if __name__ == "__main__": + unittest.main() Modified: branches/testing_cleanup/scipy/io/tests/test_recaster.py =================================================================== --- branches/testing_cleanup/scipy/io/tests/test_recaster.py 2007-12-29 02:48:19 UTC (rev 3743) +++ branches/testing_cleanup/scipy/io/tests/test_recaster.py 2007-12-29 02:53:36 UTC (rev 3744) @@ -1,16 +1,14 @@ -from numpy.testing import * import numpy as N +from scipy.testing import * -set_package_path() -from io.recaster import sctype_attributes, Recaster, RecastError -restore_path() +from scipy.io.recaster import sctype_attributes, Recaster, RecastError try: # Python 2.3 support from sets import Set as set except: pass -class TestRecaster(NumpyTestCase): +class TestRecaster(TestCase): def test_init(self): # Setting sctype_list @@ -173,3 +171,7 @@ dtt = arr.dtype.type assert dtt is outp, \ 'Expected %s from %s, got %s' % (outp, inp, dtt) + +if __name__ == "__main__": + unittest.main() + Modified: branches/testing_cleanup/scipy/lib/blas/tests/test_blas.py =================================================================== --- branches/testing_cleanup/scipy/lib/blas/tests/test_blas.py 2007-12-29 02:48:19 UTC (rev 3743) +++ branches/testing_cleanup/scipy/lib/blas/tests/test_blas.py 2007-12-29 02:53:36 UTC (rev 3744) @@ -12,21 +12,18 @@ python tests/test_blas.py [] """ +import sys +import math from numpy import arange, add, array -import math +from scipy.testing import * +from scipy.lib.blas import fblas +from scipy.lib.blas import cblas +from scipy.lib.blas import get_blas_funcs -import sys -from numpy.testing import * -set_package_path() -from blas import fblas -from blas import cblas -from blas import get_blas_funcs -restore_path() +class TestCBLAS1Simple(TestCase): -class TestCBLAS1Simple(NumpyTestCase): - - def check_axpy(self): + def test_axpy(self): for p in 'sd': f = getattr(cblas,p+'axpy',None) if f is None: continue @@ -36,9 +33,9 @@ if f is None: continue assert_array_almost_equal(f([1,2j,3],[2,-1,3],a=5),[7,10j-1,18]) -class TestFBLAS1Simple(NumpyTestCase): +class TestFBLAS1Simple(TestCase): - def check_axpy(self): + def test_axpy(self): for p in 'sd': f = getattr(fblas,p+'axpy',None) if f is None: continue @@ -47,7 +44,7 @@ f = getattr(fblas,p+'axpy',None) if f is None: continue assert_array_almost_equal(f([1,2j,3],[2,-1,3],a=5),[7,10j-1,18]) - def check_copy(self): + def test_copy(self): for p in 'sd': f = getattr(fblas,p+'copy',None) if f is None: continue @@ -56,7 +53,7 @@ f = getattr(fblas,p+'copy',None) if f is None: continue assert_array_almost_equal(f([3,4j,5+3j],[8]*3),[3,4j,5+3j]) - def check_asum(self): + def test_asum(self): for p in 'sd': f = getattr(fblas,p+'asum',None) if f is None: continue @@ -65,7 +62,7 @@ f = getattr(fblas,p+'asum',None) if f is None: continue assert_almost_equal(f([3j,-4,3-4j]),14) - def check_dot(self): + def test_dot(self): for p in 'sd': f = getattr(fblas,p+'dot',None) if f is None: continue @@ -76,7 +73,7 @@ assert_almost_equal(f([3j,-4,3-4j],[2,3,1]),-9+2j) f = getattr(fblas,p+'dotc') assert_almost_equal(f([3j,-4,3-4j],[2,3j,1]),3-14j) - def check_nrm2(self): + def test_nrm2(self): for p in 'sd': f = getattr(fblas,p+'nrm2',None) if f is None: continue @@ -85,7 +82,7 @@ f = getattr(fblas,p+'nrm2',None) if f is None: continue assert_almost_equal(f([3j,-4,3-4j]),math.sqrt(50)) - def check_scal(self): + def test_scal(self): for p in 'sd': f = getattr(fblas,p+'scal',None) if f is None: continue @@ -98,7 +95,7 @@ f = getattr(fblas,p+'scal',None) if f is None: continue assert_array_almost_equal(f(3,[3j,-4,3-4j]),[9j,-12,9-12j]) - def check_swap(self): + def test_swap(self): for p in 'sd': f = getattr(fblas,p+'swap',None) if f is None: continue @@ -113,7 +110,7 @@ x1,y1 = f(x,y) assert_array_almost_equal(x1,y) assert_array_almost_equal(y1,x) - def check_amax(self): + def test_amax(self): for p in 'sd': f = getattr(fblas,'i'+p+'amax') assert_equal(f([-2,4,3]),1) @@ -122,9 +119,9 @@ assert_equal(f([-5,4+3j,6]),1) #XXX: need tests for rot,rotm,rotg,rotmg -class TestFBLAS2Simple(NumpyTestCase): +class TestFBLAS2Simple(TestCase): - def check_gemv(self): + def test_gemv(self): for p in 'sd': f = getattr(fblas,p+'gemv',None) if f is None: continue @@ -136,7 +133,7 @@ assert_array_almost_equal(f(3j,[[3-4j]],[-4]),[-48-36j]) assert_array_almost_equal(f(3j,[[3-4j]],[-4],3,[5j]),[-48-21j]) - def check_ger(self): + def test_ger(self): for p in 'sd': f = getattr(fblas,p+'ger',None) @@ -170,9 +167,9 @@ 2j, 3j],[3j,4j]),[[6,8],[12,16],[18,24]]) -class TestFBLAS3Simple(NumpyTestCase): +class TestFBLAS3Simple(TestCase): - def check_gemm(self): + def test_gemm(self): for p in 'sd': f = getattr(fblas,p+'gemm',None) if f is None: continue @@ -188,22 +185,22 @@ assert_array_almost_equal(f(1,[[1,2],[1,2]],[[3],[4]]),[[11],[11]]) assert_array_almost_equal(f(1,[[1,2]],[[3,3],[4,4]]),[[11,11]]) - def check_gemm2(self): + def test_gemm2(self): for p in 'sdcz': f = getattr(fblas,p+'gemm',None) if f is None: continue assert_array_almost_equal(f(1,[[1,2]],[[3],[4]]),[[11]]) assert_array_almost_equal(f(1,[[1,2],[1,2]],[[3],[4]]),[[11],[11]]) -class TestBLAS(NumpyTestCase): +class TestBLAS(TestCase): - def check_blas(self): + def test_blas(self): a = array([[1,1,1]]) b = array([[1],[1],[1]]) gemm, = get_blas_funcs(('gemm',),(a,b)) assert_array_almost_equal(gemm(1,a,b),[[3]],15) - def check_fblas(self): + def test_fblas(self): if hasattr(fblas,'empty_module'): print """ **************************************************************** @@ -212,7 +209,7 @@ See scipy/INSTALL.txt for troubleshooting. **************************************************************** """ - def check_cblas(self): + def test_cblas(self): if hasattr(cblas,'empty_module'): print """ **************************************************************** @@ -226,4 +223,4 @@ """ if __name__ == "__main__": - NumpyTest().run() + unittest.main() Modified: branches/testing_cleanup/scipy/lib/blas/tests/test_fblas.py =================================================================== --- branches/testing_cleanup/scipy/lib/blas/tests/test_fblas.py 2007-12-29 02:48:19 UTC (rev 3743) +++ branches/testing_cleanup/scipy/lib/blas/tests/test_fblas.py 2007-12-29 02:53:36 UTC (rev 3744) @@ -6,13 +6,12 @@ # !! Complex calculations really aren't checked that carefully. # !! Only real valued complex numbers are used in tests. -from numpy import * - import sys -from numpy.testing import * -set_package_path() -from blas import fblas -restore_path() +from numpy import zeros, transpose, newaxis, shape, float32, \ + float64, complex64, complex128, arange, array, common_type, \ + conjugate +from scipy.testing import * +from scipy.lib.blas import fblas #decimal accuracy to require between Python and LAPACK/BLAS calculations accuracy = 5 @@ -40,39 +39,40 @@ ################################################## ### Test blas ?axpy -class BaseAxpy(NumpyTestCase): - def check_default_a(self): +class BaseAxpy(object): + # Mixin class to test dtypes + def test_default_a(self): x = arange(3.,dtype=self.dtype) y = arange(3.,dtype=x.dtype) real_y = x*1.+y self.blas_func(x,y) assert_array_almost_equal(real_y,y) - def check_simple(self): + def test_simple(self): x = arange(3.,dtype=self.dtype) y = arange(3.,dtype=x.dtype) real_y = x*3.+y self.blas_func(x,y,a=3.) assert_array_almost_equal(real_y,y) - def check_x_stride(self): + def test_x_stride(self): x = arange(6.,dtype=self.dtype) y = zeros(3,x.dtype) y = arange(3.,dtype=x.dtype) real_y = x[::2]*3.+y self.blas_func(x,y,a=3.,n=3,incx=2) assert_array_almost_equal(real_y,y) - def check_y_stride(self): + def test_y_stride(self): x = arange(3.,dtype=self.dtype) y = zeros(6,x.dtype) real_y = x*3.+y[::2] self.blas_func(x,y,a=3.,n=3,incy=2) assert_array_almost_equal(real_y,y[::2]) - def check_x_and_y_stride(self): + def test_x_and_y_stride(self): x = arange(12.,dtype=self.dtype) y = zeros(6,x.dtype) real_y = x[::4]*3.+y[::2] self.blas_func(x,y,a=3.,n=3,incx=4,incy=2) assert_array_almost_equal(real_y,y[::2]) - def check_x_bad_size(self): + def test_x_bad_size(self): x = arange(12.,dtype=self.dtype) y = zeros(6,x.dtype) try: @@ -81,7 +81,7 @@ return # should catch error and never get here assert(0) - def check_y_bad_size(self): + def test_y_bad_size(self): x = arange(12.,dtype=complex64) y = zeros(6,x.dtype) try: @@ -92,21 +92,21 @@ assert(0) try: - class TestSaxpy(BaseAxpy): + class TestSaxpy(TestCase, BaseAxpy): blas_func = fblas.saxpy dtype = float32 except AttributeError: class TestSaxpy: pass -class TestDaxpy(BaseAxpy): +class TestDaxpy(TestCase, BaseAxpy): blas_func = fblas.daxpy dtype = float64 try: - class TestCaxpy(BaseAxpy): + class TestCaxpy(TestCase, BaseAxpy): blas_func = fblas.caxpy dtype = complex64 except AttributeError: class TestCaxpy: pass -class TestZaxpy(BaseAxpy): +class TestZaxpy(TestCase, BaseAxpy): blas_func = fblas.zaxpy dtype = complex128 @@ -114,19 +114,20 @@ ################################################## ### Test blas ?scal -class BaseScal(NumpyTestCase): - def check_simple(self): +class BaseScal(object): + # Mixin class for testing particular dtypes + def test_simple(self): x = arange(3.,dtype=self.dtype) real_x = x*3. self.blas_func(3.,x) assert_array_almost_equal(real_x,x) - def check_x_stride(self): + def test_x_stride(self): x = arange(6.,dtype=self.dtype) real_x = x.copy() real_x[::2] = x[::2]*array(3.,self.dtype) self.blas_func(3.,x,n=3,incx=2) assert_array_almost_equal(real_x,x) - def check_x_bad_size(self): + def test_x_bad_size(self): x = arange(12.,dtype=self.dtype) try: self.blas_func(2.,x,n=4,incx=5) @@ -135,21 +136,21 @@ # should catch error and never get here assert(0) try: - class TestSscal(BaseScal): + class TestSscal(TestCase, BaseScal): blas_func = fblas.sscal dtype = float32 except AttributeError: class TestSscal: pass -class TestDscal(BaseScal): +class TestDscal(TestCase, BaseScal): blas_func = fblas.dscal dtype = float64 try: - class TestCscal(BaseScal): + class TestCscal(TestCase, BaseScal): blas_func = fblas.cscal dtype = complex64 except AttributeError: class TestCscal: pass -class TestZscal(BaseScal): +class TestZscal(TestCase, BaseScal): blas_func = fblas.zscal dtype = complex128 @@ -159,28 +160,29 @@ ################################################## ### Test blas ?copy -class BaseCopy(NumpyTestCase): - def check_simple(self): +class BaseCopy(object): + # Mixin class for testing dtypes + def test_simple(self): x = arange(3.,dtype=self.dtype) y = zeros(shape(x),x.dtype) self.blas_func(x,y) assert_array_almost_equal(x,y) - def check_x_stride(self): + def test_x_stride(self): x = arange(6.,dtype=self.dtype) y = zeros(3,x.dtype) self.blas_func(x,y,n=3,incx=2) assert_array_almost_equal(x[::2],y) - def check_y_stride(self): + def test_y_stride(self): x = arange(3.,dtype=self.dtype) y = zeros(6,x.dtype) self.blas_func(x,y,n=3,incy=2) assert_array_almost_equal(x,y[::2]) - def check_x_and_y_stride(self): + def test_x_and_y_stride(self): x = arange(12.,dtype=self.dtype) y = zeros(6,x.dtype) self.blas_func(x,y,n=3,incx=4,incy=2) assert_array_almost_equal(x[::4],y[::2]) - def check_x_bad_size(self): + def test_x_bad_size(self): x = arange(12.,dtype=self.dtype) y = zeros(6,x.dtype) try: @@ -189,7 +191,7 @@ return # should catch error and never get here assert(0) - def check_y_bad_size(self): + def test_y_bad_size(self): x = arange(12.,dtype=complex64) y = zeros(6,x.dtype) try: @@ -198,7 +200,7 @@ return # should catch error and never get here assert(0) - #def check_y_bad_type(self): + #def test_y_bad_type(self): ## Hmmm. Should this work? What should be the output. # x = arange(3.,dtype=self.dtype) # y = zeros(shape(x)) @@ -206,21 +208,21 @@ # assert_array_almost_equal(x,y) try: - class TestScopy(BaseCopy): + class TestScopy(TestCase, BaseCopy): blas_func = fblas.scopy dtype = float32 except AttributeError: class TestScopy: pass -class TestDcopy(BaseCopy): +class TestDcopy(TestCase, BaseCopy): blas_func = fblas.dcopy dtype = float64 try: - class TestCcopy(BaseCopy): + class TestCcopy(TestCase, BaseCopy): blas_func = fblas.ccopy dtype = complex64 except AttributeError: class TestCcopy: pass -class TestZcopy(BaseCopy): +class TestZcopy(TestCase, BaseCopy): blas_func = fblas.zcopy dtype = complex128 @@ -228,8 +230,9 @@ ################################################## ### Test blas ?swap -class BaseSwap(NumpyTestCase): - def check_simple(self): +class BaseSwap(object): + # Mixin class to implement test objects + def test_simple(self): x = arange(3.,dtype=self.dtype) y = zeros(shape(x),x.dtype) desired_x = y.copy() @@ -237,7 +240,7 @@ self.blas_func(x,y) assert_array_almost_equal(desired_x,x) assert_array_almost_equal(desired_y,y) - def check_x_stride(self): + def test_x_stride(self): x = arange(6.,dtype=self.dtype) y = zeros(3,x.dtype) desired_x = y.copy() @@ -245,7 +248,7 @@ self.blas_func(x,y,n=3,incx=2) assert_array_almost_equal(desired_x,x[::2]) assert_array_almost_equal(desired_y,y) - def check_y_stride(self): + def test_y_stride(self): x = arange(3.,dtype=self.dtype) y = zeros(6,x.dtype) desired_x = y.copy()[::2] @@ -254,7 +257,7 @@ assert_array_almost_equal(desired_x,x) assert_array_almost_equal(desired_y,y[::2]) - def check_x_and_y_stride(self): + def test_x_and_y_stride(self): x = arange(12.,dtype=self.dtype) y = zeros(6,x.dtype) desired_x = y.copy()[::2] @@ -262,7 +265,7 @@ self.blas_func(x,y,n=3,incx=4,incy=2) assert_array_almost_equal(desired_x,x[::4]) assert_array_almost_equal(desired_y,y[::2]) - def check_x_bad_size(self): + def test_x_bad_size(self): x = arange(12.,dtype=self.dtype) y = zeros(6,x.dtype) try: @@ -271,7 +274,7 @@ return # should catch error and never get here assert(0) - def check_y_bad_size(self): + def test_y_bad_size(self): x = arange(12.,dtype=complex64) y = zeros(6,x.dtype) try: @@ -282,21 +285,21 @@ assert(0) try: - class TestSswap(BaseSwap): + class TestSswap(TestCase, BaseSwap): blas_func = fblas.sswap dtype = float32 except AttributeError: class TestSswap: pass -class TestDswap(BaseSwap): +class TestDswap(TestCase, BaseSwap): blas_func = fblas.dswap dtype = float64 try: - class TestCswap(BaseSwap): + class TestCswap(TestCase, BaseSwap): blas_func = fblas.cswap dtype = complex64 except AttributeError: class TestCswap: pass -class TestZswap(BaseSwap): +class TestZswap(TestCase, BaseSwap): blas_func = fblas.zswap dtype = complex128 @@ -304,7 +307,8 @@ ### Test blas ?gemv ### This will be a mess to test all cases. -class BaseGemv(NumpyTestCase): +class BaseGemv(object): + # Mixin class to test dtypes def get_data(self,x_stride=1,y_stride=1): mult = array(1, dtype = self.dtype) if self.dtype in [complex64, complex128]: @@ -316,37 +320,37 @@ x = arange(shape(a)[0]*x_stride,dtype=self.dtype) * mult y = arange(shape(a)[1]*y_stride,dtype=self.dtype) * mult return alpha,beta,a,x,y - def check_simple(self): + def test_simple(self): alpha,beta,a,x,y = self.get_data() desired_y = alpha*matrixmultiply(a,x)+beta*y y = self.blas_func(alpha,a,x,beta,y) assert_array_almost_equal(desired_y,y) - def check_default_beta_y(self): + def test_default_beta_y(self): alpha,beta,a,x,y = self.get_data() desired_y = matrixmultiply(a,x) y = self.blas_func(1,a,x) assert_array_almost_equal(desired_y,y) - def check_simple_transpose(self): + def test_simple_transpose(self): alpha,beta,a,x,y = self.get_data() desired_y = alpha*matrixmultiply(transpose(a),x)+beta*y y = self.blas_func(alpha,a,x,beta,y,trans=1) assert_array_almost_equal(desired_y,y) - def check_simple_transpose_conj(self): + def test_simple_transpose_conj(self): alpha,beta,a,x,y = self.get_data() desired_y = alpha*matrixmultiply(transpose(conjugate(a)),x)+beta*y y = self.blas_func(alpha,a,x,beta,y,trans=2) assert_array_almost_equal(desired_y,y) - def check_x_stride(self): + def test_x_stride(self): alpha,beta,a,x,y = self.get_data(x_stride=2) desired_y = alpha*matrixmultiply(a,x[::2])+beta*y y = self.blas_func(alpha,a,x,beta,y,incx=2) assert_array_almost_equal(desired_y,y) - def check_x_stride_transpose(self): + def test_x_stride_transpose(self): alpha,beta,a,x,y = self.get_data(x_stride=2) desired_y = alpha*matrixmultiply(transpose(a),x[::2])+beta*y y = self.blas_func(alpha,a,x,beta,y,trans=1,incx=2) assert_array_almost_equal(desired_y,y) - def check_x_stride_assert(self): + def test_x_stride_assert(self): # What is the use of this test? alpha,beta,a,x,y = self.get_data(x_stride=2) try: @@ -359,19 +363,19 @@ assert(0) except: pass - def check_y_stride(self): + def test_y_stride(self): alpha,beta,a,x,y = self.get_data(y_stride=2) desired_y = y.copy() desired_y[::2] = alpha*matrixmultiply(a,x)+beta*y[::2] y = self.blas_func(alpha,a,x,beta,y,incy=2) assert_array_almost_equal(desired_y,y) - def check_y_stride_transpose(self): + def test_y_stride_transpose(self): alpha,beta,a,x,y = self.get_data(y_stride=2) desired_y = y.copy() desired_y[::2] = alpha*matrixmultiply(transpose(a),x)+beta*y[::2] y = self.blas_func(alpha,a,x,beta,y,trans=1,incy=2) assert_array_almost_equal(desired_y,y) - def check_y_stride_assert(self): + def test_y_stride_assert(self): # What is the use of this test? alpha,beta,a,x,y = self.get_data(y_stride=2) try: @@ -386,21 +390,21 @@ pass try: - class TestSgemv(BaseGemv): + class TestSgemv(TestCase, BaseGemv): blas_func = fblas.sgemv dtype = float32 except AttributeError: class TestSgemv: pass -class TestDgemv(BaseGemv): +class TestDgemv(TestCase, BaseGemv): blas_func = fblas.dgemv dtype = float64 try: - class TestCgemv(BaseGemv): + class TestCgemv(TestCase, BaseGemv): blas_func = fblas.cgemv dtype = complex64 except AttributeError: class TestCgemv: pass -class TestZgemv(BaseGemv): +class TestZgemv(TestCase, BaseGemv): blas_func = fblas.zgemv dtype = complex128 @@ -409,7 +413,7 @@ ### Test blas ?ger ### This will be a mess to test all cases. -class BaseGer(NumpyTestCase): +class BaseGer(TestCase): def get_data(self,x_stride=1,y_stride=1): from numpy.random import normal alpha = array(1., dtype = self.dtype) @@ -417,31 +421,31 @@ x = arange(shape(a)[0]*x_stride,dtype=self.dtype) y = arange(shape(a)[1]*y_stride,dtype=self.dtype) return alpha,a,x,y - def check_simple(self): + def test_simple(self): alpha,a,x,y = self.get_data() # tranpose takes care of Fortran vs. C(and Python) memory layout desired_a = alpha*transpose(x[:,newaxis]*y) + a self.blas_func(x,y,a) assert_array_almost_equal(desired_a,a) - def check_x_stride(self): + def test_x_stride(self): alpha,a,x,y = self.get_data(x_stride=2) desired_a = alpha*transpose(x[::2,newaxis]*y) + a self.blas_func(x,y,a,incx=2) assert_array_almost_equal(desired_a,a) - def check_x_stride_assert(self): + def test_x_stride_assert(self): alpha,a,x,y = self.get_data(x_stride=2) try: self.blas_func(x,y,a,incx=3) assert(0) except: pass - def check_y_stride(self): + def test_y_stride(self): alpha,a,x,y = self.get_data(y_stride=2) desired_a = alpha*transpose(x[:,newaxis]*y[::2]) + a self.blas_func(x,y,a,incy=2) assert_array_almost_equal(desired_a,a) - def check_y_stride_assert(self): + def test_y_stride_assert(self): alpha,a,x,y = self.get_data(y_stride=2) try: self.blas_func(a,x,y,incy=3) @@ -472,7 +476,7 @@ y = normal(0.,1.,shape(a)[1]*y_stride).astype(self.dtype) y = y + y * array(1j, dtype = self.dtype) return alpha,a,x,y - def check_simple(self): + def test_simple(self): alpha,a,x,y = self.get_data() # tranpose takes care of Fortran vs. C(and Python) memory layout a = a * array(0.,dtype = self.dtype) @@ -482,12 +486,12 @@ fblas.cgeru(x,y,a,alpha = alpha) assert_array_almost_equal(desired_a,a) - #def check_x_stride(self): + #def test_x_stride(self): # alpha,a,x,y = self.get_data(x_stride=2) # desired_a = alpha*transpose(x[::2,newaxis]*self.transform(y)) + a # self.blas_func(x,y,a,incx=2) # assert_array_almost_equal(desired_a,a) - #def check_y_stride(self): + #def test_y_stride(self): # alpha,a,x,y = self.get_data(y_stride=2) # desired_a = alpha*transpose(x[:,newaxis]*self.transform(y[::2])) + a # self.blas_func(x,y,a,incy=2) @@ -518,4 +522,4 @@ """ if __name__ == "__main__": - NumpyTest().run() + unittest.main() Modified: branches/testing_cleanup/scipy/lib/lapack/tests/test_lapack.py =================================================================== --- branches/testing_cleanup/scipy/lib/lapack/tests/test_lapack.py 2007-12-29 02:48:19 UTC (rev 3743) +++ branches/testing_cleanup/scipy/lib/lapack/tests/test_lapack.py 2007-12-29 02:53:36 UTC (rev 3744) @@ -12,26 +12,23 @@ python tests/test_lapack.py [] """ +import os import sys -from numpy.testing import * -from numpy import * +from scipy.testing import * +from numpy import array, ones -set_package_path() -from lapack import flapack,clapack -restore_path() +from scipy.lib.lapack import flapack,clapack -set_local_path() +sys.path.insert(0, os.path.split(__file__)) from gesv_tests import _test_gev from esv_tests import _test_ev -restore_path() #class _test_ev: pass -class _TestLapack(NumpyTestCase, - _test_ev, - _test_gev): - - def check_gebal(self): +class _TestLapack(_test_ev, + _test_gev): + # Mixin class for lapack tests + def test_gebal(self): a = [[1,2,3],[4,5,6],[7,8,9]] a1 = [[1,0,0,3e-4], [4,0,0,2e-3], @@ -48,7 +45,7 @@ ba,lo,hi,pivscale,info = f(a1,permute=1,scale=1) assert not info,`info` - def check_gehrd(self): + def test_gehrd(self): a = [[-149, -50,-154], [ 537, 180, 546], [ -27, -9, -25]] @@ -84,16 +81,16 @@ **************************************************************** """ else: - class TestFlapackDouble(_TestLapack): + class TestFlapackDouble(TestCase, _TestLapack): lapack = PrefixWrapper(flapack,'d') decimal = 12 - class TestFlapackFloat(_TestLapack): + class TestFlapackFloat(TestCase, _TestLapack): lapack = PrefixWrapper(flapack,'s') decimal = 5 - class TestFlapackComplex(_TestLapack): + class TestFlapackComplex(TestCase, _TestLapack): lapack = PrefixWrapper(flapack,'c') decimal = 5 - class TestFlapackDoubleComplex(_TestLapack): + class TestFlapackDoubleComplex(TestCase, _TestLapack): lapack = PrefixWrapper(flapack,'z') decimal = 12 @@ -109,18 +106,18 @@ **************************************************************** """ else: - class TestClapackDouble(_TestLapack): + class TestClapackDouble(TestCase, _TestLapack): lapack = PrefixWrapper(clapack,'d') decimal = 12 - class TestClapackFloat(_TestLapack): + class TestClapackFloat(TestCase, _TestLapack): lapack = PrefixWrapper(clapack,'s') decimal = 5 - class TestClapackComplex(_TestLapack): + class TestClapackComplex(TestCase, _TestLapack): lapack = PrefixWrapper(clapack,'c') decimal = 5 - class TestClapackDoubleComplex(_TestLapack): + class TestClapackDoubleComplex(TestCase, _TestLapack): lapack = PrefixWrapper(clapack,'z') decimal = 12 if __name__ == "__main__": - NumpyTest().run() + unittest.main() From scipy-svn at scipy.org Sat Dec 29 15:35:34 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 Dec 2007 14:35:34 -0600 (CST) Subject: [Scipy-svn] r3745 - trunk/scipy/sparse Message-ID: <20071229203534.0369839C05E@new.scipy.org> Author: wnbell Date: 2007-12-29 14:35:32 -0600 (Sat, 29 Dec 2007) New Revision: 3745 Modified: trunk/scipy/sparse/construct.py Log: made spkron(A,B) more efficient for nearly dense B Modified: trunk/scipy/sparse/construct.py =================================================================== --- trunk/scipy/sparse/construct.py 2007-12-29 02:53:36 UTC (rev 3744) +++ trunk/scipy/sparse/construct.py 2007-12-29 20:35:32 UTC (rev 3745) @@ -12,6 +12,7 @@ from csr import csr_matrix, isspmatrix_csr from csc import csc_matrix, isspmatrix_csc +from bsr import bsr_matrix from coo import coo_matrix from dok import dok_matrix from lil import lil_matrix @@ -110,36 +111,56 @@ """ #TODO optimize for small dense B and CSR A -> BSR - A,B = coo_matrix(A),coo_matrix(B) - output_shape = (A.shape[0]*B.shape[0],A.shape[1]*B.shape[1]) + B = coo_matrix(B) - if A.nnz == 0 or B.nnz == 0: - # kronecker product is the zero matrix - return coo_matrix( output_shape ) + + if 2*B.nnz >= B.shape[0] * B.shape[1]: + #B is fairly dense, use BSR + A = csr_matrix(A,copy=True) + + output_shape = (A.shape[0]*B.shape[0],A.shape[1]*B.shape[1]) - # expand entries of a into blocks - row = A.row.repeat(B.nnz) - col = A.col.repeat(B.nnz) - data = A.data.repeat(B.nnz) + if A.nnz == 0 or B.nnz == 0: + # kronecker product is the zero matrix + return coo_matrix( output_shape ) + + B = B.toarray() + data = A.data.repeat(B.size).reshape(-1,B.shape[0],B.shape[1]) + data = data * B + + return bsr_matrix((data,A.indices,A.indptr),shape=output_shape) + else: + #use COO + A = coo_matrix(A) + output_shape = (A.shape[0]*B.shape[0],A.shape[1]*B.shape[1]) - row *= B.shape[0] - col *= B.shape[1] + if A.nnz == 0 or B.nnz == 0: + # kronecker product is the zero matrix + return coo_matrix( output_shape ) - # increment block indices - row,col = row.reshape(-1,B.nnz),col.reshape(-1,B.nnz) - row += B.row - col += B.col - row,col = row.reshape(-1),col.reshape(-1) + # expand entries of a into blocks + row = A.row.repeat(B.nnz) + col = A.col.repeat(B.nnz) + data = A.data.repeat(B.nnz) - # compute block entries - data = data.reshape(-1,B.nnz) * B.data - data = data.reshape(-1) + row *= B.shape[0] + col *= B.shape[1] - return coo_matrix((data,(row,col)), shape=output_shape).asformat(format) + # increment block indices + row,col = row.reshape(-1,B.nnz),col.reshape(-1,B.nnz) + row += B.row + col += B.col + row,col = row.reshape(-1),col.reshape(-1) + # compute block entries + data = data.reshape(-1,B.nnz) * B.data + data = data.reshape(-1) + return coo_matrix((data,(row,col)), shape=output_shape).asformat(format) + + def lil_eye((r,c), k=0, dtype='d'): """Generate a lil_matrix of dimensions (r,c) with the k-th diagonal set to 1. From scipy-svn at scipy.org Sat Dec 29 15:37:14 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 Dec 2007 14:37:14 -0600 (CST) Subject: [Scipy-svn] r3746 - trunk/scipy/sparse Message-ID: <20071229203714.602D839C05A@new.scipy.org> Author: wnbell Date: 2007-12-29 14:37:12 -0600 (Sat, 29 Dec 2007) New Revision: 3746 Modified: trunk/scipy/sparse/construct.py Log: small edit to spkron Modified: trunk/scipy/sparse/construct.py =================================================================== --- trunk/scipy/sparse/construct.py 2007-12-29 20:35:32 UTC (rev 3745) +++ trunk/scipy/sparse/construct.py 2007-12-29 20:37:12 UTC (rev 3746) @@ -114,7 +114,7 @@ B = coo_matrix(B) - if 2*B.nnz >= B.shape[0] * B.shape[1]: + if (format is None or format == "bsr") and 2*B.nnz >= B.shape[0] * B.shape[1]: #B is fairly dense, use BSR A = csr_matrix(A,copy=True) From scipy-svn at scipy.org Sat Dec 29 16:34:55 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 Dec 2007 15:34:55 -0600 (CST) Subject: [Scipy-svn] r3747 - trunk/scipy Message-ID: <20071229213455.8385C39C158@new.scipy.org> Author: rkern Date: 2007-12-29 15:34:37 -0600 (Sat, 29 Dec 2007) New Revision: 3747 Modified: trunk/scipy/__init__.py Log: Remove useless import of pkg_resources. Modified: trunk/scipy/__init__.py =================================================================== --- trunk/scipy/__init__.py 2007-12-29 20:37:12 UTC (rev 3746) +++ trunk/scipy/__init__.py 2007-12-29 21:34:37 UTC (rev 3747) @@ -14,12 +14,6 @@ """ -try: - import pkg_resources as _pr # activate namespace packages (manipulates __path__) - del _pr -except ImportError: - pass - __all__ = ['pkgload','test'] from numpy import show_config as show_numpy_config From scipy-svn at scipy.org Sun Dec 30 06:09:53 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 30 Dec 2007 05:09:53 -0600 (CST) Subject: [Scipy-svn] r3749 - branches/io_new Message-ID: <20071230110953.716D539C092@new.scipy.org> Author: oliphant Date: 2007-12-30 05:09:48 -0600 (Sun, 30 Dec 2007) New Revision: 3749 Modified: branches/io_new/__init__.py branches/io_new/setup.py Log: Make more changes to the scipy.io branch --- added docs to deprecate_with_docs. Modified: branches/io_new/__init__.py =================================================================== --- branches/io_new/__init__.py 2007-12-30 08:41:21 UTC (rev 3748) +++ branches/io_new/__init__.py 2007-12-30 11:09:48 UTC (rev 3749) @@ -4,19 +4,72 @@ from info import __doc__ -# snip on----- DELETE after numpy.deprecate_with_doc is available -import numpy -numpy.deprecate_with_doc = lambda doc: (lambda func: func) -# snip off---- DELETE after numpy.deprecate_with_doc is available - from numpy import deprecate_with_doc from numpyio import packbits, unpackbits, bswap, fread, fwrite, \ convert_objectarray -fread = deprecate_with_doc('')(fread) -fwrite = deprecate_with_doc('')(fwrite) -bswap = deprecate_with_doc('')(bswap) +fread = deprecate_with_doc(\ +""" +scipy.io.fread is easily replaced with raw reading capabilities of NumPy +including fromfile as well as memory-mapping capabilities. +""")(fread) + +fwrite = deprecate_with_doc(\ +""" + +scipy.io.fwrite is easily replaced with raw writing capabilities of +NumPy. Also, remmber that files can be directly memory-mapped into NumPy +arrays which is often a better way of "reading" especially large files. + +Look at the tofile methods as well as save and savez for writing arrays into +easily transported files of data. +""")(fwrite) + +bswap = deprecate_with_doc(\ +""" + +scipy.io.bswap is easily replaced with the byteswap method on an array. +out = scipy.io.bswap(arr) --> out = arr.byteswap(True) +""")(bswap) + +packbits = deprecate_with_doc(\ +""" + +The functionality of scipy.io.packbits is now available as numpy.packbits +The calling convention is a bit different as the 2-d case is not specialized. + +However, you can simulate scipy.packbits by raveling the last 2 dimensions +of the array and calling numpy.packbits with an axis=-1 keyword: + +def scipy_packbits(inp): + a = np.asarray(inp) + if a.ndim < 2: + return np.packbits(a) + oldshape = a.shape + newshape = oldshape[:-2] + (oldshape[-2]*oldshape[-1],) + a = np.reshape(a, newshape) + return np.packbits(a, axis=-1).ravel() +""")(packbits) + +unpackbits = deprecate_with_doc(\ +""" + +The functionality of scipy.io.unpackbits is now available in numpy.unpackbits +The calling convention is different however as the 2-d case is no longer +specialized. + +Thus, the scipy.unpackbits behavior must be simulated using numpy.unpackbits. + +def scipy_unpackbits(inp, els_per_slice, out_type=None): + inp = np.asarray(inp) + num4els = ((els_per_slice-1) >> 3) + 1 + inp = np.reshape(inp, (-1,num4els)) + res = np.unpackbits(inp, axis=-1)[:,:els_per_slice] + return res.ravel() +""")(unpackbits) +convert_objectarray = deprecate_with_doc(convert_objectarray) + # matfile read and write from matlab.mio import loadmat, savemat @@ -28,7 +81,7 @@ from recaster import sctype_attributes, Recaster from array_import import read_array, write_array -from data_store import save as save_as_module +from data_store import save, save_as_module from data_store import load, create_module, create_shelf from pickler import objload, objsave Modified: branches/io_new/setup.py =================================================================== --- branches/io_new/setup.py 2007-12-30 08:41:21 UTC (rev 3748) +++ branches/io_new/setup.py 2007-12-30 11:09:48 UTC (rev 3749) @@ -10,6 +10,7 @@ config.add_data_dir('tests') config.add_data_dir('examples') config.add_data_dir('docs') + config.add_subpackage('matlab') return config if __name__ == '__main__': From scipy-svn at scipy.org Sun Dec 30 19:53:58 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 30 Dec 2007 18:53:58 -0600 (CST) Subject: [Scipy-svn] r3750 - in trunk/scipy/sparse: . tests Message-ID: <20071231005358.C5FCE39C065@new.scipy.org> Author: wnbell Date: 2007-12-30 18:53:54 -0600 (Sun, 30 Dec 2007) New Revision: 3750 Modified: trunk/scipy/sparse/base.py trunk/scipy/sparse/compressed.py trunk/scipy/sparse/coo.py trunk/scipy/sparse/csc.py trunk/scipy/sparse/csr.py trunk/scipy/sparse/dia.py trunk/scipy/sparse/tests/test_base.py Log: consolidated csr/csc_matrix setitem added SparseEfficiencyWarning Modified: trunk/scipy/sparse/base.py =================================================================== --- trunk/scipy/sparse/base.py 2007-12-30 11:09:48 UTC (rev 3749) +++ trunk/scipy/sparse/base.py 2007-12-31 00:53:54 UTC (rev 3750) @@ -1,6 +1,7 @@ """Base class for sparse matrices""" -__all__ = ['spmatrix','isspmatrix','issparse'] +__all__ = ['spmatrix', 'isspmatrix', 'issparse', + 'SparseWarning','SparseEfficiencyWarning'] from warnings import warn @@ -9,6 +10,11 @@ from sputils import isdense, isscalarlike, isintlike +class SparseWarning(Warning): pass +class SparseFormatWarning(SparseWarning): pass +class SparseEfficiencyWarning(SparseWarning): pass + + # The formats that we might potentially understand. _formats = {'csc':[0, "Compressed Sparse Column"], 'csr':[1, "Compressed Sparse Row"], @@ -273,7 +279,7 @@ raise ValueError,'exponent must be an integer' elif isspmatrix(other): warn('Using ** for elementwise multiplication is deprecated.'\ - 'Use .multiply() instead',DeprecationWarning) + 'Use .multiply() instead', DeprecationWarning) return self.multiply(other) else: raise NotImplementedError @@ -477,6 +483,7 @@ def save(self, file_name, format = '%d %d %f\n'): #deprecated on Dec 14 2007 + #remove after 0.7 release warn('save() is deprecated, consider using mmwrite() or savemat()' \ ' provided by scipy.io instead', DeprecationWarning) Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-30 11:09:48 UTC (rev 3749) +++ trunk/scipy/sparse/compressed.py 2007-12-31 00:53:54 UTC (rev 3750) @@ -8,9 +8,9 @@ import numpy from numpy import array, matrix, asarray, asmatrix, zeros, rank, intc, \ empty, hstack, isscalar, ndarray, shape, searchsorted, empty_like, \ - where + where, concatenate -from base import spmatrix, isspmatrix +from base import spmatrix, isspmatrix, SparseEfficiencyWarning from data import _data_matrix import sparsetools from sputils import upcast, to_native, isdense, isshape, getdtype, \ @@ -35,7 +35,7 @@ warn("dims= is deprecated, use shape= instead", DeprecationWarning) shape=dims - if dims is not None: + if nzmax is not None: warn("nzmax= is deprecated", DeprecationWarning) @@ -393,9 +393,9 @@ def _get_single_element(self,row,col): M, N = self.shape if (row < 0): - row = M + row + row += M if (col < 0): - col = N + col + col += N if not (0<=row= N): - self.indptr = resize1d(self.indptr, col+2) - self.indptr[N+1:] = self.indptr[N] - N = col+1 - if (row >= M): - M = row+1 - self.shape = (M, N) - - indxs = numpy.where(row == self.indices[self.indptr[col]:self.indptr[col+1]]) - - if len(indxs[0]) == 0: - #value not present - newindx = self.indices[self.indptr[col]:self.indptr[col+1]].searchsorted(row) - newindx += self.indptr[col] - - val = array([val],dtype=self.data.dtype) - row = array([row],dtype=self.indices.dtype) - self.data = concatenate((self.data[:newindx],val,self.data[newindx:])) - self.indices = concatenate((self.indices[:newindx],row,self.indices[newindx:])) - - self.indptr[col+1:] += 1 - elif len(indxs[0]) == 1: - #value already present - self.data[self.indptr[col]:self.indptr[col+1]][indxs[0]] = val - else: - raise IndexError, "row index occurs more than once" - - self.check_format(full_check=False) - else: - # We should allow slices here! - raise IndexError, "invalid index" - def rowcol(self, ind): row = self.indices[ind] col = searchsorted(self.indptr, ind+1)-1 @@ -173,17 +127,8 @@ from csr import csr_matrix return csr_matrix((data, indices, indptr), self.shape) -# def tobsc(self,blocksize=None, copy=True): -# if blocksize in [None, (1,1)]: -# from bsc import bsc_matrix -# arg1 = (self.data.reshape(-1,1,1),self.indices,self.indptr) -# return bsc_matrix( arg1, shape=self.shape, copy=copy ) -# else: -# #TODO make this more efficient -# return self.tocoo(copy=False).tobsc(blocksize=blocksize) -# def tobsr(self, blocksize=None): - if blocksize in [None, (1,1)]: + if blocksize == (1,1): from bsr import bsr_matrix csr = self.tocsr() arg1 = (csr.data.reshape(-1,1,1),csr.indices,csr.indptr) Modified: trunk/scipy/sparse/csr.py =================================================================== --- trunk/scipy/sparse/csr.py 2007-12-30 11:09:48 UTC (rev 3749) +++ trunk/scipy/sparse/csr.py 2007-12-31 00:53:54 UTC (rev 3750) @@ -10,7 +10,7 @@ empty, hstack, isscalar, ndarray, shape, searchsorted, where, \ concatenate -from base import spmatrix,isspmatrix +from base import spmatrix, isspmatrix from sparsetools import csr_tocsc from sputils import upcast, to_native, isdense, isshape, getdtype, \ isscalarlike, isintlike @@ -102,54 +102,6 @@ return csc_matrix((self.data,self.indices,self.indptr),(N,M),copy=copy) - def __setitem__(self, key, val): - if isinstance(key, tuple): - row = key[0] - col = key[1] - if not (isscalarlike(row) and isscalarlike(col)): - raise NotImplementedError("Fancy indexing in assignment not " - "supported for csr matrices.") - M, N = self.shape - if (row < 0): - row = M + row - if (col < 0): - col = N + col - if (row < 0) or (col < 0): - raise IndexError, "index out of bounds" - if (row >= M): - self.indptr = resize1d(self.indptr, row+2) - self.indptr[M+1:] = self.indptr[M] - M = row+1 - if (col >= N): - N = col+1 - self.shape = (M, N) - - indxs = numpy.where(col == self.indices[self.indptr[row]:self.indptr[row+1]]) - - if len(indxs[0]) == 0: - #value not present - self.sort_indices() - newindx = self.indices[self.indptr[row]:self.indptr[row+1]].searchsorted(col) - newindx += self.indptr[row] - - val = array([val],dtype=self.data.dtype) - col = array([col],dtype=self.indices.dtype) - self.data = concatenate((self.data[:newindx],val,self.data[newindx:])) - self.indices = concatenate((self.indices[:newindx],col,self.indices[newindx:])) - - self.indptr[row+1:] += 1 - - elif len(indxs[0]) == 1: - #value already present - self.data[self.indptr[row]:self.indptr[row+1]][indxs[0]] = val - else: - raise IndexError, "row index occurs more than once" - - self.check_format(full_check=True) - else: - # We should allow slices here! - raise IndexError, "invalid index" - def rowcol(self, ind): col = self.indices[ind] row = searchsorted(self.indptr, ind+1)-1 @@ -192,7 +144,7 @@ return csc_matrix((data, indices, indptr), self.shape) def tobsr(self,blocksize=None,copy=True): - if blocksize in [None, (1,1)]: + if blocksize == (1,1): from bsr import bsr_matrix arg1 = (self.data.reshape(-1,1,1),self.indices,self.indptr) return bsr_matrix( arg1, shape=self.shape, copy=copy ) Modified: trunk/scipy/sparse/dia.py =================================================================== --- trunk/scipy/sparse/dia.py 2007-12-30 11:09:48 UTC (rev 3749) +++ trunk/scipy/sparse/dia.py 2007-12-31 00:53:54 UTC (rev 3750) @@ -208,12 +208,12 @@ return self def tocsr(self): - #TODO optimize COO->CSR - return self.tocoo().tocsr() + #this could be faster + return self.tocoo().tocsr(sum_duplicates=False) def tocsc(self): - #TODO optimize COO->CSC - return self.tocoo().tocsc() + #this could be faster + return self.tocoo().tocsc(sum_duplicates=False) def tocoo(self): num_data = len(self.data) Modified: trunk/scipy/sparse/tests/test_base.py =================================================================== --- trunk/scipy/sparse/tests/test_base.py 2007-12-30 11:09:48 UTC (rev 3749) +++ trunk/scipy/sparse/tests/test_base.py 2007-12-31 00:53:54 UTC (rev 3750) @@ -22,7 +22,7 @@ set_package_path() from scipy.sparse import csc_matrix, csr_matrix, dok_matrix, \ coo_matrix, lil_matrix, dia_matrix, bsr_matrix, \ - extract_diagonal, speye, spkron + extract_diagonal, speye, spkron, SparseEfficiencyWarning from scipy.linsolve import splu restore_path() @@ -482,6 +482,8 @@ class _TestGetSet: def check_setelement(self): + import warnings + warnings.simplefilter('ignore',SparseEfficiencyWarning) a = self.spmatrix((3,4)) a[1,2] = 4.0 a[0,1] = 3 From scipy-svn at scipy.org Mon Dec 31 03:51:43 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 Dec 2007 02:51:43 -0600 (CST) Subject: [Scipy-svn] r3751 - in trunk/scipy/sparse: . tests Message-ID: <20071231085143.E084739C15E@new.scipy.org> Author: wnbell Date: 2007-12-31 02:51:39 -0600 (Mon, 31 Dec 2007) New Revision: 3751 Removed: trunk/scipy/sparse/block.py Modified: trunk/scipy/sparse/bsr.py trunk/scipy/sparse/compressed.py trunk/scipy/sparse/lil.py trunk/scipy/sparse/tests/test_base.py Log: consolidated bsr with _cs_matrix class reworked lil_matrix constructor to check for sparse first removed block.py Deleted: trunk/scipy/sparse/block.py =================================================================== --- trunk/scipy/sparse/block.py 2007-12-31 00:53:54 UTC (rev 3750) +++ trunk/scipy/sparse/block.py 2007-12-31 08:51:39 UTC (rev 3751) @@ -1,450 +0,0 @@ -"""base class for block sparse formats""" - -from warnings import warn - -from numpy import zeros, intc, array, asarray, arange, diff, tile, rank, \ - prod, ravel, empty, empty_like - -from data import _data_matrix -from base import isspmatrix, _formats -from sputils import isshape, getdtype, to_native, isscalarlike, isdense, \ - upcast -import sparsetools - -#TODO refactor w/ compressed.py - -class _block_matrix(_data_matrix): - def __init__(self, arg1, shape=None, dtype=None, copy=False, blocksize=None): - _data_matrix.__init__(self) - - - if isspmatrix(arg1): - if arg1.format == self.format and copy: - arg1 = arg1.copy() - else: - arg1 = getattr(arg1,'to' + self.format)(blocksize=blocksize) - self._set_self( arg1 ) - - elif isinstance(arg1,tuple): - if isshape(arg1): - #it's a tuple of matrix dimensions (M,N) - self.shape = arg1 - M,N = self.shape - #process blocksize - if blocksize is None: - blocksize = (1,1) - else: - if not isshape(blocksize): - raise ValueError,'invalid blocksize=%s',blocksize - blocksize = tuple(blocksize) - self.data = zeros( (0,) + blocksize, getdtype(dtype, default=float) ) - self.indices = zeros( 0, dtype=intc ) - - X,Y = blocksize - if (M % X) != 0 or (N % Y) != 0: - raise ValueError, 'shape must be multiple of blocksize' - - self.indptr = zeros(self._swap((M/X,N/Y))[0] + 1, dtype=intc ) - - elif len(arg1) == 2: - # (data,(row,col)) format - self._set_self( coo_matrix(arg1).tobsr(blocksize=blocksize) ) - - elif len(arg1) == 3: - # (data,indices,indptr) format - (data, indices, indptr) = arg1 - self.indices = array(indices, copy=copy) - self.indptr = array(indptr, copy=copy) - self.data = array(data, copy=copy, \ - dtype=getdtype(dtype, data)) - else: - raise ValueError, "unrecognized form for" \ - " %s_matrix constructor" % self.format - else: - #must be dense - try: - arg1 = asarray(arg1) - except: - raise ValueError, "unrecognized form for" \ - " %s_matrix constructor" % self.format - from coo import coo_matrix - arg1 = self.__class__( coo_matrix(arg1), blocksize=blocksize ) - self._set_self( arg1 ) - - if shape is not None: - self.shape = shape # spmatrix will check for errors - else: - if self.shape is None: - # shape not already set, try to infer dimensions - try: - major_dim = len(self.indptr) - 1 - minor_dim = self.indices.max() + 1 - except: - raise ValueError,'unable to infer matrix dimensions' - else: - M,N = self._swap((major_dim,minor_dim)) - R,C = self.blocksize - self.shape = (M*R,N*C) - - if self.shape is None: - if shape is None: - #infer shape here - raise ValueError,'need to infer shape' - else: - self.shape = shape - - self.check_format() - - def check_format(self, full_check=True): - """check whether the matrix format is valid - - *Parameters*: - full_check: - True - rigorous check, O(N) operations : default - False - basic check, O(1) operations - - """ - - #use _swap to determine proper bounds - major_name,minor_name = self._swap(('row','column')) - major_dim,minor_dim = self._swap(self.shape) - major_blk,minor_blk = self._swap(self.blocksize) - - # index arrays should have integer data types - if self.indptr.dtype.kind != 'i': - warn("indptr array has non-integer dtype (%s)" \ - % self.indptr.dtype.name ) - if self.indices.dtype.kind != 'i': - warn("indices array has non-integer dtype (%s)" \ - % self.indices.dtype.name ) - - # only support 32-bit ints for now - self.indptr = asarray(self.indptr,intc) - self.indices = asarray(self.indices,intc) - self.data = to_native(self.data) - - # check array shapes - if (rank(self.indices) != 1) or (rank(self.indptr) != 1): - raise ValueError,"indices, and indptr should be rank 1" - if rank(self.data) != 3: - raise ValueError,"data should be rank 3" - - # check index pointer - if (len(self.indptr) != major_dim/major_blk + 1 ): - raise ValueError, \ - "index pointer size (%d) should be (%d)" % \ - (len(self.indptr), major_dim/major_blk + 1) - if (self.indptr[0] != 0): - raise ValueError,"index pointer should start with 0" - - # check index and data arrays - if (len(self.indices) != len(self.data)): - raise ValueError,"indices and data should have the same size" - if (self.indptr[-1] > len(self.indices)): - raise ValueError, \ - "Last value of index pointer should be less than "\ - "the size of index and data arrays" - - self.prune() - - if full_check: - #check format validity (more expensive) - if self.nnz > 0: - if self.indices.max() >= minor_dim/minor_blk: - print "max index",self.indices.max() - raise ValueError, "%s index values must be < %d" % \ - (minor_name,minor_dim) - if self.indices.min() < 0: - raise ValueError, "%s index values must be >= 0" % \ - minor_name - if diff(self.indptr).min() < 0: - raise ValueError,'index pointer values must form a " \ - "non-decreasing sequence' - - #if not self.has_sorted_indices(): - # warn('Indices were not in sorted order. Sorting indices.') - # self.sort_indices(check_first=False) - - def _get_blocksize(self): - return self.data.shape[1:] - blocksize = property(fget=_get_blocksize) - - def getnnz(self): - R,C = self.blocksize - return self.indptr[-1] * R * C - nnz = property(fget=getnnz) - - def __repr__(self): - nnz = self.getnnz() - format = self.getformat() - return "<%dx%d sparse matrix of type '%s'\n" \ - "\twith %d stored elements (blocksize = %dx%d) in %s format>" % \ - ( self.shape + (self.dtype.type, nnz) + self.blocksize + \ - (_formats[format][1],) ) - - - def __add__(self,other): - # First check if argument is a scalar - if isscalarlike(other): - # Now we would add this scalar to every element. - raise NotImplementedError, 'adding a scalar to a CSC or CSR ' \ - 'matrix is not supported' - elif isspmatrix(other): - if (other.shape != self.shape): - raise ValueError, "inconsistent shapes" - - return self._binopt(other,'_plus_') - elif isdense(other): - # Convert this matrix to a dense matrix and add them - return self.todense() + other - else: - raise NotImplementedError - - def __radd__(self,other): - return self.__add__(other) - - def __sub__(self,other): - # First check if argument is a scalar - if isscalarlike(other): - # Now we would add this scalar to every element. - raise NotImplementedError, 'adding a scalar to a sparse ' \ - 'matrix is not supported' - elif isspmatrix(other): - if (other.shape != self.shape): - raise ValueError, "inconsistent shapes" - - return self._binopt(other,'_minus_') - elif isdense(other): - # Convert this matrix to a dense matrix and subtract them - return self.todense() - other - else: - raise NotImplementedError - - def __rsub__(self,other): # other - self - #note: this can't be replaced by other + (-self) for unsigned types - if isscalarlike(other): - # Now we would add this scalar to every element. - raise NotImplementedError, 'adding a scalar to a sparse ' \ - 'matrix is not supported' - elif isdense(other): - # Convert this matrix to a dense matrix and subtract them - return other - self.todense() - else: - raise NotImplementedError - - - def __mul__(self, other): # self * other - """ Scalar, vector, or matrix multiplication - """ - if isscalarlike(other): - return self._with_data(self.data * other) - else: - return self.dot(other) - - - def __rmul__(self, other): # other * self - if isscalarlike(other): - return self.__mul__(other) - else: - # Don't use asarray unless we have to - try: - tr = other.transpose() - except AttributeError: - tr = asarray(other).transpose() - return self.transpose().dot(tr).transpose() - - - def __truediv__(self,other): - if isscalarlike(other): - return self * (1./other) - elif isspmatrix(other): - if (other.shape != self.shape): - raise ValueError, "inconsistent shapes" - - return self._binopt(other,'_eldiv_') - else: - raise NotImplementedError - - - def multiply(self, other): - """Point-wise multiplication by another matrix - """ - if (other.shape != self.shape): - raise ValueError, "inconsistent shapes" - - if isdense(other): - return multiply(self.todense(),other) - else: - other = self.__class__(other) - return self._binopt(other,'_elmul_') - - - - - - - - - def _set_self(self, other, copy=False): - """take the member variables of other and assign them to self""" - - if copy: - other = other.copy() - - self.data = other.data - self.indices = other.indices - self.indptr = other.indptr - self.shape = other.shape - - - #conversion methods - def toarray(self): - A = self.tocoo(copy=False) - M = zeros(self.shape, dtype=self.dtype) - M[A.row, A.col] = A.data - return M - - def todia(self): - return self.tocoo(copy=False).todia() - - def todok(self): - return self.tocoo(copy=False).todok() - - def tocsr(self): - return self.tocoo(copy=False).tocsr() - #TODO make this more efficient - - def tocsc(self): - return self.tocoo(copy=False).tocsc() - #TODO make this more efficient - - - - - # methods that modify the internal data structure - def has_sorted_indices(self): - """Determine whether the matrix has sorted indices - """ - fn = sparsetools.csr_has_sorted_indices - return fn( len(self.indptr) - 1, self.indptr, self.indices) - - def sorted_indices(self): - """Return a copy of this matrix with sorted indices - """ - A = self.copy() - A.sort_indices() - return A - - # an alternative that has linear complexity is the following - # typically the previous option is faster - #return self.toother().toother() - - def sort_indices(self, check_first=True): - """Sort the indices of this matrix *in place* - """ - if check_first and self.has_sorted_indices(): - return - - from csr import csr_matrix - - X,Y = self.blocksize - M,N = self.shape - - if self.nnz == 0: - return - - #use CSR.sort_indices to determine a permutation for BSR<->BSC - major,minor = self._swap((M/X,N/Y)) - - data = arange(len(self.indices), dtype=self.indices.dtype) - proxy = csr_matrix((data,self.indices,self.indptr),shape=(major,minor)) - proxy.sort_indices() - - self.data[:] = self.data[proxy.data] - self.indices[:] = proxy.indices - - def prune(self): - """ Remove empty space after all non-zero elements. - """ - major_dim = self._swap(self.shape)[0] - major_blk = self._swap(self.blocksize)[0] - - if len(self.indptr) != major_dim/major_blk + 1: - raise ValueError, "index pointer has invalid length" - if len(self.indices) < self.nnz / prod(self.blocksize): - raise ValueError, "indices has too few elements" - if self.data.size < self.nnz: - raise ValueError, "data array has too few elements" - - nnz = self.indptr[-1] - - self.data = self.data[:nnz] - self.indices = self.indices[:nnz] - - # utility functions - def _binopt(self, other, op, in_shape=None, out_shape=None): - """apply the binary operation fn to two sparse matrices""" - other = self.__class__(other,blocksize=self.blocksize) - - if in_shape is None: - in_shape = self.shape - if out_shape is None: - out_shape = self.shape - - self.sort_indices() - other.sort_indices() - - # e.g. bsr_plus_bsr, etc. - fn = getattr(sparsetools, self.format + op + self.format) - - R,C = self.blocksize - - max_bnnz = len(self.data) + len(other.data) - indptr = empty_like(self.indptr) - indices = empty( max_bnnz, dtype=intc ) - data = empty( R*C*max_bnnz, dtype=upcast(self.dtype,other.dtype) ) - - fn(in_shape[0]/R, in_shape[1]/C, R, C, \ - self.indptr, self.indices, ravel(self.data), - other.indptr, other.indices, ravel(other.data), - indptr, indices, data) - - actual_bnnz = indptr[-1] - indices = indices[:actual_bnnz] - data = data[:R*C*actual_bnnz] - - if actual_bnnz < max_bnnz/2: - indices = indices.copy() - data = data.copy() - - data = data.reshape(-1,R,C) - - return self.__class__((data, indices, indptr), shape=out_shape) - - # needed by _data_matrix - def _with_data(self,data,copy=True): - """Returns a matrix with the same sparsity structure as self, - but with different data. By default the structure arrays - (i.e. .indptr and .indices) are copied. - """ - if copy: - return self.__class__((data,self.indices.copy(),self.indptr.copy()), \ - shape=self.shape,dtype=data.dtype) - else: - return self.__class__((data,self.indices,self.indptr), \ - shape=self.shape,dtype=data.dtype) - - - - - - - -# test with: -# A = arange(4*6).reshape(4,6) % 5 -# A[0:2,2:4] = 0 -# A[0:2,:] = 0 - - - - Modified: trunk/scipy/sparse/bsr.py =================================================================== --- trunk/scipy/sparse/bsr.py 2007-12-31 00:53:54 UTC (rev 3750) +++ trunk/scipy/sparse/bsr.py 2007-12-31 08:51:39 UTC (rev 3751) @@ -2,15 +2,20 @@ __all__ = ['bsr_matrix', 'isspmatrix_bsr'] +from warnings import warn + from numpy import zeros, intc, array, asarray, arange, diff, tile, rank, \ prod, ravel, empty, matrix, asmatrix, empty_like, hstack +import sparsetools from sparsetools import bsr_matvec, csr_matmat_pass1, bsr_matmat_pass2 -from block import _block_matrix +from data import _data_matrix +from compressed import _cs_matrix from base import isspmatrix -from sputils import isdense, upcast, isscalarlike +from sputils import isshape, getdtype, to_native, isscalarlike, isdense, \ + upcast -class bsr_matrix(_block_matrix): +class bsr_matrix(_cs_matrix): """Block Sparse Row matrix This can be instantiated in several ways: @@ -82,16 +87,185 @@ [4, 4, 5, 5, 6, 6]]) """ + def __init__(self, arg1, shape=None, dtype=None, copy=False, blocksize=None): + _data_matrix.__init__(self) + + if isspmatrix(arg1): + if arg1.format == self.format and copy: + arg1 = arg1.copy() + else: + arg1 = getattr(arg1,'to' + self.format)(blocksize=blocksize) + self._set_self( arg1 ) + + elif isinstance(arg1,tuple): + if isshape(arg1): + #it's a tuple of matrix dimensions (M,N) + self.shape = arg1 + M,N = self.shape + #process blocksize + if blocksize is None: + blocksize = (1,1) + else: + if not isshape(blocksize): + raise ValueError,'invalid blocksize=%s',blocksize + blocksize = tuple(blocksize) + self.data = zeros( (0,) + blocksize, getdtype(dtype, default=float) ) + self.indices = zeros( 0, dtype=intc ) + + X,Y = blocksize + if (M % X) != 0 or (N % Y) != 0: + raise ValueError, 'shape must be multiple of blocksize' - def __mul__(self, other): # self * other - """ Scalar, vector, or matrix multiplication - """ - if isscalarlike(other): - return self._with_data(self.data * other) + self.indptr = zeros(M/X + 1, dtype=intc ) + + elif len(arg1) == 2: + # (data,(row,col)) format + self._set_self( coo_matrix(arg1).tobsr(blocksize=blocksize) ) + + elif len(arg1) == 3: + # (data,indices,indptr) format + (data, indices, indptr) = arg1 + self.indices = array(indices, copy=copy) + self.indptr = array(indptr, copy=copy) + self.data = array(data, copy=copy, \ + dtype=getdtype(dtype, data)) + else: + raise ValueError,'unrecognized bsr_matrix constructor usage' else: - return self.dot(other) + #must be dense + try: + arg1 = asarray(arg1) + except: + raise ValueError, "unrecognized form for" \ + " %s_matrix constructor" % self.format + from coo import coo_matrix + arg1 = self.__class__( coo_matrix(arg1), blocksize=blocksize ) + self._set_self( arg1 ) + if shape is not None: + self.shape = shape # spmatrix will check for errors + else: + if self.shape is None: + # shape not already set, try to infer dimensions + try: + M = len(self.indptr) - 1 + N = self.indices.max() + 1 + except: + raise ValueError,'unable to infer matrix dimensions' + else: + R,C = self.blocksize + self.shape = (M*R,N*C) + + if self.shape is None: + if shape is None: + #infer shape here + raise ValueError,'need to infer shape' + else: + self.shape = shape + + self.check_format() + + def check_format(self, full_check=True): + """check whether the matrix format is valid + + *Parameters*: + full_check: + True - rigorous check, O(N) operations : default + False - basic check, O(1) operations + + """ + M,N = self.shape + R,C = self.blocksize + + # index arrays should have integer data types + if self.indptr.dtype.kind != 'i': + warn("indptr array has non-integer dtype (%s)" \ + % self.indptr.dtype.name ) + if self.indices.dtype.kind != 'i': + warn("indices array has non-integer dtype (%s)" \ + % self.indices.dtype.name ) + + # only support 32-bit ints for now + self.indptr = asarray(self.indptr,intc) + self.indices = asarray(self.indices,intc) + self.data = to_native(self.data) + + # check array shapes + if (rank(self.indices) != 1) or (rank(self.indptr) != 1): + raise ValueError,"indices, and indptr should be rank 1" + if rank(self.data) != 3: + raise ValueError,"data should be rank 3" + + # check index pointer + if (len(self.indptr) != M/R + 1 ): + raise ValueError, \ + "index pointer size (%d) should be (%d)" % \ + (len(self.indptr), M/R + 1) + if (self.indptr[0] != 0): + raise ValueError,"index pointer should start with 0" + + # check index and data arrays + if (len(self.indices) != len(self.data)): + raise ValueError,"indices and data should have the same size" + if (self.indptr[-1] > len(self.indices)): + raise ValueError, \ + "Last value of index pointer should be less than "\ + "the size of index and data arrays" + + self.prune() + + if full_check: + #check format validity (more expensive) + if self.nnz > 0: + if self.indices.max() >= N/C: + print "max index",self.indices.max() + raise ValueError, "column index values must be < %d" % N/C + if self.indices.min() < 0: + raise ValueError, "column index values must be >= 0" + if diff(self.indptr).min() < 0: + raise ValueError,'index pointer values must form a " \ + "non-decreasing sequence' + + #if not self.has_sorted_indices(): + # warn('Indices were not in sorted order. Sorting indices.') + # self.sort_indices(check_first=False) + + def _get_blocksize(self): + return self.data.shape[1:] + blocksize = property(fget=_get_blocksize) + + def getnnz(self): + R,C = self.blocksize + return self.indptr[-1] * R * C + nnz = property(fget=getnnz) + + def __repr__(self): + nnz = self.getnnz() + format = self.getformat() + return "<%dx%d sparse matrix of type '%s'\n" \ + "\twith %d stored elements (blocksize = %dx%d) in %s format>" % \ + ( self.shape + (self.dtype.type, nnz) + self.blocksize + \ + (_formats[format][1],) ) + + + ########################## + # NotImplemented methods # + ########################## + + def getdata(self,ind): + raise NotImplementedError + + def __getitem__(self,key): + raise NotImplementedError + + def __setitem__(self,key,val): + raise NotImplementedError + + ###################### + # Arithmetic methods # + ###################### + def matvec(self, other, output=None): """Sparse matrix vector product (self * other) @@ -187,16 +361,26 @@ else: raise TypeError, "need a dense or sparse matrix" -# def transpose(self,copy=False): -# M,N = self.shape -# -# data = self.data.swapaxes(1,2) -# indices = self.indices -# indptr = self.indptr -# -# from bsc import bsc_matrix -# return bsc_matrix( (data,indices,indptr), shape=(N,M), copy=copy) - + + ###################### + # Conversion methods # + ###################### + + def tobsr(self,blocksize=None,copy=False): + if blocksize not in [None, self.blocksize]: + return self.tocoo(copy=False).tobsr(blocksize=blocksize) + if copy: + return self.copy() + else: + return self + + def tocsr(self): + return self.tocoo(copy=False).tocsr() + #TODO make this more efficient + + def tocsc(self): + return self.tocoo(copy=False).tocsc() + def tocoo(self,copy=True): """Convert this matrix to COOrdinate format. @@ -246,21 +430,117 @@ return bsr_matrix( (data,indices,indptr), shape=(N,M) ) - def tobsr(self,blocksize=None,copy=False): + + ############################################################## + # methods that examine or modify the internal data structure # + ############################################################## + + def sum_duplicates(self): + raise NotImplementedError - if blocksize not in [None, self.blocksize]: - return self.tocoo(copy=False).tobsr(blocksize=blocksize) + def sort_indices(self, check_first=True): + """Sort the indices of this matrix *in place* + """ + if check_first and self.has_sorted_indices(): + return + + from csr import csr_matrix + + R,C = self.blocksize + M,N = self.shape + + if self.nnz == 0: + return + + #use CSR.sort_indices to determine a permutation for BSR blocks + data = arange(len(self.indices), dtype=self.indices.dtype) + proxy = csr_matrix((data,self.indices,self.indptr),shape=(M/R,N/C)) + proxy.sort_indices() + + self.data[:] = self.data[proxy.data] + self.indices[:] = proxy.indices + + def prune(self): + """ Remove empty space after all non-zero elements. + """ + + R,C = self.blocksize + M,N = self.shape + + if len(self.indptr) != M/R + 1: + raise ValueError, "index pointer has invalid length" + + bnnz = self.indptr[-1] + + if len(self.indices) < bnnz: + raise ValueError, "indices array has too few elements" + if len(self.data) < bnnz: + raise ValueError, "data array has too few elements" + + self.data = self.data[:bnnz] + self.indices = self.indices[:bnnz] + + # utility functions + def _binopt(self, other, op, in_shape=None, out_shape=None): + """apply the binary operation fn to two sparse matrices""" + other = self.__class__(other,blocksize=self.blocksize) + + if in_shape is None: + in_shape = self.shape + if out_shape is None: + out_shape = self.shape + + self.sort_indices() + other.sort_indices() + + # e.g. bsr_plus_bsr, etc. + fn = getattr(sparsetools, self.format + op + self.format) + + R,C = self.blocksize + + max_bnnz = len(self.data) + len(other.data) + indptr = empty_like(self.indptr) + indices = empty( max_bnnz, dtype=intc ) + data = empty( R*C*max_bnnz, dtype=upcast(self.dtype,other.dtype) ) + + fn(in_shape[0]/R, in_shape[1]/C, R, C, \ + self.indptr, self.indices, ravel(self.data), + other.indptr, other.indices, ravel(other.data), + indptr, indices, data) + + actual_bnnz = indptr[-1] + indices = indices[:actual_bnnz] + data = data[:R*C*actual_bnnz] + + if actual_bnnz < max_bnnz/2: + indices = indices.copy() + data = data.copy() + + data = data.reshape(-1,R,C) + + return self.__class__((data, indices, indptr), shape=out_shape) + + # needed by _data_matrix + def _with_data(self,data,copy=True): + """Returns a matrix with the same sparsity structure as self, + but with different data. By default the structure arrays + (i.e. .indptr and .indices) are copied. + """ if copy: - return self.copy() + return self.__class__((data,self.indices.copy(),self.indptr.copy()), \ + shape=self.shape,dtype=data.dtype) else: - return self + return self.__class__((data,self.indices,self.indptr), \ + shape=self.shape,dtype=data.dtype) + + - # these functions are used by the parent class - # to remove redudancy between bsc_matrix and bsr_matrix - def _swap(self,x): - """swap the members of x if this is a column-oriented matrix - """ - return (x[0],x[1]) +# # these functions are used by the parent class +# # to remove redudancy between bsc_matrix and bsr_matrix +# def _swap(self,x): +# """swap the members of x if this is a column-oriented matrix +# """ +# return (x[0],x[1]) from sputils import _isinstance Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-31 00:53:54 UTC (rev 3750) +++ trunk/scipy/sparse/compressed.py 2007-12-31 08:51:39 UTC (rev 3751) @@ -68,16 +68,16 @@ self.indptr = array(indptr, copy=copy) self.data = array(data, copy=copy, dtype=getdtype(dtype, data)) else: - raise ValueError, "unrecognized form for" \ - " %s_matrix constructor" % self.format + raise ValueError, "unrecognized %s_matrix constructor usage" %\ + self.format else: #must be dense try: arg1 = asarray(arg1) except: - raise ValueError, "unrecognized form for" \ - " %s_matrix constructor" % self.format + raise ValueError, "unrecognized %s_matrix constructor usage" % \ + self.format from coo import coo_matrix self._set_self( self.__class__(coo_matrix(arg1)) ) @@ -385,7 +385,7 @@ # The spmatrix base class already does axis=0 and axis=1 efficiently # so we only do the case axis=None here if axis is None: - return self.data[:self.indptr[-1]].sum() + return self.data.sum() else: return spmatrix.sum(self,axis) raise ValueError, "axis out of bounds" @@ -518,8 +518,10 @@ # We should allow slices here! raise IndexError, "invalid index" + ###################### + # Conversion methods # + ###################### - # conversion methods def todia(self): return self.tocoo(copy=False).todia() @@ -555,8 +557,10 @@ M[A.row, A.col] = A.data return M - - # methods that examine or modify the internal data structure + ############################################################## + # methods that examine or modify the internal data structure # + ############################################################## + def sum_duplicates(self): """Eliminate duplicate matrix entries by adding them together Modified: trunk/scipy/sparse/lil.py =================================================================== --- trunk/scipy/sparse/lil.py 2007-12-31 00:53:54 UTC (rev 3750) +++ trunk/scipy/sparse/lil.py 2007-12-31 08:51:39 UTC (rev 3751) @@ -64,7 +64,16 @@ for i in range(M): self.rows[i] = [] self.data[i] = [] - else: + elif isspmatrix(A): + if isspmatrix_lil(A) and copy: + A = A.copy() + else: + A = A.tolil() + self.shape = A.shape + self.dtype = A.dtype + self.rows = A.rows + self.data = A.data + elif isinstance(A,tuple): if isshape(A): M, N = A self.shape = (M,N) @@ -74,22 +83,17 @@ self.rows[i] = [] self.data[i] = [] else: - if isspmatrix(A): - if isspmatrix_lil(A) and copy: - A = A.copy() - else: - A = A.tolil() - else: - #assume A is dense - try: - A = asmatrix(A) - except TypeError: - raise TypeError, "unsupported matrix type" - else: - from csr import csr_matrix - A = csr_matrix(A).tolil() + raise TypeError,'unrecognized lil_matrix constructor usage' + else: + #assume A is dense + try: + A = asmatrix(A) + except TypeError: + raise TypeError, "unsupported matrix type" + else: + from csr import csr_matrix + A = csr_matrix(A).tolil() - #A is a lil matrix self.shape = A.shape self.dtype = A.dtype self.rows = A.rows Modified: trunk/scipy/sparse/tests/test_base.py =================================================================== --- trunk/scipy/sparse/tests/test_base.py 2007-12-31 00:53:54 UTC (rev 3750) +++ trunk/scipy/sparse/tests/test_base.py 2007-12-31 08:51:39 UTC (rev 3751) @@ -31,6 +31,7 @@ #TODO check that invalid shape in constructor raises exception #TODO check that spmatrix( ... , copy=X ) is respected #TODO test repr(spmatrix) +#TODO test prune class _TestCommon: """test common functionality shared by all sparse formats""" From scipy-svn at scipy.org Mon Dec 31 16:17:40 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 Dec 2007 15:17:40 -0600 (CST) Subject: [Scipy-svn] r3752 - in trunk/scipy/sparse: . tests Message-ID: <20071231211740.08E9F39C097@new.scipy.org> Author: wnbell Date: 2007-12-31 15:17:31 -0600 (Mon, 31 Dec 2007) New Revision: 3752 Modified: trunk/scipy/sparse/sputils.py trunk/scipy/sparse/tests/test_base.py trunk/scipy/sparse/tests/test_sputils.py Log: float96 -> longdouble should address #575 Modified: trunk/scipy/sparse/sputils.py =================================================================== --- trunk/scipy/sparse/sputils.py 2007-12-31 08:51:39 UTC (rev 3751) +++ trunk/scipy/sparse/sputils.py 2007-12-31 21:17:31 UTC (rev 3752) @@ -7,9 +7,12 @@ import numpy # keep this list syncronized with sparsetools -supported_dtypes = ['int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32', - 'int64', 'uint64', 'float32', 'float64', 'float96', - 'complex64', 'complex128', 'complex192'] +#supported_dtypes = ['int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32', +# 'int64', 'uint64', 'float32', 'float64', +# 'complex64', 'complex128'] +supported_dtypes = ['int8','uint8','short','ushort','intc','uintc', + 'longlong','ulonglong','single','double','longdouble', + 'csingle','cdouble','clongdouble'] supported_dtypes = [ numpy.typeDict[x] for x in supported_dtypes] def upcast(*args): Modified: trunk/scipy/sparse/tests/test_base.py =================================================================== --- trunk/scipy/sparse/tests/test_base.py 2007-12-31 08:51:39 UTC (rev 3751) +++ trunk/scipy/sparse/tests/test_base.py 2007-12-31 21:17:31 UTC (rev 3752) @@ -23,6 +23,7 @@ from scipy.sparse import csc_matrix, csr_matrix, dok_matrix, \ coo_matrix, lil_matrix, dia_matrix, bsr_matrix, \ extract_diagonal, speye, spkron, SparseEfficiencyWarning +from scipy.sparse.sputils import supported_dtypes from scipy.linsolve import splu restore_path() @@ -302,7 +303,7 @@ assert_equal( result.shape, (4,2) ) assert_equal( result, dot(a,b) ) - def check_conversions(self): + def check_formatconversions(self): A = spkron([[1,0,1],[0,1,1],[1,0,0]], [[1,1],[0,1]] ) D = A.todense() A = self.spmatrix(A) @@ -657,16 +658,11 @@ self.Asp = self.spmatrix(self.A) self.Bsp = self.spmatrix(self.B) - #supported types - self.dtypes = ['int8','uint8','int16','uint16','int32','uint32', - 'int64','uint64','float32','float64','float96', - 'complex64','complex128','complex192'] - - def check_conversion(self): + def check_astype(self): self.arith_init() #check whether dtype and value is preserved in conversion - for x in self.dtypes: + for x in supported_dtypes: A = self.A.astype(x) B = self.B.astype(x) @@ -684,10 +680,10 @@ assert_array_equal((self.Asp+self.Bsp).todense(),self.A+self.B) #check conversions - for x in self.dtypes: + for x in supported_dtypes: A = self.A.astype(x) Asp = self.spmatrix(A) - for y in self.dtypes: + for y in supported_dtypes: B = self.B.astype(y) Bsp = self.spmatrix(B) @@ -716,10 +712,10 @@ #basic tests assert_array_equal((self.Asp*self.Bsp.T).todense(),self.A*self.B.T) - for x in self.dtypes: + for x in supported_dtypes: A = self.A.astype(x) Asp = self.spmatrix(A) - for y in self.dtypes: + for y in supported_dtypes: B = self.B.astype(y) Bsp = self.spmatrix(B) Modified: trunk/scipy/sparse/tests/test_sputils.py =================================================================== --- trunk/scipy/sparse/tests/test_sputils.py 2007-12-31 08:51:39 UTC (rev 3751) +++ trunk/scipy/sparse/tests/test_sputils.py 2007-12-31 21:17:31 UTC (rev 3752) @@ -12,7 +12,7 @@ class TestSparseUtils(NumpyTestCase): def check_upcast(self): - assert_equal(upcast('int32'),numpy.int32) + assert_equal(upcast('intc'),numpy.intc) assert_equal(upcast('int32','float32'),numpy.float64) assert_equal(upcast('bool',complex,float),numpy.complex128) assert_equal(upcast('i','d'),numpy.float64) From scipy-svn at scipy.org Mon Dec 31 20:42:18 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 Dec 2007 19:42:18 -0600 (CST) Subject: [Scipy-svn] r3753 - in trunk/scipy/sparse: . tests Message-ID: <20080101014218.9A84D39C03E@new.scipy.org> Author: wnbell Date: 2007-12-31 19:42:14 -0600 (Mon, 31 Dec 2007) New Revision: 3753 Modified: trunk/scipy/sparse/compressed.py trunk/scipy/sparse/csc.py trunk/scipy/sparse/csr.py trunk/scipy/sparse/sputils.py trunk/scipy/sparse/tests/test_sputils.py Log: deprecate rowcol() changed upcast Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2007-12-31 21:17:31 UTC (rev 3752) +++ trunk/scipy/sparse/compressed.py 2008-01-01 01:42:14 UTC (rev 3753) @@ -18,13 +18,6 @@ -def resize1d(arr, newlen): - old = len(arr) - new = zeros((newlen,), arr.dtype) - new[:old] = arr - return new - - class _cs_matrix(_data_matrix): """base matrix class for compressed row and column oriented matrices""" Modified: trunk/scipy/sparse/csc.py =================================================================== --- trunk/scipy/sparse/csc.py 2007-12-31 21:17:31 UTC (rev 3752) +++ trunk/scipy/sparse/csc.py 2008-01-01 01:42:14 UTC (rev 3753) @@ -14,7 +14,7 @@ from sputils import upcast, to_native, isdense, isshape, getdtype, \ isscalarlike -from compressed import _cs_matrix,resize1d +from compressed import _cs_matrix class csc_matrix(_cs_matrix): @@ -105,6 +105,8 @@ yield csr[r,:] def rowcol(self, ind): + #TODO remove after 0.7 + warn('rowcol() is deprecated',DeprecationWarning) row = self.indices[ind] col = searchsorted(self.indptr, ind+1)-1 return (row, col) Modified: trunk/scipy/sparse/csr.py =================================================================== --- trunk/scipy/sparse/csr.py 2007-12-31 21:17:31 UTC (rev 3752) +++ trunk/scipy/sparse/csr.py 2008-01-01 01:42:14 UTC (rev 3753) @@ -15,7 +15,7 @@ from sputils import upcast, to_native, isdense, isshape, getdtype, \ isscalarlike, isintlike -from compressed import _cs_matrix,resize1d +from compressed import _cs_matrix class csr_matrix(_cs_matrix): """Compressed Sparse Row matrix @@ -103,6 +103,8 @@ def rowcol(self, ind): + #TODO remove after 0.7 + warn('rowcol() is deprecated',DeprecationWarning) col = self.indices[ind] row = searchsorted(self.indptr, ind+1)-1 return (row, col) Modified: trunk/scipy/sparse/sputils.py =================================================================== --- trunk/scipy/sparse/sputils.py 2007-12-31 21:17:31 UTC (rev 3752) +++ trunk/scipy/sparse/sputils.py 2008-01-01 01:42:14 UTC (rev 3753) @@ -4,7 +4,7 @@ __all__ = ['upcast','getdtype','isscalarlike','isintlike', 'isshape','issequence','isdense'] -import numpy +import numpy as np # keep this list syncronized with sparsetools #supported_dtypes = ['int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32', @@ -13,7 +13,7 @@ supported_dtypes = ['int8','uint8','short','ushort','intc','uintc', 'longlong','ulonglong','single','double','longdouble', 'csingle','cdouble','clongdouble'] -supported_dtypes = [ numpy.typeDict[x] for x in supported_dtypes] +supported_dtypes = [ np.typeDict[x] for x in supported_dtypes] def upcast(*args): """Returns the nearest supported sparse dtype for the @@ -23,7 +23,7 @@ Example ======= - + >>> upcast('int32') >>> upcast('bool') @@ -34,26 +34,26 @@ """ - sample = numpy.array([0],dtype=args[0]) + sample = np.array([0],dtype=args[0]) for t in args[1:]: - sample = sample + numpy.array([0],dtype=t) + sample = sample + np.array([0],dtype=t) upcast = sample.dtype for t in supported_dtypes: - if upcast <= t: + if can_cast(sample.dtype,t): return t raise TypeError,'no supported conversion for types: %s' % args def to_native(A): - return numpy.asarray(A,dtype=A.dtype.newbyteorder('native')) + return np.asarray(A,dtype=A.dtype.newbyteorder('native')) def getdtype(dtype, a=None, default=None): """Function used to simplify argument processing. If 'dtype' is not - specified (is None), returns a.dtype; otherwise returns a numpy.dtype + specified (is None), returns a.dtype; otherwise returns a np.dtype object created from the specified dtype argument. If 'dtype' and 'a' are both None, construct a data type out of the 'default' parameter. Furthermore, 'dtype' must be in 'allowed' set. @@ -65,18 +65,18 @@ newdtype = a.dtype except AttributeError: if default is not None: - newdtype = numpy.dtype(default) + newdtype = np.dtype(default) canCast = False else: raise TypeError, "could not interpret data type" else: - newdtype = numpy.dtype(dtype) + newdtype = np.dtype(dtype) return newdtype def isscalarlike(x): """Is x either a scalar, an array scalar, or a 0-dim array?""" - return numpy.isscalar(x) or (isdense(x) and x.ndim == 0) + return np.isscalar(x) or (isdense(x) and x.ndim == 0) def isintlike(x): """Is x appropriate as an index into a sparse matrix? Returns True @@ -105,7 +105,7 @@ def issequence(t): return isinstance(t, (list, tuple))\ - or (isinstance(t, numpy.ndarray) and (t.ndim == 1)) + or (isinstance(t, np.ndarray) and (t.ndim == 1)) def _isinstance(x, _class): @@ -117,5 +117,5 @@ return isinstance(x, _class) or aux def isdense(x): - return _isinstance(x, numpy.ndarray) + return _isinstance(x, np.ndarray) Modified: trunk/scipy/sparse/tests/test_sputils.py =================================================================== --- trunk/scipy/sparse/tests/test_sputils.py 2007-12-31 21:17:31 UTC (rev 3752) +++ trunk/scipy/sparse/tests/test_sputils.py 2008-01-01 01:42:14 UTC (rev 3753) @@ -1,8 +1,8 @@ """unit tests for sparse utility functions""" -import numpy +import numpy as np -from numpy.testing import * +from np.testing import * set_package_path() from scipy.sparse.sputils import * restore_path() @@ -12,26 +12,26 @@ class TestSparseUtils(NumpyTestCase): def check_upcast(self): - assert_equal(upcast('intc'),numpy.intc) - assert_equal(upcast('int32','float32'),numpy.float64) - assert_equal(upcast('bool',complex,float),numpy.complex128) - assert_equal(upcast('i','d'),numpy.float64) + assert_equal(upcast('int32'),np.int32) + assert_equal(upcast('int32','float32'),np.float64) + assert_equal(upcast('bool',complex,float),np.complex128) + assert_equal(upcast('i','d'),np.float64) def check_getdtype(self): - A = numpy.array([1],dtype='int8') + A = np.array([1],dtype='int8') - assert_equal(getdtype(None,default=float),numpy.float) - assert_equal(getdtype(None,a=A),numpy.int8) + assert_equal(getdtype(None,default=float),np.float) + assert_equal(getdtype(None,a=A),np.int8) def check_isscalarlike(self): assert_equal(isscalarlike(3.0),True) assert_equal(isscalarlike(-4),True) assert_equal(isscalarlike(2.5),True) assert_equal(isscalarlike(1 + 3j),True) - assert_equal(isscalarlike(numpy.array(3)),True) + assert_equal(isscalarlike(np.array(3)),True) assert_equal(isscalarlike( "16" ), True) - assert_equal(isscalarlike( numpy.array([3])), False) + assert_equal(isscalarlike( np.array([3])), False) assert_equal(isscalarlike( [[3]] ), False) assert_equal(isscalarlike( (1,) ), False) assert_equal(isscalarlike( (1,2) ), False) @@ -39,8 +39,8 @@ def check_isintlike(self): assert_equal(isintlike(3.0),True) assert_equal(isintlike(-4),True) - assert_equal(isintlike(numpy.array(3)),True) - assert_equal(isintlike( numpy.array([3])), True) + assert_equal(isintlike(np.array(3)),True) + assert_equal(isintlike( np.array([3])), True) assert_equal(isintlike(2.5),False) assert_equal(isintlike(1 + 3j),False) @@ -61,14 +61,14 @@ assert_equal(issequence( (1,2,3) ),True) assert_equal(issequence( [1] ),True) assert_equal(issequence( [1,2,3] ),True) - assert_equal(issequence( numpy.array([1,2,3]) ),True) + assert_equal(issequence( np.array([1,2,3]) ),True) - assert_equal(issequence( numpy.array([[1],[2],[3]]) ),False) + assert_equal(issequence( np.array([[1],[2],[3]]) ),False) assert_equal(issequence( 3 ),False) def check_isdense(self): - assert_equal(isdense( numpy.array([1]) ),True) - assert_equal(isdense( numpy.matrix([1]) ),True) + assert_equal(isdense( np.array([1]) ),True) + assert_equal(isdense( np.matrix([1]) ),True) if __name__ == "__main__": NumpyTest().run() From scipy-svn at scipy.org Mon Dec 31 21:26:26 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 Dec 2007 20:26:26 -0600 (CST) Subject: [Scipy-svn] r3754 - branches/io_new Message-ID: <20080101022626.7AA2B39C12A@new.scipy.org> Author: oliphant Date: 2007-12-31 20:26:21 -0600 (Mon, 31 Dec 2007) New Revision: 3754 Removed: branches/io_new/datasource.py Modified: branches/io_new/__init__.py branches/io_new/array_import.py branches/io_new/data_store.py branches/io_new/npfile.py branches/io_new/pickler.py Log: Add deprecation doc strings for scipy.io Modified: branches/io_new/__init__.py =================================================================== --- branches/io_new/__init__.py 2008-01-01 01:42:14 UTC (rev 3753) +++ branches/io_new/__init__.py 2008-01-01 02:26:21 UTC (rev 3754) @@ -6,36 +6,35 @@ from numpy import deprecate_with_doc +# These are all deprecated (until the end deprecated tag) +from npfile import npfile +from data_store import save, load, create_module, create_shelf +from array_import import read_array, write_array +from pickler import objload, objsave + from numpyio import packbits, unpackbits, bswap, fread, fwrite, \ convert_objectarray -fread = deprecate_with_doc(\ -""" -scipy.io.fread is easily replaced with raw reading capabilities of NumPy +fread = deprecate_with_doc(""" +scipy.io.fread is can be replaced with raw reading capabilities of NumPy including fromfile as well as memory-mapping capabilities. """)(fread) -fwrite = deprecate_with_doc(\ -""" +fwrite = deprecate_with_doc(""" +scipy.io.fwrite can be replaced with raw writing capabilities of +NumPy. Also, remember that files can be directly memory-mapped into NumPy +arrays which is often a better way of reading especially large files. -scipy.io.fwrite is easily replaced with raw writing capabilities of -NumPy. Also, remmber that files can be directly memory-mapped into NumPy -arrays which is often a better way of "reading" especially large files. - Look at the tofile methods as well as save and savez for writing arrays into easily transported files of data. """)(fwrite) -bswap = deprecate_with_doc(\ -""" - +bswap = deprecate_with_doc(""" scipy.io.bswap is easily replaced with the byteswap method on an array. out = scipy.io.bswap(arr) --> out = arr.byteswap(True) """)(bswap) -packbits = deprecate_with_doc(\ -""" - +packbits = deprecate_with_doc(""" The functionality of scipy.io.packbits is now available as numpy.packbits The calling convention is a bit different as the 2-d case is not specialized. @@ -52,9 +51,7 @@ return np.packbits(a, axis=-1).ravel() """)(packbits) -unpackbits = deprecate_with_doc(\ -""" - +unpackbits = deprecate_with_doc(""" The functionality of scipy.io.unpackbits is now available in numpy.unpackbits The calling convention is different however as the 2-d case is no longer specialized. @@ -68,24 +65,25 @@ res = np.unpackbits(inp, axis=-1)[:,:els_per_slice] return res.ravel() """)(unpackbits) -convert_objectarray = deprecate_with_doc(convert_objectarray) +convert_objectarray = deprecate_with_doc(""" +The same functionality can be obtained using NumPy string arrays and the +.astype method (except for the optional missing value feature). +""")(convert_objectarray) + +# end deprecated + # matfile read and write from matlab.mio import loadmat, savemat # netCDF file support from netcdf import netcdf_file, netcdf_variable -from npfile import npfile - from recaster import sctype_attributes, Recaster +from data_store import save_as_module +from mmio import mminfo, mmread, mmwrite -from array_import import read_array, write_array -from data_store import save, save_as_module -from data_store import load, create_module, create_shelf -from pickler import objload, objsave -from mmio import mminfo, mmread, mmwrite __all__ = filter(lambda s:not s.startswith('_'),dir()) from numpy.testing import NumpyTest Modified: branches/io_new/array_import.py =================================================================== --- branches/io_new/array_import.py 2008-01-01 01:42:14 UTC (rev 3753) +++ branches/io_new/array_import.py 2008-01-01 02:26:21 UTC (rev 3754) @@ -18,10 +18,6 @@ # Numpy imports. import numpy -# snip on----- DELETE after numpy.deprecate_with_doc is available -numpy.deprecate_with_doc = lambda doc: (lambda func: func) -# snip off---- DELETE after numpy.deprecate_with_doc is available - from numpy import array, take, concatenate, asarray, real, imag, \ deprecate_with_doc # Sadly, this module is still written with typecodes in mind. @@ -316,7 +312,10 @@ return cols, atype - at deprecate_with_doc('') + at deprecate_with_doc(""" +The functionality of read_array is in numpy.loadtxt which allows the same +functionality using different syntax. +""") def read_array(fileobject, separator=default, columns=default, comment="#", lines=default, atype=Float, linesep='\n', rowsize=10000, missing=0): @@ -444,7 +443,11 @@ return row_sep.join(thestr) - at deprecate_with_doc('') + at deprecate_with_doc(""" + +This function is replaced by numpy.savetxt which allows the same functionality +through a different syntax. +""") def write_array(fileobject, arr, separator=" ", linesep='\n', precision=5, suppress_small=0, keep_open=0): """Write a rank-2 or less array to file represented by fileobject. Modified: branches/io_new/data_store.py =================================================================== --- branches/io_new/data_store.py 2008-01-01 01:42:14 UTC (rev 3753) +++ branches/io_new/data_store.py 2008-01-01 02:26:21 UTC (rev 3754) @@ -5,30 +5,27 @@ you to store data to a file and then load it back into the workspace. When the data is stored, a python module is also created as the "namespace for the data" - >>> import data_store + >>> import scipy.io >>> import os >>> a = 1 - >>> data_store.save('c:/temp/junker',{'a':a}) + >>> scipy.io.save_as_module('c:/temp/junker',{'a':a}) >>> os.chdir('c:/temp') >>> import junker >>> junker.a 1 """ -__all__ = ['load', 'save', 'create_module', 'create_shelf'] +__all__ = ['save_as_module', + # The rest of these are all deprecated + 'save', 'create_module', + 'create_shelf', 'load'] + import dumb_shelve import os -# snip on----- DELETE after numpy.deprecate_with_doc is available -import numpy -numpy.deprecate_with_doc = lambda doc: (lambda func: func) -# snip off---- DELETE after numpy.deprecate_with_doc is available +from numpy import deprecate_with_doc, deprecate -from numpy import deprecate_with_doc - - - at deprecate_with_doc('') -def load(module): +def _load(module): """ Load data into module from a shelf with the same name as the module. """ @@ -43,18 +40,15 @@ # print i, 'loaded...' # print 'done' -def save_as_module(file_name=None,data=None): - """ Save the dictionary "data" into - a module and shelf named save - """ - import dumb_shelve - create_module(file_name) - create_shelf(file_name,data) +load = deprecate_with_doc(""" +This is an internal function used with scipy.io.save_as_module -save = deprecate_with_doc('')(save_as_module) +If you are saving arrays into a module, you should think about using +HDF5 or .npz files instead. +""")(_load) - at deprecate_with_doc('') -def create_module(file_name): + +def _create_module(file_name): """ Create the module file. """ if not os.path.exists(file_name+'.py'): # don't clobber existing files @@ -62,11 +56,17 @@ f = open(file_name+'.py','w') f.write('import scipy.io.data_store as data_store\n') f.write('import %s\n' % module_name) - f.write('data_store.load(%s)' % module_name) + f.write('data_store._load(%s)' % module_name) f.close() - at deprecate_with_doc('') -def create_shelf(file_name,data): +create_module = deprecate_with_doc(""" +This is an internal function used with scipy.io.save_as_module + +If you are saving arrays into a module, you should think about +using HDF5 or .npz files instead. +""")(_create_module) + +def _create_shelf(file_name,data): """Use this to write the data to a new file """ shelf_name = file_name.split('.')[0] @@ -76,3 +76,20 @@ f[i] = data[i] # print 'done' f.close() + +create_shelf = deprecate_with_doc(""" +This is an internal function used with scipy.io.save_as_module + +If you are saving arrays into a module, you should think about using +HDF5 or .npz files instead. +""")(_create_shelf) + + +def save_as_module(file_name=None,data=None): + """ Save the dictionary "data" into + a module and shelf named save + """ + _create_module(file_name) + _create_shelf(file_name,data) + +save = deprecate(save_as_module, 'save', 'save_as_module') Deleted: branches/io_new/datasource.py =================================================================== --- branches/io_new/datasource.py 2008-01-01 01:42:14 UTC (rev 3753) +++ branches/io_new/datasource.py 2008-01-01 02:26:21 UTC (rev 3754) @@ -1,457 +0,0 @@ -"""A file interface for handling local and remote data files. -The goal of datasource is to abstract some of the file system operations when -dealing with data files so the researcher doesn't have to know all the -low-level details. Through datasource, a researcher can obtain and use a -file with one function call, regardless of location of the file. - -DataSource is meant to augment standard python libraries, not replace them. -It should work seemlessly with standard file IO operations and the os module. - -DataSource files can originate locally or remotely: - -- local files : '/home/guido/src/local/data.txt' -- URLs (http, ftp, ...) : 'http://www.scipy.org/not/real/data.txt' - -DataSource files can also be compressed or uncompressed. Currently only gzip -and bz2 are supported. - -Example: - - >>> # Create a DataSource, use os.curdir (default) for local storage. - >>> ds = datasource.DataSource() - >>> - >>> # Open a remote file. - >>> # DataSource downloads the file, stores it locally in: - >>> # './www.google.com/index.html' - >>> # opens the file and returns a file object. - >>> fp = ds.open('http://www.google.com/index.html') - >>> - >>> # Use the file as you normally would - >>> fp.read() - >>> fp.close() - -""" - -__docformat__ = "restructuredtext en" - -import bz2 -import gzip -import os -import tempfile -from shutil import rmtree -from urllib2 import urlopen, URLError -from urlparse import urlparse - -import warnings - -# datasource has been used for a while in the NIPY project for analyzing -# large fmri imaging files hosted over a network. Data would be fetched -# via URLs, cached locally and analyzed. Under these conditions the code -# worked well, however it needs to be documented, tested and reviewed -# before being fully exposed to SciPy. We hope to do this before the -# 0.7 release. -_api_warning = "The datasource API will be changing frequently before \ -the 0.7 release as the code is ported from the NIPY project to SciPy. \ -Some of the current public interface may become private during the port! \ -Use this module minimally, if at all, until it is stabilized." - -warnings.warn(_api_warning) - -# TODO: .zip support, .tar support? -_file_openers = {".gz":gzip.open, ".bz2":bz2.BZ2File, None:file} - - -def open(path, mode='r', destpath=os.curdir): - """Open ``path`` with ``mode`` and return the file object. - - If ``path`` is an URL, it will be downloaded, stored in the DataSource - directory and opened from there. - - *Parameters*: - - path : {string} - - mode : {string}, optional - - destpath : {string}, optional - Destination directory where URLs will be downloaded and stored. - - *Returns*: - - file object - - """ - - ds = DataSource(destpath) - return ds.open(path, mode) - - -class DataSource (object): - """A generic data source file (file, http, ftp, ...). - - DataSources could be local files or remote files/URLs. The files may - also be compressed or uncompressed. DataSource hides some of the low-level - details of downloading the file, allowing you to simply pass in a valid - file path (or URL) and obtain a file object. - - *Methods*: - - - exists : test if the file exists locally or remotely - - abspath : get absolute path of the file in the DataSource directory - - open : open the file - - *Example URL DataSource*:: - - # Initialize DataSource with a local directory, default is os.curdir. - ds = DataSource('/home/guido') - - # Open remote file. - # File will be downloaded and opened from here: - # /home/guido/site/xyz.txt - ds.open('http://fake.xyz.web/site/xyz.txt') - - *Example using DataSource for temporary files*:: - - # Initialize DataSource with 'None' for the local directory. - ds = DataSource(None) - - # Open local file. - # Opened file exists in a temporary directory like: - # /tmp/tmpUnhcvM/foobar.txt - # Temporary directories are deleted when the DataSource is deleted. - ds.open('/home/guido/foobar.txt') - - *Notes*: - BUG : URLs require a scheme string ('http://') to be used. - www.google.com will fail. - - >>> repos.exists('www.google.com/index.html') - False - - >>> repos.exists('http://www.google.com/index.html') - True - - """ - - def __init__(self, destpath=os.curdir): - """Create a DataSource with a local path at destpath.""" - if destpath: - self._destpath = os.path.abspath(destpath) - self._istmpdest = False - else: - self._destpath = tempfile.mkdtemp() - self._istmpdest = True - - def __del__(self): - # Remove temp directories - if self._istmpdest: - rmtree(self._destpath) - - def _iszip(self, filename): - """Test if the filename is a zip file by looking at the file extension. - """ - fname, ext = os.path.splitext(filename) - return ext in _file_openers.keys() - - def _iswritemode(self, mode): - """Test if the given mode will open a file for writing.""" - - # Currently only used to test the bz2 files. - _writemodes = ("w", "+") - for c in mode: - if c in _writemodes: - return True - return False - - def _splitzipext(self, filename): - """Split zip extension from filename and return filename. - - *Returns*: - base, zip_ext : {tuple} - - """ - - if self._iszip(filename): - return os.path.splitext(filename) - else: - return filename, None - - def _possible_names(self, filename): - """Return a tuple containing compressed filename variations.""" - names = [filename] - if not self._iszip(filename): - for zipext in _file_openers.keys(): - if zipext: - names.append(filename+zipext) - return names - - def _isurl(self, path): - """Test if path is a net location. Tests the scheme and netloc.""" - - # BUG : URLs require a scheme string ('http://') to be used. - # www.google.com will fail. - # Should we prepend the scheme for those that don't have it and - # test that also? Similar to the way we append .gz and test for - # for compressed versions of files. - - scheme, netloc, upath, uparams, uquery, ufrag = urlparse(path) - return bool(scheme and netloc) - - def _cache(self, path): - """Cache the file specified by path. - - Creates a copy of the file in the datasource cache. - - """ - - upath = self.abspath(path) - - # ensure directory exists - if not os.path.exists(os.path.dirname(upath)): - os.makedirs(os.path.dirname(upath)) - - # TODO: Doesn't handle compressed files! - if self._isurl(path): - try: - openedurl = urlopen(path) - file(upath, 'w').write(openedurl.read()) - except URLError: - raise URLError("URL not found: ", path) - else: - try: - # TODO: Why not just copy the file with shutils.copyfile? - fp = file(path, 'r') - file(upath, 'w').write(fp.read()) - except IOError: - raise IOError("File not found: ", path) - return upath - - def _findfile(self, path): - """Searches for ``path`` and returns full path if found. - - If path is an URL, _findfile will cache a local copy and return - the path to the cached file. - If path is a local file, _findfile will return a path to that local - file. - - The search will include possible compressed versions of the file and - return the first occurence found. - - """ - - # Build list of possible local file paths - if not self._isurl(path): - # Valid local paths - filelist = self._possible_names(path) - # Paths in self._destpath - filelist += self._possible_names(self.abspath(path)) - else: - # Cached URLs in self._destpath - filelist = self._possible_names(self.abspath(path)) - # Remote URLs - filelist = filelist + self._possible_names(path) - - for name in filelist: - if self.exists(name): - if self._isurl(name): - name = self._cache(name) - return name - return None - - def abspath(self, path): - """Return absolute path of ``path`` in the DataSource directory. - - If ``path`` is an URL, the ``abspath`` will be either the location - the file exists locally or the location it would exist when opened - using the ``open`` method. - - The functionality is idential to os.path.abspath. - - *Parameters*: - - path : {string} - Can be a local file or a remote URL. - - *Returns*: - - Complete path, rooted in the DataSource destination directory. - - *See Also*: - - `open` : Method that downloads and opens files. - - """ - - # TODO: This should be more robust. Handles case where path includes - # the destpath, but not other sub-paths. Failing case: - # path = /home/guido/datafile.txt - # destpath = /home/alex/ - # upath = self.abspath(path) - # upath == '/home/alex/home/guido/datafile.txt' - - # handle case where path includes self._destpath - splitpath = path.split(self._destpath, 2) - if len(splitpath) > 1: - path = splitpath[1] - scheme, netloc, upath, uparams, uquery, ufrag = urlparse(path) - return os.path.join(self._destpath, netloc, upath.strip(os.sep)) - - def exists(self, path): - """Test if ``path`` exists. - - Test if ``path`` exists as (and in this order): - - - a local file. - - a remote URL that have been downloaded and stored locally in the - DataSource directory. - - a remote URL that has not been downloaded, but is valid and - accessible. - - *Parameters*: - - path : {string} - Can be a local file or a remote URL. - - *Returns*: - - boolean - - *See Also*: - - `abspath` - - *Notes* - - When ``path`` is an URL, ``exist`` will return True if it's either - stored locally in the DataSource directory, or is a valid remote - URL. DataSource does not discriminate between to two, the file - is accessible if it exists in either location. - - """ - - # Test local path - if os.path.exists(path): - return True - - # Test cached url - upath = self.abspath(path) - if os.path.exists(upath): - return True - - # Test remote url - if self._isurl(path): - try: - netfile = urlopen(path) - del(netfile) - return True - except URLError: - return False - return False - - def open(self, path, mode='r'): - """Open ``path`` with ``mode`` and return the file object. - - If ``path`` is an URL, it will be downloaded, stored in the DataSource - directory and opened from there. - - *Parameters*: - - path : {string} - - mode : {string}, optional - - - *Returns*: - - file object - - """ - - # TODO: There is no support for opening a file for writing which - # doesn't exist yet (creating a file). Should there be? - - # TODO: Add a ``subdir`` parameter for specifying the subdirectory - # used to store URLs in self._destpath. - - if self._isurl(path) and self._iswritemode(mode): - raise ValueError("URLs are not writeable") - - # NOTE: _findfile will fail on a new file opened for writing. - found = self._findfile(path) - if found: - _fname, ext = self._splitzipext(found) - if ext == 'bz2': - mode.replace("+", "") - return _file_openers[ext](found, mode=mode) - else: - raise IOError("%s not found." % path) - - -class Repository (DataSource): - """A data Repository where multiple DataSource's share a base URL/directory. - - Repository extends DataSource by prepending a base URL (or directory) to - all the files it handles. Use a Repository when you will be working with - multiple files from one base URL. Initialize the Respository with the - base URL, then refer to each file by it's filename only. - - *Methods*: - - - exists : test if the file exists locally or remotely - - abspath : get absolute path of the file in the DataSource directory - - open : open the file - - *Toy example*:: - - # Analyze all files in the repository. - repos = Repository('/home/user/data/dir/') - for filename in filelist: - fp = repos.open(filename) - fp.analyze() - fp.close() - - # Similarly you could use a URL for a repository. - repos = Repository('http://www.xyz.edu/data') - - """ - - def __init__(self, baseurl, destpath=os.curdir): - """Create a Repository with a shared url or directory of baseurl.""" - DataSource.__init__(self, destpath=destpath) - self._baseurl = baseurl - - def __del__(self): - DataSource.__del__(self) - - def _fullpath(self, path): - """Return complete path for path. Prepends baseurl if necessary.""" - splitpath = path.split(self._baseurl, 2) - if len(splitpath) == 1: - result = os.path.join(self._baseurl, path) - else: - result = path # path contains baseurl already - return result - - def _findfile(self, path): - """Extend DataSource method to prepend baseurl to ``path``.""" - return DataSource._findfile(self, self._fullpath(path)) - - def abspath(self, path): - """Extend DataSource method to prepend baseurl to ``path``.""" - return DataSource.abspath(self, self._fullpath(path)) - - def exists(self, path): - """Extend DataSource method to prepend baseurl to ``path``.""" - return DataSource.exists(self, self._fullpath(path)) - - def open(self, path, mode='r'): - """Extend DataSource method to prepend baseurl to ``path``.""" - return DataSource.open(self, self._fullpath(path), mode) - - def listdir(self): - '''List files in the source Repository.''' - if self._isurl(self._baseurl): - raise NotImplementedError, \ - "Directory listing of URLs, not supported yet." - else: - return os.listdir(self._baseurl) Modified: branches/io_new/npfile.py =================================================================== --- branches/io_new/npfile.py 2008-01-01 01:42:14 UTC (rev 3753) +++ branches/io_new/npfile.py 2008-01-01 02:26:21 UTC (rev 3754) @@ -222,3 +222,11 @@ if (not endian == 'dtype') and (dt_endian != endian): return arr.byteswap() return arr.copy() + +npfile = N.deprecate_with_doc(""" +You can achieve the same effect as using npfile, using ndarray.tofile +and numpy.fromfile. + +Even better you can use memory-mapped arrays and data-types to map out a +file format for direct manipulation in NumPy. +""")(npfile) Modified: branches/io_new/pickler.py =================================================================== --- branches/io_new/pickler.py 2008-01-01 01:42:14 UTC (rev 3753) +++ branches/io_new/pickler.py 2008-01-01 02:26:21 UTC (rev 3754) @@ -1,13 +1,10 @@ import cPickle -# snip on----- DELETE after numpy.deprecate_with_doc is available -import numpy -numpy.deprecate_with_doc = lambda doc: (lambda func: func) -# snip off---- DELETE after numpy.deprecate_with_doc is available - from numpy import deprecate_with_doc - at deprecate_with_doc('') + at deprecate_with_doc(""" +Just use cPickle.dump directly or numpy.savez +""") def objsave(file, allglobals, *args): """Pickle the part of a dictionary containing the argument list into file string. @@ -27,6 +24,9 @@ cPickle.dump(savedict,fid,1) fid.close() + at deprecate_with_doc(""" +Just use cPickle.load or numpy.load. +""") def objload(file, allglobals): """Load a previously pickled dictionary and insert into given dictionary. From scipy-svn at scipy.org Mon Dec 31 21:27:25 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 Dec 2007 20:27:25 -0600 (CST) Subject: [Scipy-svn] r3755 - branches/io_new/matlab Message-ID: <20080101022725.280DC39C03E@new.scipy.org> Author: oliphant Date: 2007-12-31 20:27:24 -0600 (Mon, 31 Dec 2007) New Revision: 3755 Added: branches/io_new/matlab/setup.py Log: Add setup.py command for matlab. Added: branches/io_new/matlab/setup.py =================================================================== --- branches/io_new/matlab/setup.py 2008-01-01 02:26:21 UTC (rev 3754) +++ branches/io_new/matlab/setup.py 2008-01-01 02:27:24 UTC (rev 3755) @@ -0,0 +1,10 @@ +#!/usr/bin/env python + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('matlab', parent_package, top_path) + return config + +if __name__ == '__main__': + from numpy.distutils.core import setup + setup(**configuration(top_path='').todict()) Property changes on: branches/io_new/matlab/setup.py ___________________________________________________________________ Name: svn:executable + * Name: svn:keywords + Id Name: svn:eol-style + native From scipy-svn at scipy.org Mon Dec 31 21:27:52 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 Dec 2007 20:27:52 -0600 (CST) Subject: [Scipy-svn] r3756 - in trunk/scipy/sparse: . tests Message-ID: <20080101022752.EA31039C03E@new.scipy.org> Author: wnbell Date: 2007-12-31 20:27:50 -0600 (Mon, 31 Dec 2007) New Revision: 3756 Modified: trunk/scipy/sparse/compressed.py trunk/scipy/sparse/sputils.py trunk/scipy/sparse/tests/test_sparse.py trunk/scipy/sparse/tests/test_sputils.py Log: cache result of has_sorted_indices() Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2008-01-01 02:27:24 UTC (rev 3755) +++ trunk/scipy/sparse/compressed.py 2008-01-01 02:27:50 UTC (rev 3756) @@ -570,9 +570,15 @@ def has_sorted_indices(self): """Determine whether the matrix has sorted indices """ - fn = sparsetools.csr_has_sorted_indices - return fn( len(self.indptr) - 1, self.indptr, self.indices) + #first check to see if result was cached + if not hasattr(self,'_has_sorted_indices'): + fn = sparsetools.csr_has_sorted_indices + self._has_sorted_indices = \ + fn( len(self.indptr) - 1, self.indptr, self.indices) + + return self._has_sorted_indices + def sorted_indices(self): """Return a copy of this matrix with sorted indices """ @@ -584,18 +590,15 @@ # although the previous option is typically faster #return self.toother().toother() - def sort_indices(self,check_first=True): + def sort_indices(self): """Sort the indices of this matrix *in place* """ - #see if sorting can be avoided - if check_first and self.has_sorted_indices(): - return + + if not self.has_sorted_indices(): + fn = sparsetools.csr_sort_indices + fn( len(self.indptr) - 1, self.indptr, self.indices, self.data) + self._has_sorted_indices = True - fn = sparsetools.csr_sort_indices - fn( len(self.indptr) - 1, self.indptr, self.indices, self.data) - - #TODO store is_sorted flag somewhere - def ensure_sorted_indices(self, inplace=False): """Return a copy of this matrix where the column indices are sorted """ @@ -624,6 +627,10 @@ self.indices = self.indices[:self.nnz] + ################### + # utility methods # + ################### + # needed by _data_matrix def _with_data(self,data,copy=True): """Returns a matrix with the same sparsity structure as self, @@ -637,7 +644,6 @@ return self.__class__((data,self.indices,self.indptr), \ shape=self.shape,dtype=data.dtype) - # utility functions def _binopt(self, other, op, in_shape=None, out_shape=None): """apply the binary operation fn to two sparse matrices""" other = self.__class__(other) Modified: trunk/scipy/sparse/sputils.py =================================================================== --- trunk/scipy/sparse/sputils.py 2008-01-01 02:27:24 UTC (rev 3755) +++ trunk/scipy/sparse/sputils.py 2008-01-01 02:27:50 UTC (rev 3756) @@ -41,7 +41,7 @@ upcast = sample.dtype for t in supported_dtypes: - if can_cast(sample.dtype,t): + if np.can_cast(sample.dtype,t): return t raise TypeError,'no supported conversion for types: %s' % args Modified: trunk/scipy/sparse/tests/test_sparse.py =================================================================== --- trunk/scipy/sparse/tests/test_sparse.py 2008-01-01 02:27:24 UTC (rev 3755) +++ trunk/scipy/sparse/tests/test_sparse.py 2008-01-01 02:27:50 UTC (rev 3756) @@ -117,7 +117,8 @@ start = time.clock() iter = 0 while iter < 5 and time.clock() - start < 1: - A.sort_indices(check_first =False) + A._has_sorted_indices = False + A.sort_indices() iter += 1 end = time.clock() Modified: trunk/scipy/sparse/tests/test_sputils.py =================================================================== --- trunk/scipy/sparse/tests/test_sputils.py 2008-01-01 02:27:24 UTC (rev 3755) +++ trunk/scipy/sparse/tests/test_sputils.py 2008-01-01 02:27:50 UTC (rev 3756) @@ -1,8 +1,8 @@ """unit tests for sparse utility functions""" import numpy as np +from numpy.testing import * -from np.testing import * set_package_path() from scipy.sparse.sputils import * restore_path() @@ -12,7 +12,7 @@ class TestSparseUtils(NumpyTestCase): def check_upcast(self): - assert_equal(upcast('int32'),np.int32) + assert_equal(upcast('intc'),np.intc) assert_equal(upcast('int32','float32'),np.float64) assert_equal(upcast('bool',complex,float),np.complex128) assert_equal(upcast('i','d'),np.float64) From scipy-svn at scipy.org Mon Dec 31 21:55:24 2007 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 Dec 2007 20:55:24 -0600 (CST) Subject: [Scipy-svn] r3757 - trunk/scipy/sparse Message-ID: <20080101025524.B66B339C03E@new.scipy.org> Author: wnbell Date: 2007-12-31 20:55:20 -0600 (Mon, 31 Dec 2007) New Revision: 3757 Modified: trunk/scipy/sparse/bsr.py trunk/scipy/sparse/csc.py trunk/scipy/sparse/csr.py Log: set _has_sorted_indices after CSR<->CSC Modified: trunk/scipy/sparse/bsr.py =================================================================== --- trunk/scipy/sparse/bsr.py 2008-01-01 02:27:50 UTC (rev 3756) +++ trunk/scipy/sparse/bsr.py 2008-01-01 02:55:20 UTC (rev 3757) @@ -438,10 +438,10 @@ def sum_duplicates(self): raise NotImplementedError - def sort_indices(self, check_first=True): + def sort_indices(self): """Sort the indices of this matrix *in place* """ - if check_first and self.has_sorted_indices(): + if self.has_sorted_indices(): return from csr import csr_matrix @@ -460,6 +460,8 @@ self.data[:] = self.data[proxy.data] self.indices[:] = proxy.indices + self._has_sorted_indices = True + def prune(self): """ Remove empty space after all non-zero elements. """ Modified: trunk/scipy/sparse/csc.py =================================================================== --- trunk/scipy/sparse/csc.py 2008-01-01 02:27:50 UTC (rev 3756) +++ trunk/scipy/sparse/csc.py 2008-01-01 02:55:20 UTC (rev 3757) @@ -127,7 +127,9 @@ indptr, indices, data) from csr import csr_matrix - return csr_matrix((data, indices, indptr), self.shape) + A = csr_matrix((data, indices, indptr), self.shape) + A._has_sorted_indices = True + return A def tobsr(self, blocksize=None): if blocksize == (1,1): Modified: trunk/scipy/sparse/csr.py =================================================================== --- trunk/scipy/sparse/csr.py 2008-01-01 02:27:50 UTC (rev 3756) +++ trunk/scipy/sparse/csr.py 2008-01-01 02:55:20 UTC (rev 3757) @@ -143,7 +143,9 @@ indptr, indices, data) from csc import csc_matrix - return csc_matrix((data, indices, indptr), self.shape) + A = csc_matrix((data, indices, indptr), self.shape) + A._has_sorted_indices = True + return A def tobsr(self,blocksize=None,copy=True): if blocksize == (1,1):