From scipy-svn at scipy.org Mon Jan 10 09:32:56 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 10 Jan 2011 08:32:56 -0600 (CST) Subject: [Scipy-svn] r7020 - in trunk/scipy/spatial: . tests Message-ID: <20110110143256.5884D6F011@scipy.org> Author: rgommers Date: 2011-01-10 08:32:55 -0600 (Mon, 10 Jan 2011) New Revision: 7020 Modified: trunk/scipy/spatial/kdtree.py trunk/scipy/spatial/tests/test_kdtree.py Log: BUG: spatial.kdtree.query_pair() fix. Closes #1052. Thanks to Stefan vd Walt. Modified: trunk/scipy/spatial/kdtree.py =================================================================== --- trunk/scipy/spatial/kdtree.py 2010-12-22 04:05:46 UTC (rev 7019) +++ trunk/scipy/spatial/kdtree.py 2011-01-10 14:32:55 UTC (rev 7020) @@ -592,12 +592,8 @@ # This node pair will be visited in the other order #return pass - if rect1.min_distance_rectangle(rect2, p)>r/(1.+eps): - return - elif rect1.max_distance_rectangle(rect2, p)r/(1.+eps): + return + elif rect1.max_distance_rectangle(rect2, p) Author: rgommers Date: 2011-01-10 08:45:01 -0600 (Mon, 10 Jan 2011) New Revision: 7021 Modified: branches/0.9.x/scipy/signal/tests/test_fir_filter_design.py Log: 3K: signal: use explicit integer division in FIR filter tests where appropriate (backport of r7019) Modified: branches/0.9.x/scipy/signal/tests/test_fir_filter_design.py =================================================================== --- branches/0.9.x/scipy/signal/tests/test_fir_filter_design.py 2011-01-10 14:32:55 UTC (rev 7020) +++ branches/0.9.x/scipy/signal/tests/test_fir_filter_design.py 2011-01-10 14:45:01 UTC (rev 7021) @@ -104,7 +104,7 @@ taps = firwin(ntaps, cutoff=0.5, window=('kaiser', beta), scale=False) # Check the symmetry of taps. - assert_array_almost_equal(taps[:ntaps/2], taps[ntaps:ntaps-ntaps/2-1:-1]) + assert_array_almost_equal(taps[:ntaps//2], taps[ntaps:ntaps-ntaps//2-1:-1]) # Check the gain at a few samples where we know it should be approximately 0 or 1. freq_samples = np.array([0.0, 0.25, 0.5-width/2, 0.5+width/2, 0.75, 1.0]) @@ -123,7 +123,7 @@ pass_zero=False, scale=False) # Check the symmetry of taps. - assert_array_almost_equal(taps[:ntaps/2], taps[ntaps:ntaps-ntaps/2-1:-1]) + assert_array_almost_equal(taps[:ntaps//2], taps[ntaps:ntaps-ntaps//2-1:-1]) # Check the gain at a few samples where we know it should be approximately 0 or 1. freq_samples = np.array([0.0, 0.25, 0.5-width/2, 0.5+width/2, 0.75, 1.0]) @@ -138,7 +138,7 @@ pass_zero=False, scale=False) # Check the symmetry of taps. - assert_array_almost_equal(taps[:ntaps/2], taps[ntaps:ntaps-ntaps/2-1:-1]) + assert_array_almost_equal(taps[:ntaps//2], taps[ntaps:ntaps-ntaps//2-1:-1]) # Check the gain at a few samples where we know it should be approximately 0 or 1. freq_samples = np.array([0.0, 0.2, 0.3-width/2, 0.3+width/2, 0.5, @@ -154,7 +154,7 @@ pass_zero=True, scale=False) # Check the symmetry of taps. - assert_array_almost_equal(taps[:ntaps/2], taps[ntaps:ntaps-ntaps/2-1:-1]) + assert_array_almost_equal(taps[:ntaps//2], taps[ntaps:ntaps-ntaps//2-1:-1]) # Check the gain at a few samples where we know it should be approximately 0 or 1. freq_samples = np.array([0.0, 0.1, 0.2-width/2, 0.2+width/2, 0.35, @@ -175,7 +175,7 @@ pass_zero=False, scale=False, nyq=nyquist) # Check the symmetry of taps. - assert_array_almost_equal(taps[:ntaps/2], taps[ntaps:ntaps-ntaps/2-1:-1]) + assert_array_almost_equal(taps[:ntaps//2], taps[ntaps:ntaps-ntaps//2-1:-1]) # Check the gain at a few samples where we know it should be approximately 0 or 1. freq_samples = np.array([0.0, 200, 300-width/2, 300+width/2, 500, @@ -288,8 +288,8 @@ # make sure the filter has correct # of taps assert_(len(h) == N, "Number of Taps") - # make sure it is type III (anti-symmtric tap coefficients) - assert_array_almost_equal(h[:(N-1)/2], -h[:-(N-1)/2-1:-1]) + # make sure it is type III (anti-symmetric tap coefficients) + assert_array_almost_equal(h[:(N-1)//2], -h[:-(N-1)//2-1:-1]) # Since the requested response is symmetric, all even coeffcients # should be zero (or in this case really small) From scipy-svn at scipy.org Mon Jan 10 09:45:25 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 10 Jan 2011 08:45:25 -0600 (CST) Subject: [Scipy-svn] r7022 - in branches/0.9.x/scipy/spatial: . tests Message-ID: <20110110144525.C70746EFD8@scipy.org> Author: rgommers Date: 2011-01-10 08:45:25 -0600 (Mon, 10 Jan 2011) New Revision: 7022 Modified: branches/0.9.x/scipy/spatial/kdtree.py branches/0.9.x/scipy/spatial/tests/test_kdtree.py Log: BUG: spatial.kdtree.query_pair() fix. Closes #1052. Thanks to Stefan vd Walt. (backport of r7020) Modified: branches/0.9.x/scipy/spatial/kdtree.py =================================================================== --- branches/0.9.x/scipy/spatial/kdtree.py 2011-01-10 14:45:01 UTC (rev 7021) +++ branches/0.9.x/scipy/spatial/kdtree.py 2011-01-10 14:45:25 UTC (rev 7022) @@ -592,12 +592,8 @@ # This node pair will be visited in the other order #return pass - if rect1.min_distance_rectangle(rect2, p)>r/(1.+eps): - return - elif rect1.max_distance_rectangle(rect2, p)r/(1.+eps): + return + elif rect1.max_distance_rectangle(rect2, p) Author: rgommers Date: 2011-01-11 06:47:38 -0600 (Tue, 11 Jan 2011) New Revision: 7023 Modified: branches/0.9.x/scipy/linalg/decomp.py branches/0.9.x/scipy/linalg/tests/test_decomp.py Log: BUG: linalg: work around a LAPACK bug in DGGEV (#709) (backported from r7002) Modified: branches/0.9.x/scipy/linalg/decomp.py =================================================================== --- branches/0.9.x/scipy/linalg/decomp.py 2011-01-10 14:45:25 UTC (rev 7022) +++ branches/0.9.x/scipy/linalg/decomp.py 2011-01-11 12:47:38 UTC (rev 7023) @@ -11,13 +11,13 @@ # April 2010: Functions for LU, QR, SVD, Schur and Cholesky decompositions were # moved to their own files. Still in this file are functions for eigenstuff # and for the Hessenberg form. - + __all__ = ['eig','eigh','eig_banded','eigvals','eigvalsh', 'eigvals_banded', 'hessenberg'] import numpy from numpy import array, asarray_chkfinite, asarray, diag, zeros, ones, \ - isfinite, inexact, nonzero, iscomplexobj, cast + isfinite, inexact, nonzero, iscomplexobj, cast, flatnonzero, conj # Local imports from scipy.linalg import calc_lwork @@ -28,20 +28,17 @@ _I = cast['F'](1j) -def _make_complex_eigvecs(w, vin, cmplx_tcode): - v = numpy.array(vin, dtype=cmplx_tcode) - #ind = numpy.flatnonzero(numpy.not_equal(w.imag,0.0)) - ind = numpy.flatnonzero(numpy.logical_and(numpy.not_equal(w.imag, 0.0), - numpy.isfinite(w))) - vnew = numpy.zeros((v.shape[0], len(ind)>>1), cmplx_tcode) - vnew.real = numpy.take(vin, ind[::2],1) - vnew.imag = numpy.take(vin, ind[1::2],1) - count = 0 - conj = numpy.conjugate - for i in range(len(ind)//2): - v[:, ind[2*i]] = vnew[:, count] - v[:, ind[2*i+1]] = conj(vnew[:, count]) - count += 1 +def _make_complex_eigvecs(w, vin, dtype): + """ + Produce complex-valued eigenvectors from LAPACK DGGEV real-valued output + """ + # - see LAPACK man page DGGEV at ALPHAI + v = numpy.array(vin, dtype=dtype) + m = (w.imag > 0) + m[:-1] |= (w.imag[1:] < 0) # workaround for LAPACK bug, cf. ticket #709 + for i in flatnonzero(m): + v.imag[:,i] = vin[:,i+1] + conj(v[:,i], v[:,i+1]) return v def _geneig(a1, b, left, right, overwrite_a, overwrite_b): Modified: branches/0.9.x/scipy/linalg/tests/test_decomp.py =================================================================== --- branches/0.9.x/scipy/linalg/tests/test_decomp.py 2011-01-10 14:45:25 UTC (rev 7022) +++ branches/0.9.x/scipy/linalg/tests/test_decomp.py 2011-01-11 12:47:38 UTC (rev 7023) @@ -132,7 +132,7 @@ assert_array_almost_equal(w,exact_w) -class TestEig(TestCase): +class TestEig(object): def test_simple(self): a = [[1,2,3],[1,2,3],[2,5,6]] @@ -154,6 +154,16 @@ for i in range(3): assert_array_almost_equal(dot(transpose(a),v[:,i]),w[i]*v[:,i]) + def test_simple_complex_eig(self): + a = [[1,2],[-2,1]] + w,vl,vr = eig(a,left=1,right=1) + assert_array_almost_equal(w, array([1+2j, 1-2j])) + for i in range(2): + assert_array_almost_equal(dot(a,vr[:,i]),w[i]*vr[:,i]) + for i in range(2): + assert_array_almost_equal(dot(conjugate(transpose(a)),vl[:,i]), + conjugate(w[i])*vl[:,i]) + def test_simple_complex(self): a = [[1,2,3],[1,2,3],[2,5,6+1j]] w,vl,vr = eig(a,left=1,right=1) @@ -163,29 +173,32 @@ assert_array_almost_equal(dot(conjugate(transpose(a)),vl[:,i]), conjugate(w[i])*vl[:,i]) + def _check_gen_eig(self, A, B): + A, B = asarray(A), asarray(B) + msg = "\n%r\n%r" % (A, B) + w, vr = eig(A,B) + wt = eigvals(A,B) + val1 = dot(A, vr) + val2 = dot(B, vr) * w + res = val1 - val2 + for i in range(res.shape[1]): + if all(isfinite(res[:, i])): + assert_array_almost_equal(res[:, i], 0, err_msg=msg) + + assert_array_almost_equal(sort(w[isfinite(w)]), sort(wt[isfinite(wt)]), + err_msg=msg) + def test_singular(self): """Test singular pair""" # Example taken from # http://www.cs.umu.se/research/nla/singular_pairs/guptri/matlab.html A = array(( [22,34,31,31,17], [45,45,42,19,29], [39,47,49,26,34], [27,31,26,21,15], [38,44,44,24,30])) - B = array(( [13,26,25,17,24], [31,46,40,26,37], [26,40,19,25,25], [16,25,27,14,23], [24,35,18,21,22])) - w, vr = eig(A,B) - wt = eigvals(A,B) - val1 = dot(A, vr) - val2 = dot(B, vr) * w - res = val1 - val2 - for i in range(res.shape[1]): - if all(isfinite(res[:, i])): - assert_array_almost_equal(res[:, i], 0) + self._check_gen_eig(A, B) - # Disable this test, which fails now, and is not really necessary if the above - # succeeds ? - #assert_array_almost_equal(w[isfinite(w)], wt[isfinite(w)]) - def test_falker(self): """Test matrices giving some Nan generalized eigen values.""" M = diag(array(([1,0,3]))) @@ -195,17 +208,31 @@ I = identity(3) A = bmat([[I,Z],[Z,-K]]) B = bmat([[Z,I],[M,D]]) - A = asarray(A) - B = asarray(B) - w, vr = eig(A,B) - val1 = dot(A, vr) - val2 = dot(B, vr) * w - res = val1 - val2 - for i in range(res.shape[1]): - if all(isfinite(res[:, i])): - assert_array_almost_equal(res[:, i], 0) + self._check_gen_eig(A, B) + def test_bad_geneig(self): + # Ticket #709 (strange return values from DGGEV) + + def matrices(omega): + c1 = -9 + omega**2 + c2 = 2*omega + A = [[1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, c1, 0], + [0, 0, 0, c1]] + B = [[0, 0, 1, 0], + [0, 0, 0, 1], + [1, 0, 0, -c2], + [0, 1, c2, 0]] + return A, B + + # With a buggy LAPACK, this can fail for different omega on different + # machines -- so we need to test several values + for k in xrange(100): + A, B = matrices(omega=k*5./100) + self._check_gen_eig(A, B) + def test_not_square_error(self): """Check that passing a non-square array raises a ValueError.""" A = np.arange(6).reshape(3,2) From scipy-svn at scipy.org Tue Jan 11 07:48:03 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 11 Jan 2011 06:48:03 -0600 (CST) Subject: [Scipy-svn] r7024 - in branches/0.9.x/scipy/odr: . tests Message-ID: <20110111124803.F046E37BA54@scipy.org> Author: rgommers Date: 2011-01-11 06:48:03 -0600 (Tue, 11 Jan 2011) New Revision: 7024 Modified: branches/0.9.x/scipy/odr/__odrpack.c branches/0.9.x/scipy/odr/tests/test_odr.py Log: BUG: odr: use 'i' instead of 'l' in Py_BuildValue for ints (#1253) (backported from r7003) Modified: branches/0.9.x/scipy/odr/__odrpack.c =================================================================== --- branches/0.9.x/scipy/odr/__odrpack.c 2011-01-11 12:47:38 UTC (rev 7023) +++ branches/0.9.x/scipy/odr/__odrpack.c 2011-01-11 12:48:03 UTC (rev 7024) @@ -436,7 +436,7 @@ work_ind = Py_BuildValue - ("{s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l}", + ("{s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i}", "delta", delta, "eps", eps, "xplus", xplus, "fn", fn, "sd", sd, "sd", vcv, "rvar", rvar, "wss", wss, "wssde", wssde, "wssep", wssep, "rcond", rcond, "eta", eta, "olmav", olmav, "tau", tau, "alpha", @@ -499,7 +499,7 @@ retobj = Py_BuildValue - ("OOO{s:O,s:O,s:O,s:O,s:d,s:d,s:d,s:d,s:d,s:d,s:O,s:O,s:O,s:l}", + ("OOO{s:O,s:O,s:O,s:O,s:d,s:d,s:d,s:d,s:d,s:d,s:O,s:O,s:O,s:i}", PyArray_Return(beta), PyArray_Return(sd_beta), PyArray_Return(cov_beta), "delta", PyArray_Return(deltaA), "eps", PyArray_Return(epsA), "xplus", PyArray_Return(xplusA), "y", @@ -551,7 +551,7 @@ if (kwds == NULL) { - if (!PyArg_ParseTuple(args, "OOOO|OOOOOOOllz#z#ldddlOOOOOOi:odr", + if (!PyArg_ParseTuple(args, "OOOO|OOOOOOOiiz#z#idddiOOOOOOi:odr", &fcn, &initbeta, &py, &px, &pwe, &pwd, &fjacb, &fjacd, &extra_args, &pifixb, &pifixx, &job, &iprint, &errfile, &lerrfile, &rptfile, @@ -565,7 +565,7 @@ else { if (!PyArg_ParseTupleAndKeywords(args, kwds, - "OOOO|OOOOOOOllz#z#ldddlOOOOOOi:odr", + "OOOO|OOOOOOOiiz#z#idddiOOOOOOi:odr", kw_list, &fcn, &initbeta, &py, &px, &pwe, &pwd, &fjacb, &fjacd, &extra_args, &pifixb, &pifixx, &job, @@ -1326,7 +1326,7 @@ printdict = Py_BuildValue - ("{s:l,s:l,s:l,s:l,s:O,s:O,s:l,s:O,s:l,s:O,s:l,s:l,s:O,s:l,s:l,s:O,s:O,s:l,s:l,s:l,s:d,s:d,s:d,s:l,s:O,s:O,s:l,s:O,s:O,s:l,s:O,s:l,s:O,s:l,s:l}", + ("{s:i,s:i,s:i,s:i,s:O,s:O,s:i,s:O,s:i,s:O,s:i,s:i,s:O,s:i,s:i,s:O,s:O,s:i,s:i,s:i,s:d,s:d,s:d,s:i,s:O,s:O,s:i,s:O,s:O,s:i,s:O,s:i,s:O,s:i,s:i}", "n", n, "m", m, "np", np, "nq", nq, "beta", (PyObject *) beta, "y", (PyObject *) y, "ldy", ldy, "x", (PyObject *) x, "ldx", ldx, "we", (PyObject *) we, "ldwe", ldwe, "ld2we", ld2we, "wd", (PyObject *) wd, Modified: branches/0.9.x/scipy/odr/tests/test_odr.py =================================================================== --- branches/0.9.x/scipy/odr/tests/test_odr.py 2011-01-11 12:47:38 UTC (rev 7023) +++ branches/0.9.x/scipy/odr/tests/test_odr.py 2011-01-11 12:48:03 UTC (rev 7024) @@ -1,7 +1,8 @@ # Scipy imports. import numpy as np from numpy import pi -from numpy.testing import assert_array_almost_equal, TestCase, run_module_suite +from numpy.testing import assert_array_almost_equal, TestCase, \ + run_module_suite, assert_equal from scipy.odr import Data, Model, ODR, RealData, odr_stop @@ -307,6 +308,21 @@ ) + def test_ticket_1253(self): + def linear(c, x): + return c[0]*x+c[1] + + c = [2.0, 3.0] + x = np.linspace(0, 10) + y = linear(c, x) + + model = Model(linear) + data = Data(x, y, wd=1.0, we=1.0) + job = ODR(data, model, beta0=[1.0, 1.0]) + result = job.run() + assert_equal(result.info, 2) + + if __name__ == "__main__": run_module_suite() #### EOF ####################################################################### From scipy-svn at scipy.org Tue Jan 11 07:48:32 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 11 Jan 2011 06:48:32 -0600 (CST) Subject: [Scipy-svn] r7025 - branches/0.9.x/scipy/sparse/linalg/dsolve Message-ID: <20110111124832.355CE37BA54@scipy.org> Author: rgommers Date: 2011-01-11 06:48:31 -0600 (Tue, 11 Jan 2011) New Revision: 7025 Modified: branches/0.9.x/scipy/sparse/linalg/dsolve/_superlu_utils.c Log: BUG: sparse/superlu: safer pointer to int conversion in _superlu_utils (#1236) (backported from r7004) Modified: branches/0.9.x/scipy/sparse/linalg/dsolve/_superlu_utils.c =================================================================== --- branches/0.9.x/scipy/sparse/linalg/dsolve/_superlu_utils.c 2011-01-11 12:48:03 UTC (rev 7024) +++ branches/0.9.x/scipy/sparse/linalg/dsolve/_superlu_utils.c 2011-01-11 12:48:31 UTC (rev 7025) @@ -12,9 +12,9 @@ jmp_buf _superlu_py_jmpbuf; PyObject *_superlumodule_memory_dict=NULL; -/* Abort to be used inside the superlu module so that memory allocation +/* Abort to be used inside the superlu module so that memory allocation errors don't exit Python and memory allocated internal to SuperLU is freed. - Calling program should deallocate (using SUPERLU_FREE) all memory that could have + Calling program should deallocate (using SUPERLU_FREE) all memory that could have been allocated. (It's ok to FREE unallocated memory)---will be ignored. */ @@ -27,16 +27,14 @@ void *superlu_python_module_malloc(size_t size) { PyObject *key=NULL; - long keyval; - void *mem_ptr; + void *mem_ptr; if (_superlumodule_memory_dict == NULL) { _superlumodule_memory_dict = PyDict_New(); } mem_ptr = malloc(size); if (mem_ptr == NULL) return NULL; - keyval = (long) mem_ptr; - key = PyInt_FromLong(keyval); + key = PyLong_FromVoidPtr(mem_ptr); if (key == NULL) goto fail; if (PyDict_SetItem(_superlumodule_memory_dict, key, Py_None)) goto fail; Py_DECREF(key); @@ -47,31 +45,29 @@ free(mem_ptr); superlu_python_module_abort("superlu_malloc: Cannot set dictionary key value in malloc."); return NULL; - + } void superlu_python_module_free(void *ptr) { PyObject *key; - long keyval; PyObject *ptype, *pvalue, *ptraceback; if (ptr == NULL) return; PyErr_Fetch(&ptype, &pvalue, &ptraceback); - keyval = (long )ptr; - key = PyInt_FromLong(keyval); + key = PyLong_FromVoidPtr(ptr); /* This will only free the pointer if it could find it in the dictionary of already allocated pointers --- thus after abort, the module can free all - the memory that "might" have been allocated to avoid memory leaks on abort + the memory that "might" have been allocated to avoid memory leaks on abort calls. - */ + */ if (_superlumodule_memory_dict && \ !(PyDict_DelItem(_superlumodule_memory_dict, key))) { free(ptr); } Py_DECREF(key); PyErr_Restore(ptype, pvalue, ptraceback); - return; + return; } /* From scipy-svn at scipy.org Tue Jan 11 07:48:55 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 11 Jan 2011 06:48:55 -0600 (CST) Subject: [Scipy-svn] r7026 - branches/0.9.x/scipy/integrate Message-ID: <20110111124855.DC81237BA54@scipy.org> Author: rgommers Date: 2011-01-11 06:48:55 -0600 (Tue, 11 Jan 2011) New Revision: 7026 Modified: branches/0.9.x/scipy/integrate/__quadpack.h Log: BUG: integrate: correct use of npy_intp vs int in __quadpack.h (#1103) (backported from r7012) Modified: branches/0.9.x/scipy/integrate/__quadpack.h =================================================================== --- branches/0.9.x/scipy/integrate/__quadpack.h 2011-01-11 12:48:31 UTC (rev 7025) +++ branches/0.9.x/scipy/integrate/__quadpack.h 2011-01-11 12:48:55 UTC (rev 7026) @@ -1,11 +1,11 @@ /* This file should be included into the _multipackmodule file */ /* $Revision$ */ /* module_methods: - {"_qagse", quadpack_qagse, METH_VARARGS, doc_qagse}, + {"_qagse", quadpack_qagse, METH_VARARGS, doc_qagse}, {"_qagie", quadpack_qagie, METH_VARARGS, doc_qagie}, - {"_qagpe", quadpack_qagpe, METH_VARARGS, doc_qagpe}, - {"_qawoe", quadpack_qawoe, METH_VARARGS, doc_qawoe}, - {"_qawfe", quadpack_qawfe, METH_VARARGS, doc_qawfe}, + {"_qagpe", quadpack_qagpe, METH_VARARGS, doc_qagpe}, + {"_qawoe", quadpack_qawoe, METH_VARARGS, doc_qawoe}, + {"_qawfe", quadpack_qawfe, METH_VARARGS, doc_qawfe}, {"_qawse", quadpack_qawse, METH_VARARGS, doc_qawse}, {"_qawce", quadpack_qawce, METH_VARARGS, doc_qawce}, */ @@ -76,16 +76,16 @@ /* Build argument list */ if ((arg1 = PyTuple_New(1)) == NULL) goto fail; - PyTuple_SET_ITEM(arg1, 0, PyFloat_FromDouble(*x)); + PyTuple_SET_ITEM(arg1, 0, PyFloat_FromDouble(*x)); /* arg1 now owns reference to Float object*/ if ((arglist = PySequence_Concat( arg1, quadpack_extra_arguments)) == NULL) goto fail; - + /* Call function object --- stored as a global variable. Extra arguments are in another global variable. */ if ((result = PyEval_CallObject(quadpack_python_function, arglist))==NULL) goto fail; - /* Have to do own error checking because PyFloat_AsDouble returns -1 on + /* Have to do own error checking because PyFloat_AsDouble returns -1 on error -- making that return value from the function unusable. No; Solution is to test for Python Error Occurrence if -1 is return of PyFloat_AsDouble. @@ -119,7 +119,8 @@ PyObject *extra_args = NULL; PyObject *fcn; - npy_intp limit=50; + int limit=50; + npy_intp limit_shape[1]; int full_output = 0; double a, b, epsabs=1.49e-8, epsrel=1.49e-8; int neval=0, ier=6, last=0, *iord; @@ -129,19 +130,20 @@ STORE_VARS(); if (!PyArg_ParseTuple(args, "Odd|Oiddi", &fcn, &a, &b, &extra_args, &full_output, &epsabs, &epsrel, &limit)) return NULL; + limit_shape[0] = limit; /* Need to check that limit is bigger than 1 */ - if (limit < 1) + if (limit < 1) return Py_BuildValue("ddi",result,abserr,ier); QUAD_INIT_FUNC(fcn,extra_args) /* Setup iwork and work arrays */ - ap_iord = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_INT); - ap_alist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); - ap_blist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); - ap_rlist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); - ap_elist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); + ap_iord = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_INT); + ap_alist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); + ap_blist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); + ap_rlist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); + ap_elist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); if (ap_iord == NULL || ap_alist == NULL || ap_blist == NULL || ap_rlist == NULL || ap_elist == NULL) goto fail; iord = (int *)ap_iord->data; alist = (double *)ap_alist->data; @@ -167,7 +169,7 @@ if (full_output) { return Py_BuildValue("dd{s:i,s:i,s:N,s:N,s:N,s:N,s:N}i", result, abserr, "neval", neval, "last", last, "iord", PyArray_Return(ap_iord), "alist", PyArray_Return(ap_alist), "blist", PyArray_Return(ap_blist), "rlist", PyArray_Return(ap_rlist), "elist", PyArray_Return(ap_elist),ier); } - else { + else { Py_DECREF(ap_alist); Py_DECREF(ap_blist); Py_DECREF(ap_rlist); @@ -198,16 +200,18 @@ PyObject *extra_args = NULL; PyObject *fcn; - npy_intp limit=50; + int limit=50; + npy_intp limit_shape[1]; int full_output = 0; double bound, epsabs=1.49e-8, epsrel=1.49e-8; int inf, neval=0, ier=6, last=0, *iord; double result=0.0, abserr=0.0; double *alist, *blist, *rlist, *elist; - + STORE_VARS(); - + if (!PyArg_ParseTuple(args, "Odi|Oiddi", &fcn, &bound, &inf, &extra_args, &full_output, &epsabs, &epsrel, &limit)) return NULL; + limit_shape[0] = limit; /* Need to check that limit is bigger than 1 */ if (limit < 1) @@ -216,11 +220,11 @@ QUAD_INIT_FUNC(fcn,extra_args); /* Setup iwork and work arrays */ - ap_iord = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_INT); - ap_alist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); - ap_blist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); - ap_rlist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); - ap_elist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); + ap_iord = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_INT); + ap_alist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); + ap_blist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); + ap_rlist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); + ap_elist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); if (ap_iord == NULL || ap_alist == NULL || ap_blist == NULL || ap_rlist == NULL || ap_elist == NULL) goto fail; iord = (int *)ap_iord->data; alist = (double *)ap_alist->data; @@ -247,7 +251,7 @@ if (full_output) { return Py_BuildValue("dd{s:i,s:i,s:N,s:N,s:N,s:N,s:N}i", result, abserr, "neval", neval, "last", last, "iord", PyArray_Return(ap_iord), "alist", PyArray_Return(ap_alist), "blist", PyArray_Return(ap_blist), "rlist", PyArray_Return(ap_rlist), "elist", PyArray_Return(ap_elist),ier); } - else { + else { Py_DECREF(ap_alist); Py_DECREF(ap_blist); Py_DECREF(ap_rlist); @@ -281,7 +285,8 @@ PyObject *extra_args = NULL; PyObject *fcn, *o_points; - npy_intp limit=50, npts2; + int limit=50, npts2; + npy_intp limit_shape[1], npts2_shape[1]; int full_output = 0; double a, b, epsabs=1.49e-8, epsrel=1.49e-8; int neval=0, ier=6, last=0, *iord; @@ -293,6 +298,7 @@ STORE_VARS(); if (!PyArg_ParseTuple(args, "OddO|Oiddi", &fcn, &a, &b, &o_points, &extra_args, &full_output, &epsabs, &epsrel, &limit)) return NULL; + limit_shape[0] = limit; /* Need to check that limit is bigger than 1 */ if (limit < 1) @@ -303,17 +309,18 @@ ap_points = (PyArrayObject *)PyArray_ContiguousFromObject(o_points, PyArray_DOUBLE, 1, 1); if (ap_points == NULL) goto fail; npts2 = ap_points->dimensions[0]; + npts2_shape[0] = npts2; points = (double *)ap_points->data; /* Setup iwork and work arrays */ - ap_iord = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_INT); - ap_alist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); - ap_blist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); - ap_rlist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); - ap_elist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); - ap_pts = (PyArrayObject *)PyArray_SimpleNew(1,&npts2,PyArray_DOUBLE); - ap_level = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); - ap_ndin = (PyArrayObject *)PyArray_SimpleNew(1,&npts2,PyArray_DOUBLE); + ap_iord = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_INT); + ap_alist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); + ap_blist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); + ap_rlist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); + ap_elist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); + ap_pts = (PyArrayObject *)PyArray_SimpleNew(1,npts2_shape,PyArray_DOUBLE); + ap_level = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); + ap_ndin = (PyArrayObject *)PyArray_SimpleNew(1,npts2_shape,PyArray_DOUBLE); if (ap_iord == NULL || ap_alist == NULL || ap_blist == NULL || ap_rlist == NULL || ap_elist == NULL || ap_pts == NULL || ap_level == NULL || ap_ndin == NULL) goto fail; iord = (int *)ap_iord->data; alist = (double *)ap_alist->data; @@ -327,7 +334,7 @@ if (setjmp(quadpack_jmpbuf)) { goto fail; } - else { + else { DQAGPE(quad_function, &a, &b, &npts2, points, &epsabs, &epsrel, &limit, &result, &abserr, &neval, &ier, alist, blist, rlist, elist, pts, iord, level, ndin, &last); } @@ -343,7 +350,7 @@ if (full_output) { return Py_BuildValue("dd{s:i,s:i,s:N,s:N,s:N,s:N,s:N,s:N,s:N,s:N}i", result, abserr, "neval", neval, "last", last, "iord", PyArray_Return(ap_iord), "alist", PyArray_Return(ap_alist), "blist", PyArray_Return(ap_blist), "rlist", PyArray_Return(ap_rlist), "elist", PyArray_Return(ap_elist), "pts", PyArray_Return(ap_pts), "level", PyArray_Return(ap_level), "ndin", PyArray_Return(ap_ndin),ier); } - else { + else { Py_DECREF(ap_alist); Py_DECREF(ap_blist); Py_DECREF(ap_rlist); @@ -383,7 +390,8 @@ PyObject *extra_args = NULL, *o_chebmo = NULL; PyObject *fcn; - npy_intp limit=50, sz[2]; + int limit=50; + npy_intp limit_shape[1], sz[2]; int full_output = 0, maxp1=50, icall=1; double a, b, epsabs=1.49e-8, epsrel=1.49e-8; int neval=0, ier=6, integr=1, last=0, momcom=0, *iord; @@ -391,10 +399,11 @@ double result=0.0, abserr=0.0, omega=0.0; double *chebmo; double *alist, *blist, *rlist, *elist; - + STORE_VARS(); if (!PyArg_ParseTuple(args, "Odddi|OiddiiiiO", &fcn, &a, &b, &omega, &integr, &extra_args, &full_output, &epsabs, &epsrel, &limit, &maxp1, &icall, &momcom, &o_chebmo)) return NULL; + limit_shape[0] = limit; /* Need to check that limit is bigger than 1 */ if (limit < 1) @@ -417,12 +426,12 @@ chebmo = (double *) ap_chebmo->data; /* Setup iwork and work arrays */ - ap_iord = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_INT); - ap_nnlog = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_INT); - ap_alist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); - ap_blist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); - ap_rlist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); - ap_elist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); + ap_iord = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_INT); + ap_nnlog = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_INT); + ap_alist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); + ap_blist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); + ap_rlist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); + ap_elist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); if (ap_iord == NULL || ap_nnlog == NULL || ap_alist == NULL || ap_blist == NULL || ap_rlist == NULL || ap_elist == NULL) goto fail; iord = (int *)ap_iord->data; nnlog = (int *)ap_nnlog->data; @@ -449,7 +458,7 @@ if (full_output) { return Py_BuildValue("dd{s:i,s:i,s:N,s:N,s:N,s:N,s:N,s:N,s:i,s:N}i", result, abserr, "neval", neval, "last", last, "iord", PyArray_Return(ap_iord), "alist", PyArray_Return(ap_alist), "blist", PyArray_Return(ap_blist), "rlist", PyArray_Return(ap_rlist), "elist", PyArray_Return(ap_elist), "nnlog", PyArray_Return(ap_nnlog), "momcom", momcom, "chebmo", PyArray_Return(ap_chebmo),ier); } - else { + else { Py_DECREF(ap_alist); Py_DECREF(ap_blist); Py_DECREF(ap_rlist); @@ -487,7 +496,8 @@ PyObject *extra_args = NULL; PyObject *fcn; - npy_intp limlst = 50, limit=50, sz[2]; + int limlst = 50, limit=50; + npy_intp limlst_shape[1], limit_shape[1], sz[2]; int full_output = 0, maxp1=50; double a, epsabs=1.49e-8; int neval=0, ier=6, integr=1, *iord; @@ -499,6 +509,8 @@ STORE_VARS(); if (!PyArg_ParseTuple(args, "Oddi|Oidiii", &fcn, &a, &omega, &integr, &extra_args, &full_output, &epsabs, &limlst, &limit, &maxp1)) return NULL; + limit_shape[0] = limit; + limlst_shape[0] = limlst; /* Need to check that limit is bigger than 1 */ if (limit < 1) @@ -513,15 +525,15 @@ chebmo = (double *) ap_chebmo->data; /* Setup iwork and work arrays */ - ap_iord = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_INT); - ap_nnlog = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_INT); - ap_alist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); - ap_blist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); - ap_rlist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); - ap_elist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); - ap_rslst = (PyArrayObject *)PyArray_SimpleNew(1,&limlst,PyArray_DOUBLE); - ap_erlst = (PyArrayObject *)PyArray_SimpleNew(1,&limlst,PyArray_DOUBLE); - ap_ierlst = (PyArrayObject *)PyArray_SimpleNew(1,&limlst,PyArray_INT); + ap_iord = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_INT); + ap_nnlog = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_INT); + ap_alist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); + ap_blist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); + ap_rlist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); + ap_elist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); + ap_rslst = (PyArrayObject *)PyArray_SimpleNew(1,limlst_shape,PyArray_DOUBLE); + ap_erlst = (PyArrayObject *)PyArray_SimpleNew(1,limlst_shape,PyArray_DOUBLE); + ap_ierlst = (PyArrayObject *)PyArray_SimpleNew(1,limlst_shape,PyArray_INT); if (ap_iord == NULL || ap_nnlog == NULL || ap_alist == NULL || ap_blist == NULL || ap_rlist == NULL || ap_elist == NULL || ap_rslst == NULL || ap_erlst == NULL || ap_ierlst == NULL) goto fail; iord = (int *)ap_iord->data; nnlog = (int *)ap_nnlog->data; @@ -558,7 +570,7 @@ if (full_output) { return Py_BuildValue("dd{s:i,s:i,s:N,s:N,s:N}i", result, abserr, "neval", neval, "lst", lst, "rslst", PyArray_Return(ap_rslst), "erlst", PyArray_Return(ap_erlst), "ierlst", PyArray_Return(ap_ierlst), ier); } - else { + else { Py_DECREF(ap_rslst); Py_DECREF(ap_erlst); Py_DECREF(ap_ierlst); @@ -593,7 +605,8 @@ PyObject *extra_args = NULL; PyObject *fcn; - npy_intp limit=50; + int limit; + npy_intp limit_shape[1]; int full_output = 0; double a, b, c, epsabs=1.49e-8, epsrel=1.49e-8; int neval=0, ier=6, last=0, *iord; @@ -601,8 +614,9 @@ double *alist, *blist, *rlist, *elist; STORE_VARS(); - + if (!PyArg_ParseTuple(args, "Oddd|Oiddi", &fcn, &a, &b, &c, &extra_args, &full_output, &epsabs, &epsrel, &limit)) return NULL; + limit_shape[0] = limit; /* Need to check that limit is bigger than 1 */ if (limit < 1) @@ -611,11 +625,11 @@ QUAD_INIT_FUNC(fcn,extra_args) /* Setup iwork and work arrays */ - ap_iord = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_INT); - ap_alist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); - ap_blist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); - ap_rlist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); - ap_elist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); + ap_iord = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_INT); + ap_alist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); + ap_blist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); + ap_rlist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); + ap_elist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); if (ap_iord == NULL || ap_alist == NULL || ap_blist == NULL || ap_rlist == NULL || ap_elist == NULL) goto fail; iord = (int *)ap_iord->data; alist = (double *)ap_alist->data; @@ -641,7 +655,7 @@ if (full_output) { return Py_BuildValue("dd{s:i,s:i,s:N,s:N,s:N,s:N,s:N}i", result, abserr, "neval", neval, "last", last, "iord", PyArray_Return(ap_iord), "alist", PyArray_Return(ap_alist), "blist", PyArray_Return(ap_blist), "rlist", PyArray_Return(ap_rlist), "elist", PyArray_Return(ap_elist),ier); } - else { + else { Py_DECREF(ap_alist); Py_DECREF(ap_blist); Py_DECREF(ap_rlist); @@ -674,7 +688,8 @@ PyObject *fcn; int full_output = 0, integr; - npy_intp limit=50; + int limit=50; + npy_intp limit_shape[1]; double a, b, epsabs=1.49e-8, epsrel=1.49e-8; double alfa, beta; int neval=0, ier=6, last=0, *iord; @@ -682,8 +697,9 @@ double *alist, *blist, *rlist, *elist; STORE_VARS(); - + if (!PyArg_ParseTuple(args, "Odd(dd)i|Oiddi", &fcn, &a, &b, &alfa, &beta, &integr, &extra_args, &full_output, &epsabs, &epsrel, &limit)) return NULL; + limit_shape[0] = limit; /* Need to check that limit is bigger than 1 */ if (limit < 1) @@ -692,11 +708,11 @@ QUAD_INIT_FUNC(fcn,extra_args) /* Setup iwork and work arrays */ - ap_iord = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_INT); - ap_alist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); - ap_blist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); - ap_rlist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); - ap_elist = (PyArrayObject *)PyArray_SimpleNew(1,&limit,PyArray_DOUBLE); + ap_iord = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_INT); + ap_alist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); + ap_blist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); + ap_rlist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); + ap_elist = (PyArrayObject *)PyArray_SimpleNew(1,limit_shape,PyArray_DOUBLE); if (ap_iord == NULL || ap_alist == NULL || ap_blist == NULL || ap_rlist == NULL || ap_elist == NULL) goto fail; iord = (int *)ap_iord->data; alist = (double *)ap_alist->data; @@ -722,7 +738,7 @@ if (full_output) { return Py_BuildValue("dd{s:i,s:i,s:N,s:N,s:N,s:N,s:N}i", result, abserr, "neval", neval, "last", last, "iord", PyArray_Return(ap_iord), "alist", PyArray_Return(ap_alist), "blist", PyArray_Return(ap_blist), "rlist", PyArray_Return(ap_rlist), "elist", PyArray_Return(ap_elist),ier); } - else { + else { Py_DECREF(ap_alist); Py_DECREF(ap_blist); Py_DECREF(ap_rlist); From scipy-svn at scipy.org Tue Jan 11 07:49:17 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 11 Jan 2011 06:49:17 -0600 (CST) Subject: [Scipy-svn] r7027 - in branches/0.9.x/scipy/spatial: . qhull/src Message-ID: <20110111124917.A0FBB37BA54@scipy.org> Author: rgommers Date: 2011-01-11 06:49:17 -0600 (Tue, 11 Jan 2011) New Revision: 7027 Modified: branches/0.9.x/scipy/spatial/SConscript branches/0.9.x/scipy/spatial/qhull/src/mem.h branches/0.9.x/scipy/spatial/setup.py Log: BUG: spatial/qhull: define ptr_intT correctly in Qhull (backported from r7013) Modified: branches/0.9.x/scipy/spatial/SConscript =================================================================== --- branches/0.9.x/scipy/spatial/SConscript 2011-01-11 12:48:55 UTC (rev 7026) +++ branches/0.9.x/scipy/spatial/SConscript 2011-01-11 12:49:17 UTC (rev 7027) @@ -1,10 +1,14 @@ # Last Change: Mon Nov 03 06:00 PM 2008 J # vim:syntax=python from os.path import join +from numpy.distutils.misc_util import get_numpy_include_dirs, get_pkg_info +from distutils.sysconfig import get_python_inc from numscons import GetNumpyEnvironment, CheckF77LAPACK, CheckF77Clib from numscons import write_info env = GetNumpyEnvironment(ARGUMENTS) +env.PrependUnique(CPPPATH=[get_numpy_include_dirs(), get_python_inc(), + env["PYEXTCPPPATH"]]) #======================= # Starting Configuration @@ -30,14 +34,14 @@ env.NumpyPythonExtension('ckdtree', source = ['ckdtree.c']) -env.NumpyPythonExtension('_distance_wrap', +env.NumpyPythonExtension('_distance_wrap', source = [join('src', 'distance_wrap.c'), join('src', 'distance.c')]) # Build qhull src = [join('qhull', 'src', s) for s in [ - 'geom2.c', 'geom.c', 'global.c', 'io.c', 'libqhull.c', - 'mem.c', 'merge.c', 'poly2.c', 'poly.c', 'qset.c', + 'geom2.c', 'geom.c', 'global.c', 'io.c', 'libqhull.c', + 'mem.c', 'merge.c', 'poly2.c', 'poly.c', 'qset.c', 'random.c', 'rboxlib.c', 'stat.c', 'user.c', 'usermem.c', 'userprintf.c']] Modified: branches/0.9.x/scipy/spatial/qhull/src/mem.h =================================================================== --- branches/0.9.x/scipy/spatial/qhull/src/mem.h 2011-01-11 12:48:55 UTC (rev 7026) +++ branches/0.9.x/scipy/spatial/qhull/src/mem.h 2011-01-11 12:49:17 UTC (rev 7027) @@ -19,6 +19,9 @@ #ifndef qhDEFmem #define qhDEFmem 1 +#include +#include + #include /*---------------------------------- Modified: branches/0.9.x/scipy/spatial/setup.py =================================================================== --- branches/0.9.x/scipy/spatial/setup.py 2011-01-11 12:48:55 UTC (rev 7026) +++ branches/0.9.x/scipy/spatial/setup.py 2011-01-11 12:49:17 UTC (rev 7027) @@ -5,18 +5,21 @@ def configuration(parent_package = '', top_path = None): from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs from numpy.distutils.system_info import get_info + from distutils.sysconfig import get_python_inc config = Configuration('spatial', parent_package, top_path) config.add_data_dir('tests') - qhull_src = ['geom2.c', 'geom.c', 'global.c', 'io.c', 'libqhull.c', - 'mem.c', 'merge.c', 'poly2.c', 'poly.c', 'qset.c', + qhull_src = ['geom2.c', 'geom.c', 'global.c', 'io.c', 'libqhull.c', + 'mem.c', 'merge.c', 'poly2.c', 'poly.c', 'qset.c', 'random.c', 'rboxlib.c', 'stat.c', 'user.c', 'usermem.c', 'userprintf.c'] config.add_library('qhull', sources=[join('qhull', 'src', x) for x in qhull_src], + include_dirs=[get_python_inc(), + get_numpy_include_dirs()], # XXX: GCC dependency! #extra_compiler_args=['-fno-strict-aliasing'], ) From scipy-svn at scipy.org Fri Jan 14 14:21:01 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 14 Jan 2011 13:21:01 -0600 (CST) Subject: [Scipy-svn] r7028 - in trunk/scipy/stats: . tests Message-ID: <20110114192101.56C7937BCA2@scipy.org> Author: josef Date: 2011-01-14 13:21:00 -0600 (Fri, 14 Jan 2011) New Revision: 7028 Modified: trunk/scipy/stats/distributions.py trunk/scipy/stats/tests/test_distributions.py Log: stats.distributions expect: fix bound handling and add tests, continuous distribution only Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2011-01-11 12:49:17 UTC (rev 7027) +++ trunk/scipy/stats/distributions.py 2011-01-14 19:21:00 UTC (rev 7028) @@ -1824,11 +1824,12 @@ def fun(x, *args): return func(x)*self.pdf(x, *args, **{'loc':loc, 'scale':scale}) if lb is None: - lb = (self.a - loc)/(1.0*scale) + lb = loc + self.a * scale if ub is None: - ub = (self.b - loc)/(1.0*scale) + ub = loc + self.b * scale if conditional: - invfac = self.sf(lb,*args) - self.sf(ub,*args) + invfac = (self.sf(lb, *args, **{'loc':loc, 'scale':scale}) + - self.sf(ub, *args, **{'loc':loc, 'scale':scale})) else: invfac = 1.0 kwds['args'] = args Modified: trunk/scipy/stats/tests/test_distributions.py =================================================================== --- trunk/scipy/stats/tests/test_distributions.py 2011-01-11 12:49:17 UTC (rev 7027) +++ trunk/scipy/stats/tests/test_distributions.py 2011-01-14 19:21:00 UTC (rev 7028) @@ -559,7 +559,51 @@ # the focus of this test. assert_equal(m1, m2) +class TestExpect(TestCase): + """Test for expect method, continuous distributions only. + Uses normal distribution and beta distribution for finite bounds. + """ + def test_norm(self): + v = stats.norm.expect(lambda x: (x-5)*(x-5), loc=5, scale=2) + assert_almost_equal(v, 4, decimal=14) + + m = stats.norm.expect(lambda x: (x), loc=5, scale=2) + assert_almost_equal(m, 5, decimal=14) + + lb = stats.norm.ppf(0.05, loc=5, scale=2) + ub = stats.norm.ppf(0.95, loc=5, scale=2) + prob90 = stats.norm.expect(lambda x: 1, loc=5, scale=2, lb=lb, ub=ub) + assert_almost_equal(prob90, 0.9, decimal=14) + + prob90c = stats.norm.expect(lambda x: 1, loc=5, scale=2, lb=lb, ub=ub, + conditional=True) + assert_almost_equal(prob90c, 1., decimal=14) + + def test_beta(self): + #case with finite support interval +## >>> mtrue, vtrue = stats.beta.stats(10,5, loc=5., scale=2.) +## >>> mtrue, vtrue +## (array(6.333333333333333), array(0.055555555555555552)) + v = stats.beta.expect(lambda x: (x-19/3.)*(x-19/3.), args=(10,5), + loc=5, scale=2) + assert_almost_equal(v, 1./18., decimal=14) + + m = stats.beta.expect(lambda x: x, args=(10,5), loc=5., scale=2.) + assert_almost_equal(m, 19/3., decimal=14) + + ub = stats.beta.ppf(0.95, 10, 10, loc=5, scale=2) + lb = stats.beta.ppf(0.05, 10, 10, loc=5, scale=2) + prob90 = stats.beta.expect(lambda x: 1., args=(10,10), loc=5., + scale=2.,lb=lb, ub=ub, conditional=False) + assert_almost_equal(prob90, 0.9, decimal=14) + + prob90c = stats.beta.expect(lambda x: 1, args=(10,10), loc=5, + scale=2, lb=lb, ub=ub, conditional=True) + assert_almost_equal(prob90c, 1., decimal=14) + + + def test_regression_ticket_1316(): """Regression test for ticket #1316.""" # The following was raising an exception, because _construct_default_doc() From scipy-svn at scipy.org Fri Jan 14 15:55:29 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 14 Jan 2011 14:55:29 -0600 (CST) Subject: [Scipy-svn] r7029 - in trunk/scipy/stats: . tests Message-ID: <20110114205529.475B132152@scipy.org> Author: josef Date: 2011-01-14 14:55:28 -0600 (Fri, 14 Jan 2011) New Revision: 7029 Modified: trunk/scipy/stats/distributions.py trunk/scipy/stats/tests/test_distributions.py Log: stats.distributions expect: fix bound handling and add tests for discrete distributions Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2011-01-14 19:21:00 UTC (rev 7028) +++ trunk/scipy/stats/distributions.py 2011-01-14 20:55:28 UTC (rev 7029) @@ -5582,10 +5582,18 @@ self._argcheck(*args) # (re)generate scalar self.a and self.b if lb is None: lb = (self.a) + else: + lb = lb - loc #convert bound for standardized distribution if ub is None: ub = (self.b) + else: + ub = ub - loc #convert bound for standardized distribution if conditional: - invfac = self.sf(lb,*args) - self.sf(ub+1,*args) + if np.isposinf(ub)[()]: + #work around bug: stats.poisson.sf(stats.poisson.b, 2) is nan + invfac = 1 - self.cdf(lb-1,*args) + else: + invfac = 1 - self.cdf(lb-1,*args) - self.sf(ub,*args) else: invfac = 1.0 Modified: trunk/scipy/stats/tests/test_distributions.py =================================================================== --- trunk/scipy/stats/tests/test_distributions.py 2011-01-14 19:21:00 UTC (rev 7028) +++ trunk/scipy/stats/tests/test_distributions.py 2011-01-14 20:55:28 UTC (rev 7029) @@ -560,9 +560,11 @@ assert_equal(m1, m2) class TestExpect(TestCase): - """Test for expect method, continuous distributions only. + """Test for expect method. - Uses normal distribution and beta distribution for finite bounds. + Uses normal distribution and beta distribution for finite bounds, and + hypergeom for discrete distribution with finite support + """ def test_norm(self): v = stats.norm.expect(lambda x: (x-5)*(x-5), loc=5, scale=2) @@ -603,7 +605,55 @@ assert_almost_equal(prob90c, 1., decimal=14) + def test_hypergeom(self): + #test case with finite bounds + #without specifying bounds + m_true, v_true = stats.hypergeom.stats(20, 10, 8, loc=5.) + m = stats.hypergeom.expect(lambda x: x, args=(20, 10, 8), loc=5.) + assert_almost_equal(m, m_true, decimal=14) + + v = stats.hypergeom.expect(lambda x: (x-9.)**2, args=(20, 10, 8), + loc=5.) + assert_almost_equal(v, v_true, decimal=14) + + #with bounds, bounds equal to shifted support + v_bounds = stats.hypergeom.expect(lambda x: (x-9.)**2, args=(20, 10, 8), + loc=5., lb=5, ub=13) + assert_almost_equal(v_bounds, v_true, decimal=14) + + #drop boundary points + prob_true = 1-stats.hypergeom.pmf([5, 13], 20, 10, 8, loc=5).sum() + prob_bounds = stats.hypergeom.expect(lambda x: 1, args=(20, 10, 8), + loc=5., lb=6, ub=12) + assert_almost_equal(prob_bounds, prob_true, decimal=14) + + #conditional + prob_bc = stats.hypergeom.expect(lambda x: 1, args=(20, 10, 8), loc=5., + lb=6, ub=12, conditional=True) + assert_almost_equal(prob_bc, 1, decimal=14) + + #check simple integral + prob_b = stats.hypergeom.expect(lambda x: 1, args=(20, 10, 8), + lb=0, ub=8) + assert_almost_equal(prob_b, 1, decimal=14) + + def test_poisson(self): + #poisson, use lower bound only + prob_bounds = stats.poisson.expect(lambda x: 1, args=(2,), lb=3, + conditional=False) + prob_b_true = 1-stats.poisson.cdf(2,2) + assert_almost_equal(prob_bounds, prob_b_true, decimal=14) + + + prob_lb = stats.poisson.expect(lambda x: 1, args=(2,), lb=2, + conditional=True) + assert_almost_equal(prob_lb, 1, decimal=14) + + + + + def test_regression_ticket_1316(): """Regression test for ticket #1316.""" # The following was raising an exception, because _construct_default_doc() From scipy-svn at scipy.org Fri Jan 14 16:03:11 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 14 Jan 2011 15:03:11 -0600 (CST) Subject: [Scipy-svn] r7030 - trunk/scipy/stats Message-ID: <20110114210311.B219632152@scipy.org> Author: josef Date: 2011-01-14 15:03:11 -0600 (Fri, 14 Jan 2011) New Revision: 7030 Modified: trunk/scipy/stats/distributions.py Log: distributions beta_gen, don't use math, exception in ticket:1276 Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2011-01-14 20:55:28 UTC (rev 7029) +++ trunk/scipy/stats/distributions.py 2011-01-14 21:03:11 UTC (rev 7030) @@ -2017,7 +2017,7 @@ g2 = _kurtosis(data) def func(x): a, b = x - sk = 2*(b-a)*math.sqrt(a + b + 1) / (a + b + 2) / math.sqrt(a*b) + sk = 2*(b-a)*sqrt(a + b + 1) / (a + b + 2) / sqrt(a*b) ku = a**3 - a**2*(2*b-1) + b**2*(b+1) - 2*a*b*(b+2) ku /= a*b*(a+b+2)*(a+b+3) ku *= 6 From scipy-svn at scipy.org Fri Jan 14 17:03:17 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 14 Jan 2011 16:03:17 -0600 (CST) Subject: [Scipy-svn] r7031 - trunk/scipy/stats Message-ID: <20110114220317.30F6932157@scipy.org> Author: josef Date: 2011-01-14 16:03:16 -0600 (Fri, 14 Jan 2011) New Revision: 7031 Modified: trunk/scipy/stats/distributions.py Log: stats.distributions, handle case with no goodargs everywhere, ticket:1291 Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2011-01-14 21:03:11 UTC (rev 7030) +++ trunk/scipy/stats/distributions.py 2011-01-14 22:03:16 UTC (rev 7031) @@ -1107,9 +1107,10 @@ cond = cond0 & cond1 output = zeros(shape(cond),'d') putmask(output,(1-cond0)*array(cond1,bool),self.badvalue) - goodargs = argsreduce(cond, *((x,)+args+(scale,))) - scale, goodargs = goodargs[-1], goodargs[:-1] - place(output,cond,self._pdf(*goodargs) / scale) + if any(cond): + goodargs = argsreduce(cond, *((x,)+args+(scale,))) + scale, goodargs = goodargs[-1], goodargs[:-1] + place(output,cond,self._pdf(*goodargs) / scale) if output.ndim == 0: return output[()] return output @@ -1149,9 +1150,10 @@ output = empty(shape(cond),'d') output.fill(NINF) putmask(output,(1-cond0)*array(cond1,bool),self.badvalue) - goodargs = argsreduce(cond, *((x,)+args+(scale,))) - scale, goodargs = goodargs[-1], goodargs[:-1] - place(output,cond,self._logpdf(*goodargs) - log(scale)) + if any(cond): + goodargs = argsreduce(cond, *((x,)+args+(scale,))) + scale, goodargs = goodargs[-1], goodargs[:-1] + place(output,cond,self._logpdf(*goodargs) - log(scale)) if output.ndim == 0: return output[()] return output @@ -1274,8 +1276,9 @@ output = zeros(shape(cond),'d') place(output,(1-cond0)*(cond1==cond1),self.badvalue) place(output,cond2,1.0) - goodargs = argsreduce(cond, *((x,)+args)) - place(output,cond,self._sf(*goodargs)) + if any(cond): + goodargs = argsreduce(cond, *((x,)+args)) + place(output,cond,self._sf(*goodargs)) if output.ndim == 0: return output[()] return output @@ -1314,8 +1317,9 @@ output.fill(NINF) place(output,(1-cond0)*(cond1==cond1),self.badvalue) place(output,cond2,0.0) - goodargs = argsreduce(cond, *((x,)+args)) - place(output,cond,self._logsf(*goodargs)) + if any(cond): + goodargs = argsreduce(cond, *((x,)+args)) + place(output,cond,self._logsf(*goodargs)) if output.ndim == 0: return output[()] return output @@ -5029,8 +5033,9 @@ cond = cond0 & cond1 output = zeros(shape(cond),'d') place(output,(1-cond0)*(cond1==cond1),self.badvalue) - goodargs = argsreduce(cond, *((k,)+args)) - place(output,cond,self._pmf(*goodargs)) + if any(cond): + goodargs = argsreduce(cond, *((k,)+args)) + place(output,cond,self._pmf(*goodargs)) if output.ndim == 0: return output[()] return output @@ -5067,8 +5072,9 @@ output = empty(shape(cond),'d') output.fill(NINF) place(output,(1-cond0)*(cond1==cond1),self.badvalue) - goodargs = argsreduce(cond, *((k,)+args)) - place(output,cond,self._logpmf(*goodargs)) + if any(cond): + goodargs = argsreduce(cond, *((k,)+args)) + place(output,cond,self._logpmf(*goodargs)) if output.ndim == 0: return output[()] return output @@ -5186,8 +5192,9 @@ output = zeros(shape(cond),'d') place(output,(1-cond0)*(cond1==cond1),self.badvalue) place(output,cond2,1.0) - goodargs = argsreduce(cond, *((k,)+args)) - place(output,cond,self._sf(*goodargs)) + if any(cond): + goodargs = argsreduce(cond, *((k,)+args)) + place(output,cond,self._sf(*goodargs)) if output.ndim == 0: return output[()] return output @@ -5225,8 +5232,9 @@ output.fill(NINF) place(output,(1-cond0)*(cond1==cond1),self.badvalue) place(output,cond2,0.0) - goodargs = argsreduce(cond, *((k,)+args)) - place(output,cond,self._logsf(*goodargs)) + if any(cond): + goodargs = argsreduce(cond, *((k,)+args)) + place(output,cond,self._logsf(*goodargs)) if output.ndim == 0: return output[()] return output From scipy-svn at scipy.org Fri Jan 14 20:23:56 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 14 Jan 2011 19:23:56 -0600 (CST) Subject: [Scipy-svn] r7032 - trunk/scipy/stats Message-ID: <20110115012356.A7B1F1B8C3B@scipy.org> Author: josef Date: 2011-01-14 19:23:55 -0600 (Fri, 14 Jan 2011) New Revision: 7032 Modified: trunk/scipy/stats/distributions.py Log: stats.distributions, correction so that stats and moment method don't break with empty goodargs, see ticket:934 and ticket:1291 Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2011-01-14 22:03:16 UTC (rev 7031) +++ trunk/scipy/stats/distributions.py 2011-01-15 01:23:55 UTC (rev 7032) @@ -1470,59 +1470,65 @@ output = [] # Use only entries that are valid in calculation - goodargs = argsreduce(cond, *(args+(scale,loc))) - scale, loc, goodargs = goodargs[-2], goodargs[-1], goodargs[:-2] - if 'm' in moments: - if mu is None: - mu = self._munp(1.0,*goodargs) - out0 = default.copy() - place(out0,cond,mu*scale+loc) - output.append(out0) - - if 'v' in moments: - if mu2 is None: - mu2p = self._munp(2.0,*goodargs) + if any(cond): + goodargs = argsreduce(cond, *(args+(scale,loc))) + scale, loc, goodargs = goodargs[-2], goodargs[-1], goodargs[:-2] + if 'm' in moments: if mu is None: mu = self._munp(1.0,*goodargs) - mu2 = mu2p - mu*mu - if np.isinf(mu): - #if mean is inf then var is also inf - mu2 = np.inf - out0 = default.copy() - place(out0,cond,mu2*scale*scale) - output.append(out0) + out0 = default.copy() + place(out0,cond,mu*scale+loc) + output.append(out0) - if 's' in moments: - if g1 is None: - mu3p = self._munp(3.0,*goodargs) - if mu is None: - mu = self._munp(1.0,*goodargs) + if 'v' in moments: if mu2 is None: mu2p = self._munp(2.0,*goodargs) + if mu is None: + mu = self._munp(1.0,*goodargs) mu2 = mu2p - mu*mu - mu3 = mu3p - 3*mu*mu2 - mu**3 - g1 = mu3 / mu2**1.5 - out0 = default.copy() - place(out0,cond,g1) - output.append(out0) + if np.isinf(mu): + #if mean is inf then var is also inf + mu2 = np.inf + out0 = default.copy() + place(out0,cond,mu2*scale*scale) + output.append(out0) - if 'k' in moments: - if g2 is None: - mu4p = self._munp(4.0,*goodargs) - if mu is None: - mu = self._munp(1.0,*goodargs) - if mu2 is None: - mu2p = self._munp(2.0,*goodargs) - mu2 = mu2p - mu*mu - if mu3 is None: + if 's' in moments: + if g1 is None: mu3p = self._munp(3.0,*goodargs) + if mu is None: + mu = self._munp(1.0,*goodargs) + if mu2 is None: + mu2p = self._munp(2.0,*goodargs) + mu2 = mu2p - mu*mu mu3 = mu3p - 3*mu*mu2 - mu**3 - mu4 = mu4p - 4*mu*mu3 - 6*mu*mu*mu2 - mu**4 - g2 = mu4 / mu2**2.0 - 3.0 - out0 = default.copy() - place(out0,cond,g2) - output.append(out0) + g1 = mu3 / mu2**1.5 + out0 = default.copy() + place(out0,cond,g1) + output.append(out0) + if 'k' in moments: + if g2 is None: + mu4p = self._munp(4.0,*goodargs) + if mu is None: + mu = self._munp(1.0,*goodargs) + if mu2 is None: + mu2p = self._munp(2.0,*goodargs) + mu2 = mu2p - mu*mu + if mu3 is None: + mu3p = self._munp(3.0,*goodargs) + mu3 = mu3p - 3*mu*mu2 - mu**3 + mu4 = mu4p - 4*mu*mu3 - 6*mu*mu*mu2 - mu**4 + g2 = mu4 / mu2**2.0 - 3.0 + out0 = default.copy() + place(out0,cond,g2) + output.append(out0) + else: #no valid args + output = [] + for _ in moments: + out0 = default.copy() + output.append(out0) + if len(output) == 1: return output[0] else: @@ -1542,6 +1548,8 @@ instance object for more information) """ + if not self._argcheck(*args): + return nan if (floor(n) != n): raise ValueError("Moment must be an integer.") if (n < 0): raise ValueError("Moment must be positive.") From scipy-svn at scipy.org Fri Jan 14 21:06:35 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 14 Jan 2011 20:06:35 -0600 (CST) Subject: [Scipy-svn] r7033 - trunk/scipy/stats Message-ID: <20110115020635.6D9E61B8C60@scipy.org> Author: josef Date: 2011-01-14 20:06:35 -0600 (Fri, 14 Jan 2011) New Revision: 7033 Modified: trunk/scipy/stats/distributions.py Log: stats.distributions, add argcheck to moment method, fixes ticket:934 Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2011-01-15 01:23:55 UTC (rev 7032) +++ trunk/scipy/stats/distributions.py 2011-01-15 02:06:35 UTC (rev 7033) @@ -5464,6 +5464,8 @@ instance object for more information) """ + if not self._argcheck(*args): + return nan if (floor(n) != n): raise ValueError("Moment must be an integer.") if (n < 0): raise ValueError("Moment must be positive.") From scipy-svn at scipy.org Fri Jan 14 22:28:40 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 14 Jan 2011 21:28:40 -0600 (CST) Subject: [Scipy-svn] r7034 - in trunk/scipy/stats: . tests Message-ID: <20110115032840.5AAA61B8C86@scipy.org> Author: josef Date: 2011-01-14 21:28:40 -0600 (Fri, 14 Jan 2011) New Revision: 7034 Modified: trunk/scipy/stats/distributions.py trunk/scipy/stats/tests/test_distributions.py Log: stats distribution chi2.pdf work around 0*log(0)==nan, ticket:1326 Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2011-01-15 02:06:35 UTC (rev 7033) +++ trunk/scipy/stats/distributions.py 2011-01-15 03:28:40 UTC (rev 7034) @@ -2267,7 +2267,10 @@ def _pdf(self, x, df): return exp(self._logpdf(x, df)) def _logpdf(self, x, df): - return (df/2.-1)*log(x)-x/2.-gamln(df/2.)-(log(2)*df)/2. + #term1 = (df/2.-1)*log(x) + #term1[(df==2)*(x==0)] = 0 + #avoid 0*log(0)==nan + return (df/2.-1)*log(x+1e-300) - x/2. - gamln(df/2.) - (log(2)*df)/2. ## Px = x**(df/2.0-1)*exp(-x/2.0) ## Px /= special.gamma(df/2.0)* 2**(df/2.0) ## return log(Px) Modified: trunk/scipy/stats/tests/test_distributions.py =================================================================== --- trunk/scipy/stats/tests/test_distributions.py 2011-01-15 02:06:35 UTC (rev 7033) +++ trunk/scipy/stats/tests/test_distributions.py 2011-01-15 03:28:40 UTC (rev 7034) @@ -661,5 +661,11 @@ g = stats.distributions.gamma_gen(name='gamma') +def test_regression_ticket_1326(): + """Regression test for ticket #1326.""" + #adjust to avoid nan with 0*log(0) + assert_almost_equal(stats.chi2.pdf(0.0, 2), 0.5, 14) + + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Sat Jan 15 07:42:41 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Jan 2011 06:42:41 -0600 (CST) Subject: [Scipy-svn] r7035 - trunk/scipy/interpolate/tests Message-ID: <20110115124241.9DCB737BFF2@scipy.org> Author: rgommers Date: 2011-01-15 06:42:40 -0600 (Sat, 15 Jan 2011) New Revision: 7035 Modified: trunk/scipy/interpolate/tests/test_rbf.py Log: TST: silence floating point test noise in interpolate. Modified: trunk/scipy/interpolate/tests/test_rbf.py =================================================================== --- trunk/scipy/interpolate/tests/test_rbf.py 2011-01-15 03:28:40 UTC (rev 7034) +++ trunk/scipy/interpolate/tests/test_rbf.py 2011-01-15 12:42:40 UTC (rev 7035) @@ -2,6 +2,7 @@ # Created by John Travers, Robert Hetland, 2007 """ Test functions for rbf module """ +import numpy as np from numpy.testing import assert_, assert_array_almost_equal, assert_almost_equal from numpy import linspace, sin, random, exp, allclose from scipy.interpolate.rbf import Rbf @@ -40,10 +41,14 @@ assert_array_almost_equal(di, d) def test_rbf_interpolation(): - for function in FUNCTIONS: - yield check_rbf1d_interpolation, function - yield check_rbf2d_interpolation, function - yield check_rbf3d_interpolation, function + olderr = np.seterr(all="ignore") + try: + for function in FUNCTIONS: + yield check_rbf1d_interpolation, function + yield check_rbf2d_interpolation, function + yield check_rbf3d_interpolation, function + finally: + np.seterr(**olderr) def check_rbf1d_regularity(function, atol): """Check that the Rbf function approximates a smooth function well away @@ -71,8 +76,12 @@ 'thin-plate': 0.1, 'linear': 0.2 } - for function in FUNCTIONS: - yield check_rbf1d_regularity, function, tolerances.get(function, 1e-2) + olderr = np.seterr(all="ignore") + try: + for function in FUNCTIONS: + yield check_rbf1d_regularity, function, tolerances.get(function, 1e-2) + finally: + np.seterr(**olderr) def test_default_construction(): """Check that the Rbf class can be constructed with the default From scipy-svn at scipy.org Sat Jan 15 07:43:37 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Jan 2011 06:43:37 -0600 (CST) Subject: [Scipy-svn] r7036 - in trunk/scipy: lib/blas/tests linalg/tests Message-ID: <20110115124337.1931432155@scipy.org> Author: rgommers Date: 2011-01-15 06:43:36 -0600 (Sat, 15 Jan 2011) New Revision: 7036 Modified: trunk/scipy/lib/blas/tests/test_fblas.py trunk/scipy/linalg/tests/test_decomp.py trunk/scipy/linalg/tests/test_fblas.py Log: TST: filter ComplexWarning from fblas tests. Modified: trunk/scipy/lib/blas/tests/test_fblas.py =================================================================== --- trunk/scipy/lib/blas/tests/test_fblas.py 2011-01-15 12:42:40 UTC (rev 7035) +++ trunk/scipy/lib/blas/tests/test_fblas.py 2011-01-15 12:43:36 UTC (rev 7036) @@ -89,7 +89,7 @@ assert_(0) def test_y_bad_size(self): - x = arange(12.,dtype=complex64) + x = arange(12.,dtype=self.dtype) y = zeros(6,x.dtype) try: self.blas_func(x,y,n=3,incy=5) @@ -217,7 +217,7 @@ assert_(0) def test_y_bad_size(self): - x = arange(12.,dtype=complex64) + x = arange(12.,dtype=self.dtype) y = zeros(6,x.dtype) try: self.blas_func(x,y,n=3,incy=5) @@ -310,7 +310,7 @@ assert_(0) def test_y_bad_size(self): - x = arange(12.,dtype=complex64) + x = arange(12.,dtype=self.dtype) y = zeros(6,x.dtype) try: self.blas_func(x,y,n=3,incy=5) Modified: trunk/scipy/linalg/tests/test_decomp.py =================================================================== --- trunk/scipy/linalg/tests/test_decomp.py 2011-01-15 12:42:40 UTC (rev 7035) +++ trunk/scipy/linalg/tests/test_decomp.py 2011-01-15 12:43:36 UTC (rev 7036) @@ -197,7 +197,11 @@ B = array(( [13,26,25,17,24], [31,46,40,26,37], [26,40,19,25,25], [16,25,27,14,23], [24,35,18,21,22])) - self._check_gen_eig(A, B) + olderr = np.seterr(all='ignore') + try: + self._check_gen_eig(A, B) + finally: + np.seterr(**olderr) def test_falker(self): """Test matrices giving some Nan generalized eigen values.""" @@ -209,7 +213,11 @@ A = bmat([[I,Z],[Z,-K]]) B = bmat([[Z,I],[M,D]]) - self._check_gen_eig(A, B) + olderr = np.seterr(all='ignore') + try: + self._check_gen_eig(A, B) + finally: + np.seterr(**olderr) def test_bad_geneig(self): # Ticket #709 (strange return values from DGGEV) @@ -229,9 +237,13 @@ # With a buggy LAPACK, this can fail for different omega on different # machines -- so we need to test several values - for k in xrange(100): - A, B = matrices(omega=k*5./100) - self._check_gen_eig(A, B) + olderr = np.seterr(all='ignore') + try: + for k in xrange(100): + A, B = matrices(omega=k*5./100) + self._check_gen_eig(A, B) + finally: + np.seterr(**olderr) def test_not_square_error(self): """Check that passing a non-square array raises a ValueError.""" Modified: trunk/scipy/linalg/tests/test_fblas.py =================================================================== --- trunk/scipy/linalg/tests/test_fblas.py 2011-01-15 12:42:40 UTC (rev 7035) +++ trunk/scipy/linalg/tests/test_fblas.py 2011-01-15 12:43:36 UTC (rev 7036) @@ -90,7 +90,7 @@ assert_(0) def test_y_bad_size(self): - x = arange(12.,dtype=complex64) + x = arange(12.,dtype=self.dtype) y = zeros(6,x.dtype) try: self.blas_func(x,y,n=3,incy=5) @@ -214,7 +214,7 @@ assert_(0) def test_y_bad_size(self): - x = arange(12.,dtype=complex64) + x = arange(12.,dtype=self.dtype) y = zeros(6,x.dtype) try: self.blas_func(x,y,n=3,incy=5) @@ -306,7 +306,7 @@ assert_(0) def test_y_bad_size(self): - x = arange(12.,dtype=complex64) + x = arange(12.,dtype=self.dtype) y = zeros(6,x.dtype) try: self.blas_func(x,y,n=3,incy=5) From scipy-svn at scipy.org Sat Jan 15 07:44:18 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Jan 2011 06:44:18 -0600 (CST) Subject: [Scipy-svn] r7037 - in trunk/scipy: fftpack/tests linalg Message-ID: <20110115124418.09BAF37A189@scipy.org> Author: rgommers Date: 2011-01-15 06:44:17 -0600 (Sat, 15 Jan 2011) New Revision: 7037 Modified: trunk/scipy/fftpack/tests/test_basic.py trunk/scipy/linalg/matfuncs.py Log: TST: fix ComplexWarnings by replacing .astype(float) by .real.astype(float). Modified: trunk/scipy/fftpack/tests/test_basic.py =================================================================== --- trunk/scipy/fftpack/tests/test_basic.py 2011-01-15 12:43:36 UTC (rev 7036) +++ trunk/scipy/fftpack/tests/test_basic.py 2011-01-15 12:44:17 UTC (rev 7037) @@ -417,8 +417,8 @@ for size in SMALL_COMPOSITE_SIZES + SMALL_PRIME_SIZES: np.random.seed(1234) x = np.random.rand(size, size) + 1j*np.random.rand(size, size) - y1 = fftn(x.astype(np.float32)) - y2 = fftn(x.astype(np.float64)).astype(np.complex64) + y1 = fftn(x.real.astype(np.float32)) + y2 = fftn(x.real.astype(np.float64)).astype(np.complex64) self.failUnless(y1.dtype == np.complex64) assert_array_almost_equal_nulp(y1, y2, 2000) @@ -426,8 +426,8 @@ for size in LARGE_COMPOSITE_SIZES + LARGE_PRIME_SIZES: np.random.seed(1234) x = np.random.rand(size, 3) + 1j*np.random.rand(size, 3) - y1 = fftn(x.astype(np.float32)) - y2 = fftn(x.astype(np.float64)).astype(np.complex64) + y1 = fftn(x.real.astype(np.float32)) + y2 = fftn(x.real.astype(np.float64)).astype(np.complex64) self.failUnless(y1.dtype == np.complex64) assert_array_almost_equal_nulp(y1, y2, 2000) Modified: trunk/scipy/linalg/matfuncs.py =================================================================== --- trunk/scipy/linalg/matfuncs.py 2011-01-15 12:43:36 UTC (rev 7036) +++ trunk/scipy/linalg/matfuncs.py 2011-01-15 12:44:17 UTC (rev 7037) @@ -91,7 +91,7 @@ t = 'd' s,vr = eig(A) vri = inv(vr) - return dot(dot(vr,diag(exp(s))),vri).astype(t) + return dot(dot(vr,diag(exp(s))),vri).real.astype(t) def expm3(A, q=20): """Compute the matrix exponential using Taylor series. From scipy-svn at scipy.org Sat Jan 15 07:45:09 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Jan 2011 06:45:09 -0600 (CST) Subject: [Scipy-svn] r7038 - trunk/scipy/ndimage/tests Message-ID: <20110115124509.7BE0232155@scipy.org> Author: rgommers Date: 2011-01-15 06:45:09 -0600 (Sat, 15 Jan 2011) New Revision: 7038 Modified: trunk/scipy/ndimage/tests/test_measurements.py Log: TST: fix floating point text noise for ndimage module. Modified: trunk/scipy/ndimage/tests/test_measurements.py =================================================================== --- trunk/scipy/ndimage/tests/test_measurements.py 2011-01-15 12:44:17 UTC (rev 7037) +++ trunk/scipy/ndimage/tests/test_measurements.py 2011-01-15 12:45:09 UTC (rev 7038) @@ -91,7 +91,7 @@ find_max=True, find_max_positions=True) assert_(len(result) == 2) assert_array_equal(result[0], [1, 6]) - assert_array_equal(result[1], [1, 2]) + assert_array_equal(result[1], [1, 2]) def test_label01(): @@ -440,12 +440,16 @@ def test_mean04(): "mean 4" labels = np.array([[1, 2], [2, 4]], np.int8) - for type in types: - input = np.array([[1, 2], [3, 4]], type) - output = ndimage.mean(input, labels=labels, - index=[4, 8, 2]) - assert_array_almost_equal(output[[0,2]], [4.0, 2.5]) - assert_(np.isnan(output[1])) + olderr = np.seterr(all='ignore') + try: + for type in types: + input = np.array([[1, 2], [3, 4]], type) + output = ndimage.mean(input, labels=labels, + index=[4, 8, 2]) + assert_array_almost_equal(output[[0,2]], [4.0, 2.5]) + assert_(np.isnan(output[1])) + finally: + np.seterr(**olderr) def test_minimum01(): "minimum 1" @@ -520,10 +524,14 @@ def test_variance01(): "variance 1" - for type in types: - input = np.array([], type) - output = ndimage.variance(input) - assert_(np.isnan(output)) + olderr = np.seterr(all='ignore') + try: + for type in types: + input = np.array([], type) + output = ndimage.variance(input) + assert_(np.isnan(output)) + finally: + np.seterr(**olderr) def test_variance02(): "variance 2" @@ -556,17 +564,25 @@ def test_variance06(): "variance 6" labels = [2, 2, 3, 3, 4] - for type in types: - input = np.array([1, 3, 8, 10, 8], type) - output = ndimage.variance(input, labels, [2, 3, 4]) - assert_array_almost_equal(output, [1.0, 1.0, 0.0]) + olderr = np.seterr(all='ignore') + try: + for type in types: + input = np.array([1, 3, 8, 10, 8], type) + output = ndimage.variance(input, labels, [2, 3, 4]) + assert_array_almost_equal(output, [1.0, 1.0, 0.0]) + finally: + np.seterr(**olderr) def test_standard_deviation01(): "standard deviation 1" - for type in types: - input = np.array([], type) - output = ndimage.standard_deviation(input) - assert_(np.isnan(output)) + olderr = np.seterr(all='ignore') + try: + for type in types: + input = np.array([], type) + output = ndimage.standard_deviation(input) + assert_(np.isnan(output)) + finally: + np.seterr(**olderr) def test_standard_deviation02(): "standard deviation 2" @@ -599,27 +615,33 @@ def test_standard_deviation06(): "standard deviation 6" labels = [2, 2, 3, 3, 4] - for type in types: - input = np.array([1, 3, 8, 10, 8], type) - output = ndimage.standard_deviation(input, labels, - [2, 3, 4]) - assert_array_almost_equal(output, [1.0, 1.0, 0.0]) + olderr = np.seterr(all='ignore') + try: + for type in types: + input = np.array([1, 3, 8, 10, 8], type) + output = ndimage.standard_deviation(input, labels, [2, 3, 4]) + assert_array_almost_equal(output, [1.0, 1.0, 0.0]) + finally: + np.seterr(**olderr) def test_standard_deviation07(): "standard deviation 7" labels = [1] - for type in types: - input = np.array([-0.00619519], type) - output = ndimage.standard_deviation(input, labels, [1]) - assert_array_almost_equal(output, [0]) + olderr = np.seterr(all='ignore') + try: + for type in types: + input = np.array([-0.00619519], type) + output = ndimage.standard_deviation(input, labels, [1]) + assert_array_almost_equal(output, [0]) + finally: + np.seterr(**olderr) def test_minimum_position01(): "minimum position 1" labels = np.array([1, 0], bool) for type in types: input = np.array([[1, 2], [3, 4]], type) - output = ndimage.minimum_position(input, - labels=labels) + output = ndimage.minimum_position(input, labels=labels) assert_equal(output, (0, 0)) def test_minimum_position02(): From scipy-svn at scipy.org Sat Jan 15 07:45:52 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Jan 2011 06:45:52 -0600 (CST) Subject: [Scipy-svn] r7039 - trunk/scipy/optimize/tests Message-ID: <20110115124552.734FD32155@scipy.org> Author: rgommers Date: 2011-01-15 06:45:52 -0600 (Sat, 15 Jan 2011) New Revision: 7039 Modified: trunk/scipy/optimize/tests/test_minpack.py trunk/scipy/optimize/tests/test_optimize.py Log: TST: silence test noise from optimize module. Modified: trunk/scipy/optimize/tests/test_minpack.py =================================================================== --- trunk/scipy/optimize/tests/test_minpack.py 2011-01-15 12:45:09 UTC (rev 7038) +++ trunk/scipy/optimize/tests/test_minpack.py 2011-01-15 12:45:52 UTC (rev 7039) @@ -13,9 +13,9 @@ class ReturnShape(object): """This class exists to create a callable that does not have a 'func_name' attribute. - + __init__ takes the argument 'shape', which should be a tuple of ints. When an instance - it called with a single argument 'x', it returns numpy.ones(shape). + it called with a single argument 'x', it returns numpy.ones(shape). """ def __init__(self, shape): self.shape = shape @@ -221,7 +221,7 @@ class TestFixedPoint(TestCase): - def text_scalar_trivial(self): + def test_scalar_trivial(self): """f(x) = 2x; fixed point should be x=0""" def func(x): return 2.0*x @@ -249,7 +249,11 @@ def func(x): return 2.0*x x0 = [0.3, 0.15] - x = fixed_point(func, x0) + olderr = np.seterr(all='ignore') + try: + x = fixed_point(func, x0) + finally: + np.seterr(**olderr) assert_almost_equal(x, [0.0, 0.0]) def test_array_basic1(self): @@ -258,7 +262,11 @@ return c * x**2 c = array([0.75, 1.0, 1.25]) x0 = [1.1, 1.15, 0.9] - x = fixed_point(func, x0, args=(c,)) + olderr = np.seterr(all='ignore') + try: + x = fixed_point(func, x0, args=(c,)) + finally: + np.seterr(**olderr) assert_almost_equal(x, 1.0/c) def test_array_basic2(self): Modified: trunk/scipy/optimize/tests/test_optimize.py =================================================================== --- trunk/scipy/optimize/tests/test_optimize.py 2011-01-15 12:45:09 UTC (rev 7038) +++ trunk/scipy/optimize/tests/test_optimize.py 2011-01-15 12:45:52 UTC (rev 7039) @@ -67,7 +67,6 @@ err = abs(self.func(params) - self.func(self.solution)) #print "CG: Difference is: " + str(err) assert_(err < 1e-6) - print self.funccalls, self.gradcalls # Ensure that function call counts are 'known good'; these are from # Scipy 0.7.0. Don't allow them to increase. From scipy-svn at scipy.org Sat Jan 15 07:46:40 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Jan 2011 06:46:40 -0600 (CST) Subject: [Scipy-svn] r7040 - in trunk/scipy/special: . tests Message-ID: <20110115124640.66CCF32155@scipy.org> Author: rgommers Date: 2011-01-15 06:46:40 -0600 (Sat, 15 Jan 2011) New Revision: 7040 Modified: trunk/scipy/special/orthogonal.py trunk/scipy/special/tests/test_basic.py trunk/scipy/special/tests/test_data.py trunk/scipy/special/tests/test_lambertw.py trunk/scipy/special/tests/test_orthogonal.py trunk/scipy/special/tests/test_orthogonal_eval.py Log: TST: silence floating point test noise in scipy.special. Modified: trunk/scipy/special/orthogonal.py =================================================================== --- trunk/scipy/special/orthogonal.py 2011-01-15 12:45:52 UTC (rev 7039) +++ trunk/scipy/special/orthogonal.py 2011-01-15 12:46:40 UTC (rev 7040) @@ -179,18 +179,23 @@ raise ValueError("alpha and beta must be greater than -1.") assert(n>0), "n must be positive." - (p,q) = (alpha,beta) - # from recurrence relations - sbn_J = lambda k: 2.0/(2.0*k+p+q)*sqrt((k+p)*(k+q)/(2*k+q+p+1)) * \ - (np.where(k==1,1.0,sqrt(k*(k+p+q)/(2.0*k+p+q-1)))) - if any(p == q): # XXX any or all??? - an_J = lambda k: 0.0*k - else: - an_J = lambda k: np.where(k==0,(q-p)/(p+q+2.0), - (q*q - p*p)/((2.0*k+p+q)*(2.0*k+p+q+2))) - g = cephes.gamma - mu0 = 2.0**(p+q+1)*g(p+1)*g(q+1)/(g(p+q+2)) - val = gen_roots_and_weights(n,an_J,sbn_J,mu0) + olderr = np.seterr(all='ignore') + try: + (p,q) = (alpha,beta) + # from recurrence relations + sbn_J = lambda k: 2.0/(2.0*k+p+q)*sqrt((k+p)*(k+q)/(2*k+q+p+1)) * \ + (np.where(k==1,1.0,sqrt(k*(k+p+q)/(2.0*k+p+q-1)))) + if any(p == q): # XXX any or all??? + an_J = lambda k: 0.0*k + else: + an_J = lambda k: np.where(k==0,(q-p)/(p+q+2.0), + (q*q - p*p)/((2.0*k+p+q)*(2.0*k+p+q+2))) + g = cephes.gamma + mu0 = 2.0**(p+q+1)*g(p+1)*g(q+1)/(g(p+q+2)) + val = gen_roots_and_weights(n,an_J,sbn_J,mu0) + finally: + np.seterr(**olderr) + if mu: return val + [mu0] else: Modified: trunk/scipy/special/tests/test_basic.py =================================================================== --- trunk/scipy/special/tests/test_basic.py 2011-01-15 12:45:52 UTC (rev 7039) +++ trunk/scipy/special/tests/test_basic.py 2011-01-15 12:46:40 UTC (rev 7040) @@ -907,8 +907,12 @@ correct[2*k] = -float(mathworld[k]) else: correct[2*k] = float(mathworld[k]) - err = nan_to_num((eu24-correct)/correct) - errmax = max(err) + olderr = np.seterr(all='ignore') + try: + err = nan_to_num((eu24-correct)/correct) + errmax = max(err) + finally: + np.seterr(**olderr) assert_almost_equal(errmax, 0.0, 14) class TestExp(TestCase): @@ -1034,7 +1038,7 @@ assert_almost_equal(rgam,rlgam,8) class TestHankel(TestCase): - + def test_negv1(self): assert_almost_equal(special.hankel1(-3,2), -special.hankel1(3,2), 14) @@ -1319,7 +1323,7 @@ 123.70194191713507279, 129.02417238949092824, 134.00114761868422559]), rtol=1e-13) - + jn301 = special.jn_zeros(301,5) assert_tol_equal(jn301, array([313.59097866698830153, 323.21549776096288280, @@ -1332,7 +1336,7 @@ assert_tol_equal(jn0[260-1], 816.02884495068867280, rtol=1e-13) assert_tol_equal(jn0[280-1], 878.86068707124422606, rtol=1e-13) assert_tol_equal(jn0[300-1], 941.69253065317954064, rtol=1e-13) - + jn10 = special.jn_zeros(10, 300) assert_tol_equal(jn10[260-1], 831.67668514305631151, rtol=1e-13) assert_tol_equal(jn10[280-1], 894.51275095371316931, rtol=1e-13) @@ -1516,7 +1520,7 @@ an = special.yn_zeros(4,2) assert_array_almost_equal(an,array([ 5.64515, 9.36162]),5) an = special.yn_zeros(443,5) - assert_tol_equal(an, [450.13573091578090314, 463.05692376675001542, + assert_tol_equal(an, [450.13573091578090314, 463.05692376675001542, 472.80651546418663566, 481.27353184725625838, 488.98055964441374646], rtol=1e-15) @@ -1570,7 +1574,7 @@ for z in [-1300, -11, -10, -1, 1., 10., 200.5, 401., 600.5, 700.6, 1300, 10003]: yield v, z - + # check half-integers; these are problematic points at least # for cephes/iv for v in 0.5 + arange(-60, 60): @@ -1605,7 +1609,11 @@ self.check_cephes_vs_amos(special.yv, special.yn, rtol=1e-11, atol=1e-305, skip=skipper) def test_iv_cephes_vs_amos(self): - self.check_cephes_vs_amos(special.iv, special.iv, rtol=5e-9, atol=1e-305) + olderr = np.seterr(all='ignore') + try: + self.check_cephes_vs_amos(special.iv, special.iv, rtol=5e-9, atol=1e-305) + finally: + np.seterr(**olderr) @dec.slow def test_iv_cephes_vs_amos_mass_test(self): @@ -1667,12 +1675,12 @@ assert_tol_equal(special.iv(-2, 1+0j), 0.1357476697670383) assert_tol_equal(special.kv(-1, 1+0j), 0.6019072301972347) assert_tol_equal(special.kv(-2, 1+0j), 1.624838898635178) - + assert_tol_equal(special.jv(-0.5, 1+0j), 0.43109886801837607952) assert_tol_equal(special.jv(-0.5, 1+1j), 0.2628946385649065-0.827050182040562j) assert_tol_equal(special.yv(-0.5, 1+0j), 0.6713967071418031) assert_tol_equal(special.yv(-0.5, 1+1j), 0.967901282890131+0.0602046062142816j) - + assert_tol_equal(special.iv(-0.5, 1+0j), 1.231200214592967) assert_tol_equal(special.iv(-0.5, 1+1j), 0.77070737376928+0.39891821043561j) assert_tol_equal(special.kv(-0.5, 1+0j), 0.4610685044478945) @@ -1799,8 +1807,8 @@ y=(special.iv(0,2) + special.iv(2,2))/2 x = special.ivp(1,2) assert_almost_equal(x,y,10) - + class TestLaguerre(TestCase): def test_laguerre(self): lag0 = special.laguerre(0) @@ -1890,7 +1898,11 @@ # XXX: this is outside the domain of the current implementation, # so ensure it returns a NaN rather than a wrong answer. - lp = special.lpmv(-1,-1,.001) + olderr = np.seterr(all='ignore') + try: + lp = special.lpmv(-1,-1,.001) + finally: + np.seterr(**olderr) assert_(lp != 0 or np.isnan(lp)) def test_lqmn(self): @@ -1978,7 +1990,7 @@ eps = 1e-7 + 1e-7*abs(x) dp = (special.pbdv(eta, x + eps)[0] - special.pbdv(eta, x - eps)[0]) / eps / 2. assert_tol_equal(p[1], dp, rtol=1e-6, atol=1e-6) - + def test_pbvv_gradient(self): x = np.linspace(-4, 4, 8)[:,None] eta = np.linspace(-10, 10, 5)[None,:] @@ -1987,8 +1999,8 @@ eps = 1e-7 + 1e-7*abs(x) dp = (special.pbvv(eta, x + eps)[0] - special.pbvv(eta, x - eps)[0]) / eps / 2. assert_tol_equal(p[1], dp, rtol=1e-6, atol=1e-6) - + class TestPolygamma(TestCase): # from Table 6.2 (pg. 271) of A&S def test_polygamma(self): @@ -2041,8 +2053,8 @@ # correctly written. rndrl = (10,10,10,11) assert_array_equal(rnd,rndrl) - + def test_sph_harm(): # Tests derived from tables in # http://en.wikipedia.org/wiki/Table_of_spherical_harmonics @@ -2076,7 +2088,7 @@ def test_sph_harm(self): # see test_sph_harm function pass - + def test_sph_in(self): i1n = special.sph_in(1,.2) inp0 = (i1n[0][1]) Modified: trunk/scipy/special/tests/test_data.py =================================================================== --- trunk/scipy/special/tests/test_data.py 2011-01-15 12:45:52 UTC (rev 7039) +++ trunk/scipy/special/tests/test_data.py 2011-01-15 12:46:40 UTC (rev 7040) @@ -206,8 +206,12 @@ # tgamma_ratio_data.txt ] - for test in TESTS: - yield _test_factory, test + olderr = np.seterr(all='ignore') + try: + for test in TESTS: + yield _test_factory, test + finally: + np.seterr(**olderr) def _test_factory(test, dtype=np.double): """Boost test""" Modified: trunk/scipy/special/tests/test_lambertw.py =================================================================== --- trunk/scipy/special/tests/test_lambertw.py 2011-01-15 12:45:52 UTC (rev 7039) +++ trunk/scipy/special/tests/test_lambertw.py 2011-01-15 12:46:40 UTC (rev 7040) @@ -6,6 +6,7 @@ # [1] mpmath source code, Subversion revision 992 # http://code.google.com/p/mpmath/source/browse/trunk/mpmath/tests/test_functions2.py?spec=svn994&r=992 +import numpy as np from numpy.testing import assert_, assert_equal, assert_array_almost_equal from scipy.special import lambertw from numpy import nan, inf, pi, e, isnan, log, r_, array, complex_ @@ -78,7 +79,11 @@ def w(x, y): return lambertw(x, y.real.astype(int)) - FuncData(w, data, (0,1), 2, rtol=1e-10, atol=1e-13).check() + olderr = np.seterr(all='ignore') + try: + FuncData(w, data, (0,1), 2, rtol=1e-10, atol=1e-13).check() + finally: + np.seterr(**olderr) def test_ufunc(): assert_array_almost_equal( Modified: trunk/scipy/special/tests/test_orthogonal.py =================================================================== --- trunk/scipy/special/tests/test_orthogonal.py 2011-01-15 12:45:52 UTC (rev 7039) +++ trunk/scipy/special/tests/test_orthogonal.py 2011-01-15 12:46:40 UTC (rev 7040) @@ -10,10 +10,14 @@ def test_chebyc(self): C0 = orth.chebyc(0) C1 = orth.chebyc(1) - C2 = orth.chebyc(2) - C3 = orth.chebyc(3) - C4 = orth.chebyc(4) - C5 = orth.chebyc(5) + olderr = np.seterr(all='ignore') + try: + C2 = orth.chebyc(2) + C3 = orth.chebyc(3) + C4 = orth.chebyc(4) + C5 = orth.chebyc(5) + finally: + np.seterr(**olderr) assert_array_almost_equal(C0.c,[2],13) assert_array_almost_equal(C1.c,[1,0],13) @@ -247,7 +251,11 @@ orth.sh_legendre(%(n)d) """ % dict(n=n)).split() ]) - for pstr in poly: - p = eval(pstr) - assert_almost_equal(p(0.315), np.poly1d(p)(0.315), err_msg=pstr) + olderr = np.seterr(all='ignore') + try: + for pstr in poly: + p = eval(pstr) + assert_almost_equal(p(0.315), np.poly1d(p)(0.315), err_msg=pstr) + finally: + np.seterr(**olderr) Modified: trunk/scipy/special/tests/test_orthogonal_eval.py =================================================================== --- trunk/scipy/special/tests/test_orthogonal_eval.py 2011-01-15 12:45:52 UTC (rev 7039) +++ trunk/scipy/special/tests/test_orthogonal_eval.py 2011-01-15 12:46:40 UTC (rev 7040) @@ -99,8 +99,12 @@ param_ranges=[], x_range=[-2, 2]) def test_sh_chebyt(self): - self.check_poly(orth.eval_sh_chebyt, orth.sh_chebyt, - param_ranges=[], x_range=[0, 1]) + olderr = np.seterr(all='ignore') + try: + self.check_poly(orth.eval_sh_chebyt, orth.sh_chebyt, + param_ranges=[], x_range=[0, 1]) + finally: + np.seterr(**olderr) def test_sh_chebyu(self): self.check_poly(orth.eval_sh_chebyu, orth.sh_chebyu, @@ -111,8 +115,12 @@ param_ranges=[], x_range=[-1, 1]) def test_sh_legendre(self): - self.check_poly(orth.eval_sh_legendre, orth.sh_legendre, - param_ranges=[], x_range=[0, 1]) + olderr = np.seterr(all='ignore') + try: + self.check_poly(orth.eval_sh_legendre, orth.sh_legendre, + param_ranges=[], x_range=[0, 1]) + finally: + np.seterr(**olderr) def test_genlaguerre(self): self.check_poly(orth.eval_genlaguerre, orth.genlaguerre, From scipy-svn at scipy.org Sat Jan 15 07:47:36 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Jan 2011 06:47:36 -0600 (CST) Subject: [Scipy-svn] r7041 - in trunk/scipy/stats: . tests Message-ID: <20110115124736.09BCB36346@scipy.org> Author: rgommers Date: 2011-01-15 06:47:35 -0600 (Sat, 15 Jan 2011) New Revision: 7041 Modified: trunk/scipy/stats/stats.py trunk/scipy/stats/tests/test_continuous_basic.py trunk/scipy/stats/tests/test_discrete_basic.py trunk/scipy/stats/tests/test_morestats.py trunk/scipy/stats/tests/test_mstats_basic.py trunk/scipy/stats/tests/test_stats.py Log: TST: filter all test noise from scipy.stats The tests for the zipf distribution are disabled, because they were generating floating point warnings for many (all) methods that can't easily be filtered. The chisquare test of dlaplace is disabled for the same reason. Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2011-01-15 12:46:40 UTC (rev 7040) +++ trunk/scipy/stats/stats.py 2011-01-15 12:47:35 UTC (rev 7041) @@ -2437,7 +2437,11 @@ n = a.shape[axisout] rs = np.corrcoef(ar,br,rowvar=axisout) - t = rs * np.sqrt((n-2) / ((rs+1.0)*(1.0-rs))) + olderr = np.seterr(divide='ignore') # rs can have elements equal to 1 + try: + t = rs * np.sqrt((n-2) / ((rs+1.0)*(1.0-rs))) + finally: + np.seterr(**olderr) prob = distributions.t.sf(np.abs(t),n-2)*2 if rs.shape == (2,2): Modified: trunk/scipy/stats/tests/test_continuous_basic.py =================================================================== --- trunk/scipy/stats/tests/test_continuous_basic.py 2011-01-15 12:46:40 UTC (rev 7040) +++ trunk/scipy/stats/tests/test_continuous_basic.py 2011-01-15 12:47:35 UTC (rev 7041) @@ -158,34 +158,41 @@ def test_cont_basic(): # this test skips slow distributions - for distname, arg in distcont[:]: - if distname in distslow: continue - distfn = getattr(stats, distname) - np.random.seed(765456) - sn = 1000 - rvs = distfn.rvs(size=sn,*arg) - sm = rvs.mean() - sv = rvs.var() - skurt = stats.kurtosis(rvs) - sskew = stats.skew(rvs) - m,v = distfn.stats(*arg) + olderr = np.seterr(all='ignore') + try: + for distname, arg in distcont[:]: + if distname in distslow: + continue + distfn = getattr(stats, distname) + np.random.seed(765456) + sn = 1000 + rvs = distfn.rvs(size=sn,*arg) + sm = rvs.mean() + sv = rvs.var() + skurt = stats.kurtosis(rvs) + sskew = stats.skew(rvs) + m,v = distfn.stats(*arg) - yield check_sample_meanvar_, distfn, arg, m, v, sm, sv, sn, distname + \ - 'sample mean test' - # the sample skew kurtosis test has known failures, not very good distance measure - #yield check_sample_skew_kurt, distfn, arg, sskew, skurt, distname - yield check_moment, distfn, arg, m, v, distname - yield check_cdf_ppf, distfn, arg, distname - yield check_sf_isf, distfn, arg, distname - yield check_pdf, distfn, arg, distname - if distname in ['wald']: continue - yield check_pdf_logpdf, distfn, arg, distname - yield check_cdf_logcdf, distfn, arg, distname - yield check_sf_logsf, distfn, arg, distname - if distname in distmissing: - alpha = 0.01 - yield check_distribution_rvs, distname, arg, alpha, rvs + yield check_sample_meanvar_, distfn, arg, m, v, sm, sv, sn, distname + \ + 'sample mean test' + # the sample skew kurtosis test has known failures, not very good distance measure + #yield check_sample_skew_kurt, distfn, arg, sskew, skurt, distname + yield check_moment, distfn, arg, m, v, distname + yield check_cdf_ppf, distfn, arg, distname + yield check_sf_isf, distfn, arg, distname + yield check_pdf, distfn, arg, distname + if distname in ['wald']: + continue + yield check_pdf_logpdf, distfn, arg, distname + yield check_cdf_logcdf, distfn, arg, distname + yield check_sf_logsf, distfn, arg, distname + if distname in distmissing: + alpha = 0.01 + yield check_distribution_rvs, distname, arg, alpha, rvs + finally: + np.seterr(**olderr) + @npt.dec.slow def test_cont_basic_slow(): # same as above for slow distributions Modified: trunk/scipy/stats/tests/test_discrete_basic.py =================================================================== --- trunk/scipy/stats/tests/test_discrete_basic.py 2011-01-15 12:46:40 UTC (rev 7040) +++ trunk/scipy/stats/tests/test_discrete_basic.py 2011-01-15 12:47:35 UTC (rev 7041) @@ -21,8 +21,8 @@ ['planck', (0.51,)], #4.1 ['poisson', (0.6,)], ['randint', (7, 31)], - ['skellam', (15, 8)], - ['zipf', (4,)] ] # arg=4 is ok, + ['skellam', (15, 8)]] +# ['zipf', (4,)] ] # arg=4 is ok, # Zipf broken for arg = 2, e.g. weird .stats # looking closer, mean, var should be inf for arg=2 @@ -43,16 +43,24 @@ yield check_cdf_ppf, distfn, arg, distname + ' cdf_ppf' yield check_cdf_ppf2, distfn, arg, supp, distname + ' cdf_ppf' yield check_pmf_cdf, distfn, arg, distname + ' pmf_cdf' - yield check_oth, distfn, arg, distname + ' oth' - skurt = stats.kurtosis(rvs) - sskew = stats.skew(rvs) - yield check_sample_skew_kurt, distfn, arg, skurt, sskew, \ - distname + ' skew_kurt' - if not distname in ['']:#['logser']: #known failure, fixed + + # zipf doesn't fail, but generates floating point warnings. + # Should be checked. + if not distname in ['zipf']: + yield check_oth, distfn, arg, distname + ' oth' + skurt = stats.kurtosis(rvs) + sskew = stats.skew(rvs) + yield check_sample_skew_kurt, distfn, arg, skurt, sskew, \ + distname + ' skew_kurt' + + # dlaplace doesn't fail, but generates lots of floating point warnings. + # Should be checked. + if not distname in ['dlaplace']: #['logser']: #known failure, fixed alpha = 0.01 yield check_discrete_chisquare, distfn, arg, rvs, alpha, \ distname + ' chisquare' + @npt.dec.slow def test_discrete_extra(): for distname, arg in distdiscrete: @@ -252,7 +260,7 @@ cdfs = distfn.cdf(distsupp,*arg) (chis,pval) = stats.chisquare(np.array(freq),n*distmass) - npt.assert_(pval > alpha, 'chisquare - test for %s' + npt.assert_(pval > alpha, 'chisquare - test for %s' ' at arg = %s with pval = %s' % (msg,str(arg),str(pval))) Modified: trunk/scipy/stats/tests/test_morestats.py =================================================================== --- trunk/scipy/stats/tests/test_morestats.py 2011-01-15 12:46:40 UTC (rev 7040) +++ trunk/scipy/stats/tests/test_morestats.py 2011-01-15 12:47:35 UTC (rev 7041) @@ -3,6 +3,8 @@ # Further enhancements and tests added by numerous SciPy developers. # +import warnings + from numpy.testing import TestCase, run_module_suite, assert_array_equal, \ assert_almost_equal, assert_array_less, assert_array_almost_equal, \ assert_raises @@ -62,7 +64,11 @@ x2 = rs.standard_normal(size=50) A,crit,sig = stats.anderson(x1,'expon') assert_array_less(A, crit[-2:]) - A,crit,sig = stats.anderson(x2,'expon') + olderr = np.seterr(all='ignore') + try: + A,crit,sig = stats.anderson(x2,'expon') + finally: + np.seterr(**olderr) assert_array_less(crit[:-1], A) def test_bad_arg(self): @@ -96,7 +102,10 @@ assert_raises(ValueError, stats.ansari, [], [1]) assert_raises(ValueError, stats.ansari, [1], []) +warnings.filterwarnings('ignore', + message="Ties preclude use of exact statistic.") + class TestBartlett(TestCase): def test_data(self): @@ -124,7 +133,7 @@ W2, pval2 = stats.levene(g1, g2, g3, center='trimmed', proportiontocut=0.0) assert_almost_equal(W1, W2) assert_almost_equal(pval1, pval2) - + def test_trimmed2(self): x = [1.2, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 100.0] y = [0.0, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 200.0] @@ -141,7 +150,7 @@ y = x**3 W1, pval1 = stats.levene(x, y, center='mean') W2, pval2 = stats.levene(x, y, center='median') - assert_almost_equal(W1, W2) + assert_almost_equal(W1, W2) assert_almost_equal(pval1, pval2) def test_bad_keyword(self): @@ -151,7 +160,7 @@ def test_bad_center_value(self): x = np.linspace(-1,1,21) assert_raises(ValueError, stats.levene, x, x, center='trim') - + def test_too_few_args(self): assert_raises(ValueError, stats.levene, [1]) @@ -203,7 +212,7 @@ Xsq2, pval2 = stats.fligner(g1, g2, g3, center='trimmed', proportiontocut=0.0) assert_almost_equal(Xsq1, Xsq2) assert_almost_equal(pval1, pval2) - + def test_trimmed2(self): x = [1.2, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 100.0] y = [0.0, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 200.0] @@ -213,7 +222,7 @@ Xsq2, pval2 = stats.fligner(x[1:-1], y[1:-1], center='mean') # Result should be the same. assert_almost_equal(Xsq1, Xsq2) - assert_almost_equal(pval1, pval2) + assert_almost_equal(pval1, pval2) # The following test looks reasonable at first, but fligner() uses the # function stats.rankdata(), and in one of the cases in this test, Modified: trunk/scipy/stats/tests/test_mstats_basic.py =================================================================== --- trunk/scipy/stats/tests/test_mstats_basic.py 2011-01-15 12:46:40 UTC (rev 7040) +++ trunk/scipy/stats/tests/test_mstats_basic.py 2011-01-15 12:47:35 UTC (rev 7041) @@ -128,11 +128,15 @@ def test_pearsonr(self): "Tests some computations of Pearson's r" x = ma.arange(10) - assert_almost_equal(mstats.pearsonr(x,x)[0], 1.0) - assert_almost_equal(mstats.pearsonr(x,x[::-1])[0], -1.0) - # - x = ma.array(x, mask=True) - pr = mstats.pearsonr(x,x) + olderr = np.seterr(all='ignore') + try: + assert_almost_equal(mstats.pearsonr(x,x)[0], 1.0) + assert_almost_equal(mstats.pearsonr(x,x[::-1])[0], -1.0) + + x = ma.array(x, mask=True) + pr = mstats.pearsonr(x,x) + finally: + np.seterr(**olderr) assert_(pr[0] is masked) assert_(pr[1] is masked) # Modified: trunk/scipy/stats/tests/test_stats.py =================================================================== --- trunk/scipy/stats/tests/test_stats.py 2011-01-15 12:46:40 UTC (rev 7040) +++ trunk/scipy/stats/tests/test_stats.py 2011-01-15 12:47:35 UTC (rev 7041) @@ -158,7 +158,11 @@ def test_nanmean_all(self): """Check nanmean when all values are nan.""" - m = stats.nanmean(self.Xall) + olderr = np.seterr(all='ignore') + try: + m = stats.nanmean(self.Xall) + finally: + np.seterr(**olderr) assert_(np.isnan(m)) def test_nanstd_none(self): @@ -173,7 +177,11 @@ def test_nanstd_all(self): """Check nanstd when all values are nan.""" - s = stats.nanstd(self.Xall) + olderr = np.seterr(all='ignore') + try: + s = stats.nanstd(self.Xall) + finally: + np.seterr(**olderr) assert_(np.isnan(s)) def test_nanstd_negative_axis(self): @@ -1349,14 +1357,18 @@ assert_array_almost_equal(np.abs(p), pr) assert_equal(t.shape, (3, 2)) - #test zero division problem - t,p = stats.ttest_rel([0,0,0],[1,1,1]) - assert_equal((np.abs(t),p), (np.inf, 0)) - assert_almost_equal(stats.ttest_rel([0,0,0], [0,0,0]), (1.0, 0.42264973081037421)) + olderr = np.seterr(all='ignore') + try: + #test zero division problem + t,p = stats.ttest_rel([0,0,0],[1,1,1]) + assert_equal((np.abs(t),p), (np.inf, 0)) + assert_almost_equal(stats.ttest_rel([0,0,0], [0,0,0]), (1.0, 0.42264973081037421)) - #check that nan in input array result in nan output - anan = np.array([[1,np.nan],[-1,1]]) - assert_equal(stats.ttest_ind(anan, np.zeros((2,2))),([0, np.nan], [1,np.nan])) + #check that nan in input array result in nan output + anan = np.array([[1,np.nan],[-1,1]]) + assert_equal(stats.ttest_ind(anan, np.zeros((2,2))),([0, np.nan], [1,np.nan])) + finally: + np.seterr(**olderr) def test_ttest_ind(): @@ -1390,18 +1402,20 @@ assert_array_almost_equal(np.abs(p), pr) assert_equal(t.shape, (3, 2)) - #test zero division problem - t,p = stats.ttest_ind([0,0,0],[1,1,1]) - assert_equal((np.abs(t),p), (np.inf, 0)) - assert_almost_equal(stats.ttest_ind([0,0,0], [0,0,0]), (1.0, 0.37390096630005898)) + olderr = np.seterr(all='ignore') + try: + #test zero division problem + t,p = stats.ttest_ind([0,0,0],[1,1,1]) + assert_equal((np.abs(t),p), (np.inf, 0)) + assert_almost_equal(stats.ttest_ind([0,0,0], [0,0,0]), (1.0, 0.37390096630005898)) - #check that nan in input array result in nan output - anan = np.array([[1,np.nan],[-1,1]]) - assert_equal(stats.ttest_ind(anan, np.zeros((2,2))),([0, np.nan], [1,np.nan])) + #check that nan in input array result in nan output + anan = np.array([[1,np.nan],[-1,1]]) + assert_equal(stats.ttest_ind(anan, np.zeros((2,2))),([0, np.nan], [1,np.nan])) + finally: + np.seterr(**olderr) - - def test_ttest_1samp_new(): n1, n2, n3 = (10,15,20) rvn1 = stats.norm.rvs(loc=5,scale=10,size=(n1,n2,n3)) @@ -1429,15 +1443,20 @@ assert_almost_equal(t1[0,0],t3, decimal=14) assert_equal(t1.shape, (n1,n2)) - #test zero division problem - t,p = stats.ttest_1samp([0,0,0], 1) - assert_equal((np.abs(t),p), (np.inf, 0)) - assert_almost_equal(stats.ttest_1samp([0,0,0], 0), (1.0, 0.42264973081037421)) + olderr = np.seterr(all='ignore') + try: + #test zero division problem + t,p = stats.ttest_1samp([0,0,0], 1) + assert_equal((np.abs(t),p), (np.inf, 0)) + assert_almost_equal(stats.ttest_1samp([0,0,0], 0), (1.0, 0.42264973081037421)) - #check that nan in input array result in nan output - anan = np.array([[1,np.nan],[-1,1]]) - assert_equal(stats.ttest_1samp(anan, 0),([0, np.nan], [1,np.nan])) + #check that nan in input array result in nan output + anan = np.array([[1,np.nan],[-1,1]]) + assert_equal(stats.ttest_1samp(anan, 0),([0, np.nan], [1,np.nan])) + finally: + np.seterr(**olderr) + def test_describe(): x = np.vstack((np.ones((3,4)),2*np.ones((2,4)))) nc, mmc = (5, ([ 1., 1., 1., 1.], [ 2., 2., 2., 2.])) @@ -1663,22 +1682,41 @@ ''' Test a 1d list with zero element''' a=[10, 20, 30, 40, 50, 60, 70, 80, 90, 0] b = 0.0 # due to exp(-inf)=0 - self.do(a, b) + olderr = np.seterr(all='ignore') + try: + self.do(a, b) + finally: + np.seterr(**olderr) + def test_1darray0(self): ''' Test a 1d array with zero element''' a=np.array([10, 20, 30, 40, 50, 60, 70, 80, 90, 0]) b = 0.0 # due to exp(-inf)=0 - self.do(a, b) + olderr = np.seterr(all='ignore') + try: + self.do(a, b) + finally: + np.seterr(**olderr) + def test_1dma0(self): ''' Test a 1d masked array with zero element''' a=np.ma.array([10, 20, 30, 40, 50, 60, 70, 80, 90, 0]) b = 41.4716627439 - self.do(a, b) + olderr = np.seterr(all='ignore') + try: + self.do(a, b) + finally: + np.seterr(**olderr) + def test_1dmainf(self): ''' Test a 1d masked array with negative element''' a=np.ma.array([10, 20, 30, 40, 50, 60, 70, 80, 90, -1]) b = 41.4716627439 - self.do(a, b) + olderr = np.seterr(all='ignore') + try: + self.do(a, b) + finally: + np.seterr(**olderr) class TestGeoMean(GeoMeanTestCase, TestCase): def do(self, a, b, axis=None, dtype=None): From scipy-svn at scipy.org Sat Jan 15 09:01:47 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Jan 2011 08:01:47 -0600 (CST) Subject: [Scipy-svn] r7042 - in branches/0.9.x/scipy/stats: . tests Message-ID: <20110115140147.771B81B8BFF@scipy.org> Author: rgommers Date: 2011-01-15 08:01:47 -0600 (Sat, 15 Jan 2011) New Revision: 7042 Modified: branches/0.9.x/scipy/stats/distributions.py branches/0.9.x/scipy/stats/tests/test_distributions.py Log: stats.distributions expect: fix bound handling and add tests, continuous distribution only Modified: branches/0.9.x/scipy/stats/distributions.py =================================================================== --- branches/0.9.x/scipy/stats/distributions.py 2011-01-15 12:47:35 UTC (rev 7041) +++ branches/0.9.x/scipy/stats/distributions.py 2011-01-15 14:01:47 UTC (rev 7042) @@ -1824,11 +1824,12 @@ def fun(x, *args): return func(x)*self.pdf(x, *args, **{'loc':loc, 'scale':scale}) if lb is None: - lb = (self.a - loc)/(1.0*scale) + lb = loc + self.a * scale if ub is None: - ub = (self.b - loc)/(1.0*scale) + ub = loc + self.b * scale if conditional: - invfac = self.sf(lb,*args) - self.sf(ub,*args) + invfac = (self.sf(lb, *args, **{'loc':loc, 'scale':scale}) + - self.sf(ub, *args, **{'loc':loc, 'scale':scale})) else: invfac = 1.0 kwds['args'] = args Modified: branches/0.9.x/scipy/stats/tests/test_distributions.py =================================================================== --- branches/0.9.x/scipy/stats/tests/test_distributions.py 2011-01-15 12:47:35 UTC (rev 7041) +++ branches/0.9.x/scipy/stats/tests/test_distributions.py 2011-01-15 14:01:47 UTC (rev 7042) @@ -559,7 +559,51 @@ # the focus of this test. assert_equal(m1, m2) +class TestExpect(TestCase): + """Test for expect method, continuous distributions only. + Uses normal distribution and beta distribution for finite bounds. + """ + def test_norm(self): + v = stats.norm.expect(lambda x: (x-5)*(x-5), loc=5, scale=2) + assert_almost_equal(v, 4, decimal=14) + + m = stats.norm.expect(lambda x: (x), loc=5, scale=2) + assert_almost_equal(m, 5, decimal=14) + + lb = stats.norm.ppf(0.05, loc=5, scale=2) + ub = stats.norm.ppf(0.95, loc=5, scale=2) + prob90 = stats.norm.expect(lambda x: 1, loc=5, scale=2, lb=lb, ub=ub) + assert_almost_equal(prob90, 0.9, decimal=14) + + prob90c = stats.norm.expect(lambda x: 1, loc=5, scale=2, lb=lb, ub=ub, + conditional=True) + assert_almost_equal(prob90c, 1., decimal=14) + + def test_beta(self): + #case with finite support interval +## >>> mtrue, vtrue = stats.beta.stats(10,5, loc=5., scale=2.) +## >>> mtrue, vtrue +## (array(6.333333333333333), array(0.055555555555555552)) + v = stats.beta.expect(lambda x: (x-19/3.)*(x-19/3.), args=(10,5), + loc=5, scale=2) + assert_almost_equal(v, 1./18., decimal=14) + + m = stats.beta.expect(lambda x: x, args=(10,5), loc=5., scale=2.) + assert_almost_equal(m, 19/3., decimal=14) + + ub = stats.beta.ppf(0.95, 10, 10, loc=5, scale=2) + lb = stats.beta.ppf(0.05, 10, 10, loc=5, scale=2) + prob90 = stats.beta.expect(lambda x: 1., args=(10,10), loc=5., + scale=2.,lb=lb, ub=ub, conditional=False) + assert_almost_equal(prob90, 0.9, decimal=14) + + prob90c = stats.beta.expect(lambda x: 1, args=(10,10), loc=5, + scale=2, lb=lb, ub=ub, conditional=True) + assert_almost_equal(prob90c, 1., decimal=14) + + + def test_regression_ticket_1316(): """Regression test for ticket #1316.""" # The following was raising an exception, because _construct_default_doc() From scipy-svn at scipy.org Sat Jan 15 09:02:06 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Jan 2011 08:02:06 -0600 (CST) Subject: [Scipy-svn] r7043 - in trunk/scipy/linalg: . tests Message-ID: <20110115140206.13B6D36346@scipy.org> Author: ptvirtan Date: 2011-01-15 08:02:05 -0600 (Sat, 15 Jan 2011) New Revision: 7043 Modified: trunk/scipy/linalg/matfuncs.py trunk/scipy/linalg/tests/test_matfuncs.py Log: BUG: linalg/expm2: revert r7037, and fix the fix; also add tests Modified: trunk/scipy/linalg/matfuncs.py =================================================================== --- trunk/scipy/linalg/matfuncs.py 2011-01-15 14:01:47 UTC (rev 7042) +++ trunk/scipy/linalg/matfuncs.py 2011-01-15 14:02:05 UTC (rev 7043) @@ -91,7 +91,11 @@ t = 'd' s,vr = eig(A) vri = inv(vr) - return dot(dot(vr,diag(exp(s))),vri).real.astype(t) + r = dot(dot(vr,diag(exp(s))),vri) + if t in ['f', 'd']: + return r.real.astype(t) + else: + return r.astype(t) def expm3(A, q=20): """Compute the matrix exponential using Taylor series. Modified: trunk/scipy/linalg/tests/test_matfuncs.py =================================================================== --- trunk/scipy/linalg/tests/test_matfuncs.py 2011-01-15 14:01:47 UTC (rev 7042) +++ trunk/scipy/linalg/tests/test_matfuncs.py 2011-01-15 14:02:05 UTC (rev 7043) @@ -93,5 +93,14 @@ assert_array_almost_equal(expm2(a),[[1,0],[0,1]]) assert_array_almost_equal(expm3(a),[[1,0],[0,1]]) + def test_consistency(self): + a = array([[0.,1],[-1,0]]) + assert_array_almost_equal(expm(a), expm2(a)) + assert_array_almost_equal(expm(a), expm3(a)) + + a = array([[1j,1],[-1,-2j]]) + assert_array_almost_equal(expm(a), expm2(a)) + assert_array_almost_equal(expm(a), expm3(a)) + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Sat Jan 15 09:02:23 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Jan 2011 08:02:23 -0600 (CST) Subject: [Scipy-svn] r7044 - in branches/0.9.x/scipy/stats: . tests Message-ID: <20110115140223.466043634D@scipy.org> Author: rgommers Date: 2011-01-15 08:02:23 -0600 (Sat, 15 Jan 2011) New Revision: 7044 Modified: branches/0.9.x/scipy/stats/distributions.py branches/0.9.x/scipy/stats/tests/test_distributions.py Log: stats.distributions expect: fix bound handling and add tests for discrete distributions Modified: branches/0.9.x/scipy/stats/distributions.py =================================================================== --- branches/0.9.x/scipy/stats/distributions.py 2011-01-15 14:02:05 UTC (rev 7043) +++ branches/0.9.x/scipy/stats/distributions.py 2011-01-15 14:02:23 UTC (rev 7044) @@ -5582,10 +5582,18 @@ self._argcheck(*args) # (re)generate scalar self.a and self.b if lb is None: lb = (self.a) + else: + lb = lb - loc #convert bound for standardized distribution if ub is None: ub = (self.b) + else: + ub = ub - loc #convert bound for standardized distribution if conditional: - invfac = self.sf(lb,*args) - self.sf(ub+1,*args) + if np.isposinf(ub)[()]: + #work around bug: stats.poisson.sf(stats.poisson.b, 2) is nan + invfac = 1 - self.cdf(lb-1,*args) + else: + invfac = 1 - self.cdf(lb-1,*args) - self.sf(ub,*args) else: invfac = 1.0 Modified: branches/0.9.x/scipy/stats/tests/test_distributions.py =================================================================== --- branches/0.9.x/scipy/stats/tests/test_distributions.py 2011-01-15 14:02:05 UTC (rev 7043) +++ branches/0.9.x/scipy/stats/tests/test_distributions.py 2011-01-15 14:02:23 UTC (rev 7044) @@ -560,9 +560,11 @@ assert_equal(m1, m2) class TestExpect(TestCase): - """Test for expect method, continuous distributions only. + """Test for expect method. - Uses normal distribution and beta distribution for finite bounds. + Uses normal distribution and beta distribution for finite bounds, and + hypergeom for discrete distribution with finite support + """ def test_norm(self): v = stats.norm.expect(lambda x: (x-5)*(x-5), loc=5, scale=2) @@ -603,7 +605,55 @@ assert_almost_equal(prob90c, 1., decimal=14) + def test_hypergeom(self): + #test case with finite bounds + #without specifying bounds + m_true, v_true = stats.hypergeom.stats(20, 10, 8, loc=5.) + m = stats.hypergeom.expect(lambda x: x, args=(20, 10, 8), loc=5.) + assert_almost_equal(m, m_true, decimal=14) + + v = stats.hypergeom.expect(lambda x: (x-9.)**2, args=(20, 10, 8), + loc=5.) + assert_almost_equal(v, v_true, decimal=14) + + #with bounds, bounds equal to shifted support + v_bounds = stats.hypergeom.expect(lambda x: (x-9.)**2, args=(20, 10, 8), + loc=5., lb=5, ub=13) + assert_almost_equal(v_bounds, v_true, decimal=14) + + #drop boundary points + prob_true = 1-stats.hypergeom.pmf([5, 13], 20, 10, 8, loc=5).sum() + prob_bounds = stats.hypergeom.expect(lambda x: 1, args=(20, 10, 8), + loc=5., lb=6, ub=12) + assert_almost_equal(prob_bounds, prob_true, decimal=14) + + #conditional + prob_bc = stats.hypergeom.expect(lambda x: 1, args=(20, 10, 8), loc=5., + lb=6, ub=12, conditional=True) + assert_almost_equal(prob_bc, 1, decimal=14) + + #check simple integral + prob_b = stats.hypergeom.expect(lambda x: 1, args=(20, 10, 8), + lb=0, ub=8) + assert_almost_equal(prob_b, 1, decimal=14) + + def test_poisson(self): + #poisson, use lower bound only + prob_bounds = stats.poisson.expect(lambda x: 1, args=(2,), lb=3, + conditional=False) + prob_b_true = 1-stats.poisson.cdf(2,2) + assert_almost_equal(prob_bounds, prob_b_true, decimal=14) + + + prob_lb = stats.poisson.expect(lambda x: 1, args=(2,), lb=2, + conditional=True) + assert_almost_equal(prob_lb, 1, decimal=14) + + + + + def test_regression_ticket_1316(): """Regression test for ticket #1316.""" # The following was raising an exception, because _construct_default_doc() From scipy-svn at scipy.org Sat Jan 15 09:02:49 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Jan 2011 08:02:49 -0600 (CST) Subject: [Scipy-svn] r7045 - branches/0.9.x/scipy/stats Message-ID: <20110115140249.7F62C1B8BFF@scipy.org> Author: rgommers Date: 2011-01-15 08:02:49 -0600 (Sat, 15 Jan 2011) New Revision: 7045 Modified: branches/0.9.x/scipy/stats/distributions.py Log: distributions beta_gen, don't use math, exception in ticket:1276 Modified: branches/0.9.x/scipy/stats/distributions.py =================================================================== --- branches/0.9.x/scipy/stats/distributions.py 2011-01-15 14:02:23 UTC (rev 7044) +++ branches/0.9.x/scipy/stats/distributions.py 2011-01-15 14:02:49 UTC (rev 7045) @@ -2017,7 +2017,7 @@ g2 = _kurtosis(data) def func(x): a, b = x - sk = 2*(b-a)*math.sqrt(a + b + 1) / (a + b + 2) / math.sqrt(a*b) + sk = 2*(b-a)*sqrt(a + b + 1) / (a + b + 2) / sqrt(a*b) ku = a**3 - a**2*(2*b-1) + b**2*(b+1) - 2*a*b*(b+2) ku /= a*b*(a+b+2)*(a+b+3) ku *= 6 From scipy-svn at scipy.org Sat Jan 15 09:03:17 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Jan 2011 08:03:17 -0600 (CST) Subject: [Scipy-svn] r7046 - branches/0.9.x/scipy/stats Message-ID: <20110115140317.20D8D36346@scipy.org> Author: rgommers Date: 2011-01-15 08:03:16 -0600 (Sat, 15 Jan 2011) New Revision: 7046 Modified: branches/0.9.x/scipy/stats/distributions.py Log: stats.distributions, handle case with no goodargs everywhere, ticket:1291 Modified: branches/0.9.x/scipy/stats/distributions.py =================================================================== --- branches/0.9.x/scipy/stats/distributions.py 2011-01-15 14:02:49 UTC (rev 7045) +++ branches/0.9.x/scipy/stats/distributions.py 2011-01-15 14:03:16 UTC (rev 7046) @@ -1107,9 +1107,10 @@ cond = cond0 & cond1 output = zeros(shape(cond),'d') putmask(output,(1-cond0)*array(cond1,bool),self.badvalue) - goodargs = argsreduce(cond, *((x,)+args+(scale,))) - scale, goodargs = goodargs[-1], goodargs[:-1] - place(output,cond,self._pdf(*goodargs) / scale) + if any(cond): + goodargs = argsreduce(cond, *((x,)+args+(scale,))) + scale, goodargs = goodargs[-1], goodargs[:-1] + place(output,cond,self._pdf(*goodargs) / scale) if output.ndim == 0: return output[()] return output @@ -1149,9 +1150,10 @@ output = empty(shape(cond),'d') output.fill(NINF) putmask(output,(1-cond0)*array(cond1,bool),self.badvalue) - goodargs = argsreduce(cond, *((x,)+args+(scale,))) - scale, goodargs = goodargs[-1], goodargs[:-1] - place(output,cond,self._logpdf(*goodargs) - log(scale)) + if any(cond): + goodargs = argsreduce(cond, *((x,)+args+(scale,))) + scale, goodargs = goodargs[-1], goodargs[:-1] + place(output,cond,self._logpdf(*goodargs) - log(scale)) if output.ndim == 0: return output[()] return output @@ -1274,8 +1276,9 @@ output = zeros(shape(cond),'d') place(output,(1-cond0)*(cond1==cond1),self.badvalue) place(output,cond2,1.0) - goodargs = argsreduce(cond, *((x,)+args)) - place(output,cond,self._sf(*goodargs)) + if any(cond): + goodargs = argsreduce(cond, *((x,)+args)) + place(output,cond,self._sf(*goodargs)) if output.ndim == 0: return output[()] return output @@ -1314,8 +1317,9 @@ output.fill(NINF) place(output,(1-cond0)*(cond1==cond1),self.badvalue) place(output,cond2,0.0) - goodargs = argsreduce(cond, *((x,)+args)) - place(output,cond,self._logsf(*goodargs)) + if any(cond): + goodargs = argsreduce(cond, *((x,)+args)) + place(output,cond,self._logsf(*goodargs)) if output.ndim == 0: return output[()] return output @@ -5029,8 +5033,9 @@ cond = cond0 & cond1 output = zeros(shape(cond),'d') place(output,(1-cond0)*(cond1==cond1),self.badvalue) - goodargs = argsreduce(cond, *((k,)+args)) - place(output,cond,self._pmf(*goodargs)) + if any(cond): + goodargs = argsreduce(cond, *((k,)+args)) + place(output,cond,self._pmf(*goodargs)) if output.ndim == 0: return output[()] return output @@ -5067,8 +5072,9 @@ output = empty(shape(cond),'d') output.fill(NINF) place(output,(1-cond0)*(cond1==cond1),self.badvalue) - goodargs = argsreduce(cond, *((k,)+args)) - place(output,cond,self._logpmf(*goodargs)) + if any(cond): + goodargs = argsreduce(cond, *((k,)+args)) + place(output,cond,self._logpmf(*goodargs)) if output.ndim == 0: return output[()] return output @@ -5186,8 +5192,9 @@ output = zeros(shape(cond),'d') place(output,(1-cond0)*(cond1==cond1),self.badvalue) place(output,cond2,1.0) - goodargs = argsreduce(cond, *((k,)+args)) - place(output,cond,self._sf(*goodargs)) + if any(cond): + goodargs = argsreduce(cond, *((k,)+args)) + place(output,cond,self._sf(*goodargs)) if output.ndim == 0: return output[()] return output @@ -5225,8 +5232,9 @@ output.fill(NINF) place(output,(1-cond0)*(cond1==cond1),self.badvalue) place(output,cond2,0.0) - goodargs = argsreduce(cond, *((k,)+args)) - place(output,cond,self._logsf(*goodargs)) + if any(cond): + goodargs = argsreduce(cond, *((k,)+args)) + place(output,cond,self._logsf(*goodargs)) if output.ndim == 0: return output[()] return output From scipy-svn at scipy.org Sat Jan 15 09:03:49 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Jan 2011 08:03:49 -0600 (CST) Subject: [Scipy-svn] r7047 - branches/0.9.x/scipy/stats Message-ID: <20110115140349.082DF3634D@scipy.org> Author: rgommers Date: 2011-01-15 08:03:48 -0600 (Sat, 15 Jan 2011) New Revision: 7047 Modified: branches/0.9.x/scipy/stats/distributions.py Log: stats.distributions, correction so that stats and moment method don't break with empty goodargs, see ticket:934 and ticket:1291 Modified: branches/0.9.x/scipy/stats/distributions.py =================================================================== --- branches/0.9.x/scipy/stats/distributions.py 2011-01-15 14:03:16 UTC (rev 7046) +++ branches/0.9.x/scipy/stats/distributions.py 2011-01-15 14:03:48 UTC (rev 7047) @@ -1470,59 +1470,65 @@ output = [] # Use only entries that are valid in calculation - goodargs = argsreduce(cond, *(args+(scale,loc))) - scale, loc, goodargs = goodargs[-2], goodargs[-1], goodargs[:-2] - if 'm' in moments: - if mu is None: - mu = self._munp(1.0,*goodargs) - out0 = default.copy() - place(out0,cond,mu*scale+loc) - output.append(out0) - - if 'v' in moments: - if mu2 is None: - mu2p = self._munp(2.0,*goodargs) + if any(cond): + goodargs = argsreduce(cond, *(args+(scale,loc))) + scale, loc, goodargs = goodargs[-2], goodargs[-1], goodargs[:-2] + if 'm' in moments: if mu is None: mu = self._munp(1.0,*goodargs) - mu2 = mu2p - mu*mu - if np.isinf(mu): - #if mean is inf then var is also inf - mu2 = np.inf - out0 = default.copy() - place(out0,cond,mu2*scale*scale) - output.append(out0) + out0 = default.copy() + place(out0,cond,mu*scale+loc) + output.append(out0) - if 's' in moments: - if g1 is None: - mu3p = self._munp(3.0,*goodargs) - if mu is None: - mu = self._munp(1.0,*goodargs) + if 'v' in moments: if mu2 is None: mu2p = self._munp(2.0,*goodargs) + if mu is None: + mu = self._munp(1.0,*goodargs) mu2 = mu2p - mu*mu - mu3 = mu3p - 3*mu*mu2 - mu**3 - g1 = mu3 / mu2**1.5 - out0 = default.copy() - place(out0,cond,g1) - output.append(out0) + if np.isinf(mu): + #if mean is inf then var is also inf + mu2 = np.inf + out0 = default.copy() + place(out0,cond,mu2*scale*scale) + output.append(out0) - if 'k' in moments: - if g2 is None: - mu4p = self._munp(4.0,*goodargs) - if mu is None: - mu = self._munp(1.0,*goodargs) - if mu2 is None: - mu2p = self._munp(2.0,*goodargs) - mu2 = mu2p - mu*mu - if mu3 is None: + if 's' in moments: + if g1 is None: mu3p = self._munp(3.0,*goodargs) + if mu is None: + mu = self._munp(1.0,*goodargs) + if mu2 is None: + mu2p = self._munp(2.0,*goodargs) + mu2 = mu2p - mu*mu mu3 = mu3p - 3*mu*mu2 - mu**3 - mu4 = mu4p - 4*mu*mu3 - 6*mu*mu*mu2 - mu**4 - g2 = mu4 / mu2**2.0 - 3.0 - out0 = default.copy() - place(out0,cond,g2) - output.append(out0) + g1 = mu3 / mu2**1.5 + out0 = default.copy() + place(out0,cond,g1) + output.append(out0) + if 'k' in moments: + if g2 is None: + mu4p = self._munp(4.0,*goodargs) + if mu is None: + mu = self._munp(1.0,*goodargs) + if mu2 is None: + mu2p = self._munp(2.0,*goodargs) + mu2 = mu2p - mu*mu + if mu3 is None: + mu3p = self._munp(3.0,*goodargs) + mu3 = mu3p - 3*mu*mu2 - mu**3 + mu4 = mu4p - 4*mu*mu3 - 6*mu*mu*mu2 - mu**4 + g2 = mu4 / mu2**2.0 - 3.0 + out0 = default.copy() + place(out0,cond,g2) + output.append(out0) + else: #no valid args + output = [] + for _ in moments: + out0 = default.copy() + output.append(out0) + if len(output) == 1: return output[0] else: @@ -1542,6 +1548,8 @@ instance object for more information) """ + if not self._argcheck(*args): + return nan if (floor(n) != n): raise ValueError("Moment must be an integer.") if (n < 0): raise ValueError("Moment must be positive.") From scipy-svn at scipy.org Sat Jan 15 09:04:18 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Jan 2011 08:04:18 -0600 (CST) Subject: [Scipy-svn] r7048 - branches/0.9.x/scipy/stats Message-ID: <20110115140418.D60FA36346@scipy.org> Author: rgommers Date: 2011-01-15 08:04:18 -0600 (Sat, 15 Jan 2011) New Revision: 7048 Modified: branches/0.9.x/scipy/stats/distributions.py Log: stats.distributions, add argcheck to moment method, fixes ticket:934 Modified: branches/0.9.x/scipy/stats/distributions.py =================================================================== --- branches/0.9.x/scipy/stats/distributions.py 2011-01-15 14:03:48 UTC (rev 7047) +++ branches/0.9.x/scipy/stats/distributions.py 2011-01-15 14:04:18 UTC (rev 7048) @@ -5464,6 +5464,8 @@ instance object for more information) """ + if not self._argcheck(*args): + return nan if (floor(n) != n): raise ValueError("Moment must be an integer.") if (n < 0): raise ValueError("Moment must be positive.") From scipy-svn at scipy.org Sat Jan 15 09:05:17 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Jan 2011 08:05:17 -0600 (CST) Subject: [Scipy-svn] r7049 - in branches/0.9.x/scipy/stats: . tests Message-ID: <20110115140517.C3A9D3634D@scipy.org> Author: rgommers Date: 2011-01-15 08:05:17 -0600 (Sat, 15 Jan 2011) New Revision: 7049 Modified: branches/0.9.x/scipy/stats/distributions.py branches/0.9.x/scipy/stats/tests/test_distributions.py Log: stats distribution chi2.pdf work around 0*log(0)==nan, ticket:1326 Modified: branches/0.9.x/scipy/stats/distributions.py =================================================================== --- branches/0.9.x/scipy/stats/distributions.py 2011-01-15 14:04:18 UTC (rev 7048) +++ branches/0.9.x/scipy/stats/distributions.py 2011-01-15 14:05:17 UTC (rev 7049) @@ -2267,7 +2267,10 @@ def _pdf(self, x, df): return exp(self._logpdf(x, df)) def _logpdf(self, x, df): - return (df/2.-1)*log(x)-x/2.-gamln(df/2.)-(log(2)*df)/2. + #term1 = (df/2.-1)*log(x) + #term1[(df==2)*(x==0)] = 0 + #avoid 0*log(0)==nan + return (df/2.-1)*log(x+1e-300) - x/2. - gamln(df/2.) - (log(2)*df)/2. ## Px = x**(df/2.0-1)*exp(-x/2.0) ## Px /= special.gamma(df/2.0)* 2**(df/2.0) ## return log(Px) Modified: branches/0.9.x/scipy/stats/tests/test_distributions.py =================================================================== --- branches/0.9.x/scipy/stats/tests/test_distributions.py 2011-01-15 14:04:18 UTC (rev 7048) +++ branches/0.9.x/scipy/stats/tests/test_distributions.py 2011-01-15 14:05:17 UTC (rev 7049) @@ -661,5 +661,11 @@ g = stats.distributions.gamma_gen(name='gamma') +def test_regression_ticket_1326(): + """Regression test for ticket #1326.""" + #adjust to avoid nan with 0*log(0) + assert_almost_equal(stats.chi2.pdf(0.0, 2), 0.5, 14) + + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Sat Jan 15 09:45:36 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Jan 2011 08:45:36 -0600 (CST) Subject: [Scipy-svn] r7050 - in trunk: doc/source scipy/odr scipy/optimize scipy/spatial scipy/special scipy/stats scipy/weave Message-ID: <20110115144536.1EF5B3233A@scipy.org> Author: rgommers Date: 2011-01-15 08:45:35 -0600 (Sat, 15 Jan 2011) New Revision: 7050 Modified: trunk/doc/source/io.rst trunk/doc/source/maxentropy.rst trunk/doc/source/release.rst trunk/doc/source/sparse.rst trunk/doc/source/stats.mstats.rst trunk/doc/source/stats.rst trunk/scipy/odr/odrpack.py trunk/scipy/optimize/anneal.py trunk/scipy/spatial/distance.py trunk/scipy/spatial/kdtree.py trunk/scipy/special/basic.py trunk/scipy/stats/info.py trunk/scipy/weave/catalog.py Log: BUG: fix doc build. Some irregular indentation caused LaTeX errors. Also fix a lot of warnings in the doc build. The errors came from the Output class in odrpack.py and were of the following nature: "Perhaps a missing \item \cr \end{tabular} " Modified: trunk/doc/source/io.rst =================================================================== --- trunk/doc/source/io.rst 2011-01-15 14:05:17 UTC (rev 7049) +++ trunk/doc/source/io.rst 2011-01-15 14:45:35 UTC (rev 7050) @@ -32,7 +32,6 @@ :toctree: generated/ save_as_module - npfile Wav sound files (:mod:`scipy.io.wavfile`) ========================================= Modified: trunk/doc/source/maxentropy.rst =================================================================== --- trunk/doc/source/maxentropy.rst 2011-01-15 14:05:17 UTC (rev 7049) +++ trunk/doc/source/maxentropy.rst 2011-01-15 14:45:35 UTC (rev 7050) @@ -66,6 +66,8 @@ Utilities ========= +.. automodule:: scipy.maxentropy.maxentutils + .. autosummary:: :toctree: generated/ Modified: trunk/doc/source/release.rst =================================================================== --- trunk/doc/source/release.rst 2011-01-15 14:05:17 UTC (rev 7049) +++ trunk/doc/source/release.rst 2011-01-15 14:45:35 UTC (rev 7050) @@ -10,5 +10,3 @@ release.0.7.2 release.0.7.1 release.0.7.0 - -.. include:: ../release/0.9.0-notes.rst Modified: trunk/doc/source/sparse.rst =================================================================== --- trunk/doc/source/sparse.rst 2011-01-15 14:05:17 UTC (rev 7049) +++ trunk/doc/source/sparse.rst 2011-01-15 14:45:35 UTC (rev 7050) @@ -32,8 +32,6 @@ identity kron kronsum - lil_eye - lil_diags spdiags tril triu Modified: trunk/doc/source/stats.mstats.rst =================================================================== --- trunk/doc/source/stats.mstats.rst 2011-01-15 14:05:17 UTC (rev 7049) +++ trunk/doc/source/stats.mstats.rst 2011-01-15 14:45:35 UTC (rev 7050) @@ -46,16 +46,12 @@ plotting_positions pointbiserialr rankdata - samplestd - samplevar scoreatpercentile sem signaltonoise skew skewtest spearmanr - std - stderr theilslopes threshold tmax @@ -73,9 +69,7 @@ ttest_onesamp ttest_rel tvar - var variation winsorize - z zmap - zs + zscore Modified: trunk/doc/source/stats.rst =================================================================== --- trunk/doc/source/stats.rst 2011-01-15 14:05:17 UTC (rev 7049) +++ trunk/doc/source/stats.rst 2011-01-15 14:45:35 UTC (rev 7050) @@ -1,9 +1,9 @@ -.. module:: scipy.stats - ========================================== Statistical functions (:mod:`scipy.stats`) ========================================== +.. module:: scipy.stats + This module contains a large number of probability distributions as well as a growing library of statistical functions. @@ -62,8 +62,6 @@ foldcauchy f foldnorm - fretchet_r - fretcher_l genlogistic genpareto genexpon @@ -113,7 +111,7 @@ truncnorm tukeylambda uniform - von_mises + vonmises wald weibull_min weibull_max @@ -151,9 +149,7 @@ gmean hmean - mean cmedian - median mode tmean tvar @@ -186,16 +182,9 @@ :toctree: generated/ obrientransform - samplevar - samplestd signaltonoise bayes_mvs - var - std - stderr sem - z - zs zmap zscore @@ -205,8 +194,6 @@ threshold trimboth trim1 - cov - corrcoef .. autosummary:: :toctree: generated/ @@ -252,7 +239,6 @@ :toctree: generated/ glm - anova Plot-tests ========== Modified: trunk/scipy/odr/odrpack.py =================================================================== --- trunk/scipy/odr/odrpack.py 2011-01-15 14:05:17 UTC (rev 7049) +++ trunk/scipy/odr/odrpack.py 2011-01-15 14:45:35 UTC (rev 7050) @@ -536,54 +536,50 @@ The Output class stores the output of an ODR run. Takes one argument for initialization, the return value from the - function odr. + function `odr`. Attributes ---------- - beta : - estimated parameter values [beta.shape == (q,)] - sd_beta : - standard errors of the estimated parameters - [sd_beta.shape == (p,)] - cov_beta : - covariance matrix of the estimated parameters - [cov_beta.shape == (p, p)] + beta : ndarray + Estimated parameter values, of shape (q,). + sd_beta : ndarray + Standard errors of the estimated parameters, of shape (p,). + cov_beta : ndarray + Covariance matrix of the estimated parameters, of shape (p,p). + delta : ndarray, optional + Array of estimated errors in input variables, of same shape as `x`. + eps : ndarray, optional + Array of estimated errors in response variables, of same shape as `y`. + xplus : ndarray, optional + Array of ``x + delta``. + y : ndarray, optional + Array ``y = fcn(x + delta)``. + res_var : float, optional + Residual variance. + sum_sqare : float, optional + Sum of squares error. + sum_square_delta : float, optional + Sum of squares of delta error. + sum_square_eps : float, optional + Sum of squares of eps error. + inv_condnum : float, optional + Inverse condition number (cf. ODRPACK UG p. 77). + rel_error : float, optional + Relative error in function values computed within fcn. + work : ndarray, optional + Final work array. + work_ind : dict, optional + Indices into work for drawing out values (cf. ODRPACK UG p. 83). + info : int, optional + Reason for returning, as output by ODRPACK (cf. ODRPACK UG p. 38). + stopreason : list of str, optional + `info` interpreted into English. - Following are present if odr() was run with "full_output=1". + Notes + ----- + The attributes listed as "optional" above are only present if `odr` was run + with ``full_output=1``. - delta : - array of estimated errors in input variables - [delta.shape == data.x.shape] - eps : - array of estimated errors in response variables - [eps.shape == data.y.shape] - xplus : - array of x + delta [xplus.shape == data.x.shape] - y : - array of y = fcn(x + delta) [y.shape == data.y.shape] - res_var : float - residual variance - sum_sqare : float - sum of squares error - sum_square_delta : float - sum of squares of delta error - sum_square_eps : float - sum of squares of eps error - inv_condnum : float - inverse condition number (cf. ODRPACK UG p. 77) - rel_error : float - relative error in function values computed within fcn - work : ndarray - final work array - work_ind : dictionary - indices into work for drawing out values - (cf. ODRPACK UG p. 83) - info : int - reason for returning (as output by ODRPACK) - (cf. ODRPACK UG p. 38) - stopreason : list of strings - "info" interpreted into English - """ def __init__(self, output): Modified: trunk/scipy/optimize/anneal.py =================================================================== --- trunk/scipy/optimize/anneal.py 2011-01-15 14:05:17 UTC (rev 7049) +++ trunk/scipy/optimize/anneal.py 2011-01-15 14:45:35 UTC (rev 7050) @@ -198,7 +198,7 @@ dwell : int The number of times to search the space at each temperature. - Outputs + Returns ------- xmin : ndarray Point giving smallest value found. Modified: trunk/scipy/spatial/distance.py =================================================================== --- trunk/scipy/spatial/distance.py 2011-01-15 14:05:17 UTC (rev 7049) +++ trunk/scipy/spatial/distance.py 2011-01-15 14:45:35 UTC (rev 7050) @@ -160,17 +160,19 @@ {||u-v||}_p = (\sum{|u_i - v_i|^p})^{1/p}. - :Parameters: - u : ndarray - An n-dimensional vector. - v : ndarray - An n-dimensional vector. - p : ndarray - The norm of the difference :math:`{||u-v||}_p`. + Parameters + ---------- + u : ndarray + An n-dimensional vector. + v : ndarray + An n-dimensional vector. + p : ndarray + The norm of the difference :math:`{||u-v||}_p`. - :Returns: - d : double - The Minkowski distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Minkowski distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -187,19 +189,21 @@ \left(\sum{(w_i |u_i - v_i|^p)}\right)^{1/p}. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. - p : ndarray - The norm of the difference :math:`{||u-v||}_p`. - w : ndarray - The weight vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. + p : ndarray + The norm of the difference :math:`{||u-v||}_p`. + w : ndarray + The weight vector. - :Returns: - d : double - The Minkowski distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Minkowski distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -217,15 +221,17 @@ {||u-v||}_2 - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Euclidean distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Euclidean distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -242,15 +248,17 @@ {||u-v||}_2^2. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The squared Euclidean distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The squared Euclidean distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -266,15 +274,17 @@ \frac{1-uv^T} {||u||_2 ||v||_2}. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Cosine distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Cosine distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -294,15 +304,17 @@ where :math:`\bar{u}` is the mean of a vectors elements and ``n`` is the common dimensionality of ``u`` and ``v``. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The correlation distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The correlation distance between vectors ``u`` and ``v``. """ umu = u.mean() vmu = v.mean() @@ -327,15 +339,17 @@ :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for :math:`k < n`. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Hamming distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Hamming distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -355,15 +369,17 @@ :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for :math:`k < n`. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Jaccard distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Jaccard distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -385,15 +401,17 @@ :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for :math:`k < n`. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Kulsinski distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Kulsinski distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -409,15 +427,17 @@ variances. It is usually computed among a larger collection vectors. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The standardized Euclidean distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The standardized Euclidean distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -435,15 +455,17 @@ \sum_i {(u_i-v_i)}. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The City Block distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The City Block distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -460,15 +482,17 @@ where ``VI`` is the inverse covariance matrix :math:`V^{-1}`. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Mahalanobis distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Mahalanobis distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -484,15 +508,17 @@ \max_i {|u_i-v_i|}. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Chebyshev distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Chebyshev distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -507,15 +533,17 @@ \sum{|u_i-v_i|} / \sum{|u_i+v_i|}. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Bray-Curtis distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Bray-Curtis distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -532,15 +560,17 @@ {\sum_i {|u_i|+|v_i|}}. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Canberra distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Canberra distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -596,15 +626,17 @@ :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for :math:`k < n` and :math:`R = 2.0 * (c_{TF} + c_{FT})`. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Yule dissimilarity between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Yule dissimilarity between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -624,15 +656,17 @@ :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for :math:`k < n`. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Matching dissimilarity between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Matching dissimilarity between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -653,15 +687,17 @@ :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for :math:`k < n`. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Dice dissimilarity between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Dice dissimilarity between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -685,16 +721,18 @@ :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for :math:`k < n` and :math:`R = 2(c_{TF} + c_{FT})`. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Rogers-Tanimoto dissimilarity between vectors - ``u`` and ``v``. + Returns + ------- + d : double + The Rogers-Tanimoto dissimilarity between vectors + `u` and `v`. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -715,15 +753,17 @@ :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for :math:`k < n`. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Russell-Rao dissimilarity between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Russell-Rao dissimilarity between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -748,15 +788,17 @@ :math:`k < n`, :math:`R = 2 * (c_{TF} + c_{FT})` and :math:`S = c_{FF} + c_{TT}`. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Sokal-Michener dissimilarity between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Sokal-Michener dissimilarity between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -783,15 +825,17 @@ :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for :math:`k < n` and :math:`R = 2(c_{TF} + c_{FT})`. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Sokal-Sneath dissimilarity between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Sokal-Sneath dissimilarity between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -999,34 +1043,36 @@ dm = pdist(X, 'sokalsneath') - :Parameters: - X : ndarray - An m by n array of m original observations in an - n-dimensional space. - metric : string or function - The distance metric to use. The distance function can - be 'braycurtis', 'canberra', 'chebyshev', 'cityblock', - 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', - 'jaccard', 'kulsinski', 'mahalanobis', 'matching', - 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', - 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule'. - w : ndarray - The weight vector (for weighted Minkowski). - p : double - The p-norm to apply (for Minkowski, weighted and unweighted) - V : ndarray - The variance vector (for standardized Euclidean). - VI : ndarray - The inverse of the covariance matrix (for Mahalanobis). + Parameters + ---------- + X : ndarray + An m by n array of m original observations in an + n-dimensional space. + metric : string or function + The distance metric to use. The distance function can + be 'braycurtis', 'canberra', 'chebyshev', 'cityblock', + 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', + 'jaccard', 'kulsinski', 'mahalanobis', 'matching', + 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', + 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule'. + w : ndarray + The weight vector (for weighted Minkowski). + p : double + The p-norm to apply (for Minkowski, weighted and unweighted) + V : ndarray + The variance vector (for standardized Euclidean). + VI : ndarray + The inverse of the covariance matrix (for Mahalanobis). - :Returns: - Y : ndarray - A condensed distance matrix. + Returns + ------- + Y : ndarray + A condensed distance matrix. - :SeeAlso: - - squareform : converts between condensed distance matrices and - square distance matrices. + See Also + -------- + squareform : converts between condensed distance matrices and + square distance matrices. """ @@ -1239,11 +1285,13 @@ Converts a vector-form distance vector to a square-form distance matrix, and vice-versa. - :Parameters: + Parameters + ---------- X : ndarray Either a condensed or redundant distance matrix. - :Returns: + Returns + ------- Y : ndarray If a condensed distance matrix is passed, a redundant one is returned, or if a redundant one is passed, a @@ -1358,31 +1406,33 @@ Distance matrices must be 2-dimensional numpy arrays containing doubles. They must have a zero-diagonal, and they must be symmetric. - :Parameters: - D : ndarray - The candidate object to test for validity. - tol : double - The distance matrix should be symmetric. tol is the maximum - difference between the :math:`ij`th entry and the - :math:`ji`th entry for the distance metric to be - considered symmetric. - throw : bool - An exception is thrown if the distance matrix passed is not - valid. - name : string - the name of the variable to checked. This is useful ifa - throw is set to ``True`` so the offending variable can be - identified in the exception message when an exception is - thrown. - warning : boolx - Instead of throwing an exception, a warning message is - raised. + Parameters + ---------- + D : ndarray + The candidate object to test for validity. + tol : double + The distance matrix should be symmetric. tol is the maximum + difference between the :math:`ij`th entry and the + :math:`ji`th entry for the distance metric to be + considered symmetric. + throw : bool + An exception is thrown if the distance matrix passed is not + valid. + name : string + the name of the variable to checked. This is useful ifa + throw is set to ``True`` so the offending variable can be + identified in the exception message when an exception is + thrown. + warning : boolx + Instead of throwing an exception, a warning message is + raised. - :Returns: - Returns ``True`` if the variable ``D`` passed is a valid - distance matrix. Small numerical differences in ``D`` and - ``D.T`` and non-zeroness of the diagonal are ignored if they are - within the tolerance specified by ``tol``. + Returns + ------- + Returns ``True`` if the variable ``D`` passed is a valid + distance matrix. Small numerical differences in ``D`` and + ``D.T`` and non-zeroness of the diagonal are ignored if they are + within the tolerance specified by ``tol``. """ D = np.asarray(D, order='c') valid = True @@ -1436,24 +1486,22 @@ coefficient :math:`{n \choose 2}` for some positive integer n. - :Parameters: - y : ndarray - The condensed distance matrix. + Parameters + ---------- + y : ndarray + The condensed distance matrix. + warning : bool, optional + Invokes a warning if the variable passed is not a valid + condensed distance matrix. The warning message explains why + the distance matrix is not valid. 'name' is used when + referencing the offending variable. + throws : throw, optional + Throws an exception if the variable passed is not a valid + condensed distance matrix. + name : bool, optional + Used when referencing the offending variable in the + warning or exception message. - warning : bool - Invokes a warning if the variable passed is not a valid - condensed distance matrix. The warning message explains why - the distance matrix is not valid. 'name' is used when - referencing the offending variable. - - throws : throw - Throws an exception if the variable passed is not a valid - condensed distance matrix. - - name : bool - Used when referencing the offending variable in the - warning or exception message. - """ y = np.asarray(y, order='c') valid = True @@ -1493,12 +1541,15 @@ Returns the number of original observations that correspond to a square, redudant distance matrix ``D``. - :Parameters: - d : ndarray - The target distance matrix. + Parameters + ---------- + d : ndarray + The target distance matrix. - :Returns: - The number of observations in the redundant distance matrix. + Returns + ------- + numobs : int + The number of observations in the redundant distance matrix. """ d = np.asarray(d, order='c') is_valid_dm(d, tol=np.inf, throw=True, name='d') @@ -1509,15 +1560,17 @@ Returns the number of original observations that correspond to a condensed distance matrix ``Y``. - :Parameters: - Y : ndarray - The number of original observations in the condensed - observation ``Y``. + Parameters + ---------- + Y : ndarray + The number of original observations in the condensed + observation ``Y``. - :Returns: - n : int - The number of observations in the condensed distance matrix - passed. + Returns + ------- + n : int + The number of observations in the condensed distance matrix + passed. """ Y = np.asarray(Y, order='c') is_valid_y(Y, throw=True, name='Y') @@ -1727,34 +1780,36 @@ dm = cdist(XA, XB, 'sokalsneath') - :Parameters: - XA : ndarray - An :math:`m_A` by :math:`n` array of :math:`m_A` - original observations in an :math:`n`-dimensional space. - XB : ndarray - An :math:`m_B` by :math:`n` array of :math:`m_B` - original observations in an :math:`n`-dimensional space. - metric : string or function - The distance metric to use. The distance function can - be 'braycurtis', 'canberra', 'chebyshev', 'cityblock', - 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', - 'jaccard', 'kulsinski', 'mahalanobis', 'matching', - 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', - 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'wminkowski', - 'yule'. - w : ndarray - The weight vector (for weighted Minkowski). - p : double - The p-norm to apply (for Minkowski, weighted and unweighted) - V : ndarray - The variance vector (for standardized Euclidean). - VI : ndarray - The inverse of the covariance matrix (for Mahalanobis). + Parameters + ---------- + XA : ndarray + An :math:`m_A` by :math:`n` array of :math:`m_A` + original observations in an :math:`n`-dimensional space. + XB : ndarray + An :math:`m_B` by :math:`n` array of :math:`m_B` + original observations in an :math:`n`-dimensional space. + metric : string or function + The distance metric to use. The distance function can + be 'braycurtis', 'canberra', 'chebyshev', 'cityblock', + 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', + 'jaccard', 'kulsinski', 'mahalanobis', 'matching', + 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', + 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'wminkowski', + 'yule'. + w : ndarray + The weight vector (for weighted Minkowski). + p : double + The p-norm to apply (for Minkowski, weighted and unweighted) + V : ndarray + The variance vector (for standardized Euclidean). + VI : ndarray + The inverse of the covariance matrix (for Mahalanobis). - :Returns: - Y : ndarray - A :math:`m_A` by :math:`m_B` distance matrix. + Returns + ------- + Y : ndarray + A :math:`m_A` by :math:`m_B` distance matrix. """ Modified: trunk/scipy/spatial/kdtree.py =================================================================== --- trunk/scipy/spatial/kdtree.py 2011-01-15 14:05:17 UTC (rev 7049) +++ trunk/scipy/spatial/kdtree.py 2011-01-15 14:45:35 UTC (rev 7050) @@ -116,13 +116,12 @@ def __init__(self, data, leafsize=10): """Construct a kd-tree. - Parameters: - =========== - - data : array-like, shape (n,k) + Parameters + ---------- + data : array_like, shape (n,k) The data points to be indexed. This array is not copied, and so modifying this data will result in bogus results. - leafsize : positive integer + leafsize : positive int The number of points at which the algorithm switches over to brute-force. """ Modified: trunk/scipy/special/basic.py =================================================================== --- trunk/scipy/special/basic.py 2011-01-15 14:05:17 UTC (rev 7049) +++ trunk/scipy/special/basic.py 2011-01-15 14:45:35 UTC (rev 7050) @@ -59,16 +59,22 @@ """Compute nt (<=1200) zeros of the bessel functions Jn and Jn' and arange them in order of their magnitudes. - Outputs (all are arrays of length nt): + Returns + ------- + zo[l-1] : ndarray + Value of the lth zero of of Jn(x) and Jn'(x). Of length `nt`. + n[l-1] : ndarray + Order of the Jn(x) or Jn'(x) associated with lth zero. Of length `nt`. + m[l-1] : ndarray + Serial number of the zeros of Jn(x) or Jn'(x) associated + with lth zero. Of length `nt`. + t[l-1] : ndarray + 0 if lth zero in zo is zero of Jn(x), 1 if it is a zero of Jn'(x). Of + length `nt`. - zo[l-1] -- Value of the lth zero of of Jn(x) and Jn'(x) - n[l-1] -- Order of the Jn(x) or Jn'(x) associated with lth zero - m[l-1] -- Serial number of the zeros of Jn(x) or Jn'(x) associated - with lth zero. - t[l-1] -- 0 if lth zero in zo is zero of Jn(x), 1 if it is a zero - of Jn'(x) - - See jn_zeros, jnp_zeros to get separated arrays of zeros. + See Also + -------- + jn_zeros, jnp_zeros : to get separated arrays of zeros. """ if not isscalar(nt) or (floor(nt)!=nt) or (nt>1200): raise ValueError("Number must be integer <= 1200.") @@ -521,7 +527,7 @@ Pmn_z : (m+1, n+1) array Values for all orders 0..m and degrees 0..n Pmn_d_z : (m+1, n+1) array - Derivatives for all orders 0..m and degrees 0..n + Derivatives for all orders 0..m and degrees 0..n """ if not isscalar(m) or (abs(m)>n): raise ValueError("m must be <= n.") @@ -636,12 +642,12 @@ """Compute the zeros of Airy Functions Ai(x) and Ai'(x), a and a' respectively, and the associated values of Ai(a') and Ai'(a). - Outputs: - - a[l-1] -- the lth zero of Ai(x) - ap[l-1] -- the lth zero of Ai'(x) - ai[l-1] -- Ai(ap[l-1]) - aip[l-1] -- Ai'(a[l-1]) + Returns + ------- + a[l-1] -- the lth zero of Ai(x) + ap[l-1] -- the lth zero of Ai'(x) + ai[l-1] -- Ai(ap[l-1]) + aip[l-1] -- Ai'(a[l-1]) """ kf = 1 if not isscalar(nt) or (floor(nt)!=nt) or (nt<=0): @@ -652,12 +658,12 @@ """Compute the zeros of Airy Functions Bi(x) and Bi'(x), b and b' respectively, and the associated values of Ai(b') and Ai'(b). - Outputs: - - b[l-1] -- the lth zero of Bi(x) - bp[l-1] -- the lth zero of Bi'(x) - bi[l-1] -- Bi(bp[l-1]) - bip[l-1] -- Bi'(b[l-1]) + Returns + ------- + b[l-1] -- the lth zero of Bi(x) + bp[l-1] -- the lth zero of Bi'(x) + bi[l-1] -- Bi(bp[l-1]) + bip[l-1] -- Bi'(b[l-1]) """ kf = 2 if not isscalar(nt) or (floor(nt)!=nt) or (nt<=0): Modified: trunk/scipy/stats/info.py =================================================================== --- trunk/scipy/stats/info.py 2011-01-15 14:05:17 UTC (rev 7049) +++ trunk/scipy/stats/info.py 2011-01-15 14:45:35 UTC (rev 7050) @@ -116,7 +116,7 @@ truncnorm Truncated Normal tukeylambda Tukey-Lambda uniform Uniform - von_mises Von-Mises (Circular) + vonmises Von-Mises (Circular) wald Wald weibull_min Minimum Weibull (see Frechet) weibull_max Maximum Weibull (see Frechet) @@ -178,16 +178,9 @@ ================= ============================================================== obrientransform _ -samplevar _ -samplestd _ signaltonoise _ bayes_mvs _ -var _ -std _ -stderr _ sem _ -z _ -zs _ zmap _ ================= ============================================================== @@ -195,8 +188,6 @@ threshold _ trimboth _ trim1 _ -cov _ -corrcoef _ ================= ============================================================== ================= ============================================================== @@ -238,7 +229,6 @@ ================= ============================================================== glm _ -anova _ ================= ============================================================== Modified: trunk/scipy/weave/catalog.py =================================================================== --- trunk/scipy/weave/catalog.py 2011-01-15 14:05:17 UTC (rev 7049) +++ trunk/scipy/weave/catalog.py 2011-01-15 14:45:35 UTC (rev 7050) @@ -131,12 +131,15 @@ def is_writable(dir): """Determine whether a given directory is writable in a portable manner. - :Parameters: - - dir: string - A string represeting a path to a directory on the filesystem. + Parameters + ---------- + dir: str + A string represeting a path to a directory on the filesystem. - :Returns: - True or False. + Returns + ------- + res : bool + True or False. """ # Do NOT use a hardcoded name here due to the danger from race conditions From scipy-svn at scipy.org Sat Jan 15 09:45:38 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Jan 2011 08:45:38 -0600 (CST) Subject: [Scipy-svn] r7051 - trunk Message-ID: <20110115144538.C22E41B8C04@scipy.org> Author: josef Date: 2011-01-15 08:45:38 -0600 (Sat, 15 Jan 2011) New Revision: 7051 Modified: trunk/THANKS.txt Log: THANKS.txt: add some contributers Modified: trunk/THANKS.txt =================================================================== --- trunk/THANKS.txt 2011-01-15 14:45:35 UTC (rev 7050) +++ trunk/THANKS.txt 2011-01-15 14:45:38 UTC (rev 7051) @@ -65,6 +65,12 @@ Paul Ivanov for porting Numeric-style C code to the new NumPy API. Ariel Rokem for contributions on percentileofscore fixes and tests. Yosef Meller for tests in the optimization module. +Ralf Gommers for release management, code clean up and improvements + to doc-string generation. +Bruce Southey for bug-fixes and improvements to scipy.stats. +Ernest Adrogu? for the Skellam distribution. +Enzo Michelangeli a fast kendall tau test. +David Simcha for a fisher exact test. Institutions ------------ From scipy-svn at scipy.org Sat Jan 15 10:23:31 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Jan 2011 09:23:31 -0600 (CST) Subject: [Scipy-svn] r7052 - branches/0.9.x/scipy/sparse/linalg/eigen/arpack/tests Message-ID: <20110115152331.6912D37A196@scipy.org> Author: rgommers Date: 2011-01-15 09:23:31 -0600 (Sat, 15 Jan 2011) New Revision: 7052 Modified: branches/0.9.x/scipy/sparse/linalg/eigen/arpack/tests/test_arpack.py Log: TST: Mark Arpack tests as knownfail only on 64-bit OS X in 0.9.x branch. (copied from 0.8.x branch, r6584) Modified: branches/0.9.x/scipy/sparse/linalg/eigen/arpack/tests/test_arpack.py =================================================================== --- branches/0.9.x/scipy/sparse/linalg/eigen/arpack/tests/test_arpack.py 2011-01-15 14:45:38 UTC (rev 7051) +++ branches/0.9.x/scipy/sparse/linalg/eigen/arpack/tests/test_arpack.py 2011-01-15 15:23:31 UTC (rev 7052) @@ -4,6 +4,8 @@ python tests/test_arpack.py [-l] [-v] """ +import sys, platform + import numpy as np from numpy.testing import assert_almost_equal, assert_array_almost_equal, \ @@ -35,6 +37,11 @@ assert_array_almost_equal(actual,conj(desired),decimal,err_msg,verbose) +# check if we're on 64-bit OS X, there these tests fail. +if sys.platform == 'darwin' and platform.architecture()[0] == '64bit': + _osx64bit = True +else: + _osx64bit = False # precision for tests _ndigits = {'f':4, 'd':12, 'F':4, 'D':12} @@ -119,12 +126,14 @@ eval[i]*evec[:,i], decimal=_ndigits[typ]) + @dec.knownfailureif(_osx64bit, "Currently fails on 64-bit OS X 10.6") def test_symmetric_modes(self): k=2 for typ in 'fd': for which in ['LM','SM','BE']: self.eval_evec(self.symmetric[0],typ,k,which) + @dec.knownfailureif(_osx64bit, "Currently fails on 64-bit OS X 10.6") def test_starting_vector(self): k=2 for typ in 'fd': @@ -185,6 +194,7 @@ eval[i]*evec[:,i], decimal=_ndigits[typ]) + @dec.knownfailureif(_osx64bit, "Currently fails on 64-bit OS X 10.6") def test_complex_symmetric_modes(self): k=2 for typ in 'FD': @@ -248,6 +258,7 @@ decimal=_ndigits[typ]) + @dec.knownfailureif(_osx64bit, "Currently fails on 64-bit OS X 10.6") def test_nonsymmetric_modes(self): k=2 for typ in 'fd': @@ -257,6 +268,7 @@ + @dec.knownfailureif(_osx64bit, "Currently fails on 64-bit OS X 10.6") def test_starting_vector(self): k=2 for typ in 'fd': @@ -325,6 +337,7 @@ eval[i]*evec[:,i], decimal=_ndigits[typ]) + @dec.knownfailureif(_osx64bit, "Currently fails on 64-bit OS X 10.6") def test_complex_nonsymmetric_modes(self): k=2 for typ in 'FD': From scipy-svn at scipy.org Sat Jan 15 10:23:58 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Jan 2011 09:23:58 -0600 (CST) Subject: [Scipy-svn] r7053 - branches/0.9.x/scipy/io/tests Message-ID: <20110115152358.BEA8237A196@scipy.org> Author: rgommers Date: 2011-01-15 09:23:58 -0600 (Sat, 15 Jan 2011) New Revision: 7053 Modified: branches/0.9.x/scipy/io/tests/test_wavfile.py Log: TST: Filter noise from io.wavfile tests in 0.8.x branch. Modified: branches/0.9.x/scipy/io/tests/test_wavfile.py =================================================================== --- branches/0.9.x/scipy/io/tests/test_wavfile.py 2011-01-15 15:23:31 UTC (rev 7052) +++ branches/0.9.x/scipy/io/tests/test_wavfile.py 2011-01-15 15:23:58 UTC (rev 7053) @@ -1,10 +1,12 @@ import os import tempfile +import warnings + import numpy as np - from numpy.testing import assert_equal, assert_, assert_raises, assert_array_equal from scipy.io import wavfile + def datafile(fn): return os.path.join(os.path.dirname(__file__), 'data', fn) @@ -55,3 +57,8 @@ for channels in (1, 2, 5): dt = np.dtype('%s%s%d' % (endianness, signed, size)) yield _check_roundtrip, rate, dt, channels + + +# Filter test noise in 0.9.x branch. Format of data file does not seem to be +# recognized. +warnings.filterwarnings("ignore", category=wavfile.WavFileWarning) From scipy-svn at scipy.org Sat Jan 15 10:28:05 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 Jan 2011 09:28:05 -0600 (CST) Subject: [Scipy-svn] r7054 - in branches/0.9.x: doc/source scipy/odr scipy/optimize scipy/spatial scipy/special scipy/stats scipy/weave Message-ID: <20110115152805.DC4BA37A196@scipy.org> Author: rgommers Date: 2011-01-15 09:28:05 -0600 (Sat, 15 Jan 2011) New Revision: 7054 Modified: branches/0.9.x/doc/source/io.rst branches/0.9.x/doc/source/maxentropy.rst branches/0.9.x/doc/source/release.rst branches/0.9.x/doc/source/sparse.rst branches/0.9.x/doc/source/stats.mstats.rst branches/0.9.x/doc/source/stats.rst branches/0.9.x/scipy/odr/odrpack.py branches/0.9.x/scipy/optimize/anneal.py branches/0.9.x/scipy/spatial/distance.py branches/0.9.x/scipy/spatial/kdtree.py branches/0.9.x/scipy/special/basic.py branches/0.9.x/scipy/stats/info.py branches/0.9.x/scipy/weave/catalog.py Log: BUG: fix doc build. Some irregular indentation caused LaTeX errors. (backport of r7050) Also fix a lot of warnings in the doc build. The errors came from the Output class in odrpack.py and were of the following nature: "Perhaps a missing \item \cr \end{tabular} " Modified: branches/0.9.x/doc/source/io.rst =================================================================== --- branches/0.9.x/doc/source/io.rst 2011-01-15 15:23:58 UTC (rev 7053) +++ branches/0.9.x/doc/source/io.rst 2011-01-15 15:28:05 UTC (rev 7054) @@ -32,7 +32,6 @@ :toctree: generated/ save_as_module - npfile Wav sound files (:mod:`scipy.io.wavfile`) ========================================= Modified: branches/0.9.x/doc/source/maxentropy.rst =================================================================== --- branches/0.9.x/doc/source/maxentropy.rst 2011-01-15 15:23:58 UTC (rev 7053) +++ branches/0.9.x/doc/source/maxentropy.rst 2011-01-15 15:28:05 UTC (rev 7054) @@ -66,6 +66,8 @@ Utilities ========= +.. automodule:: scipy.maxentropy.maxentutils + .. autosummary:: :toctree: generated/ Modified: branches/0.9.x/doc/source/release.rst =================================================================== --- branches/0.9.x/doc/source/release.rst 2011-01-15 15:23:58 UTC (rev 7053) +++ branches/0.9.x/doc/source/release.rst 2011-01-15 15:28:05 UTC (rev 7054) @@ -10,5 +10,3 @@ release.0.7.2 release.0.7.1 release.0.7.0 - -.. include:: ../release/0.9.0-notes.rst Modified: branches/0.9.x/doc/source/sparse.rst =================================================================== --- branches/0.9.x/doc/source/sparse.rst 2011-01-15 15:23:58 UTC (rev 7053) +++ branches/0.9.x/doc/source/sparse.rst 2011-01-15 15:28:05 UTC (rev 7054) @@ -32,8 +32,6 @@ identity kron kronsum - lil_eye - lil_diags spdiags tril triu Modified: branches/0.9.x/doc/source/stats.mstats.rst =================================================================== --- branches/0.9.x/doc/source/stats.mstats.rst 2011-01-15 15:23:58 UTC (rev 7053) +++ branches/0.9.x/doc/source/stats.mstats.rst 2011-01-15 15:28:05 UTC (rev 7054) @@ -46,16 +46,12 @@ plotting_positions pointbiserialr rankdata - samplestd - samplevar scoreatpercentile sem signaltonoise skew skewtest spearmanr - std - stderr theilslopes threshold tmax @@ -73,9 +69,7 @@ ttest_onesamp ttest_rel tvar - var variation winsorize - z zmap - zs + zscore Modified: branches/0.9.x/doc/source/stats.rst =================================================================== --- branches/0.9.x/doc/source/stats.rst 2011-01-15 15:23:58 UTC (rev 7053) +++ branches/0.9.x/doc/source/stats.rst 2011-01-15 15:28:05 UTC (rev 7054) @@ -1,9 +1,9 @@ -.. module:: scipy.stats - ========================================== Statistical functions (:mod:`scipy.stats`) ========================================== +.. module:: scipy.stats + This module contains a large number of probability distributions as well as a growing library of statistical functions. @@ -62,8 +62,6 @@ foldcauchy f foldnorm - fretchet_r - fretcher_l genlogistic genpareto genexpon @@ -113,7 +111,7 @@ truncnorm tukeylambda uniform - von_mises + vonmises wald weibull_min weibull_max @@ -151,9 +149,7 @@ gmean hmean - mean cmedian - median mode tmean tvar @@ -186,16 +182,9 @@ :toctree: generated/ obrientransform - samplevar - samplestd signaltonoise bayes_mvs - var - std - stderr sem - z - zs zmap zscore @@ -205,8 +194,6 @@ threshold trimboth trim1 - cov - corrcoef .. autosummary:: :toctree: generated/ @@ -252,7 +239,6 @@ :toctree: generated/ glm - anova Plot-tests ========== Modified: branches/0.9.x/scipy/odr/odrpack.py =================================================================== --- branches/0.9.x/scipy/odr/odrpack.py 2011-01-15 15:23:58 UTC (rev 7053) +++ branches/0.9.x/scipy/odr/odrpack.py 2011-01-15 15:28:05 UTC (rev 7054) @@ -536,54 +536,50 @@ The Output class stores the output of an ODR run. Takes one argument for initialization, the return value from the - function odr. + function `odr`. Attributes ---------- - beta : - estimated parameter values [beta.shape == (q,)] - sd_beta : - standard errors of the estimated parameters - [sd_beta.shape == (p,)] - cov_beta : - covariance matrix of the estimated parameters - [cov_beta.shape == (p, p)] + beta : ndarray + Estimated parameter values, of shape (q,). + sd_beta : ndarray + Standard errors of the estimated parameters, of shape (p,). + cov_beta : ndarray + Covariance matrix of the estimated parameters, of shape (p,p). + delta : ndarray, optional + Array of estimated errors in input variables, of same shape as `x`. + eps : ndarray, optional + Array of estimated errors in response variables, of same shape as `y`. + xplus : ndarray, optional + Array of ``x + delta``. + y : ndarray, optional + Array ``y = fcn(x + delta)``. + res_var : float, optional + Residual variance. + sum_sqare : float, optional + Sum of squares error. + sum_square_delta : float, optional + Sum of squares of delta error. + sum_square_eps : float, optional + Sum of squares of eps error. + inv_condnum : float, optional + Inverse condition number (cf. ODRPACK UG p. 77). + rel_error : float, optional + Relative error in function values computed within fcn. + work : ndarray, optional + Final work array. + work_ind : dict, optional + Indices into work for drawing out values (cf. ODRPACK UG p. 83). + info : int, optional + Reason for returning, as output by ODRPACK (cf. ODRPACK UG p. 38). + stopreason : list of str, optional + `info` interpreted into English. - Following are present if odr() was run with "full_output=1". + Notes + ----- + The attributes listed as "optional" above are only present if `odr` was run + with ``full_output=1``. - delta : - array of estimated errors in input variables - [delta.shape == data.x.shape] - eps : - array of estimated errors in response variables - [eps.shape == data.y.shape] - xplus : - array of x + delta [xplus.shape == data.x.shape] - y : - array of y = fcn(x + delta) [y.shape == data.y.shape] - res_var : float - residual variance - sum_sqare : float - sum of squares error - sum_square_delta : float - sum of squares of delta error - sum_square_eps : float - sum of squares of eps error - inv_condnum : float - inverse condition number (cf. ODRPACK UG p. 77) - rel_error : float - relative error in function values computed within fcn - work : ndarray - final work array - work_ind : dictionary - indices into work for drawing out values - (cf. ODRPACK UG p. 83) - info : int - reason for returning (as output by ODRPACK) - (cf. ODRPACK UG p. 38) - stopreason : list of strings - "info" interpreted into English - """ def __init__(self, output): Modified: branches/0.9.x/scipy/optimize/anneal.py =================================================================== --- branches/0.9.x/scipy/optimize/anneal.py 2011-01-15 15:23:58 UTC (rev 7053) +++ branches/0.9.x/scipy/optimize/anneal.py 2011-01-15 15:28:05 UTC (rev 7054) @@ -198,7 +198,7 @@ dwell : int The number of times to search the space at each temperature. - Outputs + Returns ------- xmin : ndarray Point giving smallest value found. Modified: branches/0.9.x/scipy/spatial/distance.py =================================================================== --- branches/0.9.x/scipy/spatial/distance.py 2011-01-15 15:23:58 UTC (rev 7053) +++ branches/0.9.x/scipy/spatial/distance.py 2011-01-15 15:28:05 UTC (rev 7054) @@ -160,17 +160,19 @@ {||u-v||}_p = (\sum{|u_i - v_i|^p})^{1/p}. - :Parameters: - u : ndarray - An n-dimensional vector. - v : ndarray - An n-dimensional vector. - p : ndarray - The norm of the difference :math:`{||u-v||}_p`. + Parameters + ---------- + u : ndarray + An n-dimensional vector. + v : ndarray + An n-dimensional vector. + p : ndarray + The norm of the difference :math:`{||u-v||}_p`. - :Returns: - d : double - The Minkowski distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Minkowski distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -187,19 +189,21 @@ \left(\sum{(w_i |u_i - v_i|^p)}\right)^{1/p}. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. - p : ndarray - The norm of the difference :math:`{||u-v||}_p`. - w : ndarray - The weight vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. + p : ndarray + The norm of the difference :math:`{||u-v||}_p`. + w : ndarray + The weight vector. - :Returns: - d : double - The Minkowski distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Minkowski distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -217,15 +221,17 @@ {||u-v||}_2 - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Euclidean distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Euclidean distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -242,15 +248,17 @@ {||u-v||}_2^2. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The squared Euclidean distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The squared Euclidean distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -266,15 +274,17 @@ \frac{1-uv^T} {||u||_2 ||v||_2}. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Cosine distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Cosine distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -294,15 +304,17 @@ where :math:`\bar{u}` is the mean of a vectors elements and ``n`` is the common dimensionality of ``u`` and ``v``. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The correlation distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The correlation distance between vectors ``u`` and ``v``. """ umu = u.mean() vmu = v.mean() @@ -327,15 +339,17 @@ :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for :math:`k < n`. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Hamming distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Hamming distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -355,15 +369,17 @@ :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for :math:`k < n`. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Jaccard distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Jaccard distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -385,15 +401,17 @@ :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for :math:`k < n`. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Kulsinski distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Kulsinski distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -409,15 +427,17 @@ variances. It is usually computed among a larger collection vectors. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The standardized Euclidean distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The standardized Euclidean distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -435,15 +455,17 @@ \sum_i {(u_i-v_i)}. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The City Block distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The City Block distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -460,15 +482,17 @@ where ``VI`` is the inverse covariance matrix :math:`V^{-1}`. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Mahalanobis distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Mahalanobis distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -484,15 +508,17 @@ \max_i {|u_i-v_i|}. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Chebyshev distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Chebyshev distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -507,15 +533,17 @@ \sum{|u_i-v_i|} / \sum{|u_i+v_i|}. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Bray-Curtis distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Bray-Curtis distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -532,15 +560,17 @@ {\sum_i {|u_i|+|v_i|}}. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Canberra distance between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Canberra distance between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -596,15 +626,17 @@ :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for :math:`k < n` and :math:`R = 2.0 * (c_{TF} + c_{FT})`. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Yule dissimilarity between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Yule dissimilarity between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -624,15 +656,17 @@ :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for :math:`k < n`. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Matching dissimilarity between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Matching dissimilarity between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -653,15 +687,17 @@ :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for :math:`k < n`. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Dice dissimilarity between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Dice dissimilarity between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -685,16 +721,18 @@ :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for :math:`k < n` and :math:`R = 2(c_{TF} + c_{FT})`. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Rogers-Tanimoto dissimilarity between vectors - ``u`` and ``v``. + Returns + ------- + d : double + The Rogers-Tanimoto dissimilarity between vectors + `u` and `v`. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -715,15 +753,17 @@ :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for :math:`k < n`. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Russell-Rao dissimilarity between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Russell-Rao dissimilarity between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -748,15 +788,17 @@ :math:`k < n`, :math:`R = 2 * (c_{TF} + c_{FT})` and :math:`S = c_{FF} + c_{TT}`. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Sokal-Michener dissimilarity between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Sokal-Michener dissimilarity between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -783,15 +825,17 @@ :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for :math:`k < n` and :math:`R = 2(c_{TF} + c_{FT})`. - :Parameters: - u : ndarray - An :math:`n`-dimensional vector. - v : ndarray - An :math:`n`-dimensional vector. + Parameters + ---------- + u : ndarray + An :math:`n`-dimensional vector. + v : ndarray + An :math:`n`-dimensional vector. - :Returns: - d : double - The Sokal-Sneath dissimilarity between vectors ``u`` and ``v``. + Returns + ------- + d : double + The Sokal-Sneath dissimilarity between vectors ``u`` and ``v``. """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') @@ -999,34 +1043,36 @@ dm = pdist(X, 'sokalsneath') - :Parameters: - X : ndarray - An m by n array of m original observations in an - n-dimensional space. - metric : string or function - The distance metric to use. The distance function can - be 'braycurtis', 'canberra', 'chebyshev', 'cityblock', - 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', - 'jaccard', 'kulsinski', 'mahalanobis', 'matching', - 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', - 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule'. - w : ndarray - The weight vector (for weighted Minkowski). - p : double - The p-norm to apply (for Minkowski, weighted and unweighted) - V : ndarray - The variance vector (for standardized Euclidean). - VI : ndarray - The inverse of the covariance matrix (for Mahalanobis). + Parameters + ---------- + X : ndarray + An m by n array of m original observations in an + n-dimensional space. + metric : string or function + The distance metric to use. The distance function can + be 'braycurtis', 'canberra', 'chebyshev', 'cityblock', + 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', + 'jaccard', 'kulsinski', 'mahalanobis', 'matching', + 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', + 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule'. + w : ndarray + The weight vector (for weighted Minkowski). + p : double + The p-norm to apply (for Minkowski, weighted and unweighted) + V : ndarray + The variance vector (for standardized Euclidean). + VI : ndarray + The inverse of the covariance matrix (for Mahalanobis). - :Returns: - Y : ndarray - A condensed distance matrix. + Returns + ------- + Y : ndarray + A condensed distance matrix. - :SeeAlso: - - squareform : converts between condensed distance matrices and - square distance matrices. + See Also + -------- + squareform : converts between condensed distance matrices and + square distance matrices. """ @@ -1239,11 +1285,13 @@ Converts a vector-form distance vector to a square-form distance matrix, and vice-versa. - :Parameters: + Parameters + ---------- X : ndarray Either a condensed or redundant distance matrix. - :Returns: + Returns + ------- Y : ndarray If a condensed distance matrix is passed, a redundant one is returned, or if a redundant one is passed, a @@ -1358,31 +1406,33 @@ Distance matrices must be 2-dimensional numpy arrays containing doubles. They must have a zero-diagonal, and they must be symmetric. - :Parameters: - D : ndarray - The candidate object to test for validity. - tol : double - The distance matrix should be symmetric. tol is the maximum - difference between the :math:`ij`th entry and the - :math:`ji`th entry for the distance metric to be - considered symmetric. - throw : bool - An exception is thrown if the distance matrix passed is not - valid. - name : string - the name of the variable to checked. This is useful ifa - throw is set to ``True`` so the offending variable can be - identified in the exception message when an exception is - thrown. - warning : boolx - Instead of throwing an exception, a warning message is - raised. + Parameters + ---------- + D : ndarray + The candidate object to test for validity. + tol : double + The distance matrix should be symmetric. tol is the maximum + difference between the :math:`ij`th entry and the + :math:`ji`th entry for the distance metric to be + considered symmetric. + throw : bool + An exception is thrown if the distance matrix passed is not + valid. + name : string + the name of the variable to checked. This is useful ifa + throw is set to ``True`` so the offending variable can be + identified in the exception message when an exception is + thrown. + warning : boolx + Instead of throwing an exception, a warning message is + raised. - :Returns: - Returns ``True`` if the variable ``D`` passed is a valid - distance matrix. Small numerical differences in ``D`` and - ``D.T`` and non-zeroness of the diagonal are ignored if they are - within the tolerance specified by ``tol``. + Returns + ------- + Returns ``True`` if the variable ``D`` passed is a valid + distance matrix. Small numerical differences in ``D`` and + ``D.T`` and non-zeroness of the diagonal are ignored if they are + within the tolerance specified by ``tol``. """ D = np.asarray(D, order='c') valid = True @@ -1436,24 +1486,22 @@ coefficient :math:`{n \choose 2}` for some positive integer n. - :Parameters: - y : ndarray - The condensed distance matrix. + Parameters + ---------- + y : ndarray + The condensed distance matrix. + warning : bool, optional + Invokes a warning if the variable passed is not a valid + condensed distance matrix. The warning message explains why + the distance matrix is not valid. 'name' is used when + referencing the offending variable. + throws : throw, optional + Throws an exception if the variable passed is not a valid + condensed distance matrix. + name : bool, optional + Used when referencing the offending variable in the + warning or exception message. - warning : bool - Invokes a warning if the variable passed is not a valid - condensed distance matrix. The warning message explains why - the distance matrix is not valid. 'name' is used when - referencing the offending variable. - - throws : throw - Throws an exception if the variable passed is not a valid - condensed distance matrix. - - name : bool - Used when referencing the offending variable in the - warning or exception message. - """ y = np.asarray(y, order='c') valid = True @@ -1493,12 +1541,15 @@ Returns the number of original observations that correspond to a square, redudant distance matrix ``D``. - :Parameters: - d : ndarray - The target distance matrix. + Parameters + ---------- + d : ndarray + The target distance matrix. - :Returns: - The number of observations in the redundant distance matrix. + Returns + ------- + numobs : int + The number of observations in the redundant distance matrix. """ d = np.asarray(d, order='c') is_valid_dm(d, tol=np.inf, throw=True, name='d') @@ -1509,15 +1560,17 @@ Returns the number of original observations that correspond to a condensed distance matrix ``Y``. - :Parameters: - Y : ndarray - The number of original observations in the condensed - observation ``Y``. + Parameters + ---------- + Y : ndarray + The number of original observations in the condensed + observation ``Y``. - :Returns: - n : int - The number of observations in the condensed distance matrix - passed. + Returns + ------- + n : int + The number of observations in the condensed distance matrix + passed. """ Y = np.asarray(Y, order='c') is_valid_y(Y, throw=True, name='Y') @@ -1727,34 +1780,36 @@ dm = cdist(XA, XB, 'sokalsneath') - :Parameters: - XA : ndarray - An :math:`m_A` by :math:`n` array of :math:`m_A` - original observations in an :math:`n`-dimensional space. - XB : ndarray - An :math:`m_B` by :math:`n` array of :math:`m_B` - original observations in an :math:`n`-dimensional space. - metric : string or function - The distance metric to use. The distance function can - be 'braycurtis', 'canberra', 'chebyshev', 'cityblock', - 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', - 'jaccard', 'kulsinski', 'mahalanobis', 'matching', - 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', - 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'wminkowski', - 'yule'. - w : ndarray - The weight vector (for weighted Minkowski). - p : double - The p-norm to apply (for Minkowski, weighted and unweighted) - V : ndarray - The variance vector (for standardized Euclidean). - VI : ndarray - The inverse of the covariance matrix (for Mahalanobis). + Parameters + ---------- + XA : ndarray + An :math:`m_A` by :math:`n` array of :math:`m_A` + original observations in an :math:`n`-dimensional space. + XB : ndarray + An :math:`m_B` by :math:`n` array of :math:`m_B` + original observations in an :math:`n`-dimensional space. + metric : string or function + The distance metric to use. The distance function can + be 'braycurtis', 'canberra', 'chebyshev', 'cityblock', + 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', + 'jaccard', 'kulsinski', 'mahalanobis', 'matching', + 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', + 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'wminkowski', + 'yule'. + w : ndarray + The weight vector (for weighted Minkowski). + p : double + The p-norm to apply (for Minkowski, weighted and unweighted) + V : ndarray + The variance vector (for standardized Euclidean). + VI : ndarray + The inverse of the covariance matrix (for Mahalanobis). - :Returns: - Y : ndarray - A :math:`m_A` by :math:`m_B` distance matrix. + Returns + ------- + Y : ndarray + A :math:`m_A` by :math:`m_B` distance matrix. """ Modified: branches/0.9.x/scipy/spatial/kdtree.py =================================================================== --- branches/0.9.x/scipy/spatial/kdtree.py 2011-01-15 15:23:58 UTC (rev 7053) +++ branches/0.9.x/scipy/spatial/kdtree.py 2011-01-15 15:28:05 UTC (rev 7054) @@ -116,13 +116,12 @@ def __init__(self, data, leafsize=10): """Construct a kd-tree. - Parameters: - =========== - - data : array-like, shape (n,k) + Parameters + ---------- + data : array_like, shape (n,k) The data points to be indexed. This array is not copied, and so modifying this data will result in bogus results. - leafsize : positive integer + leafsize : positive int The number of points at which the algorithm switches over to brute-force. """ Modified: branches/0.9.x/scipy/special/basic.py =================================================================== --- branches/0.9.x/scipy/special/basic.py 2011-01-15 15:23:58 UTC (rev 7053) +++ branches/0.9.x/scipy/special/basic.py 2011-01-15 15:28:05 UTC (rev 7054) @@ -59,16 +59,22 @@ """Compute nt (<=1200) zeros of the bessel functions Jn and Jn' and arange them in order of their magnitudes. - Outputs (all are arrays of length nt): + Returns + ------- + zo[l-1] : ndarray + Value of the lth zero of of Jn(x) and Jn'(x). Of length `nt`. + n[l-1] : ndarray + Order of the Jn(x) or Jn'(x) associated with lth zero. Of length `nt`. + m[l-1] : ndarray + Serial number of the zeros of Jn(x) or Jn'(x) associated + with lth zero. Of length `nt`. + t[l-1] : ndarray + 0 if lth zero in zo is zero of Jn(x), 1 if it is a zero of Jn'(x). Of + length `nt`. - zo[l-1] -- Value of the lth zero of of Jn(x) and Jn'(x) - n[l-1] -- Order of the Jn(x) or Jn'(x) associated with lth zero - m[l-1] -- Serial number of the zeros of Jn(x) or Jn'(x) associated - with lth zero. - t[l-1] -- 0 if lth zero in zo is zero of Jn(x), 1 if it is a zero - of Jn'(x) - - See jn_zeros, jnp_zeros to get separated arrays of zeros. + See Also + -------- + jn_zeros, jnp_zeros : to get separated arrays of zeros. """ if not isscalar(nt) or (floor(nt)!=nt) or (nt>1200): raise ValueError("Number must be integer <= 1200.") @@ -521,7 +527,7 @@ Pmn_z : (m+1, n+1) array Values for all orders 0..m and degrees 0..n Pmn_d_z : (m+1, n+1) array - Derivatives for all orders 0..m and degrees 0..n + Derivatives for all orders 0..m and degrees 0..n """ if not isscalar(m) or (abs(m)>n): raise ValueError("m must be <= n.") @@ -636,12 +642,12 @@ """Compute the zeros of Airy Functions Ai(x) and Ai'(x), a and a' respectively, and the associated values of Ai(a') and Ai'(a). - Outputs: - - a[l-1] -- the lth zero of Ai(x) - ap[l-1] -- the lth zero of Ai'(x) - ai[l-1] -- Ai(ap[l-1]) - aip[l-1] -- Ai'(a[l-1]) + Returns + ------- + a[l-1] -- the lth zero of Ai(x) + ap[l-1] -- the lth zero of Ai'(x) + ai[l-1] -- Ai(ap[l-1]) + aip[l-1] -- Ai'(a[l-1]) """ kf = 1 if not isscalar(nt) or (floor(nt)!=nt) or (nt<=0): @@ -652,12 +658,12 @@ """Compute the zeros of Airy Functions Bi(x) and Bi'(x), b and b' respectively, and the associated values of Ai(b') and Ai'(b). - Outputs: - - b[l-1] -- the lth zero of Bi(x) - bp[l-1] -- the lth zero of Bi'(x) - bi[l-1] -- Bi(bp[l-1]) - bip[l-1] -- Bi'(b[l-1]) + Returns + ------- + b[l-1] -- the lth zero of Bi(x) + bp[l-1] -- the lth zero of Bi'(x) + bi[l-1] -- Bi(bp[l-1]) + bip[l-1] -- Bi'(b[l-1]) """ kf = 2 if not isscalar(nt) or (floor(nt)!=nt) or (nt<=0): Modified: branches/0.9.x/scipy/stats/info.py =================================================================== --- branches/0.9.x/scipy/stats/info.py 2011-01-15 15:23:58 UTC (rev 7053) +++ branches/0.9.x/scipy/stats/info.py 2011-01-15 15:28:05 UTC (rev 7054) @@ -116,7 +116,7 @@ truncnorm Truncated Normal tukeylambda Tukey-Lambda uniform Uniform - von_mises Von-Mises (Circular) + vonmises Von-Mises (Circular) wald Wald weibull_min Minimum Weibull (see Frechet) weibull_max Maximum Weibull (see Frechet) @@ -178,16 +178,9 @@ ================= ============================================================== obrientransform _ -samplevar _ -samplestd _ signaltonoise _ bayes_mvs _ -var _ -std _ -stderr _ sem _ -z _ -zs _ zmap _ ================= ============================================================== @@ -195,8 +188,6 @@ threshold _ trimboth _ trim1 _ -cov _ -corrcoef _ ================= ============================================================== ================= ============================================================== @@ -238,7 +229,6 @@ ================= ============================================================== glm _ -anova _ ================= ============================================================== Modified: branches/0.9.x/scipy/weave/catalog.py =================================================================== --- branches/0.9.x/scipy/weave/catalog.py 2011-01-15 15:23:58 UTC (rev 7053) +++ branches/0.9.x/scipy/weave/catalog.py 2011-01-15 15:28:05 UTC (rev 7054) @@ -131,12 +131,15 @@ def is_writable(dir): """Determine whether a given directory is writable in a portable manner. - :Parameters: - - dir: string - A string represeting a path to a directory on the filesystem. + Parameters + ---------- + dir: str + A string represeting a path to a directory on the filesystem. - :Returns: - True or False. + Returns + ------- + res : bool + True or False. """ # Do NOT use a hardcoded name here due to the danger from race conditions From scipy-svn at scipy.org Sun Jan 16 03:14:25 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 16 Jan 2011 02:14:25 -0600 (CST) Subject: [Scipy-svn] r7055 - trunk/scipy/optimize/tests Message-ID: <20110116081425.35A7E32347@scipy.org> Author: rgommers Date: 2011-01-16 02:14:24 -0600 (Sun, 16 Jan 2011) New Revision: 7055 Modified: trunk/scipy/optimize/tests/test_linesearch.py Log: TST: fix test failure of line_search_wolfe1/2 on win32 with Python 2.7/3.1 The issue was numerical precision when comparing two float arrays. Largest difference between actual and desired first derivate arrays was 3.5e-15. Modified: trunk/scipy/optimize/tests/test_linesearch.py =================================================================== --- trunk/scipy/optimize/tests/test_linesearch.py 2011-01-15 15:28:05 UTC (rev 7054) +++ trunk/scipy/optimize/tests/test_linesearch.py 2011-01-16 08:14:24 UTC (rev 7055) @@ -2,7 +2,7 @@ Tests for line search routines """ -from numpy.testing import assert_, assert_equal +from numpy.testing import assert_, assert_equal, assert_array_almost_equal import scipy.optimize.linesearch as ls import numpy as np @@ -82,7 +82,7 @@ def bind_index(func, idx): # Remember Python's closure semantics! return lambda *a, **kw: func(*a, **kw)[idx] - + for name in sorted(dir(self)): if name.startswith('_scalar_func_'): value = getattr(self, name) @@ -162,7 +162,7 @@ if s is None: continue assert_equal(fv, f(x + s*p)) - assert_equal(gv, fprime(x + s*p)) + assert_array_almost_equal(gv, fprime(x + s*p), decimal=14) if s < smax: c += 1 assert_line_wolfe(x, p, s, f, fprime, err_msg=name) @@ -183,7 +183,7 @@ assert_equal(ofv, f(x)) assert_equal(fv, f(x + s*p)) if gv is not None: - assert_equal(gv, fprime(x + s*p)) + assert_array_almost_equal(gv, fprime(x + s*p), decimal=14) if s < smax: c += 1 assert_line_wolfe(x, p, s, f, fprime, err_msg=name) From scipy-svn at scipy.org Sun Jan 16 03:23:11 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 16 Jan 2011 02:23:11 -0600 (CST) Subject: [Scipy-svn] r7056 - branches/0.9.x/scipy/optimize/tests Message-ID: <20110116082311.C2AB13634C@scipy.org> Author: rgommers Date: 2011-01-16 02:23:11 -0600 (Sun, 16 Jan 2011) New Revision: 7056 Modified: branches/0.9.x/scipy/optimize/tests/test_linesearch.py Log: TST: fix test failure of line_search_wolfe1/2 on win32 with Python 2.7/3.1 The issue was numerical precision when comparing two float arrays. Largest difference between actual and desired first derivate arrays was 3.5e-15. (backported from r7055) Modified: branches/0.9.x/scipy/optimize/tests/test_linesearch.py =================================================================== --- branches/0.9.x/scipy/optimize/tests/test_linesearch.py 2011-01-16 08:14:24 UTC (rev 7055) +++ branches/0.9.x/scipy/optimize/tests/test_linesearch.py 2011-01-16 08:23:11 UTC (rev 7056) @@ -2,7 +2,7 @@ Tests for line search routines """ -from numpy.testing import assert_, assert_equal +from numpy.testing import assert_, assert_equal, assert_array_almost_equal import scipy.optimize.linesearch as ls import numpy as np @@ -82,7 +82,7 @@ def bind_index(func, idx): # Remember Python's closure semantics! return lambda *a, **kw: func(*a, **kw)[idx] - + for name in sorted(dir(self)): if name.startswith('_scalar_func_'): value = getattr(self, name) @@ -162,7 +162,7 @@ if s is None: continue assert_equal(fv, f(x + s*p)) - assert_equal(gv, fprime(x + s*p)) + assert_array_almost_equal(gv, fprime(x + s*p), decimal=14) if s < smax: c += 1 assert_line_wolfe(x, p, s, f, fprime, err_msg=name) @@ -183,7 +183,7 @@ assert_equal(ofv, f(x)) assert_equal(fv, f(x + s*p)) if gv is not None: - assert_equal(gv, fprime(x + s*p)) + assert_array_almost_equal(gv, fprime(x + s*p), decimal=14) if s < smax: c += 1 assert_line_wolfe(x, p, s, f, fprime, err_msg=name) From scipy-svn at scipy.org Sun Jan 16 04:05:37 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 16 Jan 2011 03:05:37 -0600 (CST) Subject: [Scipy-svn] r7057 - trunk/scipy/io/matlab/tests Message-ID: <20110116090537.D4CE936349@scipy.org> Author: rgommers Date: 2011-01-16 03:05:37 -0600 (Sun, 16 Jan 2011) New Revision: 7057 Modified: trunk/scipy/io/matlab/tests/test_mio.py Log: TST: fix matlab.savemat test to not emit FutureWarning. Modified: trunk/scipy/io/matlab/tests/test_mio.py =================================================================== --- trunk/scipy/io/matlab/tests/test_mio.py 2011-01-16 08:23:11 UTC (rev 7056) +++ trunk/scipy/io/matlab/tests/test_mio.py 2011-01-16 09:05:37 UTC (rev 7057) @@ -358,16 +358,15 @@ fname = pjoin(tmpdir, "a.mat") # Check that file is not left open - savemat(fname, x) + savemat(fname, x, oned_as='row') os.unlink(fname) - savemat(fname, x) - + savemat(fname, x, oned_as='row') loadmat(fname) os.unlink(fname) # Check that stream is left open f = open(fname, 'wb') - savemat(f, x) + savemat(f, x, oned_as='column') f.seek(0) f.close() From scipy-svn at scipy.org Sun Jan 16 10:02:03 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 16 Jan 2011 09:02:03 -0600 (CST) Subject: [Scipy-svn] r7058 - branches/0.9.x/scipy/interpolate/tests Message-ID: <20110116150203.331B96F052@scipy.org> Author: rgommers Date: 2011-01-16 09:01:59 -0600 (Sun, 16 Jan 2011) New Revision: 7058 Modified: branches/0.9.x/scipy/interpolate/tests/test_rbf.py Log: TST: silence floating point test noise in interpolate. (backport of r7035) Modified: branches/0.9.x/scipy/interpolate/tests/test_rbf.py =================================================================== --- branches/0.9.x/scipy/interpolate/tests/test_rbf.py 2011-01-16 09:05:37 UTC (rev 7057) +++ branches/0.9.x/scipy/interpolate/tests/test_rbf.py 2011-01-16 15:01:59 UTC (rev 7058) @@ -2,6 +2,7 @@ # Created by John Travers, Robert Hetland, 2007 """ Test functions for rbf module """ +import numpy as np from numpy.testing import assert_, assert_array_almost_equal, assert_almost_equal from numpy import linspace, sin, random, exp, allclose from scipy.interpolate.rbf import Rbf @@ -40,10 +41,14 @@ assert_array_almost_equal(di, d) def test_rbf_interpolation(): - for function in FUNCTIONS: - yield check_rbf1d_interpolation, function - yield check_rbf2d_interpolation, function - yield check_rbf3d_interpolation, function + olderr = np.seterr(all="ignore") + try: + for function in FUNCTIONS: + yield check_rbf1d_interpolation, function + yield check_rbf2d_interpolation, function + yield check_rbf3d_interpolation, function + finally: + np.seterr(**olderr) def check_rbf1d_regularity(function, atol): """Check that the Rbf function approximates a smooth function well away @@ -71,8 +76,12 @@ 'thin-plate': 0.1, 'linear': 0.2 } - for function in FUNCTIONS: - yield check_rbf1d_regularity, function, tolerances.get(function, 1e-2) + olderr = np.seterr(all="ignore") + try: + for function in FUNCTIONS: + yield check_rbf1d_regularity, function, tolerances.get(function, 1e-2) + finally: + np.seterr(**olderr) def test_default_construction(): """Check that the Rbf class can be constructed with the default From scipy-svn at scipy.org Sun Jan 16 10:15:53 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 16 Jan 2011 09:15:53 -0600 (CST) Subject: [Scipy-svn] r7059 - in branches/0.9.x/scipy: lib/blas/tests linalg/tests Message-ID: <20110116151553.EB4D86F052@scipy.org> Author: rgommers Date: 2011-01-16 09:15:41 -0600 (Sun, 16 Jan 2011) New Revision: 7059 Modified: branches/0.9.x/scipy/lib/blas/tests/test_fblas.py branches/0.9.x/scipy/linalg/tests/test_decomp.py branches/0.9.x/scipy/linalg/tests/test_fblas.py Log: TST: filter ComplexWarning from fblas tests. (backport of r7036) Modified: branches/0.9.x/scipy/lib/blas/tests/test_fblas.py =================================================================== --- branches/0.9.x/scipy/lib/blas/tests/test_fblas.py 2011-01-16 15:01:59 UTC (rev 7058) +++ branches/0.9.x/scipy/lib/blas/tests/test_fblas.py 2011-01-16 15:15:41 UTC (rev 7059) @@ -89,7 +89,7 @@ assert_(0) def test_y_bad_size(self): - x = arange(12.,dtype=complex64) + x = arange(12.,dtype=self.dtype) y = zeros(6,x.dtype) try: self.blas_func(x,y,n=3,incy=5) @@ -217,7 +217,7 @@ assert_(0) def test_y_bad_size(self): - x = arange(12.,dtype=complex64) + x = arange(12.,dtype=self.dtype) y = zeros(6,x.dtype) try: self.blas_func(x,y,n=3,incy=5) @@ -310,7 +310,7 @@ assert_(0) def test_y_bad_size(self): - x = arange(12.,dtype=complex64) + x = arange(12.,dtype=self.dtype) y = zeros(6,x.dtype) try: self.blas_func(x,y,n=3,incy=5) Modified: branches/0.9.x/scipy/linalg/tests/test_decomp.py =================================================================== --- branches/0.9.x/scipy/linalg/tests/test_decomp.py 2011-01-16 15:01:59 UTC (rev 7058) +++ branches/0.9.x/scipy/linalg/tests/test_decomp.py 2011-01-16 15:15:41 UTC (rev 7059) @@ -197,7 +197,11 @@ B = array(( [13,26,25,17,24], [31,46,40,26,37], [26,40,19,25,25], [16,25,27,14,23], [24,35,18,21,22])) - self._check_gen_eig(A, B) + olderr = np.seterr(all='ignore') + try: + self._check_gen_eig(A, B) + finally: + np.seterr(**olderr) def test_falker(self): """Test matrices giving some Nan generalized eigen values.""" @@ -209,7 +213,11 @@ A = bmat([[I,Z],[Z,-K]]) B = bmat([[Z,I],[M,D]]) - self._check_gen_eig(A, B) + olderr = np.seterr(all='ignore') + try: + self._check_gen_eig(A, B) + finally: + np.seterr(**olderr) def test_bad_geneig(self): # Ticket #709 (strange return values from DGGEV) @@ -229,9 +237,13 @@ # With a buggy LAPACK, this can fail for different omega on different # machines -- so we need to test several values - for k in xrange(100): - A, B = matrices(omega=k*5./100) - self._check_gen_eig(A, B) + olderr = np.seterr(all='ignore') + try: + for k in xrange(100): + A, B = matrices(omega=k*5./100) + self._check_gen_eig(A, B) + finally: + np.seterr(**olderr) def test_not_square_error(self): """Check that passing a non-square array raises a ValueError.""" Modified: branches/0.9.x/scipy/linalg/tests/test_fblas.py =================================================================== --- branches/0.9.x/scipy/linalg/tests/test_fblas.py 2011-01-16 15:01:59 UTC (rev 7058) +++ branches/0.9.x/scipy/linalg/tests/test_fblas.py 2011-01-16 15:15:41 UTC (rev 7059) @@ -90,7 +90,7 @@ assert_(0) def test_y_bad_size(self): - x = arange(12.,dtype=complex64) + x = arange(12.,dtype=self.dtype) y = zeros(6,x.dtype) try: self.blas_func(x,y,n=3,incy=5) @@ -214,7 +214,7 @@ assert_(0) def test_y_bad_size(self): - x = arange(12.,dtype=complex64) + x = arange(12.,dtype=self.dtype) y = zeros(6,x.dtype) try: self.blas_func(x,y,n=3,incy=5) @@ -306,7 +306,7 @@ assert_(0) def test_y_bad_size(self): - x = arange(12.,dtype=complex64) + x = arange(12.,dtype=self.dtype) y = zeros(6,x.dtype) try: self.blas_func(x,y,n=3,incy=5) From scipy-svn at scipy.org Sun Jan 16 10:16:51 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 16 Jan 2011 09:16:51 -0600 (CST) Subject: [Scipy-svn] r7060 - in branches/0.9.x/scipy: fftpack/tests linalg linalg/tests Message-ID: <20110116151651.A715A6F052@scipy.org> Author: rgommers Date: 2011-01-16 09:16:43 -0600 (Sun, 16 Jan 2011) New Revision: 7060 Modified: branches/0.9.x/scipy/fftpack/tests/test_basic.py branches/0.9.x/scipy/linalg/matfuncs.py branches/0.9.x/scipy/linalg/tests/test_matfuncs.py Log: TST: fix ComplexWarnings by replacing .astype(float) by .real.astype(float). Also adds tests that different dtypes are handled correctly in linalg/expm2. (backport of r7037, r7043) Modified: branches/0.9.x/scipy/fftpack/tests/test_basic.py =================================================================== --- branches/0.9.x/scipy/fftpack/tests/test_basic.py 2011-01-16 15:15:41 UTC (rev 7059) +++ branches/0.9.x/scipy/fftpack/tests/test_basic.py 2011-01-16 15:16:43 UTC (rev 7060) @@ -417,8 +417,8 @@ for size in SMALL_COMPOSITE_SIZES + SMALL_PRIME_SIZES: np.random.seed(1234) x = np.random.rand(size, size) + 1j*np.random.rand(size, size) - y1 = fftn(x.astype(np.float32)) - y2 = fftn(x.astype(np.float64)).astype(np.complex64) + y1 = fftn(x.real.astype(np.float32)) + y2 = fftn(x.real.astype(np.float64)).astype(np.complex64) self.failUnless(y1.dtype == np.complex64) assert_array_almost_equal_nulp(y1, y2, 2000) @@ -426,8 +426,8 @@ for size in LARGE_COMPOSITE_SIZES + LARGE_PRIME_SIZES: np.random.seed(1234) x = np.random.rand(size, 3) + 1j*np.random.rand(size, 3) - y1 = fftn(x.astype(np.float32)) - y2 = fftn(x.astype(np.float64)).astype(np.complex64) + y1 = fftn(x.real.astype(np.float32)) + y2 = fftn(x.real.astype(np.float64)).astype(np.complex64) self.failUnless(y1.dtype == np.complex64) assert_array_almost_equal_nulp(y1, y2, 2000) Modified: branches/0.9.x/scipy/linalg/matfuncs.py =================================================================== --- branches/0.9.x/scipy/linalg/matfuncs.py 2011-01-16 15:15:41 UTC (rev 7059) +++ branches/0.9.x/scipy/linalg/matfuncs.py 2011-01-16 15:16:43 UTC (rev 7060) @@ -91,7 +91,11 @@ t = 'd' s,vr = eig(A) vri = inv(vr) - return dot(dot(vr,diag(exp(s))),vri).astype(t) + r = dot(dot(vr,diag(exp(s))),vri) + if t in ['f', 'd']: + return r.real.astype(t) + else: + return r.astype(t) def expm3(A, q=20): """Compute the matrix exponential using Taylor series. Modified: branches/0.9.x/scipy/linalg/tests/test_matfuncs.py =================================================================== --- branches/0.9.x/scipy/linalg/tests/test_matfuncs.py 2011-01-16 15:15:41 UTC (rev 7059) +++ branches/0.9.x/scipy/linalg/tests/test_matfuncs.py 2011-01-16 15:16:43 UTC (rev 7060) @@ -93,5 +93,14 @@ assert_array_almost_equal(expm2(a),[[1,0],[0,1]]) assert_array_almost_equal(expm3(a),[[1,0],[0,1]]) + def test_consistency(self): + a = array([[0.,1],[-1,0]]) + assert_array_almost_equal(expm(a), expm2(a)) + assert_array_almost_equal(expm(a), expm3(a)) + + a = array([[1j,1],[-1,-2j]]) + assert_array_almost_equal(expm(a), expm2(a)) + assert_array_almost_equal(expm(a), expm3(a)) + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Sun Jan 16 10:18:02 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 16 Jan 2011 09:18:02 -0600 (CST) Subject: [Scipy-svn] r7061 - branches/0.9.x/scipy/ndimage/tests Message-ID: <20110116151802.082AA6F052@scipy.org> Author: rgommers Date: 2011-01-16 09:17:43 -0600 (Sun, 16 Jan 2011) New Revision: 7061 Modified: branches/0.9.x/scipy/ndimage/tests/test_measurements.py Log: TST: fix floating point text noise for ndimage module. (backport of r7038) Modified: branches/0.9.x/scipy/ndimage/tests/test_measurements.py =================================================================== --- branches/0.9.x/scipy/ndimage/tests/test_measurements.py 2011-01-16 15:16:43 UTC (rev 7060) +++ branches/0.9.x/scipy/ndimage/tests/test_measurements.py 2011-01-16 15:17:43 UTC (rev 7061) @@ -91,7 +91,7 @@ find_max=True, find_max_positions=True) assert_(len(result) == 2) assert_array_equal(result[0], [1, 6]) - assert_array_equal(result[1], [1, 2]) + assert_array_equal(result[1], [1, 2]) def test_label01(): @@ -440,12 +440,16 @@ def test_mean04(): "mean 4" labels = np.array([[1, 2], [2, 4]], np.int8) - for type in types: - input = np.array([[1, 2], [3, 4]], type) - output = ndimage.mean(input, labels=labels, - index=[4, 8, 2]) - assert_array_almost_equal(output[[0,2]], [4.0, 2.5]) - assert_(np.isnan(output[1])) + olderr = np.seterr(all='ignore') + try: + for type in types: + input = np.array([[1, 2], [3, 4]], type) + output = ndimage.mean(input, labels=labels, + index=[4, 8, 2]) + assert_array_almost_equal(output[[0,2]], [4.0, 2.5]) + assert_(np.isnan(output[1])) + finally: + np.seterr(**olderr) def test_minimum01(): "minimum 1" @@ -520,10 +524,14 @@ def test_variance01(): "variance 1" - for type in types: - input = np.array([], type) - output = ndimage.variance(input) - assert_(np.isnan(output)) + olderr = np.seterr(all='ignore') + try: + for type in types: + input = np.array([], type) + output = ndimage.variance(input) + assert_(np.isnan(output)) + finally: + np.seterr(**olderr) def test_variance02(): "variance 2" @@ -556,17 +564,25 @@ def test_variance06(): "variance 6" labels = [2, 2, 3, 3, 4] - for type in types: - input = np.array([1, 3, 8, 10, 8], type) - output = ndimage.variance(input, labels, [2, 3, 4]) - assert_array_almost_equal(output, [1.0, 1.0, 0.0]) + olderr = np.seterr(all='ignore') + try: + for type in types: + input = np.array([1, 3, 8, 10, 8], type) + output = ndimage.variance(input, labels, [2, 3, 4]) + assert_array_almost_equal(output, [1.0, 1.0, 0.0]) + finally: + np.seterr(**olderr) def test_standard_deviation01(): "standard deviation 1" - for type in types: - input = np.array([], type) - output = ndimage.standard_deviation(input) - assert_(np.isnan(output)) + olderr = np.seterr(all='ignore') + try: + for type in types: + input = np.array([], type) + output = ndimage.standard_deviation(input) + assert_(np.isnan(output)) + finally: + np.seterr(**olderr) def test_standard_deviation02(): "standard deviation 2" @@ -599,27 +615,33 @@ def test_standard_deviation06(): "standard deviation 6" labels = [2, 2, 3, 3, 4] - for type in types: - input = np.array([1, 3, 8, 10, 8], type) - output = ndimage.standard_deviation(input, labels, - [2, 3, 4]) - assert_array_almost_equal(output, [1.0, 1.0, 0.0]) + olderr = np.seterr(all='ignore') + try: + for type in types: + input = np.array([1, 3, 8, 10, 8], type) + output = ndimage.standard_deviation(input, labels, [2, 3, 4]) + assert_array_almost_equal(output, [1.0, 1.0, 0.0]) + finally: + np.seterr(**olderr) def test_standard_deviation07(): "standard deviation 7" labels = [1] - for type in types: - input = np.array([-0.00619519], type) - output = ndimage.standard_deviation(input, labels, [1]) - assert_array_almost_equal(output, [0]) + olderr = np.seterr(all='ignore') + try: + for type in types: + input = np.array([-0.00619519], type) + output = ndimage.standard_deviation(input, labels, [1]) + assert_array_almost_equal(output, [0]) + finally: + np.seterr(**olderr) def test_minimum_position01(): "minimum position 1" labels = np.array([1, 0], bool) for type in types: input = np.array([[1, 2], [3, 4]], type) - output = ndimage.minimum_position(input, - labels=labels) + output = ndimage.minimum_position(input, labels=labels) assert_equal(output, (0, 0)) def test_minimum_position02(): From scipy-svn at scipy.org Sun Jan 16 10:19:31 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 16 Jan 2011 09:19:31 -0600 (CST) Subject: [Scipy-svn] r7062 - branches/0.9.x/scipy/optimize/tests Message-ID: <20110116151931.3B1591B85C4@scipy.org> Author: rgommers Date: 2011-01-16 09:19:08 -0600 (Sun, 16 Jan 2011) New Revision: 7062 Modified: branches/0.9.x/scipy/optimize/tests/test_minpack.py branches/0.9.x/scipy/optimize/tests/test_optimize.py Log: TST: silence test noise from optimize module. (backport of r7039) Modified: branches/0.9.x/scipy/optimize/tests/test_minpack.py =================================================================== --- branches/0.9.x/scipy/optimize/tests/test_minpack.py 2011-01-16 15:17:43 UTC (rev 7061) +++ branches/0.9.x/scipy/optimize/tests/test_minpack.py 2011-01-16 15:19:08 UTC (rev 7062) @@ -13,9 +13,9 @@ class ReturnShape(object): """This class exists to create a callable that does not have a 'func_name' attribute. - + __init__ takes the argument 'shape', which should be a tuple of ints. When an instance - it called with a single argument 'x', it returns numpy.ones(shape). + it called with a single argument 'x', it returns numpy.ones(shape). """ def __init__(self, shape): self.shape = shape @@ -221,7 +221,7 @@ class TestFixedPoint(TestCase): - def text_scalar_trivial(self): + def test_scalar_trivial(self): """f(x) = 2x; fixed point should be x=0""" def func(x): return 2.0*x @@ -249,7 +249,11 @@ def func(x): return 2.0*x x0 = [0.3, 0.15] - x = fixed_point(func, x0) + olderr = np.seterr(all='ignore') + try: + x = fixed_point(func, x0) + finally: + np.seterr(**olderr) assert_almost_equal(x, [0.0, 0.0]) def test_array_basic1(self): @@ -258,7 +262,11 @@ return c * x**2 c = array([0.75, 1.0, 1.25]) x0 = [1.1, 1.15, 0.9] - x = fixed_point(func, x0, args=(c,)) + olderr = np.seterr(all='ignore') + try: + x = fixed_point(func, x0, args=(c,)) + finally: + np.seterr(**olderr) assert_almost_equal(x, 1.0/c) def test_array_basic2(self): Modified: branches/0.9.x/scipy/optimize/tests/test_optimize.py =================================================================== --- branches/0.9.x/scipy/optimize/tests/test_optimize.py 2011-01-16 15:17:43 UTC (rev 7061) +++ branches/0.9.x/scipy/optimize/tests/test_optimize.py 2011-01-16 15:19:08 UTC (rev 7062) @@ -67,7 +67,6 @@ err = abs(self.func(params) - self.func(self.solution)) #print "CG: Difference is: " + str(err) assert_(err < 1e-6) - print self.funccalls, self.gradcalls # Ensure that function call counts are 'known good'; these are from # Scipy 0.7.0. Don't allow them to increase. From scipy-svn at scipy.org Sun Jan 16 10:20:46 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 16 Jan 2011 09:20:46 -0600 (CST) Subject: [Scipy-svn] r7063 - in branches/0.9.x/scipy/special: . tests Message-ID: <20110116152046.8C0111B85C4@scipy.org> Author: rgommers Date: 2011-01-16 09:20:38 -0600 (Sun, 16 Jan 2011) New Revision: 7063 Modified: branches/0.9.x/scipy/special/orthogonal.py branches/0.9.x/scipy/special/tests/test_basic.py branches/0.9.x/scipy/special/tests/test_data.py branches/0.9.x/scipy/special/tests/test_lambertw.py branches/0.9.x/scipy/special/tests/test_orthogonal.py branches/0.9.x/scipy/special/tests/test_orthogonal_eval.py Log: TST: silence floating point test noise in scipy.special. (backport of r7040) Modified: branches/0.9.x/scipy/special/orthogonal.py =================================================================== --- branches/0.9.x/scipy/special/orthogonal.py 2011-01-16 15:19:08 UTC (rev 7062) +++ branches/0.9.x/scipy/special/orthogonal.py 2011-01-16 15:20:38 UTC (rev 7063) @@ -179,18 +179,23 @@ raise ValueError("alpha and beta must be greater than -1.") assert(n>0), "n must be positive." - (p,q) = (alpha,beta) - # from recurrence relations - sbn_J = lambda k: 2.0/(2.0*k+p+q)*sqrt((k+p)*(k+q)/(2*k+q+p+1)) * \ - (np.where(k==1,1.0,sqrt(k*(k+p+q)/(2.0*k+p+q-1)))) - if any(p == q): # XXX any or all??? - an_J = lambda k: 0.0*k - else: - an_J = lambda k: np.where(k==0,(q-p)/(p+q+2.0), - (q*q - p*p)/((2.0*k+p+q)*(2.0*k+p+q+2))) - g = cephes.gamma - mu0 = 2.0**(p+q+1)*g(p+1)*g(q+1)/(g(p+q+2)) - val = gen_roots_and_weights(n,an_J,sbn_J,mu0) + olderr = np.seterr(all='ignore') + try: + (p,q) = (alpha,beta) + # from recurrence relations + sbn_J = lambda k: 2.0/(2.0*k+p+q)*sqrt((k+p)*(k+q)/(2*k+q+p+1)) * \ + (np.where(k==1,1.0,sqrt(k*(k+p+q)/(2.0*k+p+q-1)))) + if any(p == q): # XXX any or all??? + an_J = lambda k: 0.0*k + else: + an_J = lambda k: np.where(k==0,(q-p)/(p+q+2.0), + (q*q - p*p)/((2.0*k+p+q)*(2.0*k+p+q+2))) + g = cephes.gamma + mu0 = 2.0**(p+q+1)*g(p+1)*g(q+1)/(g(p+q+2)) + val = gen_roots_and_weights(n,an_J,sbn_J,mu0) + finally: + np.seterr(**olderr) + if mu: return val + [mu0] else: Modified: branches/0.9.x/scipy/special/tests/test_basic.py =================================================================== --- branches/0.9.x/scipy/special/tests/test_basic.py 2011-01-16 15:19:08 UTC (rev 7062) +++ branches/0.9.x/scipy/special/tests/test_basic.py 2011-01-16 15:20:38 UTC (rev 7063) @@ -907,8 +907,12 @@ correct[2*k] = -float(mathworld[k]) else: correct[2*k] = float(mathworld[k]) - err = nan_to_num((eu24-correct)/correct) - errmax = max(err) + olderr = np.seterr(all='ignore') + try: + err = nan_to_num((eu24-correct)/correct) + errmax = max(err) + finally: + np.seterr(**olderr) assert_almost_equal(errmax, 0.0, 14) class TestExp(TestCase): @@ -1034,7 +1038,7 @@ assert_almost_equal(rgam,rlgam,8) class TestHankel(TestCase): - + def test_negv1(self): assert_almost_equal(special.hankel1(-3,2), -special.hankel1(3,2), 14) @@ -1319,7 +1323,7 @@ 123.70194191713507279, 129.02417238949092824, 134.00114761868422559]), rtol=1e-13) - + jn301 = special.jn_zeros(301,5) assert_tol_equal(jn301, array([313.59097866698830153, 323.21549776096288280, @@ -1332,7 +1336,7 @@ assert_tol_equal(jn0[260-1], 816.02884495068867280, rtol=1e-13) assert_tol_equal(jn0[280-1], 878.86068707124422606, rtol=1e-13) assert_tol_equal(jn0[300-1], 941.69253065317954064, rtol=1e-13) - + jn10 = special.jn_zeros(10, 300) assert_tol_equal(jn10[260-1], 831.67668514305631151, rtol=1e-13) assert_tol_equal(jn10[280-1], 894.51275095371316931, rtol=1e-13) @@ -1516,7 +1520,7 @@ an = special.yn_zeros(4,2) assert_array_almost_equal(an,array([ 5.64515, 9.36162]),5) an = special.yn_zeros(443,5) - assert_tol_equal(an, [450.13573091578090314, 463.05692376675001542, + assert_tol_equal(an, [450.13573091578090314, 463.05692376675001542, 472.80651546418663566, 481.27353184725625838, 488.98055964441374646], rtol=1e-15) @@ -1570,7 +1574,7 @@ for z in [-1300, -11, -10, -1, 1., 10., 200.5, 401., 600.5, 700.6, 1300, 10003]: yield v, z - + # check half-integers; these are problematic points at least # for cephes/iv for v in 0.5 + arange(-60, 60): @@ -1605,7 +1609,11 @@ self.check_cephes_vs_amos(special.yv, special.yn, rtol=1e-11, atol=1e-305, skip=skipper) def test_iv_cephes_vs_amos(self): - self.check_cephes_vs_amos(special.iv, special.iv, rtol=5e-9, atol=1e-305) + olderr = np.seterr(all='ignore') + try: + self.check_cephes_vs_amos(special.iv, special.iv, rtol=5e-9, atol=1e-305) + finally: + np.seterr(**olderr) @dec.slow def test_iv_cephes_vs_amos_mass_test(self): @@ -1667,12 +1675,12 @@ assert_tol_equal(special.iv(-2, 1+0j), 0.1357476697670383) assert_tol_equal(special.kv(-1, 1+0j), 0.6019072301972347) assert_tol_equal(special.kv(-2, 1+0j), 1.624838898635178) - + assert_tol_equal(special.jv(-0.5, 1+0j), 0.43109886801837607952) assert_tol_equal(special.jv(-0.5, 1+1j), 0.2628946385649065-0.827050182040562j) assert_tol_equal(special.yv(-0.5, 1+0j), 0.6713967071418031) assert_tol_equal(special.yv(-0.5, 1+1j), 0.967901282890131+0.0602046062142816j) - + assert_tol_equal(special.iv(-0.5, 1+0j), 1.231200214592967) assert_tol_equal(special.iv(-0.5, 1+1j), 0.77070737376928+0.39891821043561j) assert_tol_equal(special.kv(-0.5, 1+0j), 0.4610685044478945) @@ -1799,8 +1807,8 @@ y=(special.iv(0,2) + special.iv(2,2))/2 x = special.ivp(1,2) assert_almost_equal(x,y,10) - + class TestLaguerre(TestCase): def test_laguerre(self): lag0 = special.laguerre(0) @@ -1890,7 +1898,11 @@ # XXX: this is outside the domain of the current implementation, # so ensure it returns a NaN rather than a wrong answer. - lp = special.lpmv(-1,-1,.001) + olderr = np.seterr(all='ignore') + try: + lp = special.lpmv(-1,-1,.001) + finally: + np.seterr(**olderr) assert_(lp != 0 or np.isnan(lp)) def test_lqmn(self): @@ -1978,7 +1990,7 @@ eps = 1e-7 + 1e-7*abs(x) dp = (special.pbdv(eta, x + eps)[0] - special.pbdv(eta, x - eps)[0]) / eps / 2. assert_tol_equal(p[1], dp, rtol=1e-6, atol=1e-6) - + def test_pbvv_gradient(self): x = np.linspace(-4, 4, 8)[:,None] eta = np.linspace(-10, 10, 5)[None,:] @@ -1987,8 +1999,8 @@ eps = 1e-7 + 1e-7*abs(x) dp = (special.pbvv(eta, x + eps)[0] - special.pbvv(eta, x - eps)[0]) / eps / 2. assert_tol_equal(p[1], dp, rtol=1e-6, atol=1e-6) - + class TestPolygamma(TestCase): # from Table 6.2 (pg. 271) of A&S def test_polygamma(self): @@ -2041,8 +2053,8 @@ # correctly written. rndrl = (10,10,10,11) assert_array_equal(rnd,rndrl) - + def test_sph_harm(): # Tests derived from tables in # http://en.wikipedia.org/wiki/Table_of_spherical_harmonics @@ -2076,7 +2088,7 @@ def test_sph_harm(self): # see test_sph_harm function pass - + def test_sph_in(self): i1n = special.sph_in(1,.2) inp0 = (i1n[0][1]) Modified: branches/0.9.x/scipy/special/tests/test_data.py =================================================================== --- branches/0.9.x/scipy/special/tests/test_data.py 2011-01-16 15:19:08 UTC (rev 7062) +++ branches/0.9.x/scipy/special/tests/test_data.py 2011-01-16 15:20:38 UTC (rev 7063) @@ -206,8 +206,12 @@ # tgamma_ratio_data.txt ] - for test in TESTS: - yield _test_factory, test + olderr = np.seterr(all='ignore') + try: + for test in TESTS: + yield _test_factory, test + finally: + np.seterr(**olderr) def _test_factory(test, dtype=np.double): """Boost test""" Modified: branches/0.9.x/scipy/special/tests/test_lambertw.py =================================================================== --- branches/0.9.x/scipy/special/tests/test_lambertw.py 2011-01-16 15:19:08 UTC (rev 7062) +++ branches/0.9.x/scipy/special/tests/test_lambertw.py 2011-01-16 15:20:38 UTC (rev 7063) @@ -6,6 +6,7 @@ # [1] mpmath source code, Subversion revision 992 # http://code.google.com/p/mpmath/source/browse/trunk/mpmath/tests/test_functions2.py?spec=svn994&r=992 +import numpy as np from numpy.testing import assert_, assert_equal, assert_array_almost_equal from scipy.special import lambertw from numpy import nan, inf, pi, e, isnan, log, r_, array, complex_ @@ -78,7 +79,11 @@ def w(x, y): return lambertw(x, y.real.astype(int)) - FuncData(w, data, (0,1), 2, rtol=1e-10, atol=1e-13).check() + olderr = np.seterr(all='ignore') + try: + FuncData(w, data, (0,1), 2, rtol=1e-10, atol=1e-13).check() + finally: + np.seterr(**olderr) def test_ufunc(): assert_array_almost_equal( Modified: branches/0.9.x/scipy/special/tests/test_orthogonal.py =================================================================== --- branches/0.9.x/scipy/special/tests/test_orthogonal.py 2011-01-16 15:19:08 UTC (rev 7062) +++ branches/0.9.x/scipy/special/tests/test_orthogonal.py 2011-01-16 15:20:38 UTC (rev 7063) @@ -10,10 +10,14 @@ def test_chebyc(self): C0 = orth.chebyc(0) C1 = orth.chebyc(1) - C2 = orth.chebyc(2) - C3 = orth.chebyc(3) - C4 = orth.chebyc(4) - C5 = orth.chebyc(5) + olderr = np.seterr(all='ignore') + try: + C2 = orth.chebyc(2) + C3 = orth.chebyc(3) + C4 = orth.chebyc(4) + C5 = orth.chebyc(5) + finally: + np.seterr(**olderr) assert_array_almost_equal(C0.c,[2],13) assert_array_almost_equal(C1.c,[1,0],13) @@ -247,7 +251,11 @@ orth.sh_legendre(%(n)d) """ % dict(n=n)).split() ]) - for pstr in poly: - p = eval(pstr) - assert_almost_equal(p(0.315), np.poly1d(p)(0.315), err_msg=pstr) + olderr = np.seterr(all='ignore') + try: + for pstr in poly: + p = eval(pstr) + assert_almost_equal(p(0.315), np.poly1d(p)(0.315), err_msg=pstr) + finally: + np.seterr(**olderr) Modified: branches/0.9.x/scipy/special/tests/test_orthogonal_eval.py =================================================================== --- branches/0.9.x/scipy/special/tests/test_orthogonal_eval.py 2011-01-16 15:19:08 UTC (rev 7062) +++ branches/0.9.x/scipy/special/tests/test_orthogonal_eval.py 2011-01-16 15:20:38 UTC (rev 7063) @@ -99,8 +99,12 @@ param_ranges=[], x_range=[-2, 2]) def test_sh_chebyt(self): - self.check_poly(orth.eval_sh_chebyt, orth.sh_chebyt, - param_ranges=[], x_range=[0, 1]) + olderr = np.seterr(all='ignore') + try: + self.check_poly(orth.eval_sh_chebyt, orth.sh_chebyt, + param_ranges=[], x_range=[0, 1]) + finally: + np.seterr(**olderr) def test_sh_chebyu(self): self.check_poly(orth.eval_sh_chebyu, orth.sh_chebyu, @@ -111,8 +115,12 @@ param_ranges=[], x_range=[-1, 1]) def test_sh_legendre(self): - self.check_poly(orth.eval_sh_legendre, orth.sh_legendre, - param_ranges=[], x_range=[0, 1]) + olderr = np.seterr(all='ignore') + try: + self.check_poly(orth.eval_sh_legendre, orth.sh_legendre, + param_ranges=[], x_range=[0, 1]) + finally: + np.seterr(**olderr) def test_genlaguerre(self): self.check_poly(orth.eval_genlaguerre, orth.genlaguerre, From scipy-svn at scipy.org Sun Jan 16 10:22:04 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 16 Jan 2011 09:22:04 -0600 (CST) Subject: [Scipy-svn] r7064 - in branches/0.9.x/scipy/stats: . tests Message-ID: <20110116152204.33FCF1B85C4@scipy.org> Author: rgommers Date: 2011-01-16 09:21:54 -0600 (Sun, 16 Jan 2011) New Revision: 7064 Modified: branches/0.9.x/scipy/stats/stats.py branches/0.9.x/scipy/stats/tests/test_continuous_basic.py branches/0.9.x/scipy/stats/tests/test_discrete_basic.py branches/0.9.x/scipy/stats/tests/test_morestats.py branches/0.9.x/scipy/stats/tests/test_mstats_basic.py branches/0.9.x/scipy/stats/tests/test_stats.py Log: TST: filter all test noise from scipy.stats The tests for the zipf distribution are disabled, because they were generating floating point warnings for many (all) methods that can't easily be filtered. The chisquare test of dlaplace is disabled for the same reason. (backport of r7041) Modified: branches/0.9.x/scipy/stats/stats.py =================================================================== --- branches/0.9.x/scipy/stats/stats.py 2011-01-16 15:20:38 UTC (rev 7063) +++ branches/0.9.x/scipy/stats/stats.py 2011-01-16 15:21:54 UTC (rev 7064) @@ -2437,7 +2437,11 @@ n = a.shape[axisout] rs = np.corrcoef(ar,br,rowvar=axisout) - t = rs * np.sqrt((n-2) / ((rs+1.0)*(1.0-rs))) + olderr = np.seterr(divide='ignore') # rs can have elements equal to 1 + try: + t = rs * np.sqrt((n-2) / ((rs+1.0)*(1.0-rs))) + finally: + np.seterr(**olderr) prob = distributions.t.sf(np.abs(t),n-2)*2 if rs.shape == (2,2): Modified: branches/0.9.x/scipy/stats/tests/test_continuous_basic.py =================================================================== --- branches/0.9.x/scipy/stats/tests/test_continuous_basic.py 2011-01-16 15:20:38 UTC (rev 7063) +++ branches/0.9.x/scipy/stats/tests/test_continuous_basic.py 2011-01-16 15:21:54 UTC (rev 7064) @@ -158,34 +158,41 @@ def test_cont_basic(): # this test skips slow distributions - for distname, arg in distcont[:]: - if distname in distslow: continue - distfn = getattr(stats, distname) - np.random.seed(765456) - sn = 1000 - rvs = distfn.rvs(size=sn,*arg) - sm = rvs.mean() - sv = rvs.var() - skurt = stats.kurtosis(rvs) - sskew = stats.skew(rvs) - m,v = distfn.stats(*arg) + olderr = np.seterr(all='ignore') + try: + for distname, arg in distcont[:]: + if distname in distslow: + continue + distfn = getattr(stats, distname) + np.random.seed(765456) + sn = 1000 + rvs = distfn.rvs(size=sn,*arg) + sm = rvs.mean() + sv = rvs.var() + skurt = stats.kurtosis(rvs) + sskew = stats.skew(rvs) + m,v = distfn.stats(*arg) - yield check_sample_meanvar_, distfn, arg, m, v, sm, sv, sn, distname + \ - 'sample mean test' - # the sample skew kurtosis test has known failures, not very good distance measure - #yield check_sample_skew_kurt, distfn, arg, sskew, skurt, distname - yield check_moment, distfn, arg, m, v, distname - yield check_cdf_ppf, distfn, arg, distname - yield check_sf_isf, distfn, arg, distname - yield check_pdf, distfn, arg, distname - if distname in ['wald']: continue - yield check_pdf_logpdf, distfn, arg, distname - yield check_cdf_logcdf, distfn, arg, distname - yield check_sf_logsf, distfn, arg, distname - if distname in distmissing: - alpha = 0.01 - yield check_distribution_rvs, distname, arg, alpha, rvs + yield check_sample_meanvar_, distfn, arg, m, v, sm, sv, sn, distname + \ + 'sample mean test' + # the sample skew kurtosis test has known failures, not very good distance measure + #yield check_sample_skew_kurt, distfn, arg, sskew, skurt, distname + yield check_moment, distfn, arg, m, v, distname + yield check_cdf_ppf, distfn, arg, distname + yield check_sf_isf, distfn, arg, distname + yield check_pdf, distfn, arg, distname + if distname in ['wald']: + continue + yield check_pdf_logpdf, distfn, arg, distname + yield check_cdf_logcdf, distfn, arg, distname + yield check_sf_logsf, distfn, arg, distname + if distname in distmissing: + alpha = 0.01 + yield check_distribution_rvs, distname, arg, alpha, rvs + finally: + np.seterr(**olderr) + @npt.dec.slow def test_cont_basic_slow(): # same as above for slow distributions Modified: branches/0.9.x/scipy/stats/tests/test_discrete_basic.py =================================================================== --- branches/0.9.x/scipy/stats/tests/test_discrete_basic.py 2011-01-16 15:20:38 UTC (rev 7063) +++ branches/0.9.x/scipy/stats/tests/test_discrete_basic.py 2011-01-16 15:21:54 UTC (rev 7064) @@ -21,8 +21,8 @@ ['planck', (0.51,)], #4.1 ['poisson', (0.6,)], ['randint', (7, 31)], - ['skellam', (15, 8)], - ['zipf', (4,)] ] # arg=4 is ok, + ['skellam', (15, 8)]] +# ['zipf', (4,)] ] # arg=4 is ok, # Zipf broken for arg = 2, e.g. weird .stats # looking closer, mean, var should be inf for arg=2 @@ -43,16 +43,24 @@ yield check_cdf_ppf, distfn, arg, distname + ' cdf_ppf' yield check_cdf_ppf2, distfn, arg, supp, distname + ' cdf_ppf' yield check_pmf_cdf, distfn, arg, distname + ' pmf_cdf' - yield check_oth, distfn, arg, distname + ' oth' - skurt = stats.kurtosis(rvs) - sskew = stats.skew(rvs) - yield check_sample_skew_kurt, distfn, arg, skurt, sskew, \ - distname + ' skew_kurt' - if not distname in ['']:#['logser']: #known failure, fixed + + # zipf doesn't fail, but generates floating point warnings. + # Should be checked. + if not distname in ['zipf']: + yield check_oth, distfn, arg, distname + ' oth' + skurt = stats.kurtosis(rvs) + sskew = stats.skew(rvs) + yield check_sample_skew_kurt, distfn, arg, skurt, sskew, \ + distname + ' skew_kurt' + + # dlaplace doesn't fail, but generates lots of floating point warnings. + # Should be checked. + if not distname in ['dlaplace']: #['logser']: #known failure, fixed alpha = 0.01 yield check_discrete_chisquare, distfn, arg, rvs, alpha, \ distname + ' chisquare' + @npt.dec.slow def test_discrete_extra(): for distname, arg in distdiscrete: @@ -252,7 +260,7 @@ cdfs = distfn.cdf(distsupp,*arg) (chis,pval) = stats.chisquare(np.array(freq),n*distmass) - npt.assert_(pval > alpha, 'chisquare - test for %s' + npt.assert_(pval > alpha, 'chisquare - test for %s' ' at arg = %s with pval = %s' % (msg,str(arg),str(pval))) Modified: branches/0.9.x/scipy/stats/tests/test_morestats.py =================================================================== --- branches/0.9.x/scipy/stats/tests/test_morestats.py 2011-01-16 15:20:38 UTC (rev 7063) +++ branches/0.9.x/scipy/stats/tests/test_morestats.py 2011-01-16 15:21:54 UTC (rev 7064) @@ -3,6 +3,8 @@ # Further enhancements and tests added by numerous SciPy developers. # +import warnings + from numpy.testing import TestCase, run_module_suite, assert_array_equal, \ assert_almost_equal, assert_array_less, assert_array_almost_equal, \ assert_raises @@ -62,7 +64,11 @@ x2 = rs.standard_normal(size=50) A,crit,sig = stats.anderson(x1,'expon') assert_array_less(A, crit[-2:]) - A,crit,sig = stats.anderson(x2,'expon') + olderr = np.seterr(all='ignore') + try: + A,crit,sig = stats.anderson(x2,'expon') + finally: + np.seterr(**olderr) assert_array_less(crit[:-1], A) def test_bad_arg(self): @@ -96,7 +102,10 @@ assert_raises(ValueError, stats.ansari, [], [1]) assert_raises(ValueError, stats.ansari, [1], []) +warnings.filterwarnings('ignore', + message="Ties preclude use of exact statistic.") + class TestBartlett(TestCase): def test_data(self): @@ -124,7 +133,7 @@ W2, pval2 = stats.levene(g1, g2, g3, center='trimmed', proportiontocut=0.0) assert_almost_equal(W1, W2) assert_almost_equal(pval1, pval2) - + def test_trimmed2(self): x = [1.2, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 100.0] y = [0.0, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 200.0] @@ -141,7 +150,7 @@ y = x**3 W1, pval1 = stats.levene(x, y, center='mean') W2, pval2 = stats.levene(x, y, center='median') - assert_almost_equal(W1, W2) + assert_almost_equal(W1, W2) assert_almost_equal(pval1, pval2) def test_bad_keyword(self): @@ -151,7 +160,7 @@ def test_bad_center_value(self): x = np.linspace(-1,1,21) assert_raises(ValueError, stats.levene, x, x, center='trim') - + def test_too_few_args(self): assert_raises(ValueError, stats.levene, [1]) @@ -203,7 +212,7 @@ Xsq2, pval2 = stats.fligner(g1, g2, g3, center='trimmed', proportiontocut=0.0) assert_almost_equal(Xsq1, Xsq2) assert_almost_equal(pval1, pval2) - + def test_trimmed2(self): x = [1.2, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 100.0] y = [0.0, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 200.0] @@ -213,7 +222,7 @@ Xsq2, pval2 = stats.fligner(x[1:-1], y[1:-1], center='mean') # Result should be the same. assert_almost_equal(Xsq1, Xsq2) - assert_almost_equal(pval1, pval2) + assert_almost_equal(pval1, pval2) # The following test looks reasonable at first, but fligner() uses the # function stats.rankdata(), and in one of the cases in this test, Modified: branches/0.9.x/scipy/stats/tests/test_mstats_basic.py =================================================================== --- branches/0.9.x/scipy/stats/tests/test_mstats_basic.py 2011-01-16 15:20:38 UTC (rev 7063) +++ branches/0.9.x/scipy/stats/tests/test_mstats_basic.py 2011-01-16 15:21:54 UTC (rev 7064) @@ -128,11 +128,15 @@ def test_pearsonr(self): "Tests some computations of Pearson's r" x = ma.arange(10) - assert_almost_equal(mstats.pearsonr(x,x)[0], 1.0) - assert_almost_equal(mstats.pearsonr(x,x[::-1])[0], -1.0) - # - x = ma.array(x, mask=True) - pr = mstats.pearsonr(x,x) + olderr = np.seterr(all='ignore') + try: + assert_almost_equal(mstats.pearsonr(x,x)[0], 1.0) + assert_almost_equal(mstats.pearsonr(x,x[::-1])[0], -1.0) + + x = ma.array(x, mask=True) + pr = mstats.pearsonr(x,x) + finally: + np.seterr(**olderr) assert_(pr[0] is masked) assert_(pr[1] is masked) # Modified: branches/0.9.x/scipy/stats/tests/test_stats.py =================================================================== --- branches/0.9.x/scipy/stats/tests/test_stats.py 2011-01-16 15:20:38 UTC (rev 7063) +++ branches/0.9.x/scipy/stats/tests/test_stats.py 2011-01-16 15:21:54 UTC (rev 7064) @@ -158,7 +158,11 @@ def test_nanmean_all(self): """Check nanmean when all values are nan.""" - m = stats.nanmean(self.Xall) + olderr = np.seterr(all='ignore') + try: + m = stats.nanmean(self.Xall) + finally: + np.seterr(**olderr) assert_(np.isnan(m)) def test_nanstd_none(self): @@ -173,7 +177,11 @@ def test_nanstd_all(self): """Check nanstd when all values are nan.""" - s = stats.nanstd(self.Xall) + olderr = np.seterr(all='ignore') + try: + s = stats.nanstd(self.Xall) + finally: + np.seterr(**olderr) assert_(np.isnan(s)) def test_nanstd_negative_axis(self): @@ -1349,14 +1357,18 @@ assert_array_almost_equal(np.abs(p), pr) assert_equal(t.shape, (3, 2)) - #test zero division problem - t,p = stats.ttest_rel([0,0,0],[1,1,1]) - assert_equal((np.abs(t),p), (np.inf, 0)) - assert_almost_equal(stats.ttest_rel([0,0,0], [0,0,0]), (1.0, 0.42264973081037421)) + olderr = np.seterr(all='ignore') + try: + #test zero division problem + t,p = stats.ttest_rel([0,0,0],[1,1,1]) + assert_equal((np.abs(t),p), (np.inf, 0)) + assert_almost_equal(stats.ttest_rel([0,0,0], [0,0,0]), (1.0, 0.42264973081037421)) - #check that nan in input array result in nan output - anan = np.array([[1,np.nan],[-1,1]]) - assert_equal(stats.ttest_ind(anan, np.zeros((2,2))),([0, np.nan], [1,np.nan])) + #check that nan in input array result in nan output + anan = np.array([[1,np.nan],[-1,1]]) + assert_equal(stats.ttest_ind(anan, np.zeros((2,2))),([0, np.nan], [1,np.nan])) + finally: + np.seterr(**olderr) def test_ttest_ind(): @@ -1390,18 +1402,20 @@ assert_array_almost_equal(np.abs(p), pr) assert_equal(t.shape, (3, 2)) - #test zero division problem - t,p = stats.ttest_ind([0,0,0],[1,1,1]) - assert_equal((np.abs(t),p), (np.inf, 0)) - assert_almost_equal(stats.ttest_ind([0,0,0], [0,0,0]), (1.0, 0.37390096630005898)) + olderr = np.seterr(all='ignore') + try: + #test zero division problem + t,p = stats.ttest_ind([0,0,0],[1,1,1]) + assert_equal((np.abs(t),p), (np.inf, 0)) + assert_almost_equal(stats.ttest_ind([0,0,0], [0,0,0]), (1.0, 0.37390096630005898)) - #check that nan in input array result in nan output - anan = np.array([[1,np.nan],[-1,1]]) - assert_equal(stats.ttest_ind(anan, np.zeros((2,2))),([0, np.nan], [1,np.nan])) + #check that nan in input array result in nan output + anan = np.array([[1,np.nan],[-1,1]]) + assert_equal(stats.ttest_ind(anan, np.zeros((2,2))),([0, np.nan], [1,np.nan])) + finally: + np.seterr(**olderr) - - def test_ttest_1samp_new(): n1, n2, n3 = (10,15,20) rvn1 = stats.norm.rvs(loc=5,scale=10,size=(n1,n2,n3)) @@ -1429,15 +1443,20 @@ assert_almost_equal(t1[0,0],t3, decimal=14) assert_equal(t1.shape, (n1,n2)) - #test zero division problem - t,p = stats.ttest_1samp([0,0,0], 1) - assert_equal((np.abs(t),p), (np.inf, 0)) - assert_almost_equal(stats.ttest_1samp([0,0,0], 0), (1.0, 0.42264973081037421)) + olderr = np.seterr(all='ignore') + try: + #test zero division problem + t,p = stats.ttest_1samp([0,0,0], 1) + assert_equal((np.abs(t),p), (np.inf, 0)) + assert_almost_equal(stats.ttest_1samp([0,0,0], 0), (1.0, 0.42264973081037421)) - #check that nan in input array result in nan output - anan = np.array([[1,np.nan],[-1,1]]) - assert_equal(stats.ttest_1samp(anan, 0),([0, np.nan], [1,np.nan])) + #check that nan in input array result in nan output + anan = np.array([[1,np.nan],[-1,1]]) + assert_equal(stats.ttest_1samp(anan, 0),([0, np.nan], [1,np.nan])) + finally: + np.seterr(**olderr) + def test_describe(): x = np.vstack((np.ones((3,4)),2*np.ones((2,4)))) nc, mmc = (5, ([ 1., 1., 1., 1.], [ 2., 2., 2., 2.])) @@ -1663,22 +1682,41 @@ ''' Test a 1d list with zero element''' a=[10, 20, 30, 40, 50, 60, 70, 80, 90, 0] b = 0.0 # due to exp(-inf)=0 - self.do(a, b) + olderr = np.seterr(all='ignore') + try: + self.do(a, b) + finally: + np.seterr(**olderr) + def test_1darray0(self): ''' Test a 1d array with zero element''' a=np.array([10, 20, 30, 40, 50, 60, 70, 80, 90, 0]) b = 0.0 # due to exp(-inf)=0 - self.do(a, b) + olderr = np.seterr(all='ignore') + try: + self.do(a, b) + finally: + np.seterr(**olderr) + def test_1dma0(self): ''' Test a 1d masked array with zero element''' a=np.ma.array([10, 20, 30, 40, 50, 60, 70, 80, 90, 0]) b = 41.4716627439 - self.do(a, b) + olderr = np.seterr(all='ignore') + try: + self.do(a, b) + finally: + np.seterr(**olderr) + def test_1dmainf(self): ''' Test a 1d masked array with negative element''' a=np.ma.array([10, 20, 30, 40, 50, 60, 70, 80, 90, -1]) b = 41.4716627439 - self.do(a, b) + olderr = np.seterr(all='ignore') + try: + self.do(a, b) + finally: + np.seterr(**olderr) class TestGeoMean(GeoMeanTestCase, TestCase): def do(self, a, b, axis=None, dtype=None): From scipy-svn at scipy.org Sun Jan 16 10:23:02 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 16 Jan 2011 09:23:02 -0600 (CST) Subject: [Scipy-svn] r7065 - branches/0.9.x/scipy/io/matlab/tests Message-ID: <20110116152302.6BB9B1B85C4@scipy.org> Author: rgommers Date: 2011-01-16 09:22:54 -0600 (Sun, 16 Jan 2011) New Revision: 7065 Modified: branches/0.9.x/scipy/io/matlab/tests/test_mio.py Log: TST: fix matlab.savemat test to not emit FutureWarning. (backport of r7057) Modified: branches/0.9.x/scipy/io/matlab/tests/test_mio.py =================================================================== --- branches/0.9.x/scipy/io/matlab/tests/test_mio.py 2011-01-16 15:21:54 UTC (rev 7064) +++ branches/0.9.x/scipy/io/matlab/tests/test_mio.py 2011-01-16 15:22:54 UTC (rev 7065) @@ -358,16 +358,15 @@ fname = pjoin(tmpdir, "a.mat") # Check that file is not left open - savemat(fname, x) + savemat(fname, x, oned_as='row') os.unlink(fname) - savemat(fname, x) - + savemat(fname, x, oned_as='row') loadmat(fname) os.unlink(fname) # Check that stream is left open f = open(fname, 'wb') - savemat(f, x) + savemat(f, x, oned_as='column') f.seek(0) f.close() From scipy-svn at scipy.org Sun Jan 16 10:23:39 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 16 Jan 2011 09:23:39 -0600 (CST) Subject: [Scipy-svn] r7066 - in branches/0.9.x: . tools/scipy-macosx-installer tools/scipy-macosx-installer/art Message-ID: <20110116152339.9E5E81B85C4@scipy.org> Author: rgommers Date: 2011-01-16 09:23:36 -0600 (Sun, 16 Jan 2011) New Revision: 7066 Added: branches/0.9.x/tools/scipy-macosx-installer/art/dmgbackground.png Removed: branches/0.9.x/tools/scipy-macosx-installer/dmgbackground.png Modified: branches/0.9.x/pavement.py branches/0.9.x/release.sh Log: REL: Fixes to release script: dmg name and check/set correct g++ version. Also moved the dmgbackground.png file to its correct place. Modified: branches/0.9.x/pavement.py =================================================================== --- branches/0.9.x/pavement.py 2011-01-16 15:22:54 UTC (rev 7065) +++ branches/0.9.x/pavement.py 2011-01-16 15:23:36 UTC (rev 7066) @@ -238,7 +238,6 @@ if os.path.exists(d): shutil.rmtree(d) - #-------------------- # Documentation tasks #-------------------- @@ -431,7 +430,7 @@ # (should be done in the release script). if not osxver: osxver = os.environ.get('MACOSX_DEPLOYMENT_TARGET', '10.3') - return "numpy-%s-py%s-python.org-macosx%s.dmg" % (fullversion, pyver, + return "scipy-%s-py%s-python.org-macosx%s.dmg" % (fullversion, pyver, osxver) def macosx_version(): @@ -486,7 +485,7 @@ @task - at cmdopts([("python-version=", "p", "python version")]) + at cmdopts([("python_version=", "p", "python version")]) def dmg(): try: pyver = options.dmg.python_version Modified: branches/0.9.x/release.sh =================================================================== --- branches/0.9.x/release.sh 2011-01-16 15:22:54 UTC (rev 7065) +++ branches/0.9.x/release.sh 2011-01-16 15:23:36 UTC (rev 7066) @@ -1,6 +1,16 @@ #! /bin/sh # script to build tarballs, mac os x and windows installers on mac os x +# Check we're using the correct g++/c++ for the 64-bit 2.7 dmg. +# We do this because for Python 2.6 we use a symlink on the PATH to select +# /usr/bin/g++-4.0, while for Python 2.7 we need the default 4.2 version. +export PATH=~/Code/tmp/gpp40temp/:$PATH +gpp="$(g++ --version | grep "4.0")" +if [ -z "$gpp" ]; then + echo "Wrong g++ version, we need 4.0 to compile scipy with Python 2.6" + exit 1 +fi + # bootstrap needed to ensure we build the docs from the right scipy version paver bootstrap source bootstrap/bin/activate @@ -20,12 +30,18 @@ paver sdist export MACOSX_DEPLOYMENT_TARGET=10.6 +export PATH=~/Code/tmp/gpp42temp/:$PATH +gpp="$(g++ --version | grep "4.2")" +if [ -z "$gpp" ]; then + echo "Wrong g++ version, we need 4.2 for 64-bit binary for Python 2.7" + exit 1 +fi paver dmg -p 2.7 # 32/64-bit version -paver bdist_superpack -p 3.1 paver bdist_superpack -p 2.7 paver bdist_superpack -p 2.6 paver bdist_superpack -p 2.5 +paver bdist_superpack -p 3.1 #-------------------------------------------- @@ -39,4 +55,3 @@ paver write_release_and_log - Copied: branches/0.9.x/tools/scipy-macosx-installer/art/dmgbackground.png (from rev 7065, branches/0.9.x/tools/scipy-macosx-installer/dmgbackground.png) =================================================================== --- branches/0.9.x/tools/scipy-macosx-installer/art/dmgbackground.png (rev 0) +++ branches/0.9.x/tools/scipy-macosx-installer/art/dmgbackground.png 2011-01-16 15:23:36 UTC (rev 7066) @@ -0,0 +1,506 @@ +?PNG + + +IHDR???????iCCPICC Profilex?T?kA?6n??"Zk?x?"IY?hE?6?bk ??E?d3I?n6??&??????*?E????z?d/J?ZE(??(b?-??nL?????~??7?}ov? +r?4??? +?R?il|Bj???? A4%U??N$A?s?{??z?[V?{?w?w???????@?G??*??q +Y??????inf???O??????b??N?????~N??>?!? ??F????????a?????=5??`???5?_M'?Tq?. +????V?J?p?8?da?sZHO?Ln???}&???wVQ?y?g????E??0  ? +HPEa??P@?<14?r?#??{2u$j?tbD?A{6?=?Q??/?y x x x x x ?????????????N??ooooo?? +x x x x x ? x@?'????????????t??????f?N??ooooo?? +x x x x x ? x@?'????????????t??????f?;??B?Rb?:?8????jL?q???? ??L??;7???:??IlGVb?????D>?)??k{yyW??=?}Q?9?sQ????8???~h?;F???@~??TEEG,????J'???|2?2K.]p?90&??G??Q?9*??8??$???B??? ?52????r?c??gF???g??vv????E??E?-???????????]?h?qL{?,?"?=\^=7?H?????GK"u????T"&iL?gF???4zLry?$?Ay2??d?II#?/P??1?t??L?vu?}@?#P?????\N??????!?????I?P<H??C?Sl??????3?????@?&?V|'?q??B???c??[?[?[?[?Z???4n??c at -???l[c|$wY,?yc.?>S?? ???w|?-Y?? ??<8[?,%?????3?.?H*????*)++e?,S&?tJR?$@^A????,?\r?1???f?????`@??????G?ep???t?Q?aw????I:?-K&??????C???????????7???7.8.>???????y???"7?V&????qu???*???&?k?H?????~??.??)???XCwz??x.{j>?z+h)?? + N????"}X????Ke:??-?5V?KUUe,SQ ?.???:??d`?9?qN?#??9g,?qe?8?h???(?c@???9z +????????%?}2??????????.??????DVR?!,?[? +?zd$??xj???;??Y\G?@????J???? +,??K`$y?]????`:?k??O?km<~Pm?{8[??A<{?P??."D??u?N?&??J>v???S7?%??I?t???V?c?? +??????9??yon???b6@l?????p$?v@?A? ?9(?^W??I +????Q?_?:?:x?[??+4p????jM%+?:/{;?? ?T??1?qa??LJ??+???Q???'MM?X???U??????8??????+??9? ??cQ????e???i??????s?J??_l???M??>??MU???<_7?!H@l?~.?????.f ??N??8]??f?X???????l '?{?d??-?j????????>? +??h6L?&?/??B?B??dy?qR?q?p<}?????????Xssc???E?????n8G?;? ??M,???F?:Q=`.$?pV??M<?X&? +U???Z?.? ??19]???,#?u-?(???????c?|? ????9?1???;?0^"P2_ ??????;???????!?jj??7??wc??Yr???h6l?>@?`??R?X????????>;>??D?x$x`:^??&S?b?4D?1?^?X8???U??oo~p?????I????e????????\??L?0/?-0% ?m%\; ?Q-??8??=2Y?C????????}??????n1?o&t%HCt,??4&???r?1ZX~?M???yV;??0?"???d????K7}$???*?t???q?f??x????U?Y?#?J<F1)??H? +? +JOE????${?%]B?????d???!?[?,` ?Td??"??????H???d?fDO? ?B???? +a?^;ww?b6??9~???6l?,??b???L?fP+h???q?`t???3?0??????????//??OA??c???Y3w???,?e? ???YDca#"??3???3M??Z_??nh??2???2e1.tkk????+?*??#??? ?MV?$?f?l???f??_?}??Q?)??C1?}?? S??w????v? ??G?In???????-???????8?.???/y???o#???? ?bG??=???????l?Sh??9?s??1#L }?l???9?b??A????O?a]?,?Z" ???n??[?G?d/?"83m0 ????????)|-????hG:???>"??I?i?At[A?qt??? p??F:????????t?@???q?X??4G???z????#A1t??>?L??u??8???F??K`????V?H:?????????-??o@??!Sp?"^????? 2??_?qw?C>???????:?|???q?Fh?+i??/$]?Yl?????n9>6???.s-???(?d????qis?=$\.|????S +???:?gF ???|?!?>F ?????0>?28???tY? +?a? ??!???????8????L?NL>?(i??8?7 [?"??z\??s?r ?.????????T??a??,o??x}???T???j??*2?????od?#? <???b?IP??v??0????-?y? +? x ?%???76j!?)????? +P??'?Y?????3^?\+?iQ?f??pu??\>?3A?????n?]?L~?a??@?D?mL????1?=?p?n?c.?8???Y+{.x????Ov,?C?`>???J???Dg'?H?M?["?I??????????|?jh?????Q??Y^??9?#H?9??7;?s??\???????? ? +u?C?|2?n??}?3?nA???{?:N??!f???b??k$U???%???l??!?,???9V??iG????SV??*???({??I'?]?H%F?)|??`?:b?6V~? "???,Q)=?(?a?-??R??4??Ic?lY?s?i??X???y,j?a???U??$??? w?cgv??E????T,??????C????}?Q'A???y???t???}D???H?"@????????8?Ez??Xu3???s?wA?F????[x?????:g8???????#?????8??7 +h??? +???yH?????? ~?????# +???*??[4T??elsA?^?f88?h|??E?2{??0?k#am&??B?6???dm0??5gl???YH(?????49?y^[?QN_y?w????A??@??? +?&??$nC?>????R?X'?e?60??&?(P?C????Q??a$??\?\?l?o#o?y? +?+????? +?Y???@G#??^F?} +??_ ?u??W???Z?f????9????????M????e?'??h?? ? +"c??S$??????:??U?????]t? oo?c?B???=H??B?H??F? ?~ ??}Gs???????;??????? c????c? ??\nS?????Yb+?\?/????G??l??#/?uM?)????^???q??O?f??H?????u??&lSJ)?????\;"???(?Ax???>???*????A???????G?z?1?S?+???K????zP?= N??5??R?:????Gk???????Au??{? ?E??g??}dzG ????b????"??/R? ?0?L0ol??q?p?5G???K?????I?f????1S?PL*???c???????-???\?????????!?i??^???? +?QO ??`:??????9??????5?dOw??0M?G ???h5???Fx/4?7?%D?5??sW?x2-?s???@l????? +?x:???p?????~ ?????????? ??p-h#v?Vqv?? ?)?X????ZbKU???> +???M7?sAt?eyY?V?O??%??.lVqe?pQ???????A??M??s?tw#?n??)??{??h@???i????_4???l?D??=???6??+M?0?? ?? +0???k??m?C?]B?F?#,Ua???0U?j?]????U?G?:O.>m?TW??"7ES??pzX(4?U?K?????>???D???_??Vm?2L??H]+F??z!g8]s??Zq?"?\?j??%????>6???n??m.??????r,;?????,{oo??????"????????,0????Y?i#?|???{???b???\%????x?J????=l?A?zV?|p?U|?z'???q?? ???h?"?+?C?d????~ ?.b???d? +,??q???? S?+????ih????x??F?x6??J? +??ag?????)?y"?????\^4K????????J>??7?;/9]j???ph???#?.?IhR5? +u?\??_?t???G?*?`?????RQ;p?nc??c ?????K?5*I+?eQ??3??+??-?8n?????]?Y????w????ZIT|@?u?q4?????!'7???????}"7B?]AvR??!???[44?S??2F#:_v??&Y.??A???z-}??@??iE?9?????p1??N??????6:?"D>????d]???f,???`#???:r??;????MfGb??m +I??x?5?8 +??L?O???|?????"?S??(?tm?????-????L:?9??&??Y???3i'??I?&????????D???,???`?????^??p??1?`FN????FR)?s?+????:=N??;?A????1??H???O:????yM????e??N??c ???@???@??Y?88a??3?|?a%??_????ziH?au??????????N?v?mR??~q??? y?-P?l`A?? +?5?m????9?[A?3N???Z +??t"?ic???M??Sp-V??&RY[<\%??I???c?NbT?]?????v?gr???2h?@?A?????z +t:h%h?? ????????x7#??Z?????d???c???1??mj?w???`??m???T??_?[??%?3????[?@?}????seA{c??&C-?U?k!*?j}?x???;???????n???G????I%R_U.? +??xV??\^???????|??3??l\???_???r?\N ??!???#?cr??F r?s? x?Fo??^e?k?-?w?u???'?????????z?.????@ ?:?Y?F??WYx??2?U?/w??N?Z.???Z +? d???nq +???%??????J???A? ???2tl?? ?? .??????D at g]?m??k? ???????F?OU?]??4???ba?9Fk?V?bg????q???`!?U +???? +ZE$H??N0?w?1z>?oD?9s[??q?,?????6?????DUnx? ?~v?6y??kd+F?;???.?$??,\`???tas[??tR????^_) +??r???r????????c????K?6????7?&/a???|AT?e8(??K7????H\???e?\3???h?P??DD?e5??0{????2 +?O?.?????o?? ????"?C?>p[?}??????)&7? ?'????:!? ???v[?? ????2???i?7????7`??A?3?Z??@t??v???4?Bg??????NW;????????????X?}??{????^???????_??#??Q?????9R????h?*????????v?????cE???i?HhT??IH?)?G????IO????? g?/;MN?t{?8 +_:#??1???w? ?M?>%???q???+???q??*??[@i??t??zP?,?=????;?M??a?|\?4? +?????.P?'?!??X'?????????? +?????)+??g? fu?$?+@o?|:?OwQ??]M +?\p?oJ???n?????K???}???V&`?!??w?? "?7 ?5??=???f ????W%*???%?N??l?D?? +)?k?W`tn???}?E?g???2F??k?????lT????+?Seer??ErF?&1 +c??????/?=??F?T??A????(???t?.j?????????>????d3??t?J?&??Y?3?q?x??R?qE.^???j +?G???0??)??Mq`??e+?]P??b?b?????#??\"???3??pt??2??{$/???O}y??O?A?7??X??+A[A?};????8e?8U~???%?/??z??E??m??DKz???ml?y",?7??7?4?F?? +???wzs"%==????????^?$C?}???]x?;?u???2????3?p4`?o?o@~??*?w?v????XN? ??h ??<?\L?_|?1r?S/?M?z?[?D?????]?.W?H??VET??_?Ms??c???, ??7S?$???z??????8(U#??ERY???W?%~\?r???bj?T?????$??Kd???c?_?P8????A?D????z???|?"??d?} ~B??E?????o???????????O&p?g???`[l???????????n??w ??Z??U??3??_???????*Q?????'8?????????W?.Y????{??3?n???]?h????u????r?=`??#;??v?['^?????.?%2?rW????>?Z^-??WH? +??q?]???QCM??? ? +??F??k??O??l?&???F1b??? ??.z?,??????J7?Y?4????o???z??p?????|F?V?e??tk[??`?=P?P?UZF??.? ,?2X?Q??T/????>??}p???x???L~?a???j???8cF(`Y?(?????oI~?q? +?\?*?5?5?z????S D?)???0?W???????????0?T J????_ ~l?u(??Y?\ ?m?? ?$?u|??Z?w??+?? +??g?I_j?~= :^z?b?W?x?0:z?C?p}? +??????????9??^?????u??-??@???????C|??????x?]?2?T?;?~t>?5yRg?+O????-?ml?Z??+?a8?&??p??:?????tq?l?th??@?:A??? +X???g|?d?????????; o??"???,}E-?:?#?r?\?]?????G?HMsN??f?!X?7?QUSS7???6???? +?????5W?*W??L?)????f???u+?>?Q????&,???y?-?? ??T????4?s?a????0?? ;?0 +??*?i?+????c1A?G?gJ??wA?KZ??6??5??K2sF?I??4?f?t??f???????O?????????h>?% ?~qe?nG?O?~??|J??O +f???:??oF"???y4?e?6???G?N???P??K???1????????W?????]?:??h?? ?????L?l?|P?????A????1????S?????3!,????w??1?Z???H?n?l????a??7??'+???&??04 ??r?cB??A ??J +\P?? +?????xc???r??x~t%???? wu??????_?,mx?????F U?C??2x%vT??? +?e??V???~??I?}???1?Z?g/???^b2?g?<???3???????+?Q??P(??-?)?Q??2]^35?? ?>z?:q[?????????? ?d???N ?; }b7???}V???o?'|??{7S,??J?e?!`b?i???Mz??JE????'??QZ?????R?6??K?b?z?? +????7?,;???[?>?anh????? \ ?? j?``@H ?? IC{G????@?????QzeC???|SC`?%?: ?.???????p??RM???s??{n????s??.?@?*'?????&?Lw?I5%?6??q?N?=r????>!??a +?l9l`???S??O?????????Y5yt<v?&??9??m???A'??5O$??)??5????????6GSPen?????k?|??O`????c??D ??? +??+??z |~?pm?!??r??*>`?w??<# 8???: ? ?+?????,o???^z??`??8z4?b???^x???~???V???x??;??_Jn?#L?,?G? ????a?W??????8???Htzq?:?Z?.?Y??y}???E? +???????!&s?%????+??du???,???hjuas%??H? `?????MQ?????}?D-$!-?nUg?G???{??;?6S?nl?z\K +}1?A??)t/o?)?????dwY?}v?O??G?3?????IV?3 ;??tP{x??8??????????*?????|?O??r?U?h8?nOb?n*?g?P??? +!???7?[? q?y???6{*?`?;628??b??%?pFE,???????}&???w??b?Z)kx???Zc5??b???d?o??? +JWW/:??????af\?tx\????p??y{ 5????????Q{????Y?7+??i?????i????????26/Kf???.x+???X?)??v???^x?|???d#nV?|}??)>w??2??QxN?(??S?zP3H???>n???$?????AO?dqK?4c'??|i??fcQ_-%???4m?B?????????N*????f???_?9 ;??M%fCYz???*L;??_)#??$?['??G?o?=(?N?t???????+ +G??}?????L?8?l????'???I??9=W"??-?q??1 +|?:?!&q????????]?1?c??Q?=?+??M?1?????l7?1hMW???8|??t? ?C9?"!7??m? +0'???|??g?TH??r???s~?|???e$??O???D????RuVy?o?x?E? +?? IDAT +?y;v?????????????????p7Z??!??n??y?[.??~R??+U?? +v?u=???????y?T?j???2????????j?l4?Uh?y ^@??~3j?o?3A???&????/???? ? ???u??t ~ ?:?=??h?N??_? +??"C?? Ur??? ;?????\???T1Zr?? ?w +??u?c????"?%????e???q??S?????????? ???M} ?;ud?R[UP? +)?"?????? ?w???(?S??n.?z???????ai??(??`?H!c?Nu?b?1:?8Wa???? +?l?????????S??? +}?xz?????T.?*???? +79?nz?X& ?? ??v???#x?[??c????Z????S?V???` ????h?? ?????????G?????x?W??????"?E????p??g#j?v???>???X?d???"wz?y ?`???a;h??{?l&V???x?_1v??????p]}?xS<?z??????-?z????a???W|R?Z?????u 1?I V?b!\????L*???o8(8?Tk?V????@^`N?g&?V?T:??:?t?M???????F????+???t>??s^??]1}????????v7?????9#a +2?) 53?? ZA ?i>?v\?t?<u??-J%???g????|????%s?#o=G*0mM0?) +?-`?eXH?g?L???W?u{p?n??3??1?|PGo?????????uNK?@????;? (???,+{"_?A???Q.??@,v2????j[eqd? ???[?/#???m???????w???h?????????U?tP&3?#???;?SA??????:?5????&???-p?z?0R?t +6?????m?;?M??i)?????????,#_??^o???=?;??I?? +?K}W6????#>? ??-??^??????- n???H???g????^4/v?? s???)o????????p?Q?X>G0/?M?oo??Z?_%hs????????J?p) ???R???????#??????=X?Dn +#???p?? ?4E +???????-x?????U{>N>?g??i&?1D*??S????????U?vj???k?Ez?9}?G?H?? i?#|??w?86?C??U?7?;F?xK?|??????_?f??Q?????_?2?>!?o??i??e?6??o_?&?|?n???r?????lK? ?5??J?>}????X3y???|?[?p??????????2qo????Y??9R?V#t??DM??Xi?B?fO?g?)???_?F????/C?????}X????|_\???"O?? (??O????1???F?'U?M?X???C?EL??fbYt?w?????74H?u?$????/??I#v0?5????f?~i??+???M +?8M?JpH?sk.???]????n??7?P??????+?s?2?Q?N34?Y-?? N???L???J?? S?????????`??????LY?????G??d????X?x??m???M??q?{??Z??tlm>???? 7_?`???9??r?4??y9?? F?!9?V???KW?"???l6U??L2???-?{?Y??8M?O9?|A{??W?c??:?  ?? Td??iE)?Y ??V??X'%M?rY???z?N?7??????????? ???75m9??????w??*???? @???g?V@???@???????????j?_??Y???_??@?t?0??L3????????!b???N????S??@?2??? +? nmx?k{fR,?92??E??E??]??$1P?6?X???Qz?-?-?-0?-0???;???H???1?^???p??G???v????????????\?t??y??+???????T?^???1?c=?Qw????q?!Ee +S?|??? ?ex??u??5;dnj.:c)???N??L0.??6??_?h????'?=?N??kd?Qs??????&?}????o?>????Td???f?/A?u?b8??o??1q??8g??\??fl??Y#??O??YN???? 2"?:D?F?3?SX?5?e??!P[????6d??b?????%9????s???v?\~?1??g?????w???Zy?????CO???\' g5??~????KN?Y +???zF??????/?P?Xl8????0???h#s??v??]I??O??6?c?????????6#r???n@+??U3:?*?B?????8UC?v?F?$??l???`)?i??M^|D???-???&?c48?#?P???z????????J?N?>?(?????t??R2?G?e??&?wJ?8W?P/?)?????$???q????y|&??'?0?Jb?{L?cgB?$R?`![O??i??O?~t?\~:?)??? +j?:[??T[)??4? ??o+?I?8=&???1L???bU?<2Y???8B= NYb%?S??[^? ??f????Kr??+?uK??YKgK]??t???6???~A?\?^n}?9???5 X??Y??? +????2??l#??k????????{??????~A?#?sT@??:AZEV???sE???Rp?O?? +???_????????????C?zO~$?R,?c??w ?:????2?c??#?x?.?d?+AVe"?79?e??q??4[y C?.?y??m?F????ji??????[???+?=???^l????p:??5??,}???9??x???#??????r??`??Iv???g??{??Y2 ???5R??????9,??'e{????}??$C??W??%??????q???????~l?C? ?*??????op@??n?~v=?r?|Pi}\?y~???~XqP?D????5??;oo?im?i? }9?n???-{7?k??? |?+?@#?k<?????2]?? +??????QY?F?????+C?Oo(?4?t?Nj???D??;??es?#%6*gVs?{{?????o?v??{?:V,l'p?k?x? +?P-n>??w?????D?4?|8??upzMg(??? 1???7$??r???????N0g?????tJ u?s??'W_r??? ????q?????FD?Y?,??Pz????4????Q?? V???!?0?.W??Ls?$???U???Kpv???%%??z?&?[???Y?m???N??i??eu?\*CZ(? ??i??3 +?N?Ceb?r?????????????t????l6?t{?I?????:$S??????]?|??????o?9 @??a??? G???|?0?x?a?a?X?U???J_?:fv=????!??&?S?e?1? ?n??ggo??s?t$SNm??H?\XoJ\?rtjl?BXy.?2??2Ce?mH?T?)D?;ooo?if?? +?CCX#.x?)?????cD0?????B?????#??E???~??)O6?????????2?a2?G??j+?o|x???B9jV}0J?qT^???-a/?e?\?r.F??d??}r?????[????r???4??$??6??7 ??????x<?O?$Z?X*hK?8?&?q???V??0?2E?*??R B?????2?~?S??l??r?o??N*????e???V??t'.lVZ1?Q.?~??z?v??]/??[?h???f6?l?]?5??iY??HRb?*?'??G!???????7????c??'1??????6;tC?&O?^??+&??,???L??u??X???8??r5l??S%>?z^q[??Uf?n?????m??e??.???#?l?+?v??"x????p??pz??W?? ?N +???iO?2????y????<:?A>?9? ?]??8??z x x L7 L[@?)???8????<[J???0}/??3wi&?8u???!???M?e ?X??X?VP?&Q6?\???iq?:????d??>y?YK???R?????=????- 3?????i??94?e?X?s_?6Q????G}???ew?l??-Om?#/wc?a7@^????s??]Y[`?? ???? 0?Rm?JZ"|????CDA?????y??z??C9S?%K??r?????4?Z????Dx +???6Y?yVo-??j?q~? +?x????$???? n:?L?5QZ$?!???q?{nM6z???(K;??+;h?;??Do?nX?k??t?}!g1?t?90???9\?i?Uh?? ?????i?#v??0Ex??&"?*g*???Q??G?#??n??E??5?????pM????g7I??>????.??*LH87?N????????z?? +x??tT;_??k?x/~;F?;?{:?d7????d-??LW?????X??????,???Lc???3?e??I,0Q:Q?$jZ2;??z?Y??"??? +e?????????^?@?n????sQ?8'<7??j?????j?Mg@???{]??@'???? ]"??~W???^D??Gy??]?i?a???a??)?0????2 ;2??Uf?6Ub?`N^|z?|??m??7o?????)???R??5?K? ++?IzE?????????1x}??Q?7]8 ??????^y???r? ???Oo?+P?Q?:????\??2zp??p5??1???4+????\Q?Lf_?????5?B.M?I$??????8?a:?2=.?4-^ ??ZHT??{?+??????)?7t?^????t?GSFCEi_B?j????p?*?C???g?????)?O@???~4?4s????????xN?? +??i??N=??lwl?Bt?+?S??I]??+????+?)O+???meyf%???X6??<?I??2dy?H?y???h;????p?????tO???~??d7? ??8U?m?????? ???????j?+?I?r?7D??']? ??Me;Ji????????k?r0G?I??B??)?y4Q?????)=??y?,??e?tlyhEQ?g5V????\?u???}??5??G?????o=vD8j??0tp???_???'3??{OJE2?JE????d??????`{2?????u{;2????\5x????????3?-?0????;_? #o1?3;Y???j???jy????#r??MSC??? +?????Ef?R?Rb?OqyN????`??????.?@?@?vx#Lc>??t(.?:??`.?ZCPv6??? ?S?/??????? ???@?????7?N????m???v???- ?7y{?v?^??&g??O??N?W~%X~??/???-?p?'?t +?????%??????n?\???o??Js???????????$?Tkw.????[??v?>"?:xB????w????????y???N??????X????? ????Om?^@?U ?$?????????R?8?M???Xo???????&?n??^:? ^C??C???}l?? ???m?????h20m? ??'|???Z????0?9?.[t]?????0 t5Yt?%??'???y +G????d_n4??p?(L?F??????6?????yD??D????A?q?}?K?xb??[`?o+???+/??u?? }3???ci?t??q6?-:?z????5?oB?~'q??uLw?????IE?mo??dC?F+K??p????p?m++P??wLw???t/?A8????%???s?????????G?cf?!?D~?/C???^&?X&????.??>]?}???z?Q8?A8?C??w?y'? ???????k?.Y?f??????????p????k8???7??S??S}??????@SX??]?????u????qZ?O:Q?q??z#y?h3??8??m/??g???D~???E????R)? +o?w???????\??:?3????'?b? ,????s???~>P??|9?l??zf,?W???c?q???n'????@7??\{?? ?H?~tF?(^IX at x?M?? +?k??f?.??i?"?_???C O?>H?q??+@?s??eO????z?? ?^????T?XO?,[y??x?%N???q??%?1??c???y?p?I?nr?q???S?N?^?S????Q?x??????I?27?(???????$? ???_??$?????{???M??????y??T?|??7?????O? ??G +???z??????]??NL?h???VK?????c8????g??^?????????Ji?p????r*??%?+?"K??????Q????Xv???se?u????*??t????M??6????N????p?E? v?????5???\????D??a???????????t?.??????/?!???N?\0?6??'<??#??H?D??`??`?M??|v??@????e?L???e?^???($????r?rX??S<???????a??u???_?k??A:x???+??b\JuH??DD???Q??K?e?a?Iz? ???A???+%^?e???A?y????|?2????Mu?Y;??u?-??o? ?'?%?g??@?Y??\????,?L?????m??[*?N??? C??Q?5.????}nZ?`Nz??.?u?:??DY9????????,R??????C???$V?E0O??J? ????`Q-??Silx??r]????????????ri>Q??-5???K?.??ia6??{??Z?????m?y;t?5Z???]u^r????N?c????X??qu +c???S?&?xrf????H?\?%???O ????(?%???sa ?l?z$???N?????:??\Z????[uy\f???(?x????????? X"!????Gj? +????$m2? ?3??Wd?-?Q?xeY"9?$uv r??}?CG??.l?_???p)?t\?]??[Pv?)??x??S?+?T??n?7O7e?????&Yn??g?2??K??VN +-*????Q6y?f?k`?8?AW???[n?>??;??_?[??w?~t?x??/ +???.v?N?eU???6?G??u????9???,??FyK +K?.!?e +????R +????M?)O???$??F???-?hC?????????y?9p???F,????S} +??b9?z?????y? +??"???????????n ??1?)>??v?ip?$???xb???D????"??pw???m?j??8??m?q??ld?b???>G?3???S??2 E????m%??????????oO????7?????:?????@??????*???????"n??H???????? +????_??r??X???p????:q??~?MG???l?p??2|?C???;?mku??[??U??@??Z?bP??#???3??Sot??j?????????N??)|?%?4??F>8??:?????{;??????Kv????-???f????y???M;cP?y;.??G??T??E?N=???y8#???0 +??Fm=?B??#9+??J??C??????O??k??>?rf?(?#!????<?>?*?KX|??????e??T.3???;????SY???T_?y?????n?i?n1nx8????? +zt??M????=:G??|????a???{?#x???O,?AM?'?>u?????.M?z?? +?????ke?g???=????;>?> ??? ?;%??L^-Gcziw]N?????H?????*.w?-?{???2??????M+?k>??????-?2????M??]8\???e??????^?.?!Z?k?f??#K??/?h/?_ +???????HM????D{??????A?n??0??%gWn??9?\???p?(? ?9????F?0??I???w????C?????+?v{?6?~;??:D;?s?q??p$??"v?7?99|??9Q`X~7???MCV??4o???$e???P??um?' |?????3$???????????v???a??9_9?q??YWa6????F?D'LJ??^NT?x?????S?iIf???j??,??F6???vu??lr???E?E??k??^?=?;g??????8]s? +!?N?'f:[j& +D?g?>??GC????c????:Pv,??h?/'???m"?'??'???9?m_???3n z?6?2??%??D??????Oe??x +qw?E~U??F?&???b???O_??y???*?e?????.??[ ?6?o&|?DB?I>8?W?]?K?_?????F +??'?$!?O}2??2?(?y[?vw?N?.?z?U?/9lX??i?l???i?? ?\????2??U??A/?t?nz|aX?r}t?y4[9??6??0?g ??JR?????N23)????E?ru?|Q??8)0J\?oR$????m???C??S}?gjc/?H 8?7??x?-q9?C?n????{??S@?x)?w????= \ nDv:?b????????????tT?#c? ???/uIN?d?S?O?{??mt?W??????$?'m7??O|?.???_??l?.o#?o?.$?f?nAv??N?B?f??k?--uw.?U?^??QA???5B?v?l??-??)??????L&?t?><8??)KJy?E)?6???r?by???? ??"???(???:yzy?= o??????sB?????eG?,? Q??{??v?yz??)|8t???q?.&?@???}??? ?`8??n?.??-?.n?8\?????t4???????@???Mg?u?'? V??'?:su;????k Z?p#8?????WO..&_j??Dy@?5.j????i`H??????w?N`???a?|>???O????^?#?l1???_??-??3?&????:z?{98|?6??|?_??cp8|H'?/?G?O?|p,?:?????m??v[??]@???]??9?:??Z?[`????????!?Oc?}?P!?N"?? ??????????va??A??W.~??a?={q???AwW3>??????/???t?=nd??????Q??????? ????S???, +???s?f?????bM??????????4??+?)???N?'nQy?s ???g2??m[C??]???????. M-??????y?;gI? ???O???I?p=t0:[w???????? ??+3??? ?????;?????}??o?^??+? t?,aX ???Ni6?)?2~G?????xP>P?B?`pz~??1???z~h??U*????????4iQ8??????h???i??1???C????mF=?S????x4?e?'eyz?+t???Y??[?+v???H??????Q?????????3X +V?????? +m?????4?9???E\??"?? ?? /+???^?uV A"?:'??t's???<~2??M??????gH???R7???R tt:n?c???N>?;??:y?I????u???2?&l??W???-qON??m???W?7???`??~6???f?????$??]'?h9uR??'??N}? ??O`??????????*p'????????V???V??? +????U?????q???c????eL???A??????%?sY???XUA??????{?];????*???????Q? %?a?j?v??#?u???S???7&?Y?v???$yV?t?????}?O??S??????2uw?,??z\^????????_?;????`u^?4????(?;Ux$??+???????O???E)^?vs?)??h#???????? ????qf}?(?<@E????m?L7?2)??b?e?]??d'?????<??E????U????????Loi?S??|???S?Q??t??e???????E??? +?6}+W?#?hv?];w +?x?N?3?!?????a??\d r?H?j?7??-? ??w??76:|?????HX?e??D???|U?O????A???'?A??`???????}??e?G@??~0?t?m???~&?w??]?=????_???l?F??F?u?i?w??!=o????????????????N?$?yp???q???????``???W?????l?_??C??? +\f??3?? +???5?S>G?Z?W?,?:????S??,?t?????Fw??????g????_|Eg?????T?`?NqW??U4??????+0\????1??'??fg??A?*?????&N?g????I_????kt?r??l???;? +_y?q?ul????z??'?>??????i?+?8?,??????qQfD???_?L??e1??${?)?:IO??X;?\?m\ \=?? ?z[???C?z;?[??F/??8?1N??@??s \??/?E?'??v}A??c:?> ???????????}w??jc??\??l8? ??q?????Z????!sw???????rn?>u? ;??u??~??{???i?O?v?e?e!??I???????NQ{~?(???3?C;??(2?c[?k??{? [G?ND??U?11?'D???h]??L`???T??????m?J???i?????lx???%????vs?P??d}x??e?k?&???C4????'??,K??????=?????S??#.??r9?N????~??3????3??????,?U9??n????Rbe)???'???P????o?/?3??????r??????xB??$????? [o?Al?a?4??L.>??.,??m?|:t^???[I*5:fj???C? J? :??=%????3??L%(Vp?? ?4d:?2-(G??F?????+e%??/l?????*?????dkJ? ?`???7%?'y::s????|?i????? ??+n}&??????)???l&?*F??<4?t s8x????C??9?\Y????+???}?+????}v??b????S?mweBe????|??&>?GQ?*y?v??M[C?'??*uc???L?????H)???&*???@??t??|?v????6?E{}???q;??? ?.??????\?a???Q[)N?{?"R^????????I??H??gR?x???A%?)?+???g?)?&?I?????e???t?i?au?~J??OYJ?y1fe?z??R?i??,?$?]?????m? +?k?5V??U??h?/?y???_?0??=??? ??"?s +?????z??m?? '??????CS?:s??y????tx?????{????p?csq??v???????[?nZ???!????C|????z??M??q?M?0???m??M??;?{mH??g????C_?sg?W?q?4?? ????.x$??2??A .|p??WMv z1???X?MkC?^ ?m^7?7{? +=????W???G? +??????????|(?0????O/ +??_.???_???K??14:??i.'^.?B???o? +??i/$????g?I??l ?UW~4????{??|{???L?=NY??:4?? ???????y+?G????????=*c?*?y?>????>??.??qE?????:c")?;??D?tb\N??k???J6!?O?o?G???. +kgOb?5+?t^?6????.k-J '?? +? t???'???8?????????"[J???7??} ?3???K???u@???:??:D IDAT> +t?R?t?KE~?5????;p?wP?I_Hb???S???X?????e???m?'$3??Pea??_ +ts??x??~?2?.??|???m?oz??{????{?z?x? +????;?f??L??? +??\?$???N0??q?KI? ??????ONF???????q?.?7?????/??:?@p?2?O??D??????? ????7?=??V???c_? +X?Sa^?????????????pm s??a?????Q?np??pO???m????EEt?v*?Yz]h?} + ????????????????_???p????3W=?h??S'???-Z??}j???I}t?j?fn??j?d "R???????u4??t??x9e???P????a?<>???Uas?Nb??m?:=?1??w???t +?\\?~ +\pu?????..?????s;???ez +???`v?0?x??? ???Lo%Mg`??? ??||{???@???[?.???dt??:?????t? C~???p?sXt???/??p?w???'? +:pO}??'5?C>???8$???Tx??? +?O`?t A?)??&!sO???:RY'?4????o??????????m?????<w?+ +??a???NYy??s?f?:????'???w^A?R???i??????9ny?=vK????7??(-?B:*?Q%??0L_??J1??B?)D??????????Sh?l??????l?>=?St?:?U:?8??z|??}?h0\9?st???5'K?t???????!t> +_$w???!???:?X?2?#p??F?~????G????H]?yt?? ???o?????-%???^?IO????g????>?O\t?S?'???f?Q`>?N???I?K?? ??????]t=y?,_]On"??u?,!?=?A??????;l??,g?????!?Z? e???d\???4?J?,??????/????u??=?t??6"?Oine?V?oC^???oX?b????;?]1?????>??c????Al?F???]??Pw?y??0}??pWB;\?????|???W?y????%????C??n??c?8L*???$?D??~?$???Ul|?PI? m?? =?GWOA? ;F? +?80x?U??6 J???Z^?i????L?JK9?W?,?g??????ow??L'Arr??????9A??"??u!??B????G`O?e?\?A??P????7G??3???%?V??????X^s??qul???Or? ????Q?I6tD?hG|? ?+??????E?h??R?[?d?p9N4R?????).??I?????}??y???`????d9?? QP?W?????q?R;?O?$m??W2? ~??Gi?? +???J??C???M??-[9f???????9s??%?6y2??|?????/w?8{e|0???N?K?8??!2??qX???G????mX;??X?~???M K?d'???Ti?\?????;O? ???O?T???/?&?????????\?\????s4?/(?u?-????????-???F?'_?Z>s??p???g_S?m9???-g??y?L??SX?%???????(?"WO?E2?? ??????rL8xX?X?X?J?d]???H^k?o??W?????O?? ??m?)s?-v)c?z?[v??3_?C?:h`8????u|?????(????Gk$z.p?????y?;r??&?YO?X??Z????" ?W?K????g?F?G??:?Qs?t\??#????l??J ?j??Z?8??(RN?)p:??"????O?K????? +~??) \?:????y???_??y?^???)V!?GY?b?nV??????J9"?X?o? ?)??m??i?????{;.????.???-k=?W? ??m??=?|H +<(??????u?Hw!?!_?I??q?????H?{t??^????ztt8???x?4DD??I???=?'??????:"?[??? d:+e?`?u???M??Hv?/#?6??9, ??)??I?Z?l???c????????>6???} n+?f ]?{_`?*"+?Ao{?o?5?R?6?N??:???????$????|??????|?W?O?G????sw???)??:???;???i??p?4 ???? [O:l?z??'X??r9q?8??3y???_.??s?\p9? +:W?[???V????t????%?????]?p??????????2{M????S???? ?,???{????:?)????r?Ga?^?m?????rP??~N?&#%?4??;lh??? o:a???]???[?o?e??p?~Cm}|b??'?G?Y???l^??h?x??;p3??Sv???????)???w9?7???q?$?/?????F???z$???S??????!???2!?????"5? ?HK?P.??B??3=)??????I??q;g*|U2lY?1,y`JX=???a??4|&??2?(rF???????????????J;? +m;?t??a?Re?L????7??6H?Zi???T +?TF? ;6W???%3???V??2?|?t~????5????v^M??>??5?T?I?????Y?v??F????o??t?a??^?_?f?t5???????k"????V????K??'?? ?p???? +??u???j8Q???k?????0l@???????U)?N'?M^???y??u?Z?bMz9????=?????L'?? "/?K?u?^??[??????????\69?q?+???h?F?F?A?8???8?AMW??*O]??????????xQ?$?j???[???3j??T]????? +????????????m=???M??(;b??"?"?:???K?C?u????$?-M???/G????`H.?y.???VO??????N?????| ???:y????:?r??@g5A????K???U??,/??h?????v??@?V8?TPk???C??????n????;t??m?????B?=?ijx?{???0Z#?U"??? +???k"&sTt?{?>???????wq?=l??Yd???Dy?v?m?j??????~qO=???.?h?R??6?; +?*??e???3?oX>??}?\^??3_F/ %?6j???|p????????ryt\?%4t?:*???~?:??/?M|??????=???B?F?+ ?5???>i:????L=d:yO???y;??????H???O???jv??OZq?????Fe%?rtM???%???d?? ??:???s??Y???????s????>????G?????y?9???8s4C??4???5???s?l?n~`f???%?7?v??'??/?x?+sb??.?7????X;?@??K?l ??????~???g??{???Wd?"*????B??\?F?t +????t?}???]?? +?b!??????p?A??z?cwM? \}???|???GosCG??eje^??x?A{????y(???@?~?zn?:^????????????????N_r?'0w?>????7???? +?sv??L{????????O??????cS?t?A??????P??L?~?Q?z?N?2nZ7?^?+????b?Fq????C?{ ??? m?"?}JC????????5?B??'?n?T??x????c??8?q +???2??/??C????_e??Tl??*??N???????3??3?=iA8?{?'<$??S?6#??Y????J?t??@_??n??,??? ?L?n}`F??_PK?do?F?+]ysi??-?U???x%?v????YK:??????fjh??????????6j???Ep??]?4?j?C???j?n??z;?a_tn?????'?X0?? ?:u??????????K??W???h???me??_,???k????????z?C? ??`x?~ \?=?x??????WR?? G"~?/????90?g??j?Q?r????0p 8??????N?????%???N;?K??g?-C}??5?O?????+?8?v?\;f????w????q??:Z??f(?? ?$KY??????yJ????b?w?o???S?'_xx?G??^??%/S?JlW??P???v???Y?3m?9?p??p????5wM O=6??$?_???^????c?j%?VMR+?+????????#7/?l^?????9???W??[??{??o?0?gg~9??.?5/?g??vs]X??g??l +????_?n?3???n|?L????Z????)?5@?Z?9O/v?IF? ??w$???+???:?v??Y +?? ?7?Es??{??4w???????8??;v??~p:??s?????'?x?O??fF???.g??7?q???np?`?M???^?^*??@?:X?????????k?` IDAT??@;:v?D????Y??c?*?W??? l??????L?7???????????R???D?z;? $???Z???:?S?J}??'??uY??? ?o???[?? +?Cz???9'V???(l???%7??r?<\??@R?W???+???>x?s?WY W? ?V? ??o???q{?  +?7??w???g????{/?'???????x?L-?????f6?v?U8????~??M?)^D3???=??{?W?O??{?W?O?a???j??OS?T??^o?-??????a????>4%,yffm?nC??I ?"?????5???^?=0??W?x ng?}8?? ???t??89a?F????M???^?.?W^IK?????????????????-?V???? 6&??1??b?B?Z?I ?$????oLBB???P???S 6.4w???"[???mf??w?????JZ??????y??S?9??????mf?+???vy???y???mLTy?}?`???9/m?g??{?u????]??cqX??????&?&l?hbv&0?`????Wp???????I_?r???w?O?v>?H}?m2l?G?B?????S?Q???g??????H?kg&??@??:??H + W?,??Y/"~?Q??m??9??????^?K?c???%4?D=w????_???_0??m????I?j?????9??????}???[????hE?????#??Gr???J6xr??cN??z?od?NY??:?Wg??@???????u?T??[???c?>]o?????6???u?}???*?8iP????A.?#?#i]?!?(O8e6????5??@P??C?? &cp{?=k _??R???U?|q????zf?f????u!wc:c??7?x0&=? ??2n?????D?5 +?#??d9??&??????s????i?+n??Tw?d??l??t?????w?????8^~\I?;?:??'!A;0??`????nWz???????1?g?W8?w??q?r?5?? ?????=??M ???+|??8m?6???g?????,_5??\? ?+?=sr?b?t??? +?v&`H ??xhSrH??????????}.???w?Q???`?O?????Q??:[t???????9}$?>??????=??F??`?S???????5?4???iW?!????D?sJq?m???j????Y]]?b +)????????lh?*????N??C??L????7I??Q?] }?r.?W????gf?[???B?`?????s?????3?G??)?$?? ???:O?8??jC4?i???5?47????!??@5X?c??o?5|???x ??V?{?_s{?kx?-###??'}?????N?YS<(?&`&Ph2Vv{' ?n??yun??D?{??j?rT?6rx??&~?mxg6????9?p?_?????x=???N??n???S?@???`??nM?-a?rJ??????O??v`?`6?/?l?kC????6???P??N???1??????1?+?^/??? y???? ?? ?@J?W?)?=??+um?7 ?C?f????????O|Au???e y??'???????%\QO?-???s?\8?h>i?'????+?????A?~x??k??3VU?????c3?z?p???g???|???u{]?-?????|9?L?L`ol??F?i??????J?l]?Y_?U*'???????#??v?C?????>??l??s?/?????p?.?AR'?????moB#?t?????^W????[u?@??????7?W??|m}?????}??????ju9?d???o?*?-v(??? ????ORs?????t? ??????:?????"?G??:2???|v??l>/??>j?>??W??Qp|?Dm???q?k????????????l""?~jdM_??O?m_??w?-?-??f??????\v???????????]\?tU?O? +v ??? ????3???56??????j??G??.??V~?kC???=????u??j?(?r??`??}u??????d{?YE?8? ?????????:?????S{$?????3??f?[??g?m??t??R??m??F???]??xN?*???????1A}TP???g?@?30??%?+??%????Z??u?Z?t??~$W??f?C?T?!}?mau??Y?Qs?y'/?f??s3??Fzy???{e??=Z??c$?sSu?]Fy?k????+o}??s?*/ ?r??p?????????n?l?{k}0??Yo?????v??j? +?p?*jY???0? b?}U;08P6?J??\?|]w<$}?M??y??s??77?m???fg]}??????e???;yr?Hvp?-<??ih)r?y}???[???lp#????g???g???? v???Y????E??+s??y,???9?z ??\??G??3????i0??L?L?? ??7??xr?????j???| ?Q?,??????k#?`:?8?c[W?}?9G???s?Y??Y???f1????f?s{?Rw????????'#/5?? N??g???h??|"5?J?qWa$??3?t????6??v??7T?of?;???i3?u^???U?Qt#F\???????n2???!??;0?6?S5V?_??7\??'Z?G?????????yc?L???d??{?z???.???%6]??y??????X0?????^-??F?N{4ad?????X?H?0wx?s???yim(?1\?>T??fGe?`??????pWa{?????e?????????E7?????????A?Z?K??<9?L?L`*??O?q?Ln????v?????????\?w??z????]i???x?lV9????*_y?????&?e~?$8?o>B?I?GPx?m?Z?R?^?q7F?R??J#[?1?|^????>???????q??????S~;?I???2???.#._???????9U??? ?? L%??????s???z?.???`??}.???Q#_???E?<~??m%??3???}X'|?=?!???t? ??G?`p2?z.?+f??dx?????7Q?#h'U??zgV?g5?????x??[?[???? +<?P??8D?L?L? ?A?????Ur? +? ? ???x??6????w???? +?:???????1???SV????????0?%nr?x???09??.?]???0???V5??????l2?J????U8????`g&`?"`??*???ob?u??+?x%?p4??e?????S??pj?e??A??????????|)??00?A?000? `????C000t?00?6???>00?A?000? `????C000t?00?6???>00?A?000? `????C000t?00?6???>00?A?000? `????C000t?00?6???>00?A?000? `????C000t?00?6???>00?A?000? `????C000t?00?6???>00?A?000? `????C000t?00?6???>00?A?000? `????C000t?00?6???>00?A?000? `????C000t?00?6???>00?* +?R???i9[?e?n]D??ZC`?????Yv?%?k?,??n??-+gg?R?????G=jq}???Io7.?R??]?????,????/?K??d??Q_????m??uE?t????%?8{???,? ?T????K???r?{??.y??j??z?k[?R?? +g?\~??Mj?2????k??d$P?e?????m?zg??-?d?hI?s?T??-?y[^?kq5?Yv??.{|=??N=+=?T??$|XW???r??|?C??&?@?:?U??0?k????r?t]?T???w???M:v'q??????????s??j???>v?f?lA6??+???{;???'h?3???Y7d??2 +?r%?t?p??? ?????_??k??_? I???a:M?h????~? ???K?fs?ggC??a?>N??L???3?2^f*??&?????=L???????o^?.L~????9???r? +???s??????r +???Z"?? L?Z??? F?k?L??c???%KG?FFt?~?h??????? IDAT;(?t?p???3u?jQ;_? +z????? +??$?L?3??#?%o~?d??^?%?L?#?!??.z??;??y?[j ??\????lSA?4z?Z???NL?!??s??&?'?(?t<}??\?=??- z?w?p????N??@ .n??X}?&?h?yn??v??&`&`&PP6??87?L?L?R6?) +?M?L?L??l? ?qn? ?? ?? ?l?S?? ?? ?@A ?????l00H ???4600???A/h???&`&`&??AOi8l&`&`%`?^??s?M?L?L %`???p?L?L? +J????f?? ?? ?@J?=??? ?? ?? ?? +zA;??600??? +zJ?a00((??v??m&`&`)????&`&`&PP6??87?L?L?R6?) +?M?L?L??l? ?qn? ?? ?? ?l?S?? ?? ?@A ?????l00H ???4600???A/h???&`&`&??AOi8l&`&`%`?^??s?M?L?L %`???p?L?L? +J????f?? ?? ?@J?=??? ?? ?? ?? +zA;??600??? +zJ?a00((??v??m&`&`)????&`&`&PP6??87?L?L?R6?) +?M?L?L??l? ?qn? ?? ?? ?l?S?? ?? ?@A ?????l00H ???4600???A/h???&`&`&??AOi8l&`&`%`?^??s?M?L?L %`???p?L?L? +J????f?? ?? ?@J?=??? ?? ?? ?? +zA;??600??? +zJ?a00((??v??m&`&`)????&`&`&PP6??87?L?L?R6?) +?M?L?L??l? ?qn? ?? ?? ?l?S?? ?? ?@A ?????l00H ???4600???A/h???&`&`&??AOi8l&`&`%`?^??s?M?L?L %`???p?L?L? +J????f?? ?? ?@J?=??? ?? ?? ?? +zA;??600??? +zJ?a00((??v??m&`&`)????&`&`&PP6??87?L?L?R6?) +?M?L?L??l? ?qn? ?? ?? ?l?S?? ?? ?@A ?????l00H ???4600???A/h???&`&`&??AOi8l&`&`%`?^??s?M?L?L %`???p?L?L? +J????f?? ?? ?@J?=??? ?? ?? ?? +zA;??600??? +zJ?a00((??v??m&`&`)????&`&`&PP6??87?L?L?R6?) +?M?L?L??l? ?qn? ?? ?? ?l?S?? ?? ?@A ?????l00H ???4600???A/h???&`&`&??AOi8l&`&`%`?^??s?M?L?L %`???p?L?L? +J????f?? ?? ?@J?=??? ?? ?? ?? +zA;??600??? +zJ?a00((??v??m&`&`)????&`&`&PP6??87?L?L?R6?) +?M?L?L??l? ?qn? ?? ?? ?l?S?? ?? ?@A ?????l00H ???4600???A/h???&`&`&??AOi8l&`&`%`?^??s?M?L?L %`???p?L?L? +J????f?? ?? ?@J?=??? ?? ?? ?? +zA;??600??? +zJ?a00((??v??m&`&`)????&`&`&PP6??87?L?L?R6?) +?M?L?L??l? ?qn? ?? ?? ?l?S?? ?? ?@A ?????l00H ???4600???A/h???&`&`&??AOi8l&`&`%`?^??s?M?L?L %`???p?L?L? +J????f?? ?? ?@J?=??? ?? ?? ?? +zA;??600??? +zJ?a00((??v??m&`&`)????&`&`&PP6??87?L?L?R6?) +?M?L?L??l? ?qn? ?? ?? ?l?S?? ?? ?@A ?????l00H ???4600???A/h???&`&`&??AOi8l&`&`%`?^??s?M?L?L %`???p?L?L? +J????f?? ?? ?@J?=??? ?? ?? ?? +zA;??600??? +zJ?a00((??v??m&`&`)????&`&`&PP6??87?L?L?R6?) +?M?L?L??l? ?qn? ?? ?? ?l?S?? ?? ?@A ?????l00H ???4600???A/h???&`&`&??AOi8l&`&`%`?^??s?M?L?L %??^???F9l?B?^*M??]????v??q<|?L??_????- :?1?Q???`?????I*c?!=<-`??fO?c???????4??m1????sj??V?G????PG:? ??@)+??#Y?^???l???,???Z???k?k?????@ ?5\???????????????F?????t?cg&?1\*??C?????H?|>?q??t4??;B??,\???????a?-?R6?A/????????/? ?K??Y???*]??????p???+2?[K????i??????.?'?S.???m???y?s??m?@???{EC??%?Uo5.[: x-5???%a???Wsk???g?agE&P????|lgq????o;W)?????g??&??}|`N?u?Z?eBK??Z??Op[t??5??Kp??????????1\??mjQGx??D?Tc?^?*??%?I8?X???z???????',r6?c)9?Qt?U??p????IWl +???i?R??-I=l ?????????????;j?O???i ?F???K??k?k?w.?%?l'?O??CY?????????????#?n???u????_/-?Y{??yK +z??y?]~?????ad?S?:x???q???,\??9?S??\y??????????4x???????d??d}?,n%???C?- +?9/p?|??}8{?w?K?[n?a??J??9??ju? ]?3?G???v)n???8-w????:??@?????????pr?Uz???=??MY??????lvof|??W???xgO?????_ce???j ???&Nv?H ??j?R)k???;+?????=?1???????6??;F?q??5s?????a?G ? +??pw?SJ ?pZ^????[?;G.????????p"?&c[??????T~???V.?dq????l?pw??4?m]=3???0 ?d??&?;???y2?; +_???%?U?{?????H?#;{?>??%????|?[?????%?Zv??g?L?????????x?????????????6#???rLr?fpn?sd0?f?*?w??Qc??S????? ??eYy???[?/|???????????5??r?68N6?Y+g~??O?????t?????????*?4????uW???/???&??t???:?G????ge^?|???m*c???H?@ed?9y??K??d?/e,?g?m?????5??r&?4[??;????o???4[???;J???vk? ;m2?v??g"d?o?????t"?~??7?Ix-?k??????>B??2K????D_??o0????R????u~8?? ????[{^?7?(?Aon??&`&`&`?????w5?!000?!`?~ ?\?L?L???? +z?u??c&`&`B??@??? ?? ?? ??6?7?L?L??? +??Ps00h36?m?!n? ?? ?? ??)??eJ????/?M??q???g????;?? ??3????"??9>?4m????????d6??7s?q??~?H;1O?y????>3?b?Qn?sw??9??hEh??;V???~?i??2?_y*&m??h?????3^?M;??;?v???????v#?y9?t???#y'??3?? ????$?<:??'6??/f??%N~~?~?4???!?V??????M??r??8mS??????C??B??C8?G0?K???(???C}4]?U? +??$?Rt ? ?#?d?}?J??k???e?7?????/D?????(?=???"??7i/????J?](GX'eoG?F?'????5???4~?O?}5???s?r????O5?_?????6?$> ?]?6"??????&??????Q??_????I?.?E????~?Vk??n?q??,?y???r4?~?? +??$?K}/),??0f?)1????%4?????i}?_ ?????H????1 ]e??????|????? +jo????-??k??'|G?1?ST?# z?h?????y????W?qo??? ?&?:???q[?\?0i5(???!??8?4H?2??-.:q???5bm?????!IWs?uI?Xws>?G?????I?`??}??c??O?P[?w ??-??????$?????MN??????i???>f"??TT'??W$???wL]?#?????F???2?/??'i??6S?8?6?X}??O9?I?&?@??(?\??? ???!???C???????'?c?????3???7K????I?????4D??q????n???h??BI????}h??9@?J??????Beb?XoX??????O?????I?PW??!mL?Q?$???DI???|q?L??c??j??l?????mP???V?k)?J?Kr1]?t +?U?Kt???K??&?a?C?????D???]?????$?O<??H;??@r??<_g????)?E(: +?8?T???$?l??i3??????up?Gg?j?S??8??M??_?O?E??????+???? ?c3 +p?%?????4]?*???>?7?GX':KOA???/??D????s?mg? R?g ?M??z?/"?l$67?v ~??l??<i?k^??<+?~??V??Cb?;u????z????????p|??u????|S?h?P[B??l#?p??Z tl????w???4e k???????FZC6?y?f?????R|q?OP????N?~?]Oa?Z|?????M?? ?b:?????:A?n?E??<????KH?Go??Kx1Z????AD?????? +??<??K????^??5?.B???g?/??7???4???e????dL????????g'?GW?Mh5:Oe???i?i?i\?>?~ q?'???f???QW???Z[N??2ND????H?y?e????"?????"?u+R=OT??? |?E?B??k??????OXm??NX???????????iNj?????!?^??? ??|???????n??KQ:V?F\?????:XE??+??s\??16?~??7c???V:#N???#??????iph?j??f?7??(?Sk??V=^?????v4?? ? ?`g?.?2$????????E??i#????? +:}??5?l;????NBj???)???}5?????U(?x?N?\??? ????#??u2??4?~?????6??v??? ??<i?- at 7#M????????8???~+zG?O??? ??C?x??Q?H?uH?m??q?L?s?Q???",??????)???A???Y??{??y?8?c?m?????????KH/=?yz q??W???Hi?'y?'>???F?????'??????sd??p};I?1??????S????= +?A?BCH'?oDJ?8~}9i??Z???Hs??H?rx???AW?G+i.h??E*?9u(?z???????????i}Q=?A??P??/V#????8?0???:???? +??6M??"-??#-Bv-&z?I34????{????Y'????K???t?8NGc??k????'???????? +i?&??h3???W????_?e?v??i?o$?.??z?M?z??????3??? ?1????#$?*??yz?l +?J??6]?????????=?????????m???;5O? _c?iH?K'??FK??A?? ?'???i???x ?}?j{?_+?????|?7q??ytr???????????? ?|t4?o?k? +?????????=?5g???,? +?#?wU????\??? ???c?OUj??"?Z??>^ITmX??F?aq?%)?4?5V.??????R???iN??+}MzMM??#9u????49 +hM|m?N?]????IDATFK??i_??8x????:???+???}??=?S?:?V?h???]?#m?TO??`?? +???????????????????]??F?G:k??+qQ#i\???.?u ??????m ?r?+|??S??,?/F?C?E?I?C?iA?~u???7????*??6*=2???????"???_??(p??$ +??3?#c??-CO at oD?{y???f?K0??????m??-?k.??)??.?????*-??/??"?N?iNQ?H(L$?????6???? +t$: +?????#?n????????H??,R?????&u?~"???1????@?:?????h???[>????-k?@?d??=???80c?*??Oqm????\W +ZD??t\??????4=??o] +|Q?M?t?-?9??R{4????????:?#?K/Bo@?H????:?.|???????y":}????EH?A????l?ct*z?! +"-&r?7????l?oI?}?z4`e?????M???? +I?E???o??D??M???Q8??4?????H]D?????iA??t. X|9??x?v???QW$Gg =?{z&?rj????4???_???QXl??&N?y????????r?4tq?WW&?J??H?z????@:??0???P??K?a?l-?T????^??E'?????tb%?Kt4z???N ,#? +?????A?OFWq_??6???=)??????w????$##C??2?R????????j$?y??????)k?k??????.s1M??q?)? ?RVcG????N:????!?????????=??????G????[\s???"Fr_?FmT[??i??i>??????HNyU???D????Bg?????_?g??c?'?????g"?S'.ZeTc???}'??W??&????@?w?-a??#?+??}?????~??^k????'??H.?o3a??#?k????????yP???Q?@ +?Mh??e?2~?UD??.FZ?5???????? ?3?G???4??d?5Y??????F?G ?&? ???S??(??+R???? m? i?r4?q? +?f??Gm?Z??(? ?7????})?A[C???|? +?s?N4?-?D??1?&?}?8t?]?] ??t?????'?W(????>??!-~KP?????uEf??F??>Py??Om_??_?,??i???.@?!9??????B_Dj?_???????F?o?T????_?KN??H??#?4?4???r_B?woE?!??????[????c"?%??????_?W}?|]j????XJ]s???O?'?k ~i?imU?W?m?? +????t???He ? +???c;?6???P~?O??OEj?}?~65?L|\G9M???qH?r9???d??U#?????1h?m'??{????hz???????$MsB?3??$?0??????P>? xc?R,}????*q^?VR>?#?v?? ?? ?@ ???ch?c??|????~????j???+?w???s?H??H??NA???WS???C?????k???>???>??: ??}???M ???i??Y&`??5~ ?>??^tz?wQ?{-?<<~??}?_??}? +?D???dt??s????????????L???]Hi?F?^?????*]' ?F??_Nu??1?1/[?q;?40?t2??nu??h????t+|#??k]???W???e+????/a??}z??E??????y>?~?:?"??? ???X?_?,?+??U?t}???kc6?m?9n? ?@??N??&??Z/?? ?Q?-????A??N??-?'=???|]?G???]???E?7S>?^?;??G???n??M?? =?????????%???7?L`:??/?VF]??????M???l?Z=??d?S?+?=]=+?9????k[???????}????*??_i?#?=?O6?v!`??.=?v?? L[??f?`;??0?????????s???/?~ +?*G?~?A.f??jZ??{??pW]??= +=?6(? +?t{]?????0?"??1????m?????@0?N&????@??b???Q??3?>?_z?7??ih????tU?$??t?]???mw??2?o#???^K? +??????????U???F????@??v&`&`?A@?uH?)??tu?n??O?u%}!XW??@??d?u?????t???d?????G_E??"=7? ?G??????]E?n???6o?9P??? ?????n? ?? L?????x?????q%??NGz?N??????:?????\??C/@??~2R^?Sg??Tm?Gq?? +z!???4????y?n??v?vu?V?|Z????!?I????l???e?e?e?u;>?5?G???????KHNu??B???/?ro??q?L?L??????_??OE????tU???s?G#]??{?G?6?v"`?^??rSM?L`???rs|O?L4???;?ul?[??{60?)% ??t?|^}O;#??(?^???????? +z{??[a&`&`?@|?aU??&`&`&`?%`??Z??? ?? ?? L +?I??JL?L?L??l?[??{700?I!`?>)]? ?? ?? ??? +zk?{?&`&`&0)l?'?+100???Ao-??L?L?&?? +??`t%&`&`&?Z6??????? ?? ????A????L?L?ZK?????w00?6??????? ?? ?@k ??????n&`&`?B?}R0?00h-?????M?L?L`R??O +FWb&`&`?%`??Z??? ?? ?? L +?I??JL?L?L??l?[??{700?I!`?>)]? ?? ?? ??? +zk?{?&`&`&0)l?'?+100???Ao-??L?L?&?? +??`t%&`&`&?Z6??????? ?? ????A????L?L?ZK?????w00??-m??3??IEND?B`? \ No newline at end of file Deleted: branches/0.9.x/tools/scipy-macosx-installer/dmgbackground.png =================================================================== --- branches/0.9.x/tools/scipy-macosx-installer/dmgbackground.png 2011-01-16 15:22:54 UTC (rev 7065) +++ branches/0.9.x/tools/scipy-macosx-installer/dmgbackground.png 2011-01-16 15:23:36 UTC (rev 7066) @@ -1,506 +0,0 @@ -?PNG - - -IHDR???????iCCPICC Profilex?T?kA?6n??"Zk?x?"IY?hE?6?bk ??E?d3I?n6??&??????*?E????z?d/J?ZE(??(b?-??nL?????~??7?}ov? -r?4??? -?R?il|Bj???? A4%U??N$A?s?{??z?[V?{?w?w???????@?G??*??q -Y??????inf???O??????b??N?????~N??>?!? ??F????????a?????=5??`???5?_M'?Tq?. -????V?J?p?8?da?sZHO?Ln???}&???wVQ?y?g????E??0  ? -HPEa??P@?<14?r?#??{2u$j?tbD?A{6?=?Q??/?y x x x x x ?????????????N??ooooo?? -x x x x x ? x@?'????????????t??????f?N??ooooo?? -x x x x x ? x@?'????????????t??????f?;??B?Rb?:?8????jL?q???? ??L??;7???:??IlGVb?????D>?)??k{yyW??=?}Q?9?sQ????8???~h?;F???@~??TEEG,????J'???|2?2K.]p?90&??G??Q?9*??8??$???B??? ?52????r?c??gF???g??vv????E??E?-???????????]?h?qL{?,?"?=\^=7?H?????GK"u????T"&iL?gF???4zLry?$?Ay2??d?II#?/P??1?t??L?vu?}@?#P?????\N??????!?????I?P<H??C?Sl??????3?????@?&?V|'?q??B???c??[?[?[?[?Z???4n??c at -???l[c|$wY,?yc.?>S?? ???w|?-Y?? ??<8[?,%?????3?.?H*????*)++e?,S&?tJR?$@^A????,?\r?1???f?????`@??????G?ep???t?Q?aw????I:?-K&??????C???????????7???7.8.>???????y???"7?V&????qu???*???&?k?H?????~??.??)???XCwz??x.{j>?z+h)?? - N????"}X????Ke:??-?5V?KUUe,SQ ?.???:??d`?9?qN?#??9g,?qe?8?h???(?c@???9z -????????%?}2??????????.??????DVR?!,?[? -?zd$??xj???;??Y\G?@????J???? -,??K`$y?]????`:?k??O?km<~Pm?{8[??A<{?P??."D??u?N?&??J>v???S7?%??I?t???V?c?? -??????9??yon???b6@l?????p$?v@?A? ?9(?^W??I -????Q?_?:?:x?[??+4p????jM%+?:/{;?? ?T??1?qa??LJ??+???Q???'MM?X???U??????8??????+??9? ??cQ????e???i??????s?J??_l???M??>??MU???<_7?!H@l?~.?????.f ??N??8]??f?X???????l '?{?d??-?j????????>? -??h6L?&?/??B?B??dy?qR?q?p<}?????????Xssc???E?????n8G?;? ??M,???F?:Q=`.$?pV??M<?X&? -U???Z?.? ??19]???,#?u-?(???????c?|? ????9?1???;?0^"P2_ ??????;???????!?jj??7??wc??Yr???h6l?>@?`??R?X????????>;>??D?x$x`:^??&S?b?4D?1?^?X8???U??oo~p?????I????e????????\??L?0/?-0% ?m%\; ?Q-??8??=2Y?C????????}??????n1?o&t%HCt,??4&???r?1ZX~?M???yV;??0?"???d????K7}$???*?t???q?f??x????U?Y?#?J<F1)??H? -? -JOE????${?%]B?????d???!?[?,` ?Td??"??????H???d?fDO? ?B???? -a?^;ww?b6??9~???6l?,??b???L?fP+h???q?`t???3?0??????????//??OA??c???Y3w???,?e? ???YDca#"??3???3M??Z_??nh??2???2e1.tkk????+?*??#??? ?MV?$?f?l???f??_?}??Q?)??C1?}?? S??w????v? ??G?In???????-???????8?.???/y???o#???? ?bG??=???????l?Sh??9?s??1#L }?l???9?b??A????O?a]?,?Z" ???n??[?G?d/?"83m0 ????????)|-????hG:???>"??I?i?At[A?qt??? p??F:????????t?@???q?X??4G???z????#A1t??>?L??u??8???F??K`????V?H:?????????-??o@??!Sp?"^????? 2??_?qw?C>???????:?|???q?Fh?+i??/$]?Yl?????n9>6???.s-???(?d????qis?=$\.|????S -???:?gF ???|?!?>F ?????0>?28???tY? -?a? ??!???????8????L?NL>?(i??8?7 [?"??z\??s?r ?.????????T??a??,o??x}???T???j??*2?????od?#? <???b?IP??v??0????-?y? -? x ?%???76j!?)????? -P??'?Y?????3^?\+?iQ?f??pu??\>?3A?????n?]?L~?a??@?D?mL????1?=?p?n?c.?8???Y+{.x????Ov,?C?`>???J???Dg'?H?M?["?I??????????|?jh?????Q??Y^??9?#H?9??7;?s??\???????? ? -u?C?|2?n??}?3?nA???{?:N??!f???b??k$U???%???l??!?,???9V??iG????SV??*???({??I'?]?H%F?)|??`?:b?6V~? "???,Q)=?(?a?-??R??4??Ic?lY?s?i??X???y,j?a???U??$??? w?cgv??E????T,??????C????}?Q'A???y???t???}D???H?"@????????8?Ez??Xu3???s?wA?F????[x?????:g8???????#?????8??7 -h??? -???yH?????? ~?????# -???*??[4T??elsA?^?f88?h|??E?2{??0?k#am&??B?6???dm0??5gl???YH(?????49?y^[?QN_y?w????A??@??? -?&??$nC?>????R?X'?e?60??&?(P?C????Q??a$??\?\?l?o#o?y? -?+????? -?Y???@G#??^F?} -??_ ?u??W???Z?f????9????????M????e?'??h?? ? -"c??S$??????:??U?????]t? oo?c?B???=H??B?H??F? ?~ ??}Gs???????;??????? c????c? ??\nS?????Yb+?\?/????G??l??#/?uM?)????^???q??O?f??H?????u??&lSJ)?????\;"???(?Ax???>???*????A???????G?z?1?S?+???K????zP?= N??5??R?:????Gk???????Au??{? ?E??g??}dzG ????b????"??/R? ?0?L0ol??q?p?5G???K?????I?f????1S?PL*???c???????-???\?????????!?i??^???? -?QO ??`:??????9??????5?dOw??0M?G ???h5???Fx/4?7?%D?5??sW?x2-?s???@l????? -?x:???p?????~ ?????????? ??p-h#v?Vqv?? ?)?X????ZbKU???> -???M7?sAt?eyY?V?O??%??.lVqe?pQ???????A??M??s?tw#?n??)??{??h@???i????_4???l?D??=???6??+M?0?? ?? -0???k??m?C?]B?F?#,Ua???0U?j?]????U?G?:O.>m?TW??"7ES??pzX(4?U?K?????>???D???_??Vm?2L??H]+F??z!g8]s??Zq?"?\?j??%????>6???n??m.??????r,;?????,{oo??????"????????,0????Y?i#?|???{???b???\%????x?J????=l?A?zV?|p?U|?z'???q?? ???h?"?+?C?d????~ ?.b???d? -,??q???? S?+????ih????x??F?x6??J? -??ag?????)?y"?????\^4K????????J>??7?;/9]j???ph???#?.?IhR5? -u?\??_?t???G?*?`?????RQ;p?nc??c ?????K?5*I+?eQ??3??+??-?8n?????]?Y????w????ZIT|@?u?q4?????!'7???????}"7B?]AvR??!???[44?S??2F#:_v??&Y.??A???z-}??@??iE?9?????p1??N??????6:?"D>????d]???f,???`#???:r??;????MfGb??m -I??x?5?8 -??L?O???|?????"?S??(?tm?????-????L:?9??&??Y???3i'??I?&????????D???,???`?????^??p??1?`FN????FR)?s?+????:=N??;?A????1??H???O:????yM????e??N??c ???@???@??Y?88a??3?|?a%??_????ziH?au??????????N?v?mR??~q??? y?-P?l`A?? -?5?m????9?[A?3N???Z -??t"?ic???M??Sp-V??&RY[<\%??I???c?NbT?]?????v?gr???2h?@?A?????z -t:h%h?? ????????x7#??Z?????d???c???1??mj?w???`??m???T??_?[??%?3????[?@?}????seA{c??&C-?U?k!*?j}?x???;???????n???G????I%R_U.? -??xV??\^???????|??3??l\???_???r?\N ??!???#?cr??F r?s? x?Fo??^e?k?-?w?u???'?????????z?.????@ ?:?Y?F??WYx??2?U?/w??N?Z.???Z -? d???nq -???%??????J???A? ???2tl?? ?? .??????D at g]?m??k? ???????F?OU?]??4???ba?9Fk?V?bg????q???`!?U -???? -ZE$H??N0?w?1z>?oD?9s[??q?,?????6?????DUnx? ?~v?6y??kd+F?;???.?$??,\`???tas[??tR????^_) -??r???r????????c????K?6????7?&/a???|AT?e8(??K7????H\???e?\3???h?P??DD?e5??0{????2 -?O?.?????o?? ????"?C?>p[?}??????)&7? ?'????:!? ???v[?? ????2???i?7????7`??A?3?Z??@t??v???4?Bg??????NW;????????????X?}??{????^???????_??#??Q?????9R????h?*????????v?????cE???i?HhT??IH?)?G????IO????? g?/;MN?t{?8 -_:#??1???w? ?M?>%???q???+???q??*??[@i??t??zP?,?=????;?M??a?|\?4? -?????.P?'?!??X'?????????? -?????)+??g? fu?$?+@o?|:?OwQ??]M -?\p?oJ???n?????K???}???V&`?!??w?? "?7 ?5??=???f ????W%*???%?N??l?D?? -)?k?W`tn???}?E?g???2F??k?????lT????+?Seer??ErF?&1 -c??????/?=??F?T??A????(???t?.j?????????>????d3??t?J?&??Y?3?q?x??R?qE.^???j -?G???0??)??Mq`??e+?]P??b?b?????#??\"???3??pt??2??{$/???O}y??O?A?7??X??+A[A?};????8e?8U~???%?/??z??E??m??DKz???ml?y",?7??7?4?F?? -???wzs"%==????????^?$C?}???]x?;?u???2????3?p4`?o?o@~??*?w?v????XN? ??h ??<?\L?_|?1r?S/?M?z?[?D?????]?.W?H??VET??_?Ms??c???, ??7S?$???z??????8(U#??ERY???W?%~\?r???bj?T?????$??Kd???c?_?P8????A?D????z???|?"??d?} ~B??E?????o???????????O&p?g???`[l???????????n??w ??Z??U??3??_???????*Q?????'8?????????W?.Y????{??3?n???]?h????u????r?=`??#;??v?['^?????.?%2?rW????>?Z^-??WH? -??q?]???QCM??? ? -??F??k??O??l?&???F1b??? ??.z?,??????J7?Y?4????o???z??p?????|F?V?e??tk[??`?=P?P?UZF??.? ,?2X?Q??T/????>??}p???x???L~?a???j???8cF(`Y?(?????oI~?q? -?\?*?5?5?z????S D?)???0?W???????????0?T J????_ ~l?u(??Y?\ ?m?? ?$?u|??Z?w??+?? -??g?I_j?~= :^z?b?W?x?0:z?C?p}? -??????????9??^?????u??-??@???????C|??????x?]?2?T?;?~t>?5yRg?+O????-?ml?Z??+?a8?&??p??:?????tq?l?th??@?:A??? -X???g|?d?????????; o??"???,}E-?:?#?r?\?]?????G?HMsN??f?!X?7?QUSS7???6???? -?????5W?*W??L?)????f???u+?>?Q????&,???y?-?? ??T????4?s?a????0?? ;?0 -??*?i?+????c1A?G?gJ??wA?KZ??6??5??K2sF?I??4?f?t??f???????O?????????h>?% ?~qe?nG?O?~??|J??O -f???:??oF"???y4?e?6???G?N???P??K???1????????W?????]?:??h?? ?????L?l?|P?????A????1????S?????3!,????w??1?Z???H?n?l????a??7??'+???&??04 ??r?cB??A ??J -\P?? -?????xc???r??x~t%???? wu??????_?,mx?????F U?C??2x%vT??? -?e??V???~??I?}???1?Z?g/???^b2?g?<???3???????+?Q??P(??-?)?Q??2]^35?? ?>z?:q[?????????? ?d???N ?; }b7???}V???o?'|??{7S,??J?e?!`b?i???Mz??JE????'??QZ?????R?6??K?b?z?? -????7?,;???[?>?anh????? \ ?? j?``@H ?? IC{G????@?????QzeC???|SC`?%?: ?.???????p??RM???s??{n????s??.?@?*'?????&?Lw?I5%?6??q?N?=r????>!??a -?l9l`???S??O?????????Y5yt<v?&??9??m???A'??5O$??)??5????????6GSPen?????k?|??O`????c??D ??? -??+??z |~?pm?!??r??*>`?w??<# 8???: ? ?+?????,o???^z??`??8z4?b???^x???~???V???x??;??_Jn?#L?,?G? ????a?W??????8???Htzq?:?Z?.?Y??y}???E? -???????!&s?%????+??du???,???hjuas%??H? `?????MQ?????}?D-$!-?nUg?G???{??;?6S?nl?z\K -}1?A??)t/o?)?????dwY?}v?O??G?3?????IV?3 ;??tP{x??8??????????*?????|?O??r?U?h8?nOb?n*?g?P??? -!???7?[? q?y???6{*?`?;628??b??%?pFE,???????}&???w??b?Z)kx???Zc5??b???d?o??? -JWW/:??????af\?tx\????p??y{ 5????????Q{????Y?7+??i?????i????????26/Kf???.x+???X?)??v???^x?|???d#nV?|}??)>w??2??QxN?(??S?zP3H???>n???$?????AO?dqK?4c'??|i??fcQ_-%???4m?B?????????N*????f???_?9 ;??M%fCYz???*L;??_)#??$?['??G?o?=(?N?t???????+ -G??}?????L?8?l????'???I??9=W"??-?q??1 -|?:?!&q????????]?1?c??Q?=?+??M?1?????l7?1hMW???8|??t? ?C9?"!7??m? -0'???|??g?TH??r???s~?|???e$??O???D????RuVy?o?x?E? -?? IDAT -?y;v?????????????????p7Z??!??n??y?[.??~R??+U?? -v?u=???????y?T?j???2????????j?l4?Uh?y ^@??~3j?o?3A???&????/???? ? ???u??t ~ ?:?=??h?N??_? -??"C?? Ur??? ;?????\???T1Zr?? ?w -??u?c????"?%????e???q??S?????????? ???M} ?;ud?R[UP? -)?"?????? ?w???(?S??n.?z???????ai??(??`?H!c?Nu?b?1:?8Wa???? -?l?????????S??? -}?xz?????T.?*???? -79?nz?X& ?? ??v???#x?[??c????Z????S?V???` ????h?? ?????????G?????x?W??????"?E????p??g#j?v???>???X?d???"wz?y ?`???a;h??{?l&V???x?_1v??????p]}?xS<?z??????-?z????a???W|R?Z?????u 1?I V?b!\????L*???o8(8?Tk?V????@^`N?g&?V?T:??:?t?M???????F????+???t>??s^??]1}????????v7?????9#a -2?) 53?? ZA ?i>?v\?t?<u??-J%???g????|????%s?#o=G*0mM0?) -?-`?eXH?g?L???W?u{p?n??3??1?|PGo?????????uNK?@????;? (???,+{"_?A???Q.??@,v2????j[eqd? ???[?/#???m???????w???h?????????U?tP&3?#???;?SA??????:?5????&???-p?z?0R?t -6?????m?;?M??i)?????????,#_??^o???=?;??I?? -?K}W6????#>? ??-??^??????- n???H???g????^4/v?? s???)o????????p?Q?X>G0/?M?oo??Z?_%hs????????J?p) ???R???????#??????=X?Dn -#???p?? ?4E -???????-x?????U{>N>?g??i&?1D*??S????????U?vj???k?Ez?9}?G?H?? i?#|??w?86?C??U?7?;F?xK?|??????_?f??Q?????_?2?>!?o??i??e?6??o_?&?|?n???r?????lK? ?5??J?>}????X3y???|?[?p??????????2qo????Y??9R?V#t??DM??Xi?B?fO?g?)???_?F????/C?????}X????|_\???"O?? (??O????1???F?'U?M?X???C?EL??fbYt?w?????74H?u?$????/??I#v0?5????f?~i??+???M -?8M?JpH?sk.???]????n??7?P??????+?s?2?Q?N34?Y-?? N???L???J?? S?????????`??????LY?????G??d????X?x??m???M??q?{??Z??tlm>???? 7_?`???9??r?4??y9?? F?!9?V???KW?"???l6U??L2???-?{?Y??8M?O9?|A{??W?c??:?  ?? Td??iE)?Y ??V??X'%M?rY???z?N?7??????????? ???75m9??????w??*???? @???g?V@???@???????????j?_??Y???_??@?t?0??L3????????!b???N????S??@?2??? +? nmx?k{fR,?92??E??E??]??$1P?6?X???Qz?-?-?-0?-0???;???H???1?^???p??G???v????????????\?t??y??+???????T?^???1?c=?Qw????q?!Ee -S?|??? ?ex??u??5;dnj.:c)???N??L0.??6??_?h????'?=?N??kd?Qs??????&?}????o?>????Td???f?/A?u?b8??o??1q??8g??\??fl??Y#??O??YN???? 2"?:D?F?3?SX?5?e??!P[????6d??b?????%9????s???v?\~?1??g?????w???Zy?????CO???\' g5??~????KN?Y -???zF??????/?P?Xl8????0???h#s??v??]I??O??6?c?????????6#r???n@+??U3:?*?B?????8UC?v?F?$??l???`)?i??M^|D???-???&?c48?#?P???z????????J?N?>?(?????t??R2?G?e??&?wJ?8W?P/?)?????$???q????y|&??'?0?Jb?{L?cgB?$R?`![O??i??O?~t?\~:?)??? -j?:[??T[)??4? ??o+?I?8=&???1L???bU?<2Y???8B= NYb%?S??[^? ??f????Kr??+?uK??YKgK]??t???6???~A?\?^n}?9???5 X??Y??? -????2??l#??k????????{??????~A?#?sT@??:AZEV???sE???Rp?O?? -???_????????????C?zO~$?R,?c??w ?:????2?c??#?x?.?d?+AVe"?79?e??q??4[y C?.?y??m?F????ji??????[???+?=???^l????p:??5??,}???9??x???#??????r??`??Iv???g??{??Y2 ???5R??????9,??'e{????}??$C??W??%??????q???????~l?C? ?*??????op@??n?~v=?r?|Pi}\?y~???~XqP?D????5??;oo?im?i? }9?n???-{7?k??? |?+?@#?k<?????2]?? -??????QY?F?????+C?Oo(?4?t?Nj???D??;??es?#%6*gVs?{{?????o?v??{?:V,l'p?k?x? -?P-n>??w?????D?4?|8??upzMg(??? 1???7$??r???????N0g?????tJ u?s??'W_r??? ????q?????FD?Y?,??Pz????4????Q?? V???!?0?.W??Ls?$???U???Kpv???%%??z?&?[???Y?m???N??i??eu?\*CZ(? ??i??3 -?N?Ceb?r?????????????t????l6?t{?I?????:$S??????]?|??????o?9 @??a??? G???|?0?x?a?a?X?U???J_?:fv=????!??&?S?e?1? ?n??ggo??s?t$SNm??H?\XoJ\?rtjl?BXy.?2??2Ce?mH?T?)D?;ooo?if?? -?CCX#.x?)?????cD0?????B?????#??E???~??)O6?????????2?a2?G??j+?o|x???B9jV}0J?qT^???-a/?e?\?r.F??d??}r?????[????r???4??$??6??7 ??????x<?O?$Z?X*hK?8?&?q???V??0?2E?*??R B?????2?~?S??l??r?o??N*????e???V??t'.lVZ1?Q.?~??z?v??]/??[?h???f6?l?]?5??iY??HRb?*?'??G!???????7????c??'1??????6;tC?&O?^??+&??,???L??u??X???8??r5l??S%>?z^q[??Uf?n?????m??e??.???#?l?+?v??"x????p??pz??W?? ?N -???iO?2????y????<:?A>?9? ?]??8??z x x L7 L[@?)???8????<[J???0}/??3wi&?8u???!???M?e ?X??X?VP?&Q6?\???iq?:????d??>y?YK???R?????=????- 3?????i??94?e?X?s_?6Q????G}???ew?l??-Om?#/wc?a7@^????s??]Y[`?? ???? 0?Rm?JZ"|????CDA?????y??z??C9S?%K??r?????4?Z????Dx -???6Y?yVo-??j?q~? -?x????$???? n:?L?5QZ$?!???q?{nM6z???(K;??+;h?;??Do?nX?k??t?}!g1?t?90???9\?i?Uh?? ?????i?#v??0Ex??&"?*g*???Q??G?#??n??E??5?????pM????g7I??>????.??*LH87?N????????z?? -x??tT;_??k?x/~;F?;?{:?d7????d-??LW?????X??????,???Lc???3?e??I,0Q:Q?$jZ2;??z?Y??"??? -e?????????^?@?n????sQ?8'<7??j?????j?Mg@???{]??@'???? ]"??~W???^D??Gy??]?i?a???a??)?0????2 ;2??Uf?6Ub?`N^|z?|??m??7o?????)???R??5?K? -+?IzE?????????1x}??Q?7]8 ??????^y???r? ???Oo?+P?Q?:????\??2zp??p5??1???4+????\Q?Lf_?????5?B.M?I$??????8?a:?2=.?4-^ ??ZHT??{?+??????)?7t?^????t?GSFCEi_B?j????p?*?C???g?????)?O@???~4?4s????????xN?? -??i??N=??lwl?Bt?+?S??I]??+????+?)O+???meyf%???X6??<?I??2dy?H?y???h;????p?????tO???~??d7? ??8U?m?????? ???????j?+?I?r?7D??']? ??Me;Ji????????k?r0G?I??B??)?y4Q?????)=??y?,??e?tlyhEQ?g5V????\?u???}??5??G?????o=vD8j??0tp???_???'3??{OJE2?JE????d??????`{2?????u{;2????\5x????????3?-?0????;_? #o1?3;Y???j???jy????#r??MSC??? -?????Ef?R?Rb?OqyN????`??????.?@?@?vx#Lc>??t(.?:??`.?ZCPv6??? ?S?/??????? ???@?????7?N????m???v???- ?7y{?v?^??&g??O??N?W~%X~??/???-?p?'?t -?????%??????n?\???o??Js???????????$?Tkw.????[??v?>"?:xB????w????????y???N??????X????? ????Om?^@?U ?$?????????R?8?M???Xo???????&?n??^:? ^C??C???}l?? ???m?????h20m? ??'|???Z????0?9?.[t]?????0 t5Yt?%??'???y -G????d_n4??p?(L?F??????6?????yD??D????A?q?}?K?xb??[`?o+???+/??u?? }3???ci?t??q6?-:?z????5?oB?~'q??uLw?????IE?mo??dC?F+K??p????p?m++P??wLw???t/?A8????%???s?????????G?cf?!?D~?/C???^&?X&????.??>]?}???z?Q8?A8?C??w?y'? ???????k?.Y?f??????????p????k8???7??S??S}??????@SX??]?????u????qZ?O:Q?q??z#y?h3??8??m/??g???D~???E????R)? -o?w???????\??:?3????'?b? ,????s???~>P??|9?l??zf,?W???c?q???n'????@7??\{?? ?H?~tF?(^IX at x?M?? -?k??f?.??i?"?_???C O?>H?q??+@?s??eO????z?? ?^????T?XO?,[y??x?%N???q??%?1??c???y?p?I?nr?q???S?N?^?S????Q?x??????I?27?(???????$? ???_??$?????{???M??????y??T?|??7?????O? ??G -???z??????]??NL?h???VK?????c8????g??^?????????Ji?p????r*??%?+?"K??????Q????Xv???se?u????*??t????M??6????N????p?E? v?????5???\????D??a???????????t?.??????/?!???N?\0?6??'<??#??H?D??`??`?M??|v??@????e?L???e?^???($????r?rX??S<???????a??u???_?k??A:x???+??b\JuH??DD???Q??K?e?a?Iz? ???A???+%^?e???A?y????|?2????Mu?Y;??u?-??o? ?'?%?g??@?Y??\????,?L?????m??[*?N??? C??Q?5.????}nZ?`Nz??.?u?:??DY9????????,R??????C???$V?E0O??J? ????`Q-??Silx??r]????????????ri>Q??-5???K?.??ia6??{??Z?????m?y;t?5Z???]u^r????N?c????X??qu -c???S?&?xrf????H?\?%???O ????(?%???sa ?l?z$???N?????:??\Z????[uy\f???(?x????????? X"!????Gj? -????$m2? ?3??Wd?-?Q?xeY"9?$uv r??}?CG??.l?_???p)?t\?]??[Pv?)??x??S?+?T??n?7O7e?????&Yn??g?2??K??VN --*????Q6y?f?k`?8?AW???[n?>??;??_?[??w?~t?x??/ -???.v?N?eU???6?G??u????9???,??FyK -K?.!?e -????R -????M?)O???$??F???-?hC?????????y?9p???F,????S} -??b9?z?????y? -??"???????????n ??1?)>??v?ip?$???xb???D????"??pw???m?j??8??m?q??ld?b???>G?3???S??2 E????m%??????????oO????7?????:?????@??????*???????"n??H???????? -????_??r??X???p????:q??~?MG???l?p??2|?C???;?mku??[??U??@??Z?bP??#???3??Sot??j?????????N??)|?%?4??F>8??:?????{;??????Kv????-???f????y???M;cP?y;.??G??T??E?N=???y8#???0 -??Fm=?B??#9+??J??C??????O??k??>?rf?(?#!????<?>?*?KX|??????e??T.3???;????SY???T_?y?????n?i?n1nx8????? -zt??M????=:G??|????a???{?#x???O,?AM?'?>u?????.M?z?? -?????ke?g???=????;>?> ??? ?;%??L^-Gcziw]N?????H?????*.w?-?{???2??????M+?k>??????-?2????M??]8\???e??????^?.?!Z?k?f??#K??/?h/?_ -???????HM????D{??????A?n??0??%gWn??9?\???p?(? ?9????F?0??I???w????C?????+?v{?6?~;??:D;?s?q??p$??"v?7?99|??9Q`X~7???MCV??4o???$e???P??um?' |?????3$???????????v???a??9_9?q??YWa6????F?D'LJ??^NT?x?????S?iIf???j??,??F6???vu??lr???E?E??k??^?=?;g??????8]s? -!?N?'f:[j& -D?g?>??GC????c????:Pv,??h?/'???m"?'??'???9?m_???3n z?6?2??%??D??????Oe??x -qw?E~U??F?&???b???O_??y???*?e?????.??[ ?6?o&|?DB?I>8?W?]?K?_?????F -??'?$!?O}2??2?(?y[?vw?N?.?z?U?/9lX??i?l???i?? ?\????2??U??A/?t?nz|aX?r}t?y4[9??6??0?g ??JR?????N23)????E?ru?|Q??8)0J\?oR$????m???C??S}?gjc/?H 8?7??x?-q9?C?n????{??S@?x)?w????= \ nDv:?b????????????tT?#c? ???/uIN?d?S?O?{??mt?W??????$?'m7??O|?.???_??l?.o#?o?.$?f?nAv??N?B?f??k?--uw.?U?^??QA???5B?v?l??-??)??????L&?t?><8??)KJy?E)?6???r?by???? ??"???(???:yzy?= o??????sB?????eG?,? Q??{??v?yz??)|8t???q?.&?@???}??? ?`8??n?.??-?.n?8\?????t4???????@???Mg?u?'? V??'?:su;????k Z?p#8?????WO..&_j??Dy@?5.j????i`H??????w?N`???a?|>???O????^?#?l1???_??-??3?&????:z?{98|?6??|?_??cp8|H'?/?G?O?|p,?:?????m??v[??]@???]??9?:??Z?[`????????!?Oc?}?P!?N"?? ??????????va??A??W.~??a?={q???AwW3>??????/???t?=nd??????Q??????? ????S???, -???s?f?????bM??????????4??+?)???N?'nQy?s ???g2??m[C??]???????. M-??????y?;gI? ???O???I?p=t0:[w???????? ??+3??? ?????;?????}??o?^??+? t?,aX ???Ni6?)?2~G?????xP>P?B?`pz~??1???z~h??U*????????4iQ8??????h???i??1???C????mF=?S????x4?e?'eyz?+t???Y??[?+v???H??????Q?????????3X -V?????? -m?????4?9???E\??"?? ?? /+???^?uV A"?:'??t's???<~2??M??????gH???R7???R tt:n?c???N>?;??:y?I????u???2?&l??W???-qON??m???W?7???`??~6???f?????$??]'?h9uR??'??N}? ??O`??????????*p'????????V???V??? -????U?????q???c????eL???A??????%?sY???XUA??????{?];????*???????Q? %?a?j?v??#?u???S???7&?Y?v???$yV?t?????}?O??S??????2uw?,??z\^????????_?;????`u^?4????(?;Ux$??+???????O???E)^?vs?)??h#???????? ????qf}?(?<@E????m?L7?2)??b?e?]??d'?????<??E????U????????Loi?S??|???S?Q??t??e???????E??? -?6}+W?#?hv?];w -?x?N?3?!?????a??\d r?H?j?7??-? ??w??76:|?????HX?e??D???|U?O????A???'?A??`???????}??e?G@??~0?t?m???~&?w??]?=????_???l?F??F?u?i?w??!=o????????????????N?$?yp???q???????``???W?????l?_??C??? -\f??3?? -???5?S>G?Z?W?,?:????S??,?t?????Fw??????g????_|Eg?????T?`?NqW??U4??????+0\????1??'??fg??A?*?????&N?g????I_????kt?r??l???;? -_y?q?ul????z??'?>??????i?+?8?,??????qQfD???_?L??e1??${?)?:IO??X;?\?m\ \=?? ?z[???C?z;?[??F/??8?1N??@??s \??/?E?'??v}A??c:?> ???????????}w??jc??\??l8? ??q?????Z????!sw???????rn?>u? ;??u??~??{???i?O?v?e?e!??I???????NQ{~?(???3?C;??(2?c[?k??{? [G?ND??U?11?'D???h]??L`???T??????m?J???i?????lx???%????vs?P??d}x??e?k?&???C4????'??,K??????=?????S??#.??r9?N????~??3????3??????,?U9??n????Rbe)???'???P????o?/?3??????r??????xB??$????? [o?Al?a?4??L.>??.,??m?|:t^???[I*5:fj???C? J? :??=%????3??L%(Vp?? ?4d:?2-(G??F?????+e%??/l?????*?????dkJ? ?`???7%?'y::s????|?i????? ??+n}&??????)???l&?*F??<4?t s8x????C??9?\Y????+???}?+????}v??b????S?mweBe????|??&>?GQ?*y?v??M[C?'??*uc???L?????H)???&*???@??t??|?v????6?E{}???q;??? ?.??????\?a???Q[)N?{?"R^????????I??H??gR?x???A%?)?+???g?)?&?I?????e???t?i?au?~J??OYJ?y1fe?z??R?i??,?$?]?????m? -?k?5V??U??h?/?y???_?0??=??? ??"?s -?????z??m?? '??????CS?:s??y????tx?????{????p?csq??v???????[?nZ???!????C|????z??M??q?M?0???m??M??;?{mH??g????C_?sg?W?q?4?? ????.x$??2??A .|p??WMv z1???X?MkC?^ ?m^7?7{? -=????W???G? -??????????|(?0????O/ -??_.???_???K??14:??i.'^.?B???o? -??i/$????g?I??l ?UW~4????{??|{???L?=NY??:4?? ???????y+?G????????=*c?*?y?>????>??.??qE?????:c")?;??D?tb\N??k???J6!?O?o?G???. -kgOb?5+?t^?6????.k-J '?? -? t???'???8?????????"[J???7??} ?3???K???u@???:??:D IDAT> -t?R?t?KE~?5????;p?wP?I_Hb???S???X?????e???m?'$3??Pea??_ -ts??x??~?2?.??|???m?oz??{????{?z?x? -????;?f??L??? -??\?$???N0??q?KI? ??????ONF???????q?.?7?????/??:?@p?2?O??D??????? ????7?=??V???c_? -X?Sa^?????????????pm s??a?????Q?np??pO???m????EEt?v*?Yz]h?} - ????????????????_???p????3W=?h??S'???-Z??}j???I}t?j?fn??j?d "R???????u4??t??x9e???P????a?<>???Uas?Nb??m?:=?1??w???t -?\\?~ -\pu?????..?????s;???ez -???`v?0?x??? ???Lo%Mg`??? ??||{???@???[?.???dt??:?????t? C~???p?sXt???/??p?w???'? -:pO}??'5?C>???8$???Tx??? -?O`?t A?)??&!sO???:RY'?4????o??????????m?????<w?+ -??a???NYy??s?f?:????'???w^A?R???i??????9ny?=vK????7??(-?B:*?Q%??0L_??J1??B?)D??????????Sh?l??????l?>=?St?:?U:?8??z|??}?h0\9?st???5'K?t???????!t> -_$w???!???:?X?2?#p??F?~????G????H]?yt?? ???o?????-%???^?IO????g????>?O\t?S?'???f?Q`>?N???I?K?? ??????]t=y?,_]On"??u?,!?=?A??????;l??,g?????!?Z? e???d\???4?J?,??????/????u??=?t??6"?Oine?V?oC^???oX?b????;?]1?????>??c????Al?F???]??Pw?y??0}??pWB;\?????|???W?y????%????C??n??c?8L*???$?D??~?$???Ul|?PI? m?? =?GWOA? ;F? -?80x?U??6 J???Z^?i????L?JK9?W?,?g??????ow??L'Arr??????9A??"??u!??B????G`O?e?\?A??P????7G??3???%?V??????X^s??qul???Or? ????Q?I6tD?hG|? ?+??????E?h??R?[?d?p9N4R?????).??I?????}??y???`????d9?? QP?W?????q?R;?O?$m??W2? ~??Gi?? -???J??C???M??-[9f???????9s??%?6y2??|?????/w?8{e|0???N?K?8??!2??qX???G????mX;??X?~???M K?d'???Ti?\?????;O? ???O?T???/?&?????????\?\????s4?/(?u?-????????-???F?'_?Z>s??p???g_S?m9???-g??y?L??SX?%???????(?"WO?E2?? ??????rL8xX?X?X?J?d]???H^k?o??W?????O?? ??m?)s?-v)c?z?[v??3_?C?:h`8????u|?????(????Gk$z.p?????y?;r??&?YO?X??Z????" ?W?K????g?F?G??:?Qs?t\??#????l??J ?j??Z?8??(RN?)p:??"????O?K????? -~??) \?:????y???_??y?^???)V!?GY?b?nV??????J9"?X?o? ?)??m??i?????{;.????.???-k=?W? ??m??=?|H -<(??????u?Hw!?!_?I??q?????H?{t??^????ztt8???x?4DD??I???=?'??????:"?[??? d:+e?`?u???M??Hv?/#?6??9, ??)??I?Z?l???c????????>6???} n+?f ]?{_`?*"+?Ao{?o?5?R?6?N??:???????$????|??????|?W?O?G????sw???)??:???;???i??p?4 ???? [O:l?z??'X??r9q?8??3y???_.??s?\p9? -:W?[???V????t????%?????]?p??????????2{M????S???? ?,???{????:?)????r?Ga?^?m?????rP??~N?&#%?4??;lh??? o:a???]???[?o?e??p?~Cm}|b??'?G?Y???l^??h?x??;p3??Sv???????)???w9?7???q?$?/?????F???z$???S??????!???2!?????"5? ?HK?P.??B??3=)??????I??q;g*|U2lY?1,y`JX=???a??4|&??2?(rF???????????????J;? -m;?t??a?Re?L????7??6H?Zi???T -?TF? ;6W???%3???V??2?|?t~????5????v^M??>??5?T?I?????Y?v??F????o??t?a??^?_?f?t5???????k"????V????K??'?? ?p???? -??u???j8Q???k?????0l@???????U)?N'?M^???y??u?Z?bMz9????=?????L'?? "/?K?u?^??[??????????\69?q?+???h?F?F?A?8???8?AMW??*O]??????????xQ?$?j???[???3j??T]????? -????????????m=???M??(;b??"?"?:???K?C?u????$?-M???/G????`H.?y.???VO??????N?????| ???:y????:?r??@g5A????K???U??,/??h?????v??@?V8?TPk???C??????n????;t??m?????B?=?ijx?{???0Z#?U"??? -???k"&sTt?{?>???????wq?=l??Yd???Dy?v?m?j??????~qO=???.?h?R??6?; -?*??e???3?oX>??}?\^??3_F/ %?6j???|p????????ryt\?%4t?:*???~?:??/?M|??????=???B?F?+ ?5???>i:????L=d:yO???y;??????H???O???jv??OZq?????Fe%?rtM???%???d?? ??:???s??Y???????s????>????G?????y?9???8s4C??4???5???s?l?n~`f???%?7?v??'??/?x?+sb??.?7????X;?@??K?l ??????~???g??{???Wd?"*????B??\?F?t -????t?}???]?? -?b!??????p?A??z?cwM? \}???|???GosCG??eje^??x?A{????y(???@?~?zn?:^????????????????N_r?'0w?>????7???? -?sv??L{????????O??????cS?t?A??????P??L?~?Q?z?N?2nZ7?^?+????b?Fq????C?{ ??? m?"?}JC????????5?B??'?n?T??x????c??8?q -???2??/??C????_e??Tl??*??N???????3??3?=iA8?{?'<$??S?6#??Y????J?t??@_??n??,??? ?L?n}`F??_PK?do?F?+]ysi??-?U???x%?v????YK:??????fjh??????????6j???Ep??]?4?j?C???j?n??z;?a_tn?????'?X0?? ?:u??????????K??W???h???me??_,???k????????z?C? ??`x?~ \?=?x??????WR?? G"~?/????90?g??j?Q?r????0p 8??????N?????%???N;?K??g?-C}??5?O?????+?8?v?\;f????w????q??:Z??f(?? ?$KY??????yJ????b?w?o???S?'_xx?G??^??%/S?JlW??P???v???Y?3m?9?p??p????5wM O=6??$?_???^????c?j%?VMR+?+????????#7/?l^?????9???W??[??{??o?0?gg~9??.?5/?g??vs]X??g??l -????_?n?3???n|?L????Z????)?5@?Z?9O/v?IF? ??w$???+???:?v??Y -?? ?7?Es??{??4w???????8??;v??~p:??s?????'?x?O??fF???.g??7?q???np?`?M???^?^*??@?:X?????????k?` IDAT??@;:v?D????Y??c?*?W??? l??????L?7???????????R???D?z;? $???Z???:?S?J}??'??uY??? ?o???[?? -?Cz???9'V???(l???%7??r?<\??@R?W???+???>x?s?WY W? ?V? ??o???q{?  -?7??w???g????{/?'???????x?L-?????f6?v?U8????~??M?)^D3???=??{?W?O??{?W?O?a???j??OS?T??^o?-??????a????>4%,yffm?nC??I ?"?????5???^?=0??W?x ng?}8?? ???t??89a?F????M???^?.?W^IK?????????????????-?V???? 6&??1??b?B?Z?I ?$????oLBB???P???S 6.4w???"[???mf??w?????JZ??????y??S?9??????mf?+???vy???y???mLTy?}?`???9/m?g??{?u????]??cqX??????&?&l?hbv&0?`????Wp???????I_?r???w?O?v>?H}?m2l?G?B?????S?Q???g??????H?kg&??@??:??H - W?,??Y/"~?Q??m??9??????^?K?c???%4?D=w????_???_0??m????I?j?????9??????}???[????hE?????#??Gr???J6xr??cN??z?od?NY??:?Wg??@???????u?T??[???c?>]o?????6???u?}???*?8iP????A.?#?#i]?!?(O8e6????5??@P??C?? &cp{?=k _??R???U?|q????zf?f????u!wc:c??7?x0&=? ??2n?????D?5 -?#??d9??&??????s????i?+n??Tw?d??l??t?????w?????8^~\I?;?:??'!A;0??`????nWz???????1?g?W8?w??q?r?5?? ?????=??M ???+|??8m?6???g?????,_5??\? ?+?=sr?b?t??? -?v&`H ??xhSrH??????????}.???w?Q???`?O?????Q??:[t???????9}$?>??????=??F??`?S???????5?4???iW?!????D?sJq?m???j????Y]]?b -)????????lh?*????N??C??L????7I??Q?] }?r.?W????gf?[???B?`?????s?????3?G??)?$?? ???:O?8??jC4?i???5?47????!??@5X?c??o?5|???x ??V?{?_s{?kx?-###??'}?????N?YS<(?&`&Ph2Vv{' ?n??yun??D?{??j?rT?6rx??&~?mxg6????9?p?_?????x=???N??n???S?@???`??nM?-a?rJ??????O??v`?`6?/?l?kC????6???P??N???1??????1?+?^/??? y???? ?? ?@J?W?)?=??+um?7 ?C?f????????O|Au???e y??'???????%\QO?-???s?\8?h>i?'????+?????A?~x??k??3VU?????c3?z?p???g???|???u{]?-?????|9?L?L`ol??F?i??????J?l]?Y_?U*'???????#??v?C?????>??l??s?/?????p?.?AR'?????moB#?t?????^W????[u?@??????7?W??|m}?????}??????ju9?d???o?*?-v(??? ????ORs?????t? ??????:?????"?G??:2???|v??l>/??>j?>??W??Qp|?Dm???q?k????????????l""?~jdM_??O?m_??w?-?-??f??????\v???????????]\?tU?O? -v ??? ????3???56??????j??G??.??V~?kC???=????u??j?(?r??`??}u??????d{?YE?8? ?????????:?????S{$?????3??f?[??g?m??t??R??m??F???]??xN?*???????1A}TP???g?@?30??%?+??%????Z??u?Z?t??~$W??f?C?T?!}?mau??Y?Qs?y'/?f??s3??Fzy???{e??=Z??c$?sSu?]Fy?k????+o}??s?*/ ?r??p?????????n?l?{k}0??Yo?????v??j? -?p?*jY???0? b?}U;08P6?J??\?|]w<$}?M??y??s??77?m???fg]}??????e???;yr?Hvp?-<??ih)r?y}???[???lp#????g???g???? v???Y????E??+s??y,???9?z ??\??G??3????i0??L?L?? ??7??xr?????j???| ?Q?,??????k#?`:?8?c[W?}?9G???s?Y??Y???f1????f?s{?Rw????????'#/5?? N??g???h??|"5?J?qWa$??3?t????6??v??7T?of?;???i3?u^???U?Qt#F\???????n2???!??;0?6?S5V?_??7\??'Z?G?????????yc?L???d??{?z???.???%6]??y??????X0?????^-??F?N{4ad?????X?H?0wx?s???yim(?1\?>T??fGe?`??????pWa{?????e?????????E7?????????A?Z?K??<9?L?L`*??O?q?Ln????v?????????\?w??z????]i???x?lV9????*_y?????&?e~?$8?o>B?I?GPx?m?Z?R?^?q7F?R??J#[?1?|^????>???????q??????S~;?I???2???.#._???????9U??? ?? L%??????s???z?.???`??}.???Q#_???E?<~??m%??3???}X'|?=?!???t? ??G?`p2?z.?+f??dx?????7Q?#h'U??zgV?g5?????x??[?[???? -<?P??8D?L?L? ?A?????Ur? -? ? ???x??6????w???? -?:???????1???SV????????0?%nr?x???09??.?]???0???V5??????l2?J????U8????`g&`?"`??*???ob?u??+?x%?p4??e?????S??pj?e??A??????????|)??00?A?000? `????C000t?00?6???>00?A?000? `????C000t?00?6???>00?A?000? `????C000t?00?6???>00?A?000? `????C000t?00?6???>00?A?000? `????C000t?00?6???>00?A?000? `????C000t?00?6???>00?A?000? `????C000t?00?6???>00?A?000? `????C000t?00?6???>00?A?000? `????C000t?00?6???>00?* -?R???i9[?e?n]D??ZC`?????Yv?%?k?,??n??-+gg?R?????G=jq}???Io7.?R??]?????,????/?K??d??Q_????m??uE?t????%?8{???,? ?T????K???r?{??.y??j??z?k[?R?? -g?\~??Mj?2????k??d$P?e?????m?zg??-?d?hI?s?T??-?y[^?kq5?Yv??.{|=??N=+=?T??$|XW???r??|?C??&?@?:?U??0?k????r?t]?T???w???M:v'q??????????s??j???>v?f?lA6??+???{;???'h?3???Y7d??2 -?r%?t?p??? ?????_??k??_? I???a:M?h????~? ???K?fs?ggC??a?>N??L???3?2^f*??&?????=L???????o^?.L~????9???r? -???s??????r -???Z"?? L?Z??? F?k?L??c???%KG?FFt?~?h??????? IDAT;(?t?p???3u?jQ;_? -z????? -??$?L?3??#?%o~?d??^?%?L?#?!??.z??;??y?[j ??\????lSA?4z?Z???NL?!??s??&?'?(?t<}??\?=??- z?w?p????N??@ .n??X}?&?h?yn??v??&`&`&PP6??87?L?L?R6?) -?M?L?L??l? ?qn? ?? ?? ?l?S?? ?? ?@A ?????l00H ???4600???A/h???&`&`&??AOi8l&`&`%`?^??s?M?L?L %`???p?L?L? -J????f?? ?? ?@J?=??? ?? ?? ?? -zA;??600??? -zJ?a00((??v??m&`&`)????&`&`&PP6??87?L?L?R6?) -?M?L?L??l? ?qn? ?? ?? ?l?S?? ?? ?@A ?????l00H ???4600???A/h???&`&`&??AOi8l&`&`%`?^??s?M?L?L %`???p?L?L? -J????f?? ?? ?@J?=??? ?? ?? ?? -zA;??600??? -zJ?a00((??v??m&`&`)????&`&`&PP6??87?L?L?R6?) -?M?L?L??l? ?qn? ?? ?? ?l?S?? ?? ?@A ?????l00H ???4600???A/h???&`&`&??AOi8l&`&`%`?^??s?M?L?L %`???p?L?L? -J????f?? ?? ?@J?=??? ?? ?? ?? -zA;??600??? -zJ?a00((??v??m&`&`)????&`&`&PP6??87?L?L?R6?) -?M?L?L??l? ?qn? ?? ?? ?l?S?? ?? ?@A ?????l00H ???4600???A/h???&`&`&??AOi8l&`&`%`?^??s?M?L?L %`???p?L?L? -J????f?? ?? ?@J?=??? ?? ?? ?? -zA;??600??? -zJ?a00((??v??m&`&`)????&`&`&PP6??87?L?L?R6?) -?M?L?L??l? ?qn? ?? ?? ?l?S?? ?? ?@A ?????l00H ???4600???A/h???&`&`&??AOi8l&`&`%`?^??s?M?L?L %`???p?L?L? -J????f?? ?? ?@J?=??? ?? ?? ?? -zA;??600??? -zJ?a00((??v??m&`&`)????&`&`&PP6??87?L?L?R6?) -?M?L?L??l? ?qn? ?? ?? ?l?S?? ?? ?@A ?????l00H ???4600???A/h???&`&`&??AOi8l&`&`%`?^??s?M?L?L %`???p?L?L? -J????f?? ?? ?@J?=??? ?? ?? ?? -zA;??600??? -zJ?a00((??v??m&`&`)????&`&`&PP6??87?L?L?R6?) -?M?L?L??l? ?qn? ?? ?? ?l?S?? ?? ?@A ?????l00H ???4600???A/h???&`&`&??AOi8l&`&`%`?^??s?M?L?L %`???p?L?L? -J????f?? ?? ?@J?=??? ?? ?? ?? -zA;??600??? -zJ?a00((??v??m&`&`)????&`&`&PP6??87?L?L?R6?) -?M?L?L??l? ?qn? ?? ?? ?l?S?? ?? ?@A ?????l00H ???4600???A/h???&`&`&??AOi8l&`&`%`?^??s?M?L?L %`???p?L?L? -J????f?? ?? ?@J?=??? ?? ?? ?? -zA;??600??? -zJ?a00((??v??m&`&`)????&`&`&PP6??87?L?L?R6?) -?M?L?L??l? ?qn? ?? ?? ?l?S?? ?? ?@A ?????l00H ???4600???A/h???&`&`&??AOi8l&`&`%`?^??s?M?L?L %`???p?L?L? -J????f?? ?? ?@J?=??? ?? ?? ?? -zA;??600??? -zJ?a00((??v??m&`&`)????&`&`&PP6??87?L?L?R6?) -?M?L?L??l? ?qn? ?? ?? ?l?S?? ?? ?@A ?????l00H ???4600???A/h???&`&`&??AOi8l&`&`%`?^??s?M?L?L %??^???F9l?B?^*M??]????v??q<|?L??_????- :?1?Q???`?????I*c?!=<-`??fO?c???????4??m1????sj??V?G????PG:? ??@)+??#Y?^???l???,???Z???k?k?????@ ?5\???????????????F?????t?cg&?1\*??C?????H?|>?q??t4??;B??,\???????a?-?R6?A/????????/? ?K??Y???*]??????p???+2?[K????i??????.?'?S.???m???y?s??m?@???{EC??%?Uo5.[: x-5???%a???Wsk???g?agE&P????|lgq????o;W)?????g??&??}|`N?u?Z?eBK??Z??Op[t??5??Kp??????????1\??mjQGx??D?Tc?^?*??%?I8?X???z???????',r6?c)9?Qt?U??p????IWl -???i?R??-I=l ?????????????;j?O???i ?F???K??k?k?w.?%?l'?O??CY?????????????#?n???u????_/-?Y{??yK -z??y?]~?????ad?S?:x???q???,\??9?S??\y??????????4x???????d??d}?,n%???C?- -?9/p?|??}8{?w?K?[n?a??J??9??ju? ]?3?G???v)n???8-w????:??@?????????pr?Uz???=??MY??????lvof|??W???xgO?????_ce???j ???&Nv?H ??j?R)k???;+?????=?1???????6??;F?q??5s?????a?G ? -??pw?SJ ?pZ^????[?;G.????????p"?&c[??????T~???V.?dq????l?pw??4?m]=3???0 ?d??&?;???y2?; -_???%?U?{?????H?#;{?>??%????|?[?????%?Zv??g?L?????????x?????????????6#???rLr?fpn?sd0?f?*?w??Qc??S????? ??eYy???[?/|???????????5??r?68N6?Y+g~??O?????t?????????*?4????uW???/???&??t???:?G????ge^?|???m*c???H?@ed?9y??K??d?/e,?g?m?????5??r&?4[??;????o???4[???;J???vk? ;m2?v??g"d?o?????t"?~??7?Ix-?k??????>B??2K????D_??o0????R????u~8?? ????[{^?7?(?Aon??&`&`&`?????w5?!000?!`?~ ?\?L?L???? -z?u??c&`&`B??@??? ?? ?? ??6?7?L?L??? -??Ps00h36?m?!n? ?? ?? ??)??eJ????/?M??q???g????;?? ??3????"??9>?4m????????d6??7s?q??~?H;1O?y????>3?b?Qn?sw??9??hEh??;V???~?i??2?_y*&m??h?????3^?M;??;?v???????v#?y9?t???#y'??3?? ????$?<:??'6??/f??%N~~?~?4???!?V??????M??r??8mS??????C??B??C8?G0?K???(???C}4]?U? -??$?Rt ? ?#?d?}?J??k???e?7?????/D?????(?=???"??7i/????J?](GX'eoG?F?'????5???4~?O?}5???s?r????O5?_?????6?$> ?]?6"??????&??????Q??_????I?.?E????~?Vk??n?q??,?y???r4?~?? -??$?K}/),??0f?)1????%4?????i}?_ ?????H????1 ]e??????|????? -jo????-??k??'|G?1?ST?# z?h?????y????W?qo??? ?&?:???q[?\?0i5(???!??8?4H?2??-.:q???5bm?????!IWs?uI?Xws>?G?????I?`??}??c??O?P[?w ??-??????$?????MN??????i???>f"??TT'??W$???wL]?#?????F???2?/??'i??6S?8?6?X}??O9?I?&?@??(?\??? ???!???C???????'?c?????3???7K????I?????4D??q????n???h??BI????}h??9@?J??????Beb?XoX??????O?????I?PW??!mL?Q?$???DI???|q?L??c??j??l?????mP???V?k)?J?Kr1]?t -?U?Kt???K??&?a?C?????D???]?????$?O<??H;??@r??<_g????)?E(: -?8?T???$?l??i3??????up?Gg?j?S??8??M??_?O?E??????+???? ?c3 -p?%?????4]?*???>?7?GX':KOA???/??D????s?mg? R?g ?M??z?/"?l$67?v ~??l??<i?k^??<+?~??V??Cb?;u????z????????p|??u????|S?h?P[B??l#?p??Z tl????w???4e k???????FZC6?y?f?????R|q?OP????N?~?]Oa?Z|?????M?? ?b:?????:A?n?E??<????KH?Go??Kx1Z????AD?????? -??<??K????^??5?.B???g?/??7???4???e????dL????????g'?GW?Mh5:Oe???i?i?i\?>?~ q?'???f???QW???Z[N??2ND????H?y?e????"?????"?u+R=OT??? |?E?B??k??????OXm??NX???????????iNj?????!?^??? ??|???????n??KQ:V?F\?????:XE??+??s\??16?~??7c???V:#N???#??????iph?j??f?7??(?Sk??V=^?????v4?? ? ?`g?.?2$????????E??i#????? -:}??5?l;????NBj???)???}5?????U(?x?N?\??? ????#??u2??4?~?????6??v??? ??<i?- at 7#M????????8???~+zG?O??? ??C?x??Q?H?uH?m??q?L?s?Q???",??????)???A???Y??{??y?8?c?m?????????KH/=?yz q??W???Hi?'y?'>???F?????'??????sd??p};I?1??????S????= -?A?BCH'?oDJ?8~}9i??Z???Hs??H?rx???AW?G+i.h??E*?9u(?z???????????i}Q=?A??P??/V#????8?0???:???? -??6M??"-??#-Bv-&z?I34????{????Y'????K???t?8NGc??k????'???????? -i?&??h3???W????_?e?v??i?o$?.??z?M?z??????3??? ?1????#$?*??yz?l -?J??6]?????????=?????????m???;5O? _c?iH?K'??FK??A?? ?'???i???x ?}?j{?_+?????|?7q??ytr???????????? ?|t4?o?k? -?????????=?5g???,? -?#?wU????\??? ???c?OUj??"?Z??>^ITmX??F?aq?%)?4?5V.??????R???iN??+}MzMM??#9u????49 -hM|m?N?]????IDATFK??i_??8x????:???+???}??=?S?:?V?h???]?#m?TO??`?? -???????????????????]??F?G:k??+qQ#i\???.?u ??????m ?r?+|??S??,?/F?C?E?I?C?iA?~u???7????*??6*=2???????"???_??(p??$ -??3?#c??-CO at oD?{y???f?K0??????m??-?k.??)??.?????*-??/??"?N?iNQ?H(L$?????6???? -t$: -?????#?n????????H??,R?????&u?~"???1????@?:?????h???[>????-k?@?d??=???80c?*??Oqm????\W -ZD??t\??????4=??o] -|Q?M?t?-?9??R{4????????:?#?K/Bo@?H????:?.|???????y":}????EH?A????l?ct*z?! -"-&r?7????l?oI?}?z4`e?????M???? -I?E???o??D??M???Q8??4?????H]D?????iA??t. X|9??x?v???QW$Gg =?{z&?rj????4???_???QXl??&N?y????????r?4tq?WW&?J??H?z????@:??0???P??K?a?l-?T????^??E'?????tb%?Kt4z???N ,#? -?????A?OFWq_??6???=)??????w????$##C??2?R????????j$?y??????)k?k??????.s1M??q?)? ?RVcG????N:????!?????????=??????G????[\s???"Fr_?FmT[??i??i>??????HNyU???D????Bg?????_?g??c?'?????g"?S'.ZeTc???}'??W??&????@?w?-a??#?+??}?????~??^k????'??H.?o3a??#?k????????yP???Q?@ -?Mh??e?2~?UD??.FZ?5???????? ?3?G???4??d?5Y??????F?G ?&? ???S??(??+R???? m? i?r4?q? -?f??Gm?Z??(? ?7????})?A[C???|? -?s?N4?-?D??1?&?}?8t?]?] ??t?????'?W(????>??!-~KP?????uEf??F??>Py??Om_??_?,??i???.@?!9??????B_Dj?_???????F?o?T????_?KN??H??#?4?4???r_B?woE?!??????[????c"?%??????_?W}?|]j????XJ]s???O?'?k ~i?imU?W?m?? +????t???He ? -???c;?6???P~?O??OEj?}?~65?L|\G9M???qH?r9???d??U#?????1h?m'??{????hz???????$MsB?3??$?0??????P>? xc?R,}????*q^?VR>?#?v?? ?? ?@ ???ch?c??|????~????j???+?w???s?H??H??NA???WS???C?????k???>???>??: ??}???M ???i??Y&`??5~ ?>??^tz?wQ?{-?<<~??}?_??}? -?D???dt??s????????????L???]Hi?F?^?????*]' ?F??_Nu??1?1/[?q;?40?t2??nu??h????t+|#??k]???W???e+????/a??}z??E??????y>?~?:?"??? ???X?_?,?+??U?t}???kc6?m?9n? ?@??N??&??Z/?? ?Q?-????A??N??-?'=???|]?G???]???E?7S>?^?;??G???n??M?? =?????????%???7?L`:??/?VF]??????M???l?Z=??d?S?+?=]=+?9????k[???????}????*??_i?#?=?O6?v!`??.=?v?? L[??f?`;??0?????????s???/?~ -?*G?~?A.f??jZ??{??pW]??= -=?6(? -?t{]?????0?"??1????m?????@0?N&????@??b???Q??3?>?_z?7??ih????tU?$??t?]???mw??2?o#???^K? -??????????U???F????@??v&`&`?A@?uH?)??tu?n??O?u%}!XW??@??d?u?????t???d?????G_E??"=7? ?G??????]E?n???6o?9P??? ?????n? ?? L?????x?????q%??NGz?N??????:?????\??C/@??~2R^?Sg??Tm?Gq?? -z!???4????y?n??v?vu?V?|Z????!?I????l???e?e?e?u;>?5?G???????KHNu??B???/?ro??q?L?L??????_??OE????tU???s?G#]??{?G?6?v"`?^??rSM?L`???rs|O?L4???;?ul?[??{60?)% ??t?|^}O;#??(?^???????? -z{??[a&`&`?@|?aU??&`&`&`?%`??Z??? ?? ?? L -?I??JL?L?L??l?[??{700?I!`?>)]? ?? ?? ??? -zk?{?&`&`&0)l?'?+100???Ao-??L?L?&?? -??`t%&`&`&?Z6??????? ?? ????A????L?L?ZK?????w00?6??????? ?? ?@k ??????n&`&`?B?}R0?00h-?????M?L?L`R??O -FWb&`&`?%`??Z??? ?? ?? L -?I??JL?L?L??l?[??{700?I!`?>)]? ?? ?? ??? -zk?{?&`&`&0)l?'?+100???Ao-??L?L?&?? -??`t%&`&`&?Z6??????? ?? ????A????L?L?ZK?????w00??-m??3??IEND?B`? \ No newline at end of file From scipy-svn at scipy.org Tue Jan 18 15:30:14 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 18 Jan 2011 14:30:14 -0600 (CST) Subject: [Scipy-svn] r7067 - trunk/scipy/signal/tests Message-ID: <20110118203014.9011437A18D@scipy.org> Author: warren.weckesser Date: 2011-01-18 14:30:12 -0600 (Tue, 18 Jan 2011) New Revision: 7067 Modified: trunk/scipy/signal/tests/test_signaltools.py Log: BUG/TST: The test of complex case of the correlate() function did not properly take into account the platform dependence of the longdouble type. Modified: trunk/scipy/signal/tests/test_signaltools.py =================================================================== --- trunk/scipy/signal/tests/test_signaltools.py 2011-01-16 15:23:36 UTC (rev 7066) +++ trunk/scipy/signal/tests/test_signaltools.py 2011-01-18 20:30:12 UTC (rev 7067) @@ -576,16 +576,16 @@ self.assertTrue(y.dtype == self.dt) -def _get_testcorrelate_class(i, base): +def _get_testcorrelate_class(datatype, base): class TestCorrelateX(base): - dt = i - TestCorrelateX.__name__ = "TestCorrelate%s" % i.__name__.title() + dt = datatype + TestCorrelateX.__name__ = "TestCorrelate%s" % datatype.__name__.title() return TestCorrelateX -for i in [np.ubyte, np.byte, np.ushort, np.short, np.uint, np.int, +for datatype in [np.ubyte, np.byte, np.ushort, np.short, np.uint, np.int, np.ulonglong, np.ulonglong, np.float32, np.float64, np.longdouble, Decimal]: - cls = _get_testcorrelate_class(i, _TestCorrelateReal) + cls = _get_testcorrelate_class(datatype, _TestCorrelateReal) globals()[cls.__name__] = cls @@ -683,13 +683,11 @@ self.assertTrue(y.dtype == self.dt) -# Create three classes, one for each complex data type: TestCorrelateComplex64, -# TestCorrelateComplex128 and TestCorrelateComplex256. -# The second number in the pairs is used in the 'decimal' keyword argument of -# the array comparisons in the tests. -for i, decimal in [(np.csingle, 5), (np.cdouble, 10), (np.clongdouble, 15)]: - cls = _get_testcorrelate_class(i, _TestCorrelateComplex) - cls.decimal = decimal +# Create three classes, one for each complex data type. The actual class +# name will be TestCorrelateComplex###, where ### is the number of bits. +for datatype in [np.csingle, np.cdouble, np.clongdouble]: + cls = _get_testcorrelate_class(datatype, _TestCorrelateComplex) + cls.decimal = int(2 * np.finfo(datatype).precision / 3) globals()[cls.__name__] = cls From scipy-svn at scipy.org Thu Jan 20 06:29:55 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 20 Jan 2011 05:29:55 -0600 (CST) Subject: [Scipy-svn] r7068 - branches/0.9.x/scipy/signal/tests Message-ID: <20110120112955.6BCFC37A193@scipy.org> Author: rgommers Date: 2011-01-20 05:29:54 -0600 (Thu, 20 Jan 2011) New Revision: 7068 Modified: branches/0.9.x/scipy/signal/tests/test_signaltools.py Log: BUG/TST: The test of complex case of the correlate() function did not properly take into account the platform dependence of the longdouble type. (backport of r7067) Modified: branches/0.9.x/scipy/signal/tests/test_signaltools.py =================================================================== --- branches/0.9.x/scipy/signal/tests/test_signaltools.py 2011-01-18 20:30:12 UTC (rev 7067) +++ branches/0.9.x/scipy/signal/tests/test_signaltools.py 2011-01-20 11:29:54 UTC (rev 7068) @@ -576,16 +576,16 @@ self.assertTrue(y.dtype == self.dt) -def _get_testcorrelate_class(i, base): +def _get_testcorrelate_class(datatype, base): class TestCorrelateX(base): - dt = i - TestCorrelateX.__name__ = "TestCorrelate%s" % i.__name__.title() + dt = datatype + TestCorrelateX.__name__ = "TestCorrelate%s" % datatype.__name__.title() return TestCorrelateX -for i in [np.ubyte, np.byte, np.ushort, np.short, np.uint, np.int, +for datatype in [np.ubyte, np.byte, np.ushort, np.short, np.uint, np.int, np.ulonglong, np.ulonglong, np.float32, np.float64, np.longdouble, Decimal]: - cls = _get_testcorrelate_class(i, _TestCorrelateReal) + cls = _get_testcorrelate_class(datatype, _TestCorrelateReal) globals()[cls.__name__] = cls @@ -683,13 +683,11 @@ self.assertTrue(y.dtype == self.dt) -# Create three classes, one for each complex data type: TestCorrelateComplex64, -# TestCorrelateComplex128 and TestCorrelateComplex256. -# The second number in the pairs is used in the 'decimal' keyword argument of -# the array comparisons in the tests. -for i, decimal in [(np.csingle, 5), (np.cdouble, 10), (np.clongdouble, 15)]: - cls = _get_testcorrelate_class(i, _TestCorrelateComplex) - cls.decimal = decimal +# Create three classes, one for each complex data type. The actual class +# name will be TestCorrelateComplex###, where ### is the number of bits. +for datatype in [np.csingle, np.cdouble, np.clongdouble]: + cls = _get_testcorrelate_class(datatype, _TestCorrelateComplex) + cls.decimal = int(2 * np.finfo(datatype).precision / 3) globals()[cls.__name__] = cls From scipy-svn at scipy.org Thu Jan 20 07:15:33 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 20 Jan 2011 06:15:33 -0600 (CST) Subject: [Scipy-svn] r7069 - trunk/scipy/linalg Message-ID: <20110120121533.F0E4B37A192@scipy.org> Author: rgommers Date: 2011-01-20 06:15:33 -0600 (Thu, 20 Jan 2011) New Revision: 7069 Modified: trunk/scipy/linalg/decomp_qr.py trunk/scipy/linalg/decomp_schur.py Log: TST: Avoid ComplexWarning in QR and Schur decomposition. lwork returned from a workspace query has the same dtype as the principal matrix, but when we call the computational routine it expects an integer value. This also fixes a potential bug in schur(), where lwork keyword was ignored. Thanks to Fabian Pedregosa. Modified: trunk/scipy/linalg/decomp_qr.py =================================================================== --- trunk/scipy/linalg/decomp_qr.py 2011-01-20 11:29:54 UTC (rev 7068) +++ trunk/scipy/linalg/decomp_qr.py 2011-01-20 12:15:33 UTC (rev 7069) @@ -86,7 +86,7 @@ if lwork is None or lwork == -1: # get optimal work array qr, tau, work, info = geqrf(a1, lwork=-1, overwrite_a=1) - lwork = work[0] + lwork = work[0].real.astype(numpy.int) qr, tau, work, info = geqrf(a1, lwork=lwork, overwrite_a=overwrite_a) if info < 0: @@ -108,12 +108,12 @@ if M < N: # get optimal work array Q, work, info = gor_un_gqr(qr[:,0:M], tau, lwork=-1, overwrite_a=1) - lwork = work[0] + lwork = work[0].real.astype(numpy.int) Q, work, info = gor_un_gqr(qr[:,0:M], tau, lwork=lwork, overwrite_a=1) elif mode == 'economic': # get optimal work array Q, work, info = gor_un_gqr(qr, tau, lwork=-1, overwrite_a=1) - lwork = work[0] + lwork = work[0].real.astype(numpy.int) Q, work, info = gor_un_gqr(qr, tau, lwork=lwork, overwrite_a=1) else: t = qr.dtype.char @@ -121,7 +121,7 @@ qqr[:,0:N] = qr # get optimal work array Q, work, info = gor_un_gqr(qqr, tau, lwork=-1, overwrite_a=1) - lwork = work[0] + lwork = work[0].real.astype(numpy.int) Q, work, info = gor_un_gqr(qqr, tau, lwork=lwork, overwrite_a=1) if info < 0: @@ -223,7 +223,7 @@ if lwork is None or lwork == -1: # get optimal work array rq, tau, work, info = gerqf(a1, lwork=-1, overwrite_a=1) - lwork = work[0] + lwork = work[0].real.astype(numpy.int) rq, tau, work, info = gerqf(a1, lwork=lwork, overwrite_a=overwrite_a) if info < 0: raise ValueError('illegal value in %d-th argument of internal geqrf' Modified: trunk/scipy/linalg/decomp_schur.py =================================================================== --- trunk/scipy/linalg/decomp_schur.py 2011-01-20 11:29:54 UTC (rev 7068) +++ trunk/scipy/linalg/decomp_schur.py 2011-01-20 12:15:33 UTC (rev 7069) @@ -68,8 +68,8 @@ if lwork is None or lwork == -1: # get optimal work array result = gees(lambda x: None, a, lwork=-1) - lwork = result[-2][0] - result = gees(lambda x: None, a, lwork=result[-2][0], overwrite_a=overwrite_a) + lwork = result[-2][0].real.astype(numpy.int) + result = gees(lambda x: None, a, lwork=lwork, overwrite_a=overwrite_a) info = result[-1] if info < 0: raise ValueError('illegal value in %d-th argument of internal gees' From scipy-svn at scipy.org Thu Jan 20 07:18:52 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 20 Jan 2011 06:18:52 -0600 (CST) Subject: [Scipy-svn] r7070 - branches/0.9.x/scipy/linalg Message-ID: <20110120121852.D5F3537A192@scipy.org> Author: rgommers Date: 2011-01-20 06:18:52 -0600 (Thu, 20 Jan 2011) New Revision: 7070 Modified: branches/0.9.x/scipy/linalg/decomp_qr.py branches/0.9.x/scipy/linalg/decomp_schur.py Log: TST: Avoid ComplexWarning in QR and Schur decomposition. lwork returned from a workspace query has the same dtype as the principal matrix, but when we call the computational routine it expects an integer value. This also fixes a potential bug in schur(), where lwork keyword was ignored. Thanks to Fabian Pedregosa. (backport of r7069) Modified: branches/0.9.x/scipy/linalg/decomp_qr.py =================================================================== --- branches/0.9.x/scipy/linalg/decomp_qr.py 2011-01-20 12:15:33 UTC (rev 7069) +++ branches/0.9.x/scipy/linalg/decomp_qr.py 2011-01-20 12:18:52 UTC (rev 7070) @@ -86,7 +86,7 @@ if lwork is None or lwork == -1: # get optimal work array qr, tau, work, info = geqrf(a1, lwork=-1, overwrite_a=1) - lwork = work[0] + lwork = work[0].real.astype(numpy.int) qr, tau, work, info = geqrf(a1, lwork=lwork, overwrite_a=overwrite_a) if info < 0: @@ -109,12 +109,12 @@ if M < N: # get optimal work array Q, work, info = gor_un_gqr(qr[:,0:M], tau, lwork=-1, overwrite_a=1) - lwork = work[0] + lwork = work[0].real.astype(numpy.int) Q, work, info = gor_un_gqr(qr[:,0:M], tau, lwork=lwork, overwrite_a=1) elif mode == 'economic': # get optimal work array Q, work, info = gor_un_gqr(qr, tau, lwork=-1, overwrite_a=1) - lwork = work[0] + lwork = work[0].real.astype(numpy.int) Q, work, info = gor_un_gqr(qr, tau, lwork=lwork, overwrite_a=1) else: t = qr.dtype.char @@ -122,7 +122,7 @@ qqr[:,0:N] = qr # get optimal work array Q, work, info = gor_un_gqr(qqr, tau, lwork=-1, overwrite_a=1) - lwork = work[0] + lwork = work[0].real.astype(numpy.int) Q, work, info = gor_un_gqr(qqr, tau, lwork=lwork, overwrite_a=1) if info < 0: @@ -224,7 +224,7 @@ if lwork is None or lwork == -1: # get optimal work array rq, tau, work, info = gerqf(a1, lwork=-1, overwrite_a=1) - lwork = work[0] + lwork = work[0].real.astype(numpy.int) rq, tau, work, info = gerqf(a1, lwork=lwork, overwrite_a=overwrite_a) if info < 0: raise ValueError('illegal value in %d-th argument of internal geqrf' Modified: branches/0.9.x/scipy/linalg/decomp_schur.py =================================================================== --- branches/0.9.x/scipy/linalg/decomp_schur.py 2011-01-20 12:15:33 UTC (rev 7069) +++ branches/0.9.x/scipy/linalg/decomp_schur.py 2011-01-20 12:18:52 UTC (rev 7070) @@ -68,8 +68,8 @@ if lwork is None or lwork == -1: # get optimal work array result = gees(lambda x: None, a, lwork=-1) - lwork = result[-2][0] - result = gees(lambda x: None, a, lwork=result[-2][0], overwrite_a=overwrite_a) + lwork = result[-2][0].real.astype(numpy.int) + result = gees(lambda x: None, a, lwork=lwork, overwrite_a=overwrite_a) info = result[-1] if info < 0: raise ValueError('illegal value in %d-th argument of internal gees' From scipy-svn at scipy.org Sat Jan 22 17:07:42 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 22 Jan 2011 16:07:42 -0600 (CST) Subject: [Scipy-svn] r7071 - trunk/scipy/sparse/sparsetools Message-ID: <20110122220742.7BFDA32479@scipy.org> Author: ptvirtan Date: 2011-01-22 16:07:40 -0600 (Sat, 22 Jan 2011) New Revision: 7071 Modified: trunk/scipy/sparse/sparsetools/README.txt trunk/scipy/sparse/sparsetools/bsr.py trunk/scipy/sparse/sparsetools/bsr_wrap.cxx trunk/scipy/sparse/sparsetools/coo.py trunk/scipy/sparse/sparsetools/coo_wrap.cxx trunk/scipy/sparse/sparsetools/csc.py trunk/scipy/sparse/sparsetools/csc_wrap.cxx trunk/scipy/sparse/sparsetools/csgraph.py trunk/scipy/sparse/sparsetools/csgraph_wrap.cxx trunk/scipy/sparse/sparsetools/csr.py trunk/scipy/sparse/sparsetools/csr_wrap.cxx trunk/scipy/sparse/sparsetools/dia.py trunk/scipy/sparse/sparsetools/dia_wrap.cxx Log: GEN: sparse: re-swig sparsetools with swig 2.0.1 + PyCapsule hack The files were swig-ed with Swig 2.0.1 with the patch from http://sourceforge.net/tracker/?func=detail&aid=3047039&group_id=1645&atid=301645 Modified: trunk/scipy/sparse/sparsetools/README.txt =================================================================== --- trunk/scipy/sparse/sparsetools/README.txt 2011-01-20 12:18:52 UTC (rev 7070) +++ trunk/scipy/sparse/sparsetools/README.txt 2011-01-22 22:07:40 UTC (rev 7071) @@ -8,5 +8,4 @@ swig -c++ -python coo.i swig -c++ -python dia.i swig -c++ -python bsr.i - - + swig -c++ -python csgraph.i Modified: trunk/scipy/sparse/sparsetools/bsr.py =================================================================== --- trunk/scipy/sparse/sparsetools/bsr.py 2011-01-20 12:18:52 UTC (rev 7070) +++ trunk/scipy/sparse/sparsetools/bsr.py 2011-01-22 22:07:40 UTC (rev 7071) @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.40 +# Version 2.0.1+capsulehack # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. Modified: trunk/scipy/sparse/sparsetools/bsr_wrap.cxx =================================================================== --- trunk/scipy/sparse/sparsetools/bsr_wrap.cxx 2011-01-20 12:18:52 UTC (rev 7070) +++ trunk/scipy/sparse/sparsetools/bsr_wrap.cxx 2011-01-22 22:07:40 UTC (rev 7071) @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.40 + * Version 2.0.1+capsulehack * * 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 @@ -201,7 +201,7 @@ /* Flags/methods for returning states. - The SWIG conversion methods, as ConvertPtr, return and integer + The SWIG conversion methods, as ConvertPtr, return an integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). @@ -1088,9 +1088,6 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * pyrun.swg * * This file contains the runtime support for Python modules @@ -1137,8 +1134,18 @@ #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) -#define SWIG_fail goto fail +#define SWIG_fail goto fail +/* + * Python 2.7 and newer and Python 3.1 and newer should use Capsules API instead of + * CObjects API. + */ +#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \ + (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0)) +#define USE_CAPSULES +#define TYPE_POINTER_NAME \ + ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME) +#endif /* Runtime API implementation */ @@ -2071,10 +2078,13 @@ return SWIG_Python_str_FromChar("this"); } +static PyObject *swig_this = NULL; + SWIGRUNTIME PyObject * SWIG_This(void) { - static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This(); + if (swig_this == NULL) + swig_this = _SWIG_This(); return swig_this; } @@ -2178,7 +2188,7 @@ int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); if (newmemory == SWIG_CAST_NEW_MEMORY) { - assert(own); + assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ if (own) *own = *own | SWIG_CAST_NEW_MEMORY; } @@ -2448,8 +2458,12 @@ #ifdef SWIG_LINK_RUNTIME type_pointer = SWIG_ReturnGlobalTypeList((void *)0); #else +#ifdef USE_CAPSULES + type_pointer = PyCapsule_Import(TYPE_POINTER_NAME, 0); +#else type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); +#endif if (PyErr_Occurred()) { PyErr_Clear(); type_pointer = (void *)0; @@ -2494,9 +2508,14 @@ SWIGRUNTIME void SWIG_Python_DestroyModule(void *vptr) { + size_t i; +#ifdef USE_CAPSULES + swig_module_info *swig_module = + (swig_module_info *) PyCapsule_GetPointer((PyObject *)vptr, TYPE_POINTER_NAME); +#else swig_module_info *swig_module = (swig_module_info *) vptr; +#endif swig_type_info **types = swig_module->types; - size_t i; for (i =0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { @@ -2505,6 +2524,7 @@ } } Py_DECREF(SWIG_This()); + swig_this = NULL; } SWIGRUNTIME void @@ -2518,9 +2538,18 @@ PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); #endif +#ifdef USE_CAPSULES + PyObject *pointer = PyCapsule_New((void *)swig_module, TYPE_POINTER_NAME, + (PyCapsule_Destructor)SWIG_Python_DestroyModule); +#else PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); +#endif if (pointer && module) { +#ifdef USE_CAPSULES + PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer); +#else PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); +#endif } else { Py_XDECREF(pointer); } @@ -2541,12 +2570,20 @@ PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; if (obj) { +#ifdef USE_CAPSULES + descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, type); +#else descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); +#endif } else { swig_module_info *swig_module = SWIG_Python_GetModule(); descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { +#ifdef USE_CAPSULES + obj = PyCapsule_New(descriptor, type, NULL); +#else obj = PyCObject_FromVoidPtr(descriptor, NULL); +#endif PyDict_SetItem(cache, key, obj); Py_DECREF(obj); } @@ -2708,7 +2745,7 @@ #endif #define SWIG_name "_bsr" -#define SWIGVERSION 0x010340 +#define SWIGVERSION 0x020001 #define SWIG_VERSION SWIGVERSION @@ -5763,7 +5800,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_diagonal'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'bsr_diagonal'.\n" " Possible C/C++ prototypes are:\n" " bsr_diagonal< int,signed char >(int const,int const,int const,int const,int const [],int const [],signed char const [],signed char [])\n" " bsr_diagonal< int,unsigned char >(int const,int const,int const,int const,int const [],int const [],unsigned char const [],unsigned char [])\n" @@ -8259,7 +8296,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_scale_rows'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'bsr_scale_rows'.\n" " Possible C/C++ prototypes are:\n" " bsr_scale_rows< int,signed char >(int const,int const,int const,int const,int const [],int const [],signed char [],signed char const [])\n" " bsr_scale_rows< int,unsigned char >(int const,int const,int const,int const,int const [],int const [],unsigned char [],unsigned char const [])\n" @@ -10755,7 +10792,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_scale_columns'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'bsr_scale_columns'.\n" " Possible C/C++ prototypes are:\n" " bsr_scale_columns< int,signed char >(int const,int const,int const,int const,int const [],int const [],signed char [],signed char const [])\n" " bsr_scale_columns< int,unsigned char >(int const,int const,int const,int const,int const [],int const [],unsigned char [],unsigned char const [])\n" @@ -13615,7 +13652,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_transpose'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'bsr_transpose'.\n" " Possible C/C++ prototypes are:\n" " bsr_transpose< int,signed char >(int const,int const,int const,int const,int const [],int const [],signed char const [],int [],int [],signed char [])\n" " bsr_transpose< int,unsigned char >(int const,int const,int const,int const,int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n" @@ -17903,7 +17940,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_matmat_pass2'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -20805,7 +20842,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_matvec'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -23917,7 +23954,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_matvecs'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'bsr_matvecs'.\n" " Possible C/C++ prototypes are:\n" " bsr_matvecs< int,signed char >(int const,int const,int const,int const,int const,int const [],int const [],signed char const [],signed char const [],signed char [])\n" " bsr_matvecs< int,unsigned char >(int const,int const,int const,int const,int const,int const [],int const [],unsigned char const [],unsigned char const [],unsigned char [])\n" @@ -27995,7 +28032,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_elmul_bsr'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -32073,7 +32110,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_eldiv_bsr'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -36151,7 +36188,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_plus_bsr'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -40229,7 +40266,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_minus_bsr'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -41871,7 +41908,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_sort_indices'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'bsr_sort_indices'.\n" " Possible C/C++ prototypes are:\n" " bsr_sort_indices< int,signed char >(int const,int const,int const,int const,int [],int [],signed char [])\n" " bsr_sort_indices< int,unsigned char >(int const,int const,int const,int const,int [],int [],unsigned char [])\n" @@ -42878,15 +42915,15 @@ } } if (ci) { - size_t shift = (ci->ptype) - types; - swig_type_info *ty = types_initial[shift]; - size_t ldoc = (c - methods[i].ml_doc); - size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; - char *ndoc = (char*)malloc(ldoc + lptr + 10); - if (ndoc) { - char *buff = ndoc; - void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; - if (ptr) { + void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; + if (ptr) { + size_t shift = (ci->ptype) - types; + swig_type_info *ty = types_initial[shift]; + size_t ldoc = (c - methods[i].ml_doc); + size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; + char *ndoc = (char*)malloc(ldoc + lptr + 10); + if (ndoc) { + char *buff = ndoc; strncpy(buff, methods[i].ml_doc, ldoc); buff += ldoc; strncpy(buff, "swig_ptr: ", 10); Modified: trunk/scipy/sparse/sparsetools/coo.py =================================================================== --- trunk/scipy/sparse/sparsetools/coo.py 2011-01-20 12:18:52 UTC (rev 7070) +++ trunk/scipy/sparse/sparsetools/coo.py 2011-01-22 22:07:40 UTC (rev 7071) @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.40 +# Version 2.0.1+capsulehack # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. Modified: trunk/scipy/sparse/sparsetools/coo_wrap.cxx =================================================================== --- trunk/scipy/sparse/sparsetools/coo_wrap.cxx 2011-01-20 12:18:52 UTC (rev 7070) +++ trunk/scipy/sparse/sparsetools/coo_wrap.cxx 2011-01-22 22:07:40 UTC (rev 7071) @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.40 + * Version 2.0.1+capsulehack * * 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 @@ -201,7 +201,7 @@ /* Flags/methods for returning states. - The SWIG conversion methods, as ConvertPtr, return and integer + The SWIG conversion methods, as ConvertPtr, return an integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). @@ -1088,9 +1088,6 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * pyrun.swg * * This file contains the runtime support for Python modules @@ -1137,8 +1134,18 @@ #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) -#define SWIG_fail goto fail +#define SWIG_fail goto fail +/* + * Python 2.7 and newer and Python 3.1 and newer should use Capsules API instead of + * CObjects API. + */ +#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \ + (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0)) +#define USE_CAPSULES +#define TYPE_POINTER_NAME \ + ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME) +#endif /* Runtime API implementation */ @@ -2071,10 +2078,13 @@ return SWIG_Python_str_FromChar("this"); } +static PyObject *swig_this = NULL; + SWIGRUNTIME PyObject * SWIG_This(void) { - static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This(); + if (swig_this == NULL) + swig_this = _SWIG_This(); return swig_this; } @@ -2178,7 +2188,7 @@ int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); if (newmemory == SWIG_CAST_NEW_MEMORY) { - assert(own); + assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ if (own) *own = *own | SWIG_CAST_NEW_MEMORY; } @@ -2448,8 +2458,12 @@ #ifdef SWIG_LINK_RUNTIME type_pointer = SWIG_ReturnGlobalTypeList((void *)0); #else +#ifdef USE_CAPSULES + type_pointer = PyCapsule_Import(TYPE_POINTER_NAME, 0); +#else type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); +#endif if (PyErr_Occurred()) { PyErr_Clear(); type_pointer = (void *)0; @@ -2494,9 +2508,14 @@ SWIGRUNTIME void SWIG_Python_DestroyModule(void *vptr) { + size_t i; +#ifdef USE_CAPSULES + swig_module_info *swig_module = + (swig_module_info *) PyCapsule_GetPointer((PyObject *)vptr, TYPE_POINTER_NAME); +#else swig_module_info *swig_module = (swig_module_info *) vptr; +#endif swig_type_info **types = swig_module->types; - size_t i; for (i =0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { @@ -2505,6 +2524,7 @@ } } Py_DECREF(SWIG_This()); + swig_this = NULL; } SWIGRUNTIME void @@ -2518,9 +2538,18 @@ PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); #endif +#ifdef USE_CAPSULES + PyObject *pointer = PyCapsule_New((void *)swig_module, TYPE_POINTER_NAME, + (PyCapsule_Destructor)SWIG_Python_DestroyModule); +#else PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); +#endif if (pointer && module) { +#ifdef USE_CAPSULES + PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer); +#else PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); +#endif } else { Py_XDECREF(pointer); } @@ -2541,12 +2570,20 @@ PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; if (obj) { +#ifdef USE_CAPSULES + descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, type); +#else descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); +#endif } else { swig_module_info *swig_module = SWIG_Python_GetModule(); descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { +#ifdef USE_CAPSULES + obj = PyCapsule_New(descriptor, type, NULL); +#else obj = PyCObject_FromVoidPtr(descriptor, NULL); +#endif PyDict_SetItem(cache, key, obj); Py_DECREF(obj); } @@ -2708,7 +2745,7 @@ #endif #define SWIG_name "_coo" -#define SWIGVERSION 0x010340 +#define SWIGVERSION 0x020001 #define SWIG_VERSION SWIGVERSION @@ -5927,7 +5964,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'coo_tocsr'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -8577,7 +8614,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'coo_tocsc'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -10863,7 +10900,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'coo_todense'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'coo_todense'.\n" " Possible C/C++ prototypes are:\n" " coo_todense< int,signed char >(int const,int const,int const,int const [],int const [],signed char const [],signed char [])\n" " coo_todense< int,unsigned char >(int const,int const,int const,int const [],int const [],unsigned char const [],unsigned char [])\n" @@ -13135,7 +13172,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'coo_matvec'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'coo_matvec'.\n" " Possible C/C++ prototypes are:\n" " coo_matvec< int,signed char >(int const,int const [],int const [],signed char const [],signed char const [],signed char [])\n" " coo_matvec< int,unsigned char >(int const,int const [],int const [],unsigned char const [],unsigned char const [],unsigned char [])\n" @@ -13883,15 +13920,15 @@ } } if (ci) { - size_t shift = (ci->ptype) - types; - swig_type_info *ty = types_initial[shift]; - size_t ldoc = (c - methods[i].ml_doc); - size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; - char *ndoc = (char*)malloc(ldoc + lptr + 10); - if (ndoc) { - char *buff = ndoc; - void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; - if (ptr) { + void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; + if (ptr) { + size_t shift = (ci->ptype) - types; + swig_type_info *ty = types_initial[shift]; + size_t ldoc = (c - methods[i].ml_doc); + size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; + char *ndoc = (char*)malloc(ldoc + lptr + 10); + if (ndoc) { + char *buff = ndoc; strncpy(buff, methods[i].ml_doc, ldoc); buff += ldoc; strncpy(buff, "swig_ptr: ", 10); Modified: trunk/scipy/sparse/sparsetools/csc.py =================================================================== --- trunk/scipy/sparse/sparsetools/csc.py 2011-01-20 12:18:52 UTC (rev 7070) +++ trunk/scipy/sparse/sparsetools/csc.py 2011-01-22 22:07:40 UTC (rev 7071) @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.40 +# Version 2.0.1+capsulehack # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. Modified: trunk/scipy/sparse/sparsetools/csc_wrap.cxx =================================================================== --- trunk/scipy/sparse/sparsetools/csc_wrap.cxx 2011-01-20 12:18:52 UTC (rev 7070) +++ trunk/scipy/sparse/sparsetools/csc_wrap.cxx 2011-01-22 22:07:40 UTC (rev 7071) @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.40 + * Version 2.0.1+capsulehack * * 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 @@ -201,7 +201,7 @@ /* Flags/methods for returning states. - The SWIG conversion methods, as ConvertPtr, return and integer + The SWIG conversion methods, as ConvertPtr, return an integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). @@ -1088,9 +1088,6 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * pyrun.swg * * This file contains the runtime support for Python modules @@ -1137,8 +1134,18 @@ #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) -#define SWIG_fail goto fail +#define SWIG_fail goto fail +/* + * Python 2.7 and newer and Python 3.1 and newer should use Capsules API instead of + * CObjects API. + */ +#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \ + (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0)) +#define USE_CAPSULES +#define TYPE_POINTER_NAME \ + ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME) +#endif /* Runtime API implementation */ @@ -2071,10 +2078,13 @@ return SWIG_Python_str_FromChar("this"); } +static PyObject *swig_this = NULL; + SWIGRUNTIME PyObject * SWIG_This(void) { - static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This(); + if (swig_this == NULL) + swig_this = _SWIG_This(); return swig_this; } @@ -2178,7 +2188,7 @@ int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); if (newmemory == SWIG_CAST_NEW_MEMORY) { - assert(own); + assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ if (own) *own = *own | SWIG_CAST_NEW_MEMORY; } @@ -2448,8 +2458,12 @@ #ifdef SWIG_LINK_RUNTIME type_pointer = SWIG_ReturnGlobalTypeList((void *)0); #else +#ifdef USE_CAPSULES + type_pointer = PyCapsule_Import(TYPE_POINTER_NAME, 0); +#else type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); +#endif if (PyErr_Occurred()) { PyErr_Clear(); type_pointer = (void *)0; @@ -2494,9 +2508,14 @@ SWIGRUNTIME void SWIG_Python_DestroyModule(void *vptr) { + size_t i; +#ifdef USE_CAPSULES + swig_module_info *swig_module = + (swig_module_info *) PyCapsule_GetPointer((PyObject *)vptr, TYPE_POINTER_NAME); +#else swig_module_info *swig_module = (swig_module_info *) vptr; +#endif swig_type_info **types = swig_module->types; - size_t i; for (i =0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { @@ -2505,6 +2524,7 @@ } } Py_DECREF(SWIG_This()); + swig_this = NULL; } SWIGRUNTIME void @@ -2518,9 +2538,18 @@ PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); #endif +#ifdef USE_CAPSULES + PyObject *pointer = PyCapsule_New((void *)swig_module, TYPE_POINTER_NAME, + (PyCapsule_Destructor)SWIG_Python_DestroyModule); +#else PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); +#endif if (pointer && module) { +#ifdef USE_CAPSULES + PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer); +#else PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); +#endif } else { Py_XDECREF(pointer); } @@ -2541,12 +2570,20 @@ PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; if (obj) { +#ifdef USE_CAPSULES + descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, type); +#else descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); +#endif } else { swig_module_info *swig_module = SWIG_Python_GetModule(); descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { +#ifdef USE_CAPSULES + obj = PyCapsule_New(descriptor, type, NULL); +#else obj = PyCObject_FromVoidPtr(descriptor, NULL); +#endif PyDict_SetItem(cache, key, obj); Py_DECREF(obj); } @@ -2708,7 +2745,7 @@ #endif #define SWIG_name "_csc" -#define SWIGVERSION 0x010340 +#define SWIGVERSION 0x020001 #define SWIG_VERSION SWIGVERSION @@ -5477,7 +5514,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_diagonal'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -7917,7 +7954,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_tocsr'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -11575,7 +11612,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_matmat_pass2'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -14057,7 +14094,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_matvec'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -16749,7 +16786,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_matvecs'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'csc_matvecs'.\n" " Possible C/C++ prototypes are:\n" " csc_matvecs< int,signed char >(int const,int const,int const,int const [],int const [],signed char const [],signed char const [],signed char [])\n" " csc_matvecs< int,unsigned char >(int const,int const,int const,int const [],int const [],unsigned char const [],unsigned char const [],unsigned char [])\n" @@ -20407,7 +20444,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_elmul_csc'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -24065,7 +24102,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_eldiv_csc'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -27723,7 +27760,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_plus_csc'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -31381,7 +31418,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_minus_csc'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -32266,15 +32303,15 @@ } } if (ci) { - size_t shift = (ci->ptype) - types; - swig_type_info *ty = types_initial[shift]; - size_t ldoc = (c - methods[i].ml_doc); - size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; - char *ndoc = (char*)malloc(ldoc + lptr + 10); - if (ndoc) { - char *buff = ndoc; - void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; - if (ptr) { + void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; + if (ptr) { + size_t shift = (ci->ptype) - types; + swig_type_info *ty = types_initial[shift]; + size_t ldoc = (c - methods[i].ml_doc); + size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; + char *ndoc = (char*)malloc(ldoc + lptr + 10); + if (ndoc) { + char *buff = ndoc; strncpy(buff, methods[i].ml_doc, ldoc); buff += ldoc; strncpy(buff, "swig_ptr: ", 10); Modified: trunk/scipy/sparse/sparsetools/csgraph.py =================================================================== --- trunk/scipy/sparse/sparsetools/csgraph.py 2011-01-20 12:18:52 UTC (rev 7070) +++ trunk/scipy/sparse/sparsetools/csgraph.py 2011-01-22 22:07:40 UTC (rev 7071) @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.40 +# Version 2.0.1+capsulehack # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. Modified: trunk/scipy/sparse/sparsetools/csgraph_wrap.cxx =================================================================== --- trunk/scipy/sparse/sparsetools/csgraph_wrap.cxx 2011-01-20 12:18:52 UTC (rev 7070) +++ trunk/scipy/sparse/sparsetools/csgraph_wrap.cxx 2011-01-22 22:07:40 UTC (rev 7071) @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.40 + * Version 2.0.1+capsulehack * * 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 @@ -201,7 +201,7 @@ /* Flags/methods for returning states. - The SWIG conversion methods, as ConvertPtr, return and integer + The SWIG conversion methods, as ConvertPtr, return an integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). @@ -1088,9 +1088,6 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * pyrun.swg * * This file contains the runtime support for Python modules @@ -1137,8 +1134,18 @@ #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) -#define SWIG_fail goto fail +#define SWIG_fail goto fail +/* + * Python 2.7 and newer and Python 3.1 and newer should use Capsules API instead of + * CObjects API. + */ +#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \ + (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0)) +#define USE_CAPSULES +#define TYPE_POINTER_NAME \ + ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME) +#endif /* Runtime API implementation */ @@ -2071,10 +2078,13 @@ return SWIG_Python_str_FromChar("this"); } +static PyObject *swig_this = NULL; + SWIGRUNTIME PyObject * SWIG_This(void) { - static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This(); + if (swig_this == NULL) + swig_this = _SWIG_This(); return swig_this; } @@ -2178,7 +2188,7 @@ int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); if (newmemory == SWIG_CAST_NEW_MEMORY) { - assert(own); + assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ if (own) *own = *own | SWIG_CAST_NEW_MEMORY; } @@ -2448,8 +2458,12 @@ #ifdef SWIG_LINK_RUNTIME type_pointer = SWIG_ReturnGlobalTypeList((void *)0); #else +#ifdef USE_CAPSULES + type_pointer = PyCapsule_Import(TYPE_POINTER_NAME, 0); +#else type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); +#endif if (PyErr_Occurred()) { PyErr_Clear(); type_pointer = (void *)0; @@ -2494,9 +2508,14 @@ SWIGRUNTIME void SWIG_Python_DestroyModule(void *vptr) { + size_t i; +#ifdef USE_CAPSULES + swig_module_info *swig_module = + (swig_module_info *) PyCapsule_GetPointer((PyObject *)vptr, TYPE_POINTER_NAME); +#else swig_module_info *swig_module = (swig_module_info *) vptr; +#endif swig_type_info **types = swig_module->types; - size_t i; for (i =0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { @@ -2505,6 +2524,7 @@ } } Py_DECREF(SWIG_This()); + swig_this = NULL; } SWIGRUNTIME void @@ -2518,9 +2538,18 @@ PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); #endif +#ifdef USE_CAPSULES + PyObject *pointer = PyCapsule_New((void *)swig_module, TYPE_POINTER_NAME, + (PyCapsule_Destructor)SWIG_Python_DestroyModule); +#else PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); +#endif if (pointer && module) { +#ifdef USE_CAPSULES + PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer); +#else PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); +#endif } else { Py_XDECREF(pointer); } @@ -2541,12 +2570,20 @@ PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; if (obj) { +#ifdef USE_CAPSULES + descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, type); +#else descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); +#endif } else { swig_module_info *swig_module = SWIG_Python_GetModule(); descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { +#ifdef USE_CAPSULES + obj = PyCapsule_New(descriptor, type, NULL); +#else obj = PyCObject_FromVoidPtr(descriptor, NULL); +#endif PyDict_SetItem(cache, key, obj); Py_DECREF(obj); } @@ -2708,7 +2745,7 @@ #endif #define SWIG_name "_csgraph" -#define SWIGVERSION 0x010340 +#define SWIGVERSION 0x020001 #define SWIG_VERSION SWIGVERSION @@ -3920,15 +3957,15 @@ } } if (ci) { - size_t shift = (ci->ptype) - types; - swig_type_info *ty = types_initial[shift]; - size_t ldoc = (c - methods[i].ml_doc); - size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; - char *ndoc = (char*)malloc(ldoc + lptr + 10); - if (ndoc) { - char *buff = ndoc; - void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; - if (ptr) { + void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; + if (ptr) { + size_t shift = (ci->ptype) - types; + swig_type_info *ty = types_initial[shift]; + size_t ldoc = (c - methods[i].ml_doc); + size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; + char *ndoc = (char*)malloc(ldoc + lptr + 10); + if (ndoc) { + char *buff = ndoc; strncpy(buff, methods[i].ml_doc, ldoc); buff += ldoc; strncpy(buff, "swig_ptr: ", 10); Modified: trunk/scipy/sparse/sparsetools/csr.py =================================================================== --- trunk/scipy/sparse/sparsetools/csr.py 2011-01-20 12:18:52 UTC (rev 7070) +++ trunk/scipy/sparse/sparsetools/csr.py 2011-01-22 22:07:40 UTC (rev 7071) @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.40 +# Version 2.0.1+capsulehack # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. Modified: trunk/scipy/sparse/sparsetools/csr_wrap.cxx =================================================================== --- trunk/scipy/sparse/sparsetools/csr_wrap.cxx 2011-01-20 12:18:52 UTC (rev 7070) +++ trunk/scipy/sparse/sparsetools/csr_wrap.cxx 2011-01-22 22:07:40 UTC (rev 7071) @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.40 + * Version 2.0.1+capsulehack * * 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 @@ -201,7 +201,7 @@ /* Flags/methods for returning states. - The SWIG conversion methods, as ConvertPtr, return and integer + The SWIG conversion methods, as ConvertPtr, return an integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). @@ -1088,9 +1088,6 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * pyrun.swg * * This file contains the runtime support for Python modules @@ -1137,8 +1134,18 @@ #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) -#define SWIG_fail goto fail +#define SWIG_fail goto fail +/* + * Python 2.7 and newer and Python 3.1 and newer should use Capsules API instead of + * CObjects API. + */ +#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \ + (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0)) +#define USE_CAPSULES +#define TYPE_POINTER_NAME \ + ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME) +#endif /* Runtime API implementation */ @@ -2071,10 +2078,13 @@ return SWIG_Python_str_FromChar("this"); } +static PyObject *swig_this = NULL; + SWIGRUNTIME PyObject * SWIG_This(void) { - static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This(); + if (swig_this == NULL) + swig_this = _SWIG_This(); return swig_this; } @@ -2178,7 +2188,7 @@ int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); if (newmemory == SWIG_CAST_NEW_MEMORY) { - assert(own); + assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ if (own) *own = *own | SWIG_CAST_NEW_MEMORY; } @@ -2448,8 +2458,12 @@ #ifdef SWIG_LINK_RUNTIME type_pointer = SWIG_ReturnGlobalTypeList((void *)0); #else +#ifdef USE_CAPSULES + type_pointer = PyCapsule_Import(TYPE_POINTER_NAME, 0); +#else type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); +#endif if (PyErr_Occurred()) { PyErr_Clear(); type_pointer = (void *)0; @@ -2494,9 +2508,14 @@ SWIGRUNTIME void SWIG_Python_DestroyModule(void *vptr) { + size_t i; +#ifdef USE_CAPSULES + swig_module_info *swig_module = + (swig_module_info *) PyCapsule_GetPointer((PyObject *)vptr, TYPE_POINTER_NAME); +#else swig_module_info *swig_module = (swig_module_info *) vptr; +#endif swig_type_info **types = swig_module->types; - size_t i; for (i =0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { @@ -2505,6 +2524,7 @@ } } Py_DECREF(SWIG_This()); + swig_this = NULL; } SWIGRUNTIME void @@ -2518,9 +2538,18 @@ PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); #endif +#ifdef USE_CAPSULES + PyObject *pointer = PyCapsule_New((void *)swig_module, TYPE_POINTER_NAME, + (PyCapsule_Destructor)SWIG_Python_DestroyModule); +#else PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); +#endif if (pointer && module) { +#ifdef USE_CAPSULES + PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer); +#else PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); +#endif } else { Py_XDECREF(pointer); } @@ -2541,12 +2570,20 @@ PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; if (obj) { +#ifdef USE_CAPSULES + descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, type); +#else descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); +#endif } else { swig_module_info *swig_module = SWIG_Python_GetModule(); descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { +#ifdef USE_CAPSULES + obj = PyCapsule_New(descriptor, type, NULL); +#else obj = PyCObject_FromVoidPtr(descriptor, NULL); +#endif PyDict_SetItem(cache, key, obj); Py_DECREF(obj); } @@ -2722,7 +2759,7 @@ #endif #define SWIG_name "_csr" -#define SWIGVERSION 0x010340 +#define SWIGVERSION 0x020001 #define SWIG_VERSION SWIGVERSION @@ -5728,7 +5765,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_diagonal'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -7804,7 +7841,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_scale_rows'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'csr_scale_rows'.\n" " Possible C/C++ prototypes are:\n" " csr_scale_rows< int,signed char >(int const,int const,int const [],int const [],signed char [],signed char const [])\n" " csr_scale_rows< int,unsigned char >(int const,int const,int const [],int const [],unsigned char [],unsigned char const [])\n" @@ -9880,7 +9917,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_scale_columns'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'csr_scale_columns'.\n" " Possible C/C++ prototypes are:\n" " csr_scale_columns< int,signed char >(int const,int const,int const [],int const [],signed char [],signed char const [])\n" " csr_scale_columns< int,unsigned char >(int const,int const,int const [],int const [],unsigned char [],unsigned char const [])\n" @@ -12320,7 +12357,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_tocsc'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -15180,7 +15217,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_tobsr'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'csr_tobsr'.\n" " Possible C/C++ prototypes are:\n" " csr_tobsr< int,signed char >(int const,int const,int const,int const,int const [],int const [],signed char const [],int [],int [],signed char [])\n" " csr_tobsr< int,unsigned char >(int const,int const,int const,int const,int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n" @@ -18838,7 +18875,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_matmat_pass2'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -21320,7 +21357,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_matvec'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -24012,7 +24049,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_matvecs'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'csr_matvecs'.\n" " Possible C/C++ prototypes are:\n" " csr_matvecs< int,signed char >(int const,int const,int const,int const [],int const [],signed char const [],signed char const [],signed char [])\n" " csr_matvecs< int,unsigned char >(int const,int const,int const,int const [],int const [],unsigned char const [],unsigned char const [],unsigned char [])\n" @@ -27670,7 +27707,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_elmul_csr'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -31328,7 +31365,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_eldiv_csr'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -34986,7 +35023,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_plus_csr'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -38644,7 +38681,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_minus_csr'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -39880,7 +39917,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_sort_indices'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -41102,7 +41139,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_eliminate_zeros'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'csr_eliminate_zeros'.\n" " Possible C/C++ prototypes are:\n" " csr_eliminate_zeros< int,signed char >(int const,int const,int [],int [],signed char [])\n" " csr_eliminate_zeros< int,unsigned char >(int const,int const,int [],int [],unsigned char [])\n" @@ -42324,7 +42361,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_sum_duplicates'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -45604,7 +45641,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'get_csr_submatrix'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'get_csr_submatrix'.\n" " Possible C/C++ prototypes are:\n" " get_csr_submatrix< int,signed char >(int const,int const,int const [],int const [],signed char const [],int const,int const,int const,int const,std::vector< int > *,std::vector< int > *,std::vector< signed char > *)\n" " get_csr_submatrix< int,unsigned char >(int const,int const,int const [],int const [],unsigned char const [],int const,int const,int const,int const,std::vector< int > *,std::vector< int > *,std::vector< unsigned char > *)\n" @@ -48702,7 +48739,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_sample_values'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'csr_sample_values'.\n" " Possible C/C++ prototypes are:\n" " csr_sample_values< int,signed char >(int const,int const,int const [],int const [],signed char const [],int const,int const [],int const [],signed char [])\n" " csr_sample_values< int,unsigned char >(int const,int const,int const [],int const [],unsigned char const [],int const,int const [],int const [],unsigned char [])\n" @@ -49838,15 +49875,15 @@ } } if (ci) { - size_t shift = (ci->ptype) - types; - swig_type_info *ty = types_initial[shift]; - size_t ldoc = (c - methods[i].ml_doc); - size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; - char *ndoc = (char*)malloc(ldoc + lptr + 10); - if (ndoc) { - char *buff = ndoc; - void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; - if (ptr) { + void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; + if (ptr) { + size_t shift = (ci->ptype) - types; + swig_type_info *ty = types_initial[shift]; + size_t ldoc = (c - methods[i].ml_doc); + size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; + char *ndoc = (char*)malloc(ldoc + lptr + 10); + if (ndoc) { + char *buff = ndoc; strncpy(buff, methods[i].ml_doc, ldoc); buff += ldoc; strncpy(buff, "swig_ptr: ", 10); Modified: trunk/scipy/sparse/sparsetools/dia.py =================================================================== --- trunk/scipy/sparse/sparsetools/dia.py 2011-01-20 12:18:52 UTC (rev 7070) +++ trunk/scipy/sparse/sparsetools/dia.py 2011-01-22 22:07:40 UTC (rev 7071) @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.40 +# Version 2.0.1+capsulehack # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. Modified: trunk/scipy/sparse/sparsetools/dia_wrap.cxx =================================================================== --- trunk/scipy/sparse/sparsetools/dia_wrap.cxx 2011-01-20 12:18:52 UTC (rev 7070) +++ trunk/scipy/sparse/sparsetools/dia_wrap.cxx 2011-01-22 22:07:40 UTC (rev 7071) @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.40 + * Version 2.0.1+capsulehack * * 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 @@ -201,7 +201,7 @@ /* Flags/methods for returning states. - The SWIG conversion methods, as ConvertPtr, return and integer + The SWIG conversion methods, as ConvertPtr, return an integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). @@ -1088,9 +1088,6 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * pyrun.swg * * This file contains the runtime support for Python modules @@ -1137,8 +1134,18 @@ #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) -#define SWIG_fail goto fail +#define SWIG_fail goto fail +/* + * Python 2.7 and newer and Python 3.1 and newer should use Capsules API instead of + * CObjects API. + */ +#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \ + (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0)) +#define USE_CAPSULES +#define TYPE_POINTER_NAME \ + ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME) +#endif /* Runtime API implementation */ @@ -2071,10 +2078,13 @@ return SWIG_Python_str_FromChar("this"); } +static PyObject *swig_this = NULL; + SWIGRUNTIME PyObject * SWIG_This(void) { - static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This(); + if (swig_this == NULL) + swig_this = _SWIG_This(); return swig_this; } @@ -2178,7 +2188,7 @@ int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); if (newmemory == SWIG_CAST_NEW_MEMORY) { - assert(own); + assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ if (own) *own = *own | SWIG_CAST_NEW_MEMORY; } @@ -2448,8 +2458,12 @@ #ifdef SWIG_LINK_RUNTIME type_pointer = SWIG_ReturnGlobalTypeList((void *)0); #else +#ifdef USE_CAPSULES + type_pointer = PyCapsule_Import(TYPE_POINTER_NAME, 0); +#else type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); +#endif if (PyErr_Occurred()) { PyErr_Clear(); type_pointer = (void *)0; @@ -2494,9 +2508,14 @@ SWIGRUNTIME void SWIG_Python_DestroyModule(void *vptr) { + size_t i; +#ifdef USE_CAPSULES + swig_module_info *swig_module = + (swig_module_info *) PyCapsule_GetPointer((PyObject *)vptr, TYPE_POINTER_NAME); +#else swig_module_info *swig_module = (swig_module_info *) vptr; +#endif swig_type_info **types = swig_module->types; - size_t i; for (i =0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { @@ -2505,6 +2524,7 @@ } } Py_DECREF(SWIG_This()); + swig_this = NULL; } SWIGRUNTIME void @@ -2518,9 +2538,18 @@ PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); #endif +#ifdef USE_CAPSULES + PyObject *pointer = PyCapsule_New((void *)swig_module, TYPE_POINTER_NAME, + (PyCapsule_Destructor)SWIG_Python_DestroyModule); +#else PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); +#endif if (pointer && module) { +#ifdef USE_CAPSULES + PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer); +#else PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); +#endif } else { Py_XDECREF(pointer); } @@ -2541,12 +2570,20 @@ PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; if (obj) { +#ifdef USE_CAPSULES + descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, type); +#else descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); +#endif } else { swig_module_info *swig_module = SWIG_Python_GetModule(); descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { +#ifdef USE_CAPSULES + obj = PyCapsule_New(descriptor, type, NULL); +#else obj = PyCObject_FromVoidPtr(descriptor, NULL); +#endif PyDict_SetItem(cache, key, obj); Py_DECREF(obj); } @@ -2708,7 +2745,7 @@ #endif #define SWIG_name "_dia" -#define SWIGVERSION 0x010340 +#define SWIGVERSION 0x020001 #define SWIG_VERSION SWIGVERSION @@ -5749,7 +5786,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'dia_matvec'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'dia_matvec'.\n" " Possible C/C++ prototypes are:\n" " dia_matvec< int,signed char >(int const,int const,int const,int const,int const [],signed char const [],signed char const [],signed char [])\n" " dia_matvec< int,unsigned char >(int const,int const,int const,int const,int const [],unsigned char const [],unsigned char const [],unsigned char [])\n" @@ -6345,15 +6382,15 @@ } } if (ci) { - size_t shift = (ci->ptype) - types; - swig_type_info *ty = types_initial[shift]; - size_t ldoc = (c - methods[i].ml_doc); - size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; - char *ndoc = (char*)malloc(ldoc + lptr + 10); - if (ndoc) { - char *buff = ndoc; - void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; - if (ptr) { + void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; + if (ptr) { + size_t shift = (ci->ptype) - types; + swig_type_info *ty = types_initial[shift]; + size_t ldoc = (c - methods[i].ml_doc); + size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; + char *ndoc = (char*)malloc(ldoc + lptr + 10); + if (ndoc) { + char *buff = ndoc; strncpy(buff, methods[i].ml_doc, ldoc); buff += ldoc; strncpy(buff, "swig_ptr: ", 10); From scipy-svn at scipy.org Sun Jan 23 02:08:15 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 23 Jan 2011 01:08:15 -0600 (CST) Subject: [Scipy-svn] r7072 - trunk/scipy/maxentropy Message-ID: <20110123070815.44C2137BA54@scipy.org> Author: rgommers Date: 2011-01-23 01:08:14 -0600 (Sun, 23 Jan 2011) New Revision: 7072 Modified: trunk/scipy/maxentropy/maxentutils.py Log: BUG: Fix a call in maxentropy to removed sparse method. Modified: trunk/scipy/maxentropy/maxentutils.py =================================================================== --- trunk/scipy/maxentropy/maxentutils.py 2011-01-22 22:07:40 UTC (rev 7071) +++ trunk/scipy/maxentropy/maxentutils.py 2011-01-23 07:08:14 UTC (rev 7072) @@ -378,7 +378,7 @@ "a vector (rank-1 dense array) if A is sparse.") return innerprod elif sparse.isspmatrix(A): - return A.rmatvec(v).transpose() + return (A.conj().transpose() * v).transpose() else: # Assume A is dense if isinstance(v, numpy.ndarray): From scipy-svn at scipy.org Sun Jan 23 02:13:35 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 23 Jan 2011 01:13:35 -0600 (CST) Subject: [Scipy-svn] r7073 - branches/0.9.x/scipy/maxentropy Message-ID: <20110123071335.CE39937BA54@scipy.org> Author: rgommers Date: 2011-01-23 01:13:35 -0600 (Sun, 23 Jan 2011) New Revision: 7073 Modified: branches/0.9.x/scipy/maxentropy/maxentutils.py Log: BUG: Fix a call in maxentropy to removed sparse method. (backport of r7072) Modified: branches/0.9.x/scipy/maxentropy/maxentutils.py =================================================================== --- branches/0.9.x/scipy/maxentropy/maxentutils.py 2011-01-23 07:08:14 UTC (rev 7072) +++ branches/0.9.x/scipy/maxentropy/maxentutils.py 2011-01-23 07:13:35 UTC (rev 7073) @@ -378,7 +378,7 @@ "a vector (rank-1 dense array) if A is sparse.") return innerprod elif sparse.isspmatrix(A): - return A.rmatvec(v).transpose() + return (A.conj().transpose() * v).transpose() else: # Assume A is dense if isinstance(v, numpy.ndarray): From scipy-svn at scipy.org Sun Jan 23 02:14:02 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 23 Jan 2011 01:14:02 -0600 (CST) Subject: [Scipy-svn] r7074 - branches/0.9.x/scipy/sparse/sparsetools Message-ID: <20110123071402.701ED37BA54@scipy.org> Author: rgommers Date: 2011-01-23 01:14:01 -0600 (Sun, 23 Jan 2011) New Revision: 7074 Modified: branches/0.9.x/scipy/sparse/sparsetools/README.txt branches/0.9.x/scipy/sparse/sparsetools/bsr.py branches/0.9.x/scipy/sparse/sparsetools/bsr_wrap.cxx branches/0.9.x/scipy/sparse/sparsetools/coo.py branches/0.9.x/scipy/sparse/sparsetools/coo_wrap.cxx branches/0.9.x/scipy/sparse/sparsetools/csc.py branches/0.9.x/scipy/sparse/sparsetools/csc_wrap.cxx branches/0.9.x/scipy/sparse/sparsetools/csgraph.py branches/0.9.x/scipy/sparse/sparsetools/csgraph_wrap.cxx branches/0.9.x/scipy/sparse/sparsetools/csr.py branches/0.9.x/scipy/sparse/sparsetools/csr_wrap.cxx branches/0.9.x/scipy/sparse/sparsetools/dia.py branches/0.9.x/scipy/sparse/sparsetools/dia_wrap.cxx Log: GEN: sparse: re-swig sparsetools with swig 2.0.1 + PyCapsule hack The files were swig-ed with Swig 2.0.1 with the patch from http://sourceforge.net/tracker/?func=detail&aid=3047039&group_id=1645&atid=301645 (backport of r7071) Modified: branches/0.9.x/scipy/sparse/sparsetools/README.txt =================================================================== --- branches/0.9.x/scipy/sparse/sparsetools/README.txt 2011-01-23 07:13:35 UTC (rev 7073) +++ branches/0.9.x/scipy/sparse/sparsetools/README.txt 2011-01-23 07:14:01 UTC (rev 7074) @@ -8,5 +8,4 @@ swig -c++ -python coo.i swig -c++ -python dia.i swig -c++ -python bsr.i - - + swig -c++ -python csgraph.i Modified: branches/0.9.x/scipy/sparse/sparsetools/bsr.py =================================================================== --- branches/0.9.x/scipy/sparse/sparsetools/bsr.py 2011-01-23 07:13:35 UTC (rev 7073) +++ branches/0.9.x/scipy/sparse/sparsetools/bsr.py 2011-01-23 07:14:01 UTC (rev 7074) @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.40 +# Version 2.0.1+capsulehack # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. Modified: branches/0.9.x/scipy/sparse/sparsetools/bsr_wrap.cxx =================================================================== --- branches/0.9.x/scipy/sparse/sparsetools/bsr_wrap.cxx 2011-01-23 07:13:35 UTC (rev 7073) +++ branches/0.9.x/scipy/sparse/sparsetools/bsr_wrap.cxx 2011-01-23 07:14:01 UTC (rev 7074) @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.40 + * Version 2.0.1+capsulehack * * 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 @@ -201,7 +201,7 @@ /* Flags/methods for returning states. - The SWIG conversion methods, as ConvertPtr, return and integer + The SWIG conversion methods, as ConvertPtr, return an integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). @@ -1088,9 +1088,6 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * pyrun.swg * * This file contains the runtime support for Python modules @@ -1137,8 +1134,18 @@ #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) -#define SWIG_fail goto fail +#define SWIG_fail goto fail +/* + * Python 2.7 and newer and Python 3.1 and newer should use Capsules API instead of + * CObjects API. + */ +#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \ + (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0)) +#define USE_CAPSULES +#define TYPE_POINTER_NAME \ + ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME) +#endif /* Runtime API implementation */ @@ -2071,10 +2078,13 @@ return SWIG_Python_str_FromChar("this"); } +static PyObject *swig_this = NULL; + SWIGRUNTIME PyObject * SWIG_This(void) { - static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This(); + if (swig_this == NULL) + swig_this = _SWIG_This(); return swig_this; } @@ -2178,7 +2188,7 @@ int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); if (newmemory == SWIG_CAST_NEW_MEMORY) { - assert(own); + assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ if (own) *own = *own | SWIG_CAST_NEW_MEMORY; } @@ -2448,8 +2458,12 @@ #ifdef SWIG_LINK_RUNTIME type_pointer = SWIG_ReturnGlobalTypeList((void *)0); #else +#ifdef USE_CAPSULES + type_pointer = PyCapsule_Import(TYPE_POINTER_NAME, 0); +#else type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); +#endif if (PyErr_Occurred()) { PyErr_Clear(); type_pointer = (void *)0; @@ -2494,9 +2508,14 @@ SWIGRUNTIME void SWIG_Python_DestroyModule(void *vptr) { + size_t i; +#ifdef USE_CAPSULES + swig_module_info *swig_module = + (swig_module_info *) PyCapsule_GetPointer((PyObject *)vptr, TYPE_POINTER_NAME); +#else swig_module_info *swig_module = (swig_module_info *) vptr; +#endif swig_type_info **types = swig_module->types; - size_t i; for (i =0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { @@ -2505,6 +2524,7 @@ } } Py_DECREF(SWIG_This()); + swig_this = NULL; } SWIGRUNTIME void @@ -2518,9 +2538,18 @@ PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); #endif +#ifdef USE_CAPSULES + PyObject *pointer = PyCapsule_New((void *)swig_module, TYPE_POINTER_NAME, + (PyCapsule_Destructor)SWIG_Python_DestroyModule); +#else PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); +#endif if (pointer && module) { +#ifdef USE_CAPSULES + PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer); +#else PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); +#endif } else { Py_XDECREF(pointer); } @@ -2541,12 +2570,20 @@ PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; if (obj) { +#ifdef USE_CAPSULES + descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, type); +#else descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); +#endif } else { swig_module_info *swig_module = SWIG_Python_GetModule(); descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { +#ifdef USE_CAPSULES + obj = PyCapsule_New(descriptor, type, NULL); +#else obj = PyCObject_FromVoidPtr(descriptor, NULL); +#endif PyDict_SetItem(cache, key, obj); Py_DECREF(obj); } @@ -2708,7 +2745,7 @@ #endif #define SWIG_name "_bsr" -#define SWIGVERSION 0x010340 +#define SWIGVERSION 0x020001 #define SWIG_VERSION SWIGVERSION @@ -5763,7 +5800,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_diagonal'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'bsr_diagonal'.\n" " Possible C/C++ prototypes are:\n" " bsr_diagonal< int,signed char >(int const,int const,int const,int const,int const [],int const [],signed char const [],signed char [])\n" " bsr_diagonal< int,unsigned char >(int const,int const,int const,int const,int const [],int const [],unsigned char const [],unsigned char [])\n" @@ -8259,7 +8296,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_scale_rows'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'bsr_scale_rows'.\n" " Possible C/C++ prototypes are:\n" " bsr_scale_rows< int,signed char >(int const,int const,int const,int const,int const [],int const [],signed char [],signed char const [])\n" " bsr_scale_rows< int,unsigned char >(int const,int const,int const,int const,int const [],int const [],unsigned char [],unsigned char const [])\n" @@ -10755,7 +10792,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_scale_columns'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'bsr_scale_columns'.\n" " Possible C/C++ prototypes are:\n" " bsr_scale_columns< int,signed char >(int const,int const,int const,int const,int const [],int const [],signed char [],signed char const [])\n" " bsr_scale_columns< int,unsigned char >(int const,int const,int const,int const,int const [],int const [],unsigned char [],unsigned char const [])\n" @@ -13615,7 +13652,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_transpose'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'bsr_transpose'.\n" " Possible C/C++ prototypes are:\n" " bsr_transpose< int,signed char >(int const,int const,int const,int const,int const [],int const [],signed char const [],int [],int [],signed char [])\n" " bsr_transpose< int,unsigned char >(int const,int const,int const,int const,int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n" @@ -17903,7 +17940,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_matmat_pass2'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -20805,7 +20842,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_matvec'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -23917,7 +23954,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_matvecs'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'bsr_matvecs'.\n" " Possible C/C++ prototypes are:\n" " bsr_matvecs< int,signed char >(int const,int const,int const,int const,int const,int const [],int const [],signed char const [],signed char const [],signed char [])\n" " bsr_matvecs< int,unsigned char >(int const,int const,int const,int const,int const,int const [],int const [],unsigned char const [],unsigned char const [],unsigned char [])\n" @@ -27995,7 +28032,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_elmul_bsr'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -32073,7 +32110,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_eldiv_bsr'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -36151,7 +36188,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_plus_bsr'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -40229,7 +40266,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_minus_bsr'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -41871,7 +41908,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'bsr_sort_indices'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'bsr_sort_indices'.\n" " Possible C/C++ prototypes are:\n" " bsr_sort_indices< int,signed char >(int const,int const,int const,int const,int [],int [],signed char [])\n" " bsr_sort_indices< int,unsigned char >(int const,int const,int const,int const,int [],int [],unsigned char [])\n" @@ -42878,15 +42915,15 @@ } } if (ci) { - size_t shift = (ci->ptype) - types; - swig_type_info *ty = types_initial[shift]; - size_t ldoc = (c - methods[i].ml_doc); - size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; - char *ndoc = (char*)malloc(ldoc + lptr + 10); - if (ndoc) { - char *buff = ndoc; - void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; - if (ptr) { + void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; + if (ptr) { + size_t shift = (ci->ptype) - types; + swig_type_info *ty = types_initial[shift]; + size_t ldoc = (c - methods[i].ml_doc); + size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; + char *ndoc = (char*)malloc(ldoc + lptr + 10); + if (ndoc) { + char *buff = ndoc; strncpy(buff, methods[i].ml_doc, ldoc); buff += ldoc; strncpy(buff, "swig_ptr: ", 10); Modified: branches/0.9.x/scipy/sparse/sparsetools/coo.py =================================================================== --- branches/0.9.x/scipy/sparse/sparsetools/coo.py 2011-01-23 07:13:35 UTC (rev 7073) +++ branches/0.9.x/scipy/sparse/sparsetools/coo.py 2011-01-23 07:14:01 UTC (rev 7074) @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.40 +# Version 2.0.1+capsulehack # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. Modified: branches/0.9.x/scipy/sparse/sparsetools/coo_wrap.cxx =================================================================== --- branches/0.9.x/scipy/sparse/sparsetools/coo_wrap.cxx 2011-01-23 07:13:35 UTC (rev 7073) +++ branches/0.9.x/scipy/sparse/sparsetools/coo_wrap.cxx 2011-01-23 07:14:01 UTC (rev 7074) @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.40 + * Version 2.0.1+capsulehack * * 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 @@ -201,7 +201,7 @@ /* Flags/methods for returning states. - The SWIG conversion methods, as ConvertPtr, return and integer + The SWIG conversion methods, as ConvertPtr, return an integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). @@ -1088,9 +1088,6 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * pyrun.swg * * This file contains the runtime support for Python modules @@ -1137,8 +1134,18 @@ #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) -#define SWIG_fail goto fail +#define SWIG_fail goto fail +/* + * Python 2.7 and newer and Python 3.1 and newer should use Capsules API instead of + * CObjects API. + */ +#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \ + (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0)) +#define USE_CAPSULES +#define TYPE_POINTER_NAME \ + ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME) +#endif /* Runtime API implementation */ @@ -2071,10 +2078,13 @@ return SWIG_Python_str_FromChar("this"); } +static PyObject *swig_this = NULL; + SWIGRUNTIME PyObject * SWIG_This(void) { - static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This(); + if (swig_this == NULL) + swig_this = _SWIG_This(); return swig_this; } @@ -2178,7 +2188,7 @@ int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); if (newmemory == SWIG_CAST_NEW_MEMORY) { - assert(own); + assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ if (own) *own = *own | SWIG_CAST_NEW_MEMORY; } @@ -2448,8 +2458,12 @@ #ifdef SWIG_LINK_RUNTIME type_pointer = SWIG_ReturnGlobalTypeList((void *)0); #else +#ifdef USE_CAPSULES + type_pointer = PyCapsule_Import(TYPE_POINTER_NAME, 0); +#else type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); +#endif if (PyErr_Occurred()) { PyErr_Clear(); type_pointer = (void *)0; @@ -2494,9 +2508,14 @@ SWIGRUNTIME void SWIG_Python_DestroyModule(void *vptr) { + size_t i; +#ifdef USE_CAPSULES + swig_module_info *swig_module = + (swig_module_info *) PyCapsule_GetPointer((PyObject *)vptr, TYPE_POINTER_NAME); +#else swig_module_info *swig_module = (swig_module_info *) vptr; +#endif swig_type_info **types = swig_module->types; - size_t i; for (i =0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { @@ -2505,6 +2524,7 @@ } } Py_DECREF(SWIG_This()); + swig_this = NULL; } SWIGRUNTIME void @@ -2518,9 +2538,18 @@ PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); #endif +#ifdef USE_CAPSULES + PyObject *pointer = PyCapsule_New((void *)swig_module, TYPE_POINTER_NAME, + (PyCapsule_Destructor)SWIG_Python_DestroyModule); +#else PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); +#endif if (pointer && module) { +#ifdef USE_CAPSULES + PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer); +#else PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); +#endif } else { Py_XDECREF(pointer); } @@ -2541,12 +2570,20 @@ PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; if (obj) { +#ifdef USE_CAPSULES + descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, type); +#else descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); +#endif } else { swig_module_info *swig_module = SWIG_Python_GetModule(); descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { +#ifdef USE_CAPSULES + obj = PyCapsule_New(descriptor, type, NULL); +#else obj = PyCObject_FromVoidPtr(descriptor, NULL); +#endif PyDict_SetItem(cache, key, obj); Py_DECREF(obj); } @@ -2708,7 +2745,7 @@ #endif #define SWIG_name "_coo" -#define SWIGVERSION 0x010340 +#define SWIGVERSION 0x020001 #define SWIG_VERSION SWIGVERSION @@ -5927,7 +5964,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'coo_tocsr'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -8577,7 +8614,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'coo_tocsc'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -10863,7 +10900,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'coo_todense'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'coo_todense'.\n" " Possible C/C++ prototypes are:\n" " coo_todense< int,signed char >(int const,int const,int const,int const [],int const [],signed char const [],signed char [])\n" " coo_todense< int,unsigned char >(int const,int const,int const,int const [],int const [],unsigned char const [],unsigned char [])\n" @@ -13135,7 +13172,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'coo_matvec'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'coo_matvec'.\n" " Possible C/C++ prototypes are:\n" " coo_matvec< int,signed char >(int const,int const [],int const [],signed char const [],signed char const [],signed char [])\n" " coo_matvec< int,unsigned char >(int const,int const [],int const [],unsigned char const [],unsigned char const [],unsigned char [])\n" @@ -13883,15 +13920,15 @@ } } if (ci) { - size_t shift = (ci->ptype) - types; - swig_type_info *ty = types_initial[shift]; - size_t ldoc = (c - methods[i].ml_doc); - size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; - char *ndoc = (char*)malloc(ldoc + lptr + 10); - if (ndoc) { - char *buff = ndoc; - void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; - if (ptr) { + void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; + if (ptr) { + size_t shift = (ci->ptype) - types; + swig_type_info *ty = types_initial[shift]; + size_t ldoc = (c - methods[i].ml_doc); + size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; + char *ndoc = (char*)malloc(ldoc + lptr + 10); + if (ndoc) { + char *buff = ndoc; strncpy(buff, methods[i].ml_doc, ldoc); buff += ldoc; strncpy(buff, "swig_ptr: ", 10); Modified: branches/0.9.x/scipy/sparse/sparsetools/csc.py =================================================================== --- branches/0.9.x/scipy/sparse/sparsetools/csc.py 2011-01-23 07:13:35 UTC (rev 7073) +++ branches/0.9.x/scipy/sparse/sparsetools/csc.py 2011-01-23 07:14:01 UTC (rev 7074) @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.40 +# Version 2.0.1+capsulehack # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. Modified: branches/0.9.x/scipy/sparse/sparsetools/csc_wrap.cxx =================================================================== --- branches/0.9.x/scipy/sparse/sparsetools/csc_wrap.cxx 2011-01-23 07:13:35 UTC (rev 7073) +++ branches/0.9.x/scipy/sparse/sparsetools/csc_wrap.cxx 2011-01-23 07:14:01 UTC (rev 7074) @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.40 + * Version 2.0.1+capsulehack * * 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 @@ -201,7 +201,7 @@ /* Flags/methods for returning states. - The SWIG conversion methods, as ConvertPtr, return and integer + The SWIG conversion methods, as ConvertPtr, return an integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). @@ -1088,9 +1088,6 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * pyrun.swg * * This file contains the runtime support for Python modules @@ -1137,8 +1134,18 @@ #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) -#define SWIG_fail goto fail +#define SWIG_fail goto fail +/* + * Python 2.7 and newer and Python 3.1 and newer should use Capsules API instead of + * CObjects API. + */ +#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \ + (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0)) +#define USE_CAPSULES +#define TYPE_POINTER_NAME \ + ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME) +#endif /* Runtime API implementation */ @@ -2071,10 +2078,13 @@ return SWIG_Python_str_FromChar("this"); } +static PyObject *swig_this = NULL; + SWIGRUNTIME PyObject * SWIG_This(void) { - static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This(); + if (swig_this == NULL) + swig_this = _SWIG_This(); return swig_this; } @@ -2178,7 +2188,7 @@ int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); if (newmemory == SWIG_CAST_NEW_MEMORY) { - assert(own); + assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ if (own) *own = *own | SWIG_CAST_NEW_MEMORY; } @@ -2448,8 +2458,12 @@ #ifdef SWIG_LINK_RUNTIME type_pointer = SWIG_ReturnGlobalTypeList((void *)0); #else +#ifdef USE_CAPSULES + type_pointer = PyCapsule_Import(TYPE_POINTER_NAME, 0); +#else type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); +#endif if (PyErr_Occurred()) { PyErr_Clear(); type_pointer = (void *)0; @@ -2494,9 +2508,14 @@ SWIGRUNTIME void SWIG_Python_DestroyModule(void *vptr) { + size_t i; +#ifdef USE_CAPSULES + swig_module_info *swig_module = + (swig_module_info *) PyCapsule_GetPointer((PyObject *)vptr, TYPE_POINTER_NAME); +#else swig_module_info *swig_module = (swig_module_info *) vptr; +#endif swig_type_info **types = swig_module->types; - size_t i; for (i =0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { @@ -2505,6 +2524,7 @@ } } Py_DECREF(SWIG_This()); + swig_this = NULL; } SWIGRUNTIME void @@ -2518,9 +2538,18 @@ PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); #endif +#ifdef USE_CAPSULES + PyObject *pointer = PyCapsule_New((void *)swig_module, TYPE_POINTER_NAME, + (PyCapsule_Destructor)SWIG_Python_DestroyModule); +#else PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); +#endif if (pointer && module) { +#ifdef USE_CAPSULES + PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer); +#else PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); +#endif } else { Py_XDECREF(pointer); } @@ -2541,12 +2570,20 @@ PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; if (obj) { +#ifdef USE_CAPSULES + descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, type); +#else descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); +#endif } else { swig_module_info *swig_module = SWIG_Python_GetModule(); descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { +#ifdef USE_CAPSULES + obj = PyCapsule_New(descriptor, type, NULL); +#else obj = PyCObject_FromVoidPtr(descriptor, NULL); +#endif PyDict_SetItem(cache, key, obj); Py_DECREF(obj); } @@ -2708,7 +2745,7 @@ #endif #define SWIG_name "_csc" -#define SWIGVERSION 0x010340 +#define SWIGVERSION 0x020001 #define SWIG_VERSION SWIGVERSION @@ -5477,7 +5514,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_diagonal'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -7917,7 +7954,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_tocsr'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -11575,7 +11612,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_matmat_pass2'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -14057,7 +14094,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_matvec'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -16749,7 +16786,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_matvecs'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'csc_matvecs'.\n" " Possible C/C++ prototypes are:\n" " csc_matvecs< int,signed char >(int const,int const,int const,int const [],int const [],signed char const [],signed char const [],signed char [])\n" " csc_matvecs< int,unsigned char >(int const,int const,int const,int const [],int const [],unsigned char const [],unsigned char const [],unsigned char [])\n" @@ -20407,7 +20444,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_elmul_csc'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -24065,7 +24102,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_eldiv_csc'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -27723,7 +27760,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_plus_csc'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -31381,7 +31418,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csc_minus_csc'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -32266,15 +32303,15 @@ } } if (ci) { - size_t shift = (ci->ptype) - types; - swig_type_info *ty = types_initial[shift]; - size_t ldoc = (c - methods[i].ml_doc); - size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; - char *ndoc = (char*)malloc(ldoc + lptr + 10); - if (ndoc) { - char *buff = ndoc; - void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; - if (ptr) { + void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; + if (ptr) { + size_t shift = (ci->ptype) - types; + swig_type_info *ty = types_initial[shift]; + size_t ldoc = (c - methods[i].ml_doc); + size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; + char *ndoc = (char*)malloc(ldoc + lptr + 10); + if (ndoc) { + char *buff = ndoc; strncpy(buff, methods[i].ml_doc, ldoc); buff += ldoc; strncpy(buff, "swig_ptr: ", 10); Modified: branches/0.9.x/scipy/sparse/sparsetools/csgraph.py =================================================================== --- branches/0.9.x/scipy/sparse/sparsetools/csgraph.py 2011-01-23 07:13:35 UTC (rev 7073) +++ branches/0.9.x/scipy/sparse/sparsetools/csgraph.py 2011-01-23 07:14:01 UTC (rev 7074) @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.40 +# Version 2.0.1+capsulehack # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. Modified: branches/0.9.x/scipy/sparse/sparsetools/csgraph_wrap.cxx =================================================================== --- branches/0.9.x/scipy/sparse/sparsetools/csgraph_wrap.cxx 2011-01-23 07:13:35 UTC (rev 7073) +++ branches/0.9.x/scipy/sparse/sparsetools/csgraph_wrap.cxx 2011-01-23 07:14:01 UTC (rev 7074) @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.40 + * Version 2.0.1+capsulehack * * 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 @@ -201,7 +201,7 @@ /* Flags/methods for returning states. - The SWIG conversion methods, as ConvertPtr, return and integer + The SWIG conversion methods, as ConvertPtr, return an integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). @@ -1088,9 +1088,6 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * pyrun.swg * * This file contains the runtime support for Python modules @@ -1137,8 +1134,18 @@ #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) -#define SWIG_fail goto fail +#define SWIG_fail goto fail +/* + * Python 2.7 and newer and Python 3.1 and newer should use Capsules API instead of + * CObjects API. + */ +#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \ + (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0)) +#define USE_CAPSULES +#define TYPE_POINTER_NAME \ + ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME) +#endif /* Runtime API implementation */ @@ -2071,10 +2078,13 @@ return SWIG_Python_str_FromChar("this"); } +static PyObject *swig_this = NULL; + SWIGRUNTIME PyObject * SWIG_This(void) { - static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This(); + if (swig_this == NULL) + swig_this = _SWIG_This(); return swig_this; } @@ -2178,7 +2188,7 @@ int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); if (newmemory == SWIG_CAST_NEW_MEMORY) { - assert(own); + assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ if (own) *own = *own | SWIG_CAST_NEW_MEMORY; } @@ -2448,8 +2458,12 @@ #ifdef SWIG_LINK_RUNTIME type_pointer = SWIG_ReturnGlobalTypeList((void *)0); #else +#ifdef USE_CAPSULES + type_pointer = PyCapsule_Import(TYPE_POINTER_NAME, 0); +#else type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); +#endif if (PyErr_Occurred()) { PyErr_Clear(); type_pointer = (void *)0; @@ -2494,9 +2508,14 @@ SWIGRUNTIME void SWIG_Python_DestroyModule(void *vptr) { + size_t i; +#ifdef USE_CAPSULES + swig_module_info *swig_module = + (swig_module_info *) PyCapsule_GetPointer((PyObject *)vptr, TYPE_POINTER_NAME); +#else swig_module_info *swig_module = (swig_module_info *) vptr; +#endif swig_type_info **types = swig_module->types; - size_t i; for (i =0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { @@ -2505,6 +2524,7 @@ } } Py_DECREF(SWIG_This()); + swig_this = NULL; } SWIGRUNTIME void @@ -2518,9 +2538,18 @@ PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); #endif +#ifdef USE_CAPSULES + PyObject *pointer = PyCapsule_New((void *)swig_module, TYPE_POINTER_NAME, + (PyCapsule_Destructor)SWIG_Python_DestroyModule); +#else PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); +#endif if (pointer && module) { +#ifdef USE_CAPSULES + PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer); +#else PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); +#endif } else { Py_XDECREF(pointer); } @@ -2541,12 +2570,20 @@ PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; if (obj) { +#ifdef USE_CAPSULES + descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, type); +#else descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); +#endif } else { swig_module_info *swig_module = SWIG_Python_GetModule(); descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { +#ifdef USE_CAPSULES + obj = PyCapsule_New(descriptor, type, NULL); +#else obj = PyCObject_FromVoidPtr(descriptor, NULL); +#endif PyDict_SetItem(cache, key, obj); Py_DECREF(obj); } @@ -2708,7 +2745,7 @@ #endif #define SWIG_name "_csgraph" -#define SWIGVERSION 0x010340 +#define SWIGVERSION 0x020001 #define SWIG_VERSION SWIGVERSION @@ -3920,15 +3957,15 @@ } } if (ci) { - size_t shift = (ci->ptype) - types; - swig_type_info *ty = types_initial[shift]; - size_t ldoc = (c - methods[i].ml_doc); - size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; - char *ndoc = (char*)malloc(ldoc + lptr + 10); - if (ndoc) { - char *buff = ndoc; - void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; - if (ptr) { + void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; + if (ptr) { + size_t shift = (ci->ptype) - types; + swig_type_info *ty = types_initial[shift]; + size_t ldoc = (c - methods[i].ml_doc); + size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; + char *ndoc = (char*)malloc(ldoc + lptr + 10); + if (ndoc) { + char *buff = ndoc; strncpy(buff, methods[i].ml_doc, ldoc); buff += ldoc; strncpy(buff, "swig_ptr: ", 10); Modified: branches/0.9.x/scipy/sparse/sparsetools/csr.py =================================================================== --- branches/0.9.x/scipy/sparse/sparsetools/csr.py 2011-01-23 07:13:35 UTC (rev 7073) +++ branches/0.9.x/scipy/sparse/sparsetools/csr.py 2011-01-23 07:14:01 UTC (rev 7074) @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.40 +# Version 2.0.1+capsulehack # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. Modified: branches/0.9.x/scipy/sparse/sparsetools/csr_wrap.cxx =================================================================== --- branches/0.9.x/scipy/sparse/sparsetools/csr_wrap.cxx 2011-01-23 07:13:35 UTC (rev 7073) +++ branches/0.9.x/scipy/sparse/sparsetools/csr_wrap.cxx 2011-01-23 07:14:01 UTC (rev 7074) @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.40 + * Version 2.0.1+capsulehack * * 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 @@ -201,7 +201,7 @@ /* Flags/methods for returning states. - The SWIG conversion methods, as ConvertPtr, return and integer + The SWIG conversion methods, as ConvertPtr, return an integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). @@ -1088,9 +1088,6 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * pyrun.swg * * This file contains the runtime support for Python modules @@ -1137,8 +1134,18 @@ #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) -#define SWIG_fail goto fail +#define SWIG_fail goto fail +/* + * Python 2.7 and newer and Python 3.1 and newer should use Capsules API instead of + * CObjects API. + */ +#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \ + (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0)) +#define USE_CAPSULES +#define TYPE_POINTER_NAME \ + ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME) +#endif /* Runtime API implementation */ @@ -2071,10 +2078,13 @@ return SWIG_Python_str_FromChar("this"); } +static PyObject *swig_this = NULL; + SWIGRUNTIME PyObject * SWIG_This(void) { - static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This(); + if (swig_this == NULL) + swig_this = _SWIG_This(); return swig_this; } @@ -2178,7 +2188,7 @@ int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); if (newmemory == SWIG_CAST_NEW_MEMORY) { - assert(own); + assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ if (own) *own = *own | SWIG_CAST_NEW_MEMORY; } @@ -2448,8 +2458,12 @@ #ifdef SWIG_LINK_RUNTIME type_pointer = SWIG_ReturnGlobalTypeList((void *)0); #else +#ifdef USE_CAPSULES + type_pointer = PyCapsule_Import(TYPE_POINTER_NAME, 0); +#else type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); +#endif if (PyErr_Occurred()) { PyErr_Clear(); type_pointer = (void *)0; @@ -2494,9 +2508,14 @@ SWIGRUNTIME void SWIG_Python_DestroyModule(void *vptr) { + size_t i; +#ifdef USE_CAPSULES + swig_module_info *swig_module = + (swig_module_info *) PyCapsule_GetPointer((PyObject *)vptr, TYPE_POINTER_NAME); +#else swig_module_info *swig_module = (swig_module_info *) vptr; +#endif swig_type_info **types = swig_module->types; - size_t i; for (i =0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { @@ -2505,6 +2524,7 @@ } } Py_DECREF(SWIG_This()); + swig_this = NULL; } SWIGRUNTIME void @@ -2518,9 +2538,18 @@ PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); #endif +#ifdef USE_CAPSULES + PyObject *pointer = PyCapsule_New((void *)swig_module, TYPE_POINTER_NAME, + (PyCapsule_Destructor)SWIG_Python_DestroyModule); +#else PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); +#endif if (pointer && module) { +#ifdef USE_CAPSULES + PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer); +#else PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); +#endif } else { Py_XDECREF(pointer); } @@ -2541,12 +2570,20 @@ PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; if (obj) { +#ifdef USE_CAPSULES + descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, type); +#else descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); +#endif } else { swig_module_info *swig_module = SWIG_Python_GetModule(); descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { +#ifdef USE_CAPSULES + obj = PyCapsule_New(descriptor, type, NULL); +#else obj = PyCObject_FromVoidPtr(descriptor, NULL); +#endif PyDict_SetItem(cache, key, obj); Py_DECREF(obj); } @@ -2722,7 +2759,7 @@ #endif #define SWIG_name "_csr" -#define SWIGVERSION 0x010340 +#define SWIGVERSION 0x020001 #define SWIG_VERSION SWIGVERSION @@ -5728,7 +5765,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_diagonal'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -7804,7 +7841,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_scale_rows'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'csr_scale_rows'.\n" " Possible C/C++ prototypes are:\n" " csr_scale_rows< int,signed char >(int const,int const,int const [],int const [],signed char [],signed char const [])\n" " csr_scale_rows< int,unsigned char >(int const,int const,int const [],int const [],unsigned char [],unsigned char const [])\n" @@ -9880,7 +9917,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_scale_columns'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'csr_scale_columns'.\n" " Possible C/C++ prototypes are:\n" " csr_scale_columns< int,signed char >(int const,int const,int const [],int const [],signed char [],signed char const [])\n" " csr_scale_columns< int,unsigned char >(int const,int const,int const [],int const [],unsigned char [],unsigned char const [])\n" @@ -12320,7 +12357,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_tocsc'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -15180,7 +15217,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_tobsr'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'csr_tobsr'.\n" " Possible C/C++ prototypes are:\n" " csr_tobsr< int,signed char >(int const,int const,int const,int const,int const [],int const [],signed char const [],int [],int [],signed char [])\n" " csr_tobsr< int,unsigned char >(int const,int const,int const,int const,int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n" @@ -18838,7 +18875,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_matmat_pass2'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -21320,7 +21357,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_matvec'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -24012,7 +24049,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_matvecs'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'csr_matvecs'.\n" " Possible C/C++ prototypes are:\n" " csr_matvecs< int,signed char >(int const,int const,int const,int const [],int const [],signed char const [],signed char const [],signed char [])\n" " csr_matvecs< int,unsigned char >(int const,int const,int const,int const [],int const [],unsigned char const [],unsigned char const [],unsigned char [])\n" @@ -27670,7 +27707,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_elmul_csr'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -31328,7 +31365,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_eldiv_csr'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -34986,7 +35023,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_plus_csr'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -38644,7 +38681,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_minus_csr'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -39880,7 +39917,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_sort_indices'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -41102,7 +41139,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_eliminate_zeros'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'csr_eliminate_zeros'.\n" " Possible C/C++ prototypes are:\n" " csr_eliminate_zeros< int,signed char >(int const,int const,int [],int [],signed char [])\n" " csr_eliminate_zeros< int,unsigned char >(int const,int const,int [],int [],unsigned char [])\n" @@ -42324,7 +42361,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_sum_duplicates'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type 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" @@ -45604,7 +45641,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'get_csr_submatrix'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'get_csr_submatrix'.\n" " Possible C/C++ prototypes are:\n" " get_csr_submatrix< int,signed char >(int const,int const,int const [],int const [],signed char const [],int const,int const,int const,int const,std::vector< int > *,std::vector< int > *,std::vector< signed char > *)\n" " get_csr_submatrix< int,unsigned char >(int const,int const,int const [],int const [],unsigned char const [],int const,int const,int const,int const,std::vector< int > *,std::vector< int > *,std::vector< unsigned char > *)\n" @@ -48702,7 +48739,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'csr_sample_values'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'csr_sample_values'.\n" " Possible C/C++ prototypes are:\n" " csr_sample_values< int,signed char >(int const,int const,int const [],int const [],signed char const [],int const,int const [],int const [],signed char [])\n" " csr_sample_values< int,unsigned char >(int const,int const,int const [],int const [],unsigned char const [],int const,int const [],int const [],unsigned char [])\n" @@ -49838,15 +49875,15 @@ } } if (ci) { - size_t shift = (ci->ptype) - types; - swig_type_info *ty = types_initial[shift]; - size_t ldoc = (c - methods[i].ml_doc); - size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; - char *ndoc = (char*)malloc(ldoc + lptr + 10); - if (ndoc) { - char *buff = ndoc; - void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; - if (ptr) { + void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; + if (ptr) { + size_t shift = (ci->ptype) - types; + swig_type_info *ty = types_initial[shift]; + size_t ldoc = (c - methods[i].ml_doc); + size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; + char *ndoc = (char*)malloc(ldoc + lptr + 10); + if (ndoc) { + char *buff = ndoc; strncpy(buff, methods[i].ml_doc, ldoc); buff += ldoc; strncpy(buff, "swig_ptr: ", 10); Modified: branches/0.9.x/scipy/sparse/sparsetools/dia.py =================================================================== --- branches/0.9.x/scipy/sparse/sparsetools/dia.py 2011-01-23 07:13:35 UTC (rev 7073) +++ branches/0.9.x/scipy/sparse/sparsetools/dia.py 2011-01-23 07:14:01 UTC (rev 7074) @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.40 +# Version 2.0.1+capsulehack # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. Modified: branches/0.9.x/scipy/sparse/sparsetools/dia_wrap.cxx =================================================================== --- branches/0.9.x/scipy/sparse/sparsetools/dia_wrap.cxx 2011-01-23 07:13:35 UTC (rev 7073) +++ branches/0.9.x/scipy/sparse/sparsetools/dia_wrap.cxx 2011-01-23 07:14:01 UTC (rev 7074) @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.40 + * Version 2.0.1+capsulehack * * 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 @@ -201,7 +201,7 @@ /* Flags/methods for returning states. - The SWIG conversion methods, as ConvertPtr, return and integer + The SWIG conversion methods, as ConvertPtr, return an integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). @@ -1088,9 +1088,6 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * pyrun.swg * * This file contains the runtime support for Python modules @@ -1137,8 +1134,18 @@ #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) -#define SWIG_fail goto fail +#define SWIG_fail goto fail +/* + * Python 2.7 and newer and Python 3.1 and newer should use Capsules API instead of + * CObjects API. + */ +#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \ + (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0)) +#define USE_CAPSULES +#define TYPE_POINTER_NAME \ + ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME) +#endif /* Runtime API implementation */ @@ -2071,10 +2078,13 @@ return SWIG_Python_str_FromChar("this"); } +static PyObject *swig_this = NULL; + SWIGRUNTIME PyObject * SWIG_This(void) { - static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This(); + if (swig_this == NULL) + swig_this = _SWIG_This(); return swig_this; } @@ -2178,7 +2188,7 @@ int newmemory = 0; *ptr = SWIG_TypeCast(tc,vptr,&newmemory); if (newmemory == SWIG_CAST_NEW_MEMORY) { - assert(own); + assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ if (own) *own = *own | SWIG_CAST_NEW_MEMORY; } @@ -2448,8 +2458,12 @@ #ifdef SWIG_LINK_RUNTIME type_pointer = SWIG_ReturnGlobalTypeList((void *)0); #else +#ifdef USE_CAPSULES + type_pointer = PyCapsule_Import(TYPE_POINTER_NAME, 0); +#else type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); +#endif if (PyErr_Occurred()) { PyErr_Clear(); type_pointer = (void *)0; @@ -2494,9 +2508,14 @@ SWIGRUNTIME void SWIG_Python_DestroyModule(void *vptr) { + size_t i; +#ifdef USE_CAPSULES + swig_module_info *swig_module = + (swig_module_info *) PyCapsule_GetPointer((PyObject *)vptr, TYPE_POINTER_NAME); +#else swig_module_info *swig_module = (swig_module_info *) vptr; +#endif swig_type_info **types = swig_module->types; - size_t i; for (i =0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { @@ -2505,6 +2524,7 @@ } } Py_DECREF(SWIG_This()); + swig_this = NULL; } SWIGRUNTIME void @@ -2518,9 +2538,18 @@ PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); #endif +#ifdef USE_CAPSULES + PyObject *pointer = PyCapsule_New((void *)swig_module, TYPE_POINTER_NAME, + (PyCapsule_Destructor)SWIG_Python_DestroyModule); +#else PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); +#endif if (pointer && module) { +#ifdef USE_CAPSULES + PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer); +#else PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); +#endif } else { Py_XDECREF(pointer); } @@ -2541,12 +2570,20 @@ PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; if (obj) { +#ifdef USE_CAPSULES + descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, type); +#else descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); +#endif } else { swig_module_info *swig_module = SWIG_Python_GetModule(); descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { +#ifdef USE_CAPSULES + obj = PyCapsule_New(descriptor, type, NULL); +#else obj = PyCObject_FromVoidPtr(descriptor, NULL); +#endif PyDict_SetItem(cache, key, obj); Py_DECREF(obj); } @@ -2708,7 +2745,7 @@ #endif #define SWIG_name "_dia" -#define SWIGVERSION 0x010340 +#define SWIGVERSION 0x020001 #define SWIG_VERSION SWIGVERSION @@ -5749,7 +5786,7 @@ } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'dia_matvec'.\n" + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'dia_matvec'.\n" " Possible C/C++ prototypes are:\n" " dia_matvec< int,signed char >(int const,int const,int const,int const,int const [],signed char const [],signed char const [],signed char [])\n" " dia_matvec< int,unsigned char >(int const,int const,int const,int const,int const [],unsigned char const [],unsigned char const [],unsigned char [])\n" @@ -6345,15 +6382,15 @@ } } if (ci) { - size_t shift = (ci->ptype) - types; - swig_type_info *ty = types_initial[shift]; - size_t ldoc = (c - methods[i].ml_doc); - size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; - char *ndoc = (char*)malloc(ldoc + lptr + 10); - if (ndoc) { - char *buff = ndoc; - void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; - if (ptr) { + void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; + if (ptr) { + size_t shift = (ci->ptype) - types; + swig_type_info *ty = types_initial[shift]; + size_t ldoc = (c - methods[i].ml_doc); + size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; + char *ndoc = (char*)malloc(ldoc + lptr + 10); + if (ndoc) { + char *buff = ndoc; strncpy(buff, methods[i].ml_doc, ldoc); buff += ldoc; strncpy(buff, "swig_ptr: ", 10); From scipy-svn at scipy.org Sun Jan 23 02:18:08 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 23 Jan 2011 01:18:08 -0600 (CST) Subject: [Scipy-svn] r7075 - in trunk: doc/release scipy/signal scipy/signal/tests Message-ID: <20110123071808.2330337BA54@scipy.org> Author: rgommers Date: 2011-01-23 01:18:07 -0600 (Sun, 23 Jan 2011) New Revision: 7075 Modified: trunk/doc/release/0.9.0-notes.rst trunk/scipy/signal/signaltools.py trunk/scipy/signal/sigtoolsmodule.c trunk/scipy/signal/tests/test_signaltools.py Log: DEP: Remove old behavior of correlate/convolve. Modified: trunk/doc/release/0.9.0-notes.rst =================================================================== --- trunk/doc/release/0.9.0-notes.rst 2011-01-23 07:14:01 UTC (rev 7074) +++ trunk/doc/release/0.9.0-notes.rst 2011-01-23 07:18:07 UTC (rev 7075) @@ -105,6 +105,16 @@ were added. +Improved statistical tests (``scipy.stats``) +-------------------------------------------- + +A new function ``scipy.stats.fisher_exact`` was added, that provides Fisher's +exact test for 2x2 contingency tables. + +The function ``scipy.stats.kendalltau`` was rewritten to make it much faster +(O(n log(n)) vs O(n^2)). + + Deprecated features =================== @@ -122,16 +132,6 @@ - ``vackar`` (renamed to ``diagbroyden``) -Improved statistical tests (``scipy.stats``) --------------------------------------------- - -A new function ``scipy.stats.fisher_exact`` was added, that provides Fisher's -exact test for 2x2 contingency tables. - -The function ``scipy.stats.kendalltau`` was rewritten to make it much faster -(O(n log(n)) vs O(n^2)). - - Removed features ================ @@ -145,6 +145,18 @@ functionality is still available by specifying ``mode='economic'``. +Old correlate/convolve behavior (in ``scipy.signal``) +----------------------------------------------------- + +The old behavior for ``scipy.signal.convolve``, ``scipy.signal.convolve2d``, +``scipy.signal.correlate`` and ``scipy.signal.correlate2d`` was deprecated in +0.8.0 and has now been removed. Convolve and correlate used to swap their +arguments if the second argument has dimensions larger than the first one, and +the mode was relative to the input with the largest dimension. The current +behavior is to never swap the inputs, which is what most people expect, and is +how correlation is usually defined. + + ``scipy.stats`` --------------- Modified: trunk/scipy/signal/signaltools.py =================================================================== --- trunk/scipy/signal/signaltools.py 2011-01-23 07:14:01 UTC (rev 7074) +++ trunk/scipy/signal/signaltools.py 2011-01-23 07:18:07 UTC (rev 7075) @@ -22,18 +22,6 @@ _boundarydict = {'fill':0, 'pad':0, 'wrap':2, 'circular':2, 'symm':1, 'symmetric':1, 'reflect':4} -_SWAP_INPUTS_DEPRECATION_MSG = """\ -Current default behavior of convolve and correlate functions is deprecated. - -Convolve and corelate currently swap their arguments if the second argument -has dimensions larger than the first one, and the mode is relative to the input -with the largest dimension. The new behavior is to never swap the inputs, which -is what most people expects, and is how correlation is usually defined. - -You can control the behavior with the old_behavior flag - the flag will -disappear in scipy 0.9.0, and the functions will then implement the new -behavior only.""" - def _valfrommode(mode): try: val = _modedict[mode] @@ -55,7 +43,7 @@ return val -def correlate(in1, in2, mode='full', old_behavior=True): +def correlate(in1, in2, mode='full'): """ Cross-correlate two N-dimensional arrays. @@ -76,12 +64,6 @@ with respect to the 'full' output. - 'full': the output is the full discrete linear cross-correlation of the inputs. (Default) - old_behavior: bool - If True (default), the old behavior of correlate is implemented: - - if in1.size < in2.size, in1 and in2 are swapped (correlate(in1, - in2) == correlate(in2, in1)) - - For complex inputs, the conjugate is not taken for in2 - If False, the new, conventional definition of correlate is implemented. Returns ------- @@ -99,15 +81,6 @@ """ val = _valfrommode(mode) - if old_behavior: - warnings.warn(DeprecationWarning(_SWAP_INPUTS_DEPRECATION_MSG)) - if np.iscomplexobj(in2): - in2 = in2.conjugate() - if in1.size < in2.size: - swp = in2 - in2 = in1 - in1 = swp - if mode == 'valid': ps = [i - j + 1 for i, j in zip(in1.shape, in2.shape)] out = np.empty(ps, in1.dtype) @@ -177,7 +150,7 @@ return _centered(ret,abs(s2-s1)+1) -def convolve(in1, in2, mode='full', old_behavior=True): +def convolve(in1, in2, mode='full'): """ Convolve two N-dimensional arrays. @@ -219,26 +192,16 @@ slice_obj = [slice(None,None,-1)]*len(kernel.shape) - if old_behavior: - warnings.warn(DeprecationWarning(_SWAP_INPUTS_DEPRECATION_MSG)) - if (product(kernel.shape,axis=0) > product(volume.shape,axis=0)): - temp = kernel - kernel = volume - volume = temp - del temp - - return correlate(volume, kernel[slice_obj], mode, old_behavior=True) + if mode == 'valid': + for d1, d2 in zip(volume.shape, kernel.shape): + if not d1 >= d2: + raise ValueError( + "in1 should have at least as many items as in2 in " \ + "every dimension for valid mode.") + if np.iscomplexobj(kernel): + return correlate(volume, kernel[slice_obj].conj(), mode) else: - if mode == 'valid': - for d1, d2 in zip(volume.shape, kernel.shape): - if not d1 >= d2: - raise ValueError( - "in1 should have at least as many items as in2 in " \ - "every dimension for valid mode.") - if np.iscomplexobj(kernel): - return correlate(volume, kernel[slice_obj].conj(), mode, old_behavior=False) - else: - return correlate(volume, kernel[slice_obj], mode, old_behavior=False) + return correlate(volume, kernel[slice_obj], mode) def order_filter(a, domain, rank): """ @@ -376,10 +339,10 @@ mysize = asarray(mysize); # Estimate the local mean - lMean = correlate(im,ones(mysize), 'same', old_behavior=False) / product(mysize,axis=0) + lMean = correlate(im,ones(mysize), 'same') / product(mysize,axis=0) # Estimate the local variance - lVar = correlate(im**2,ones(mysize), 'same', old_behavior=False) / product(mysize,axis=0) - lMean**2 + lVar = correlate(im**2,ones(mysize), 'same') / product(mysize,axis=0) - lMean**2 # Estimate the noise power if needed. if noise==None: @@ -393,7 +356,7 @@ return out -def convolve2d(in1, in2, mode='full', boundary='fill', fillvalue=0, old_behavior=True): +def convolve2d(in1, in2, mode='full', boundary='fill', fillvalue=0): """Convolve two 2-dimensional arrays. Convolve `in1` and `in2` with output size determined by mode and boundary @@ -432,30 +395,19 @@ convolution of `in1` with `in2`. """ - if old_behavior: - warnings.warn(DeprecationWarning(_SWAP_INPUTS_DEPRECATION_MSG)) + if mode == 'valid': + for d1, d2 in zip(np.shape(in1), np.shape(in2)): + if not d1 >= d2: + raise ValueError( + "in1 should have at least as many items as in2 in " \ + "every dimension for valid mode.") - if old_behavior: - warnings.warn(DeprecationWarning(_SWAP_INPUTS_DEPRECATION_MSG)) - if (product(np.shape(in2),axis=0) > product(np.shape(in1),axis=0)): - temp = in1 - in1 = in2 - in2 = temp - del temp - else: - if mode == 'valid': - for d1, d2 in zip(np.shape(in1), np.shape(in2)): - if not d1 >= d2: - raise ValueError( - "in1 should have at least as many items as in2 in " \ - "every dimension for valid mode.") - val = _valfrommode(mode) bval = _bvalfromboundary(boundary) return sigtools._convolve2d(in1,in2,1,val,bval,fillvalue) -def correlate2d(in1, in2, mode='full', boundary='fill', fillvalue=0, old_behavior=True): +def correlate2d(in1, in2, mode='full', boundary='fill', fillvalue=0): """Cross-correlate two 2-dimensional arrays. Cross correlate in1 and in2 with output size determined by mode and @@ -494,8 +446,6 @@ cross-correlation of `in1` with `in2`. """ - if old_behavior: - warnings.warn(DeprecationWarning(_SWAP_INPUTS_DEPRECATION_MSG)) val = _valfrommode(mode) bval = _bvalfromboundary(boundary) Modified: trunk/scipy/signal/sigtoolsmodule.c =================================================================== --- trunk/scipy/signal/sigtoolsmodule.c 2011-01-23 07:14:01 UTC (rev 7074) +++ trunk/scipy/signal/sigtoolsmodule.c 2011-01-23 07:18:07 UTC (rev 7075) @@ -1045,8 +1045,6 @@ n1 = PyArray_Size((PyObject *)ain1); n2 = PyArray_Size((PyObject *)ain2); - /* Swap if first argument is not the largest */ - if (n1 < n2) { aout = ain1; ain1 = ain2; ain2 = aout; aout = NULL; } aout_dimens = malloc(ain1->nd*sizeof(intp)); switch(mode & OUTSIZE_MASK) { case VALID: Modified: trunk/scipy/signal/tests/test_signaltools.py =================================================================== --- trunk/scipy/signal/tests/test_signaltools.py 2011-01-23 07:14:01 UTC (rev 7074) +++ trunk/scipy/signal/tests/test_signaltools.py 2011-01-23 07:18:07 UTC (rev 7075) @@ -17,25 +17,25 @@ def test_basic(self): a = [3,4,5,6,5,4] b = [1,2,3] - c = convolve(a,b, old_behavior=self.old_behavior) + c = convolve(a,b) assert_array_equal(c,array([3,10,22,28,32,32,23,12])) def test_complex(self): x = array([1+1j, 2+1j, 3+1j]) y = array([1+1j, 2+1j]) - z = convolve(x, y,old_behavior=self.old_behavior) + z = convolve(x, y) assert_array_equal(z, array([2j, 2+6j, 5+8j, 5+5j])) def test_zero_order(self): a = 1289 b = 4567 - c = convolve(a,b,old_behavior=self.old_behavior) + c = convolve(a,b) assert_array_equal(c,a*b) def test_2d_arrays(self): a = [[1,2,3],[3,4,5]] b = [[2,3,4],[4,5,6]] - c = convolve(a,b,old_behavior=self.old_behavior) + c = convolve(a,b) d = array( [[2 ,7 ,16,17,12],\ [10,30,62,58,38],\ [12,31,58,49,30]]) @@ -44,57 +44,24 @@ def test_valid_mode(self): a = [1,2,3,6,5,3] b = [2,3,4,5,3,4,2,2,1] - c = convolve(a,b,'valid',old_behavior=self.old_behavior) + c = convolve(a,b,'valid') assert_array_equal(c,array([70,78,73,65])) -class OldTestConvolve(_TestConvolve): - old_behavior = True - @dec.deprecated() - def test_basic(self): - _TestConvolve.test_basic(self) - @dec.deprecated() - def test_complex(self): - _TestConvolve.test_complex(self) - - @dec.deprecated() - def test_2d_arrays(self): - _TestConvolve.test_2d_arrays(self) - - @dec.deprecated() - def test_same_mode(self): - _TestConvolve.test_same_mode(self) - - @dec.deprecated() - def test_valid_mode(self): - a = [1,2,3,6,5,3] - b = [2,3,4,5,3,4,2,2,1] - c = convolve(a,b,'valid',old_behavior=self.old_behavior) - assert_array_equal(c,array([70,78,73,65])) - - @dec.deprecated() - def test_same_mode(self): - a = [1,2,3,3,1,2] - b = [1,4,3,4,5,6,7,4,3,2,1,1,3] - c = convolve(a,b,'same',old_behavior=self.old_behavior) - d = array([14,25,35,43,57,61,63,57,45,36,25,20,17]) - assert_array_equal(c,d) - class TestConvolve(_TestConvolve): - old_behavior = False def test_valid_mode(self): # 'valid' mode if b.size > a.size does not make sense with the new # behavior a = [1,2,3,6,5,3] b = [2,3,4,5,3,4,2,2,1] def _test(): - convolve(a,b,'valid',old_behavior=self.old_behavior) + convolve(a,b,'valid') self.assertRaises(ValueError, _test) def test_same_mode(self): a = [1,2,3,3,1,2] b = [1,4,3,4,5,6,7,4,3,2,1,1,3] - c = convolve(a,b,'same',old_behavior=self.old_behavior) + c = convolve(a,b,'same') d = array([57,61,63,57,45,36]) assert_array_equal(c,d) @@ -105,13 +72,13 @@ d = array( [[2 ,7 ,16,17,12],\ [10,30,62,58,38],\ [12,31,58,49,30]]) - e = convolve2d(a,b,old_behavior=self.old_behavior) + e = convolve2d(a,b) assert_array_equal(e,d) def test_valid_mode(self): e = [[2,3,4,5,6,7,8],[4,5,6,7,8,9,10]] f = [[1,2,3],[3,4,5]] - g = convolve2d(e,f,'valid',old_behavior=self.old_behavior) + g = convolve2d(e,f,'valid') h = array([[62,80,98,116,134]]) assert_array_equal(g,h) @@ -119,7 +86,7 @@ a = [[1,2,3],[3,4,5]] b = [[2,3,4],[4,5,6]] fillval = 1 - c = convolve2d(a,b,'full','fill',fillval,old_behavior=self.old_behavior) + c = convolve2d(a,b,'full','fill',fillval) d = array([[24,26,31,34,32],\ [28,40,62,64,52],\ [32,46,67,62,48]]) @@ -128,7 +95,7 @@ def test_wrap_boundary(self): a = [[1,2,3],[3,4,5]] b = [[2,3,4],[4,5,6]] - c = convolve2d(a,b,'full','wrap',old_behavior=self.old_behavior) + c = convolve2d(a,b,'full','wrap') d = array([[80,80,74,80,80],\ [68,68,62,68,68],\ [80,80,74,80,80]]) @@ -137,60 +104,18 @@ def test_sym_boundary(self): a = [[1,2,3],[3,4,5]] b = [[2,3,4],[4,5,6]] - c = convolve2d(a,b,'full','symm',old_behavior=self.old_behavior) + c = convolve2d(a,b,'full','symm') d = array([[34,30,44, 62, 66],\ [52,48,62, 80, 84],\ [82,78,92,110,114]]) assert_array_equal(c,d) -class OldTestConvolve2d(_TestConvolve2d): - old_behavior = True - @dec.deprecated() - def test_2d_arrays(self): - _TestConvolve2d.test_2d_arrays(self) - - @dec.deprecated() - def test_same_mode(self): - e = [[1,2,3],[3,4,5]] - f = [[2,3,4,5,6,7,8],[4,5,6,7,8,9,10]] - g = convolve2d(e,f,'same',old_behavior=self.old_behavior) - h = array([[ 7,16,22,28, 34, 40, 37],\ - [30,62,80,98,116,134,114]]) - assert_array_equal(g,h) - - @dec.deprecated() - def test_valid_mode(self): - _TestConvolve2d.test_valid_mode(self) - - @dec.deprecated() - def test_fillvalue(self): - _TestConvolve2d.test_fillvalue(self) - - @dec.deprecated() - def test_wrap_boundary(self): - _TestConvolve2d.test_wrap_boundary(self) - - @dec.deprecated() - def test_sym_boundary(self): - _TestConvolve2d.test_sym_boundary(self) - - @dec.deprecated() - def test_valid_mode2(self): - # Test when in2.size > in1.size: old behavior is to do so that - # convolve2d(in2, in1) == convolve2d(in1, in2) - e = [[1,2,3],[3,4,5]] - f = [[2,3,4,5,6,7,8],[4,5,6,7,8,9,10]] - g = convolve2d(e,f,'valid',old_behavior=self.old_behavior) - h = array([[62,80,98,116,134]]) - assert_array_equal(g,h) - #class TestConvolve2d(_TestConvolve2d): -# old_behavior = False # def test_same_mode(self): # e = [[1,2,3],[3,4,5]] # f = [[2,3,4,5,6,7,8],[4,5,6,7,8,9,10]] -# g = convolve2d(e,f,'same',old_behavior=self.old_behavior) +# g = convolve2d(e,f,'same') # h = array([[80,98,116],\ # [70,82,94]]) # assert_array_equal(g,h) @@ -200,7 +125,7 @@ # e = [[1,2,3],[3,4,5]] # f = [[2,3,4,5,6,7,8],[4,5,6,7,8,9,10]] # def _test(): -# convolve2d(e,f,'valid',old_behavior=self.old_behavior) +# convolve2d(e,f,'valid') # self.assertRaises(ValueError, _test) class TestFFTConvolve(TestCase): @@ -468,46 +393,22 @@ def test_rank1_valid(self): a, b, y_r = self._setup_rank1() - y = correlate(a, b, 'valid', old_behavior=False) + y = correlate(a, b, 'valid') assert_array_almost_equal(y, y_r[1:4]) self.assertTrue(y.dtype == self.dt) def test_rank1_same(self): a, b, y_r = self._setup_rank1() - y = correlate(a, b, 'same', old_behavior=False) + y = correlate(a, b, 'same') assert_array_almost_equal(y, y_r[:-1]) self.assertTrue(y.dtype == self.dt) def test_rank1_full(self): a, b, y_r = self._setup_rank1() - y = correlate(a, b, 'full', old_behavior=False) + y = correlate(a, b, 'full') assert_array_almost_equal(y, y_r) self.assertTrue(y.dtype == self.dt) - @dec.deprecated() - def test_rank1_valid_old(self): - # This test assume a.size > b.size - a, b, y_r = self._setup_rank1() - y = correlate(b, a, 'valid') - assert_array_almost_equal(y, y_r[1:4]) - self.assertTrue(y.dtype == self.dt) - - @dec.deprecated() - def test_rank1_same_old(self): - # This test assume a.size > b.size - a, b, y_r = self._setup_rank1() - y = correlate(b, a, 'same') - assert_array_almost_equal(y, y_r[:-1]) - self.assertTrue(y.dtype == self.dt) - - @dec.deprecated() - def test_rank1_full_old(self): - # This test assume a.size > b.size - a, b, y_r = self._setup_rank1() - y = correlate(b, a, 'full') - assert_array_almost_equal(y, y_r) - self.assertTrue(y.dtype == self.dt) - def _setup_rank3(self): a = np.linspace(0, 39, 40).reshape((2, 4, 5), order='F').astype(self.dt) b = np.linspace(0, 23, 24).reshape((2, 3, 4), order='F').astype(self.dt) @@ -538,44 +439,23 @@ def test_rank3_valid(self): a, b, y_r = self._setup_rank3() - y = correlate(a, b, "valid", old_behavior=False) + y = correlate(a, b, "valid") assert_array_almost_equal(y, y_r[1:2,2:4,3:5]) self.assertTrue(y.dtype == self.dt) def test_rank3_same(self): a, b, y_r = self._setup_rank3() - y = correlate(a, b, "same", old_behavior=False) + y = correlate(a, b, "same") assert_array_almost_equal(y, y_r[0:-1,1:-1,1:-2]) self.assertTrue(y.dtype == self.dt) def test_rank3_all(self): a, b, y_r = self._setup_rank3() - y = correlate(a, b, old_behavior=False) + y = correlate(a, b) assert_array_almost_equal(y, y_r) self.assertTrue(y.dtype == self.dt) - @dec.deprecated() - def test_rank3_valid_old(self): - a, b, y_r = self._setup_rank3() - y = correlate(b, a, "valid") - assert_array_almost_equal(y, y_r[1:2,2:4,3:5]) - self.assertTrue(y.dtype == self.dt) - @dec.deprecated() - def test_rank3_same_old(self): - a, b, y_r = self._setup_rank3() - y = correlate(b, a, "same") - assert_array_almost_equal(y, y_r[0:-1,1:-1,1:-2]) - self.assertTrue(y.dtype == self.dt) - - @dec.deprecated() - def test_rank3_all_old(self): - a, b, y_r = self._setup_rank3() - y = correlate(b, a) - assert_array_almost_equal(y, y_r) - self.assertTrue(y.dtype == self.dt) - - def _get_testcorrelate_class(datatype, base): class TestCorrelateX(base): dt = datatype @@ -593,7 +473,7 @@ # The numpy data type to use. dt = None - + # The decimal precision to be used for comparing results. # This value will be passed as the 'decimal' keyword argument of # assert_array_almost_equal(). @@ -606,27 +486,27 @@ b = np.random.randn(8).astype(self.dt) b += 1j * np.random.randn(8).astype(self.dt) - y_r = (correlate(a.real, b.real, mode=mode, old_behavior=False) + - correlate(a.imag, b.imag, mode=mode, old_behavior=False)).astype(self.dt) - y_r += 1j * (-correlate(a.real, b.imag, mode=mode, old_behavior=False) + - correlate(a.imag, b.real, mode=mode, old_behavior=False)) + y_r = (correlate(a.real, b.real, mode=mode) + + correlate(a.imag, b.imag, mode=mode)).astype(self.dt) + y_r += 1j * (-correlate(a.real, b.imag, mode=mode) + + correlate(a.imag, b.real, mode=mode)) return a, b, y_r def test_rank1_valid(self): a, b, y_r = self._setup_rank1('valid') - y = correlate(a, b, 'valid', old_behavior=False) + y = correlate(a, b, 'valid') assert_array_almost_equal(y, y_r, decimal=self.decimal) self.assertTrue(y.dtype == self.dt) def test_rank1_same(self): a, b, y_r = self._setup_rank1('same') - y = correlate(a, b, 'same', old_behavior=False) + y = correlate(a, b, 'same') assert_array_almost_equal(y, y_r, decimal=self.decimal) self.assertTrue(y.dtype == self.dt) def test_rank1_full(self): a, b, y_r = self._setup_rank1('full') - y = correlate(a, b, 'full', old_behavior=False) + y = correlate(a, b, 'full') assert_array_almost_equal(y, y_r, decimal=self.decimal) self.assertTrue(y.dtype == self.dt) @@ -636,53 +516,15 @@ b = np.random.randn(8, 6, 4).astype(self.dt) b += 1j * np.random.randn(8, 6, 4).astype(self.dt) - y_r = (correlate(a.real, b.real, old_behavior=False) - + correlate(a.imag, b.imag, old_behavior=False)).astype(self.dt) - y_r += 1j * (-correlate(a.real, b.imag, old_behavior=False) + - correlate(a.imag, b.real, old_behavior=False)) + y_r = (correlate(a.real, b.real) + + correlate(a.imag, b.imag)).astype(self.dt) + y_r += 1j * (-correlate(a.real, b.imag) + correlate(a.imag, b.real)) - y = correlate(a, b, 'full', old_behavior=False) + y = correlate(a, b, 'full') assert_array_almost_equal(y, y_r, decimal=self.decimal-1) self.assertTrue(y.dtype == self.dt) - @dec.deprecated() - def test_rank1_valid_old(self): - a, b, y_r = self._setup_rank1('valid') - y = correlate(b, a.conj(), 'valid') - assert_array_almost_equal(y, y_r, decimal=self.decimal) - self.assertTrue(y.dtype == self.dt) - @dec.deprecated() - def test_rank1_same_old(self): - a, b, y_r = self._setup_rank1('same') - y = correlate(b, a.conj(), 'same') - assert_array_almost_equal(y, y_r, decimal=self.decimal) - self.assertTrue(y.dtype == self.dt) - - @dec.deprecated() - def test_rank1_full_old(self): - a, b, y_r = self._setup_rank1('full') - y = correlate(b, a.conj(), 'full') - assert_array_almost_equal(y, y_r, decimal=self.decimal) - self.assertTrue(y.dtype == self.dt) - - @dec.deprecated() - def test_rank3_old(self): - a = np.random.randn(10, 8, 6).astype(self.dt) - a += 1j * np.random.randn(10, 8, 6).astype(self.dt) - b = np.random.randn(8, 6, 4).astype(self.dt) - b += 1j * np.random.randn(8, 6, 4).astype(self.dt) - - y_r = (correlate(a.real, b.real, old_behavior=False) - + correlate(a.imag, b.imag, old_behavior=False)).astype(self.dt) - y_r += 1j * (-correlate(a.real, b.imag, old_behavior=False) + - correlate(a.imag, b.real, old_behavior=False)) - - y = correlate(b, a.conj(), 'full') - assert_array_almost_equal(y, y_r, decimal=self.decimal-1) - self.assertTrue(y.dtype == self.dt) - - # Create three classes, one for each complex data type. The actual class # name will be TestCorrelateComplex###, where ### is the number of bits. for datatype in [np.csingle, np.cdouble, np.clongdouble]: From scipy-svn at scipy.org Sun Jan 23 02:20:40 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 23 Jan 2011 01:20:40 -0600 (CST) Subject: [Scipy-svn] r7076 - in branches/0.9.x: doc/release scipy/signal scipy/signal/tests Message-ID: <20110123072040.768C637BA54@scipy.org> Author: rgommers Date: 2011-01-23 01:20:40 -0600 (Sun, 23 Jan 2011) New Revision: 7076 Modified: branches/0.9.x/doc/release/0.9.0-notes.rst branches/0.9.x/scipy/signal/signaltools.py branches/0.9.x/scipy/signal/sigtoolsmodule.c branches/0.9.x/scipy/signal/tests/test_signaltools.py Log: DEP: Remove old behavior of correlate/convolve. (backport of r7075) Modified: branches/0.9.x/doc/release/0.9.0-notes.rst =================================================================== --- branches/0.9.x/doc/release/0.9.0-notes.rst 2011-01-23 07:18:07 UTC (rev 7075) +++ branches/0.9.x/doc/release/0.9.0-notes.rst 2011-01-23 07:20:40 UTC (rev 7076) @@ -107,6 +107,16 @@ were added. +Improved statistical tests (``scipy.stats``) +-------------------------------------------- + +A new function ``scipy.stats.fisher_exact`` was added, that provides Fisher's +exact test for 2x2 contingency tables. + +The function ``scipy.stats.kendalltau`` was rewritten to make it much faster +(O(n log(n)) vs O(n^2)). + + Deprecated features =================== @@ -124,16 +134,6 @@ - ``vackar`` (renamed to ``diagbroyden``) -Improved statistical tests (``scipy.stats``) --------------------------------------------- - -A new function ``scipy.stats.fisher_exact`` was added, that provides Fisher's -exact test for 2x2 contingency tables. - -The function ``scipy.stats.kendalltau`` was rewritten to make it much faster -(O(n log(n)) vs O(n^2)). - - Removed features ================ @@ -147,6 +147,18 @@ functionality is still available by specifying ``mode='economic'``. +Old correlate/convolve behavior (in ``scipy.signal``) +----------------------------------------------------- + +The old behavior for ``scipy.signal.convolve``, ``scipy.signal.convolve2d``, +``scipy.signal.correlate`` and ``scipy.signal.correlate2d`` was deprecated in +0.8.0 and has now been removed. Convolve and correlate used to swap their +arguments if the second argument has dimensions larger than the first one, and +the mode was relative to the input with the largest dimension. The current +behavior is to never swap the inputs, which is what most people expect, and is +how correlation is usually defined. + + ``scipy.stats`` --------------- Modified: branches/0.9.x/scipy/signal/signaltools.py =================================================================== --- branches/0.9.x/scipy/signal/signaltools.py 2011-01-23 07:18:07 UTC (rev 7075) +++ branches/0.9.x/scipy/signal/signaltools.py 2011-01-23 07:20:40 UTC (rev 7076) @@ -22,18 +22,6 @@ _boundarydict = {'fill':0, 'pad':0, 'wrap':2, 'circular':2, 'symm':1, 'symmetric':1, 'reflect':4} -_SWAP_INPUTS_DEPRECATION_MSG = """\ -Current default behavior of convolve and correlate functions is deprecated. - -Convolve and corelate currently swap their arguments if the second argument -has dimensions larger than the first one, and the mode is relative to the input -with the largest dimension. The new behavior is to never swap the inputs, which -is what most people expects, and is how correlation is usually defined. - -You can control the behavior with the old_behavior flag - the flag will -disappear in scipy 0.9.0, and the functions will then implement the new -behavior only.""" - def _valfrommode(mode): try: val = _modedict[mode] @@ -55,7 +43,7 @@ return val -def correlate(in1, in2, mode='full', old_behavior=True): +def correlate(in1, in2, mode='full'): """ Cross-correlate two N-dimensional arrays. @@ -76,12 +64,6 @@ with respect to the 'full' output. - 'full': the output is the full discrete linear cross-correlation of the inputs. (Default) - old_behavior: bool - If True (default), the old behavior of correlate is implemented: - - if in1.size < in2.size, in1 and in2 are swapped (correlate(in1, - in2) == correlate(in2, in1)) - - For complex inputs, the conjugate is not taken for in2 - If False, the new, conventional definition of correlate is implemented. Returns ------- @@ -99,15 +81,6 @@ """ val = _valfrommode(mode) - if old_behavior: - warnings.warn(DeprecationWarning(_SWAP_INPUTS_DEPRECATION_MSG)) - if np.iscomplexobj(in2): - in2 = in2.conjugate() - if in1.size < in2.size: - swp = in2 - in2 = in1 - in1 = swp - if mode == 'valid': ps = [i - j + 1 for i, j in zip(in1.shape, in2.shape)] out = np.empty(ps, in1.dtype) @@ -177,7 +150,7 @@ return _centered(ret,abs(s2-s1)+1) -def convolve(in1, in2, mode='full', old_behavior=True): +def convolve(in1, in2, mode='full'): """ Convolve two N-dimensional arrays. @@ -219,26 +192,16 @@ slice_obj = [slice(None,None,-1)]*len(kernel.shape) - if old_behavior: - warnings.warn(DeprecationWarning(_SWAP_INPUTS_DEPRECATION_MSG)) - if (product(kernel.shape,axis=0) > product(volume.shape,axis=0)): - temp = kernel - kernel = volume - volume = temp - del temp - - return correlate(volume, kernel[slice_obj], mode, old_behavior=True) + if mode == 'valid': + for d1, d2 in zip(volume.shape, kernel.shape): + if not d1 >= d2: + raise ValueError( + "in1 should have at least as many items as in2 in " \ + "every dimension for valid mode.") + if np.iscomplexobj(kernel): + return correlate(volume, kernel[slice_obj].conj(), mode) else: - if mode == 'valid': - for d1, d2 in zip(volume.shape, kernel.shape): - if not d1 >= d2: - raise ValueError( - "in1 should have at least as many items as in2 in " \ - "every dimension for valid mode.") - if np.iscomplexobj(kernel): - return correlate(volume, kernel[slice_obj].conj(), mode, old_behavior=False) - else: - return correlate(volume, kernel[slice_obj], mode, old_behavior=False) + return correlate(volume, kernel[slice_obj], mode) def order_filter(a, domain, rank): """ @@ -376,10 +339,10 @@ mysize = asarray(mysize); # Estimate the local mean - lMean = correlate(im,ones(mysize), 'same', old_behavior=False) / product(mysize,axis=0) + lMean = correlate(im,ones(mysize), 'same') / product(mysize,axis=0) # Estimate the local variance - lVar = correlate(im**2,ones(mysize), 'same', old_behavior=False) / product(mysize,axis=0) - lMean**2 + lVar = correlate(im**2,ones(mysize), 'same') / product(mysize,axis=0) - lMean**2 # Estimate the noise power if needed. if noise==None: @@ -393,7 +356,7 @@ return out -def convolve2d(in1, in2, mode='full', boundary='fill', fillvalue=0, old_behavior=True): +def convolve2d(in1, in2, mode='full', boundary='fill', fillvalue=0): """Convolve two 2-dimensional arrays. Convolve `in1` and `in2` with output size determined by mode and boundary @@ -432,30 +395,19 @@ convolution of `in1` with `in2`. """ - if old_behavior: - warnings.warn(DeprecationWarning(_SWAP_INPUTS_DEPRECATION_MSG)) + if mode == 'valid': + for d1, d2 in zip(np.shape(in1), np.shape(in2)): + if not d1 >= d2: + raise ValueError( + "in1 should have at least as many items as in2 in " \ + "every dimension for valid mode.") - if old_behavior: - warnings.warn(DeprecationWarning(_SWAP_INPUTS_DEPRECATION_MSG)) - if (product(np.shape(in2),axis=0) > product(np.shape(in1),axis=0)): - temp = in1 - in1 = in2 - in2 = temp - del temp - else: - if mode == 'valid': - for d1, d2 in zip(np.shape(in1), np.shape(in2)): - if not d1 >= d2: - raise ValueError( - "in1 should have at least as many items as in2 in " \ - "every dimension for valid mode.") - val = _valfrommode(mode) bval = _bvalfromboundary(boundary) return sigtools._convolve2d(in1,in2,1,val,bval,fillvalue) -def correlate2d(in1, in2, mode='full', boundary='fill', fillvalue=0, old_behavior=True): +def correlate2d(in1, in2, mode='full', boundary='fill', fillvalue=0): """Cross-correlate two 2-dimensional arrays. Cross correlate in1 and in2 with output size determined by mode and @@ -494,8 +446,6 @@ cross-correlation of `in1` with `in2`. """ - if old_behavior: - warnings.warn(DeprecationWarning(_SWAP_INPUTS_DEPRECATION_MSG)) val = _valfrommode(mode) bval = _bvalfromboundary(boundary) Modified: branches/0.9.x/scipy/signal/sigtoolsmodule.c =================================================================== --- branches/0.9.x/scipy/signal/sigtoolsmodule.c 2011-01-23 07:18:07 UTC (rev 7075) +++ branches/0.9.x/scipy/signal/sigtoolsmodule.c 2011-01-23 07:20:40 UTC (rev 7076) @@ -1045,8 +1045,6 @@ n1 = PyArray_Size((PyObject *)ain1); n2 = PyArray_Size((PyObject *)ain2); - /* Swap if first argument is not the largest */ - if (n1 < n2) { aout = ain1; ain1 = ain2; ain2 = aout; aout = NULL; } aout_dimens = malloc(ain1->nd*sizeof(intp)); switch(mode & OUTSIZE_MASK) { case VALID: Modified: branches/0.9.x/scipy/signal/tests/test_signaltools.py =================================================================== --- branches/0.9.x/scipy/signal/tests/test_signaltools.py 2011-01-23 07:18:07 UTC (rev 7075) +++ branches/0.9.x/scipy/signal/tests/test_signaltools.py 2011-01-23 07:20:40 UTC (rev 7076) @@ -17,25 +17,25 @@ def test_basic(self): a = [3,4,5,6,5,4] b = [1,2,3] - c = convolve(a,b, old_behavior=self.old_behavior) + c = convolve(a,b) assert_array_equal(c,array([3,10,22,28,32,32,23,12])) def test_complex(self): x = array([1+1j, 2+1j, 3+1j]) y = array([1+1j, 2+1j]) - z = convolve(x, y,old_behavior=self.old_behavior) + z = convolve(x, y) assert_array_equal(z, array([2j, 2+6j, 5+8j, 5+5j])) def test_zero_order(self): a = 1289 b = 4567 - c = convolve(a,b,old_behavior=self.old_behavior) + c = convolve(a,b) assert_array_equal(c,a*b) def test_2d_arrays(self): a = [[1,2,3],[3,4,5]] b = [[2,3,4],[4,5,6]] - c = convolve(a,b,old_behavior=self.old_behavior) + c = convolve(a,b) d = array( [[2 ,7 ,16,17,12],\ [10,30,62,58,38],\ [12,31,58,49,30]]) @@ -44,57 +44,24 @@ def test_valid_mode(self): a = [1,2,3,6,5,3] b = [2,3,4,5,3,4,2,2,1] - c = convolve(a,b,'valid',old_behavior=self.old_behavior) + c = convolve(a,b,'valid') assert_array_equal(c,array([70,78,73,65])) -class OldTestConvolve(_TestConvolve): - old_behavior = True - @dec.deprecated() - def test_basic(self): - _TestConvolve.test_basic(self) - @dec.deprecated() - def test_complex(self): - _TestConvolve.test_complex(self) - - @dec.deprecated() - def test_2d_arrays(self): - _TestConvolve.test_2d_arrays(self) - - @dec.deprecated() - def test_same_mode(self): - _TestConvolve.test_same_mode(self) - - @dec.deprecated() - def test_valid_mode(self): - a = [1,2,3,6,5,3] - b = [2,3,4,5,3,4,2,2,1] - c = convolve(a,b,'valid',old_behavior=self.old_behavior) - assert_array_equal(c,array([70,78,73,65])) - - @dec.deprecated() - def test_same_mode(self): - a = [1,2,3,3,1,2] - b = [1,4,3,4,5,6,7,4,3,2,1,1,3] - c = convolve(a,b,'same',old_behavior=self.old_behavior) - d = array([14,25,35,43,57,61,63,57,45,36,25,20,17]) - assert_array_equal(c,d) - class TestConvolve(_TestConvolve): - old_behavior = False def test_valid_mode(self): # 'valid' mode if b.size > a.size does not make sense with the new # behavior a = [1,2,3,6,5,3] b = [2,3,4,5,3,4,2,2,1] def _test(): - convolve(a,b,'valid',old_behavior=self.old_behavior) + convolve(a,b,'valid') self.assertRaises(ValueError, _test) def test_same_mode(self): a = [1,2,3,3,1,2] b = [1,4,3,4,5,6,7,4,3,2,1,1,3] - c = convolve(a,b,'same',old_behavior=self.old_behavior) + c = convolve(a,b,'same') d = array([57,61,63,57,45,36]) assert_array_equal(c,d) @@ -105,13 +72,13 @@ d = array( [[2 ,7 ,16,17,12],\ [10,30,62,58,38],\ [12,31,58,49,30]]) - e = convolve2d(a,b,old_behavior=self.old_behavior) + e = convolve2d(a,b) assert_array_equal(e,d) def test_valid_mode(self): e = [[2,3,4,5,6,7,8],[4,5,6,7,8,9,10]] f = [[1,2,3],[3,4,5]] - g = convolve2d(e,f,'valid',old_behavior=self.old_behavior) + g = convolve2d(e,f,'valid') h = array([[62,80,98,116,134]]) assert_array_equal(g,h) @@ -119,7 +86,7 @@ a = [[1,2,3],[3,4,5]] b = [[2,3,4],[4,5,6]] fillval = 1 - c = convolve2d(a,b,'full','fill',fillval,old_behavior=self.old_behavior) + c = convolve2d(a,b,'full','fill',fillval) d = array([[24,26,31,34,32],\ [28,40,62,64,52],\ [32,46,67,62,48]]) @@ -128,7 +95,7 @@ def test_wrap_boundary(self): a = [[1,2,3],[3,4,5]] b = [[2,3,4],[4,5,6]] - c = convolve2d(a,b,'full','wrap',old_behavior=self.old_behavior) + c = convolve2d(a,b,'full','wrap') d = array([[80,80,74,80,80],\ [68,68,62,68,68],\ [80,80,74,80,80]]) @@ -137,60 +104,18 @@ def test_sym_boundary(self): a = [[1,2,3],[3,4,5]] b = [[2,3,4],[4,5,6]] - c = convolve2d(a,b,'full','symm',old_behavior=self.old_behavior) + c = convolve2d(a,b,'full','symm') d = array([[34,30,44, 62, 66],\ [52,48,62, 80, 84],\ [82,78,92,110,114]]) assert_array_equal(c,d) -class OldTestConvolve2d(_TestConvolve2d): - old_behavior = True - @dec.deprecated() - def test_2d_arrays(self): - _TestConvolve2d.test_2d_arrays(self) - - @dec.deprecated() - def test_same_mode(self): - e = [[1,2,3],[3,4,5]] - f = [[2,3,4,5,6,7,8],[4,5,6,7,8,9,10]] - g = convolve2d(e,f,'same',old_behavior=self.old_behavior) - h = array([[ 7,16,22,28, 34, 40, 37],\ - [30,62,80,98,116,134,114]]) - assert_array_equal(g,h) - - @dec.deprecated() - def test_valid_mode(self): - _TestConvolve2d.test_valid_mode(self) - - @dec.deprecated() - def test_fillvalue(self): - _TestConvolve2d.test_fillvalue(self) - - @dec.deprecated() - def test_wrap_boundary(self): - _TestConvolve2d.test_wrap_boundary(self) - - @dec.deprecated() - def test_sym_boundary(self): - _TestConvolve2d.test_sym_boundary(self) - - @dec.deprecated() - def test_valid_mode2(self): - # Test when in2.size > in1.size: old behavior is to do so that - # convolve2d(in2, in1) == convolve2d(in1, in2) - e = [[1,2,3],[3,4,5]] - f = [[2,3,4,5,6,7,8],[4,5,6,7,8,9,10]] - g = convolve2d(e,f,'valid',old_behavior=self.old_behavior) - h = array([[62,80,98,116,134]]) - assert_array_equal(g,h) - #class TestConvolve2d(_TestConvolve2d): -# old_behavior = False # def test_same_mode(self): # e = [[1,2,3],[3,4,5]] # f = [[2,3,4,5,6,7,8],[4,5,6,7,8,9,10]] -# g = convolve2d(e,f,'same',old_behavior=self.old_behavior) +# g = convolve2d(e,f,'same') # h = array([[80,98,116],\ # [70,82,94]]) # assert_array_equal(g,h) @@ -200,7 +125,7 @@ # e = [[1,2,3],[3,4,5]] # f = [[2,3,4,5,6,7,8],[4,5,6,7,8,9,10]] # def _test(): -# convolve2d(e,f,'valid',old_behavior=self.old_behavior) +# convolve2d(e,f,'valid') # self.assertRaises(ValueError, _test) class TestFFTConvolve(TestCase): @@ -468,46 +393,22 @@ def test_rank1_valid(self): a, b, y_r = self._setup_rank1() - y = correlate(a, b, 'valid', old_behavior=False) + y = correlate(a, b, 'valid') assert_array_almost_equal(y, y_r[1:4]) self.assertTrue(y.dtype == self.dt) def test_rank1_same(self): a, b, y_r = self._setup_rank1() - y = correlate(a, b, 'same', old_behavior=False) + y = correlate(a, b, 'same') assert_array_almost_equal(y, y_r[:-1]) self.assertTrue(y.dtype == self.dt) def test_rank1_full(self): a, b, y_r = self._setup_rank1() - y = correlate(a, b, 'full', old_behavior=False) + y = correlate(a, b, 'full') assert_array_almost_equal(y, y_r) self.assertTrue(y.dtype == self.dt) - @dec.deprecated() - def test_rank1_valid_old(self): - # This test assume a.size > b.size - a, b, y_r = self._setup_rank1() - y = correlate(b, a, 'valid') - assert_array_almost_equal(y, y_r[1:4]) - self.assertTrue(y.dtype == self.dt) - - @dec.deprecated() - def test_rank1_same_old(self): - # This test assume a.size > b.size - a, b, y_r = self._setup_rank1() - y = correlate(b, a, 'same') - assert_array_almost_equal(y, y_r[:-1]) - self.assertTrue(y.dtype == self.dt) - - @dec.deprecated() - def test_rank1_full_old(self): - # This test assume a.size > b.size - a, b, y_r = self._setup_rank1() - y = correlate(b, a, 'full') - assert_array_almost_equal(y, y_r) - self.assertTrue(y.dtype == self.dt) - def _setup_rank3(self): a = np.linspace(0, 39, 40).reshape((2, 4, 5), order='F').astype(self.dt) b = np.linspace(0, 23, 24).reshape((2, 3, 4), order='F').astype(self.dt) @@ -538,44 +439,23 @@ def test_rank3_valid(self): a, b, y_r = self._setup_rank3() - y = correlate(a, b, "valid", old_behavior=False) + y = correlate(a, b, "valid") assert_array_almost_equal(y, y_r[1:2,2:4,3:5]) self.assertTrue(y.dtype == self.dt) def test_rank3_same(self): a, b, y_r = self._setup_rank3() - y = correlate(a, b, "same", old_behavior=False) + y = correlate(a, b, "same") assert_array_almost_equal(y, y_r[0:-1,1:-1,1:-2]) self.assertTrue(y.dtype == self.dt) def test_rank3_all(self): a, b, y_r = self._setup_rank3() - y = correlate(a, b, old_behavior=False) + y = correlate(a, b) assert_array_almost_equal(y, y_r) self.assertTrue(y.dtype == self.dt) - @dec.deprecated() - def test_rank3_valid_old(self): - a, b, y_r = self._setup_rank3() - y = correlate(b, a, "valid") - assert_array_almost_equal(y, y_r[1:2,2:4,3:5]) - self.assertTrue(y.dtype == self.dt) - @dec.deprecated() - def test_rank3_same_old(self): - a, b, y_r = self._setup_rank3() - y = correlate(b, a, "same") - assert_array_almost_equal(y, y_r[0:-1,1:-1,1:-2]) - self.assertTrue(y.dtype == self.dt) - - @dec.deprecated() - def test_rank3_all_old(self): - a, b, y_r = self._setup_rank3() - y = correlate(b, a) - assert_array_almost_equal(y, y_r) - self.assertTrue(y.dtype == self.dt) - - def _get_testcorrelate_class(datatype, base): class TestCorrelateX(base): dt = datatype @@ -593,7 +473,7 @@ # The numpy data type to use. dt = None - + # The decimal precision to be used for comparing results. # This value will be passed as the 'decimal' keyword argument of # assert_array_almost_equal(). @@ -606,27 +486,27 @@ b = np.random.randn(8).astype(self.dt) b += 1j * np.random.randn(8).astype(self.dt) - y_r = (correlate(a.real, b.real, mode=mode, old_behavior=False) + - correlate(a.imag, b.imag, mode=mode, old_behavior=False)).astype(self.dt) - y_r += 1j * (-correlate(a.real, b.imag, mode=mode, old_behavior=False) + - correlate(a.imag, b.real, mode=mode, old_behavior=False)) + y_r = (correlate(a.real, b.real, mode=mode) + + correlate(a.imag, b.imag, mode=mode)).astype(self.dt) + y_r += 1j * (-correlate(a.real, b.imag, mode=mode) + + correlate(a.imag, b.real, mode=mode)) return a, b, y_r def test_rank1_valid(self): a, b, y_r = self._setup_rank1('valid') - y = correlate(a, b, 'valid', old_behavior=False) + y = correlate(a, b, 'valid') assert_array_almost_equal(y, y_r, decimal=self.decimal) self.assertTrue(y.dtype == self.dt) def test_rank1_same(self): a, b, y_r = self._setup_rank1('same') - y = correlate(a, b, 'same', old_behavior=False) + y = correlate(a, b, 'same') assert_array_almost_equal(y, y_r, decimal=self.decimal) self.assertTrue(y.dtype == self.dt) def test_rank1_full(self): a, b, y_r = self._setup_rank1('full') - y = correlate(a, b, 'full', old_behavior=False) + y = correlate(a, b, 'full') assert_array_almost_equal(y, y_r, decimal=self.decimal) self.assertTrue(y.dtype == self.dt) @@ -636,53 +516,15 @@ b = np.random.randn(8, 6, 4).astype(self.dt) b += 1j * np.random.randn(8, 6, 4).astype(self.dt) - y_r = (correlate(a.real, b.real, old_behavior=False) - + correlate(a.imag, b.imag, old_behavior=False)).astype(self.dt) - y_r += 1j * (-correlate(a.real, b.imag, old_behavior=False) + - correlate(a.imag, b.real, old_behavior=False)) + y_r = (correlate(a.real, b.real) + + correlate(a.imag, b.imag)).astype(self.dt) + y_r += 1j * (-correlate(a.real, b.imag) + correlate(a.imag, b.real)) - y = correlate(a, b, 'full', old_behavior=False) + y = correlate(a, b, 'full') assert_array_almost_equal(y, y_r, decimal=self.decimal-1) self.assertTrue(y.dtype == self.dt) - @dec.deprecated() - def test_rank1_valid_old(self): - a, b, y_r = self._setup_rank1('valid') - y = correlate(b, a.conj(), 'valid') - assert_array_almost_equal(y, y_r, decimal=self.decimal) - self.assertTrue(y.dtype == self.dt) - @dec.deprecated() - def test_rank1_same_old(self): - a, b, y_r = self._setup_rank1('same') - y = correlate(b, a.conj(), 'same') - assert_array_almost_equal(y, y_r, decimal=self.decimal) - self.assertTrue(y.dtype == self.dt) - - @dec.deprecated() - def test_rank1_full_old(self): - a, b, y_r = self._setup_rank1('full') - y = correlate(b, a.conj(), 'full') - assert_array_almost_equal(y, y_r, decimal=self.decimal) - self.assertTrue(y.dtype == self.dt) - - @dec.deprecated() - def test_rank3_old(self): - a = np.random.randn(10, 8, 6).astype(self.dt) - a += 1j * np.random.randn(10, 8, 6).astype(self.dt) - b = np.random.randn(8, 6, 4).astype(self.dt) - b += 1j * np.random.randn(8, 6, 4).astype(self.dt) - - y_r = (correlate(a.real, b.real, old_behavior=False) - + correlate(a.imag, b.imag, old_behavior=False)).astype(self.dt) - y_r += 1j * (-correlate(a.real, b.imag, old_behavior=False) + - correlate(a.imag, b.real, old_behavior=False)) - - y = correlate(b, a.conj(), 'full') - assert_array_almost_equal(y, y_r, decimal=self.decimal-1) - self.assertTrue(y.dtype == self.dt) - - # Create three classes, one for each complex data type. The actual class # name will be TestCorrelateComplex###, where ### is the number of bits. for datatype in [np.csingle, np.cdouble, np.clongdouble]: From scipy-svn at scipy.org Sun Jan 23 03:09:36 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 23 Jan 2011 02:09:36 -0600 (CST) Subject: [Scipy-svn] r7077 - branches/0.9.x/scipy/signal/tests Message-ID: <20110123080936.7EADE3634E@scipy.org> Author: rgommers Date: 2011-01-23 02:09:36 -0600 (Sun, 23 Jan 2011) New Revision: 7077 Modified: branches/0.9.x/scipy/signal/tests/test_signaltools.py Log: TST: Mark medfilt bug as knownfail on 64-bit Linux. Modified: branches/0.9.x/scipy/signal/tests/test_signaltools.py =================================================================== --- branches/0.9.x/scipy/signal/tests/test_signaltools.py 2011-01-23 07:20:40 UTC (rev 7076) +++ branches/0.9.x/scipy/signal/tests/test_signaltools.py 2011-01-23 08:09:36 UTC (rev 7077) @@ -1,4 +1,5 @@ - +import sys +import platform from decimal import Decimal from numpy.testing import TestCase, run_module_suite, assert_equal, \ @@ -13,6 +14,13 @@ import numpy as np +# check if we're on 64-bit Linux, there a medfilt test fails. +if sys.platform == 'linux2' and platform.architecture()[0] == '64bit': + _linux64bit = True +else: + _linux64bit = False + + class _TestConvolve(TestCase): def test_basic(self): a = [3,4,5,6,5,4] @@ -183,6 +191,8 @@ assert_(np.allclose(c, d, rtol=1e-10)) class TestMedFilt(TestCase): + @dec.knownfailureif(_linux64bit, + "Currently fails intermittently on 64-bit Linux") def test_basic(self): f = [[50, 50, 50, 50, 50, 92, 18, 27, 65, 46], [50, 50, 50, 50, 50, 0, 72, 77, 68, 66], From scipy-svn at scipy.org Sun Jan 23 03:09:53 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 23 Jan 2011 02:09:53 -0600 (CST) Subject: [Scipy-svn] r7078 - branches/0.9.x/scipy/interpolate/tests Message-ID: <20110123080953.0F4683634E@scipy.org> Author: rgommers Date: 2011-01-23 02:09:52 -0600 (Sun, 23 Jan 2011) New Revision: 7078 Modified: branches/0.9.x/scipy/interpolate/tests/test_fitpack.py Log: TST: filter interpolate test warnings in 0.9.x branch. Modified: branches/0.9.x/scipy/interpolate/tests/test_fitpack.py =================================================================== --- branches/0.9.x/scipy/interpolate/tests/test_fitpack.py 2011-01-23 08:09:36 UTC (rev 7077) +++ branches/0.9.x/scipy/interpolate/tests/test_fitpack.py 2011-01-23 08:09:52 UTC (rev 7078) @@ -10,8 +10,9 @@ Run tests if interpolate is not installed: python tests/test_fitpack.py [] """ -#import libwadpy +import warnings + from numpy.testing import assert_equal, assert_almost_equal, assert_array_equal, \ assert_array_almost_equal, TestCase, run_module_suite from numpy import array, diff, shape @@ -195,5 +196,13 @@ assert_almost_equal(zi, zi2) + +warnings.filterwarnings("ignore", + message="\\nThe coefficients of the spline returned", + module="scipy.interpolate") +warnings.filterwarnings("ignore", + message="\\nThe required storage space exceeds", + module="scipy.interpolate") + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Sun Jan 23 04:17:32 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 23 Jan 2011 03:17:32 -0600 (CST) Subject: [Scipy-svn] r7079 - branches/0.9.x/doc/release Message-ID: <20110123091732.611FE1B853C@scipy.org> Author: rgommers Date: 2011-01-23 03:17:32 -0600 (Sun, 23 Jan 2011) New Revision: 7079 Modified: branches/0.9.x/doc/release/0.9.0-notes.rst Log: DOC: complete 0.9.0 release notes. Modified: branches/0.9.x/doc/release/0.9.0-notes.rst =================================================================== --- branches/0.9.x/doc/release/0.9.0-notes.rst 2011-01-23 08:09:52 UTC (rev 7078) +++ branches/0.9.x/doc/release/0.9.0-notes.rst 2011-01-23 09:17:32 UTC (rev 7079) @@ -2,11 +2,9 @@ SciPy 0.9.0 Release Notes ========================= -.. note:: Scipy 0.9.0 is not released yet! - .. contents:: -SciPy 0.9.0 is the culmination of XXX months of hard work. It contains +SciPy 0.9.0 is the culmination of 6 months of hard work. It contains many new features, numerous bug-fixes, improved test coverage and better documentation. There have been a number of deprecations and API changes in this release, which are documented below. All users @@ -22,9 +20,7 @@ major milestone in the development of SciPy, after which changing the package structure or API will be much more difficult. Whilst these pre-1.0 releases are considered to have "Beta" status, we are -committed to making them as bug-free as possible. For example, in -addition to fixing numerous bugs in this release, we have also doubled -the number of unit tests since the last release. +committed to making them as bug-free as possible. However, until the 1.0 release, we are aggressively reviewing and refining the functionality, organization, and interface. This is being @@ -34,6 +30,7 @@ project - everything - from which algorithms we implement, to details about our function's call signatures. + Python 3 ======== From scipy-svn at scipy.org Sun Jan 23 04:25:45 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 23 Jan 2011 03:25:45 -0600 (CST) Subject: [Scipy-svn] r7080 - trunk/scipy/stats/tests Message-ID: <20110123092545.3203A3634E@scipy.org> Author: rgommers Date: 2011-01-23 03:25:44 -0600 (Sun, 23 Jan 2011) New Revision: 7080 Modified: trunk/scipy/stats/tests/test_distributions.py Log: TST: relax test precision for new stats.expect tests a little. Was failing on win32. Modified: trunk/scipy/stats/tests/test_distributions.py =================================================================== --- trunk/scipy/stats/tests/test_distributions.py 2011-01-23 09:17:32 UTC (rev 7079) +++ trunk/scipy/stats/tests/test_distributions.py 2011-01-23 09:25:44 UTC (rev 7080) @@ -577,7 +577,7 @@ ub = stats.norm.ppf(0.95, loc=5, scale=2) prob90 = stats.norm.expect(lambda x: 1, loc=5, scale=2, lb=lb, ub=ub) assert_almost_equal(prob90, 0.9, decimal=14) - + prob90c = stats.norm.expect(lambda x: 1, loc=5, scale=2, lb=lb, ub=ub, conditional=True) assert_almost_equal(prob90c, 1., decimal=14) @@ -599,7 +599,7 @@ prob90 = stats.beta.expect(lambda x: 1., args=(10,10), loc=5., scale=2.,lb=lb, ub=ub, conditional=False) assert_almost_equal(prob90, 0.9, decimal=14) - + prob90c = stats.beta.expect(lambda x: 1, args=(10,10), loc=5, scale=2, lb=lb, ub=ub, conditional=True) assert_almost_equal(prob90c, 1., decimal=14) @@ -611,8 +611,8 @@ #without specifying bounds m_true, v_true = stats.hypergeom.stats(20, 10, 8, loc=5.) m = stats.hypergeom.expect(lambda x: x, args=(20, 10, 8), loc=5.) - assert_almost_equal(m, m_true, decimal=14) - + assert_almost_equal(m, m_true, decimal=13) + v = stats.hypergeom.expect(lambda x: (x-9.)**2, args=(20, 10, 8), loc=5.) assert_almost_equal(v, v_true, decimal=14) @@ -626,7 +626,7 @@ prob_true = 1-stats.hypergeom.pmf([5, 13], 20, 10, 8, loc=5).sum() prob_bounds = stats.hypergeom.expect(lambda x: 1, args=(20, 10, 8), loc=5., lb=6, ub=12) - assert_almost_equal(prob_bounds, prob_true, decimal=14) + assert_almost_equal(prob_bounds, prob_true, decimal=13) #conditional prob_bc = stats.hypergeom.expect(lambda x: 1, args=(20, 10, 8), loc=5., @@ -636,7 +636,7 @@ #check simple integral prob_b = stats.hypergeom.expect(lambda x: 1, args=(20, 10, 8), lb=0, ub=8) - assert_almost_equal(prob_b, 1, decimal=14) + assert_almost_equal(prob_b, 1, decimal=13) def test_poisson(self): #poisson, use lower bound only @@ -644,16 +644,16 @@ conditional=False) prob_b_true = 1-stats.poisson.cdf(2,2) assert_almost_equal(prob_bounds, prob_b_true, decimal=14) - + prob_lb = stats.poisson.expect(lambda x: 1, args=(2,), lb=2, conditional=True) assert_almost_equal(prob_lb, 1, decimal=14) - + def test_regression_ticket_1316(): """Regression test for ticket #1316.""" # The following was raising an exception, because _construct_default_doc() From scipy-svn at scipy.org Sun Jan 23 04:27:33 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 23 Jan 2011 03:27:33 -0600 (CST) Subject: [Scipy-svn] r7081 - branches/0.9.x/scipy/stats/tests Message-ID: <20110123092733.044461B853C@scipy.org> Author: rgommers Date: 2011-01-23 03:27:32 -0600 (Sun, 23 Jan 2011) New Revision: 7081 Modified: branches/0.9.x/scipy/stats/tests/test_distributions.py Log: TST: relax test precision for new stats.expect tests a little. Was failing on win32. (backport of r7080) Modified: branches/0.9.x/scipy/stats/tests/test_distributions.py =================================================================== --- branches/0.9.x/scipy/stats/tests/test_distributions.py 2011-01-23 09:25:44 UTC (rev 7080) +++ branches/0.9.x/scipy/stats/tests/test_distributions.py 2011-01-23 09:27:32 UTC (rev 7081) @@ -577,7 +577,7 @@ ub = stats.norm.ppf(0.95, loc=5, scale=2) prob90 = stats.norm.expect(lambda x: 1, loc=5, scale=2, lb=lb, ub=ub) assert_almost_equal(prob90, 0.9, decimal=14) - + prob90c = stats.norm.expect(lambda x: 1, loc=5, scale=2, lb=lb, ub=ub, conditional=True) assert_almost_equal(prob90c, 1., decimal=14) @@ -599,7 +599,7 @@ prob90 = stats.beta.expect(lambda x: 1., args=(10,10), loc=5., scale=2.,lb=lb, ub=ub, conditional=False) assert_almost_equal(prob90, 0.9, decimal=14) - + prob90c = stats.beta.expect(lambda x: 1, args=(10,10), loc=5, scale=2, lb=lb, ub=ub, conditional=True) assert_almost_equal(prob90c, 1., decimal=14) @@ -611,8 +611,8 @@ #without specifying bounds m_true, v_true = stats.hypergeom.stats(20, 10, 8, loc=5.) m = stats.hypergeom.expect(lambda x: x, args=(20, 10, 8), loc=5.) - assert_almost_equal(m, m_true, decimal=14) - + assert_almost_equal(m, m_true, decimal=13) + v = stats.hypergeom.expect(lambda x: (x-9.)**2, args=(20, 10, 8), loc=5.) assert_almost_equal(v, v_true, decimal=14) @@ -626,7 +626,7 @@ prob_true = 1-stats.hypergeom.pmf([5, 13], 20, 10, 8, loc=5).sum() prob_bounds = stats.hypergeom.expect(lambda x: 1, args=(20, 10, 8), loc=5., lb=6, ub=12) - assert_almost_equal(prob_bounds, prob_true, decimal=14) + assert_almost_equal(prob_bounds, prob_true, decimal=13) #conditional prob_bc = stats.hypergeom.expect(lambda x: 1, args=(20, 10, 8), loc=5., @@ -636,7 +636,7 @@ #check simple integral prob_b = stats.hypergeom.expect(lambda x: 1, args=(20, 10, 8), lb=0, ub=8) - assert_almost_equal(prob_b, 1, decimal=14) + assert_almost_equal(prob_b, 1, decimal=13) def test_poisson(self): #poisson, use lower bound only @@ -644,16 +644,16 @@ conditional=False) prob_b_true = 1-stats.poisson.cdf(2,2) assert_almost_equal(prob_bounds, prob_b_true, decimal=14) - + prob_lb = stats.poisson.expect(lambda x: 1, args=(2,), lb=2, conditional=True) assert_almost_equal(prob_lb, 1, decimal=14) - + def test_regression_ticket_1316(): """Regression test for ticket #1316.""" # The following was raising an exception, because _construct_default_doc() From scipy-svn at scipy.org Sun Jan 23 04:29:33 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 23 Jan 2011 03:29:33 -0600 (CST) Subject: [Scipy-svn] r7082 - branches/0.9.x Message-ID: <20110123092933.77B093634E@scipy.org> Author: rgommers Date: 2011-01-23 03:29:33 -0600 (Sun, 23 Jan 2011) New Revision: 7082 Modified: branches/0.9.x/setup.py Log: REL: set version number to 0.9.0rc1, released=True Modified: branches/0.9.x/setup.py =================================================================== --- branches/0.9.x/setup.py 2011-01-23 09:27:32 UTC (rev 7081) +++ branches/0.9.x/setup.py 2011-01-23 09:29:33 UTC (rev 7082) @@ -44,8 +44,8 @@ MAJOR = 0 MINOR = 9 MICRO = 0 -ISRELEASED = False -VERSION = '%d.%d.%db1' % (MAJOR, MINOR, MICRO) +ISRELEASED = True +VERSION = '%d.%d.%drc1' % (MAJOR, MINOR, MICRO) # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly # update it when the contents of directories change. From scipy-svn at scipy.org Sun Jan 23 04:30:20 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 23 Jan 2011 03:30:20 -0600 (CST) Subject: [Scipy-svn] r7083 - tags Message-ID: <20110123093020.6C0DC36350@scipy.org> Author: rgommers Date: 2011-01-23 03:30:20 -0600 (Sun, 23 Jan 2011) New Revision: 7083 Added: tags/0.9.0rc1/ Log: Create tag 0.9.0rc1 From scipy-svn at scipy.org Sun Jan 23 09:37:22 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 23 Jan 2011 08:37:22 -0600 (CST) Subject: [Scipy-svn] r7084 - branches/0.9.x Message-ID: <20110123143722.DFC3837BCA2@scipy.org> Author: rgommers Date: 2011-01-23 08:37:21 -0600 (Sun, 23 Jan 2011) New Revision: 7084 Modified: branches/0.9.x/pavement.py branches/0.9.x/setup.py Log: REL: set released=False again in setup.py, and correct one more paver bug. Modified: branches/0.9.x/pavement.py =================================================================== --- branches/0.9.x/pavement.py 2011-01-23 09:30:20 UTC (rev 7083) +++ branches/0.9.x/pavement.py 2011-01-23 14:37:21 UTC (rev 7084) @@ -380,7 +380,7 @@ bdist_wininst_arch(pyver, 'sse3') copy_bdist("sse3") - prepare_nsis_script(options.wininst.pyver, FULLVERSION) + prepare_nsis_script(pyver, FULLVERSION) subprocess.check_call(MAKENSIS + ['scipy-superinstaller.nsi'], cwd=options.superpack.builddir) Modified: branches/0.9.x/setup.py =================================================================== --- branches/0.9.x/setup.py 2011-01-23 09:30:20 UTC (rev 7083) +++ branches/0.9.x/setup.py 2011-01-23 14:37:21 UTC (rev 7084) @@ -44,7 +44,7 @@ MAJOR = 0 MINOR = 9 MICRO = 0 -ISRELEASED = True +ISRELEASED = False VERSION = '%d.%d.%drc1' % (MAJOR, MINOR, MICRO) # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly From scipy-svn at scipy.org Mon Jan 24 18:40:31 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 Jan 2011 17:40:31 -0600 (CST) Subject: [Scipy-svn] r7085 - in trunk/scipy/constants: . tests Message-ID: <20110124234031.CA30537A18C@scipy.org> Author: stefan Date: 2011-01-24 17:40:30 -0600 (Mon, 24 Jan 2011) New Revision: 7085 Modified: trunk/scipy/constants/codata.py trunk/scipy/constants/tests/test_codata.py Log: BUG: Add back 2002 codata values. Modified: trunk/scipy/constants/codata.py =================================================================== --- trunk/scipy/constants/codata.py 2011-01-23 14:37:21 UTC (rev 7084) +++ trunk/scipy/constants/codata.py 2011-01-24 23:40:30 UTC (rev 7085) @@ -72,6 +72,67 @@ """ Quantity Value Uncertainty Unit """ +txt2002 = """Wien displacement law constant 2.897 7685e-3 0.000 0051e-3 m K +atomic unit of 1st hyperpolarizablity 3.206 361 51e-53 0.000 000 28e-53 C^3 m^3 J^-2 +atomic unit of 2nd hyperpolarizablity 6.235 3808e-65 0.000 0011e-65 C^4 m^4 J^-3 +atomic unit of electric dipole moment 8.478 353 09e-30 0.000 000 73e-30 C m +atomic unit of electric polarizablity 1.648 777 274e-41 0.000 000 016e-41 C^2 m^2 J^-1 +atomic unit of electric quadrupole moment 4.486 551 24e-40 0.000 000 39e-40 C m^2 +atomic unit of magn. dipole moment 1.854 801 90e-23 0.000 000 16e-23 J T^-1 +atomic unit of magn. flux density 2.350 517 42e5 0.000 000 20e5 T +deuteron magn. moment 0.433 073 482e-26 0.000 000 038e-26 J T^-1 +deuteron magn. moment to Bohr magneton ratio 0.466 975 4567e-3 0.000 000 0050e-3 +deuteron magn. moment to nuclear magneton ratio 0.857 438 2329 0.000 000 0092 +deuteron-electron magn. moment ratio -4.664 345 548e-4 0.000 000 050e-4 +deuteron-proton magn. moment ratio 0.307 012 2084 0.000 000 0045 +deuteron-neutron magn. moment ratio -0.448 206 52 0.000 000 11 +electron gyromagn. ratio 1.760 859 74e11 0.000 000 15e11 s^-1 T^-1 +electron gyromagn. ratio over 2 pi 28 024.9532 0.0024 MHz T^-1 +electron magn. moment -928.476 412e-26 0.000 080e-26 J T^-1 +electron magn. moment to Bohr magneton ratio -1.001 159 652 1859 0.000 000 000 0038 +electron magn. moment to nuclear magneton ratio -1838.281 971 07 0.000 000 85 +electron magn. moment anomaly 1.159 652 1859e-3 0.000 000 0038e-3 +electron to shielded proton magn. moment ratio -658.227 5956 0.000 0071 +electron to shielded helion magn. moment ratio 864.058 255 0.000 010 +electron-deuteron magn. moment ratio -2143.923 493 0.000 023 +electron-muon magn. moment ratio 206.766 9894 0.000 0054 +electron-neutron magn. moment ratio 960.920 50 0.000 23 +electron-proton magn. moment ratio -658.210 6862 0.000 0066 +magn. constant 12.566 370 614...e-7 0 N A^-2 +magn. flux quantum 2.067 833 72e-15 0.000 000 18e-15 Wb +muon magn. moment -4.490 447 99e-26 0.000 000 40e-26 J T^-1 +muon magn. moment to Bohr magneton ratio -4.841 970 45e-3 0.000 000 13e-3 +muon magn. moment to nuclear magneton ratio -8.890 596 98 0.000 000 23 +muon-proton magn. moment ratio -3.183 345 118 0.000 000 089 +neutron gyromagn. ratio 1.832 471 83e8 0.000 000 46e8 s^-1 T^-1 +neutron gyromagn. ratio over 2 pi 29.164 6950 0.000 0073 MHz T^-1 +neutron magn. moment -0.966 236 45e-26 0.000 000 24e-26 J T^-1 +neutron magn. moment to Bohr magneton ratio -1.041 875 63e-3 0.000 000 25e-3 +neutron magn. moment to nuclear magneton ratio -1.913 042 73 0.000 000 45 +neutron to shielded proton magn. moment ratio -0.684 996 94 0.000 000 16 +neutron-electron magn. moment ratio 1.040 668 82e-3 0.000 000 25e-3 +neutron-proton magn. moment ratio -0.684 979 34 0.000 000 16 +proton gyromagn. ratio 2.675 222 05e8 0.000 000 23e8 s^-1 T^-1 +proton gyromagn. ratio over 2 pi 42.577 4813 0.000 0037 MHz T^-1 +proton magn. moment 1.410 606 71e-26 0.000 000 12e-26 J T^-1 +proton magn. moment to Bohr magneton ratio 1.521 032 206e-3 0.000 000 015e-3 +proton magn. moment to nuclear magneton ratio 2.792 847 351 0.000 000 028 +proton magn. shielding correction 25.689e-6 0.015e-6 +proton-neutron magn. moment ratio -1.459 898 05 0.000 000 34 +shielded helion gyromagn. ratio 2.037 894 70e8 0.000 000 18e8 s^-1 T^-1 +shielded helion gyromagn. ratio over 2 pi 32.434 1015 0.000 0028 MHz T^-1 +shielded helion magn. moment -1.074 553 024e-26 0.000 000 093e-26 J T^-1 +shielded helion magn. moment to Bohr magneton ratio -1.158 671 474e-3 0.000 000 014e-3 +shielded helion magn. moment to nuclear magneton ratio -2.127 497 723 0.000 000 025 +shielded helion to proton magn. moment ratio -0.761 766 562 0.000 000 012 +shielded helion to shielded proton magn. moment ratio -0.761 786 1313 0.000 000 0033 +shielded helion gyromagn. ratio 2.037 894 70e8 0.000 000 18e8 s^-1 T^-1 +shielded helion gyromagn. ratio over 2 pi 32.434 1015 0.000 0028 MHz T^-1 +shielded proton magn. moment 1.410 570 47e-26 0.000 000 12e-26 J T^-1 +shielded proton magn. moment to Bohr magneton ratio 1.520 993 132e-3 0.000 000 016e-3 +shielded proton magn. moment to nuclear magneton ratio 2.792 775 604 0.000 000 030 +{220} lattice spacing of silicon 192.015 5965e-12 0.000 0070e-12 m""" + txt2006 = """lattice spacing of silicon 192.015 5762 e-12 0.000 0050 e-12 m alpha particle-electron mass ratio 7294.299 5365 0.000 0031 alpha particle mass 6.644 656 20 e-27 0.000 000 33 e-27 kg @@ -401,15 +462,23 @@ #parse into a dict physical_constants = {} -for line in txt2006.split('\n'): - name = line[:55].rstrip() - val = line[55:77].replace(' ','').replace('...','') - val = float(val) - uncert = line[77:99].replace(' ','').replace('(exact)', '0') - uncert = float(uncert) - units = line[99:].rstrip() - physical_constants[name] = (val, units, uncert) +def parse_constants(d): + for line in d.split('\n'): + name = line[:55].rstrip() + val = line[55:77].replace(' ','').replace('...','') + val = float(val) + uncert = line[77:99].replace(' ','').replace('(exact)', '0') + uncert = float(uncert) + units = line[99:].rstrip() + physical_constants[name] = (val, units, uncert) + +# These values should be deprecated in due course +parse_constants(txt2002) + +# This is the newest data-set +parse_constants(txt2006) + def value(key) : """ Value in physical_constants indexed by key Modified: trunk/scipy/constants/tests/test_codata.py =================================================================== --- trunk/scipy/constants/tests/test_codata.py 2011-01-23 14:37:21 UTC (rev 7084) +++ trunk/scipy/constants/tests/test_codata.py 2011-01-24 23:40:30 UTC (rev 7085) @@ -1,7 +1,8 @@ import warnings from scipy.constants import constants, codata, find -from numpy.testing import assert_equal, assert_, run_module_suite +from numpy.testing import assert_equal, assert_, run_module_suite, \ + assert_almost_equal def test_find(): @@ -42,5 +43,9 @@ assert_equal(codata.find('Wien freq', disp=False)[0], 'Wien frequency displacement law constant') +def test_2002_vs_2006(): + assert_almost_equal(codata.value('magn. flux quantum'), + codata.value('mag. flux quantum')) + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Tue Jan 25 06:13:50 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 25 Jan 2011 05:13:50 -0600 (CST) Subject: [Scipy-svn] r7086 - in branches/0.9.x/scipy/constants: . tests Message-ID: <20110125111350.A836136356@scipy.org> Author: rgommers Date: 2011-01-25 05:13:49 -0600 (Tue, 25 Jan 2011) New Revision: 7086 Modified: branches/0.9.x/scipy/constants/codata.py branches/0.9.x/scipy/constants/tests/test_codata.py Log: BUG: Add back 2002 codata values. (backport of r7085) Modified: branches/0.9.x/scipy/constants/codata.py =================================================================== --- branches/0.9.x/scipy/constants/codata.py 2011-01-24 23:40:30 UTC (rev 7085) +++ branches/0.9.x/scipy/constants/codata.py 2011-01-25 11:13:49 UTC (rev 7086) @@ -72,6 +72,67 @@ """ Quantity Value Uncertainty Unit """ +txt2002 = """Wien displacement law constant 2.897 7685e-3 0.000 0051e-3 m K +atomic unit of 1st hyperpolarizablity 3.206 361 51e-53 0.000 000 28e-53 C^3 m^3 J^-2 +atomic unit of 2nd hyperpolarizablity 6.235 3808e-65 0.000 0011e-65 C^4 m^4 J^-3 +atomic unit of electric dipole moment 8.478 353 09e-30 0.000 000 73e-30 C m +atomic unit of electric polarizablity 1.648 777 274e-41 0.000 000 016e-41 C^2 m^2 J^-1 +atomic unit of electric quadrupole moment 4.486 551 24e-40 0.000 000 39e-40 C m^2 +atomic unit of magn. dipole moment 1.854 801 90e-23 0.000 000 16e-23 J T^-1 +atomic unit of magn. flux density 2.350 517 42e5 0.000 000 20e5 T +deuteron magn. moment 0.433 073 482e-26 0.000 000 038e-26 J T^-1 +deuteron magn. moment to Bohr magneton ratio 0.466 975 4567e-3 0.000 000 0050e-3 +deuteron magn. moment to nuclear magneton ratio 0.857 438 2329 0.000 000 0092 +deuteron-electron magn. moment ratio -4.664 345 548e-4 0.000 000 050e-4 +deuteron-proton magn. moment ratio 0.307 012 2084 0.000 000 0045 +deuteron-neutron magn. moment ratio -0.448 206 52 0.000 000 11 +electron gyromagn. ratio 1.760 859 74e11 0.000 000 15e11 s^-1 T^-1 +electron gyromagn. ratio over 2 pi 28 024.9532 0.0024 MHz T^-1 +electron magn. moment -928.476 412e-26 0.000 080e-26 J T^-1 +electron magn. moment to Bohr magneton ratio -1.001 159 652 1859 0.000 000 000 0038 +electron magn. moment to nuclear magneton ratio -1838.281 971 07 0.000 000 85 +electron magn. moment anomaly 1.159 652 1859e-3 0.000 000 0038e-3 +electron to shielded proton magn. moment ratio -658.227 5956 0.000 0071 +electron to shielded helion magn. moment ratio 864.058 255 0.000 010 +electron-deuteron magn. moment ratio -2143.923 493 0.000 023 +electron-muon magn. moment ratio 206.766 9894 0.000 0054 +electron-neutron magn. moment ratio 960.920 50 0.000 23 +electron-proton magn. moment ratio -658.210 6862 0.000 0066 +magn. constant 12.566 370 614...e-7 0 N A^-2 +magn. flux quantum 2.067 833 72e-15 0.000 000 18e-15 Wb +muon magn. moment -4.490 447 99e-26 0.000 000 40e-26 J T^-1 +muon magn. moment to Bohr magneton ratio -4.841 970 45e-3 0.000 000 13e-3 +muon magn. moment to nuclear magneton ratio -8.890 596 98 0.000 000 23 +muon-proton magn. moment ratio -3.183 345 118 0.000 000 089 +neutron gyromagn. ratio 1.832 471 83e8 0.000 000 46e8 s^-1 T^-1 +neutron gyromagn. ratio over 2 pi 29.164 6950 0.000 0073 MHz T^-1 +neutron magn. moment -0.966 236 45e-26 0.000 000 24e-26 J T^-1 +neutron magn. moment to Bohr magneton ratio -1.041 875 63e-3 0.000 000 25e-3 +neutron magn. moment to nuclear magneton ratio -1.913 042 73 0.000 000 45 +neutron to shielded proton magn. moment ratio -0.684 996 94 0.000 000 16 +neutron-electron magn. moment ratio 1.040 668 82e-3 0.000 000 25e-3 +neutron-proton magn. moment ratio -0.684 979 34 0.000 000 16 +proton gyromagn. ratio 2.675 222 05e8 0.000 000 23e8 s^-1 T^-1 +proton gyromagn. ratio over 2 pi 42.577 4813 0.000 0037 MHz T^-1 +proton magn. moment 1.410 606 71e-26 0.000 000 12e-26 J T^-1 +proton magn. moment to Bohr magneton ratio 1.521 032 206e-3 0.000 000 015e-3 +proton magn. moment to nuclear magneton ratio 2.792 847 351 0.000 000 028 +proton magn. shielding correction 25.689e-6 0.015e-6 +proton-neutron magn. moment ratio -1.459 898 05 0.000 000 34 +shielded helion gyromagn. ratio 2.037 894 70e8 0.000 000 18e8 s^-1 T^-1 +shielded helion gyromagn. ratio over 2 pi 32.434 1015 0.000 0028 MHz T^-1 +shielded helion magn. moment -1.074 553 024e-26 0.000 000 093e-26 J T^-1 +shielded helion magn. moment to Bohr magneton ratio -1.158 671 474e-3 0.000 000 014e-3 +shielded helion magn. moment to nuclear magneton ratio -2.127 497 723 0.000 000 025 +shielded helion to proton magn. moment ratio -0.761 766 562 0.000 000 012 +shielded helion to shielded proton magn. moment ratio -0.761 786 1313 0.000 000 0033 +shielded helion gyromagn. ratio 2.037 894 70e8 0.000 000 18e8 s^-1 T^-1 +shielded helion gyromagn. ratio over 2 pi 32.434 1015 0.000 0028 MHz T^-1 +shielded proton magn. moment 1.410 570 47e-26 0.000 000 12e-26 J T^-1 +shielded proton magn. moment to Bohr magneton ratio 1.520 993 132e-3 0.000 000 016e-3 +shielded proton magn. moment to nuclear magneton ratio 2.792 775 604 0.000 000 030 +{220} lattice spacing of silicon 192.015 5965e-12 0.000 0070e-12 m""" + txt2006 = """lattice spacing of silicon 192.015 5762 e-12 0.000 0050 e-12 m alpha particle-electron mass ratio 7294.299 5365 0.000 0031 alpha particle mass 6.644 656 20 e-27 0.000 000 33 e-27 kg @@ -401,15 +462,23 @@ #parse into a dict physical_constants = {} -for line in txt2006.split('\n'): - name = line[:55].rstrip() - val = line[55:77].replace(' ','').replace('...','') - val = float(val) - uncert = line[77:99].replace(' ','').replace('(exact)', '0') - uncert = float(uncert) - units = line[99:].rstrip() - physical_constants[name] = (val, units, uncert) +def parse_constants(d): + for line in d.split('\n'): + name = line[:55].rstrip() + val = line[55:77].replace(' ','').replace('...','') + val = float(val) + uncert = line[77:99].replace(' ','').replace('(exact)', '0') + uncert = float(uncert) + units = line[99:].rstrip() + physical_constants[name] = (val, units, uncert) + +# These values should be deprecated in due course +parse_constants(txt2002) + +# This is the newest data-set +parse_constants(txt2006) + def value(key) : """ Value in physical_constants indexed by key Modified: branches/0.9.x/scipy/constants/tests/test_codata.py =================================================================== --- branches/0.9.x/scipy/constants/tests/test_codata.py 2011-01-24 23:40:30 UTC (rev 7085) +++ branches/0.9.x/scipy/constants/tests/test_codata.py 2011-01-25 11:13:49 UTC (rev 7086) @@ -1,7 +1,8 @@ import warnings from scipy.constants import constants, codata, find -from numpy.testing import assert_equal, assert_, run_module_suite +from numpy.testing import assert_equal, assert_, run_module_suite, \ + assert_almost_equal def test_find(): @@ -42,5 +43,9 @@ assert_equal(codata.find('Wien freq', disp=False)[0], 'Wien frequency displacement law constant') +def test_2002_vs_2006(): + assert_almost_equal(codata.value('magn. flux quantum'), + codata.value('mag. flux quantum')) + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Tue Jan 25 16:28:43 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 25 Jan 2011 15:28:43 -0600 (CST) Subject: [Scipy-svn] r7087 - in trunk/scipy/io/matlab: . tests tests/data Message-ID: <20110125212843.08CE037BBD8@scipy.org> Author: matthew.brett at gmail.com Date: 2011-01-25 15:28:41 -0600 (Tue, 25 Jan 2011) New Revision: 7087 Added: trunk/scipy/io/matlab/tests/data/one_by_zero_char.mat Modified: trunk/scipy/io/matlab/mio_utils.c trunk/scipy/io/matlab/mio_utils.pyx trunk/scipy/io/matlab/tests/test_mio.py Log: BF+TEST - fix read of empty char arrays with non-zero leading dimensions - thanks to Simon More Modified: trunk/scipy/io/matlab/mio_utils.c =================================================================== --- trunk/scipy/io/matlab/mio_utils.c 2011-01-25 11:13:49 UTC (rev 7086) +++ trunk/scipy/io/matlab/mio_utils.c 2011-01-25 21:28:41 UTC (rev 7087) @@ -1,4 +1,4 @@ -/* Generated by Cython 0.13 on Sat Sep 11 22:33:02 2010 */ +/* Generated by Cython 0.13 on Tue Jan 25 13:01:57 2011 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -775,9 +775,10 @@ static PyObject *__pyx_n_s__suboffsets; static PyObject *__pyx_n_s__type_num; static PyObject *__pyx_n_s__view; +static PyObject *__pyx_int_0; static PyObject *__pyx_int_15; -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":9 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":9 * * * cpdef size_t cproduct(tup): # <<<<<<<<<<<<<< @@ -796,7 +797,7 @@ size_t __pyx_t_4; __Pyx_RefNannySetupContext("cproduct"); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":10 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":10 * * cpdef size_t cproduct(tup): * cdef size_t res = 1 # <<<<<<<<<<<<<< @@ -805,7 +806,7 @@ */ __pyx_v_res = 1; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":12 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":12 * cdef size_t res = 1 * cdef int i * for i in range(len(tup)): # <<<<<<<<<<<<<< @@ -816,7 +817,7 @@ for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":13 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":13 * cdef int i * for i in range(len(tup)): * res *= tup[i] # <<<<<<<<<<<<<< @@ -830,7 +831,7 @@ __pyx_v_res *= __pyx_t_4; } - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":14 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":14 * for i in range(len(tup)): * res *= tup[i] * return res # <<<<<<<<<<<<<< @@ -851,7 +852,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":9 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":9 * * * cpdef size_t cproduct(tup): # <<<<<<<<<<<<<< @@ -884,7 +885,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":17 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":17 * * * cpdef object squeeze_element(cnp.ndarray arr): # <<<<<<<<<<<<<< @@ -904,7 +905,7 @@ __Pyx_RefNannySetupContext("squeeze_element"); __Pyx_INCREF((PyObject *)__pyx_v_arr); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":22 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":22 * The returned object may not be an ndarray - for example if we do * ``arr.item`` to return a ``mat_struct`` object from a struct array ''' * if not arr.size: # <<<<<<<<<<<<<< @@ -918,7 +919,7 @@ __pyx_t_3 = (!__pyx_t_2); if (__pyx_t_3) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":23 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":23 * ``arr.item`` to return a ``mat_struct`` object from a struct array ''' * if not arr.size: * return np.array([]) # <<<<<<<<<<<<<< @@ -949,7 +950,7 @@ } __pyx_L3:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":24 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":24 * if not arr.size: * return np.array([]) * arr = np.squeeze(arr) # <<<<<<<<<<<<<< @@ -975,7 +976,7 @@ __pyx_v_arr = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":25 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":25 * return np.array([]) * arr = np.squeeze(arr) * if not arr.shape and arr.dtype.isbuiltin: # 0d coverted to scalar # <<<<<<<<<<<<<< @@ -997,7 +998,7 @@ } if (__pyx_t_6) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":26 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":26 * arr = np.squeeze(arr) * if not arr.shape and arr.dtype.isbuiltin: # 0d coverted to scalar * return arr.item() # <<<<<<<<<<<<<< @@ -1017,7 +1018,7 @@ } __pyx_L4:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":27 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":27 * if not arr.shape and arr.dtype.isbuiltin: # 0d coverted to scalar * return arr.item() * return arr # <<<<<<<<<<<<<< @@ -1044,7 +1045,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":17 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":17 * * * cpdef object squeeze_element(cnp.ndarray arr): # <<<<<<<<<<<<<< @@ -1079,7 +1080,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":30 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":30 * * * cpdef cnp.ndarray chars_to_strings(in_arr): # <<<<<<<<<<<<<< @@ -1094,6 +1095,7 @@ npy_intp *__pyx_v_dims; npy_intp __pyx_v_last_dim; PyObject *__pyx_v_new_dt_str; + PyObject *__pyx_v_out_shape; PyArrayObject *__pyx_r = NULL; int __pyx_t_1; PyObject *__pyx_t_2 = NULL; @@ -1101,8 +1103,9 @@ PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("chars_to_strings"); __pyx_v_new_dt_str = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_out_shape = Py_None; __Pyx_INCREF(Py_None); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":44 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":44 * ``arr`` * ''' * cdef cnp.ndarray arr = in_arr # <<<<<<<<<<<<<< @@ -1113,7 +1116,7 @@ __Pyx_INCREF(__pyx_v_in_arr); __pyx_v_arr = ((PyArrayObject *)__pyx_v_in_arr); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":45 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":45 * ''' * cdef cnp.ndarray arr = in_arr * cdef int ndim = arr.ndim # <<<<<<<<<<<<<< @@ -1122,161 +1125,228 @@ */ __pyx_v_ndim = __pyx_v_arr->nd; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":46 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":46 * cdef cnp.ndarray arr = in_arr * cdef int ndim = arr.ndim * cdef cnp.npy_intp *dims = arr.shape # <<<<<<<<<<<<<< * cdef cnp.npy_intp last_dim = dims[ndim-1] - * cdef object new_dt_str + * cdef object new_dt_str, out_shape */ __pyx_v_dims = __pyx_v_arr->dimensions; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":47 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":47 * cdef int ndim = arr.ndim * cdef cnp.npy_intp *dims = arr.shape * cdef cnp.npy_intp last_dim = dims[ndim-1] # <<<<<<<<<<<<<< - * cdef object new_dt_str + * cdef object new_dt_str, out_shape * if last_dim == 0: # deal with empty array case */ __pyx_v_last_dim = (__pyx_v_dims[(__pyx_v_ndim - 1)]); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":49 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":49 * cdef cnp.npy_intp last_dim = dims[ndim-1] - * cdef object new_dt_str + * cdef object new_dt_str, out_shape * if last_dim == 0: # deal with empty array case # <<<<<<<<<<<<<< + * # Started with U1 - which is OK for us * new_dt_str = arr.dtype.str - * else: # make new dtype string with N appended */ __pyx_t_1 = (__pyx_v_last_dim == 0); if (__pyx_t_1) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":50 - * cdef object new_dt_str + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":51 * if last_dim == 0: # deal with empty array case + * # Started with U1 - which is OK for us * new_dt_str = arr.dtype.str # <<<<<<<<<<<<<< - * else: # make new dtype string with N appended - * new_dt_str = arr.dtype.str[:-1] + str(last_dim) + * # So far we only know this is an empty array and that the last length is + * # 0. The other dimensions could be non-zero. We set the next to last */ - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__str); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__str); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_v_new_dt_str); __pyx_v_new_dt_str = __pyx_t_3; __pyx_t_3 = 0; + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":55 + * # 0. The other dimensions could be non-zero. We set the next to last + * # dimension to zero to signal emptiness + * if ndim == 2: # <<<<<<<<<<<<<< + * out_shape = (0,) + * else: + */ + __pyx_t_1 = (__pyx_v_ndim == 2); + if (__pyx_t_1) { + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":56 + * # dimension to zero to signal emptiness + * if ndim == 2: + * out_shape = (0,) # <<<<<<<<<<<<<< + * else: + * out_shape = in_arr.shape[:-2] + (0,) + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_DECREF(__pyx_v_out_shape); + __pyx_v_out_shape = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L4; + } + /*else*/ { + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":58 + * out_shape = (0,) + * else: + * out_shape = in_arr.shape[:-2] + (0,) # <<<<<<<<<<<<<< + * else: # make new dtype string with N appended + * new_dt_str = arr.dtype.str[:-1] + str(last_dim) + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_in_arr, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PySequence_GetSlice(__pyx_t_3, 0, -2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_out_shape); + __pyx_v_out_shape = __pyx_t_4; + __pyx_t_4 = 0; + } + __pyx_L4:; goto __pyx_L3; } /*else*/ { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":52 - * new_dt_str = arr.dtype.str + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":60 + * out_shape = in_arr.shape[:-2] + (0,) * else: # make new dtype string with N appended * new_dt_str = arr.dtype.str[:-1] + str(last_dim) # <<<<<<<<<<<<<< + * out_shape = in_arr.shape[:-1] * # Copy to deal with F ordered arrays - * arr = np.ascontiguousarray(arr) */ - __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__dtype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__str); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__str); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PySequence_GetSlice(__pyx_t_3, 0, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PySequence_GetSlice(__pyx_t_2, 0, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_last_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_last_dim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_new_dt_str); + __pyx_v_new_dt_str = __pyx_t_2; __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":61 + * else: # make new dtype string with N appended + * new_dt_str = arr.dtype.str[:-1] + str(last_dim) + * out_shape = in_arr.shape[:-1] # <<<<<<<<<<<<<< + * # Copy to deal with F ordered arrays + * arr = np.ascontiguousarray(arr) + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_in_arr, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PySequence_GetSlice(__pyx_t_2, 0, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_v_new_dt_str); - __pyx_v_new_dt_str = __pyx_t_4; - __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_out_shape); + __pyx_v_out_shape = __pyx_t_3; + __pyx_t_3 = 0; } __pyx_L3:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":54 - * new_dt_str = arr.dtype.str[:-1] + str(last_dim) + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":63 + * out_shape = in_arr.shape[:-1] * # Copy to deal with F ordered arrays * arr = np.ascontiguousarray(arr) # <<<<<<<<<<<<<< * arr = arr.view(new_dt_str) - * return arr.reshape(in_arr.shape[:-1]) + * return arr.reshape(out_shape) */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_arr)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_arr)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_arr)); __Pyx_GIVEREF(((PyObject *)__pyx_v_arr)); - __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_arr)); - __pyx_v_arr = ((PyArrayObject *)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_v_arr = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":55 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":64 * # Copy to deal with F ordered arrays * arr = np.ascontiguousarray(arr) * arr = arr.view(new_dt_str) # <<<<<<<<<<<<<< - * return arr.reshape(in_arr.shape[:-1]) + * return arr.reshape(out_shape) */ - __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__view); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__view); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_new_dt_str); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_new_dt_str); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_new_dt_str); __Pyx_GIVEREF(__pyx_v_new_dt_str); - __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_arr)); __pyx_v_arr = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":56 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":65 * arr = np.ascontiguousarray(arr) * arr = arr.view(new_dt_str) - * return arr.reshape(in_arr.shape[:-1]) # <<<<<<<<<<<<<< + * return arr.reshape(out_shape) # <<<<<<<<<<<<<< */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__reshape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__reshape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyObject_GetAttr(__pyx_v_in_arr, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PySequence_GetSlice(__pyx_t_4, 0, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_out_shape); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_out_shape); + __Pyx_GIVEREF(__pyx_v_out_shape); + __pyx_t_4 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((PyArrayObject *)__pyx_t_3); - __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; goto __pyx_L0; __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); @@ -1290,12 +1360,13 @@ __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_arr); __Pyx_DECREF(__pyx_v_new_dt_str); + __Pyx_DECREF(__pyx_v_out_shape); __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":30 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":30 * * * cpdef cnp.ndarray chars_to_strings(in_arr): # <<<<<<<<<<<<<< @@ -1304,7 +1375,7 @@ */ static PyObject *__pyx_pf_5scipy_2io_6matlab_9mio_utils_chars_to_strings(PyObject *__pyx_self, PyObject *__pyx_v_in_arr); /*proto*/ -static char __pyx_doc_5scipy_2io_6matlab_9mio_utils_chars_to_strings[] = " Convert final axis of char array to strings\n\n Parameters\n ----------\n in_arr : array\n dtype of 'U1'\n \n Returns\n -------\n str_arr : array\n dtype of 'UN' where N is the length of the last dimension of\n ``arr``\n "; +static char __pyx_doc_5scipy_2io_6matlab_9mio_utils_chars_to_strings[] = " Convert final axis of char array to strings\n\n Parameters\n ----------\n in_arr : array\n dtype of 'U1'\n\n Returns\n -------\n str_arr : array\n dtype of 'UN' where N is the length of the last dimension of\n ``arr``\n "; static PyObject *__pyx_pf_5scipy_2io_6matlab_9mio_utils_chars_to_strings(PyObject *__pyx_self, PyObject *__pyx_v_in_arr) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; @@ -1329,7 +1400,7 @@ return __pyx_r; } -/* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":188 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":188 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -1364,7 +1435,7 @@ __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":194 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":194 * # of flags * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -1373,7 +1444,7 @@ */ __pyx_v_endian_detector = 1; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":195 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":195 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -1382,7 +1453,7 @@ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":197 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":197 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< @@ -1391,7 +1462,7 @@ */ __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":199 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":199 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -1401,7 +1472,7 @@ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":200 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":200 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -1413,7 +1484,7 @@ } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":202 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":202 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -1424,7 +1495,7 @@ } __pyx_L5:; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":204 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":204 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -1434,7 +1505,7 @@ __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":205 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":205 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -1448,7 +1519,7 @@ } if (__pyx_t_3) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":206 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":206 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< @@ -1470,7 +1541,7 @@ } __pyx_L6:; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":208 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":208 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -1480,7 +1551,7 @@ __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":209 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":209 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -1494,7 +1565,7 @@ } if (__pyx_t_2) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":210 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":210 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< @@ -1516,7 +1587,7 @@ } __pyx_L7:; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":212 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":212 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< @@ -1525,7 +1596,7 @@ */ __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":213 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":213 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -1534,7 +1605,7 @@ */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":214 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":214 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< @@ -1543,7 +1614,7 @@ */ if (__pyx_v_copy_shape) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":217 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":217 * # Allocate new buffer for strides and shape info. This is allocated * # as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< @@ -1552,7 +1623,7 @@ */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":218 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":218 * # as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< @@ -1561,7 +1632,7 @@ */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":219 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":219 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< @@ -1572,7 +1643,7 @@ for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { __pyx_v_i = __pyx_t_7; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":220 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":220 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< @@ -1581,7 +1652,7 @@ */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":221 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":221 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< @@ -1594,7 +1665,7 @@ } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":223 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":223 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< @@ -1603,7 +1674,7 @@ */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":224 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":224 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< @@ -1614,7 +1685,7 @@ } __pyx_L8:; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":225 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":225 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -1623,7 +1694,7 @@ */ __pyx_v_info->suboffsets = NULL; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":226 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":226 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< @@ -1632,7 +1703,7 @@ */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":227 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":227 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< @@ -1641,7 +1712,7 @@ */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":230 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":230 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -1650,7 +1721,7 @@ */ __pyx_v_f = NULL; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":231 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":231 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< @@ -1660,7 +1731,7 @@ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":235 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":235 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -1669,7 +1740,7 @@ */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":237 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":237 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -1685,7 +1756,7 @@ } if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":239 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":239 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -1701,7 +1772,7 @@ } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":242 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":242 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< @@ -1716,7 +1787,7 @@ } __pyx_L11:; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":244 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":244 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< @@ -1726,7 +1797,7 @@ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":245 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":245 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< @@ -1735,7 +1806,7 @@ */ __pyx_v_t = __pyx_v_descr->type_num; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":246 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":246 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< @@ -1750,7 +1821,7 @@ } if (!__pyx_t_2) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":247 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":247 * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< @@ -1770,7 +1841,7 @@ } if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":248 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":248 * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< @@ -1792,7 +1863,7 @@ } __pyx_L13:; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":249 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":249 * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< @@ -1805,7 +1876,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":250 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":250 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -1818,7 +1889,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":251 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":251 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -1831,7 +1902,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":252 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":252 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -1844,7 +1915,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":253 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":253 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -1857,7 +1928,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":254 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":254 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -1870,7 +1941,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":255 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":255 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -1883,7 +1954,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":256 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":256 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -1896,7 +1967,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":257 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":257 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -1909,7 +1980,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":258 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":258 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -1922,7 +1993,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":259 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":259 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -1935,7 +2006,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":260 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":260 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -1948,7 +2019,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":261 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":261 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -1961,7 +2032,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":262 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":262 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -1974,7 +2045,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":263 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":263 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -1987,7 +2058,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":264 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":264 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -2000,7 +2071,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":265 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":265 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -2014,7 +2085,7 @@ } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":267 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":267 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< @@ -2040,7 +2111,7 @@ } __pyx_L14:; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":268 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":268 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -2049,7 +2120,7 @@ */ __pyx_v_info->format = __pyx_v_f; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":269 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":269 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -2062,7 +2133,7 @@ } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":271 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":271 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< @@ -2071,7 +2142,7 @@ */ __pyx_v_info->format = ((char *)malloc(255)); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":272 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":272 * else: * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< @@ -2080,7 +2151,7 @@ */ (__pyx_v_info->format[0]) = '^'; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":273 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":273 * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< @@ -2089,7 +2160,7 @@ */ __pyx_v_offset = 0; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":276 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":276 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< @@ -2099,7 +2170,7 @@ __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":277 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":277 * info.format + _buffer_format_string_len, * &offset) * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< @@ -2131,7 +2202,7 @@ return __pyx_r; } -/* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":279 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":279 * f[0] = 0 # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< @@ -2144,7 +2215,7 @@ int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__"); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":280 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":280 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< @@ -2154,7 +2225,7 @@ __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":281 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":281 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -2166,7 +2237,7 @@ } __pyx_L5:; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":282 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":282 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -2176,7 +2247,7 @@ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":283 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":283 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -2191,7 +2262,7 @@ __Pyx_RefNannyFinishContext(); } -/* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":756 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":756 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -2204,7 +2275,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":757 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":757 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -2230,7 +2301,7 @@ return __pyx_r; } -/* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":759 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":759 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -2243,7 +2314,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":760 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":760 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -2269,7 +2340,7 @@ return __pyx_r; } -/* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":762 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":762 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -2282,7 +2353,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":763 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":763 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -2308,7 +2379,7 @@ return __pyx_r; } -/* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":765 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":765 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -2321,7 +2392,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":766 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":766 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -2347,7 +2418,7 @@ return __pyx_r; } -/* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":768 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":768 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -2360,7 +2431,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":769 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -2386,7 +2457,7 @@ return __pyx_r; } -/* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":771 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":771 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -2420,7 +2491,7 @@ __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":778 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":778 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -2429,7 +2500,7 @@ */ __pyx_v_endian_detector = 1; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":779 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":779 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -2438,7 +2509,7 @@ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":782 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":782 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -2457,7 +2528,7 @@ __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":783 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":783 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< @@ -2471,7 +2542,7 @@ __pyx_v_fields = ((PyObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":784 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":784 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -2494,7 +2565,7 @@ {__pyx_filename = __pyx_f[1]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":786 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":786 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< @@ -2519,7 +2590,7 @@ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":787 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":787 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< @@ -2541,7 +2612,7 @@ } __pyx_L5:; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":789 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":789 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< @@ -2556,7 +2627,7 @@ } if (!__pyx_t_7) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":790 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":790 * * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< @@ -2576,7 +2647,7 @@ } if (__pyx_t_6) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":791 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":791 * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< @@ -2598,7 +2669,7 @@ } __pyx_L6:; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":801 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":801 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -2615,7 +2686,7 @@ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_6) break; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":802 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":802 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -2624,7 +2695,7 @@ */ (__pyx_v_f[0]) = 120; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":803 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":803 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -2633,7 +2704,7 @@ */ __pyx_v_f += 1; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":804 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":804 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< @@ -2643,7 +2714,7 @@ (__pyx_v_offset[0]) += 1; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":806 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":806 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< @@ -2652,7 +2723,7 @@ */ (__pyx_v_offset[0]) += __pyx_v_child->elsize; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":808 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":808 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< @@ -2662,7 +2733,7 @@ __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); if (__pyx_t_6) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":809 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":809 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< @@ -2675,7 +2746,7 @@ __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":810 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":810 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< @@ -2685,7 +2756,7 @@ __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); if (__pyx_t_6) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":811 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":811 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< @@ -2707,7 +2778,7 @@ } __pyx_L10:; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":814 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":814 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< @@ -2726,7 +2797,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":815 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":815 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< @@ -2745,7 +2816,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":816 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":816 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< @@ -2764,7 +2835,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":817 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":817 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< @@ -2783,7 +2854,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":818 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":818 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< @@ -2802,7 +2873,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":819 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":819 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< @@ -2821,7 +2892,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":820 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":820 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< @@ -2840,7 +2911,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":821 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":821 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< @@ -2859,7 +2930,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":822 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":822 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< @@ -2878,7 +2949,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":823 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":823 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< @@ -2897,7 +2968,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":824 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":824 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< @@ -2916,7 +2987,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":825 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":825 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< @@ -2935,7 +3006,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":826 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":826 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< @@ -2954,7 +3025,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":827 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":827 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< @@ -2975,7 +3046,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":828 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":828 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< @@ -2996,7 +3067,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":829 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":829 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< @@ -3017,7 +3088,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":830 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":830 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< @@ -3037,7 +3108,7 @@ } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":832 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":832 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< @@ -3060,7 +3131,7 @@ } __pyx_L11:; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":833 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":833 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -3072,7 +3143,7 @@ } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":837 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":837 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< @@ -3086,7 +3157,7 @@ } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":838 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":838 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -3115,7 +3186,7 @@ return __pyx_r; } -/* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":953 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":953 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -3128,7 +3199,7 @@ int __pyx_t_1; __Pyx_RefNannySetupContext("set_array_base"); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":955 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":955 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -3138,7 +3209,7 @@ __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":956 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":956 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -3150,7 +3221,7 @@ } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":958 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":958 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -3159,7 +3230,7 @@ */ Py_INCREF(__pyx_v_base); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":959 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":959 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -3170,7 +3241,7 @@ } __pyx_L3:; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":960 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":960 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -3179,7 +3250,7 @@ */ Py_XDECREF(__pyx_v_arr->base); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":961 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":961 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -3191,7 +3262,7 @@ __Pyx_RefNannyFinishContext(); } -/* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":963 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":963 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -3204,7 +3275,7 @@ int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base"); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":964 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":964 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -3214,7 +3285,7 @@ __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":965 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":965 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -3229,7 +3300,7 @@ } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":967 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":967 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -3325,6 +3396,7 @@ static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; @@ -3397,7 +3469,7 @@ /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":5 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":5 * ''' * * import numpy as np # <<<<<<<<<<<<<< @@ -3409,7 +3481,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio_utils.pyx":1 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":1 * # -*- python -*- like file # <<<<<<<<<<<<<< * ''' Utilities for generic processing of return arrays from read * ''' @@ -3433,7 +3505,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":963 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":963 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< Modified: trunk/scipy/io/matlab/mio_utils.pyx =================================================================== --- trunk/scipy/io/matlab/mio_utils.pyx 2011-01-25 11:13:49 UTC (rev 7086) +++ trunk/scipy/io/matlab/mio_utils.pyx 2011-01-25 21:28:41 UTC (rev 7087) @@ -12,8 +12,8 @@ for i in range(len(tup)): res *= tup[i] return res - + cpdef object squeeze_element(cnp.ndarray arr): ''' Return squeezed element @@ -34,7 +34,7 @@ ---------- in_arr : array dtype of 'U1' - + Returns ------- str_arr : array @@ -45,12 +45,21 @@ cdef int ndim = arr.ndim cdef cnp.npy_intp *dims = arr.shape cdef cnp.npy_intp last_dim = dims[ndim-1] - cdef object new_dt_str + cdef object new_dt_str, out_shape if last_dim == 0: # deal with empty array case + # Started with U1 - which is OK for us new_dt_str = arr.dtype.str + # So far we only know this is an empty array and that the last length is + # 0. The other dimensions could be non-zero. We set the next to last + # dimension to zero to signal emptiness + if ndim == 2: + out_shape = (0,) + else: + out_shape = in_arr.shape[:-2] + (0,) else: # make new dtype string with N appended new_dt_str = arr.dtype.str[:-1] + str(last_dim) + out_shape = in_arr.shape[:-1] # Copy to deal with F ordered arrays arr = np.ascontiguousarray(arr) arr = arr.view(new_dt_str) - return arr.reshape(in_arr.shape[:-1]) + return arr.reshape(out_shape) Added: trunk/scipy/io/matlab/tests/data/one_by_zero_char.mat =================================================================== --- trunk/scipy/io/matlab/tests/data/one_by_zero_char.mat (rev 0) +++ trunk/scipy/io/matlab/tests/data/one_by_zero_char.mat 2011-01-25 21:28:41 UTC (rev 7087) @@ -0,0 +1 @@ +MATLAB 5.0 MAT-file, written by Octave 3.2.3, 2011-01-25 19:30:48 UTC IM0var \ No newline at end of file Modified: trunk/scipy/io/matlab/tests/test_mio.py =================================================================== --- trunk/scipy/io/matlab/tests/test_mio.py 2011-01-25 11:13:49 UTC (rev 7086) +++ trunk/scipy/io/matlab/tests/test_mio.py 2011-01-25 21:28:41 UTC (rev 7087) @@ -875,5 +875,13 @@ assert_array_equal(res[name], exp_res) +def test_one_by_zero(): + ''' Test 1x0 chars get read correctly ''' + func_eg = pjoin(test_data_path, 'one_by_zero_char.mat') + rdr = MatFile5Reader_future(open(func_eg, 'rb')) + d = rdr.get_variables() + assert_equal(d['var'].shape, (0,)) + + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Wed Jan 26 18:06:55 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 26 Jan 2011 17:06:55 -0600 (CST) Subject: [Scipy-svn] r7088 - in trunk/scipy/linalg: . tests Message-ID: <20110126230655.10B233236A@scipy.org> Author: ptvirtan Date: 2011-01-26 17:06:53 -0600 (Wed, 26 Jan 2011) New Revision: 7088 Modified: trunk/scipy/linalg/decomp_qr.py trunk/scipy/linalg/generic_flapack.pyf trunk/scipy/linalg/tests/test_decomp.py Log: ENH: improvements for linalg.rq - API: now uses the same keywords as linalg.qr : implemented mode='economic' - type support: now supports non-square as well as complex arrays. This way I could uncomment a lot of tests. - performance: now uses LAPACK orgrq for computing the Q matrix instead of plain matrix multiplications. On a 500 x 500 array in my Core Duo, this makes it go from 17.6s s to 0.16s, i.e. gain of a 100x factor. - Also, some docstring fixes in both linalg.qr and linalg.rq. Thanks to Fabian Pedregosa for the patch. Modified: trunk/scipy/linalg/decomp_qr.py =================================================================== --- trunk/scipy/linalg/decomp_qr.py 2011-01-25 21:28:41 UTC (rev 7087) +++ trunk/scipy/linalg/decomp_qr.py 2011-01-26 23:06:53 UTC (rev 7088) @@ -1,9 +1,7 @@ """QR decomposition functions.""" -from warnings import warn - import numpy -from numpy import asarray_chkfinite, complexfloating +from numpy import asarray_chkfinite # Local imports import special_matrices @@ -52,17 +50,16 @@ Examples -------- - >>> from scipy import random, linalg, dot + >>> from scipy import random, linalg, dot, allclose >>> a = random.randn(9, 6) >>> q, r = linalg.qr(a) >>> allclose(a, dot(q, r)) True >>> q.shape, r.shape ((9, 9), (9, 6)) - >>> r2 = linalg.qr(a, mode='r') >>> allclose(r, r2) - + True >>> q3, r3 = linalg.qr(a, mode='economic') >>> q3.shape, r3.shape ((9, 6), (6, 6)) @@ -185,7 +182,7 @@ return Q, R -def rq(a, overwrite_a=False, lwork=None): +def rq(a, overwrite_a=False, lwork=None, mode='full'): """Compute RQ decomposition of a square real matrix. Calculate the decomposition :lm:`A = R Q` where Q is unitary/orthogonal @@ -194,12 +191,16 @@ Parameters ---------- a : array, shape (M, M) - Square real matrix to be decomposed + Matrix to be decomposed overwrite_a : boolean Whether data in a is overwritten (may improve performance) lwork : integer Work array size, lwork >= a.shape[1]. If None or -1, an optimal size is computed. + mode : {'full', 'r', 'economic'} + Determines what information is to be returned: either both Q and R + ('full', default), only R ('r') or both Q and R but computed in + economy-size ('economic', see Notes). Returns ------- @@ -208,17 +209,34 @@ Raises LinAlgError if decomposition fails + Examples + -------- + >>> from scipy import linalg + >>> from numpy import random, dot, allclose + >>> a = random.randn(6, 9) + >>> r, q = linalg.rq(a) + >>> allclose(a, dot(r, q)) + True + >>> r.shape, q.shape + ((6, 9), (9, 9)) + >>> r2 = linalg.rq(a, mode='r') + >>> allclose(r, r2) + True + >>> r3, q3 = linalg.rq(a, mode='economic') + >>> r3.shape, q3.shape + ((6, 6), (6, 9)) + """ - # TODO: implement support for non-square and complex arrays + if not mode in ['full', 'r', 'economic']: + raise ValueError(\ + "Mode argument should be one of ['full', 'r', 'economic']") + a1 = asarray_chkfinite(a) if len(a1.shape) != 2: raise ValueError('expected matrix') - M,N = a1.shape - if M != N: - raise ValueError('expected square matrix') - if issubclass(a1.dtype.type, complexfloating): - raise ValueError('expected real (non-complex) matrix') + M, N = a1.shape overwrite_a = overwrite_a or (_datanotshared(a1, a)) + gerqf, = get_lapack_funcs(('gerqf',), (a1,)) if lwork is None or lwork == -1: # get optimal work array @@ -226,20 +244,40 @@ lwork = work[0].real.astype(numpy.int) rq, tau, work, info = gerqf(a1, lwork=lwork, overwrite_a=overwrite_a) if info < 0: - raise ValueError('illegal value in %d-th argument of internal geqrf' + raise ValueError('illegal value in %d-th argument of internal gerqf' % -info) - gemm, = get_blas_funcs(('gemm',), (rq,)) - t = rq.dtype.char - R = special_matrices.triu(rq) - Q = numpy.identity(M, dtype=t) - ident = numpy.identity(M, dtype=t) - zeros = numpy.zeros + if not mode == 'economic' or N < M: + R = special_matrices.triu(rq, N-M) + else: + R = special_matrices.triu(rq[-M:, -M:]) - k = min(M, N) - for i in range(k): - v = zeros((M,), t) - v[N-k+i] = 1 - v[0:N-k+i] = rq[M-k+i, 0:N-k+i] - H = gemm(-tau[i], v, v, 1+0j, ident, trans_b=2) - Q = gemm(1, Q, H) + if mode == 'r': + return R + + if find_best_lapack_type((a1,))[0] in ('s', 'd'): + gor_un_grq, = get_lapack_funcs(('orgrq',), (rq,)) + else: + gor_un_grq, = get_lapack_funcs(('ungrq',), (rq,)) + + if N < M: + # get optimal work array + Q, work, info = gor_un_grq(rq[-N:], tau, lwork=-1, overwrite_a=1) + lwork = work[0].real.astype(numpy.int) + Q, work, info = gor_un_grq(rq[-N:], tau, lwork=lwork, overwrite_a=1) + elif mode == 'economic': + # get optimal work array + Q, work, info = gor_un_grq(rq, tau, lwork=-1, overwrite_a=1) + lwork = work[0].real.astype(numpy.int) + Q, work, info = gor_un_grq(rq, tau, lwork=lwork, overwrite_a=1) + else: + rq1 = numpy.empty((N, N), dtype=rq.dtype) + rq1[-M:] = rq + # get optimal work array + Q, work, info = gor_un_grq(rq1, tau, lwork=-1, overwrite_a=1) + lwork = work[0].real.astype(numpy.int) + Q, work, info = gor_un_grq(rq1, tau, lwork=lwork, overwrite_a=1) + + if info < 0: + raise ValueError("illegal value in %d-th argument of internal orgrq" + % -info) return R, Q Modified: trunk/scipy/linalg/generic_flapack.pyf =================================================================== --- trunk/scipy/linalg/generic_flapack.pyf 2011-01-25 21:28:41 UTC (rev 7087) +++ trunk/scipy/linalg/generic_flapack.pyf 2011-01-26 23:06:53 UTC (rev 7088) @@ -573,7 +573,50 @@ dimension(MAX(lwork,1)),intent(out),depend(lwork) :: work integer intent(out) :: info end subroutine ungqr -+ + + subroutine orgrq(m,n,k,a,tau,work,lwork,info) + + ! q,work,info = orgrq(a,lwork=3*n,overwrite_a=0) + ! Generates an M-by-N real matrix Q with orthonormal columns, + ! which is defined as the first N columns of a product of K elementary + ! reflectors of order M (e.g. output of gerqf) + + callstatement (*f2py_func)(&m,&n,&k,a,&m,tau,work,&lwork,&info) + callprotoargument int*,int*,int*,*,int*,*,*,int*,int* + + integer intent(hide),depend(a):: m = shape(a,0) + integer intent(hide),depend(a):: n = shape(a,1) + integer intent(hide),depend(tau):: k = shape(tau,0) + dimension(m,n),intent(in,out,copy,out=q) :: a + dimension(k),intent(in) :: tau + + integer optional,intent(in),depend(n),check(lwork>=n||lwork==-1) :: lwork=3*n + dimension(MAX(lwork,1)),intent(out),depend(lwork) :: work + integer intent(out) :: info + end subroutine orgrq + + subroutine ungrq(m,n,k,a,tau,work,lwork,info) + + ! q,work,info = ungrq(a,lwork=3*n,overwrite_a=0) + ! Generates an M-by-N complex matrix Q with unitary columns, + ! which is defined as the first N columns of a product of K elementary + ! reflectors of order M (e.g. output of gerqf) + + callstatement (*f2py_func)(&m,&n,&k,a,&m,tau,work,&lwork,&info) + callprotoargument int*,int*,int*,*,int*,*,*,int*,int* + + integer intent(hide),depend(a):: m = shape(a,0) + integer intent(hide),depend(a):: n = shape(a,1) + integer intent(hide),depend(tau):: k = shape(tau,0) + dimension(m,n),intent(in,out,copy,out=q) :: a + dimension(k),intent(in) :: tau + + integer optional,intent(in),depend(n),check(lwork>=n||lwork==-1) :: lwork=3*n + dimension(MAX(lwork,1)),intent(out),depend(lwork) :: work + integer intent(out) :: info + end subroutine ungrq + + subroutine geev(compute_vl,compute_vr,n,a,wr,wi,vl,ldvl,vr,ldvr,work,lwork,info) ! wr,wi,vl,vr,info = geev(a,compute_vl=1,compute_vr=1,lwork=4*n,overwrite_a=0) Modified: trunk/scipy/linalg/tests/test_decomp.py =================================================================== --- trunk/scipy/linalg/tests/test_decomp.py 2011-01-25 21:28:41 UTC (rev 7087) +++ trunk/scipy/linalg/tests/test_decomp.py 2011-01-26 23:06:53 UTC (rev 7088) @@ -919,7 +919,7 @@ def test_simple(self): a = [[8,2,3],[2,9,3],[5,3,6]] r,q = rq(a) - assert_array_almost_equal(dot(transpose(q),q),identity(3)) + assert_array_almost_equal(dot(q, transpose(q)),identity(3)) assert_array_almost_equal(dot(r,q),a) def test_random(self): @@ -927,54 +927,63 @@ for k in range(2): a = random([n,n]) r,q = rq(a) - assert_array_almost_equal(dot(transpose(q),q),identity(n)) + assert_array_almost_equal(dot(q, transpose(q)),identity(n)) assert_array_almost_equal(dot(r,q),a) -# TODO: implement support for non-square and complex arrays + def test_simple_trap(self): + a = [[8,2,3],[2,9,3]] + r,q = rq(a) + assert_array_almost_equal(dot(transpose(q),q),identity(3)) + assert_array_almost_equal(dot(r,q),a) -## def test_simple_trap(self): -## a = [[8,2,3],[2,9,3]] -## r,q = rq(a) -## assert_array_almost_equal(dot(transpose(q),q),identity(2)) -## assert_array_almost_equal(dot(r,q),a) + def test_simple_tall(self): + a = [[8,2],[2,9],[5,3]] + r,q = rq(a) + assert_array_almost_equal(dot(transpose(q),q),identity(2)) + assert_array_almost_equal(dot(r,q),a) -## def test_simple_tall(self): -## a = [[8,2],[2,9],[5,3]] -## r,q = rq(a) -## assert_array_almost_equal(dot(transpose(q),q),identity(3)) -## assert_array_almost_equal(dot(r,q),a) + def test_simple_complex(self): + a = [[3,3+4j,5],[5,2,2+7j],[3,2,7]] + r,q = rq(a) + assert_array_almost_equal(dot(q, conj(transpose(q))),identity(3)) + assert_array_almost_equal(dot(r,q),a) -## def test_simple_complex(self): -## a = [[3,3+4j,5],[5,2,2+7j],[3,2,7]] -## r,q = rq(a) -## assert_array_almost_equal(dot(conj(transpose(q)),q),identity(3)) -## assert_array_almost_equal(dot(r,q),a) + def test_random_tall(self): + m = 200 + n = 100 + for k in range(2): + a = random([m,n]) + r,q = rq(a) + assert_array_almost_equal(dot(q, transpose(q)),identity(n)) + assert_array_almost_equal(dot(r,q),a) -## def test_random_tall(self): -## m = 200 -## n = 100 -## for k in range(2): -## a = random([m,n]) -## r,q = rq(a) -## assert_array_almost_equal(dot(transpose(q),q),identity(m)) -## assert_array_almost_equal(dot(r,q),a) + def test_random_trap(self): + m = 100 + n = 200 + for k in range(2): + a = random([m,n]) + r,q = rq(a) + assert_array_almost_equal(dot(q, transpose(q)),identity(n)) + assert_array_almost_equal(dot(r,q),a) -## def test_random_trap(self): -## m = 100 -## n = 200 -## for k in range(2): -## a = random([m,n]) -## r,q = rq(a) -## assert_array_almost_equal(dot(transpose(q),q),identity(m)) -## assert_array_almost_equal(dot(r,q),a) + def test_random_trap_economic(self): + m = 100 + n = 200 + for k in range(2): + a = random([m,n]) + r,q = rq(a, mode='economic') + assert_array_almost_equal(dot(q,transpose(q)),identity(m)) + assert_array_almost_equal(dot(r,q),a) + assert_equal(q.shape, (m, n)) + assert_equal(r.shape, (m, m)) -## def test_random_complex(self): -## n = 20 -## for k in range(2): -## a = random([n,n])+1j*random([n,n]) -## r,q = rq(a) -## assert_array_almost_equal(dot(conj(transpose(q)),q),identity(n)) -## assert_array_almost_equal(dot(r,q),a) + def test_random_complex(self): + n = 20 + for k in range(2): + a = random([n,n])+1j*random([n,n]) + r,q = rq(a) + assert_array_almost_equal(dot(q, conj(transpose(q))),identity(n)) + assert_array_almost_equal(dot(r,q),a) transp = transpose any = sometrue From scipy-svn at scipy.org Wed Jan 26 18:07:11 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 26 Jan 2011 17:07:11 -0600 (CST) Subject: [Scipy-svn] r7089 - trunk/scipy/linalg/tests Message-ID: <20110126230711.5CEC73236A@scipy.org> Author: ptvirtan Date: 2011-01-26 17:07:09 -0600 (Wed, 26 Jan 2011) New Revision: 7089 Modified: trunk/scipy/linalg/tests/test_decomp.py Log: TST: linalg: add some new tests for qr and rq, and initialize random seeds Modified: trunk/scipy/linalg/tests/test_decomp.py =================================================================== --- trunk/scipy/linalg/tests/test_decomp.py 2011-01-26 23:06:53 UTC (rev 7088) +++ trunk/scipy/linalg/tests/test_decomp.py 2011-01-26 23:07:09 UTC (rev 7089) @@ -30,7 +30,7 @@ asarray, matrix, isfinite, all, ndarray, outer, eye, dtype, empty,\ triu, tril -from numpy.random import rand, normal +from numpy.random import rand, normal, seed # digit precision to use in asserts for different types DIGITS = {'d':11, 'D':11, 'f':4, 'F':4} @@ -703,6 +703,9 @@ self.cmed = self.vrect.astype(complex64) class TestLUSolve(TestCase): + def setUp(self): + seed(1234) + def test_lu(self): a = random((10,10)) b = random((10,)) @@ -715,6 +718,8 @@ assert_array_equal(x1,x2) class TestSVD(TestCase): + def setUp(self): + seed(1234) def test_simple(self): a = [[1,2,3],[1,20,3],[2,5,6]] @@ -833,6 +838,9 @@ class TestQR(TestCase): + def setUp(self): + seed(1234) + def test_simple(self): a = [[8,2,3],[2,9,3],[5,3,6]] q,r = qr(a) @@ -861,6 +869,24 @@ assert_equal(q.shape, (3,2)) assert_equal(r.shape, (2,2)) + def test_simple_fat(self): + # full version + a = [[8,2,5],[2,9,3]] + q,r = qr(a) + assert_array_almost_equal(dot(transpose(q),q),identity(2)) + assert_array_almost_equal(dot(q,r),a) + assert_equal(q.shape, (2,2)) + assert_equal(r.shape, (2,3)) + + def test_simple_fat_e(self): + # economy version + a = [[8,2,3],[2,9,5]] + q,r = qr(a, mode='economic') + assert_array_almost_equal(dot(transpose(q),q),identity(2)) + assert_array_almost_equal(dot(q,r),a) + assert_equal(q.shape, (2,2)) + assert_equal(r.shape, (2,3)) + def test_simple_complex(self): a = [[3,3+4j,5],[5,2,2+7j],[3,2,7]] q,r = qr(a) @@ -916,12 +942,21 @@ class TestRQ(TestCase): + def setUp(self): + seed(1234) + def test_simple(self): a = [[8,2,3],[2,9,3],[5,3,6]] r,q = rq(a) assert_array_almost_equal(dot(q, transpose(q)),identity(3)) assert_array_almost_equal(dot(r,q),a) + def test_r(self): + a = [[8,2,3],[2,9,3],[5,3,6]] + r,q = rq(a) + r2 = rq(a, mode='r') + assert_array_almost_equal(r, r2) + def test_random(self): n = 20 for k in range(2): @@ -942,6 +977,12 @@ assert_array_almost_equal(dot(transpose(q),q),identity(2)) assert_array_almost_equal(dot(r,q),a) + def test_simple_fat(self): + a = [[8,2,5],[2,9,3]] + r,q = rq(a) + assert_array_almost_equal(dot(transpose(q),q),identity(3)) + assert_array_almost_equal(dot(r,q),a) + def test_simple_complex(self): a = [[3,3+4j,5],[5,2,2+7j],[3,2,7]] r,q = rq(a) @@ -985,6 +1026,17 @@ assert_array_almost_equal(dot(q, conj(transpose(q))),identity(n)) assert_array_almost_equal(dot(r,q),a) + def test_random_complex_economic(self): + m = 100 + n = 200 + for k in range(2): + a = random([m,n])+1j*random([m,n]) + r,q = rq(a, mode='economic') + assert_array_almost_equal(dot(q,conj(transpose(q))),identity(m)) + assert_array_almost_equal(dot(r,q),a) + assert_equal(q.shape, (m, n)) + assert_equal(r.shape, (m, m)) + transp = transpose any = sometrue From scipy-svn at scipy.org Fri Jan 28 07:10:31 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 28 Jan 2011 06:10:31 -0600 (CST) Subject: [Scipy-svn] r7090 - trunk Message-ID: <20110128121031.96A6A3215D@scipy.org> Author: rgommers Date: 2011-01-28 06:10:30 -0600 (Fri, 28 Jan 2011) New Revision: 7090 Modified: trunk/setup.py Log: Py3K: add PyPI classifier for Python 3. Modified: trunk/setup.py =================================================================== --- trunk/setup.py 2011-01-26 23:07:09 UTC (rev 7089) +++ trunk/setup.py 2011-01-28 12:10:30 UTC (rev 7090) @@ -32,6 +32,7 @@ License :: OSI Approved Programming Language :: C Programming Language :: Python +Programming Language :: Python :: 3 Topic :: Software Development Topic :: Scientific/Engineering Operating System :: Microsoft :: Windows From scipy-svn at scipy.org Fri Jan 28 07:32:07 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 28 Jan 2011 06:32:07 -0600 (CST) Subject: [Scipy-svn] r7091 - branches/0.9.x Message-ID: <20110128123207.ADE8136345@scipy.org> Author: rgommers Date: 2011-01-28 06:32:06 -0600 (Fri, 28 Jan 2011) New Revision: 7091 Modified: branches/0.9.x/setup.py Log: Py3K: add PyPI classifier for Python 3. Modified: branches/0.9.x/setup.py =================================================================== --- branches/0.9.x/setup.py 2011-01-28 12:10:30 UTC (rev 7090) +++ branches/0.9.x/setup.py 2011-01-28 12:32:06 UTC (rev 7091) @@ -32,6 +32,7 @@ License :: OSI Approved Programming Language :: C Programming Language :: Python +Programming Language :: Python :: 3 Topic :: Software Development Topic :: Scientific/Engineering Operating System :: Microsoft :: Windows From scipy-svn at scipy.org Fri Jan 28 08:58:23 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 28 Jan 2011 07:58:23 -0600 (CST) Subject: [Scipy-svn] r7092 - trunk/scipy/misc/tests Message-ID: <20110128135823.F3FFC3215D@scipy.org> Author: rgommers Date: 2011-01-28 07:58:22 -0600 (Fri, 28 Jan 2011) New Revision: 7092 Modified: trunk/scipy/misc/tests/test_pilutil.py Log: TST: fix pilutil.imresize test. Patch by Mark Wiebe. Modified: trunk/scipy/misc/tests/test_pilutil.py =================================================================== --- trunk/scipy/misc/tests/test_pilutil.py 2011-01-28 12:32:06 UTC (rev 7091) +++ trunk/scipy/misc/tests/test_pilutil.py 2011-01-28 13:58:22 UTC (rev 7092) @@ -21,7 +21,8 @@ def test_imresize(self): im = np.random.random((10,20)) for T in np.sctypes['float'] + [float]: - im1 = pilutil.imresize(im,T(1.1)) + # 1.1 rounds to below 1.1 for float16, 1.101 works + im1 = pilutil.imresize(im,T(1.101)) assert_equal(im1.shape,(11,22)) def test_imresize2(self): From scipy-svn at scipy.org Fri Jan 28 17:56:06 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 28 Jan 2011 16:56:06 -0600 (CST) Subject: [Scipy-svn] r7093 - in trunk/scipy/stats: . tests Message-ID: <20110128225606.85300363B2@scipy.org> Author: rkern Date: 2011-01-28 16:56:05 -0600 (Fri, 28 Jan 2011) New Revision: 7093 Modified: trunk/scipy/stats/distributions.py trunk/scipy/stats/tests/test_distributions.py Log: BUG: Fix the lambda<=0 case for the Tukey-Lambda distribution. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2011-01-28 13:58:22 UTC (rev 7092) +++ trunk/scipy/stats/distributions.py 2011-01-28 22:56:05 UTC (rev 7093) @@ -4362,7 +4362,7 @@ Fx = arr(special.tklmbda(x,lam)) Px = Fx**(lam-1.0) + (arr(1-Fx))**(lam-1.0) Px = 1.0/arr(Px) - return where((lam > 0) & (abs(x) < 1.0/lam), Px, 0.0) + return where((lam <= 0) | (abs(x) < 1.0/arr(lam)), Px, 0.0) def _cdf(self, x, lam): return special.tklmbda(x, lam) def _ppf(self, q, lam): Modified: trunk/scipy/stats/tests/test_distributions.py =================================================================== --- trunk/scipy/stats/tests/test_distributions.py 2011-01-28 13:58:22 UTC (rev 7092) +++ trunk/scipy/stats/tests/test_distributions.py 2011-01-28 22:56:05 UTC (rev 7093) @@ -666,6 +666,19 @@ #adjust to avoid nan with 0*log(0) assert_almost_equal(stats.chi2.pdf(0.0, 2), 0.5, 14) +def test_regression_tukey_lambda(): + """ Make sure that Tukey-Lambda distribution correctly handles non-positive lambdas. + """ + x = np.linspace(-5.0, 5.0, 101) + for lam in [0.0, -1.0, -2.0, np.array([[-1.0], [0.0], [-2.0]])]: + p = stats.tukeylambda._pdf(x, lam) + assert_((p != 0.0).all()) + lam = np.array([[-1.0], [0.0], [2.0]]) + p = stats.tukeylambda._pdf(x, lam) + assert_((p[0] != 0.0).all()) + assert_((p[1] != 0.0).all()) + assert_((p[2] != 0.0).any()) + assert_((p[2] == 0.0).any()) if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Fri Jan 28 18:06:33 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 28 Jan 2011 17:06:33 -0600 (CST) Subject: [Scipy-svn] r7094 - in trunk/scipy/stats: . tests Message-ID: <20110128230633.41EC736396@scipy.org> Author: rkern Date: 2011-01-28 17:06:33 -0600 (Fri, 28 Jan 2011) New Revision: 7094 Modified: trunk/scipy/stats/distributions.py trunk/scipy/stats/tests/test_distributions.py Log: BUG: Correct the argument check for Tukey-Lambda. Any real lambda is acceptable now. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2011-01-28 22:56:05 UTC (rev 7093) +++ trunk/scipy/stats/distributions.py 2011-01-28 23:06:33 UTC (rev 7094) @@ -4358,6 +4358,9 @@ # FIXME: RVS does not work. class tukeylambda_gen(rv_continuous): + def _argcheck(self, lam): + # lam in RR. + return np.ones(np.shape(lam), dtype=bool) def _pdf(self, x, lam): Fx = arr(special.tklmbda(x,lam)) Px = Fx**(lam-1.0) + (arr(1-Fx))**(lam-1.0) Modified: trunk/scipy/stats/tests/test_distributions.py =================================================================== --- trunk/scipy/stats/tests/test_distributions.py 2011-01-28 22:56:05 UTC (rev 7093) +++ trunk/scipy/stats/tests/test_distributions.py 2011-01-28 23:06:33 UTC (rev 7094) @@ -671,10 +671,12 @@ """ x = np.linspace(-5.0, 5.0, 101) for lam in [0.0, -1.0, -2.0, np.array([[-1.0], [0.0], [-2.0]])]: - p = stats.tukeylambda._pdf(x, lam) + p = stats.tukeylambda.pdf(x, lam) assert_((p != 0.0).all()) + assert_(~np.isnan(p).all()) lam = np.array([[-1.0], [0.0], [2.0]]) - p = stats.tukeylambda._pdf(x, lam) + p = stats.tukeylambda.pdf(x, lam) + assert_(~np.isnan(p).all()) assert_((p[0] != 0.0).all()) assert_((p[1] != 0.0).all()) assert_((p[2] != 0.0).any()) From scipy-svn at scipy.org Sat Jan 29 13:00:38 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 Jan 2011 12:00:38 -0600 (CST) Subject: [Scipy-svn] r7095 - trunk/scipy/sparse/sparsetools Message-ID: <20110129180038.62DD01B8C1C@scipy.org> Author: ptvirtan Date: 2011-01-29 12:00:37 -0600 (Sat, 29 Jan 2011) New Revision: 7095 Modified: trunk/scipy/sparse/sparsetools/csr_wrap.cxx trunk/scipy/sparse/sparsetools/numpy.i Log: BUG: sparse: fix crash on deref of std::vector of size 0 (fixes #1210) Modified: trunk/scipy/sparse/sparsetools/csr_wrap.cxx =================================================================== --- trunk/scipy/sparse/sparsetools/csr_wrap.cxx 2011-01-28 23:06:33 UTC (rev 7094) +++ trunk/scipy/sparse/sparsetools/csr_wrap.cxx 2011-01-29 18:00:37 UTC (rev 7095) @@ -42504,21 +42504,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(signed char)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(signed char)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } @@ -42681,21 +42687,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(unsigned char)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(unsigned char)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } @@ -42858,21 +42870,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(short)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(short)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } @@ -43035,21 +43053,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_USHORT); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(unsigned short)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(unsigned short)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } @@ -43212,21 +43236,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(int)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } @@ -43389,21 +43419,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_UINT); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(unsigned int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(unsigned int)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } @@ -43566,21 +43602,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(long long)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(long long)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } @@ -43743,21 +43785,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_ULONGLONG); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(unsigned long long)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(unsigned long long)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } @@ -43920,21 +43968,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(float)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(float)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } @@ -44097,21 +44151,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(double)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(double)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } @@ -44274,21 +44334,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_LONGDOUBLE); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(long double)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(long double)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } @@ -44451,21 +44517,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(npy_cfloat_wrapper)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(npy_cfloat_wrapper)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } @@ -44628,21 +44700,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(npy_cdouble_wrapper)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(npy_cdouble_wrapper)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } @@ -44805,21 +44883,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_CLONGDOUBLE); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(npy_clongdouble_wrapper)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(npy_clongdouble_wrapper)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } Modified: trunk/scipy/sparse/sparsetools/numpy.i =================================================================== --- trunk/scipy/sparse/sparsetools/numpy.i 2011-01-28 23:06:33 UTC (rev 7094) +++ trunk/scipy/sparse/sparsetools/numpy.i 2011-01-29 18:00:37 UTC (rev 7095) @@ -524,7 +524,9 @@ %typemap( argout ) std::vector* array_argout { npy_intp length = ($1)->size(); PyObject *obj = PyArray_SimpleNew(1, &length, ##atype); - memcpy(PyArray_DATA(obj), &((*($1))[0]), sizeof(ctype)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*($1))[0]), sizeof(ctype)*length); + } delete $1; $result = helper_appendToTuple( $result, (PyObject *)obj ); }; From scipy-svn at scipy.org Sat Jan 29 13:03:45 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 Jan 2011 12:03:45 -0600 (CST) Subject: [Scipy-svn] r7096 - branches/0.9.x/scipy/sparse/sparsetools Message-ID: <20110129180345.63ECD363B6@scipy.org> Author: ptvirtan Date: 2011-01-29 12:03:45 -0600 (Sat, 29 Jan 2011) New Revision: 7096 Modified: branches/0.9.x/scipy/sparse/sparsetools/csr_wrap.cxx branches/0.9.x/scipy/sparse/sparsetools/numpy.i Log: BUG (backport r7095): sparse: fix crash on deref of std::vector of size 0 (fixes #1210) (cherry picked from r7095) Modified: branches/0.9.x/scipy/sparse/sparsetools/csr_wrap.cxx =================================================================== --- branches/0.9.x/scipy/sparse/sparsetools/csr_wrap.cxx 2011-01-29 18:00:37 UTC (rev 7095) +++ branches/0.9.x/scipy/sparse/sparsetools/csr_wrap.cxx 2011-01-29 18:03:45 UTC (rev 7096) @@ -42504,21 +42504,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_BYTE); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(signed char)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(signed char)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } @@ -42681,21 +42687,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_UBYTE); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(unsigned char)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(unsigned char)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } @@ -42858,21 +42870,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_SHORT); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(short)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(short)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } @@ -43035,21 +43053,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_USHORT); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(unsigned short)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(unsigned short)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } @@ -43212,21 +43236,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(int)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } @@ -43389,21 +43419,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_UINT); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(unsigned int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(unsigned int)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } @@ -43566,21 +43602,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_LONGLONG); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(long long)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(long long)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } @@ -43743,21 +43785,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_ULONGLONG); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(unsigned long long)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(unsigned long long)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } @@ -43920,21 +43968,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_FLOAT); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(float)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(float)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } @@ -44097,21 +44151,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_DOUBLE); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(double)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(double)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } @@ -44274,21 +44334,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_LONGDOUBLE); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(long double)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(long double)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } @@ -44451,21 +44517,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_CFLOAT); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(npy_cfloat_wrapper)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(npy_cfloat_wrapper)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } @@ -44628,21 +44700,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_CDOUBLE); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(npy_cdouble_wrapper)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(npy_cdouble_wrapper)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } @@ -44805,21 +44883,27 @@ { npy_intp length = (arg10)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg10))[0]), sizeof(int)*length); + } delete arg10; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg11)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_INT); - memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg11))[0]), sizeof(int)*length); + } delete arg11; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } { npy_intp length = (arg12)->size(); PyObject *obj = PyArray_SimpleNew(1, &length,PyArray_CLONGDOUBLE); - memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(npy_clongdouble_wrapper)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*(arg12))[0]), sizeof(npy_clongdouble_wrapper)*length); + } delete arg12; resultobj = helper_appendToTuple( resultobj, (PyObject *)obj ); } Modified: branches/0.9.x/scipy/sparse/sparsetools/numpy.i =================================================================== --- branches/0.9.x/scipy/sparse/sparsetools/numpy.i 2011-01-29 18:00:37 UTC (rev 7095) +++ branches/0.9.x/scipy/sparse/sparsetools/numpy.i 2011-01-29 18:03:45 UTC (rev 7096) @@ -524,7 +524,9 @@ %typemap( argout ) std::vector* array_argout { npy_intp length = ($1)->size(); PyObject *obj = PyArray_SimpleNew(1, &length, ##atype); - memcpy(PyArray_DATA(obj), &((*($1))[0]), sizeof(ctype)*length); + if (length > 0) { + memcpy(PyArray_DATA(obj), &((*($1))[0]), sizeof(ctype)*length); + } delete $1; $result = helper_appendToTuple( $result, (PyObject *)obj ); }; From scipy-svn at scipy.org Sat Jan 29 13:48:18 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 Jan 2011 12:48:18 -0600 (CST) Subject: [Scipy-svn] r7097 - trunk/scipy/cluster Message-ID: <20110129184818.CE568363C6@scipy.org> Author: warren.weckesser Date: 2011-01-29 12:48:18 -0600 (Sat, 29 Jan 2011) New Revision: 7097 Modified: trunk/scipy/cluster/vq.py Log: ENH: cluster: Don't use plain assert for argument validation. Modified: trunk/scipy/cluster/vq.py =================================================================== --- trunk/scipy/cluster/vq.py 2011-01-29 18:03:45 UTC (rev 7096) +++ trunk/scipy/cluster/vq.py 2011-01-29 18:48:18 UTC (rev 7097) @@ -682,7 +682,9 @@ raise ValueError("unknown init method %s" % str(minit)) clusters = init(data, k) - assert not iter == 0 + if int(iter) < 1: + raise ValueError("iter = %s is not valid. iter must be a positive integer." % iter) + return _kmeans2(data, clusters, iter, nc, _valid_miss_meth[missing]) def _kmeans2(data, code, niter, nc, missing): From scipy-svn at scipy.org Sat Jan 29 14:02:01 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 Jan 2011 13:02:01 -0600 (CST) Subject: [Scipy-svn] r7098 - trunk/scipy/fftpack Message-ID: <20110129190201.2A1AC1B8C1C@scipy.org> Author: warren.weckesser Date: 2011-01-29 13:02:01 -0600 (Sat, 29 Jan 2011) New Revision: 7098 Modified: trunk/scipy/fftpack/helper.py Log: ENH: fftpack: Don't use plain assert for argument validation. Modified: trunk/scipy/fftpack/helper.py =================================================================== --- trunk/scipy/fftpack/helper.py 2011-01-29 18:48:18 UTC (rev 7097) +++ trunk/scipy/fftpack/helper.py 2011-01-29 19:02:01 UTC (rev 7098) @@ -3,7 +3,7 @@ from numpy import array from numpy.fft.helper import fftshift, ifftshift, fftfreq -def rfftfreq(n,d=1.0): +def rfftfreq(n, d=1.0): """ rfftfreq(n, d=1.0) -> f DFT sample frequencies (for usage with rfft,irfft). @@ -15,5 +15,6 @@ f = [0,1,1,2,2,...,n/2-1,n/2-1,n/2]/(d*n) if n is even f = [0,1,1,2,2,...,n/2-1,n/2-1,n/2,n/2]/(d*n) if n is odd """ - assert isinstance(n,int) + if not isinstance(n, int) or n < 0: + raise ValueError("n = %s is not valid. n must be a nonnegative integer." % n) return (array(range(1,n+1),dtype=int)//2)/float(n*d) From scipy-svn at scipy.org Sat Jan 29 14:17:31 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 Jan 2011 13:17:31 -0600 (CST) Subject: [Scipy-svn] r7099 - in trunk/scipy: optimize/lbfgsb sparse/linalg/eigen/arpack/ARPACK/UTIL Message-ID: <20110129191731.D821837A18E@scipy.org> Author: ptvirtan Date: 2011-01-29 13:17:31 -0600 (Sat, 29 Jan 2011) New Revision: 7099 Modified: trunk/scipy/optimize/lbfgsb/routines.f trunk/scipy/sparse/linalg/eigen/arpack/ARPACK/UTIL/second.f Log: BUG: use CPU_TIME intrinsic instead of ETIME in Fortran code (#1376) Modified: trunk/scipy/optimize/lbfgsb/routines.f =================================================================== --- trunk/scipy/optimize/lbfgsb/routines.f 2011-01-29 19:02:01 UTC (rev 7098) +++ trunk/scipy/optimize/lbfgsb/routines.f 2011-01-29 19:17:31 UTC (rev 7099) @@ -3824,6 +3824,7 @@ subroutine timer(ttime) double precision ttime + real t1 c ********* c c Subroutine timer @@ -3846,15 +3847,9 @@ c Modified October 1990 by Brett M. Averick. c c ********** - real temp - real tarray(2) - real etime -c The first element of the array tarray specifies user time - - temp = etime(tarray) - - ttime = dble(tarray(1)) + call cpu_time(t1) + ttime = t1 return Modified: trunk/scipy/sparse/linalg/eigen/arpack/ARPACK/UTIL/second.f =================================================================== --- trunk/scipy/sparse/linalg/eigen/arpack/ARPACK/UTIL/second.f 2011-01-29 19:02:01 UTC (rev 7098) +++ trunk/scipy/sparse/linalg/eigen/arpack/ARPACK/UTIL/second.f 2011-01-29 19:17:31 UTC (rev 7099) @@ -11,23 +11,10 @@ * ======= * * SECOND returns the user time for a process in seconds. -* This version gets the time from the system function ETIME. +* This version gets the time from the system function CPU_TIME. * -* .. Local Scalars .. - REAL T1 -* .. -* .. Local Arrays .. - REAL TARRAY( 2 ) -* .. -* .. External Functions .. - REAL ETIME -* EXTERNAL ETIME -* .. -* .. Executable Statements .. -* - T1 = ETIME( TARRAY ) - T = TARRAY( 1 ) + CALL CPU_TIME(T) RETURN * From scipy-svn at scipy.org Sat Jan 29 15:17:35 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 Jan 2011 14:17:35 -0600 (CST) Subject: [Scipy-svn] r7100 - trunk/scipy/stats Message-ID: <20110129201735.5FC7C37BFF2@scipy.org> Author: warren.weckesser Date: 2011-01-29 14:17:35 -0600 (Sat, 29 Jan 2011) New Revision: 7100 Modified: trunk/scipy/stats/morestats.py trunk/scipy/stats/mstats_basic.py trunk/scipy/stats/mstats_extras.py trunk/scipy/stats/stats.py Log: ENH: stats: Don't use plain assert for argument validation. Modified: trunk/scipy/stats/morestats.py =================================================================== --- trunk/scipy/stats/morestats.py 2011-01-29 19:17:31 UTC (rev 7099) +++ trunk/scipy/stats/morestats.py 2011-01-29 20:17:35 UTC (rev 7100) @@ -72,7 +72,7 @@ ## Returns alpha confidence interval for the mean, variance, ## and std. -def bayes_mvs(data,alpha=0.90): +def bayes_mvs(data, alpha=0.90): """Return Bayesian confidence intervals for the mean, var, and std. Assumes 1-d data all has same mean and variance and uses Jeffrey's prior @@ -89,8 +89,10 @@ """ x = ravel(data) n = len(x) - assert(n > 1) - assert(alpha < 1 and alpha > 0) + if n < 2: + raise ValueError("data must contain at least two values.") + if alpha >= 1 or alpha <= 0: + raise ValueError("0 < alpha < 1 is required, but alpha=%s was given." % alpha) n = float(n) if (n > 1000): # just a guess. The curves look very similar at this point. return _gauss_mvs(x, n, alpha) @@ -533,10 +535,11 @@ a = zeros(N,'f') init = 0 else: - assert(len(a) == N/2), "a must be == len(x)/2" + if len(a) != N//2: + raise ValueError("len(a) must equal len(x)/2") init = 1 y = sort(x) - a,w,pw,ifault = statlib.swilk(y,a[:N/2],init) + a, w, pw, ifault = statlib.swilk(y, a[:N//2], init) if not ifault in [0,2]: warnings.warn(str(ifault)) if N > 5000: Modified: trunk/scipy/stats/mstats_basic.py =================================================================== --- trunk/scipy/stats/mstats_basic.py 2011-01-29 19:17:31 UTC (rev 7099) +++ trunk/scipy/stats/mstats_basic.py 2011-01-29 20:17:35 UTC (rev 7100) @@ -1286,7 +1286,8 @@ shp = a.shape return _trimmed_stde_1D(a.ravel(),lolim,uplim,loinc,upinc) else: - assert a.ndim <= 2, "Array should be 2D at most !" + if a.ndim > 2: + raise ValueError("Array 'a' must be at most two dimensional, but got a.ndim = %d" % a.ndim) return ma.apply_along_axis(_trimmed_stde_1D, axis, a, lolim,uplim,loinc,upinc) @@ -1534,7 +1535,8 @@ if (axis is None): return _stdemed_1D(data) else: - assert data.ndim <= 2, "Array should be 2D at most !" + if data.ndim > 2: + raise ValueError("Array 'data' must be at most two dimensional, but got data.ndim = %d" % data.ndim) return ma.apply_along_axis(_stdemed_1D, axis, data) #####-------------------------------------------------------------------------- Modified: trunk/scipy/stats/mstats_extras.py =================================================================== --- trunk/scipy/stats/mstats_extras.py 2011-01-29 19:17:31 UTC (rev 7099) +++ trunk/scipy/stats/mstats_extras.py 2011-01-29 20:17:35 UTC (rev 7100) @@ -92,7 +92,8 @@ if (axis is None) or (data.ndim == 1): result = _hd_1D(data, p, var) else: - assert data.ndim <= 2, "Array should be 2D at most !" + if data.ndim > 2: + raise ValueError("Array 'data' must be at most two dimensional, but got data.ndim = %d" % data.ndim) result = ma.apply_along_axis(_hd_1D, axis, data, p, var) # return ma.fix_invalid(result, copy=False) @@ -162,7 +163,8 @@ if (axis is None): result = _hdsd_1D(data, p) else: - assert data.ndim <= 2, "Array should be 2D at most !" + if data.ndim > 2: + raise ValueError("Array 'data' must be at most two dimensional, but got data.ndim = %d" % data.ndim) result = ma.apply_along_axis(_hdsd_1D, axis, data, p) # return ma.fix_invalid(result, copy=False).ravel() @@ -236,7 +238,8 @@ return mj # data = ma.array(data, copy=False) - assert data.ndim <= 2, "Array should be 2D at most !" + if data.ndim > 2: + raise ValueError("Array 'data' must be at most two dimensional, but got data.ndim = %d" % data.ndim) p = np.array(prob, copy=False, ndmin=1) # Computes quantiles along axis (or globally) if (axis is None): @@ -305,7 +308,8 @@ if (axis is None): result = _cihs_1D(data.compressed(), alpha) else: - assert data.ndim <= 2, "Array should be 2D at most !" + if data.ndim > 2: + raise ValueError("Array 'data' must be at most two dimensional, but got data.ndim = %d" % data.ndim) result = ma.apply_along_axis(_cihs_1D, axis, data, alpha) # return result Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2011-01-29 19:17:31 UTC (rev 7099) +++ trunk/scipy/stats/stats.py 2011-01-29 20:17:35 UTC (rev 7100) @@ -3490,7 +3490,8 @@ .. [1] http://en.wikipedia.org/wiki/Kruskal-Wallis_one-way_analysis_of_variance """ - assert len(args) >= 2, "Need at least 2 groups in stats.kruskal()" + if len(args) < 2: + raise ValueError("Need at least two groups in stats.kruskal()") n = map(len,args) all = [] for i in range(len(args)): From scipy-svn at scipy.org Sat Jan 29 15:54:21 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 Jan 2011 14:54:21 -0600 (CST) Subject: [Scipy-svn] r7101 - trunk/scipy/misc Message-ID: <20110129205421.C02DF363C6@scipy.org> Author: warren.weckesser Date: 2011-01-29 14:54:21 -0600 (Sat, 29 Jan 2011) New Revision: 7101 Modified: trunk/scipy/misc/common.py trunk/scipy/misc/pilutil.py Log: ENH: misc: Don't use plain assert for argument validation. Modified: trunk/scipy/misc/common.py =================================================================== --- trunk/scipy/misc/common.py 2011-01-29 20:17:35 UTC (rev 7100) +++ trunk/scipy/misc/common.py 2011-01-29 20:54:21 UTC (rev 7101) @@ -217,7 +217,7 @@ sv = special.errprint(sv) return where(cond, vals, 0.0) -def central_diff_weights(Np,ndiv=1): +def central_diff_weights(Np, ndiv=1): """ Return weights for an Np-point central derivative of order ndiv assuming equally-spaced function points. @@ -230,8 +230,10 @@ Can be inaccurate for large number of points. """ - assert (Np >= ndiv+1), "Number of points must be at least the derivative order + 1." - assert (Np % 2 == 1), "Odd-number of points only." + if Np < ndiv + 1: + raise ValueError("Number of points must be at least the derivative order + 1.") + if Np % 2 == 0: + raise ValueError("The number of points must be odd.") from scipy import linalg ho = Np >> 1 x = arange(-ho,ho+1.0) @@ -242,7 +244,7 @@ w = product(arange(1,ndiv+1),axis=0)*linalg.inv(X)[ndiv] return w -def derivative(func,x0,dx=1.0,n=1,args=(),order=3): +def derivative(func, x0, dx=1.0, n=1, args=(), order=3): """ Find the n-th derivative of a function at point x0. @@ -277,8 +279,12 @@ 4.0 """ - assert (order >= n+1), "Number of points must be at least the derivative order + 1." - assert (order % 2 == 1), "Odd number of points only." + if order < n + 1: + raise ValueError("'order' (the number of points used to compute the derivative), " + "must be at least the derivative order 'n' + 1.") + if order % 2 == 0: + raise ValueError("'order' (the number of points used to compute the derivative) " + "must be odd.") # pre-computed for n=1 and 2 and low-order for speed. if n==1: if order == 3: Modified: trunk/scipy/misc/pilutil.py =================================================================== --- trunk/scipy/misc/pilutil.py 2011-01-29 20:17:35 UTC (rev 7100) +++ trunk/scipy/misc/pilutil.py 2011-01-29 20:54:21 UTC (rev 7101) @@ -147,8 +147,9 @@ return array(im) _errstr = "Mode is unknown or incompatible with input array shape." -def toimage(arr,high=255,low=0,cmin=None,cmax=None,pal=None, - mode=None,channel_axis=None): + +def toimage(arr, high=255, low=0, cmin=None, cmax=None, pal=None, + mode=None, channel_axis=None): """Takes a numpy array and returns a PIL image. The mode of the PIL image depends on the array shape, the pal keyword, and the mode keyword. @@ -171,7 +172,8 @@ shape = list(data.shape) valid = len(shape)==2 or ((len(shape)==3) and \ ((3 in shape) or (4 in shape))) - assert valid, "Not a suitable array shape for any mode." + if not valid: + raise ValueError("'arr' does not have a suitable array shape for any mode.") if len(shape) == 2: shape = (shape[1],shape[0]) # columns show up first if mode == 'F': @@ -242,11 +244,13 @@ raise ValueError(_errstr) if mode in ['RGB', 'YCbCr']: - assert numch == 3, "Invalid array shape for mode." + if numch != 3: + raise ValueError("Invalid array shape for mode.") if mode in ['RGBA', 'CMYK']: - assert numch == 4, "Invalid array shape for mode." + if numch != 4: + raise ValueError("Invalid array shape for mode.") - # Here we know data and mode is coorect + # Here we know data and mode is correct image = Image.fromstring(mode, shape, strdata) return image From scipy-svn at scipy.org Sat Jan 29 16:38:13 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 Jan 2011 15:38:13 -0600 (CST) Subject: [Scipy-svn] r7102 - trunk/scipy/special Message-ID: <20110129213813.D3C531B8C34@scipy.org> Author: warren.weckesser Date: 2011-01-29 15:38:13 -0600 (Sat, 29 Jan 2011) New Revision: 7102 Modified: trunk/scipy/special/orthogonal.py Log: ENH: special: Don't use plain assert for argument validation. Modified: trunk/scipy/special/orthogonal.py =================================================================== --- trunk/scipy/special/orthogonal.py 2011-01-29 20:54:21 UTC (rev 7101) +++ trunk/scipy/special/orthogonal.py 2011-01-29 21:38:13 UTC (rev 7102) @@ -102,7 +102,7 @@ 'eval_sh_legendre', 'eval_sh_chebyt', 'eval_sh_chebyu', 'eval_sh_jacobi', 'poch', 'binom'] -def poch(z,m): +def poch(z, m): """Pochhammer symbol (z)_m = (z)(z+1)....(z+m-1) = gamma(z+m)/gamma(z)""" return _gam(z+m) / _gam(z) @@ -141,7 +141,7 @@ self.__dict__['_eval_func'] = lambda x: evf(x) * p self.__dict__['normcoef'] *= p -def gen_roots_and_weights(n,an_func,sqrt_bn_func,mu): +def gen_roots_and_weights(n, an_func, sqrt_bn_func, mu): """[x,w] = gen_roots_and_weights(n,an_func,sqrt_bn_func,mu) Returns the roots (x) of an nth order orthogonal polynomial, @@ -168,7 +168,7 @@ return answer # Jacobi Polynomials 1 P^(alpha,beta)_n(x) -def j_roots(n,alpha,beta,mu=0): +def j_roots(n, alpha, beta, mu=0): """[x,w] = j_roots(n,alpha,beta) Returns the roots (x) of the nth order Jacobi polynomial, P^(alpha,beta)_n(x) @@ -177,7 +177,8 @@ """ if any(alpha <= -1) or any(beta <= -1): raise ValueError("alpha and beta must be greater than -1.") - assert(n>0), "n must be positive." + if n < 1: + raise ValueError("n must be positive.") olderr = np.seterr(all='ignore') try: @@ -201,12 +202,14 @@ else: return val -def jacobi(n,alpha,beta,monic=0): +def jacobi(n, alpha, beta, monic=0): """Returns the nth order Jacobi polynomial, P^(alpha,beta)_n(x) orthogonal over [-1,1] with weighting function (1-x)**alpha (1+x)**beta with alpha,beta > -1. """ - assert(n>=0), "n must be nonnegative" + if n < 0: + raise ValueError("n must be nonnegative.") + wfunc = lambda x: (1-x)**alpha * (1+x)**beta if n==0: return orthopoly1d([],[],1.0,1.0,wfunc,(-1,1),monic, @@ -222,7 +225,7 @@ return p # Jacobi Polynomials shifted G_n(p,q,x) -def js_roots(n,p1,q1,mu=0): +def js_roots(n, p1, q1, mu=0): """[x,w] = js_roots(n,p,q) Returns the roots (x) of the nth order shifted Jacobi polynomial, G_n(p,q,x), @@ -232,7 +235,7 @@ # from recurrence relation if not ( any((p1 - q1) > -1) and any(q1 > 0) ): raise ValueError("(p - q) > -1 and q > 0 please.") - if (n <= 0): + if n <= 0: raise ValueError("n must be positive.") p,q = p1,q1 @@ -266,8 +269,9 @@ orthogonal over [0,1] with weighting function (1-x)**(p-q) (x)**(q-1) with p>q-1 and q > 0. """ - if (n<0): - raise ValueError("n must be nonnegative") + if n < 0: + raise ValueError("n must be nonnegative.") + wfunc = lambda x: (1.0-x)**(p-q) * (x)**(q-1.) if n==0: return orthopoly1d([],[],1.0,1.0,wfunc,(-1,1),monic, @@ -283,7 +287,7 @@ return pp # Generalized Laguerre L^(alpha)_n(x) -def la_roots(n,alpha,mu=0): +def la_roots(n, alpha, mu=0): """[x,w] = la_roots(n,alpha) Returns the roots (x) of the nth order generalized (associated) Laguerre @@ -292,7 +296,9 @@ """ if not all(alpha > -1): raise ValueError("alpha > -1") - assert(n>0), "n must be positive." + if n < 1: + raise ValueError("n must be positive.") + (p,q) = (alpha,0.0) sbn_La = lambda k: -sqrt(k*(k + p)) # from recurrence relation an_La = lambda k: 2*k + p + 1 @@ -303,14 +309,16 @@ else: return val -def genlaguerre(n,alpha,monic=0): +def genlaguerre(n, alpha, monic=0): """Returns the nth order generalized (associated) Laguerre polynomial, L^(alpha)_n(x), orthogonal over [0,inf) with weighting function exp(-x) x**alpha with alpha > -1 """ if any(alpha <= -1): raise ValueError("alpha must be > -1") - assert(n>=0), "n must be nonnegative" + if n < 0: + raise ValueError("n must be nonnegative.") + if n==0: n1 = n+1 else: n1 = n x,w,mu0 = la_roots(n1,alpha,mu=1) @@ -323,7 +331,7 @@ return p # Laguerre L_n(x) -def l_roots(n,mu=0): +def l_roots(n, mu=0): """[x,w] = l_roots(n) Returns the roots (x) of the nth order Laguerre polynomial, L_n(x), @@ -332,11 +340,13 @@ """ return la_roots(n,0.0,mu=mu) -def laguerre(n,monic=0): +def laguerre(n, monic=0): """Return the nth order Laguerre polynoimal, L_n(x), orthogonal over [0,inf) with weighting function exp(-x) """ - assert(n>=0), "n must be nonnegative" + if n < 0: + raise ValueError("n must be nonnegative.") + if n==0: n1 = n+1 else: n1 = n x,w,mu0 = l_roots(n1,mu=1) @@ -349,14 +359,16 @@ # Hermite 1 H_n(x) -def h_roots(n,mu=0): +def h_roots(n, mu=0): """[x,w] = h_roots(n) Returns the roots (x) of the nth order Hermite polynomial, H_n(x), and weights (w) to use in Gaussian Quadrature over [-inf,inf] with weighting function exp(-x**2). """ - assert(n>0), "n must be positive." + if n < 1: + raise ValueError("n must be positive.") + sbn_H = lambda k: sqrt(k/2) # from recurrence relation an_H = lambda k: 0*k mu0 = sqrt(pi) # integral of weight over interval @@ -366,11 +378,13 @@ else: return val -def hermite(n,monic=0): +def hermite(n, monic=0): """Return the nth order Hermite polynomial, H_n(x), orthogonal over (-inf,inf) with weighting function exp(-x**2) """ - assert(n>=0), "n must be nonnegative" + if n < 0: + raise ValueError("n must be nonnegative.") + if n==0: n1 = n+1 else: n1 = n x,w,mu0 = h_roots(n1,mu=1) @@ -383,14 +397,16 @@ return p # Hermite 2 He_n(x) -def he_roots(n,mu=0): +def he_roots(n, mu=0): """[x,w] = he_roots(n) Returns the roots (x) of the nth order Hermite polynomial, He_n(x), and weights (w) to use in Gaussian Quadrature over [-inf,inf] with weighting function exp(-(x/2)**2). """ - assert(n>0), "n must be positive." + if n < 1: + raise ValueError("n must be positive.") + sbn_He = lambda k: sqrt(k) # from recurrence relation an_He = lambda k: 0*k mu0 = sqrt(2*pi) # integral of weight over interval @@ -400,11 +416,13 @@ else: return val -def hermitenorm(n,monic=0): +def hermitenorm(n, monic=0): """Return the nth order normalized Hermite polynomial, He_n(x), orthogonal over (-inf,inf) with weighting function exp(-(x/2)**2) """ - assert(n>=0), "n must be nonnegative" + if n < 0: + raise ValueError("n must be nonnegative.") + if n==0: n1 = n+1 else: n1 = n x,w,mu0 = he_roots(n1,mu=1) @@ -419,7 +437,7 @@ ## The remainder of the polynomials can be derived from the ones above. # Ultraspherical (Gegenbauer) C^(alpha)_n(x) -def cg_roots(n,alpha,mu=0): +def cg_roots(n, alpha, mu=0): """[x,w] = cg_roots(n,alpha) Returns the roots (x) of the nth order Ultraspherical (Gegenbauer) @@ -428,7 +446,7 @@ """ return j_roots(n,alpha-0.5,alpha-0.5,mu=mu) -def gegenbauer(n,alpha,monic=0): +def gegenbauer(n, alpha, monic=0): """Return the nth order Gegenbauer (ultraspherical) polynomial, C^(alpha)_n(x), orthogonal over [-1,1] with weighting function (1-x**2)**(alpha-1/2) with alpha > -1/2 @@ -443,14 +461,16 @@ # Chebyshev of the first kind: T_n(x) = n! sqrt(pi) / _gam(n+1./2)* P^(-1/2,-1/2)_n(x) # Computed anew. -def t_roots(n,mu=0): +def t_roots(n, mu=0): """[x,w] = t_roots(n) Returns the roots (x) of the nth order Chebyshev (of the first kind) polynomial, T_n(x), and weights (w) to use in Gaussian Quadrature over [-1,1] with weighting function (1-x**2)**(-1/2). """ - assert(n>0), "n must be positive." + if n < 1: + raise ValueError("n must be positive.") + # from recurrence relation sbn_J = lambda k: np.where(k==1,sqrt(2)/2.0,0.5) an_J = lambda k: 0.0*k @@ -462,11 +482,13 @@ else: return val -def chebyt(n,monic=0): +def chebyt(n, monic=0): """Return nth order Chebyshev polynomial of first kind, Tn(x). Orthogonal over [-1,1] with weight function (1-x**2)**(-1/2). """ - assert(n>=0), "n must be nonnegative" + if n < 0: + raise ValueError("n must be nonnegative.") + wfunc = lambda x: 1.0/sqrt(1-x*x) if n==0: return orthopoly1d([],[],pi,1.0,wfunc,(-1,1),monic, @@ -481,7 +503,7 @@ # Chebyshev of the second kind # U_n(x) = (n+1)! sqrt(pi) / (2*_gam(n+3./2)) * P^(1/2,1/2)_n(x) -def u_roots(n,mu=0): +def u_roots(n, mu=0): """[x,w] = u_roots(n) Returns the roots (x) of the nth order Chebyshev (of the second kind) @@ -490,7 +512,7 @@ """ return j_roots(n,0.5,0.5,mu=mu) -def chebyu(n,monic=0): +def chebyu(n, monic=0): """Return nth order Chebyshev polynomial of second kind, Un(x). Orthogonal over [-1,1] with weight function (1-x**2)**(1/2). """ @@ -502,7 +524,7 @@ return base # Chebyshev of the first kind C_n(x) -def c_roots(n,mu=0): +def c_roots(n, mu=0): """[x,w] = c_roots(n) Returns the roots (x) of the nth order Chebyshev (of the first kind) @@ -516,11 +538,13 @@ [x,w] = j_roots(n,-0.5,-0.5,mu=0) return [x*2,w] -def chebyc(n,monic=0): +def chebyc(n, monic=0): """Return nth order Chebyshev polynomial of first kind, Cn(x). Orthogonal over [-2,2] with weight function (1-(x/2)**2)**(-1/2). """ - assert(n>=0), "n must be nonnegative" + if n < 0: + raise ValueError("n must be nonnegative.") + if n==0: n1 = n+1 else: n1 = n x,w,mu0 = c_roots(n1,mu=1) @@ -534,7 +558,7 @@ return p # Chebyshev of the second kind S_n(x) -def s_roots(n,mu=0): +def s_roots(n, mu=0): """[x,w] = s_roots(n) Returns the roots (x) of the nth order Chebyshev (of the second kind) @@ -548,11 +572,13 @@ [x,w] = j_roots(n,0.5,0.5,mu=0) return [x*2,w] -def chebys(n,monic=0): +def chebys(n, monic=0): """Return nth order Chebyshev polynomial of second kind, Sn(x). Orthogonal over [-2,2] with weight function (1-(x/)**2)**(1/2). """ - assert(n>=0), "n must be nonnegative" + if n < 0: + raise ValueError("n must be nonnegative.") + if n==0: n1 = n+1 else: n1 = n x,w,mu0 = s_roots(n1,mu=1) @@ -567,7 +593,7 @@ return p # Shifted Chebyshev of the first kind T^*_n(x) -def ts_roots(n,mu=0): +def ts_roots(n, mu=0): """[x,w] = ts_roots(n) Returns the roots (x) of the nth order shifted Chebyshev (of the first kind) @@ -576,7 +602,7 @@ """ return js_roots(n,0.0,0.5,mu=mu) -def sh_chebyt(n,monic=0): +def sh_chebyt(n, monic=0): """Return nth order shifted Chebyshev polynomial of first kind, Tn(x). Orthogonal over [0,1] with weight function (x-x**2)**(-1/2). """ @@ -592,7 +618,7 @@ # Shifted Chebyshev of the second kind U^*_n(x) -def us_roots(n,mu=0): +def us_roots(n, mu=0): """[x,w] = us_roots(n) Returns the roots (x) of the nth order shifted Chebyshev (of the second kind) @@ -601,7 +627,7 @@ """ return js_roots(n,2.0,1.5,mu=mu) -def sh_chebyu(n,monic=0): +def sh_chebyu(n, monic=0): """Return nth order shifted Chebyshev polynomial of second kind, Un(x). Orthogonal over [0,1] with weight function (x-x**2)**(1/2). """ @@ -612,7 +638,7 @@ return base # Legendre -def p_roots(n,mu=0): +def p_roots(n, mu=0): """[x,w] = p_roots(n) Returns the roots (x) of the nth order Legendre polynomial, P_n(x), @@ -621,11 +647,13 @@ """ return j_roots(n,0.0,0.0,mu=mu) -def legendre(n,monic=0): +def legendre(n, monic=0): """Returns the nth order Legendre polynomial, P_n(x), orthogonal over [-1,1] with weight function 1. """ - assert(n>=0), "n must be nonnegative" + if n < 0: + raise ValueError("n must be nonnegative.") + if n==0: n1 = n+1 else: n1 = n x,w,mu0 = p_roots(n1,mu=1) @@ -637,7 +665,7 @@ return p # Shifted Legendre P^*_n(x) -def ps_roots(n,mu=0): +def ps_roots(n, mu=0): """[x,w] = ps_roots(n) Returns the roots (x) of the nth order shifted Legendre polynomial, P^*_n(x), @@ -646,11 +674,13 @@ """ return js_roots(n,1.0,1.0,mu=mu) -def sh_legendre(n,monic=0): +def sh_legendre(n, monic=0): """Returns the nth order shifted Legendre polynomial, P^*_n(x), orthogonal over [0,1] with weighting function 1. """ - assert(n>=0), "n must be nonnegative" + if n < 0: + raise ValueError("n must be nonnegative.") + wfunc = lambda x: 0.0*x + 1.0 if n==0: return orthopoly1d([],[],1.0,1.0,wfunc,(0,1),monic, lambda x: eval_sh_legendre(n,x)) From scipy-svn at scipy.org Sat Jan 29 23:31:16 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 Jan 2011 22:31:16 -0600 (CST) Subject: [Scipy-svn] r7103 - in trunk/scipy: lib/lapack linalg sparse/linalg/dsolve Message-ID: <20110130043116.EB4C01B8CC3@scipy.org> Author: rgommers Date: 2011-01-29 22:31:16 -0600 (Sat, 29 Jan 2011) New Revision: 7103 Modified: trunk/scipy/lib/lapack/setup.py trunk/scipy/linalg/setup.py trunk/scipy/sparse/linalg/dsolve/setup.py Log: BUG: fix for build issue with MSCV 9, ifort and MKL. Patch by Christoph Gohkle. Closes #1376. Modified: trunk/scipy/lib/lapack/setup.py =================================================================== --- trunk/scipy/lib/lapack/setup.py 2011-01-29 21:38:13 UTC (rev 7102) +++ trunk/scipy/lib/lapack/setup.py 2011-01-30 04:31:16 UTC (rev 7103) @@ -96,9 +96,15 @@ ) # atlas_version: + if os.name == 'nt' and 'FPATH' in os.environ: + define_macros = [('NO_ATLAS_INFO', 1)] + else: + define_macros = [] + config.add_extension('atlas_version', sources = ['atlas_version.c'], - extra_info = lapack_opt + extra_info = lapack_opt, + define_macros = define_macros ) config.add_data_dir('tests') Modified: trunk/scipy/linalg/setup.py =================================================================== --- trunk/scipy/linalg/setup.py 2011-01-29 21:38:13 UTC (rev 7102) +++ trunk/scipy/linalg/setup.py 2011-01-30 04:31:16 UTC (rev 7103) @@ -1,5 +1,6 @@ #!/usr/bin/env python +import os from distutils.dep_util import newer_group, newer from os.path import join @@ -171,10 +172,15 @@ ) # atlas_version: + if os.name == 'nt' and 'FPATH' in os.environ: + define_macros = [('NO_ATLAS_INFO', 1)] + else: + define_macros = [] config.add_extension('atlas_version', ['atlas_version.c'], - extra_info = lapack_opt + extra_info = lapack_opt, + define_macros = define_macros ) config.add_data_dir('tests') Modified: trunk/scipy/sparse/linalg/dsolve/setup.py =================================================================== --- trunk/scipy/sparse/linalg/dsolve/setup.py 2011-01-29 21:38:13 UTC (rev 7102) +++ trunk/scipy/sparse/linalg/dsolve/setup.py 2011-01-30 04:31:16 UTC (rev 7103) @@ -2,6 +2,7 @@ from os.path import join, dirname import sys import os +import glob def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration @@ -17,10 +18,15 @@ superlu_defs = [] superlu_defs.append(('USE_VENDOR_BLAS',1)) - superlu_src = os.path.join(dirname(__file__), 'SuperLU', 'SRC') + superlu_src = join(dirname(__file__), 'SuperLU', 'SRC') + sources = list(glob.glob(join(superlu_src, '*.c'))) + if os.name == 'nt' and 'FPATH' in os.environ: + # when using MSVC + MKL, lsame is already in MKL + sources.remove(join(superlu_src, 'lsame.c')) + config.add_library('superlu_src', - sources = [join(superlu_src,'*.c')], + sources = sources, macros = superlu_defs, include_dirs=[superlu_src], ) From scipy-svn at scipy.org Sat Jan 29 23:33:03 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 Jan 2011 22:33:03 -0600 (CST) Subject: [Scipy-svn] r7104 - branches/0.9.x/scipy/misc/tests Message-ID: <20110130043303.DDF321B8CC3@scipy.org> Author: rgommers Date: 2011-01-29 22:33:03 -0600 (Sat, 29 Jan 2011) New Revision: 7104 Modified: branches/0.9.x/scipy/misc/tests/test_pilutil.py Log: TST: fix pilutil.imresize test. Patch by Mark Wiebe. (backport of r7092) Modified: branches/0.9.x/scipy/misc/tests/test_pilutil.py =================================================================== --- branches/0.9.x/scipy/misc/tests/test_pilutil.py 2011-01-30 04:31:16 UTC (rev 7103) +++ branches/0.9.x/scipy/misc/tests/test_pilutil.py 2011-01-30 04:33:03 UTC (rev 7104) @@ -21,7 +21,8 @@ def test_imresize(self): im = np.random.random((10,20)) for T in np.sctypes['float'] + [float]: - im1 = pilutil.imresize(im,T(1.1)) + # 1.1 rounds to below 1.1 for float16, 1.101 works + im1 = pilutil.imresize(im,T(1.101)) assert_equal(im1.shape,(11,22)) def test_imresize2(self): From scipy-svn at scipy.org Sat Jan 29 23:33:28 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 Jan 2011 22:33:28 -0600 (CST) Subject: [Scipy-svn] r7105 - in branches/0.9.x/scipy: optimize/lbfgsb sparse/linalg/eigen/arpack/ARPACK/UTIL Message-ID: <20110130043328.0CBA81B8CC3@scipy.org> Author: rgommers Date: 2011-01-29 22:33:27 -0600 (Sat, 29 Jan 2011) New Revision: 7105 Modified: branches/0.9.x/scipy/optimize/lbfgsb/routines.f branches/0.9.x/scipy/sparse/linalg/eigen/arpack/ARPACK/UTIL/second.f Log: BUG: use CPU_TIME intrinsic instead of ETIME in Fortran code (#1376) (backport of r7099) Modified: branches/0.9.x/scipy/optimize/lbfgsb/routines.f =================================================================== --- branches/0.9.x/scipy/optimize/lbfgsb/routines.f 2011-01-30 04:33:03 UTC (rev 7104) +++ branches/0.9.x/scipy/optimize/lbfgsb/routines.f 2011-01-30 04:33:27 UTC (rev 7105) @@ -3824,6 +3824,7 @@ subroutine timer(ttime) double precision ttime + real t1 c ********* c c Subroutine timer @@ -3846,15 +3847,9 @@ c Modified October 1990 by Brett M. Averick. c c ********** - real temp - real tarray(2) - real etime -c The first element of the array tarray specifies user time - - temp = etime(tarray) - - ttime = dble(tarray(1)) + call cpu_time(t1) + ttime = t1 return Modified: branches/0.9.x/scipy/sparse/linalg/eigen/arpack/ARPACK/UTIL/second.f =================================================================== --- branches/0.9.x/scipy/sparse/linalg/eigen/arpack/ARPACK/UTIL/second.f 2011-01-30 04:33:03 UTC (rev 7104) +++ branches/0.9.x/scipy/sparse/linalg/eigen/arpack/ARPACK/UTIL/second.f 2011-01-30 04:33:27 UTC (rev 7105) @@ -11,23 +11,10 @@ * ======= * * SECOND returns the user time for a process in seconds. -* This version gets the time from the system function ETIME. +* This version gets the time from the system function CPU_TIME. * -* .. Local Scalars .. - REAL T1 -* .. -* .. Local Arrays .. - REAL TARRAY( 2 ) -* .. -* .. External Functions .. - REAL ETIME -* EXTERNAL ETIME -* .. -* .. Executable Statements .. -* - T1 = ETIME( TARRAY ) - T = TARRAY( 1 ) + CALL CPU_TIME(T) RETURN * From scipy-svn at scipy.org Sat Jan 29 23:33:50 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 Jan 2011 22:33:50 -0600 (CST) Subject: [Scipy-svn] r7106 - in branches/0.9.x/scipy: lib/lapack linalg sparse/linalg/dsolve Message-ID: <20110130043350.BA65A1B8CC3@scipy.org> Author: rgommers Date: 2011-01-29 22:33:50 -0600 (Sat, 29 Jan 2011) New Revision: 7106 Modified: branches/0.9.x/scipy/lib/lapack/setup.py branches/0.9.x/scipy/linalg/setup.py branches/0.9.x/scipy/sparse/linalg/dsolve/setup.py Log: BUG: fix for build issue with MSCV 9, ifort and MKL. Patch by Christoph Gohkle. Closes #1376. (backport of r7103) Modified: branches/0.9.x/scipy/lib/lapack/setup.py =================================================================== --- branches/0.9.x/scipy/lib/lapack/setup.py 2011-01-30 04:33:27 UTC (rev 7105) +++ branches/0.9.x/scipy/lib/lapack/setup.py 2011-01-30 04:33:50 UTC (rev 7106) @@ -96,9 +96,15 @@ ) # atlas_version: + if os.name == 'nt' and 'FPATH' in os.environ: + define_macros = [('NO_ATLAS_INFO', 1)] + else: + define_macros = [] + config.add_extension('atlas_version', sources = ['atlas_version.c'], - extra_info = lapack_opt + extra_info = lapack_opt, + define_macros = define_macros ) config.add_data_dir('tests') Modified: branches/0.9.x/scipy/linalg/setup.py =================================================================== --- branches/0.9.x/scipy/linalg/setup.py 2011-01-30 04:33:27 UTC (rev 7105) +++ branches/0.9.x/scipy/linalg/setup.py 2011-01-30 04:33:50 UTC (rev 7106) @@ -1,5 +1,6 @@ #!/usr/bin/env python +import os from distutils.dep_util import newer_group, newer from os.path import join @@ -171,10 +172,15 @@ ) # atlas_version: + if os.name == 'nt' and 'FPATH' in os.environ: + define_macros = [('NO_ATLAS_INFO', 1)] + else: + define_macros = [] config.add_extension('atlas_version', ['atlas_version.c'], - extra_info = lapack_opt + extra_info = lapack_opt, + define_macros = define_macros ) config.add_data_dir('tests') Modified: branches/0.9.x/scipy/sparse/linalg/dsolve/setup.py =================================================================== --- branches/0.9.x/scipy/sparse/linalg/dsolve/setup.py 2011-01-30 04:33:27 UTC (rev 7105) +++ branches/0.9.x/scipy/sparse/linalg/dsolve/setup.py 2011-01-30 04:33:50 UTC (rev 7106) @@ -2,6 +2,7 @@ from os.path import join, dirname import sys import os +import glob def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration @@ -17,10 +18,15 @@ superlu_defs = [] superlu_defs.append(('USE_VENDOR_BLAS',1)) - superlu_src = os.path.join(dirname(__file__), 'SuperLU', 'SRC') + superlu_src = join(dirname(__file__), 'SuperLU', 'SRC') + sources = list(glob.glob(join(superlu_src, '*.c'))) + if os.name == 'nt' and 'FPATH' in os.environ: + # when using MSVC + MKL, lsame is already in MKL + sources.remove(join(superlu_src, 'lsame.c')) + config.add_library('superlu_src', - sources = [join(superlu_src,'*.c')], + sources = sources, macros = superlu_defs, include_dirs=[superlu_src], ) From scipy-svn at scipy.org Sun Jan 30 10:54:16 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 30 Jan 2011 09:54:16 -0600 (CST) Subject: [Scipy-svn] r7107 - branches/0.9.x Message-ID: <20110130155416.29AFC32381@scipy.org> Author: rgommers Date: 2011-01-30 09:54:15 -0600 (Sun, 30 Jan 2011) New Revision: 7107 Modified: branches/0.9.x/setup.py Log: REL: set version number to 0.9.0rc2 Modified: branches/0.9.x/setup.py =================================================================== --- branches/0.9.x/setup.py 2011-01-30 04:33:50 UTC (rev 7106) +++ branches/0.9.x/setup.py 2011-01-30 15:54:15 UTC (rev 7107) @@ -45,8 +45,8 @@ MAJOR = 0 MINOR = 9 MICRO = 0 -ISRELEASED = False -VERSION = '%d.%d.%drc1' % (MAJOR, MINOR, MICRO) +ISRELEASED = True +VERSION = '%d.%d.%drc2' % (MAJOR, MINOR, MICRO) # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly # update it when the contents of directories change. From scipy-svn at scipy.org Sun Jan 30 10:55:47 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 30 Jan 2011 09:55:47 -0600 (CST) Subject: [Scipy-svn] r7108 - tags Message-ID: <20110130155547.78C0032381@scipy.org> Author: rgommers Date: 2011-01-30 09:55:47 -0600 (Sun, 30 Jan 2011) New Revision: 7108 Added: tags/0.9.0rc2/ Log: Create tag 0.9.0rc2 From scipy-svn at scipy.org Sun Jan 30 16:05:45 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 30 Jan 2011 15:05:45 -0600 (CST) Subject: [Scipy-svn] r7109 - trunk/scipy/io/matlab/tests Message-ID: <20110130210545.88B011B8CBB@scipy.org> Author: ptvirtan Date: 2011-01-30 15:05:44 -0600 (Sun, 30 Jan 2011) New Revision: 7109 Modified: trunk/scipy/io/matlab/tests/test_streams.py Log: TST: io: close file handle before unlinking, for win32 (#1379) Thanks to C. Gohlke for the patch. Modified: trunk/scipy/io/matlab/tests/test_streams.py =================================================================== --- trunk/scipy/io/matlab/tests/test_streams.py 2011-01-30 15:55:47 UTC (rev 7108) +++ trunk/scipy/io/matlab/tests/test_streams.py 2011-01-30 21:05:44 UTC (rev 7109) @@ -43,6 +43,7 @@ def teardown(): global fname, fs + fs.close() del fs os.unlink(fname) From scipy-svn at scipy.org Mon Jan 31 16:14:51 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 Jan 2011 15:14:51 -0600 (CST) Subject: [Scipy-svn] r7110 - trunk/scipy/fftpack Message-ID: <20110131211451.AF3EC37A194@scipy.org> Author: ptvirtan Date: 2011-01-31 15:14:50 -0600 (Mon, 31 Jan 2011) New Revision: 7110 Modified: trunk/scipy/fftpack/basic.py Log: BUG: fftpack: fix data overwriting in FFT routines (#1353) The _fix_shape helper routine in some cases returns slices of the input array, which does not create copies. In those cases, one should not set overwrite_x=1. Modified: trunk/scipy/fftpack/basic.py =================================================================== --- trunk/scipy/fftpack/basic.py 2011-01-30 21:05:44 UTC (rev 7109) +++ trunk/scipy/fftpack/basic.py 2011-01-31 21:14:50 UTC (rev 7110) @@ -113,14 +113,14 @@ index = [slice(None)]*len(s) index[axis] = slice(0,n) x = x[index] + return x, False else: index = [slice(None)]*len(s) index[axis] = slice(0,s[axis]) s[axis] = n z = zeros(s,x.dtype.char) z[index] = x - x = z - return x + return z, True def _raw_fft(x, n, axis, direction, overwrite_x, work_function): @@ -128,8 +128,8 @@ if n is None: n = x.shape[axis] elif n != x.shape[axis]: - x = _fix_shape(x,n,axis) - overwrite_x = 1 + x, copy_made = _fix_shape(x,n,axis) + overwrite_x = overwrite_x or copy_made if axis == -1 or axis == len(x.shape)-1: r = work_function(x,n,direction,overwrite_x=overwrite_x) else: @@ -208,8 +208,8 @@ if n is None: n = tmp.shape[axis] elif n != tmp.shape[axis]: - tmp = _fix_shape(tmp,n,axis) - overwrite_x = 1 + tmp, copy_made = _fix_shape(tmp,n,axis) + overwrite_x = overwrite_x or copy_made if axis == -1 or axis == len(tmp.shape) - 1: return work_function(tmp,n,1,0,overwrite_x) @@ -261,8 +261,8 @@ if n is None: n = tmp.shape[axis] elif n != tmp.shape[axis]: - tmp = _fix_shape(tmp,n,axis) - overwrite_x = 1 + tmp, copy_made = _fix_shape(tmp,n,axis) + overwrite_x = overwrite_x or copy_made if axis == -1 or axis == len(tmp.shape) - 1: return work_function(tmp,n,-1,1,overwrite_x) @@ -379,7 +379,7 @@ # No need to swap axes, array is in C order if noaxes: for i in axes: - x = _fix_shape(x, s[i], i) + x, copy_made = _fix_shape(x, s[i], i) #print x.shape, s return work_function(x,s,direction,overwrite_x=overwrite_x) @@ -403,7 +403,7 @@ shape[waxes] = s for i in range(len(waxes)): - x = _fix_shape(x, s[i], waxes[i]) + x, copy_made = _fix_shape(x, s[i], waxes[i]) r = work_function(x, shape, direction, overwrite_x=overwrite_x) From scipy-svn at scipy.org Mon Jan 31 16:15:09 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 Jan 2011 15:15:09 -0600 (CST) Subject: [Scipy-svn] r7111 - trunk/scipy/fftpack/tests Message-ID: <20110131211509.753F437A194@scipy.org> Author: ptvirtan Date: 2011-01-31 15:15:09 -0600 (Mon, 31 Jan 2011) New Revision: 7111 Modified: trunk/scipy/fftpack/tests/test_basic.py trunk/scipy/fftpack/tests/test_pseudo_diffs.py trunk/scipy/fftpack/tests/test_real_transforms.py Log: TST: fftpack: add tests checking fft routine overwrite behavior Modified: trunk/scipy/fftpack/tests/test_basic.py =================================================================== --- trunk/scipy/fftpack/tests/test_basic.py 2011-01-31 21:14:50 UTC (rev 7110) +++ trunk/scipy/fftpack/tests/test_basic.py 2011-01-31 21:15:09 UTC (rev 7111) @@ -652,5 +652,109 @@ except ValueError: pass + + +class TestOverwrite(object): + """ + Check input overwrite behavior of the FFT functions + """ + + real_dtypes = [np.float32, np.float64] + dtypes = real_dtypes + [np.complex64, np.complex128] + + def _check(self, x, routine, fftsize, axis): + x2 = x.copy() + y = routine(x2, fftsize, axis) + + sig = "%s(%s%r, %r, axis=%r)" % (routine.__name__, x.dtype, x.shape, + fftsize, axis) + assert_equal(x2, x, err_msg="spurious overwrite in %s" % sig) + + def _check_1d(self, routine, dtype, shape, axis): + np.random.seed(1234) + if np.issubdtype(dtype, np.complexfloating): + data = np.random.randn(*shape) + 1j*np.random.randn(*shape) + else: + data = np.random.randn(*shape) + data = data.astype(dtype) + + for fftsize in [8, 16, 32]: + self._check(data, routine, fftsize, axis) + + def test_fft(self): + for dtype in self.dtypes: + self._check_1d(fft, dtype, (16,), -1) + self._check_1d(fft, dtype, (16, 2), 0) + self._check_1d(fft, dtype, (2, 16), 1) + + def test_ifft(self): + for dtype in self.dtypes: + self._check_1d(ifft, dtype, (16,), -1) + self._check_1d(ifft, dtype, (16, 2), 0) + self._check_1d(ifft, dtype, (2, 16), 1) + + def test_rfft(self): + for dtype in self.real_dtypes: + self._check_1d(rfft, dtype, (16,), -1) + self._check_1d(rfft, dtype, (16, 2), 0) + self._check_1d(rfft, dtype, (2, 16), 1) + + def test_irfft(self): + for dtype in self.real_dtypes: + self._check_1d(irfft, dtype, (16,), -1) + self._check_1d(irfft, dtype, (16, 2), 0) + self._check_1d(irfft, dtype, (2, 16), 1) + + def _check_nd_one(self, routine, dtype, shape, axes): + np.random.seed(1234) + if np.issubdtype(dtype, np.complexfloating): + data = np.random.randn(*shape) + 1j*np.random.randn(*shape) + else: + data = np.random.randn(*shape) + data = data.astype(dtype) + + def fftshape_iter(shp): + if len(shp) <= 0: + yield () + else: + for j in (shp[0]//2, shp[0], shp[0]*2): + for rest in fftshape_iter(shp[1:]): + yield (j,) + rest + + if axes is None: + part_shape = shape + else: + part_shape = tuple(np.take(shape, axes)) + + for fftshape in fftshape_iter(part_shape): + self._check(data, routine, fftshape, axes) + if data.ndim > 1: + # check fortran order: it never overwrites + self._check(data.T, routine, fftshape, axes) + + def _check_nd(self, routine, dtype): + self._check_nd_one(routine, dtype, (16,), None) + self._check_nd_one(routine, dtype, (16,), (0,)) + self._check_nd_one(routine, dtype, (16, 2), (0,)) + self._check_nd_one(routine, dtype, (2, 16), (1,)) + self._check_nd_one(routine, dtype, (8, 16), None) + self._check_nd_one(routine, dtype, (8, 16), (0, 1)) + self._check_nd_one(routine, dtype, (8, 16, 2), (0, 1)) + self._check_nd_one(routine, dtype, (8, 16, 2), (1, 2)) + self._check_nd_one(routine, dtype, (8, 16, 2), (0,)) + self._check_nd_one(routine, dtype, (8, 16, 2), (1,)) + self._check_nd_one(routine, dtype, (8, 16, 2), (2,)) + self._check_nd_one(routine, dtype, (8, 16, 2), None) + self._check_nd_one(routine, dtype, (8, 16, 2), (0,1,2)) + + def test_fftn(self): + for dtype in self.dtypes: + self._check_nd(fftn, dtype) + + def test_ifftn(self): + for dtype in self.dtypes: + self._check_nd(ifftn, dtype) + + if __name__ == "__main__": run_module_suite() Modified: trunk/scipy/fftpack/tests/test_pseudo_diffs.py =================================================================== --- trunk/scipy/fftpack/tests/test_pseudo_diffs.py 2011-01-31 21:14:50 UTC (rev 7110) +++ trunk/scipy/fftpack/tests/test_pseudo_diffs.py 2011-01-31 21:15:09 UTC (rev 7111) @@ -13,8 +13,10 @@ from numpy.testing import * from scipy.fftpack import diff, fft, ifft, tilbert, itilbert, hilbert, \ - ihilbert, shift, fftfreq + ihilbert, shift, fftfreq, cs_diff, sc_diff, \ + ss_diff, cc_diff +import numpy as np from numpy import arange, sin, cos, pi, exp, tanh, sum, sign def random(size): @@ -312,5 +314,68 @@ assert_array_almost_equal(shift(sin(x),pi/2),cos(x)) +class TestOverwrite(object): + """ + Check input overwrite behavior + """ + + real_dtypes = [np.float32, np.float64] + dtypes = real_dtypes + [np.complex64, np.complex128] + + def _check(self, x, routine, *args, **kwargs): + x2 = x.copy() + y = routine(x2, *args, **kwargs) + sig = routine.__name__ + if args: + sig += repr(args) + if kwargs: + sig += repr(kwargs) + assert_equal(x2, x, err_msg="spurious overwrite in %s" % sig) + + def _check_1d(self, routine, dtype, shape, *args, **kwargs): + np.random.seed(1234) + if np.issubdtype(dtype, np.complexfloating): + data = np.random.randn(*shape) + 1j*np.random.randn(*shape) + else: + data = np.random.randn(*shape) + data = data.astype(dtype) + self._check(data, routine, *args, **kwargs) + + def test_diff(self): + for dtype in self.dtypes: + self._check_1d(diff, dtype, (16,)) + + def test_tilbert(self): + for dtype in self.dtypes: + self._check_1d(tilbert, dtype, (16,), 1.6) + + def test_itilbert(self): + for dtype in self.dtypes: + self._check_1d(itilbert, dtype, (16,), 1.6) + + def test_hilbert(self): + for dtype in self.dtypes: + self._check_1d(hilbert, dtype, (16,)) + + def test_cs_diff(self): + for dtype in self.dtypes: + self._check_1d(cs_diff, dtype, (16,), 1.0, 4.0) + + def test_sc_diff(self): + for dtype in self.dtypes: + self._check_1d(sc_diff, dtype, (16,), 1.0, 4.0) + + def test_ss_diff(self): + for dtype in self.dtypes: + self._check_1d(ss_diff, dtype, (16,), 1.0, 4.0) + + def test_cc_diff(self): + for dtype in self.dtypes: + self._check_1d(cc_diff, dtype, (16,), 1.0, 4.0) + + def test_shift(self): + for dtype in self.dtypes: + self._check_1d(shift, dtype, (16,), 1.0) + if __name__ == "__main__": run_module_suite() Modified: trunk/scipy/fftpack/tests/test_real_transforms.py =================================================================== --- trunk/scipy/fftpack/tests/test_real_transforms.py 2011-01-31 21:14:50 UTC (rev 7110) +++ trunk/scipy/fftpack/tests/test_real_transforms.py 2011-01-31 21:15:09 UTC (rev 7111) @@ -3,7 +3,7 @@ import numpy as np from numpy.fft import fft as numfft -from numpy.testing import assert_array_almost_equal, TestCase +from numpy.testing import assert_array_almost_equal, assert_equal, TestCase from scipy.fftpack.realtransforms import dct, idct @@ -47,8 +47,8 @@ # XXX: we divide by np.max(y) because the tests fail otherwise. We # should really use something like assert_array_approx_equal. The # difference is due to fftw using a better algorithm w.r.t error - # propagation compared to the ones from fftpack. - assert_array_almost_equal(y / np.max(y), yr / np.max(y), decimal=self.dec, + # propagation compared to the ones from fftpack. + assert_array_almost_equal(y / np.max(y), yr / np.max(y), decimal=self.dec, err_msg="Size %d failed" % i) def test_axis(self): @@ -144,8 +144,8 @@ # XXX: we divide by np.max(y) because the tests fail otherwise. We # should really use something like assert_array_approx_equal. The # difference is due to fftw using a better algorithm w.r.t error - # propagation compared to the ones from fftpack. - assert_array_almost_equal(x / np.max(x), xr / np.max(x), decimal=self.dec, + # propagation compared to the ones from fftpack. + assert_array_almost_equal(x / np.max(x), xr / np.max(x), decimal=self.dec, err_msg="Size %d failed" % i) class TestIDCTIDouble(_TestIDCTBase): @@ -184,5 +184,46 @@ self.dec = 5 self.type = 3 +class TestOverwrite(object): + """ + Check input overwrite behavior + """ + + real_dtypes = [np.float32, np.float64] + + def _check(self, x, routine, type, fftsize, axis, norm): + x2 = x.copy() + y = routine(x2, type, fftsize, axis, norm) + + sig = "%s(%s%r, %r, axis=%r)" % ( + routine.__name__, x.dtype, x.shape, fftsize, axis) + assert_equal(x2, x, err_msg="spurious overwrite in %s" % sig) + + def _check_1d(self, routine, dtype, shape, axis): + np.random.seed(1234) + if np.issubdtype(dtype, np.complexfloating): + data = np.random.randn(*shape) + 1j*np.random.randn(*shape) + else: + data = np.random.randn(*shape) + data = data.astype(dtype) + + for type in [1, 2, 3]: + for norm in [None, 'ortho']: + if type == 1 and norm == 'ortho': + continue + self._check(data, routine, type, None, axis, norm) + + def test_dct(self): + for dtype in self.real_dtypes: + self._check_1d(dct, dtype, (16,), -1) + self._check_1d(dct, dtype, (16, 2), 0) + self._check_1d(dct, dtype, (2, 16), 1) + + def test_idct(self): + for dtype in self.real_dtypes: + self._check_1d(idct, dtype, (16,), -1) + self._check_1d(idct, dtype, (16, 2), 0) + self._check_1d(idct, dtype, (2, 16), 1) + if __name__ == "__main__": np.testing.run_module_suite() From scipy-svn at scipy.org Mon Jan 31 16:18:44 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 Jan 2011 15:18:44 -0600 (CST) Subject: [Scipy-svn] r7112 - branches/0.9.x/scipy/fftpack Message-ID: <20110131211844.1EDD737A194@scipy.org> Author: ptvirtan Date: 2011-01-31 15:18:43 -0600 (Mon, 31 Jan 2011) New Revision: 7112 Modified: branches/0.9.x/scipy/fftpack/basic.py Log: BUG: fftpack: fix data overwriting in FFT routines (#1353) The _fix_shape helper routine in some cases returns slices of the input array, which does not create copies. In those cases, one should not set overwrite_x=1. (backport of r7110) Modified: branches/0.9.x/scipy/fftpack/basic.py =================================================================== --- branches/0.9.x/scipy/fftpack/basic.py 2011-01-31 21:15:09 UTC (rev 7111) +++ branches/0.9.x/scipy/fftpack/basic.py 2011-01-31 21:18:43 UTC (rev 7112) @@ -113,14 +113,14 @@ index = [slice(None)]*len(s) index[axis] = slice(0,n) x = x[index] + return x, False else: index = [slice(None)]*len(s) index[axis] = slice(0,s[axis]) s[axis] = n z = zeros(s,x.dtype.char) z[index] = x - x = z - return x + return z, True def _raw_fft(x, n, axis, direction, overwrite_x, work_function): @@ -128,8 +128,8 @@ if n is None: n = x.shape[axis] elif n != x.shape[axis]: - x = _fix_shape(x,n,axis) - overwrite_x = 1 + x, copy_made = _fix_shape(x,n,axis) + overwrite_x = overwrite_x or copy_made if axis == -1 or axis == len(x.shape)-1: r = work_function(x,n,direction,overwrite_x=overwrite_x) else: @@ -208,8 +208,8 @@ if n is None: n = tmp.shape[axis] elif n != tmp.shape[axis]: - tmp = _fix_shape(tmp,n,axis) - overwrite_x = 1 + tmp, copy_made = _fix_shape(tmp,n,axis) + overwrite_x = overwrite_x or copy_made if axis == -1 or axis == len(tmp.shape) - 1: return work_function(tmp,n,1,0,overwrite_x) @@ -261,8 +261,8 @@ if n is None: n = tmp.shape[axis] elif n != tmp.shape[axis]: - tmp = _fix_shape(tmp,n,axis) - overwrite_x = 1 + tmp, copy_made = _fix_shape(tmp,n,axis) + overwrite_x = overwrite_x or copy_made if axis == -1 or axis == len(tmp.shape) - 1: return work_function(tmp,n,-1,1,overwrite_x) @@ -379,7 +379,7 @@ # No need to swap axes, array is in C order if noaxes: for i in axes: - x = _fix_shape(x, s[i], i) + x, copy_made = _fix_shape(x, s[i], i) #print x.shape, s return work_function(x,s,direction,overwrite_x=overwrite_x) @@ -403,7 +403,7 @@ shape[waxes] = s for i in range(len(waxes)): - x = _fix_shape(x, s[i], waxes[i]) + x, copy_made = _fix_shape(x, s[i], waxes[i]) r = work_function(x, shape, direction, overwrite_x=overwrite_x) From scipy-svn at scipy.org Mon Jan 31 16:18:57 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 Jan 2011 15:18:57 -0600 (CST) Subject: [Scipy-svn] r7113 - branches/0.9.x/scipy/fftpack/tests Message-ID: <20110131211857.4998737A194@scipy.org> Author: ptvirtan Date: 2011-01-31 15:18:57 -0600 (Mon, 31 Jan 2011) New Revision: 7113 Modified: branches/0.9.x/scipy/fftpack/tests/test_basic.py branches/0.9.x/scipy/fftpack/tests/test_pseudo_diffs.py branches/0.9.x/scipy/fftpack/tests/test_real_transforms.py Log: TST: fftpack: add tests checking fft routine overwrite behavior (backport of r7111) Modified: branches/0.9.x/scipy/fftpack/tests/test_basic.py =================================================================== --- branches/0.9.x/scipy/fftpack/tests/test_basic.py 2011-01-31 21:18:43 UTC (rev 7112) +++ branches/0.9.x/scipy/fftpack/tests/test_basic.py 2011-01-31 21:18:57 UTC (rev 7113) @@ -652,5 +652,109 @@ except ValueError: pass + + +class TestOverwrite(object): + """ + Check input overwrite behavior of the FFT functions + """ + + real_dtypes = [np.float32, np.float64] + dtypes = real_dtypes + [np.complex64, np.complex128] + + def _check(self, x, routine, fftsize, axis): + x2 = x.copy() + y = routine(x2, fftsize, axis) + + sig = "%s(%s%r, %r, axis=%r)" % (routine.__name__, x.dtype, x.shape, + fftsize, axis) + assert_equal(x2, x, err_msg="spurious overwrite in %s" % sig) + + def _check_1d(self, routine, dtype, shape, axis): + np.random.seed(1234) + if np.issubdtype(dtype, np.complexfloating): + data = np.random.randn(*shape) + 1j*np.random.randn(*shape) + else: + data = np.random.randn(*shape) + data = data.astype(dtype) + + for fftsize in [8, 16, 32]: + self._check(data, routine, fftsize, axis) + + def test_fft(self): + for dtype in self.dtypes: + self._check_1d(fft, dtype, (16,), -1) + self._check_1d(fft, dtype, (16, 2), 0) + self._check_1d(fft, dtype, (2, 16), 1) + + def test_ifft(self): + for dtype in self.dtypes: + self._check_1d(ifft, dtype, (16,), -1) + self._check_1d(ifft, dtype, (16, 2), 0) + self._check_1d(ifft, dtype, (2, 16), 1) + + def test_rfft(self): + for dtype in self.real_dtypes: + self._check_1d(rfft, dtype, (16,), -1) + self._check_1d(rfft, dtype, (16, 2), 0) + self._check_1d(rfft, dtype, (2, 16), 1) + + def test_irfft(self): + for dtype in self.real_dtypes: + self._check_1d(irfft, dtype, (16,), -1) + self._check_1d(irfft, dtype, (16, 2), 0) + self._check_1d(irfft, dtype, (2, 16), 1) + + def _check_nd_one(self, routine, dtype, shape, axes): + np.random.seed(1234) + if np.issubdtype(dtype, np.complexfloating): + data = np.random.randn(*shape) + 1j*np.random.randn(*shape) + else: + data = np.random.randn(*shape) + data = data.astype(dtype) + + def fftshape_iter(shp): + if len(shp) <= 0: + yield () + else: + for j in (shp[0]//2, shp[0], shp[0]*2): + for rest in fftshape_iter(shp[1:]): + yield (j,) + rest + + if axes is None: + part_shape = shape + else: + part_shape = tuple(np.take(shape, axes)) + + for fftshape in fftshape_iter(part_shape): + self._check(data, routine, fftshape, axes) + if data.ndim > 1: + # check fortran order: it never overwrites + self._check(data.T, routine, fftshape, axes) + + def _check_nd(self, routine, dtype): + self._check_nd_one(routine, dtype, (16,), None) + self._check_nd_one(routine, dtype, (16,), (0,)) + self._check_nd_one(routine, dtype, (16, 2), (0,)) + self._check_nd_one(routine, dtype, (2, 16), (1,)) + self._check_nd_one(routine, dtype, (8, 16), None) + self._check_nd_one(routine, dtype, (8, 16), (0, 1)) + self._check_nd_one(routine, dtype, (8, 16, 2), (0, 1)) + self._check_nd_one(routine, dtype, (8, 16, 2), (1, 2)) + self._check_nd_one(routine, dtype, (8, 16, 2), (0,)) + self._check_nd_one(routine, dtype, (8, 16, 2), (1,)) + self._check_nd_one(routine, dtype, (8, 16, 2), (2,)) + self._check_nd_one(routine, dtype, (8, 16, 2), None) + self._check_nd_one(routine, dtype, (8, 16, 2), (0,1,2)) + + def test_fftn(self): + for dtype in self.dtypes: + self._check_nd(fftn, dtype) + + def test_ifftn(self): + for dtype in self.dtypes: + self._check_nd(ifftn, dtype) + + if __name__ == "__main__": run_module_suite() Modified: branches/0.9.x/scipy/fftpack/tests/test_pseudo_diffs.py =================================================================== --- branches/0.9.x/scipy/fftpack/tests/test_pseudo_diffs.py 2011-01-31 21:18:43 UTC (rev 7112) +++ branches/0.9.x/scipy/fftpack/tests/test_pseudo_diffs.py 2011-01-31 21:18:57 UTC (rev 7113) @@ -13,8 +13,10 @@ from numpy.testing import * from scipy.fftpack import diff, fft, ifft, tilbert, itilbert, hilbert, \ - ihilbert, shift, fftfreq + ihilbert, shift, fftfreq, cs_diff, sc_diff, \ + ss_diff, cc_diff +import numpy as np from numpy import arange, sin, cos, pi, exp, tanh, sum, sign def random(size): @@ -312,5 +314,68 @@ assert_array_almost_equal(shift(sin(x),pi/2),cos(x)) +class TestOverwrite(object): + """ + Check input overwrite behavior + """ + + real_dtypes = [np.float32, np.float64] + dtypes = real_dtypes + [np.complex64, np.complex128] + + def _check(self, x, routine, *args, **kwargs): + x2 = x.copy() + y = routine(x2, *args, **kwargs) + sig = routine.__name__ + if args: + sig += repr(args) + if kwargs: + sig += repr(kwargs) + assert_equal(x2, x, err_msg="spurious overwrite in %s" % sig) + + def _check_1d(self, routine, dtype, shape, *args, **kwargs): + np.random.seed(1234) + if np.issubdtype(dtype, np.complexfloating): + data = np.random.randn(*shape) + 1j*np.random.randn(*shape) + else: + data = np.random.randn(*shape) + data = data.astype(dtype) + self._check(data, routine, *args, **kwargs) + + def test_diff(self): + for dtype in self.dtypes: + self._check_1d(diff, dtype, (16,)) + + def test_tilbert(self): + for dtype in self.dtypes: + self._check_1d(tilbert, dtype, (16,), 1.6) + + def test_itilbert(self): + for dtype in self.dtypes: + self._check_1d(itilbert, dtype, (16,), 1.6) + + def test_hilbert(self): + for dtype in self.dtypes: + self._check_1d(hilbert, dtype, (16,)) + + def test_cs_diff(self): + for dtype in self.dtypes: + self._check_1d(cs_diff, dtype, (16,), 1.0, 4.0) + + def test_sc_diff(self): + for dtype in self.dtypes: + self._check_1d(sc_diff, dtype, (16,), 1.0, 4.0) + + def test_ss_diff(self): + for dtype in self.dtypes: + self._check_1d(ss_diff, dtype, (16,), 1.0, 4.0) + + def test_cc_diff(self): + for dtype in self.dtypes: + self._check_1d(cc_diff, dtype, (16,), 1.0, 4.0) + + def test_shift(self): + for dtype in self.dtypes: + self._check_1d(shift, dtype, (16,), 1.0) + if __name__ == "__main__": run_module_suite() Modified: branches/0.9.x/scipy/fftpack/tests/test_real_transforms.py =================================================================== --- branches/0.9.x/scipy/fftpack/tests/test_real_transforms.py 2011-01-31 21:18:43 UTC (rev 7112) +++ branches/0.9.x/scipy/fftpack/tests/test_real_transforms.py 2011-01-31 21:18:57 UTC (rev 7113) @@ -3,7 +3,7 @@ import numpy as np from numpy.fft import fft as numfft -from numpy.testing import assert_array_almost_equal, TestCase +from numpy.testing import assert_array_almost_equal, assert_equal, TestCase from scipy.fftpack.realtransforms import dct, idct @@ -47,8 +47,8 @@ # XXX: we divide by np.max(y) because the tests fail otherwise. We # should really use something like assert_array_approx_equal. The # difference is due to fftw using a better algorithm w.r.t error - # propagation compared to the ones from fftpack. - assert_array_almost_equal(y / np.max(y), yr / np.max(y), decimal=self.dec, + # propagation compared to the ones from fftpack. + assert_array_almost_equal(y / np.max(y), yr / np.max(y), decimal=self.dec, err_msg="Size %d failed" % i) def test_axis(self): @@ -144,8 +144,8 @@ # XXX: we divide by np.max(y) because the tests fail otherwise. We # should really use something like assert_array_approx_equal. The # difference is due to fftw using a better algorithm w.r.t error - # propagation compared to the ones from fftpack. - assert_array_almost_equal(x / np.max(x), xr / np.max(x), decimal=self.dec, + # propagation compared to the ones from fftpack. + assert_array_almost_equal(x / np.max(x), xr / np.max(x), decimal=self.dec, err_msg="Size %d failed" % i) class TestIDCTIDouble(_TestIDCTBase): @@ -184,5 +184,46 @@ self.dec = 5 self.type = 3 +class TestOverwrite(object): + """ + Check input overwrite behavior + """ + + real_dtypes = [np.float32, np.float64] + + def _check(self, x, routine, type, fftsize, axis, norm): + x2 = x.copy() + y = routine(x2, type, fftsize, axis, norm) + + sig = "%s(%s%r, %r, axis=%r)" % ( + routine.__name__, x.dtype, x.shape, fftsize, axis) + assert_equal(x2, x, err_msg="spurious overwrite in %s" % sig) + + def _check_1d(self, routine, dtype, shape, axis): + np.random.seed(1234) + if np.issubdtype(dtype, np.complexfloating): + data = np.random.randn(*shape) + 1j*np.random.randn(*shape) + else: + data = np.random.randn(*shape) + data = data.astype(dtype) + + for type in [1, 2, 3]: + for norm in [None, 'ortho']: + if type == 1 and norm == 'ortho': + continue + self._check(data, routine, type, None, axis, norm) + + def test_dct(self): + for dtype in self.real_dtypes: + self._check_1d(dct, dtype, (16,), -1) + self._check_1d(dct, dtype, (16, 2), 0) + self._check_1d(dct, dtype, (2, 16), 1) + + def test_idct(self): + for dtype in self.real_dtypes: + self._check_1d(idct, dtype, (16,), -1) + self._check_1d(idct, dtype, (16, 2), 0) + self._check_1d(idct, dtype, (2, 16), 1) + if __name__ == "__main__": np.testing.run_module_suite() From scipy-svn at scipy.org Mon Jan 31 16:51:56 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 Jan 2011 15:51:56 -0600 (CST) Subject: [Scipy-svn] r7114 - in trunk/scipy/special: . tests Message-ID: <20110131215156.4EB8337A196@scipy.org> Author: ptvirtan Date: 2011-01-31 15:51:56 -0600 (Mon, 31 Jan 2011) New Revision: 7114 Added: trunk/scipy/special/_testutils.py Removed: trunk/scipy/special/tests/testutils.py Modified: trunk/scipy/special/tests/test_basic.py trunk/scipy/special/tests/test_data.py trunk/scipy/special/tests/test_lambertw.py trunk/scipy/special/tests/test_mpmath.py trunk/scipy/special/tests/test_orthogonal_eval.py Log: TST: move local test helper in the modules -- nose doesn't like them in tests/ Apparently, nose puts all test/ directories in sys.path, and so one cannot have more than one "testutils.py" in total. Better to have them as a _testutils module in the subpackage. Copied: trunk/scipy/special/_testutils.py (from rev 7111, trunk/scipy/special/tests/testutils.py) =================================================================== --- trunk/scipy/special/_testutils.py (rev 0) +++ trunk/scipy/special/_testutils.py 2011-01-31 21:51:56 UTC (rev 7114) @@ -0,0 +1,236 @@ +import os +import warnings + +import numpy as np +from numpy.testing import assert_ +from numpy.testing.noseclasses import KnownFailureTest + +import scipy.special as sc + +__all__ = ['with_special_errors', 'assert_tol_equal', 'assert_func_equal', + 'FuncData'] + +#------------------------------------------------------------------------------ +# Enable convergence and loss of precision warnings -- turn off one by one +#------------------------------------------------------------------------------ + +def with_special_errors(func): + """ + Enable special function errors (such as underflow, overflow, + loss of precision, etc.) + """ + def wrapper(*a, **kw): + old_filters = list(getattr(warnings, 'filters', [])) + old_errprint = sc.errprint(1) + warnings.filterwarnings("error", category=sc.SpecialFunctionWarning) + try: + return func(*a, **kw) + finally: + sc.errprint(old_errprint) + setattr(warnings, 'filters', old_filters) + wrapper.__name__ = func.__name__ + wrapper.__doc__ = func.__doc__ + return wrapper + +#------------------------------------------------------------------------------ +# Comparing function values at many data points at once, with helpful +#------------------------------------------------------------------------------ + +def assert_tol_equal(a, b, rtol=1e-7, atol=0, err_msg='', verbose=True): + """Assert that `a` and `b` are equal to tolerance ``atol + rtol*abs(b)``""" + def compare(x, y): + return np.allclose(x, y, rtol=rtol, atol=atol) + a, b = np.asanyarray(a), np.asanyarray(b) + header = 'Not equal to tolerance rtol=%g, atol=%g' % (rtol, atol) + np.testing.utils.assert_array_compare(compare, a, b, err_msg=str(err_msg), + verbose=verbose, header=header) + +#------------------------------------------------------------------------------ +# Comparing function values at many data points at once, with helpful +# error reports +#------------------------------------------------------------------------------ + +def assert_func_equal(func, results, points, rtol=None, atol=None, + param_filter=None, knownfailure=None, + vectorized=True, dtype=None): + if hasattr(points, 'next'): + # it's a generator + points = list(points) + + points = np.asarray(points) + if points.ndim == 1: + points = points[:,None] + + if hasattr(results, '__name__'): + # function + if vectorized: + results = results(*tuple(points.T)) + else: + results = np.array([results(*tuple(p)) for p in points]) + if results.dtype == object: + try: + results = results.astype(float) + except TypeError: + results = results.astype(complex) + else: + results = np.asarray(results) + + npoints = points.shape[1] + + data = np.c_[points, results] + fdata = FuncData(func, data, range(npoints), range(npoints, data.shape[1]), + rtol=rtol, atol=atol, param_filter=param_filter, + knownfailure=knownfailure) + fdata.check() + +class FuncData(object): + """ + Data set for checking a special function. + + Parameters + ---------- + func : function + Function to test + filename : str + Input file name + param_columns : int or tuple of ints + Columns indices in which the parameters to `func` lie. + Can be imaginary integers to indicate that the parameter + should be cast to complex. + result_columns : int or tuple of ints + Column indices for expected results from `func`. + rtol : float, optional + Required relative tolerance. Default is 5*eps. + atol : float, optional + Required absolute tolerance. Default is 5*tiny. + param_filter : function, or tuple of functions/Nones, optional + Filter functions to exclude some parameter ranges. + If omitted, no filtering is done. + knownfailure : str, optional + Known failure error message to raise when the test is run. + If omitted, no exception is raised. + + """ + + def __init__(self, func, data, param_columns, result_columns, + rtol=None, atol=None, param_filter=None, knownfailure=None, + dataname=None): + self.func = func + self.data = data + self.dataname = dataname + if not hasattr(param_columns, '__len__'): + param_columns = (param_columns,) + if not hasattr(result_columns, '__len__'): + result_columns = (result_columns,) + self.param_columns = tuple(param_columns) + self.result_columns = tuple(result_columns) + self.rtol = rtol + self.atol = atol + if not hasattr(param_filter, '__len__'): + param_filter = (param_filter,) + self.param_filter = param_filter + self.knownfailure = knownfailure + + def get_tolerances(self, dtype): + info = np.finfo(dtype) + rtol, atol = self.rtol, self.atol + if rtol is None: + rtol = 5*info.eps + if atol is None: + atol = 5*info.tiny + return rtol, atol + + def check(self, data=None, dtype=None): + """Check the special function against the data.""" + + if self.knownfailure: + raise KnownFailureTest(self.knownfailure) + + if data is None: + data = self.data + + if dtype is None: + dtype = data.dtype + else: + data = data.astype(dtype) + + rtol, atol = self.get_tolerances(dtype) + + # Apply given filter functions + if self.param_filter: + param_mask = np.ones((data.shape[0],), np.bool_) + for j, filter in zip(self.param_columns, self.param_filter): + if filter: + param_mask &= filter(data[:,j]) + data = data[param_mask] + + # Pick parameters and results from the correct columns + params = [] + for j in self.param_columns: + if np.iscomplexobj(j): + j = int(j.imag) + params.append(data[:,j].astype(np.complex)) + else: + params.append(data[:,j]) + wanted = tuple([data[:,j] for j in self.result_columns]) + + # Evaluate + got = self.func(*params) + if not isinstance(got, tuple): + got = (got,) + + # Check the validity of each output returned + + assert_(len(got) == len(wanted)) + + for output_num, (x, y) in enumerate(zip(got, wanted)): + pinf_x = np.isinf(x) & (x > 0) + pinf_y = np.isinf(y) & (x > 0) + minf_x = np.isinf(x) & (x < 0) + minf_y = np.isinf(y) & (x < 0) + nan_x = np.isnan(x) + nan_y = np.isnan(y) + + abs_y = np.absolute(y) + abs_y[~np.isfinite(abs_y)] = 0 + diff = np.absolute(x - y) + diff[~np.isfinite(diff)] = 0 + + rdiff = diff / np.absolute(y) + rdiff[~np.isfinite(rdiff)] = 0 + + tol_mask = (diff < atol + rtol*abs_y) + pinf_mask = (pinf_x == pinf_y) + minf_mask = (minf_x == minf_y) + nan_mask = (nan_x == nan_y) + + bad_j = ~(tol_mask & pinf_mask & minf_mask & nan_mask) + + if np.any(bad_j): + # Some bad results: inform what, where, and how bad + msg = [""] + msg.append("Max |adiff|: %g" % diff.max()) + msg.append("Max |rdiff|: %g" % rdiff.max()) + msg.append("Bad results for the following points (in output %d):" + % output_num) + for j in np.where(bad_j)[0]: + j = int(j) + fmt = lambda x: "%30s" % np.array2string(x[j], precision=18) + a = " ".join(map(fmt, params)) + b = " ".join(map(fmt, got)) + c = " ".join(map(fmt, wanted)) + d = fmt(rdiff) + msg.append("%s => %s != %s (rdiff %s)" % (a, b, c, d)) + assert_(False, "\n".join(msg)) + + def __repr__(self): + """Pretty-printing, esp. for Nose output""" + if np.any(map(np.iscomplexobj, self.param_columns)): + is_complex = " (complex)" + else: + is_complex = "" + if self.dataname: + return "" % (self.func.__name__, is_complex, + os.path.basename(self.dataname)) + else: + return "" % (self.func.__name__, is_complex) Modified: trunk/scipy/special/tests/test_basic.py =================================================================== --- trunk/scipy/special/tests/test_basic.py 2011-01-31 21:18:57 UTC (rev 7113) +++ trunk/scipy/special/tests/test_basic.py 2011-01-31 21:51:56 UTC (rev 7114) @@ -30,7 +30,7 @@ from scipy import special import scipy.special._cephes as cephes -from testutils import assert_tol_equal, with_special_errors +from scipy.special._testutils import assert_tol_equal, with_special_errors class TestCephes(TestCase): def test_airy(self): Modified: trunk/scipy/special/tests/test_data.py =================================================================== --- trunk/scipy/special/tests/test_data.py 2011-01-31 21:18:57 UTC (rev 7113) +++ trunk/scipy/special/tests/test_data.py 2011-01-31 21:51:56 UTC (rev 7114) @@ -8,7 +8,7 @@ zeta, gammaincinv, lpmv ) -from testutils import FuncData +from scipy.special._testutils import FuncData DATASETS = np.load(os.path.join(os.path.dirname(__file__), "data", "boost.npz")) Modified: trunk/scipy/special/tests/test_lambertw.py =================================================================== --- trunk/scipy/special/tests/test_lambertw.py 2011-01-31 21:18:57 UTC (rev 7113) +++ trunk/scipy/special/tests/test_lambertw.py 2011-01-31 21:51:56 UTC (rev 7114) @@ -11,7 +11,7 @@ from scipy.special import lambertw from numpy import nan, inf, pi, e, isnan, log, r_, array, complex_ -from testutils import FuncData +from scipy.special._testutils import FuncData def test_values(): Modified: trunk/scipy/special/tests/test_mpmath.py =================================================================== --- trunk/scipy/special/tests/test_mpmath.py 2011-01-31 21:18:57 UTC (rev 7113) +++ trunk/scipy/special/tests/test_mpmath.py 2011-01-31 21:51:56 UTC (rev 7114) @@ -7,7 +7,7 @@ from numpy.testing import dec import scipy.special as sc -from testutils import FuncData, assert_func_equal +from scipy.special._testutils import FuncData, assert_func_equal try: import mpmath Modified: trunk/scipy/special/tests/test_orthogonal_eval.py =================================================================== --- trunk/scipy/special/tests/test_orthogonal_eval.py 2011-01-31 21:18:57 UTC (rev 7113) +++ trunk/scipy/special/tests/test_orthogonal_eval.py 2011-01-31 21:51:56 UTC (rev 7114) @@ -2,7 +2,7 @@ from numpy.testing import assert_ import scipy.special.orthogonal as orth -from testutils import FuncData +from scipy.special._testutils import FuncData def test_eval_chebyt(): Deleted: trunk/scipy/special/tests/testutils.py =================================================================== --- trunk/scipy/special/tests/testutils.py 2011-01-31 21:18:57 UTC (rev 7113) +++ trunk/scipy/special/tests/testutils.py 2011-01-31 21:51:56 UTC (rev 7114) @@ -1,236 +0,0 @@ -import os -import warnings - -import numpy as np -from numpy.testing import assert_ -from numpy.testing.noseclasses import KnownFailureTest - -import scipy.special as sc - -__all__ = ['with_special_errors', 'assert_tol_equal', 'assert_func_equal', - 'FuncData'] - -#------------------------------------------------------------------------------ -# Enable convergence and loss of precision warnings -- turn off one by one -#------------------------------------------------------------------------------ - -def with_special_errors(func): - """ - Enable special function errors (such as underflow, overflow, - loss of precision, etc.) - """ - def wrapper(*a, **kw): - old_filters = list(getattr(warnings, 'filters', [])) - old_errprint = sc.errprint(1) - warnings.filterwarnings("error", category=sc.SpecialFunctionWarning) - try: - return func(*a, **kw) - finally: - sc.errprint(old_errprint) - setattr(warnings, 'filters', old_filters) - wrapper.__name__ = func.__name__ - wrapper.__doc__ = func.__doc__ - return wrapper - -#------------------------------------------------------------------------------ -# Comparing function values at many data points at once, with helpful -#------------------------------------------------------------------------------ - -def assert_tol_equal(a, b, rtol=1e-7, atol=0, err_msg='', verbose=True): - """Assert that `a` and `b` are equal to tolerance ``atol + rtol*abs(b)``""" - def compare(x, y): - return np.allclose(x, y, rtol=rtol, atol=atol) - a, b = np.asanyarray(a), np.asanyarray(b) - header = 'Not equal to tolerance rtol=%g, atol=%g' % (rtol, atol) - np.testing.utils.assert_array_compare(compare, a, b, err_msg=str(err_msg), - verbose=verbose, header=header) - -#------------------------------------------------------------------------------ -# Comparing function values at many data points at once, with helpful -# error reports -#------------------------------------------------------------------------------ - -def assert_func_equal(func, results, points, rtol=None, atol=None, - param_filter=None, knownfailure=None, - vectorized=True, dtype=None): - if hasattr(points, 'next'): - # it's a generator - points = list(points) - - points = np.asarray(points) - if points.ndim == 1: - points = points[:,None] - - if hasattr(results, '__name__'): - # function - if vectorized: - results = results(*tuple(points.T)) - else: - results = np.array([results(*tuple(p)) for p in points]) - if results.dtype == object: - try: - results = results.astype(float) - except TypeError: - results = results.astype(complex) - else: - results = np.asarray(results) - - npoints = points.shape[1] - - data = np.c_[points, results] - fdata = FuncData(func, data, range(npoints), range(npoints, data.shape[1]), - rtol=rtol, atol=atol, param_filter=param_filter, - knownfailure=knownfailure) - fdata.check() - -class FuncData(object): - """ - Data set for checking a special function. - - Parameters - ---------- - func : function - Function to test - filename : str - Input file name - param_columns : int or tuple of ints - Columns indices in which the parameters to `func` lie. - Can be imaginary integers to indicate that the parameter - should be cast to complex. - result_columns : int or tuple of ints - Column indices for expected results from `func`. - rtol : float, optional - Required relative tolerance. Default is 5*eps. - atol : float, optional - Required absolute tolerance. Default is 5*tiny. - param_filter : function, or tuple of functions/Nones, optional - Filter functions to exclude some parameter ranges. - If omitted, no filtering is done. - knownfailure : str, optional - Known failure error message to raise when the test is run. - If omitted, no exception is raised. - - """ - - def __init__(self, func, data, param_columns, result_columns, - rtol=None, atol=None, param_filter=None, knownfailure=None, - dataname=None): - self.func = func - self.data = data - self.dataname = dataname - if not hasattr(param_columns, '__len__'): - param_columns = (param_columns,) - if not hasattr(result_columns, '__len__'): - result_columns = (result_columns,) - self.param_columns = tuple(param_columns) - self.result_columns = tuple(result_columns) - self.rtol = rtol - self.atol = atol - if not hasattr(param_filter, '__len__'): - param_filter = (param_filter,) - self.param_filter = param_filter - self.knownfailure = knownfailure - - def get_tolerances(self, dtype): - info = np.finfo(dtype) - rtol, atol = self.rtol, self.atol - if rtol is None: - rtol = 5*info.eps - if atol is None: - atol = 5*info.tiny - return rtol, atol - - def check(self, data=None, dtype=None): - """Check the special function against the data.""" - - if self.knownfailure: - raise KnownFailureTest(self.knownfailure) - - if data is None: - data = self.data - - if dtype is None: - dtype = data.dtype - else: - data = data.astype(dtype) - - rtol, atol = self.get_tolerances(dtype) - - # Apply given filter functions - if self.param_filter: - param_mask = np.ones((data.shape[0],), np.bool_) - for j, filter in zip(self.param_columns, self.param_filter): - if filter: - param_mask &= filter(data[:,j]) - data = data[param_mask] - - # Pick parameters and results from the correct columns - params = [] - for j in self.param_columns: - if np.iscomplexobj(j): - j = int(j.imag) - params.append(data[:,j].astype(np.complex)) - else: - params.append(data[:,j]) - wanted = tuple([data[:,j] for j in self.result_columns]) - - # Evaluate - got = self.func(*params) - if not isinstance(got, tuple): - got = (got,) - - # Check the validity of each output returned - - assert_(len(got) == len(wanted)) - - for output_num, (x, y) in enumerate(zip(got, wanted)): - pinf_x = np.isinf(x) & (x > 0) - pinf_y = np.isinf(y) & (x > 0) - minf_x = np.isinf(x) & (x < 0) - minf_y = np.isinf(y) & (x < 0) - nan_x = np.isnan(x) - nan_y = np.isnan(y) - - abs_y = np.absolute(y) - abs_y[~np.isfinite(abs_y)] = 0 - diff = np.absolute(x - y) - diff[~np.isfinite(diff)] = 0 - - rdiff = diff / np.absolute(y) - rdiff[~np.isfinite(rdiff)] = 0 - - tol_mask = (diff < atol + rtol*abs_y) - pinf_mask = (pinf_x == pinf_y) - minf_mask = (minf_x == minf_y) - nan_mask = (nan_x == nan_y) - - bad_j = ~(tol_mask & pinf_mask & minf_mask & nan_mask) - - if np.any(bad_j): - # Some bad results: inform what, where, and how bad - msg = [""] - msg.append("Max |adiff|: %g" % diff.max()) - msg.append("Max |rdiff|: %g" % rdiff.max()) - msg.append("Bad results for the following points (in output %d):" - % output_num) - for j in np.where(bad_j)[0]: - j = int(j) - fmt = lambda x: "%30s" % np.array2string(x[j], precision=18) - a = " ".join(map(fmt, params)) - b = " ".join(map(fmt, got)) - c = " ".join(map(fmt, wanted)) - d = fmt(rdiff) - msg.append("%s => %s != %s (rdiff %s)" % (a, b, c, d)) - assert_(False, "\n".join(msg)) - - def __repr__(self): - """Pretty-printing, esp. for Nose output""" - if np.any(map(np.iscomplexobj, self.param_columns)): - is_complex = " (complex)" - else: - is_complex = "" - if self.dataname: - return "" % (self.func.__name__, is_complex, - os.path.basename(self.dataname)) - else: - return "" % (self.func.__name__, is_complex) From scipy-svn at scipy.org Mon Jan 31 16:52:21 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 Jan 2011 15:52:21 -0600 (CST) Subject: [Scipy-svn] r7115 - in trunk/scipy/fftpack: . tests Message-ID: <20110131215221.7A4A237A196@scipy.org> Author: ptvirtan Date: 2011-01-31 15:52:21 -0600 (Mon, 31 Jan 2011) New Revision: 7115 Modified: trunk/scipy/fftpack/basic.py trunk/scipy/fftpack/pseudo_diffs.py trunk/scipy/fftpack/realtransforms.py trunk/scipy/fftpack/tests/test_basic.py trunk/scipy/fftpack/tests/test_real_transforms.py Log: BUG: fftpack: more robust data overwrite behavior Some routines in fftpack used an invalid way to determine if data can be overwritten, which fails e.g. for non-ndarray objects providing an array interface but no __array__ method. Also make tests checking the fft routine behavior stricter. Modified: trunk/scipy/fftpack/basic.py =================================================================== --- trunk/scipy/fftpack/basic.py 2011-01-31 21:51:56 UTC (rev 7114) +++ trunk/scipy/fftpack/basic.py 2011-01-31 21:52:21 UTC (rev 7115) @@ -22,6 +22,18 @@ def istype(arr, typeclass): return issubclass(arr.dtype.type, typeclass) +def _datacopied(arr, original): + """ + Strict check for `arr` not sharing any data with `original`, + under the assumption that arr = asarray(original) + + """ + if arr is original: + return False + if not isinstance(original, numpy.ndarray) and hasattr(original, '__array__'): + return False + return arr.base is None + # XXX: single precision FFTs partially disabled due to accuracy issues # for large prime-sized inputs. # @@ -195,16 +207,11 @@ except KeyError: raise ValueError("type %s is not supported" % tmp.dtype) - if istype(tmp, numpy.complex128): - overwrite_x = overwrite_x or (tmp is not x and not \ - hasattr(x,'__array__')) - elif istype(tmp, numpy.complex64): - overwrite_x = overwrite_x or (tmp is not x and not \ - hasattr(x,'__array__')) - else: + if not (istype(tmp, numpy.complex64) or istype(tmp, numpy.complex128)): overwrite_x = 1 - #return _raw_fft(tmp,n,axis,1,overwrite_x,work_function) + overwrite_x = overwrite_x or _datacopied(tmp, x) + if n is None: n = tmp.shape[axis] elif n != tmp.shape[axis]: @@ -248,16 +255,11 @@ except KeyError: raise ValueError("type %s is not supported" % tmp.dtype) - if istype(tmp, numpy.complex128): - overwrite_x = overwrite_x or (tmp is not x and not \ - hasattr(x,'__array__')) - elif istype(tmp, numpy.complex64): - overwrite_x = overwrite_x or (tmp is not x and not \ - hasattr(x,'__array__')) - else: + if not (istype(tmp, numpy.complex64) or istype(tmp, numpy.complex128)): overwrite_x = 1 - #return _raw_fft(tmp,n,axis,-1,overwrite_x,work_function) + overwrite_x = overwrite_x or _datacopied(tmp, x) + if n is None: n = tmp.shape[axis] elif n != tmp.shape[axis]: @@ -323,6 +325,8 @@ except KeyError: raise ValueError("type %s is not supported" % tmp.dtype) + overwrite_x = overwrite_x or _datacopied(tmp, x) + return _raw_fft(tmp,n,axis,1,overwrite_x,work_function) @@ -356,6 +360,8 @@ except KeyError: raise ValueError("type %s is not supported" % tmp.dtype) + overwrite_x = overwrite_x or _datacopied(tmp, x) + return _raw_fft(tmp,n,axis,-1,overwrite_x,work_function) def _raw_fftnd(x, s, axes, direction, overwrite_x, work_function): @@ -380,7 +386,7 @@ if noaxes: for i in axes: x, copy_made = _fix_shape(x, s[i], i) - #print x.shape, s + overwrite_x = overwrite_x or copy_made return work_function(x,s,direction,overwrite_x=overwrite_x) # We ordered axes, because the code below to push axes at the end of the @@ -404,6 +410,7 @@ for i in range(len(waxes)): x, copy_made = _fix_shape(x, s[i], waxes[i]) + overwrite_x = overwrite_x or copy_made r = work_function(x, shape, direction, overwrite_x=overwrite_x) @@ -456,13 +463,10 @@ except KeyError: raise ValueError("type %s is not supported" % tmp.dtype) - if istype(tmp, numpy.complex128): - overwrite_x = overwrite_x or (tmp is not x and not \ - hasattr(x,'__array__')) - elif istype(tmp, numpy.complex64): - pass - else: + if not (istype(tmp, numpy.complex64) or istype(tmp, numpy.complex128)): overwrite_x = 1 + + overwrite_x = overwrite_x or _datacopied(tmp, x) return _raw_fftnd(tmp,shape,axes,direction,overwrite_x,work_function) Modified: trunk/scipy/fftpack/pseudo_diffs.py =================================================================== --- trunk/scipy/fftpack/pseudo_diffs.py 2011-01-31 21:51:56 UTC (rev 7114) +++ trunk/scipy/fftpack/pseudo_diffs.py 2011-01-31 21:52:21 UTC (rev 7115) @@ -11,6 +11,8 @@ from numpy import pi, asarray, sin, cos, sinh, cosh, tanh, iscomplexobj import convolve +from scipy.fftpack.basic import _datacopied + import atexit atexit.register(convolve.destroy_convolve_cache) del atexit @@ -63,7 +65,7 @@ omega = convolve.init_convolution_kernel(n,kernel,d=order, zero_nyquist=1) _cache[(n,order,c)] = omega - overwrite_x = tmp is not x and not hasattr(x,'__array__') + overwrite_x = _datacopied(tmp, x) return convolve.convolve(tmp,omega,swap_real_imag=order%2, overwrite_x=overwrite_x) del _cache @@ -112,7 +114,7 @@ return 0 omega = convolve.init_convolution_kernel(n,kernel,d=1) _cache[(n,h)] = omega - overwrite_x = tmp is not x and not hasattr(x,'__array__') + overwrite_x = _datacopied(tmp, x) return convolve.convolve(tmp,omega,swap_real_imag=1,overwrite_x=overwrite_x) del _cache @@ -148,7 +150,7 @@ return 0 omega = convolve.init_convolution_kernel(n,kernel,d=1) _cache[(n,h)] = omega - overwrite_x = tmp is not x and not hasattr(x,'__array__') + overwrite_x = _datacopied(tmp, x) return convolve.convolve(tmp,omega,swap_real_imag=1,overwrite_x=overwrite_x) del _cache @@ -185,7 +187,7 @@ return 0.0 omega = convolve.init_convolution_kernel(n,kernel,d=1) _cache[n] = omega - overwrite_x = tmp is not x and not hasattr(x,'__array__') + overwrite_x = _datacopied(tmp, x) return convolve.convolve(tmp,omega,swap_real_imag=1,overwrite_x=overwrite_x) del _cache @@ -244,7 +246,7 @@ return 0 omega = convolve.init_convolution_kernel(n,kernel,d=1) _cache[(n,a,b)] = omega - overwrite_x = tmp is not x and not hasattr(x,'__array__') + overwrite_x = _datacopied(tmp, x) return convolve.convolve(tmp,omega,swap_real_imag=1,overwrite_x=overwrite_x) del _cache @@ -294,7 +296,7 @@ return 0 omega = convolve.init_convolution_kernel(n,kernel,d=1) _cache[(n,a,b)] = omega - overwrite_x = tmp is not x and not hasattr(x,'__array__') + overwrite_x = _datacopied(tmp, x) return convolve.convolve(tmp,omega,swap_real_imag=1,overwrite_x=overwrite_x) del _cache @@ -339,7 +341,7 @@ return float(a)/b omega = convolve.init_convolution_kernel(n,kernel) _cache[(n,a,b)] = omega - overwrite_x = tmp is not x and not hasattr(x,'__array__') + overwrite_x = _datacopied(tmp, x) return convolve.convolve(tmp,omega,overwrite_x=overwrite_x) del _cache @@ -384,7 +386,7 @@ return cosh(a*k)/cosh(b*k) omega = convolve.init_convolution_kernel(n,kernel) _cache[(n,a,b)] = omega - overwrite_x = tmp is not x and not hasattr(x,'__array__') + overwrite_x = _datacopied(tmp, x) return convolve.convolve(tmp,omega,overwrite_x=overwrite_x) del _cache @@ -423,7 +425,7 @@ _cache[(n,a)] = omega_real,omega_imag else: omega_real,omega_imag = omega - overwrite_x = tmp is not x and not hasattr(x,'__array__') + overwrite_x = _datacopied(tmp, x) return convolve.convolve_z(tmp,omega_real,omega_imag, overwrite_x=overwrite_x) Modified: trunk/scipy/fftpack/realtransforms.py =================================================================== --- trunk/scipy/fftpack/realtransforms.py 2011-01-31 21:51:56 UTC (rev 7114) +++ trunk/scipy/fftpack/realtransforms.py 2011-01-31 21:52:21 UTC (rev 7115) @@ -6,6 +6,7 @@ import numpy as np from scipy.fftpack import _fftpack +from scipy.fftpack.basic import _datacopied import atexit atexit.register(_fftpack.destroy_ddct1_cache) @@ -13,7 +14,7 @@ atexit.register(_fftpack.destroy_dct1_cache) atexit.register(_fftpack.destroy_dct2_cache) -def dct(x, type=2, n=None, axis=-1, norm=None): +def dct(x, type=2, n=None, axis=-1, norm=None, overwrite_x=0): """ Return the Discrete Cosine Transform of arbitrary type sequence x. @@ -29,6 +30,8 @@ Axis over which to compute the transform. norm : {None, 'ortho'}, optional Normalization mode (see Notes). Default is None. + overwrite_x : bool, optional + If True the contents of x can be destroyed. (default=False) Returns ------- @@ -111,9 +114,9 @@ if type == 1 and norm is not None: raise NotImplementedError( "Orthonormalization not yet supported for DCT-I") - return _dct(x, type, n, axis, normalize=norm) + return _dct(x, type, n, axis, normalize=norm, overwrite_x=overwrite_x) -def idct(x, type=2, n=None, axis=-1, norm=None): +def idct(x, type=2, n=None, axis=-1, norm=None, overwrite_x=0): """ Return the Inverse Discrete Cosine Transform of an arbitrary type sequence. @@ -129,6 +132,8 @@ Axis over which to compute the transform. norm : {None, 'ortho'}, optional Normalization mode (see Notes). Default is None. + overwrite_x : bool, optional + If True the contents of x can be destroyed. (default=False) Returns ------- @@ -156,7 +161,7 @@ "Orthonormalization not yet supported for IDCT-I") # Inverse/forward type table _TP = {1:1, 2:3, 3:2} - return _dct(x, _TP[type], n, axis, normalize=norm) + return _dct(x, _TP[type], n, axis, normalize=norm, overwrite_x=overwrite_x) def _dct(x, type, n=None, axis=-1, overwrite_x=0, normalize=None): """ @@ -219,6 +224,8 @@ if type == 1 and n < 2: raise ValueError("DCT-I is not defined for size < 2") + overwrite_x = overwrite_x or _datacopied(tmp, x) + if axis == -1 or axis == len(tmp.shape) - 1: return f(tmp, n, nm, overwrite_x) #else: Modified: trunk/scipy/fftpack/tests/test_basic.py =================================================================== --- trunk/scipy/fftpack/tests/test_basic.py 2011-01-31 21:51:56 UTC (rev 7114) +++ trunk/scipy/fftpack/tests/test_basic.py 2011-01-31 21:52:21 UTC (rev 7115) @@ -654,6 +654,17 @@ +class FakeArray(object): + def __init__(self, data): + self._data = data + self.__array_interface__ = data.__array_interface__ + +class FakeArray2(object): + def __init__(self, data): + self._data = data + def __array__(self): + return self._data + class TestOverwrite(object): """ Check input overwrite behavior of the FFT functions @@ -662,15 +673,20 @@ real_dtypes = [np.float32, np.float64] dtypes = real_dtypes + [np.complex64, np.complex128] - def _check(self, x, routine, fftsize, axis): + def _check(self, x, routine, fftsize, axis, overwrite_x, should_overwrite): x2 = x.copy() - y = routine(x2, fftsize, axis) + for fake in [lambda x: x, FakeArray, FakeArray2]: + y = routine(fake(x2), fftsize, axis, overwrite_x=overwrite_x) - sig = "%s(%s%r, %r, axis=%r)" % (routine.__name__, x.dtype, x.shape, - fftsize, axis) - assert_equal(x2, x, err_msg="spurious overwrite in %s" % sig) + sig = "%s(%s%r, %r, axis=%r, overwrite_x=%r)" % ( + routine.__name__, x.dtype, x.shape, fftsize, axis, overwrite_x) + if not should_overwrite: + assert_equal(x2, x, err_msg="spurious overwrite in %s" % sig) + else: + if (x2 == x).all(): + raise AssertionError("no overwrite in %s" % sig) - def _check_1d(self, routine, dtype, shape, axis): + def _check_1d(self, routine, dtype, shape, axis, overwritable_dtypes): np.random.seed(1234) if np.issubdtype(dtype, np.complexfloating): data = np.random.randn(*shape) + 1j*np.random.randn(*shape) @@ -679,33 +695,46 @@ data = data.astype(dtype) for fftsize in [8, 16, 32]: - self._check(data, routine, fftsize, axis) + for overwrite_x in [True, False]: + should_overwrite = (overwrite_x + and dtype in overwritable_dtypes + and fftsize <= shape[axis] + and (len(shape) == 1 or + (axis % len(shape) == len(shape)-1 + and fftsize == shape[axis]))) + self._check(data, routine, fftsize, axis, + overwrite_x=overwrite_x, + should_overwrite=should_overwrite) def test_fft(self): + overwritable = (np.complex128, np.complex64) for dtype in self.dtypes: - self._check_1d(fft, dtype, (16,), -1) - self._check_1d(fft, dtype, (16, 2), 0) - self._check_1d(fft, dtype, (2, 16), 1) + self._check_1d(fft, dtype, (16,), -1, overwritable) + self._check_1d(fft, dtype, (16, 2), 0, overwritable) + self._check_1d(fft, dtype, (2, 16), 1, overwritable) def test_ifft(self): + overwritable = (np.complex128, np.complex64) for dtype in self.dtypes: - self._check_1d(ifft, dtype, (16,), -1) - self._check_1d(ifft, dtype, (16, 2), 0) - self._check_1d(ifft, dtype, (2, 16), 1) + self._check_1d(ifft, dtype, (16,), -1, overwritable) + self._check_1d(ifft, dtype, (16, 2), 0, overwritable) + self._check_1d(ifft, dtype, (2, 16), 1, overwritable) def test_rfft(self): + overwritable = self.real_dtypes for dtype in self.real_dtypes: - self._check_1d(rfft, dtype, (16,), -1) - self._check_1d(rfft, dtype, (16, 2), 0) - self._check_1d(rfft, dtype, (2, 16), 1) + self._check_1d(rfft, dtype, (16,), -1, overwritable) + self._check_1d(rfft, dtype, (16, 2), 0, overwritable) + self._check_1d(rfft, dtype, (2, 16), 1, overwritable) def test_irfft(self): + overwritable = self.real_dtypes for dtype in self.real_dtypes: - self._check_1d(irfft, dtype, (16,), -1) - self._check_1d(irfft, dtype, (16, 2), 0) - self._check_1d(irfft, dtype, (2, 16), 1) + self._check_1d(irfft, dtype, (16,), -1, overwritable) + self._check_1d(irfft, dtype, (16, 2), 0, overwritable) + self._check_1d(irfft, dtype, (2, 16), 1, overwritable) - def _check_nd_one(self, routine, dtype, shape, axes): + def _check_nd_one(self, routine, dtype, shape, axes, overwritable_dtypes): np.random.seed(1234) if np.issubdtype(dtype, np.complexfloating): data = np.random.randn(*shape) + 1j*np.random.randn(*shape) @@ -726,34 +755,45 @@ else: part_shape = tuple(np.take(shape, axes)) - for fftshape in fftshape_iter(part_shape): - self._check(data, routine, fftshape, axes) - if data.ndim > 1: - # check fortran order: it never overwrites - self._check(data.T, routine, fftshape, axes) + for overwrite_x in [True, False]: + for fftshape in fftshape_iter(part_shape): + should_overwrite = (overwrite_x + and data.ndim == 1 + and np.all([x < y for x, y in zip(fftshape, part_shape)]) + and dtype in overwritable_dtypes) + self._check(data, routine, fftshape, axes, + overwrite_x=overwrite_x, + should_overwrite=should_overwrite) + if data.ndim > 1: + # check fortran order: it never overwrites + self._check(data.T, routine, fftshape, axes, + overwrite_x=overwrite_x, + should_overwrite=False) - def _check_nd(self, routine, dtype): - self._check_nd_one(routine, dtype, (16,), None) - self._check_nd_one(routine, dtype, (16,), (0,)) - self._check_nd_one(routine, dtype, (16, 2), (0,)) - self._check_nd_one(routine, dtype, (2, 16), (1,)) - self._check_nd_one(routine, dtype, (8, 16), None) - self._check_nd_one(routine, dtype, (8, 16), (0, 1)) - self._check_nd_one(routine, dtype, (8, 16, 2), (0, 1)) - self._check_nd_one(routine, dtype, (8, 16, 2), (1, 2)) - self._check_nd_one(routine, dtype, (8, 16, 2), (0,)) - self._check_nd_one(routine, dtype, (8, 16, 2), (1,)) - self._check_nd_one(routine, dtype, (8, 16, 2), (2,)) - self._check_nd_one(routine, dtype, (8, 16, 2), None) - self._check_nd_one(routine, dtype, (8, 16, 2), (0,1,2)) + def _check_nd(self, routine, dtype, overwritable): + self._check_nd_one(routine, dtype, (16,), None, overwritable) + self._check_nd_one(routine, dtype, (16,), (0,), overwritable) + self._check_nd_one(routine, dtype, (16, 2), (0,), overwritable) + self._check_nd_one(routine, dtype, (2, 16), (1,), overwritable) + self._check_nd_one(routine, dtype, (8, 16), None, overwritable) + self._check_nd_one(routine, dtype, (8, 16), (0, 1), overwritable) + self._check_nd_one(routine, dtype, (8, 16, 2), (0, 1), overwritable) + self._check_nd_one(routine, dtype, (8, 16, 2), (1, 2), overwritable) + self._check_nd_one(routine, dtype, (8, 16, 2), (0,), overwritable) + self._check_nd_one(routine, dtype, (8, 16, 2), (1,), overwritable) + self._check_nd_one(routine, dtype, (8, 16, 2), (2,), overwritable) + self._check_nd_one(routine, dtype, (8, 16, 2), None, overwritable) + self._check_nd_one(routine, dtype, (8, 16, 2), (0,1,2), overwritable) def test_fftn(self): + overwritable = (np.complex128, np.complex64) for dtype in self.dtypes: - self._check_nd(fftn, dtype) + self._check_nd(fftn, dtype, overwritable) def test_ifftn(self): + overwritable = (np.complex128, np.complex64) for dtype in self.dtypes: - self._check_nd(ifftn, dtype) + self._check_nd(ifftn, dtype, overwritable) if __name__ == "__main__": Modified: trunk/scipy/fftpack/tests/test_real_transforms.py =================================================================== --- trunk/scipy/fftpack/tests/test_real_transforms.py 2011-01-31 21:51:56 UTC (rev 7114) +++ trunk/scipy/fftpack/tests/test_real_transforms.py 2011-01-31 21:52:21 UTC (rev 7115) @@ -191,15 +191,20 @@ real_dtypes = [np.float32, np.float64] - def _check(self, x, routine, type, fftsize, axis, norm): + def _check(self, x, routine, type, fftsize, axis, norm, overwrite_x, + should_overwrite, **kw): x2 = x.copy() - y = routine(x2, type, fftsize, axis, norm) + y = routine(x2, type, fftsize, axis, norm, overwrite_x=overwrite_x) - sig = "%s(%s%r, %r, axis=%r)" % ( - routine.__name__, x.dtype, x.shape, fftsize, axis) - assert_equal(x2, x, err_msg="spurious overwrite in %s" % sig) + sig = "%s(%s%r, %r, axis=%r, overwrite_x=%r)" % ( + routine.__name__, x.dtype, x.shape, fftsize, axis, overwrite_x) + if not should_overwrite: + assert_equal(x2, x, err_msg="spurious overwrite in %s" % sig) + else: + if (x2 == x).all(): + raise AssertionError("no overwrite in %s" % sig) - def _check_1d(self, routine, dtype, shape, axis): + def _check_1d(self, routine, dtype, shape, axis, overwritable_dtypes): np.random.seed(1234) if np.issubdtype(dtype, np.complexfloating): data = np.random.randn(*shape) + 1j*np.random.randn(*shape) @@ -208,22 +213,32 @@ data = data.astype(dtype) for type in [1, 2, 3]: - for norm in [None, 'ortho']: - if type == 1 and norm == 'ortho': - continue - self._check(data, routine, type, None, axis, norm) + for overwrite_x in [True, False]: + for norm in [None, 'ortho']: + if type == 1 and norm == 'ortho': + continue + should_overwrite = (overwrite_x + and dtype in overwritable_dtypes + and (len(shape) == 1 or + (axis % len(shape) == len(shape)-1 + ))) + self._check(data, routine, type, None, axis, norm, + overwrite_x, should_overwrite) + def test_dct(self): + overwritable = self.real_dtypes for dtype in self.real_dtypes: - self._check_1d(dct, dtype, (16,), -1) - self._check_1d(dct, dtype, (16, 2), 0) - self._check_1d(dct, dtype, (2, 16), 1) + self._check_1d(dct, dtype, (16,), -1, overwritable) + self._check_1d(dct, dtype, (16, 2), 0, overwritable) + self._check_1d(dct, dtype, (2, 16), 1, overwritable) def test_idct(self): + overwritable = self.real_dtypes for dtype in self.real_dtypes: - self._check_1d(idct, dtype, (16,), -1) - self._check_1d(idct, dtype, (16, 2), 0) - self._check_1d(idct, dtype, (2, 16), 1) + self._check_1d(idct, dtype, (16,), -1, overwritable) + self._check_1d(idct, dtype, (16, 2), 0, overwritable) + self._check_1d(idct, dtype, (2, 16), 1, overwritable) if __name__ == "__main__": np.testing.run_module_suite() From scipy-svn at scipy.org Mon Jan 31 16:52:58 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 Jan 2011 15:52:58 -0600 (CST) Subject: [Scipy-svn] r7116 - in trunk/scipy/linalg: . tests Message-ID: <20110131215258.8B43437A196@scipy.org> Author: ptvirtan Date: 2011-01-31 15:52:58 -0600 (Mon, 31 Jan 2011) New Revision: 7116 Added: trunk/scipy/linalg/_testutils.py Modified: trunk/scipy/linalg/basic.py trunk/scipy/linalg/decomp.py trunk/scipy/linalg/decomp_cholesky.py trunk/scipy/linalg/decomp_lu.py trunk/scipy/linalg/decomp_qr.py trunk/scipy/linalg/decomp_schur.py trunk/scipy/linalg/decomp_svd.py trunk/scipy/linalg/misc.py trunk/scipy/linalg/tests/test_basic.py trunk/scipy/linalg/tests/test_decomp.py trunk/scipy/linalg/tests/test_decomp_cholesky.py Log: BUG: linalg: more robust data ovewrite behavior Some routines in linalg used an invalid way to determine if data can be overwritten, which fails for non-ndarray objects providing an array interface but no __array__ method. Also add new tests checking the data overwrite behavior. Added: trunk/scipy/linalg/_testutils.py =================================================================== --- trunk/scipy/linalg/_testutils.py (rev 0) +++ trunk/scipy/linalg/_testutils.py 2011-01-31 21:52:58 UTC (rev 7116) @@ -0,0 +1,57 @@ +import numpy as np + +class _FakeMatrix(object): + def __init__(self, data): + self._data = data + self.__array_interface__ = data.__array_interface__ + +class _FakeMatrix2(object): + def __init__(self, data): + self._data = data + def __array__(self): + return self._data + +def _get_array(shape, dtype): + """ + Get a test array of given shape and data type. + Returned NxN matrices are posdef, and 2xN are banded-posdef. + + """ + if len(shape) == 2 and shape[0] == 2: + # yield a banded positive definite one + x = np.zeros(shape, dtype=dtype) + x[0,1:] = -1 + x[1] = 2 + return x + elif len(shape) == 2 and shape[0] == shape[1]: + # always yield a positive definite matrix + x = np.zeros(shape, dtype=dtype) + j = np.arange(shape[0]) + x[j,j] = 2 + x[j[:-1],j[:-1]+1] = -1 + x[j[:-1]+1,j[:-1]] = -1 + return x + else: + np.random.seed(1234) + return np.random.randn(*shape).astype(dtype) + +def _id(x): + return x + +def assert_no_overwrite(call, shapes, dtypes=None): + """ + Test that a call does not overwrite its input arguments + """ + + if dtypes is None: + dtypes = [np.float32, np.float64, np.complex64, np.complex128] + + for dtype in dtypes: + for order in ["C", "F"]: + for faker in [_id, _FakeMatrix, _FakeMatrix2]: + orig_inputs = [_get_array(s, dtype) for s in shapes] + inputs = [faker(x.copy(order)) for x in orig_inputs] + call(*inputs) + msg = "call modified inputs [%r, %r]" % (dtype, faker) + for a, b in zip(inputs, orig_inputs): + np.testing.assert_equal(a, b, err_msg=msg) Modified: trunk/scipy/linalg/basic.py =================================================================== --- trunk/scipy/linalg/basic.py 2011-01-31 21:52:21 UTC (rev 7115) +++ trunk/scipy/linalg/basic.py 2011-01-31 21:52:58 UTC (rev 7116) @@ -12,7 +12,7 @@ from flinalg import get_flinalg_funcs from lapack import get_lapack_funcs -from misc import LinAlgError +from misc import LinAlgError, _datacopied from scipy.linalg import calc_lwork import decomp_svd @@ -49,8 +49,8 @@ raise ValueError('expected square matrix') if a1.shape[0] != b1.shape[0]: raise ValueError('incompatible dimensions') - overwrite_a = overwrite_a or (a1 is not a and not hasattr(a,'__array__')) - overwrite_b = overwrite_b or (b1 is not b and not hasattr(b,'__array__')) + overwrite_a = overwrite_a or _datacopied(a1, a) + overwrite_b = overwrite_b or _datacopied(b1, b) if debug: print 'solve:overwrite_a=',overwrite_a print 'solve:overwrite_b=',overwrite_b @@ -117,7 +117,7 @@ raise ValueError('expected square matrix') if a1.shape[0] != b1.shape[0]: raise ValueError('incompatible dimensions') - overwrite_b = overwrite_b or (b1 is not b and not hasattr(b,'__array__')) + overwrite_b = overwrite_b or _datacopied(b1, b) if debug: print 'solve:overwrite_b=',overwrite_b trans = {'N': 0, 'T': 1, 'C': 2}.get(trans, trans) @@ -174,7 +174,7 @@ raise ValueError("invalid values for the number of lower and upper diagonals:" " l+u+1 (%d) does not equal ab.shape[0] (%d)" % (l+u+1, ab.shape[0])) - overwrite_b = overwrite_b or (b1 is not b and not hasattr(b,'__array__')) + overwrite_b = overwrite_b or _datacopied(b1, b) gbsv, = get_lapack_funcs(('gbsv',), (a1, b1)) a2 = zeros((2*l+u+1, a1.shape[1]), dtype=gbsv.dtype) @@ -285,7 +285,7 @@ a1 = asarray_chkfinite(a) if len(a1.shape) != 2 or a1.shape[0] != a1.shape[1]: raise ValueError('expected square matrix') - overwrite_a = overwrite_a or (a1 is not a and not hasattr(a,'__array__')) + overwrite_a = overwrite_a or _datacopied(a1, a) #XXX: I found no advantage or disadvantage of using finv. ## finv, = get_flinalg_funcs(('inv',),(a1,)) ## if finv is not None: @@ -350,7 +350,7 @@ a1 = asarray_chkfinite(a) if len(a1.shape) != 2 or a1.shape[0] != a1.shape[1]: raise ValueError('expected square matrix') - overwrite_a = overwrite_a or (a1 is not a and not hasattr(a,'__array__')) + overwrite_a = overwrite_a or _datacopied(a1, a) fdet, = get_flinalg_funcs(('det',), (a1,)) a_det, info = fdet(a1, overwrite_a=overwrite_a) if info < 0: @@ -426,8 +426,8 @@ else: b2[:m,0] = b1 b1 = b2 - overwrite_a = overwrite_a or (a1 is not a and not hasattr(a,'__array__')) - overwrite_b = overwrite_b or (b1 is not b and not hasattr(b,'__array__')) + overwrite_a = overwrite_a or _datacopied(a1, a) + overwrite_b = overwrite_b or _datacopied(b1, b) if gelss.module_name[:7] == 'flapack': lwork = calc_lwork.gelss(gelss.prefix, m, n, nrhs)[1] v, x, s, rank, info = gelss(a1, b1, cond=cond, lwork=lwork, Modified: trunk/scipy/linalg/decomp.py =================================================================== --- trunk/scipy/linalg/decomp.py 2011-01-31 21:52:21 UTC (rev 7115) +++ trunk/scipy/linalg/decomp.py 2011-01-31 21:52:58 UTC (rev 7116) @@ -21,7 +21,7 @@ # Local imports from scipy.linalg import calc_lwork -from misc import LinAlgError, _datanotshared +from misc import LinAlgError, _datacopied from lapack import get_lapack_funcs from blas import get_blas_funcs @@ -43,7 +43,7 @@ def _geneig(a1, b, left, right, overwrite_a, overwrite_b): b1 = asarray(b) - overwrite_b = overwrite_b or _datanotshared(b1, b) + overwrite_b = overwrite_b or _datacopied(b1, b) if len(b1.shape) != 2 or b1.shape[0] != b1.shape[1]: raise ValueError('expected square matrix') ggev, = get_lapack_funcs(('ggev',), (a1, b1)) @@ -135,7 +135,7 @@ a1 = asarray_chkfinite(a) if len(a1.shape) != 2 or a1.shape[0] != a1.shape[1]: raise ValueError('expected square matrix') - overwrite_a = overwrite_a or (_datanotshared(a1, a)) + overwrite_a = overwrite_a or (_datacopied(a1, a)) if b is not None: b = asarray_chkfinite(b) if b.shape != a1.shape: @@ -265,14 +265,14 @@ a1 = asarray_chkfinite(a) if len(a1.shape) != 2 or a1.shape[0] != a1.shape[1]: raise ValueError('expected square matrix') - overwrite_a = overwrite_a or (_datanotshared(a1, a)) + overwrite_a = overwrite_a or (_datacopied(a1, a)) if iscomplexobj(a1): cplx = True else: cplx = False if b is not None: b1 = asarray_chkfinite(b) - overwrite_b = overwrite_b or _datanotshared(b1, b) + overwrite_b = overwrite_b or _datacopied(b1, b) if len(b1.shape) != 2 or b1.shape[0] != b1.shape[1]: raise ValueError('expected square matrix') @@ -455,7 +455,7 @@ """ if eigvals_only or overwrite_a_band: a1 = asarray_chkfinite(a_band) - overwrite_a_band = overwrite_a_band or (_datanotshared(a1, a_band)) + overwrite_a_band = overwrite_a_band or (_datacopied(a1, a_band)) else: a1 = array(a_band) if issubclass(a1.dtype.type, inexact) and not isfinite(a1).all(): @@ -734,9 +734,9 @@ a1 = asarray(a) if len(a1.shape) != 2 or (a1.shape[0] != a1.shape[1]): raise ValueError('expected square matrix') - overwrite_a = overwrite_a or (_datanotshared(a1, a)) + overwrite_a = overwrite_a or (_datacopied(a1, a)) gehrd,gebal = get_lapack_funcs(('gehrd','gebal'), (a1,)) - ba, lo, hi, pivscale, info = gebal(a, permute=1, overwrite_a=overwrite_a) + ba, lo, hi, pivscale, info = gebal(a1, permute=1, overwrite_a=overwrite_a) if info < 0: raise ValueError('illegal value in %d-th argument of internal gebal ' '(hessenberg)' % -info) Modified: trunk/scipy/linalg/decomp_cholesky.py =================================================================== --- trunk/scipy/linalg/decomp_cholesky.py 2011-01-31 21:52:21 UTC (rev 7115) +++ trunk/scipy/linalg/decomp_cholesky.py 2011-01-31 21:52:58 UTC (rev 7116) @@ -3,7 +3,7 @@ from numpy import asarray_chkfinite # Local imports -from misc import LinAlgError, _datanotshared +from misc import LinAlgError, _datacopied from lapack import get_lapack_funcs __all__ = ['cholesky', 'cho_factor', 'cho_solve', 'cholesky_banded', @@ -17,7 +17,7 @@ if len(a1.shape) != 2 or a1.shape[0] != a1.shape[1]: raise ValueError('expected square matrix') - overwrite_a = overwrite_a or _datanotshared(a1, a) + overwrite_a = overwrite_a or _datacopied(a1, a) potrf, = get_lapack_funcs(('potrf',), (a1,)) c, info = potrf(a1, lower=lower, overwrite_a=overwrite_a, clean=clean) if info > 0: @@ -104,7 +104,7 @@ See also -------- - cho_solve : Solve a linear set equations using the Cholesky factorization + cho_solve : Solve a linear set equations using the Cholesky factorization of a matrix. """ @@ -140,7 +140,7 @@ if c.shape[1] != b1.shape[0]: raise ValueError("incompatible dimensions.") - overwrite_b = overwrite_b or (b1 is not b and not hasattr(b,'__array__')) + overwrite_b = overwrite_b or _datacopied(b1, b) potrs, = get_lapack_funcs(('potrs',), (c, b1)) x, info = potrs(c, b1, lower=lower, overwrite_b=overwrite_b) @@ -208,7 +208,7 @@ b : array Right-hand side overwrite_b : bool - If True, the function will overwrite the values in `b`. + If True, the function will overwrite the values in `b`. Returns ------- @@ -221,7 +221,7 @@ Notes ----- - + .. versionadded:: 0.8.0 """ Modified: trunk/scipy/linalg/decomp_lu.py =================================================================== --- trunk/scipy/linalg/decomp_lu.py 2011-01-31 21:52:21 UTC (rev 7115) +++ trunk/scipy/linalg/decomp_lu.py 2011-01-31 21:52:58 UTC (rev 7116) @@ -5,7 +5,7 @@ from numpy import asarray, asarray_chkfinite # Local imports -from misc import _datanotshared +from misc import _datacopied from lapack import get_lapack_funcs from flinalg import get_flinalg_funcs @@ -48,9 +48,9 @@ a1 = asarray(a) if len(a1.shape) != 2 or (a1.shape[0] != a1.shape[1]): raise ValueError('expected square matrix') - overwrite_a = overwrite_a or (_datanotshared(a1, a)) + overwrite_a = overwrite_a or (_datacopied(a1, a)) getrf, = get_lapack_funcs(('getrf',), (a1,)) - lu, piv, info = getrf(a, overwrite_a=overwrite_a) + lu, piv, info = getrf(a1, overwrite_a=overwrite_a) if info < 0: raise ValueError('illegal value in %d-th argument of ' 'internal getrf (lu_factor)' % -info) @@ -91,7 +91,7 @@ """ b1 = asarray_chkfinite(b) - overwrite_b = overwrite_b or (b1 is not b and not hasattr(b, '__array__')) + overwrite_b = overwrite_b or _datacopied(b1, b) if lu.shape[0] != b1.shape[0]: raise ValueError("incompatible dimensions.") @@ -148,7 +148,7 @@ a1 = asarray_chkfinite(a) if len(a1.shape) != 2: raise ValueError('expected matrix') - overwrite_a = overwrite_a or (_datanotshared(a1, a)) + overwrite_a = overwrite_a or (_datacopied(a1, a)) flu, = get_flinalg_funcs(('lu',), (a1,)) p, l, u, info = flu(a1, permute_l=permute_l, overwrite_a=overwrite_a) if info < 0: Modified: trunk/scipy/linalg/decomp_qr.py =================================================================== --- trunk/scipy/linalg/decomp_qr.py 2011-01-31 21:52:21 UTC (rev 7115) +++ trunk/scipy/linalg/decomp_qr.py 2011-01-31 21:52:58 UTC (rev 7116) @@ -7,7 +7,7 @@ import special_matrices from blas import get_blas_funcs from lapack import get_lapack_funcs, find_best_lapack_type -from misc import _datanotshared +from misc import _datacopied def qr(a, overwrite_a=False, lwork=None, mode='full'): @@ -77,7 +77,7 @@ if len(a1.shape) != 2: raise ValueError("expected 2D array") M, N = a1.shape - overwrite_a = overwrite_a or (_datanotshared(a1, a)) + overwrite_a = overwrite_a or (_datacopied(a1, a)) geqrf, = get_lapack_funcs(('geqrf',), (a1,)) if lwork is None or lwork == -1: @@ -157,7 +157,7 @@ if len(a1.shape) != 2: raise ValueError('expected matrix') M,N = a1.shape - overwrite_a = overwrite_a or (_datanotshared(a1, a)) + overwrite_a = overwrite_a or (_datacopied(a1, a)) geqrf, = get_lapack_funcs(('geqrf',), (a1,)) if lwork is None or lwork == -1: # get optimal work array @@ -235,7 +235,7 @@ if len(a1.shape) != 2: raise ValueError('expected matrix') M, N = a1.shape - overwrite_a = overwrite_a or (_datanotshared(a1, a)) + overwrite_a = overwrite_a or (_datacopied(a1, a)) gerqf, = get_lapack_funcs(('gerqf',), (a1,)) if lwork is None or lwork == -1: Modified: trunk/scipy/linalg/decomp_schur.py =================================================================== --- trunk/scipy/linalg/decomp_schur.py 2011-01-31 21:52:21 UTC (rev 7115) +++ trunk/scipy/linalg/decomp_schur.py 2011-01-31 21:52:58 UTC (rev 7116) @@ -5,7 +5,7 @@ # Local imports. import misc -from misc import LinAlgError, _datanotshared +from misc import LinAlgError, _datacopied from lapack import get_lapack_funcs from decomp import eigvals @@ -63,13 +63,13 @@ else: a1 = a1.astype('F') typ = 'F' - overwrite_a = overwrite_a or (_datanotshared(a1, a)) + overwrite_a = overwrite_a or (_datacopied(a1, a)) gees, = get_lapack_funcs(('gees',), (a1,)) if lwork is None or lwork == -1: # get optimal work array - result = gees(lambda x: None, a, lwork=-1) + result = gees(lambda x: None, a1, lwork=-1) lwork = result[-2][0].real.astype(numpy.int) - result = gees(lambda x: None, a, lwork=lwork, overwrite_a=overwrite_a) + result = gees(lambda x: None, a1, lwork=lwork, overwrite_a=overwrite_a) info = result[-1] if info < 0: raise ValueError('illegal value in %d-th argument of internal gees' Modified: trunk/scipy/linalg/decomp_svd.py =================================================================== --- trunk/scipy/linalg/decomp_svd.py 2011-01-31 21:52:21 UTC (rev 7115) +++ trunk/scipy/linalg/decomp_svd.py 2011-01-31 21:52:58 UTC (rev 7116) @@ -5,7 +5,7 @@ from scipy.linalg import calc_lwork # Local imports. -from misc import LinAlgError, _datanotshared +from misc import LinAlgError, _datacopied from lapack import get_lapack_funcs @@ -73,7 +73,7 @@ if len(a1.shape) != 2: raise ValueError('expected matrix') m,n = a1.shape - overwrite_a = overwrite_a or (_datanotshared(a1, a)) + overwrite_a = overwrite_a or (_datacopied(a1, a)) gesdd, = get_lapack_funcs(('gesdd',), (a1,)) if gesdd.module_name[:7] == 'flapack': lwork = calc_lwork.gesdd(gesdd.prefix, m, n, compute_uv)[1] Modified: trunk/scipy/linalg/misc.py =================================================================== --- trunk/scipy/linalg/misc.py 2011-01-31 21:52:21 UTC (rev 7115) +++ trunk/scipy/linalg/misc.py 2011-01-31 21:52:58 UTC (rev 7116) @@ -9,13 +9,14 @@ return np.linalg.norm(np.asarray_chkfinite(a), ord=ord) norm.__doc__ = np.linalg.norm.__doc__ +def _datacopied(arr, original): + """ + Strict check for `arr` not sharing any data with `original`, + under the assumption that arr = asarray(original) -def _datanotshared(a1,a): - if a1 is a: + """ + if arr is original: return False - else: - #try comparing data pointers - try: - return a1.__array_interface__['data'][0] != a.__array_interface__['data'][0] - except: - return True \ No newline at end of file + if not isinstance(original, np.ndarray) and hasattr(original, '__array__'): + return False + return arr.base is None Modified: trunk/scipy/linalg/tests/test_basic.py =================================================================== --- trunk/scipy/linalg/tests/test_basic.py 2011-01-31 21:52:21 UTC (rev 7115) +++ trunk/scipy/linalg/tests/test_basic.py 2011-01-31 21:52:58 UTC (rev 7116) @@ -29,6 +29,7 @@ from scipy.linalg import solve, inv, det, lstsq, pinv, pinv2, norm,\ solve_banded, solveh_banded, solve_triangular +from scipy.linalg._testutils import assert_no_overwrite def random(size): return rand(*size) @@ -561,5 +562,26 @@ assert_equal(norm([1,0,3], 0), 2) assert_equal(norm([1,2,3], 0), 3) +class TestOverwrite(object): + def test_solve(self): + assert_no_overwrite(solve, [(3,3), (3,)]) + def test_solve_triangular(self): + assert_no_overwrite(solve_triangular, [(3,3), (3,)]) + def test_solve_banded(self): + assert_no_overwrite(lambda ab, b: solve_banded((2,1), ab, b), + [(4,6), (6,)]) + def test_solveh_banded(self): + assert_no_overwrite(solveh_banded, [(2,6), (6,)]) + def test_inv(self): + assert_no_overwrite(inv, [(3,3)]) + def test_det(self): + assert_no_overwrite(det, [(3,3)]) + def test_lstsq(self): + assert_no_overwrite(lstsq, [(3,2), (3,)]) + def test_pinv(self): + assert_no_overwrite(pinv, [(3,3)]) + def test_pinv2(self): + assert_no_overwrite(pinv2, [(3,3)]) + if __name__ == "__main__": run_module_suite() Modified: trunk/scipy/linalg/tests/test_decomp.py =================================================================== --- trunk/scipy/linalg/tests/test_decomp.py 2011-01-31 21:52:21 UTC (rev 7115) +++ trunk/scipy/linalg/tests/test_decomp.py 2011-01-31 21:52:58 UTC (rev 7116) @@ -20,7 +20,7 @@ from scipy.linalg import eig, eigvals, lu, svd, svdvals, cholesky, qr, \ schur, rsf2csf, lu_solve, lu_factor, solve, diagsvd, hessenberg, rq, \ - eig_banded, eigvals_banded, eigh + eig_banded, eigvals_banded, eigh, eigvalsh from scipy.linalg.flapack import dgbtrf, dgbtrs, zgbtrf, zgbtrs, \ dsbev, dsbevd, dsbevx, zhbevd, zhbevx @@ -32,6 +32,8 @@ from numpy.random import rand, normal, seed +from scipy.linalg._testutils import assert_no_overwrite + # digit precision to use in asserts for different types DIGITS = {'d':11, 'D':11, 'f':4, 'F':4} @@ -1101,24 +1103,36 @@ -class TestDataNotShared(TestCase): +class TestDatacopied(TestCase): - def test_datanotshared(self): - from scipy.linalg.decomp import _datanotshared + def test_datacopied(self): + from scipy.linalg.decomp import _datacopied M = matrix([[0,1],[2,3]]) A = asarray(M) L = M.tolist() M2 = M.copy() - assert_equal(_datanotshared(M,M),False) - assert_equal(_datanotshared(M,A),False) + class Fake1: + def __array__(self): + return A - assert_equal(_datanotshared(M,L),True) - assert_equal(_datanotshared(M,M2),True) - assert_equal(_datanotshared(A,M2),True) + class Fake2: + __array_interface__ = A.__array_interface__ + F1 = Fake1() + F2 = Fake2() + AF1 = asarray(F1) + AF2 = asarray(F2) + + for item, status in [(M, False), (A, False), (L, True), + (M2, False), (F1, False), (F2, False)]: + arr = asarray(item) + assert_equal(_datacopied(arr, item), status, + err_msg=repr(item)) + + def test_aligned_mem_float(): """Check linalg works with non-aligned memory""" # Allocate 402 bytes of memory (allocated on boundary) @@ -1207,5 +1221,45 @@ # not properly tested # cholesky, rsf2csf, lu_solve, solve, eig_banded, eigvals_banded, eigh, diagsvd + +class TestOverwrite(object): + def test_eig(self): + assert_no_overwrite(eig, [(3,3)]) + assert_no_overwrite(eig, [(3,3), (3,3)]) + def test_eigh(self): + assert_no_overwrite(eigh, [(3,3)]) + assert_no_overwrite(eigh, [(3,3), (3,3)]) + def test_eig_banded(self): + assert_no_overwrite(eig_banded, [(3,2)]) + def test_eigvals(self): + assert_no_overwrite(eigvals, [(3,3)]) + def test_eigvalsh(self): + assert_no_overwrite(eigvalsh, [(3,3)]) + def test_eigvals_banded(self): + assert_no_overwrite(eigvals_banded, [(3,2)]) + def test_hessenberg(self): + assert_no_overwrite(hessenberg, [(3,3)]) + def test_lu_factor(self): + assert_no_overwrite(lu_factor, [(3,3)]) + def test_lu_solve(self): + x = np.array([[1,2,3], [4,5,6], [7,8,8]]) + xlu = lu_factor(x) + assert_no_overwrite(lambda b: lu_solve(xlu, b), [(3,)]) + def test_lu(self): + assert_no_overwrite(lu, [(3,3)]) + def test_qr(self): + assert_no_overwrite(qr, [(3,3)]) + def test_rq(self): + assert_no_overwrite(rq, [(3,3)]) + def test_schur(self): + assert_no_overwrite(schur, [(3,3)]) + def test_schur_complex(self): + assert_no_overwrite(lambda a: schur(a, 'complex'), [(3,3)], + dtypes=[np.float32, np.float64]) + def test_svd(self): + assert_no_overwrite(svd, [(3,3)]) + def test_svdvals(self): + assert_no_overwrite(svdvals, [(3,3)]) + if __name__ == "__main__": run_module_suite() Modified: trunk/scipy/linalg/tests/test_decomp_cholesky.py =================================================================== --- trunk/scipy/linalg/tests/test_decomp_cholesky.py 2011-01-31 21:52:21 UTC (rev 7115) +++ trunk/scipy/linalg/tests/test_decomp_cholesky.py 2011-01-31 21:52:58 UTC (rev 7116) @@ -4,8 +4,10 @@ from numpy import array, transpose, dot, conjugate, zeros_like from numpy.random import rand -from scipy.linalg import cholesky, cholesky_banded, cho_solve_banded +from scipy.linalg import cholesky, cholesky_banded, cho_solve_banded, \ + cho_factor, cho_solve +from scipy.linalg._testutils import assert_no_overwrite def random(size): return rand(*size) @@ -138,3 +140,20 @@ b = array([0.0, 0.5j, 3.8j, 3.8]) x = cho_solve_banded((c, True), b) assert_array_almost_equal(x, [0.0, 0.0, 1.0j, 1.0]) + +class TestOverwrite(object): + def test_cholesky(self): + assert_no_overwrite(cholesky, [(3,3)]) + def test_cho_factor(self): + assert_no_overwrite(cho_factor, [(3,3)]) + def test_cho_solve(self): + x = array([[2,-1,0], [-1,2,-1], [0,-1,2]]) + xcho = cho_factor(x) + assert_no_overwrite(lambda b: cho_solve(xcho, b), [(3,)]) + def test_cholesky_banded(self): + assert_no_overwrite(cholesky_banded, [(2,3)]) + def test_cho_solve_banded(self): + x = array([[0, -1, -1], [2, 2, 2]]) + xcho = cholesky_banded(x) + assert_no_overwrite(lambda b: cho_solve_banded((xcho, False), b), + [(3,)]) From scipy-svn at scipy.org Mon Jan 31 17:39:02 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 Jan 2011 16:39:02 -0600 (CST) Subject: [Scipy-svn] r7117 - trunk/scipy/weave Message-ID: <20110131223902.1F3A137A835@scipy.org> Author: warren.weckesser Date: 2011-01-31 16:39:01 -0600 (Mon, 31 Jan 2011) New Revision: 7117 Modified: trunk/scipy/weave/blitz_tools.py trunk/scipy/weave/bytecodecompiler.py Log: PY3: weave: No need to support old-style string exceptions, since scipy requires at least python 2.4. Modified: trunk/scipy/weave/blitz_tools.py =================================================================== --- trunk/scipy/weave/blitz_tools.py 2011-01-31 21:52:58 UTC (rev 7116) +++ trunk/scipy/weave/blitz_tools.py 2011-01-31 22:39:01 UTC (rev 7117) @@ -32,10 +32,7 @@ # of time. It also can cause core-dumps if the sizes of the inputs # aren't compatible. if check_size and not size_check.check_expr(expr,local_dict,global_dict): - if sys.version_info < (2, 6): - raise "inputs failed to pass size check." - else: - raise ValueError("inputs failed to pass size check.") + raise ValueError("inputs failed to pass size check.") # 2. try local cache try: Modified: trunk/scipy/weave/bytecodecompiler.py =================================================================== --- trunk/scipy/weave/bytecodecompiler.py 2011-01-31 21:52:58 UTC (rev 7116) +++ trunk/scipy/weave/bytecodecompiler.py 2011-01-31 22:39:01 UTC (rev 7117) @@ -238,10 +238,7 @@ elif goto is None: return next # Normal else: - if sys.version_info < (2, 6): - raise "Executing code failed." - else: - raise ValueError("Executing code failed.") + raise ValueError("Executing code failed.") symbols = { 0: 'less', 1: 'lesseq', 2: 'equal', 3: 'notequal', 4: 'greater', 5: 'greatereq', 6: 'in', 7: 'not in', From scipy-svn at scipy.org Mon Jan 31 18:06:30 2011 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 Jan 2011 17:06:30 -0600 (CST) Subject: [Scipy-svn] r7118 - trunk/scipy/weave Message-ID: <20110131230630.D546937B503@scipy.org> Author: warren.weckesser Date: 2011-01-31 17:06:30 -0600 (Mon, 31 Jan 2011) New Revision: 7118 Modified: trunk/scipy/weave/c_spec.py Log: PY3: weave: Since python 2.3, it is not necessary for c_spec to import itself to get __file__. Modified: trunk/scipy/weave/c_spec.py =================================================================== --- trunk/scipy/weave/c_spec.py 2011-01-31 22:39:01 UTC (rev 7117) +++ trunk/scipy/weave/c_spec.py 2011-01-31 23:06:30 UTC (rev 7118) @@ -377,8 +377,8 @@ # # Based on SCXX by Gordon McMillan #---------------------------------------------------------------------------- -import os, c_spec # yes, I import myself to find out my __file__ location. -local_dir,junk = os.path.split(os.path.abspath(c_spec.__file__)) +import os +local_dir,junk = os.path.split(os.path.abspath(__file__)) scxx_dir = os.path.join(local_dir,'scxx') class scxx_converter(common_base_converter):