From numpy-svn at scipy.org Sat Jul 3 14:47:34 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 3 Jul 2010 13:47:34 -0500 (CDT) Subject: [Numpy-svn] r8469 - in trunk/numpy/core: src/multiarray tests Message-ID: <20100703184734.674D139C4B4@scipy.org> Author: ptvirtan Date: 2010-07-03 13:47:34 -0500 (Sat, 03 Jul 2010) New Revision: 8469 Modified: trunk/numpy/core/src/multiarray/buffer.c trunk/numpy/core/tests/test_multiarray.py Log: BUG: core: fix a reference leak to numpy.core._internal (thanks to Lisandro Dalcin) Modified: trunk/numpy/core/src/multiarray/buffer.c =================================================================== --- trunk/numpy/core/src/multiarray/buffer.c 2010-06-30 20:40:46 UTC (rev 8468) +++ trunk/numpy/core/src/multiarray/buffer.c 2010-07-03 18:47:34 UTC (rev 8469) @@ -740,16 +740,22 @@ } *p = '\0'; + str = PyUString_FromStringAndSize(buf, strlen(buf)); + free(buf); + if (str == NULL) { + return NULL; + } + /* Convert */ _numpy_internal = PyImport_ImportModule("numpy.core._internal"); if (_numpy_internal == NULL) { + Py_DECREF(str); return NULL; } - str = PyUString_FromStringAndSize(buf, strlen(buf)); - free(buf); descr = (PyArray_Descr*)PyObject_CallMethod( _numpy_internal, "_dtype_from_pep3118", "O", str); Py_DECREF(str); + Py_DECREF(_numpy_internal); if (descr == NULL) { PyErr_Format(PyExc_ValueError, "'%s' is not a valid PEP 3118 buffer format string", buf); Modified: trunk/numpy/core/tests/test_multiarray.py =================================================================== --- trunk/numpy/core/tests/test_multiarray.py 2010-06-30 20:40:46 UTC (rev 8468) +++ trunk/numpy/core/tests/test_multiarray.py 2010-07-03 18:47:34 UTC (rev 8469) @@ -1728,5 +1728,14 @@ x = np.array([(1,),(2,)], dtype={'f0': (int, j)}) self._check_roundtrip(x) + def test_reference_leak(self): + count_1 = sys.getrefcount(np.core._internal) + a = np.zeros(4) + b = memoryview(a) + c = np.asarray(b) + count_2 = sys.getrefcount(np.core._internal) + assert_equal(count_1, count_2) + + if __name__ == "__main__": run_module_suite() From numpy-svn at scipy.org Tue Jul 6 17:58:20 2010 From: numpy-svn at scipy.org (Google Pharmacy) Date: Tue, 6 Jul 2010 16:58:20 -0500 (CDT) Subject: [Numpy-svn] Family adventure across the world Message-ID: <20100706215820.BDBFE39CAEB@scipy.org> An HTML attachment was scrubbed... URL: From numpy-svn at scipy.org Wed Jul 7 00:31:51 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 6 Jul 2010 23:31:51 -0500 (CDT) Subject: [Numpy-svn] r8470 - in trunk/numpy: lib lib/tests oldnumeric Message-ID: <20100707043151.E9F5139CAEE@scipy.org> Author: charris Date: 2010-07-06 23:31:51 -0500 (Tue, 06 Jul 2010) New Revision: 8470 Modified: trunk/numpy/lib/function_base.py trunk/numpy/lib/tests/test_function_base.py trunk/numpy/lib/tests/test_regression.py trunk/numpy/oldnumeric/mlab.py Log: ENH: Add ddof keyword to cov and corrcoef. Deprecate bias keyword. Modified: trunk/numpy/lib/function_base.py =================================================================== --- trunk/numpy/lib/function_base.py 2010-07-03 18:47:34 UTC (rev 8469) +++ trunk/numpy/lib/function_base.py 2010-07-07 04:31:51 UTC (rev 8470) @@ -1,27 +1,24 @@ __docformat__ = "restructuredtext en" -__all__ = ['select', 'piecewise', 'trim_zeros', - 'copy', 'iterable', 'percentile', - 'diff', 'gradient', 'angle', 'unwrap', 'sort_complex', 'disp', - 'extract', 'place', 'nansum', 'nanmax', 'nanargmax', - 'nanargmin', 'nanmin', 'vectorize', 'asarray_chkfinite', 'average', - 'histogram', 'histogramdd', 'bincount', 'digitize', 'cov', - 'corrcoef', 'msort', 'median', 'sinc', 'hamming', 'hanning', - 'bartlett', 'blackman', 'kaiser', 'trapz', 'i0', 'add_newdoc', - 'add_docstring', 'meshgrid', 'delete', 'insert', 'append', - 'interp' - ] +__all__ = ['select', 'piecewise', 'trim_zeros', 'copy', 'iterable', + 'percentile', 'diff', 'gradient', 'angle', 'unwrap', 'sort_complex', + 'disp', 'extract', 'place', 'nansum', 'nanmax', 'nanargmax', + 'nanargmin', 'nanmin', 'vectorize', 'asarray_chkfinite', 'average', + 'histogram', 'histogramdd', 'bincount', 'digitize', 'cov', 'corrcoef', + 'msort', 'median', 'sinc', 'hamming', 'hanning', 'bartlett', + 'blackman', 'kaiser', 'trapz', 'i0', 'add_newdoc', 'add_docstring', + 'meshgrid', 'delete', 'insert', 'append', 'interp'] + import warnings - import types import sys import numpy.core.numeric as _nx from numpy.core import linspace from numpy.core.numeric import ones, zeros, arange, concatenate, array, \ - asarray, asanyarray, empty, empty_like, ndarray, around + asarray, asanyarray, empty, empty_like, ndarray, around from numpy.core.numeric import ScalarType, dot, where, newaxis, intp, \ - integer, isscalar + integer, isscalar from numpy.core.umath import pi, multiply, add, arctan2, \ - frompyfunc, isnan, cos, less_equal, sqrt, sin, mod, exp, log10 + frompyfunc, isnan, cos, less_equal, sqrt, sin, mod, exp, log10 from numpy.core.fromnumeric import ravel, nonzero, choose, sort, mean from numpy.core.numerictypes import typecodes, number from numpy.core import atleast_1d, atleast_2d @@ -1817,7 +1814,7 @@ for x, c in zip(self.ufunc(*newargs), self.otypes)]) return _res -def cov(m, y=None, rowvar=1, bias=0): +def cov(m, y=None, rowvar=1, bias=0, ddof=None): """ Estimate a covariance matrix, given data. @@ -1844,7 +1841,13 @@ bias : int, optional Default normalization is by ``(N-1)``, where ``N`` is the number of observations given (unbiased estimate). If `bias` is 1, then - normalization is by ``N``. + normalization is by ``N``. Deprecated in numpy 1.5, use ddof + instead. + ddof : int, optional + Normalization is by ``(N - ddof)``, where ``N`` is the number of + observations. Setting ddof=1 gives the usual unbiased estimate. + Default will be ``None`` until the `bias` keyword is removed and + will be 0 thereafter. Returns ------- @@ -1868,7 +1871,7 @@ Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance matrix shows this clearly: - >>> np.cov(x) + >>> np.cov(x, ddof=1) array([[ 1., -1.], [-1., 1.]]) @@ -1880,13 +1883,13 @@ >>> x = [-2.1, -1, 4.3] >>> y = [3, 1.1, 0.12] >>> X = np.vstack((x,y)) - >>> print np.cov(X) + >>> print np.cov(X, ddof=1) [[ 11.71 -4.286 ] [ -4.286 2.14413333]] - >>> print np.cov(x, y) + >>> print np.cov(x, y, ddof=1) [[ 11.71 -4.286 ] [ -4.286 2.14413333]] - >>> print np.cov(x) + >>> print np.cov(x, ddof=1) 11.71 """ @@ -1904,7 +1907,7 @@ if y is not None: y = array(y, copy=False, ndmin=2, dtype=float) - X = concatenate((X,y),axis) + X = concatenate((X,y), axis) X -= X.mean(axis=1-axis)[tup] if rowvar: @@ -1912,17 +1915,25 @@ else: N = X.shape[0] - if bias: - fact = N*1.0 - else: - fact = N-1.0 + if ddof is None: + if bias: + msg = "The bias keyword is deprecated, "\ + "use ddof=0 instead of bias=1" + ddof = 0 + else: + msg = "The bias keyword is deprecated, "\ + "use ddof=1 instead of bias=0" + ddof = 1 + warnings.warn(msg, DeprecationWarning) + fact = N - ddof if not rowvar: return (dot(X.T, X.conj()) / fact).squeeze() else: return (dot(X, X.T.conj()) / fact).squeeze() -def corrcoef(x, y=None, rowvar=1, bias=0): + +def corrcoef(x, y=None, rowvar=1, bias=0, ddof=None): """ Return correlation coefficients. @@ -1951,7 +1962,13 @@ bias : int, optional Default normalization is by ``(N-1)``, where ``N`` is the number of observations given (unbiased estimate). If `bias` is 1, then - normalization is by ``N``. + normalization is by ``N``. Deprecated in numpy 1.5, use ddof + instead. + ddof : int, optional + Normalization is by ``(N - ddof)``, where ``N`` is the number of + observations. Setting ddof=1 gives the usual unbiased estimate. + Default will be ``None`` until the `bias` keyword is removed and + will be 0 thereafter. Returns ------- @@ -1963,7 +1980,17 @@ cov : Covariance matrix """ - c = cov(x, y, rowvar, bias) + if ddof is None: + if bias: + msg = "The bias keyword is deprecated, "\ + "use ddof=0 instead of bias=1" + ddof = 0 + else: + msg = "The bias keyword is deprecated, "\ + "use ddof=1 instead of bias=0" + ddof = 1 + warnings.warn(msg, DeprecationWarning) + c = cov(x, y, ddof=ddof) try: d = diag(c) except ValueError: # scalar covariance Modified: trunk/numpy/lib/tests/test_function_base.py =================================================================== --- trunk/numpy/lib/tests/test_function_base.py 2010-07-03 18:47:34 UTC (rev 8469) +++ trunk/numpy/lib/tests/test_function_base.py 2010-07-07 04:31:51 UTC (rev 8470) @@ -828,11 +828,11 @@ B = array([[ 0.10377691, 0.5417086 , 0.49807457], [ 0.82872117, 0.77801674, 0.39226705], [ 0.9314666 , 0.66800209, 0.03538394]]) - assert_almost_equal(corrcoef(A), + assert_almost_equal(corrcoef(A, ddof=1), array([[ 1. , 0.9379533 , -0.04931983], [ 0.9379533 , 1. , 0.30007991], [-0.04931983, 0.30007991, 1. ]])) - assert_almost_equal(corrcoef(A, B), + assert_almost_equal(corrcoef(A, B, ddof=1), array([[ 1. , 0.9379533 , -0.04931983, 0.30151751, 0.66318558, 0.51532523], [ 0.9379533 , 1. , 0.30007991, Modified: trunk/numpy/lib/tests/test_regression.py =================================================================== --- trunk/numpy/lib/tests/test_regression.py 2010-07-03 18:47:34 UTC (rev 8469) +++ trunk/numpy/lib/tests/test_regression.py 2010-07-07 04:31:51 UTC (rev 8470) @@ -14,8 +14,8 @@ """Ticket #91""" x = np.random.random((3,3)) y = x.copy() - np.cov(x,rowvar=1) - np.cov(y,rowvar=0) + np.cov(x, rowvar=1, ddof=1) + np.cov(y, rowvar=0, ddof=1) assert_array_equal(x,y) def test_mem_digitize(self,level=rlevel): Modified: trunk/numpy/oldnumeric/mlab.py =================================================================== --- trunk/numpy/oldnumeric/mlab.py 2010-07-03 18:47:34 UTC (rev 8469) +++ trunk/numpy/oldnumeric/mlab.py 2010-07-07 04:31:51 UTC (rev 8470) @@ -92,7 +92,7 @@ from numpy import sqrt, multiply def corrcoef(x, y=None): - c = cov(x,y) + c = cov(x, y, ddof=1) d = diag(c) return c/sqrt(multiply.outer(d,d)) From numpy-svn at scipy.org Wed Jul 7 00:31:55 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 6 Jul 2010 23:31:55 -0500 (CDT) Subject: [Numpy-svn] r8471 - in trunk/numpy: lib lib/tests oldnumeric Message-ID: <20100707043155.41ED039CB12@scipy.org> Author: charris Date: 2010-07-06 23:31:55 -0500 (Tue, 06 Jul 2010) New Revision: 8471 Modified: trunk/numpy/lib/function_base.py trunk/numpy/lib/tests/test_function_base.py trunk/numpy/lib/tests/test_regression.py trunk/numpy/oldnumeric/mlab.py Log: Don't deprecated bias keyword, just add ddof. Modified: trunk/numpy/lib/function_base.py =================================================================== --- trunk/numpy/lib/function_base.py 2010-07-07 04:31:51 UTC (rev 8470) +++ trunk/numpy/lib/function_base.py 2010-07-07 04:31:55 UTC (rev 8471) @@ -1839,15 +1839,15 @@ is transposed: each column represents a variable, while the rows contain observations. bias : int, optional - Default normalization is by ``(N-1)``, where ``N`` is the number of + Default normalization is by ``(N - 1)``, where ``N`` is the number of observations given (unbiased estimate). If `bias` is 1, then - normalization is by ``N``. Deprecated in numpy 1.5, use ddof - instead. + normalization is by ``N``. These values can be overridden by using + the keyword ``ddof`` in numpy versions >= 1.5. ddof : int, optional - Normalization is by ``(N - ddof)``, where ``N`` is the number of - observations. Setting ddof=1 gives the usual unbiased estimate. - Default will be ``None`` until the `bias` keyword is removed and - will be 0 thereafter. + .. versionadded:: 1.5 + If not ``None`` normalization is by ``(N - ddof)``, where ``N`` is + the number of observations. When defined, ``ddof`` overrides the + value implied by ``bias``. The default value is ``None``. Returns ------- @@ -1871,7 +1871,7 @@ Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance matrix shows this clearly: - >>> np.cov(x, ddof=1) + >>> np.cov(x) array([[ 1., -1.], [-1., 1.]]) @@ -1883,17 +1883,16 @@ >>> x = [-2.1, -1, 4.3] >>> y = [3, 1.1, 0.12] >>> X = np.vstack((x,y)) - >>> print np.cov(X, ddof=1) + >>> print np.cov(X) [[ 11.71 -4.286 ] [ -4.286 2.14413333]] - >>> print np.cov(x, y, ddof=1) + >>> print np.cov(x, y) [[ 11.71 -4.286 ] [ -4.286 2.14413333]] - >>> print np.cov(x, ddof=1) + >>> print np.cov(x) 11.71 """ - X = array(m, ndmin=2, dtype=float) if X.shape[0] == 1: rowvar = 1 @@ -1916,16 +1915,11 @@ N = X.shape[0] if ddof is None: - if bias: - msg = "The bias keyword is deprecated, "\ - "use ddof=0 instead of bias=1" - ddof = 0 - else: - msg = "The bias keyword is deprecated, "\ - "use ddof=1 instead of bias=0" + if bias == 0: ddof = 1 - warnings.warn(msg, DeprecationWarning) - fact = N - ddof + else: + ddof = 0 + fact = float(N - ddof) if not rowvar: return (dot(X.T, X.conj()) / fact).squeeze() @@ -1960,15 +1954,15 @@ is transposed: each column represents a variable, while the rows contain observations. bias : int, optional - Default normalization is by ``(N-1)``, where ``N`` is the number of - observations given (unbiased estimate). If `bias` is 1, then - normalization is by ``N``. Deprecated in numpy 1.5, use ddof - instead. - ddof : int, optional - Normalization is by ``(N - ddof)``, where ``N`` is the number of - observations. Setting ddof=1 gives the usual unbiased estimate. - Default will be ``None`` until the `bias` keyword is removed and - will be 0 thereafter. + Default normalization is by ``(N - 1)``, where ``N`` is the number of + observations (unbiased estimate). If `bias` is 1, then + normalization is by ``N``. These values can be overridden by using + the keyword ``ddof`` in numpy versions >= 1.5. + ddof : {None, int}, optional + .. versionadded:: 1.5 + If not ``None`` normalization is by ``(N - ddof)``, where ``N`` is + the number of observations. When defined, ``ddof`` overrides the + value implied by ``bias``. The default value is ``None``. Returns ------- @@ -1980,17 +1974,7 @@ cov : Covariance matrix """ - if ddof is None: - if bias: - msg = "The bias keyword is deprecated, "\ - "use ddof=0 instead of bias=1" - ddof = 0 - else: - msg = "The bias keyword is deprecated, "\ - "use ddof=1 instead of bias=0" - ddof = 1 - warnings.warn(msg, DeprecationWarning) - c = cov(x, y, ddof=ddof) + c = cov(x, y, bias=bias, ddof=ddof) try: d = diag(c) except ValueError: # scalar covariance Modified: trunk/numpy/lib/tests/test_function_base.py =================================================================== --- trunk/numpy/lib/tests/test_function_base.py 2010-07-07 04:31:51 UTC (rev 8470) +++ trunk/numpy/lib/tests/test_function_base.py 2010-07-07 04:31:55 UTC (rev 8471) @@ -828,11 +828,11 @@ B = array([[ 0.10377691, 0.5417086 , 0.49807457], [ 0.82872117, 0.77801674, 0.39226705], [ 0.9314666 , 0.66800209, 0.03538394]]) - assert_almost_equal(corrcoef(A, ddof=1), + assert_almost_equal(corrcoef(A), array([[ 1. , 0.9379533 , -0.04931983], [ 0.9379533 , 1. , 0.30007991], [-0.04931983, 0.30007991, 1. ]])) - assert_almost_equal(corrcoef(A, B, ddof=1), + assert_almost_equal(corrcoef(A, B), array([[ 1. , 0.9379533 , -0.04931983, 0.30151751, 0.66318558, 0.51532523], [ 0.9379533 , 1. , 0.30007991, Modified: trunk/numpy/lib/tests/test_regression.py =================================================================== --- trunk/numpy/lib/tests/test_regression.py 2010-07-07 04:31:51 UTC (rev 8470) +++ trunk/numpy/lib/tests/test_regression.py 2010-07-07 04:31:55 UTC (rev 8471) @@ -14,8 +14,8 @@ """Ticket #91""" x = np.random.random((3,3)) y = x.copy() - np.cov(x, rowvar=1, ddof=1) - np.cov(y, rowvar=0, ddof=1) + np.cov(x, rowvar=1) + np.cov(y, rowvar=0) assert_array_equal(x,y) def test_mem_digitize(self,level=rlevel): Modified: trunk/numpy/oldnumeric/mlab.py =================================================================== --- trunk/numpy/oldnumeric/mlab.py 2010-07-07 04:31:51 UTC (rev 8470) +++ trunk/numpy/oldnumeric/mlab.py 2010-07-07 04:31:55 UTC (rev 8471) @@ -92,7 +92,7 @@ from numpy import sqrt, multiply def corrcoef(x, y=None): - c = cov(x, y, ddof=1) + c = cov(x, y) d = diag(c) return c/sqrt(multiply.outer(d,d)) From numpy-svn at scipy.org Wed Jul 7 00:31:57 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 6 Jul 2010 23:31:57 -0500 (CDT) Subject: [Numpy-svn] r8472 - trunk/numpy/lib Message-ID: <20100707043157.C1C2139CAEE@scipy.org> Author: charris Date: 2010-07-06 23:31:57 -0500 (Tue, 06 Jul 2010) New Revision: 8472 Modified: trunk/numpy/lib/function_base.py Log: Fix missing rowvar in cov call in corrcoeff. Modified: trunk/numpy/lib/function_base.py =================================================================== --- trunk/numpy/lib/function_base.py 2010-07-07 04:31:55 UTC (rev 8471) +++ trunk/numpy/lib/function_base.py 2010-07-07 04:31:57 UTC (rev 8472) @@ -1974,7 +1974,7 @@ cov : Covariance matrix """ - c = cov(x, y, bias=bias, ddof=ddof) + c = cov(x, y, rowvar, bias, ddof) try: d = diag(c) except ValueError: # scalar covariance From numpy-svn at scipy.org Wed Jul 7 00:32:01 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 6 Jul 2010 23:32:01 -0500 (CDT) Subject: [Numpy-svn] r8473 - in trunk/numpy: lib lib/tests ma ma/tests Message-ID: <20100707043201.2189239CAEE@scipy.org> Author: charris Date: 2010-07-06 23:32:00 -0500 (Tue, 06 Jul 2010) New Revision: 8473 Modified: trunk/numpy/lib/function_base.py trunk/numpy/lib/tests/test_function_base.py trunk/numpy/ma/extras.py trunk/numpy/ma/tests/test_extras.py Log: ENH: Add ddof keyword to masked versions of cov and corrcoef. Modified: trunk/numpy/lib/function_base.py =================================================================== --- trunk/numpy/lib/function_base.py 2010-07-07 04:31:57 UTC (rev 8472) +++ trunk/numpy/lib/function_base.py 2010-07-07 04:32:00 UTC (rev 8473) @@ -1846,8 +1846,8 @@ ddof : int, optional .. versionadded:: 1.5 If not ``None`` normalization is by ``(N - ddof)``, where ``N`` is - the number of observations. When defined, ``ddof`` overrides the - value implied by ``bias``. The default value is ``None``. + the number of observations; this overrides the value implied by + ``bias``. The default value is ``None``. Returns ------- @@ -1893,6 +1893,10 @@ 11.71 """ + # Check inputs + if ddof is not None and ddof != int(ddof): + raise ValueError("ddof must be integer") + X = array(m, ndmin=2, dtype=float) if X.shape[0] == 1: rowvar = 1 @@ -1961,8 +1965,8 @@ ddof : {None, int}, optional .. versionadded:: 1.5 If not ``None`` normalization is by ``(N - ddof)``, where ``N`` is - the number of observations. When defined, ``ddof`` overrides the - value implied by ``bias``. The default value is ``None``. + the number of observations; this overrides the value implied by + ``bias``. The default value is ``None``. Returns ------- Modified: trunk/numpy/lib/tests/test_function_base.py =================================================================== --- trunk/numpy/lib/tests/test_function_base.py 2010-07-07 04:31:57 UTC (rev 8472) +++ trunk/numpy/lib/tests/test_function_base.py 2010-07-07 04:32:00 UTC (rev 8473) @@ -821,32 +821,37 @@ class TestCorrCoef(TestCase): + A = array([[ 0.15391142, 0.18045767, 0.14197213], + [ 0.70461506, 0.96474128, 0.27906989], + [ 0.9297531 , 0.32296769, 0.19267156]]) + B = array([[ 0.10377691, 0.5417086 , 0.49807457], + [ 0.82872117, 0.77801674, 0.39226705], + [ 0.9314666 , 0.66800209, 0.03538394]]) + res1 = array([[ 1. , 0.9379533 , -0.04931983], + [ 0.9379533 , 1. , 0.30007991], + [-0.04931983, 0.30007991, 1. ]]) + res2 = array([[ 1. , 0.9379533 , -0.04931983, + 0.30151751, 0.66318558, 0.51532523], + [ 0.9379533 , 1. , 0.30007991, + - 0.04781421, 0.88157256, 0.78052386], + [-0.04931983, 0.30007991, 1. , + - 0.96717111, 0.71483595, 0.83053601], + [ 0.30151751, -0.04781421, -0.96717111, + 1. , -0.51366032, -0.66173113], + [ 0.66318558, 0.88157256, 0.71483595, + - 0.51366032, 1. , 0.98317823], + [ 0.51532523, 0.78052386, 0.83053601, + - 0.66173113, 0.98317823, 1. ]]) + def test_simple(self): - A = array([[ 0.15391142, 0.18045767, 0.14197213], - [ 0.70461506, 0.96474128, 0.27906989], - [ 0.9297531 , 0.32296769, 0.19267156]]) - B = array([[ 0.10377691, 0.5417086 , 0.49807457], - [ 0.82872117, 0.77801674, 0.39226705], - [ 0.9314666 , 0.66800209, 0.03538394]]) - assert_almost_equal(corrcoef(A), - array([[ 1. , 0.9379533 , -0.04931983], - [ 0.9379533 , 1. , 0.30007991], - [-0.04931983, 0.30007991, 1. ]])) - assert_almost_equal(corrcoef(A, B), - array([[ 1. , 0.9379533 , -0.04931983, - 0.30151751, 0.66318558, 0.51532523], - [ 0.9379533 , 1. , 0.30007991, - - 0.04781421, 0.88157256, 0.78052386], - [-0.04931983, 0.30007991, 1. , - - 0.96717111, 0.71483595, 0.83053601], - [ 0.30151751, -0.04781421, -0.96717111, - 1. , -0.51366032, -0.66173113], - [ 0.66318558, 0.88157256, 0.71483595, - - 0.51366032, 1. , 0.98317823], - [ 0.51532523, 0.78052386, 0.83053601, - - 0.66173113, 0.98317823, 1. ]])) + assert_almost_equal(corrcoef(self.A), self.res1) + assert_almost_equal(corrcoef(self.A, self.B), self.res2) + def test_ddof(self): + assert_almost_equal(corrcoef(self.A, ddof=-1), self.res1) + assert_almost_equal(corrcoef(self.A, self.B, ddof=-1), self.res2) + class Test_i0(TestCase): def test_simple(self): assert_almost_equal(i0(0.5), array(1.0634833707413234)) Modified: trunk/numpy/ma/extras.py =================================================================== --- trunk/numpy/ma/extras.py 2010-07-07 04:31:57 UTC (rev 8472) +++ trunk/numpy/ma/extras.py 2010-07-07 04:32:00 UTC (rev 8473) @@ -1299,7 +1299,7 @@ return (x, xnotmask, rowvar) -def cov(x, y=None, rowvar=True, bias=False, allow_masked=True): +def cov(x, y=None, rowvar=True, bias=False, allow_masked=True, ddof=None): """ Estimate the covariance matrix. @@ -1329,12 +1329,19 @@ bias : bool, optional Default normalization (False) is by ``(N-1)``, where ``N`` is the number of observations given (unbiased estimate). If `bias` is True, - then normalization is by ``N``. + then normalization is by ``N``. This keyword can be overridden by + the keyword ``ddof`` in numpy versions >= 1.5. allow_masked : bool, optional If True, masked values are propagated pair-wise: if a value is masked in `x`, the corresponding value is masked in `y`. If False, raises a `ValueError` exception when some values are missing. + ddof : {None, int}, optional + .. versionadded:: 1.5 + If not ``None`` normalization is by ``(N - ddof)``, where ``N`` is + the number of observations; this overrides the value implied by + ``bias``. The default value is ``None``. + Raises ------ ValueError: @@ -1345,17 +1352,27 @@ numpy.cov """ + # Check inputs + if ddof is not None and ddof != int(ddof): + raise ValueError("ddof must be an integer") + # Set up ddof + if ddof is None: + if bias: + ddof = 0 + else: + ddof = 1 + (x, xnotmask, rowvar) = _covhelper(x, y, rowvar, allow_masked) if not rowvar: - fact = np.dot(xnotmask.T, xnotmask) * 1. - (1 - bool(bias)) + fact = np.dot(xnotmask.T, xnotmask) * 1. - ddof result = (dot(x.T, x.conj(), strict=False) / fact).squeeze() else: - fact = np.dot(xnotmask, xnotmask.T) * 1. - (1 - bool(bias)) + fact = np.dot(xnotmask, xnotmask.T) * 1. - ddof result = (dot(x, x.T.conj(), strict=False) / fact).squeeze() return result -def corrcoef(x, y=None, rowvar=True, bias=False, allow_masked=True): +def corrcoef(x, y=None, rowvar=True, bias=False, allow_masked=True, ddof=None): """ Return correlation coefficients of the input array. @@ -1379,11 +1396,17 @@ bias : bool, optional Default normalization (False) is by ``(N-1)``, where ``N`` is the number of observations given (unbiased estimate). If `bias` is 1, - then normalization is by ``N``. + then normalization is by ``N``. This keyword can be overridden by + the keyword ``ddof`` in numpy versions >= 1.5. allow_masked : bool, optional If True, masked values are propagated pair-wise: if a value is masked in `x`, the corresponding value is masked in `y`. If False, raises an exception. + ddof : {None, int}, optional + .. versionadded:: 1.5 + If not ``None`` normalization is by ``(N - ddof)``, where ``N`` is + the number of observations; this overrides the value implied by + ``bias``. The default value is ``None``. See Also -------- @@ -1391,14 +1414,24 @@ cov : Estimate the covariance matrix. """ + # Check inputs + if ddof is not None and ddof != int(ddof): + raise ValueError("ddof must be an integer") + # Set up ddof + if ddof is None: + if bias: + ddof = 0 + else: + ddof = 1 + # Get the data (x, xnotmask, rowvar) = _covhelper(x, y, rowvar, allow_masked) # Compute the covariance matrix if not rowvar: - fact = np.dot(xnotmask.T, xnotmask) * 1. - (1 - bool(bias)) + fact = np.dot(xnotmask.T, xnotmask) * 1. - ddof c = (dot(x.T, x.conj(), strict=False) / fact).squeeze() else: - fact = np.dot(xnotmask, xnotmask.T) * 1. - (1 - bool(bias)) + fact = np.dot(xnotmask, xnotmask.T) * 1. - ddof c = (dot(x, x.T.conj(), strict=False) / fact).squeeze() # Check whether we have a scalar try: Modified: trunk/numpy/ma/tests/test_extras.py =================================================================== --- trunk/numpy/ma/tests/test_extras.py 2010-07-07 04:31:57 UTC (rev 8472) +++ trunk/numpy/ma/tests/test_extras.py 2010-07-07 04:32:00 UTC (rev 8473) @@ -528,6 +528,12 @@ def setUp(self): self.data = array(np.random.rand(12)) + def test_ddof(self): + "Test ddof keyword" + x = self.data + assert_almost_equal(np.corrcoef(x, ddof=0), corrcoef(x, ddof=0)) + + def test_1d_wo_missing(self): "Test cov on 1D variable w/o missing values" x = self.data From numpy-svn at scipy.org Fri Jul 9 04:11:40 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 9 Jul 2010 03:11:40 -0500 (CDT) Subject: [Numpy-svn] r8474 - in trunk/numpy/random: mtrand tests Message-ID: <20100709081140.1AE7B39CAEA@scipy.org> Author: ptvirtan Date: 2010-07-09 03:11:39 -0500 (Fri, 09 Jul 2010) New Revision: 8474 Modified: trunk/numpy/random/mtrand/mtrand.pyx trunk/numpy/random/tests/test_random.py Log: BUG: random: accept Python long as input to np.random.permutation (#1535) Modified: trunk/numpy/random/mtrand/mtrand.pyx =================================================================== --- trunk/numpy/random/mtrand/mtrand.pyx 2010-07-07 04:32:00 UTC (rev 8473) +++ trunk/numpy/random/mtrand/mtrand.pyx 2010-07-09 08:11:39 UTC (rev 8474) @@ -4226,7 +4226,7 @@ array([15, 1, 9, 4, 12]) """ - if isinstance(x, (int, np.integer)): + if isinstance(x, (int, long, np.integer)): arr = np.arange(x) else: arr = np.array(x) Modified: trunk/numpy/random/tests/test_random.py =================================================================== --- trunk/numpy/random/tests/test_random.py 2010-07-07 04:32:00 UTC (rev 8473) +++ trunk/numpy/random/tests/test_random.py 2010-07-09 08:11:39 UTC (rev 8474) @@ -34,6 +34,12 @@ msg = "Frequency was %f, should be < 0.23" % freq assert_(freq < 0.23, msg) + def test_permutation_longs(self): + np.random.seed(1234) + a = np.random.permutation(12) + np.random.seed(1234) + b = np.random.permutation(12L) + assert_array_equal(a, b) class TestMultinomial(TestCase): def test_basic(self): From numpy-svn at scipy.org Fri Jul 9 04:11:55 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 9 Jul 2010 03:11:55 -0500 (CDT) Subject: [Numpy-svn] r8475 - trunk/numpy/random/mtrand Message-ID: <20100709081155.2FEBA39CAEA@scipy.org> Author: ptvirtan Date: 2010-07-09 03:11:54 -0500 (Fri, 09 Jul 2010) New Revision: 8475 Modified: trunk/numpy/random/mtrand/mtrand.c Log: GEN: random: Regenerate mtrand.c Modified: trunk/numpy/random/mtrand/mtrand.c =================================================================== --- trunk/numpy/random/mtrand/mtrand.c 2010-07-09 08:11:39 UTC (rev 8474) +++ trunk/numpy/random/mtrand/mtrand.c 2010-07-09 08:11:54 UTC (rev 8475) @@ -1,4 +1,4 @@ -/* Generated by Cython 0.12 on Mon Feb 22 20:43:03 2010 */ +/* Generated by Cython 0.12.1 on Mon Jul 5 13:47:19 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -6,6 +6,7 @@ #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #else + #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif @@ -17,6 +18,7 @@ #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) #define PyDict_Contains(d,o) PySequence_Contains(d,o) #endif + #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX @@ -26,7 +28,9 @@ #define PyInt_AsSsize_t(o) PyInt_AsLong(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #endif + #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -36,17 +40,17 @@ #define PyType_Modified(t) typedef struct { - void *buf; - PyObject *obj; - Py_ssize_t len; - Py_ssize_t itemsize; - int readonly; - int ndim; - char *format; - Py_ssize_t *shape; - Py_ssize_t *strides; - Py_ssize_t *suboffsets; - void *internal; + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 @@ -60,18 +64,22 @@ #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #endif + #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #endif + #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif + #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif + #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyString_Type PyUnicode_Type @@ -80,6 +88,7 @@ #define PyBytes_Type PyString_Type #define PyBytes_CheckExact PyString_CheckExact #endif + #if PY_MAJOR_VERSION >= 3 #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) @@ -99,10 +108,13 @@ #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) + #endif + #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) #endif + #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -116,6 +128,7 @@ #else #define _USE_MATH_DEFINES #endif + #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -125,6 +138,7 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif + #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -147,12 +161,14 @@ #include "distributions.h" #include "initarray.h" -#ifdef __GNUC__ -#define INLINE __inline__ -#elif _WIN32 -#define INLINE __inline -#else -#define INLINE +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #else + #define CYTHON_INLINE + #endif #endif typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ @@ -174,8 +190,8 @@ #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -static INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); #if !defined(T_PYSSIZET) #if PY_VERSION_HEX < 0x02050000 @@ -239,9 +255,9 @@ #endif #endif -static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) @@ -291,7 +307,7 @@ typedef long (*__pyx_t_6mtrand_rk_discd)(rk_state *, double); -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":522 +/* "mtrand.pyx":522 * return sum * * cdef class RandomState: # <<<<<<<<<<<<<< @@ -358,14 +374,8 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ -static INLINE PyObject* __Pyx_Type(PyObject* o) { - PyObject* type = (PyObject*) Py_TYPE(o); - Py_INCREF(type); - return type; -} - -static INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; r = PyObject_GetItem(o, j); @@ -378,7 +388,7 @@ __Pyx_GetItemInt_List_Fast(o, i, size <= sizeof(long)) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) -static INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) { +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) { if (likely(o != Py_None)) { if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, i); @@ -398,7 +408,7 @@ __Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) -static INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) { +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) { if (likely(o != Py_None)) { if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, i); @@ -419,7 +429,7 @@ __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) -static INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) { +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) { PyObject *r; if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { r = PyList_GET_ITEM(o, i); @@ -438,21 +448,21 @@ return r; } -static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); -static INLINE void __Pyx_RaiseTooManyValuesError(void); +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void); static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ static int __Pyx_EndUnpack(PyObject *); /*proto*/ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ -static INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, +static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/ -static INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ -static INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { +static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { if (likely(PyList_CheckExact(L))) { if (PyList_Append(L, x) < 0) return NULL; Py_INCREF(Py_None); @@ -472,7 +482,7 @@ __Pyx_SetItemInt_Fast(o, i, v, size <= sizeof(long)) : \ __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) -static INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { +static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { int r; if (!j) return -1; r = PyObject_SetItem(o, j, v); @@ -480,7 +490,7 @@ return r; } -static INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int fits_long) { +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int fits_long) { if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { Py_INCREF(v); Py_DECREF(PyList_GET_ITEM(o, i)); @@ -495,49 +505,49 @@ } } -static INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); -static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); -static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); -static INLINE char __Pyx_PyInt_AsChar(PyObject *); +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); -static INLINE short __Pyx_PyInt_AsShort(PyObject *); +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); -static INLINE int __Pyx_PyInt_AsInt(PyObject *); +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); -static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); -static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); -static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); -static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); -static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); -static INLINE long __Pyx_PyInt_AsLong(PyObject *); +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); -static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); -static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); -static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ @@ -1010,7 +1020,7 @@ static PyObject *__pyx_k_33; static PyObject *__pyx_k_43; -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":128 +/* "mtrand.pyx":128 * import numpy as np * * cdef object cont0_array(rk_state *state, rk_cont0 func, object size): # <<<<<<<<<<<<<< @@ -1033,7 +1043,7 @@ __Pyx_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":134 + /* "mtrand.pyx":134 * cdef long i * * if size is None: # <<<<<<<<<<<<<< @@ -1043,7 +1053,7 @@ __pyx_t_1 = (__pyx_v_size == Py_None); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":135 + /* "mtrand.pyx":135 * * if size is None: * return func(state) # <<<<<<<<<<<<<< @@ -1060,7 +1070,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":137 + /* "mtrand.pyx":137 * return func(state) * else: * array = np.empty(size, np.float64) # <<<<<<<<<<<<<< @@ -1094,7 +1104,7 @@ arrayObject = ((PyArrayObject *)__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":138 + /* "mtrand.pyx":138 * else: * array = np.empty(size, np.float64) * length = PyArray_SIZE(array) # <<<<<<<<<<<<<< @@ -1103,7 +1113,7 @@ */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":139 + /* "mtrand.pyx":139 * array = np.empty(size, np.float64) * length = PyArray_SIZE(array) * array_data = array.data # <<<<<<<<<<<<<< @@ -1112,7 +1122,7 @@ */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":140 + /* "mtrand.pyx":140 * length = PyArray_SIZE(array) * array_data = array.data * for i from 0 <= i < length: # <<<<<<<<<<<<<< @@ -1122,7 +1132,7 @@ __pyx_t_5 = __pyx_v_length; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":141 + /* "mtrand.pyx":141 * array_data = array.data * for i from 0 <= i < length: * array_data[i] = func(state) # <<<<<<<<<<<<<< @@ -1132,7 +1142,7 @@ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state); } - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":142 + /* "mtrand.pyx":142 * for i from 0 <= i < length: * array_data[i] = func(state) * return array # <<<<<<<<<<<<<< @@ -1162,7 +1172,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":145 +/* "mtrand.pyx":145 * * * cdef object cont1_array_sc(rk_state *state, rk_cont1 func, object size, double a): # <<<<<<<<<<<<<< @@ -1185,7 +1195,7 @@ __Pyx_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":151 + /* "mtrand.pyx":151 * cdef long i * * if size is None: # <<<<<<<<<<<<<< @@ -1195,7 +1205,7 @@ __pyx_t_1 = (__pyx_v_size == Py_None); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":152 + /* "mtrand.pyx":152 * * if size is None: * return func(state, a) # <<<<<<<<<<<<<< @@ -1212,7 +1222,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":154 + /* "mtrand.pyx":154 * return func(state, a) * else: * array = np.empty(size, np.float64) # <<<<<<<<<<<<<< @@ -1246,7 +1256,7 @@ arrayObject = ((PyArrayObject *)__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":155 + /* "mtrand.pyx":155 * else: * array = np.empty(size, np.float64) * length = PyArray_SIZE(array) # <<<<<<<<<<<<<< @@ -1255,7 +1265,7 @@ */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":156 + /* "mtrand.pyx":156 * array = np.empty(size, np.float64) * length = PyArray_SIZE(array) * array_data = array.data # <<<<<<<<<<<<<< @@ -1264,7 +1274,7 @@ */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":157 + /* "mtrand.pyx":157 * length = PyArray_SIZE(array) * array_data = array.data * for i from 0 <= i < length: # <<<<<<<<<<<<<< @@ -1274,7 +1284,7 @@ __pyx_t_5 = __pyx_v_length; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":158 + /* "mtrand.pyx":158 * array_data = array.data * for i from 0 <= i < length: * array_data[i] = func(state, a) # <<<<<<<<<<<<<< @@ -1284,7 +1294,7 @@ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state, __pyx_v_a); } - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":159 + /* "mtrand.pyx":159 * for i from 0 <= i < length: * array_data[i] = func(state, a) * return array # <<<<<<<<<<<<<< @@ -1314,7 +1324,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":161 +/* "mtrand.pyx":161 * return array * * cdef object cont1_array(rk_state *state, rk_cont1 func, object size, ndarray oa): # <<<<<<<<<<<<<< @@ -1343,7 +1353,7 @@ __pyx_v_itera = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":170 + /* "mtrand.pyx":170 * cdef broadcast multi * * if size is None: # <<<<<<<<<<<<<< @@ -1353,7 +1363,7 @@ __pyx_t_1 = (__pyx_v_size == Py_None); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":171 + /* "mtrand.pyx":171 * * if size is None: * array = PyArray_SimpleNew(oa.nd, oa.dimensions, NPY_DOUBLE) # <<<<<<<<<<<<<< @@ -1367,7 +1377,7 @@ arrayObject = ((PyArrayObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":172 + /* "mtrand.pyx":172 * if size is None: * array = PyArray_SimpleNew(oa.nd, oa.dimensions, NPY_DOUBLE) * length = PyArray_SIZE(array) # <<<<<<<<<<<<<< @@ -1376,7 +1386,7 @@ */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":173 + /* "mtrand.pyx":173 * array = PyArray_SimpleNew(oa.nd, oa.dimensions, NPY_DOUBLE) * length = PyArray_SIZE(array) * array_data = array.data # <<<<<<<<<<<<<< @@ -1385,7 +1395,7 @@ */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":174 + /* "mtrand.pyx":174 * length = PyArray_SIZE(array) * array_data = array.data * itera = PyArray_IterNew(oa) # <<<<<<<<<<<<<< @@ -1399,7 +1409,7 @@ __pyx_v_itera = ((PyArrayIterObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":175 + /* "mtrand.pyx":175 * array_data = array.data * itera = PyArray_IterNew(oa) * for i from 0 <= i < length: # <<<<<<<<<<<<<< @@ -1409,7 +1419,7 @@ __pyx_t_3 = __pyx_v_length; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":176 + /* "mtrand.pyx":176 * itera = PyArray_IterNew(oa) * for i from 0 <= i < length: * array_data[i] = func(state, ((itera.dataptr))[0]) # <<<<<<<<<<<<<< @@ -1418,7 +1428,7 @@ */ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state, (((double *)__pyx_v_itera->dataptr)[0])); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":177 + /* "mtrand.pyx":177 * for i from 0 <= i < length: * array_data[i] = func(state, ((itera.dataptr))[0]) * PyArray_ITER_NEXT(itera) # <<<<<<<<<<<<<< @@ -1431,7 +1441,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":179 + /* "mtrand.pyx":179 * PyArray_ITER_NEXT(itera) * else: * array = np.empty(size, np.float64) # <<<<<<<<<<<<<< @@ -1465,7 +1475,7 @@ arrayObject = ((PyArrayObject *)__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":180 + /* "mtrand.pyx":180 * else: * array = np.empty(size, np.float64) * array_data = array.data # <<<<<<<<<<<<<< @@ -1474,7 +1484,7 @@ */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":182 + /* "mtrand.pyx":182 * array_data = array.data * multi = PyArray_MultiIterNew(2, array, * oa) # <<<<<<<<<<<<<< @@ -1488,7 +1498,7 @@ __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":183 + /* "mtrand.pyx":183 * multi = PyArray_MultiIterNew(2, array, * oa) * if (multi.size != PyArray_SIZE(array)): # <<<<<<<<<<<<<< @@ -1498,7 +1508,7 @@ __pyx_t_1 = (__pyx_v_multi->size != PyArray_SIZE(arrayObject)); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":184 + /* "mtrand.pyx":184 * oa) * if (multi.size != PyArray_SIZE(array)): * raise ValueError("size is not compatible with inputs") # <<<<<<<<<<<<<< @@ -1520,7 +1530,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":185 + /* "mtrand.pyx":185 * if (multi.size != PyArray_SIZE(array)): * raise ValueError("size is not compatible with inputs") * for i from 0 <= i < multi.size: # <<<<<<<<<<<<<< @@ -1530,7 +1540,7 @@ __pyx_t_3 = __pyx_v_multi->size; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":186 + /* "mtrand.pyx":186 * raise ValueError("size is not compatible with inputs") * for i from 0 <= i < multi.size: * oa_data = PyArray_MultiIter_DATA(multi, 1) # <<<<<<<<<<<<<< @@ -1539,7 +1549,7 @@ */ __pyx_v_oa_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 1)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":187 + /* "mtrand.pyx":187 * for i from 0 <= i < multi.size: * oa_data = PyArray_MultiIter_DATA(multi, 1) * array_data[i] = func(state, oa_data[0]) # <<<<<<<<<<<<<< @@ -1548,7 +1558,7 @@ */ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state, (__pyx_v_oa_data[0])); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":188 + /* "mtrand.pyx":188 * oa_data = PyArray_MultiIter_DATA(multi, 1) * array_data[i] = func(state, oa_data[0]) * PyArray_MultiIter_NEXTi(multi, 1) # <<<<<<<<<<<<<< @@ -1560,7 +1570,7 @@ } __pyx_L3:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":189 + /* "mtrand.pyx":189 * array_data[i] = func(state, oa_data[0]) * PyArray_MultiIter_NEXTi(multi, 1) * return array # <<<<<<<<<<<<<< @@ -1591,7 +1601,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":191 +/* "mtrand.pyx":191 * return array * * cdef object cont2_array_sc(rk_state *state, rk_cont2 func, object size, double a, # <<<<<<<<<<<<<< @@ -1614,7 +1624,7 @@ __Pyx_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":198 + /* "mtrand.pyx":198 * cdef long i * * if size is None: # <<<<<<<<<<<<<< @@ -1624,7 +1634,7 @@ __pyx_t_1 = (__pyx_v_size == Py_None); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":199 + /* "mtrand.pyx":199 * * if size is None: * return func(state, a, b) # <<<<<<<<<<<<<< @@ -1641,7 +1651,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":201 + /* "mtrand.pyx":201 * return func(state, a, b) * else: * array = np.empty(size, np.float64) # <<<<<<<<<<<<<< @@ -1675,7 +1685,7 @@ arrayObject = ((PyArrayObject *)__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":202 + /* "mtrand.pyx":202 * else: * array = np.empty(size, np.float64) * length = PyArray_SIZE(array) # <<<<<<<<<<<<<< @@ -1684,7 +1694,7 @@ */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":203 + /* "mtrand.pyx":203 * array = np.empty(size, np.float64) * length = PyArray_SIZE(array) * array_data = array.data # <<<<<<<<<<<<<< @@ -1693,7 +1703,7 @@ */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":204 + /* "mtrand.pyx":204 * length = PyArray_SIZE(array) * array_data = array.data * for i from 0 <= i < length: # <<<<<<<<<<<<<< @@ -1703,7 +1713,7 @@ __pyx_t_5 = __pyx_v_length; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":205 + /* "mtrand.pyx":205 * array_data = array.data * for i from 0 <= i < length: * array_data[i] = func(state, a, b) # <<<<<<<<<<<<<< @@ -1713,7 +1723,7 @@ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state, __pyx_v_a, __pyx_v_b); } - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":206 + /* "mtrand.pyx":206 * for i from 0 <= i < length: * array_data[i] = func(state, a, b) * return array # <<<<<<<<<<<<<< @@ -1743,7 +1753,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":209 +/* "mtrand.pyx":209 * * * cdef object cont2_array(rk_state *state, rk_cont2 func, object size, # <<<<<<<<<<<<<< @@ -1771,7 +1781,7 @@ arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":219 + /* "mtrand.pyx":219 * cdef broadcast multi * * if size is None: # <<<<<<<<<<<<<< @@ -1781,7 +1791,7 @@ __pyx_t_1 = (__pyx_v_size == Py_None); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":220 + /* "mtrand.pyx":220 * * if size is None: * multi = PyArray_MultiIterNew(2, oa, ob) # <<<<<<<<<<<<<< @@ -1795,7 +1805,7 @@ __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":221 + /* "mtrand.pyx":221 * if size is None: * multi = PyArray_MultiIterNew(2, oa, ob) * array = PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_DOUBLE) # <<<<<<<<<<<<<< @@ -1809,7 +1819,7 @@ arrayObject = ((PyArrayObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":222 + /* "mtrand.pyx":222 * multi = PyArray_MultiIterNew(2, oa, ob) * array = PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_DOUBLE) * array_data = array.data # <<<<<<<<<<<<<< @@ -1818,7 +1828,7 @@ */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":223 + /* "mtrand.pyx":223 * array = PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_DOUBLE) * array_data = array.data * for i from 0 <= i < multi.size: # <<<<<<<<<<<<<< @@ -1828,7 +1838,7 @@ __pyx_t_3 = __pyx_v_multi->size; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":224 + /* "mtrand.pyx":224 * array_data = array.data * for i from 0 <= i < multi.size: * oa_data = PyArray_MultiIter_DATA(multi, 0) # <<<<<<<<<<<<<< @@ -1837,7 +1847,7 @@ */ __pyx_v_oa_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 0)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":225 + /* "mtrand.pyx":225 * for i from 0 <= i < multi.size: * oa_data = PyArray_MultiIter_DATA(multi, 0) * ob_data = PyArray_MultiIter_DATA(multi, 1) # <<<<<<<<<<<<<< @@ -1846,7 +1856,7 @@ */ __pyx_v_ob_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 1)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":226 + /* "mtrand.pyx":226 * oa_data = PyArray_MultiIter_DATA(multi, 0) * ob_data = PyArray_MultiIter_DATA(multi, 1) * array_data[i] = func(state, oa_data[0], ob_data[0]) # <<<<<<<<<<<<<< @@ -1855,7 +1865,7 @@ */ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state, (__pyx_v_oa_data[0]), (__pyx_v_ob_data[0])); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":227 + /* "mtrand.pyx":227 * ob_data = PyArray_MultiIter_DATA(multi, 1) * array_data[i] = func(state, oa_data[0], ob_data[0]) * PyArray_MultiIter_NEXT(multi) # <<<<<<<<<<<<<< @@ -1868,7 +1878,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":229 + /* "mtrand.pyx":229 * PyArray_MultiIter_NEXT(multi) * else: * array = np.empty(size, np.float64) # <<<<<<<<<<<<<< @@ -1902,7 +1912,7 @@ arrayObject = ((PyArrayObject *)__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":230 + /* "mtrand.pyx":230 * else: * array = np.empty(size, np.float64) * array_data = array.data # <<<<<<<<<<<<<< @@ -1911,7 +1921,7 @@ */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":231 + /* "mtrand.pyx":231 * array = np.empty(size, np.float64) * array_data = array.data * multi = PyArray_MultiIterNew(3, array, oa, ob) # <<<<<<<<<<<<<< @@ -1925,7 +1935,7 @@ __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":232 + /* "mtrand.pyx":232 * array_data = array.data * multi = PyArray_MultiIterNew(3, array, oa, ob) * if (multi.size != PyArray_SIZE(array)): # <<<<<<<<<<<<<< @@ -1935,7 +1945,7 @@ __pyx_t_1 = (__pyx_v_multi->size != PyArray_SIZE(arrayObject)); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":233 + /* "mtrand.pyx":233 * multi = PyArray_MultiIterNew(3, array, oa, ob) * if (multi.size != PyArray_SIZE(array)): * raise ValueError("size is not compatible with inputs") # <<<<<<<<<<<<<< @@ -1957,7 +1967,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":234 + /* "mtrand.pyx":234 * if (multi.size != PyArray_SIZE(array)): * raise ValueError("size is not compatible with inputs") * for i from 0 <= i < multi.size: # <<<<<<<<<<<<<< @@ -1967,7 +1977,7 @@ __pyx_t_3 = __pyx_v_multi->size; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":235 + /* "mtrand.pyx":235 * raise ValueError("size is not compatible with inputs") * for i from 0 <= i < multi.size: * oa_data = PyArray_MultiIter_DATA(multi, 1) # <<<<<<<<<<<<<< @@ -1976,7 +1986,7 @@ */ __pyx_v_oa_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 1)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":236 + /* "mtrand.pyx":236 * for i from 0 <= i < multi.size: * oa_data = PyArray_MultiIter_DATA(multi, 1) * ob_data = PyArray_MultiIter_DATA(multi, 2) # <<<<<<<<<<<<<< @@ -1985,7 +1995,7 @@ */ __pyx_v_ob_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 2)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":237 + /* "mtrand.pyx":237 * oa_data = PyArray_MultiIter_DATA(multi, 1) * ob_data = PyArray_MultiIter_DATA(multi, 2) * array_data[i] = func(state, oa_data[0], ob_data[0]) # <<<<<<<<<<<<<< @@ -1994,7 +2004,7 @@ */ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state, (__pyx_v_oa_data[0]), (__pyx_v_ob_data[0])); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":238 + /* "mtrand.pyx":238 * ob_data = PyArray_MultiIter_DATA(multi, 2) * array_data[i] = func(state, oa_data[0], ob_data[0]) * PyArray_MultiIter_NEXTi(multi, 1) # <<<<<<<<<<<<<< @@ -2003,7 +2013,7 @@ */ PyArray_MultiIter_NEXTi(__pyx_v_multi, 1); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":239 + /* "mtrand.pyx":239 * array_data[i] = func(state, oa_data[0], ob_data[0]) * PyArray_MultiIter_NEXTi(multi, 1) * PyArray_MultiIter_NEXTi(multi, 2) # <<<<<<<<<<<<<< @@ -2015,7 +2025,7 @@ } __pyx_L3:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":240 + /* "mtrand.pyx":240 * PyArray_MultiIter_NEXTi(multi, 1) * PyArray_MultiIter_NEXTi(multi, 2) * return array # <<<<<<<<<<<<<< @@ -2046,7 +2056,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":242 +/* "mtrand.pyx":242 * return array * * cdef object cont3_array_sc(rk_state *state, rk_cont3 func, object size, double a, # <<<<<<<<<<<<<< @@ -2069,7 +2079,7 @@ __Pyx_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":250 + /* "mtrand.pyx":250 * cdef long i * * if size is None: # <<<<<<<<<<<<<< @@ -2079,7 +2089,7 @@ __pyx_t_1 = (__pyx_v_size == Py_None); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":251 + /* "mtrand.pyx":251 * * if size is None: * return func(state, a, b, c) # <<<<<<<<<<<<<< @@ -2096,7 +2106,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":253 + /* "mtrand.pyx":253 * return func(state, a, b, c) * else: * array = np.empty(size, np.float64) # <<<<<<<<<<<<<< @@ -2130,7 +2140,7 @@ arrayObject = ((PyArrayObject *)__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":254 + /* "mtrand.pyx":254 * else: * array = np.empty(size, np.float64) * length = PyArray_SIZE(array) # <<<<<<<<<<<<<< @@ -2139,7 +2149,7 @@ */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":255 + /* "mtrand.pyx":255 * array = np.empty(size, np.float64) * length = PyArray_SIZE(array) * array_data = array.data # <<<<<<<<<<<<<< @@ -2148,7 +2158,7 @@ */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":256 + /* "mtrand.pyx":256 * length = PyArray_SIZE(array) * array_data = array.data * for i from 0 <= i < length: # <<<<<<<<<<<<<< @@ -2158,7 +2168,7 @@ __pyx_t_5 = __pyx_v_length; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":257 + /* "mtrand.pyx":257 * array_data = array.data * for i from 0 <= i < length: * array_data[i] = func(state, a, b, c) # <<<<<<<<<<<<<< @@ -2168,7 +2178,7 @@ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state, __pyx_v_a, __pyx_v_b, __pyx_v_c); } - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":258 + /* "mtrand.pyx":258 * for i from 0 <= i < length: * array_data[i] = func(state, a, b, c) * return array # <<<<<<<<<<<<<< @@ -2198,7 +2208,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":260 +/* "mtrand.pyx":260 * return array * * cdef object cont3_array(rk_state *state, rk_cont3 func, object size, ndarray oa, # <<<<<<<<<<<<<< @@ -2228,7 +2238,7 @@ arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":272 + /* "mtrand.pyx":272 * cdef broadcast multi * * if size is None: # <<<<<<<<<<<<<< @@ -2238,7 +2248,7 @@ __pyx_t_1 = (__pyx_v_size == Py_None); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":273 + /* "mtrand.pyx":273 * * if size is None: * multi = PyArray_MultiIterNew(3, oa, ob, oc) # <<<<<<<<<<<<<< @@ -2252,7 +2262,7 @@ __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":274 + /* "mtrand.pyx":274 * if size is None: * multi = PyArray_MultiIterNew(3, oa, ob, oc) * array = PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_DOUBLE) # <<<<<<<<<<<<<< @@ -2266,7 +2276,7 @@ arrayObject = ((PyArrayObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":275 + /* "mtrand.pyx":275 * multi = PyArray_MultiIterNew(3, oa, ob, oc) * array = PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_DOUBLE) * array_data = array.data # <<<<<<<<<<<<<< @@ -2275,7 +2285,7 @@ */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":276 + /* "mtrand.pyx":276 * array = PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_DOUBLE) * array_data = array.data * for i from 0 <= i < multi.size: # <<<<<<<<<<<<<< @@ -2285,7 +2295,7 @@ __pyx_t_3 = __pyx_v_multi->size; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":277 + /* "mtrand.pyx":277 * array_data = array.data * for i from 0 <= i < multi.size: * oa_data = PyArray_MultiIter_DATA(multi, 0) # <<<<<<<<<<<<<< @@ -2294,7 +2304,7 @@ */ __pyx_v_oa_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 0)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":278 + /* "mtrand.pyx":278 * for i from 0 <= i < multi.size: * oa_data = PyArray_MultiIter_DATA(multi, 0) * ob_data = PyArray_MultiIter_DATA(multi, 1) # <<<<<<<<<<<<<< @@ -2303,7 +2313,7 @@ */ __pyx_v_ob_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 1)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":279 + /* "mtrand.pyx":279 * oa_data = PyArray_MultiIter_DATA(multi, 0) * ob_data = PyArray_MultiIter_DATA(multi, 1) * oc_data = PyArray_MultiIter_DATA(multi, 2) # <<<<<<<<<<<<<< @@ -2312,7 +2322,7 @@ */ __pyx_v_oc_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 2)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":280 + /* "mtrand.pyx":280 * ob_data = PyArray_MultiIter_DATA(multi, 1) * oc_data = PyArray_MultiIter_DATA(multi, 2) * array_data[i] = func(state, oa_data[0], ob_data[0], oc_data[0]) # <<<<<<<<<<<<<< @@ -2321,7 +2331,7 @@ */ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state, (__pyx_v_oa_data[0]), (__pyx_v_ob_data[0]), (__pyx_v_oc_data[0])); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":281 + /* "mtrand.pyx":281 * oc_data = PyArray_MultiIter_DATA(multi, 2) * array_data[i] = func(state, oa_data[0], ob_data[0], oc_data[0]) * PyArray_MultiIter_NEXT(multi) # <<<<<<<<<<<<<< @@ -2334,7 +2344,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":283 + /* "mtrand.pyx":283 * PyArray_MultiIter_NEXT(multi) * else: * array = np.empty(size, np.float64) # <<<<<<<<<<<<<< @@ -2368,7 +2378,7 @@ arrayObject = ((PyArrayObject *)__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":284 + /* "mtrand.pyx":284 * else: * array = np.empty(size, np.float64) * array_data = array.data # <<<<<<<<<<<<<< @@ -2377,7 +2387,7 @@ */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":286 + /* "mtrand.pyx":286 * array_data = array.data * multi = PyArray_MultiIterNew(4, array, oa, * ob, oc) # <<<<<<<<<<<<<< @@ -2391,7 +2401,7 @@ __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":287 + /* "mtrand.pyx":287 * multi = PyArray_MultiIterNew(4, array, oa, * ob, oc) * if (multi.size != PyArray_SIZE(array)): # <<<<<<<<<<<<<< @@ -2401,7 +2411,7 @@ __pyx_t_1 = (__pyx_v_multi->size != PyArray_SIZE(arrayObject)); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":288 + /* "mtrand.pyx":288 * ob, oc) * if (multi.size != PyArray_SIZE(array)): * raise ValueError("size is not compatible with inputs") # <<<<<<<<<<<<<< @@ -2423,7 +2433,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":289 + /* "mtrand.pyx":289 * if (multi.size != PyArray_SIZE(array)): * raise ValueError("size is not compatible with inputs") * for i from 0 <= i < multi.size: # <<<<<<<<<<<<<< @@ -2433,7 +2443,7 @@ __pyx_t_3 = __pyx_v_multi->size; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":290 + /* "mtrand.pyx":290 * raise ValueError("size is not compatible with inputs") * for i from 0 <= i < multi.size: * oa_data = PyArray_MultiIter_DATA(multi, 1) # <<<<<<<<<<<<<< @@ -2442,7 +2452,7 @@ */ __pyx_v_oa_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 1)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":291 + /* "mtrand.pyx":291 * for i from 0 <= i < multi.size: * oa_data = PyArray_MultiIter_DATA(multi, 1) * ob_data = PyArray_MultiIter_DATA(multi, 2) # <<<<<<<<<<<<<< @@ -2451,7 +2461,7 @@ */ __pyx_v_ob_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 2)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":292 + /* "mtrand.pyx":292 * oa_data = PyArray_MultiIter_DATA(multi, 1) * ob_data = PyArray_MultiIter_DATA(multi, 2) * oc_data = PyArray_MultiIter_DATA(multi, 3) # <<<<<<<<<<<<<< @@ -2460,7 +2470,7 @@ */ __pyx_v_oc_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 3)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":293 + /* "mtrand.pyx":293 * ob_data = PyArray_MultiIter_DATA(multi, 2) * oc_data = PyArray_MultiIter_DATA(multi, 3) * array_data[i] = func(state, oa_data[0], ob_data[0], oc_data[0]) # <<<<<<<<<<<<<< @@ -2469,7 +2479,7 @@ */ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state, (__pyx_v_oa_data[0]), (__pyx_v_ob_data[0]), (__pyx_v_oc_data[0])); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":294 + /* "mtrand.pyx":294 * oc_data = PyArray_MultiIter_DATA(multi, 3) * array_data[i] = func(state, oa_data[0], ob_data[0], oc_data[0]) * PyArray_MultiIter_NEXT(multi) # <<<<<<<<<<<<<< @@ -2481,7 +2491,7 @@ } __pyx_L3:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":295 + /* "mtrand.pyx":295 * array_data[i] = func(state, oa_data[0], ob_data[0], oc_data[0]) * PyArray_MultiIter_NEXT(multi) * return array # <<<<<<<<<<<<<< @@ -2513,7 +2523,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":297 +/* "mtrand.pyx":297 * return array * * cdef object disc0_array(rk_state *state, rk_disc0 func, object size): # <<<<<<<<<<<<<< @@ -2536,7 +2546,7 @@ __Pyx_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":303 + /* "mtrand.pyx":303 * cdef long i * * if size is None: # <<<<<<<<<<<<<< @@ -2546,7 +2556,7 @@ __pyx_t_1 = (__pyx_v_size == Py_None); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":304 + /* "mtrand.pyx":304 * * if size is None: * return func(state) # <<<<<<<<<<<<<< @@ -2563,7 +2573,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":306 + /* "mtrand.pyx":306 * return func(state) * else: * array = np.empty(size, int) # <<<<<<<<<<<<<< @@ -2592,7 +2602,7 @@ arrayObject = ((PyArrayObject *)__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":307 + /* "mtrand.pyx":307 * else: * array = np.empty(size, int) * length = PyArray_SIZE(array) # <<<<<<<<<<<<<< @@ -2601,7 +2611,7 @@ */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":308 + /* "mtrand.pyx":308 * array = np.empty(size, int) * length = PyArray_SIZE(array) * array_data = array.data # <<<<<<<<<<<<<< @@ -2610,7 +2620,7 @@ */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":309 + /* "mtrand.pyx":309 * length = PyArray_SIZE(array) * array_data = array.data * for i from 0 <= i < length: # <<<<<<<<<<<<<< @@ -2620,7 +2630,7 @@ __pyx_t_5 = __pyx_v_length; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":310 + /* "mtrand.pyx":310 * array_data = array.data * for i from 0 <= i < length: * array_data[i] = func(state) # <<<<<<<<<<<<<< @@ -2630,7 +2640,7 @@ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state); } - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":311 + /* "mtrand.pyx":311 * for i from 0 <= i < length: * array_data[i] = func(state) * return array # <<<<<<<<<<<<<< @@ -2660,7 +2670,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":313 +/* "mtrand.pyx":313 * return array * * cdef object discnp_array_sc(rk_state *state, rk_discnp func, object size, long n, double p): # <<<<<<<<<<<<<< @@ -2683,7 +2693,7 @@ __Pyx_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":319 + /* "mtrand.pyx":319 * cdef long i * * if size is None: # <<<<<<<<<<<<<< @@ -2693,7 +2703,7 @@ __pyx_t_1 = (__pyx_v_size == Py_None); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":320 + /* "mtrand.pyx":320 * * if size is None: * return func(state, n, p) # <<<<<<<<<<<<<< @@ -2710,7 +2720,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":322 + /* "mtrand.pyx":322 * return func(state, n, p) * else: * array = np.empty(size, int) # <<<<<<<<<<<<<< @@ -2739,7 +2749,7 @@ arrayObject = ((PyArrayObject *)__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":323 + /* "mtrand.pyx":323 * else: * array = np.empty(size, int) * length = PyArray_SIZE(array) # <<<<<<<<<<<<<< @@ -2748,7 +2758,7 @@ */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":324 + /* "mtrand.pyx":324 * array = np.empty(size, int) * length = PyArray_SIZE(array) * array_data = array.data # <<<<<<<<<<<<<< @@ -2757,7 +2767,7 @@ */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":325 + /* "mtrand.pyx":325 * length = PyArray_SIZE(array) * array_data = array.data * for i from 0 <= i < length: # <<<<<<<<<<<<<< @@ -2767,7 +2777,7 @@ __pyx_t_5 = __pyx_v_length; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":326 + /* "mtrand.pyx":326 * array_data = array.data * for i from 0 <= i < length: * array_data[i] = func(state, n, p) # <<<<<<<<<<<<<< @@ -2777,7 +2787,7 @@ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state, __pyx_v_n, __pyx_v_p); } - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":327 + /* "mtrand.pyx":327 * for i from 0 <= i < length: * array_data[i] = func(state, n, p) * return array # <<<<<<<<<<<<<< @@ -2807,7 +2817,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":329 +/* "mtrand.pyx":329 * return array * * cdef object discnp_array(rk_state *state, rk_discnp func, object size, ndarray on, ndarray op): # <<<<<<<<<<<<<< @@ -2835,7 +2845,7 @@ arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":338 + /* "mtrand.pyx":338 * cdef broadcast multi * * if size is None: # <<<<<<<<<<<<<< @@ -2845,7 +2855,7 @@ __pyx_t_1 = (__pyx_v_size == Py_None); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":339 + /* "mtrand.pyx":339 * * if size is None: * multi = PyArray_MultiIterNew(2, on, op) # <<<<<<<<<<<<<< @@ -2859,7 +2869,7 @@ __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":340 + /* "mtrand.pyx":340 * if size is None: * multi = PyArray_MultiIterNew(2, on, op) * array = PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_LONG) # <<<<<<<<<<<<<< @@ -2873,7 +2883,7 @@ arrayObject = ((PyArrayObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":341 + /* "mtrand.pyx":341 * multi = PyArray_MultiIterNew(2, on, op) * array = PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_LONG) * array_data = array.data # <<<<<<<<<<<<<< @@ -2882,7 +2892,7 @@ */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":342 + /* "mtrand.pyx":342 * array = PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_LONG) * array_data = array.data * for i from 0 <= i < multi.size: # <<<<<<<<<<<<<< @@ -2892,7 +2902,7 @@ __pyx_t_3 = __pyx_v_multi->size; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":343 + /* "mtrand.pyx":343 * array_data = array.data * for i from 0 <= i < multi.size: * on_data = PyArray_MultiIter_DATA(multi, 0) # <<<<<<<<<<<<<< @@ -2901,7 +2911,7 @@ */ __pyx_v_on_data = ((long *)PyArray_MultiIter_DATA(__pyx_v_multi, 0)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":344 + /* "mtrand.pyx":344 * for i from 0 <= i < multi.size: * on_data = PyArray_MultiIter_DATA(multi, 0) * op_data = PyArray_MultiIter_DATA(multi, 1) # <<<<<<<<<<<<<< @@ -2910,7 +2920,7 @@ */ __pyx_v_op_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 1)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":345 + /* "mtrand.pyx":345 * on_data = PyArray_MultiIter_DATA(multi, 0) * op_data = PyArray_MultiIter_DATA(multi, 1) * array_data[i] = func(state, on_data[0], op_data[0]) # <<<<<<<<<<<<<< @@ -2919,7 +2929,7 @@ */ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state, (__pyx_v_on_data[0]), (__pyx_v_op_data[0])); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":346 + /* "mtrand.pyx":346 * op_data = PyArray_MultiIter_DATA(multi, 1) * array_data[i] = func(state, on_data[0], op_data[0]) * PyArray_MultiIter_NEXT(multi) # <<<<<<<<<<<<<< @@ -2932,7 +2942,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":348 + /* "mtrand.pyx":348 * PyArray_MultiIter_NEXT(multi) * else: * array = np.empty(size, int) # <<<<<<<<<<<<<< @@ -2961,7 +2971,7 @@ arrayObject = ((PyArrayObject *)__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":349 + /* "mtrand.pyx":349 * else: * array = np.empty(size, int) * array_data = array.data # <<<<<<<<<<<<<< @@ -2970,7 +2980,7 @@ */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":350 + /* "mtrand.pyx":350 * array = np.empty(size, int) * array_data = array.data * multi = PyArray_MultiIterNew(3, array, on, op) # <<<<<<<<<<<<<< @@ -2984,7 +2994,7 @@ __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":351 + /* "mtrand.pyx":351 * array_data = array.data * multi = PyArray_MultiIterNew(3, array, on, op) * if (multi.size != PyArray_SIZE(array)): # <<<<<<<<<<<<<< @@ -2994,7 +3004,7 @@ __pyx_t_1 = (__pyx_v_multi->size != PyArray_SIZE(arrayObject)); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":352 + /* "mtrand.pyx":352 * multi = PyArray_MultiIterNew(3, array, on, op) * if (multi.size != PyArray_SIZE(array)): * raise ValueError("size is not compatible with inputs") # <<<<<<<<<<<<<< @@ -3016,7 +3026,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":353 + /* "mtrand.pyx":353 * if (multi.size != PyArray_SIZE(array)): * raise ValueError("size is not compatible with inputs") * for i from 0 <= i < multi.size: # <<<<<<<<<<<<<< @@ -3026,7 +3036,7 @@ __pyx_t_3 = __pyx_v_multi->size; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":354 + /* "mtrand.pyx":354 * raise ValueError("size is not compatible with inputs") * for i from 0 <= i < multi.size: * on_data = PyArray_MultiIter_DATA(multi, 1) # <<<<<<<<<<<<<< @@ -3035,7 +3045,7 @@ */ __pyx_v_on_data = ((long *)PyArray_MultiIter_DATA(__pyx_v_multi, 1)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":355 + /* "mtrand.pyx":355 * for i from 0 <= i < multi.size: * on_data = PyArray_MultiIter_DATA(multi, 1) * op_data = PyArray_MultiIter_DATA(multi, 2) # <<<<<<<<<<<<<< @@ -3044,7 +3054,7 @@ */ __pyx_v_op_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 2)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":356 + /* "mtrand.pyx":356 * on_data = PyArray_MultiIter_DATA(multi, 1) * op_data = PyArray_MultiIter_DATA(multi, 2) * array_data[i] = func(state, on_data[0], op_data[0]) # <<<<<<<<<<<<<< @@ -3053,7 +3063,7 @@ */ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state, (__pyx_v_on_data[0]), (__pyx_v_op_data[0])); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":357 + /* "mtrand.pyx":357 * op_data = PyArray_MultiIter_DATA(multi, 2) * array_data[i] = func(state, on_data[0], op_data[0]) * PyArray_MultiIter_NEXTi(multi, 1) # <<<<<<<<<<<<<< @@ -3062,7 +3072,7 @@ */ PyArray_MultiIter_NEXTi(__pyx_v_multi, 1); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":358 + /* "mtrand.pyx":358 * array_data[i] = func(state, on_data[0], op_data[0]) * PyArray_MultiIter_NEXTi(multi, 1) * PyArray_MultiIter_NEXTi(multi, 2) # <<<<<<<<<<<<<< @@ -3074,7 +3084,7 @@ } __pyx_L3:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":360 + /* "mtrand.pyx":360 * PyArray_MultiIter_NEXTi(multi, 2) * * return array # <<<<<<<<<<<<<< @@ -3105,7 +3115,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":362 +/* "mtrand.pyx":362 * return array * * cdef object discdd_array_sc(rk_state *state, rk_discdd func, object size, double n, double p): # <<<<<<<<<<<<<< @@ -3128,7 +3138,7 @@ __Pyx_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":368 + /* "mtrand.pyx":368 * cdef long i * * if size is None: # <<<<<<<<<<<<<< @@ -3138,7 +3148,7 @@ __pyx_t_1 = (__pyx_v_size == Py_None); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":369 + /* "mtrand.pyx":369 * * if size is None: * return func(state, n, p) # <<<<<<<<<<<<<< @@ -3155,7 +3165,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":371 + /* "mtrand.pyx":371 * return func(state, n, p) * else: * array = np.empty(size, int) # <<<<<<<<<<<<<< @@ -3184,7 +3194,7 @@ arrayObject = ((PyArrayObject *)__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":372 + /* "mtrand.pyx":372 * else: * array = np.empty(size, int) * length = PyArray_SIZE(array) # <<<<<<<<<<<<<< @@ -3193,7 +3203,7 @@ */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":373 + /* "mtrand.pyx":373 * array = np.empty(size, int) * length = PyArray_SIZE(array) * array_data = array.data # <<<<<<<<<<<<<< @@ -3202,7 +3212,7 @@ */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":374 + /* "mtrand.pyx":374 * length = PyArray_SIZE(array) * array_data = array.data * for i from 0 <= i < length: # <<<<<<<<<<<<<< @@ -3212,7 +3222,7 @@ __pyx_t_5 = __pyx_v_length; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":375 + /* "mtrand.pyx":375 * array_data = array.data * for i from 0 <= i < length: * array_data[i] = func(state, n, p) # <<<<<<<<<<<<<< @@ -3222,7 +3232,7 @@ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state, __pyx_v_n, __pyx_v_p); } - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":376 + /* "mtrand.pyx":376 * for i from 0 <= i < length: * array_data[i] = func(state, n, p) * return array # <<<<<<<<<<<<<< @@ -3252,7 +3262,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":378 +/* "mtrand.pyx":378 * return array * * cdef object discdd_array(rk_state *state, rk_discdd func, object size, ndarray on, ndarray op): # <<<<<<<<<<<<<< @@ -3280,7 +3290,7 @@ arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":387 + /* "mtrand.pyx":387 * cdef broadcast multi * * if size is None: # <<<<<<<<<<<<<< @@ -3290,7 +3300,7 @@ __pyx_t_1 = (__pyx_v_size == Py_None); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":388 + /* "mtrand.pyx":388 * * if size is None: * multi = PyArray_MultiIterNew(2, on, op) # <<<<<<<<<<<<<< @@ -3304,7 +3314,7 @@ __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":389 + /* "mtrand.pyx":389 * if size is None: * multi = PyArray_MultiIterNew(2, on, op) * array = PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_LONG) # <<<<<<<<<<<<<< @@ -3318,7 +3328,7 @@ arrayObject = ((PyArrayObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":390 + /* "mtrand.pyx":390 * multi = PyArray_MultiIterNew(2, on, op) * array = PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_LONG) * array_data = array.data # <<<<<<<<<<<<<< @@ -3327,7 +3337,7 @@ */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":391 + /* "mtrand.pyx":391 * array = PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_LONG) * array_data = array.data * for i from 0 <= i < multi.size: # <<<<<<<<<<<<<< @@ -3337,7 +3347,7 @@ __pyx_t_3 = __pyx_v_multi->size; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":392 + /* "mtrand.pyx":392 * array_data = array.data * for i from 0 <= i < multi.size: * on_data = PyArray_MultiIter_DATA(multi, 0) # <<<<<<<<<<<<<< @@ -3346,7 +3356,7 @@ */ __pyx_v_on_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 0)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":393 + /* "mtrand.pyx":393 * for i from 0 <= i < multi.size: * on_data = PyArray_MultiIter_DATA(multi, 0) * op_data = PyArray_MultiIter_DATA(multi, 1) # <<<<<<<<<<<<<< @@ -3355,7 +3365,7 @@ */ __pyx_v_op_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 1)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":394 + /* "mtrand.pyx":394 * on_data = PyArray_MultiIter_DATA(multi, 0) * op_data = PyArray_MultiIter_DATA(multi, 1) * array_data[i] = func(state, on_data[0], op_data[0]) # <<<<<<<<<<<<<< @@ -3364,7 +3374,7 @@ */ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state, (__pyx_v_on_data[0]), (__pyx_v_op_data[0])); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":395 + /* "mtrand.pyx":395 * op_data = PyArray_MultiIter_DATA(multi, 1) * array_data[i] = func(state, on_data[0], op_data[0]) * PyArray_MultiIter_NEXT(multi) # <<<<<<<<<<<<<< @@ -3377,7 +3387,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":397 + /* "mtrand.pyx":397 * PyArray_MultiIter_NEXT(multi) * else: * array = np.empty(size, int) # <<<<<<<<<<<<<< @@ -3406,7 +3416,7 @@ arrayObject = ((PyArrayObject *)__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":398 + /* "mtrand.pyx":398 * else: * array = np.empty(size, int) * array_data = array.data # <<<<<<<<<<<<<< @@ -3415,7 +3425,7 @@ */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":399 + /* "mtrand.pyx":399 * array = np.empty(size, int) * array_data = array.data * multi = PyArray_MultiIterNew(3, array, on, op) # <<<<<<<<<<<<<< @@ -3429,7 +3439,7 @@ __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":400 + /* "mtrand.pyx":400 * array_data = array.data * multi = PyArray_MultiIterNew(3, array, on, op) * if (multi.size != PyArray_SIZE(array)): # <<<<<<<<<<<<<< @@ -3439,7 +3449,7 @@ __pyx_t_1 = (__pyx_v_multi->size != PyArray_SIZE(arrayObject)); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":401 + /* "mtrand.pyx":401 * multi = PyArray_MultiIterNew(3, array, on, op) * if (multi.size != PyArray_SIZE(array)): * raise ValueError("size is not compatible with inputs") # <<<<<<<<<<<<<< @@ -3461,7 +3471,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":402 + /* "mtrand.pyx":402 * if (multi.size != PyArray_SIZE(array)): * raise ValueError("size is not compatible with inputs") * for i from 0 <= i < multi.size: # <<<<<<<<<<<<<< @@ -3471,7 +3481,7 @@ __pyx_t_3 = __pyx_v_multi->size; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":403 + /* "mtrand.pyx":403 * raise ValueError("size is not compatible with inputs") * for i from 0 <= i < multi.size: * on_data = PyArray_MultiIter_DATA(multi, 1) # <<<<<<<<<<<<<< @@ -3480,7 +3490,7 @@ */ __pyx_v_on_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 1)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":404 + /* "mtrand.pyx":404 * for i from 0 <= i < multi.size: * on_data = PyArray_MultiIter_DATA(multi, 1) * op_data = PyArray_MultiIter_DATA(multi, 2) # <<<<<<<<<<<<<< @@ -3489,7 +3499,7 @@ */ __pyx_v_op_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 2)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":405 + /* "mtrand.pyx":405 * on_data = PyArray_MultiIter_DATA(multi, 1) * op_data = PyArray_MultiIter_DATA(multi, 2) * array_data[i] = func(state, on_data[0], op_data[0]) # <<<<<<<<<<<<<< @@ -3498,7 +3508,7 @@ */ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state, (__pyx_v_on_data[0]), (__pyx_v_op_data[0])); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":406 + /* "mtrand.pyx":406 * op_data = PyArray_MultiIter_DATA(multi, 2) * array_data[i] = func(state, on_data[0], op_data[0]) * PyArray_MultiIter_NEXTi(multi, 1) # <<<<<<<<<<<<<< @@ -3507,7 +3517,7 @@ */ PyArray_MultiIter_NEXTi(__pyx_v_multi, 1); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":407 + /* "mtrand.pyx":407 * array_data[i] = func(state, on_data[0], op_data[0]) * PyArray_MultiIter_NEXTi(multi, 1) * PyArray_MultiIter_NEXTi(multi, 2) # <<<<<<<<<<<<<< @@ -3519,7 +3529,7 @@ } __pyx_L3:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":409 + /* "mtrand.pyx":409 * PyArray_MultiIter_NEXTi(multi, 2) * * return array # <<<<<<<<<<<<<< @@ -3550,7 +3560,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":411 +/* "mtrand.pyx":411 * return array * * cdef object discnmN_array_sc(rk_state *state, rk_discnmN func, object size, # <<<<<<<<<<<<<< @@ -3573,7 +3583,7 @@ __Pyx_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":418 + /* "mtrand.pyx":418 * cdef long i * * if size is None: # <<<<<<<<<<<<<< @@ -3583,7 +3593,7 @@ __pyx_t_1 = (__pyx_v_size == Py_None); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":419 + /* "mtrand.pyx":419 * * if size is None: * return func(state, n, m, N) # <<<<<<<<<<<<<< @@ -3600,7 +3610,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":421 + /* "mtrand.pyx":421 * return func(state, n, m, N) * else: * array = np.empty(size, int) # <<<<<<<<<<<<<< @@ -3629,7 +3639,7 @@ arrayObject = ((PyArrayObject *)__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":422 + /* "mtrand.pyx":422 * else: * array = np.empty(size, int) * length = PyArray_SIZE(array) # <<<<<<<<<<<<<< @@ -3638,7 +3648,7 @@ */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":423 + /* "mtrand.pyx":423 * array = np.empty(size, int) * length = PyArray_SIZE(array) * array_data = array.data # <<<<<<<<<<<<<< @@ -3647,7 +3657,7 @@ */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":424 + /* "mtrand.pyx":424 * length = PyArray_SIZE(array) * array_data = array.data * for i from 0 <= i < length: # <<<<<<<<<<<<<< @@ -3657,7 +3667,7 @@ __pyx_t_5 = __pyx_v_length; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":425 + /* "mtrand.pyx":425 * array_data = array.data * for i from 0 <= i < length: * array_data[i] = func(state, n, m, N) # <<<<<<<<<<<<<< @@ -3667,7 +3677,7 @@ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state, __pyx_v_n, __pyx_v_m, __pyx_v_N); } - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":426 + /* "mtrand.pyx":426 * for i from 0 <= i < length: * array_data[i] = func(state, n, m, N) * return array # <<<<<<<<<<<<<< @@ -3697,7 +3707,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":428 +/* "mtrand.pyx":428 * return array * * cdef object discnmN_array(rk_state *state, rk_discnmN func, object size, # <<<<<<<<<<<<<< @@ -3727,7 +3737,7 @@ arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":439 + /* "mtrand.pyx":439 * cdef broadcast multi * * if size is None: # <<<<<<<<<<<<<< @@ -3737,7 +3747,7 @@ __pyx_t_1 = (__pyx_v_size == Py_None); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":440 + /* "mtrand.pyx":440 * * if size is None: * multi = PyArray_MultiIterNew(3, on, om, oN) # <<<<<<<<<<<<<< @@ -3751,7 +3761,7 @@ __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":441 + /* "mtrand.pyx":441 * if size is None: * multi = PyArray_MultiIterNew(3, on, om, oN) * array = PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_LONG) # <<<<<<<<<<<<<< @@ -3765,7 +3775,7 @@ arrayObject = ((PyArrayObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":442 + /* "mtrand.pyx":442 * multi = PyArray_MultiIterNew(3, on, om, oN) * array = PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_LONG) * array_data = array.data # <<<<<<<<<<<<<< @@ -3774,7 +3784,7 @@ */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":443 + /* "mtrand.pyx":443 * array = PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_LONG) * array_data = array.data * for i from 0 <= i < multi.size: # <<<<<<<<<<<<<< @@ -3784,7 +3794,7 @@ __pyx_t_3 = __pyx_v_multi->size; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":444 + /* "mtrand.pyx":444 * array_data = array.data * for i from 0 <= i < multi.size: * on_data = PyArray_MultiIter_DATA(multi, 0) # <<<<<<<<<<<<<< @@ -3793,7 +3803,7 @@ */ __pyx_v_on_data = ((long *)PyArray_MultiIter_DATA(__pyx_v_multi, 0)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":445 + /* "mtrand.pyx":445 * for i from 0 <= i < multi.size: * on_data = PyArray_MultiIter_DATA(multi, 0) * om_data = PyArray_MultiIter_DATA(multi, 1) # <<<<<<<<<<<<<< @@ -3802,7 +3812,7 @@ */ __pyx_v_om_data = ((long *)PyArray_MultiIter_DATA(__pyx_v_multi, 1)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":446 + /* "mtrand.pyx":446 * on_data = PyArray_MultiIter_DATA(multi, 0) * om_data = PyArray_MultiIter_DATA(multi, 1) * oN_data = PyArray_MultiIter_DATA(multi, 2) # <<<<<<<<<<<<<< @@ -3811,7 +3821,7 @@ */ __pyx_v_oN_data = ((long *)PyArray_MultiIter_DATA(__pyx_v_multi, 2)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":447 + /* "mtrand.pyx":447 * om_data = PyArray_MultiIter_DATA(multi, 1) * oN_data = PyArray_MultiIter_DATA(multi, 2) * array_data[i] = func(state, on_data[0], om_data[0], oN_data[0]) # <<<<<<<<<<<<<< @@ -3820,7 +3830,7 @@ */ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state, (__pyx_v_on_data[0]), (__pyx_v_om_data[0]), (__pyx_v_oN_data[0])); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":448 + /* "mtrand.pyx":448 * oN_data = PyArray_MultiIter_DATA(multi, 2) * array_data[i] = func(state, on_data[0], om_data[0], oN_data[0]) * PyArray_MultiIter_NEXT(multi) # <<<<<<<<<<<<<< @@ -3833,7 +3843,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":450 + /* "mtrand.pyx":450 * PyArray_MultiIter_NEXT(multi) * else: * array = np.empty(size, int) # <<<<<<<<<<<<<< @@ -3862,7 +3872,7 @@ arrayObject = ((PyArrayObject *)__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":451 + /* "mtrand.pyx":451 * else: * array = np.empty(size, int) * array_data = array.data # <<<<<<<<<<<<<< @@ -3871,7 +3881,7 @@ */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":453 + /* "mtrand.pyx":453 * array_data = array.data * multi = PyArray_MultiIterNew(4, array, on, om, * oN) # <<<<<<<<<<<<<< @@ -3885,7 +3895,7 @@ __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":454 + /* "mtrand.pyx":454 * multi = PyArray_MultiIterNew(4, array, on, om, * oN) * if (multi.size != PyArray_SIZE(array)): # <<<<<<<<<<<<<< @@ -3895,7 +3905,7 @@ __pyx_t_1 = (__pyx_v_multi->size != PyArray_SIZE(arrayObject)); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":455 + /* "mtrand.pyx":455 * oN) * if (multi.size != PyArray_SIZE(array)): * raise ValueError("size is not compatible with inputs") # <<<<<<<<<<<<<< @@ -3917,7 +3927,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":456 + /* "mtrand.pyx":456 * if (multi.size != PyArray_SIZE(array)): * raise ValueError("size is not compatible with inputs") * for i from 0 <= i < multi.size: # <<<<<<<<<<<<<< @@ -3927,7 +3937,7 @@ __pyx_t_3 = __pyx_v_multi->size; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":457 + /* "mtrand.pyx":457 * raise ValueError("size is not compatible with inputs") * for i from 0 <= i < multi.size: * on_data = PyArray_MultiIter_DATA(multi, 1) # <<<<<<<<<<<<<< @@ -3936,7 +3946,7 @@ */ __pyx_v_on_data = ((long *)PyArray_MultiIter_DATA(__pyx_v_multi, 1)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":458 + /* "mtrand.pyx":458 * for i from 0 <= i < multi.size: * on_data = PyArray_MultiIter_DATA(multi, 1) * om_data = PyArray_MultiIter_DATA(multi, 2) # <<<<<<<<<<<<<< @@ -3945,7 +3955,7 @@ */ __pyx_v_om_data = ((long *)PyArray_MultiIter_DATA(__pyx_v_multi, 2)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":459 + /* "mtrand.pyx":459 * on_data = PyArray_MultiIter_DATA(multi, 1) * om_data = PyArray_MultiIter_DATA(multi, 2) * oN_data = PyArray_MultiIter_DATA(multi, 3) # <<<<<<<<<<<<<< @@ -3954,7 +3964,7 @@ */ __pyx_v_oN_data = ((long *)PyArray_MultiIter_DATA(__pyx_v_multi, 3)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":460 + /* "mtrand.pyx":460 * om_data = PyArray_MultiIter_DATA(multi, 2) * oN_data = PyArray_MultiIter_DATA(multi, 3) * array_data[i] = func(state, on_data[0], om_data[0], oN_data[0]) # <<<<<<<<<<<<<< @@ -3963,7 +3973,7 @@ */ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state, (__pyx_v_on_data[0]), (__pyx_v_om_data[0]), (__pyx_v_oN_data[0])); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":461 + /* "mtrand.pyx":461 * oN_data = PyArray_MultiIter_DATA(multi, 3) * array_data[i] = func(state, on_data[0], om_data[0], oN_data[0]) * PyArray_MultiIter_NEXT(multi) # <<<<<<<<<<<<<< @@ -3975,7 +3985,7 @@ } __pyx_L3:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":463 + /* "mtrand.pyx":463 * PyArray_MultiIter_NEXT(multi) * * return array # <<<<<<<<<<<<<< @@ -4007,7 +4017,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":465 +/* "mtrand.pyx":465 * return array * * cdef object discd_array_sc(rk_state *state, rk_discd func, object size, double a): # <<<<<<<<<<<<<< @@ -4030,7 +4040,7 @@ __Pyx_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":471 + /* "mtrand.pyx":471 * cdef long i * * if size is None: # <<<<<<<<<<<<<< @@ -4040,7 +4050,7 @@ __pyx_t_1 = (__pyx_v_size == Py_None); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":472 + /* "mtrand.pyx":472 * * if size is None: * return func(state, a) # <<<<<<<<<<<<<< @@ -4057,7 +4067,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":474 + /* "mtrand.pyx":474 * return func(state, a) * else: * array = np.empty(size, int) # <<<<<<<<<<<<<< @@ -4086,7 +4096,7 @@ arrayObject = ((PyArrayObject *)__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":475 + /* "mtrand.pyx":475 * else: * array = np.empty(size, int) * length = PyArray_SIZE(array) # <<<<<<<<<<<<<< @@ -4095,7 +4105,7 @@ */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":476 + /* "mtrand.pyx":476 * array = np.empty(size, int) * length = PyArray_SIZE(array) * array_data = array.data # <<<<<<<<<<<<<< @@ -4104,7 +4114,7 @@ */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":477 + /* "mtrand.pyx":477 * length = PyArray_SIZE(array) * array_data = array.data * for i from 0 <= i < length: # <<<<<<<<<<<<<< @@ -4114,7 +4124,7 @@ __pyx_t_5 = __pyx_v_length; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":478 + /* "mtrand.pyx":478 * array_data = array.data * for i from 0 <= i < length: * array_data[i] = func(state, a) # <<<<<<<<<<<<<< @@ -4124,7 +4134,7 @@ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state, __pyx_v_a); } - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":479 + /* "mtrand.pyx":479 * for i from 0 <= i < length: * array_data[i] = func(state, a) * return array # <<<<<<<<<<<<<< @@ -4154,7 +4164,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":481 +/* "mtrand.pyx":481 * return array * * cdef object discd_array(rk_state *state, rk_discd func, object size, ndarray oa): # <<<<<<<<<<<<<< @@ -4183,7 +4193,7 @@ __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_itera = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":490 + /* "mtrand.pyx":490 * cdef flatiter itera * * if size is None: # <<<<<<<<<<<<<< @@ -4193,7 +4203,7 @@ __pyx_t_1 = (__pyx_v_size == Py_None); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":491 + /* "mtrand.pyx":491 * * if size is None: * array = PyArray_SimpleNew(oa.nd, oa.dimensions, NPY_LONG) # <<<<<<<<<<<<<< @@ -4207,7 +4217,7 @@ arrayObject = ((PyArrayObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":492 + /* "mtrand.pyx":492 * if size is None: * array = PyArray_SimpleNew(oa.nd, oa.dimensions, NPY_LONG) * length = PyArray_SIZE(array) # <<<<<<<<<<<<<< @@ -4216,7 +4226,7 @@ */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":493 + /* "mtrand.pyx":493 * array = PyArray_SimpleNew(oa.nd, oa.dimensions, NPY_LONG) * length = PyArray_SIZE(array) * array_data = array.data # <<<<<<<<<<<<<< @@ -4225,7 +4235,7 @@ */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":494 + /* "mtrand.pyx":494 * length = PyArray_SIZE(array) * array_data = array.data * itera = PyArray_IterNew(oa) # <<<<<<<<<<<<<< @@ -4239,7 +4249,7 @@ __pyx_v_itera = ((PyArrayIterObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":495 + /* "mtrand.pyx":495 * array_data = array.data * itera = PyArray_IterNew(oa) * for i from 0 <= i < length: # <<<<<<<<<<<<<< @@ -4249,7 +4259,7 @@ __pyx_t_3 = __pyx_v_length; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":496 + /* "mtrand.pyx":496 * itera = PyArray_IterNew(oa) * for i from 0 <= i < length: * array_data[i] = func(state, ((itera.dataptr))[0]) # <<<<<<<<<<<<<< @@ -4258,7 +4268,7 @@ */ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state, (((double *)__pyx_v_itera->dataptr)[0])); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":497 + /* "mtrand.pyx":497 * for i from 0 <= i < length: * array_data[i] = func(state, ((itera.dataptr))[0]) * PyArray_ITER_NEXT(itera) # <<<<<<<<<<<<<< @@ -4271,7 +4281,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":499 + /* "mtrand.pyx":499 * PyArray_ITER_NEXT(itera) * else: * array = np.empty(size, int) # <<<<<<<<<<<<<< @@ -4300,7 +4310,7 @@ arrayObject = ((PyArrayObject *)__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":500 + /* "mtrand.pyx":500 * else: * array = np.empty(size, int) * array_data = array.data # <<<<<<<<<<<<<< @@ -4309,7 +4319,7 @@ */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":501 + /* "mtrand.pyx":501 * array = np.empty(size, int) * array_data = array.data * multi = PyArray_MultiIterNew(2, array, oa) # <<<<<<<<<<<<<< @@ -4323,7 +4333,7 @@ __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":502 + /* "mtrand.pyx":502 * array_data = array.data * multi = PyArray_MultiIterNew(2, array, oa) * if (multi.size != PyArray_SIZE(array)): # <<<<<<<<<<<<<< @@ -4333,7 +4343,7 @@ __pyx_t_1 = (__pyx_v_multi->size != PyArray_SIZE(arrayObject)); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":503 + /* "mtrand.pyx":503 * multi = PyArray_MultiIterNew(2, array, oa) * if (multi.size != PyArray_SIZE(array)): * raise ValueError("size is not compatible with inputs") # <<<<<<<<<<<<<< @@ -4355,7 +4365,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":504 + /* "mtrand.pyx":504 * if (multi.size != PyArray_SIZE(array)): * raise ValueError("size is not compatible with inputs") * for i from 0 <= i < multi.size: # <<<<<<<<<<<<<< @@ -4365,7 +4375,7 @@ __pyx_t_3 = __pyx_v_multi->size; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":505 + /* "mtrand.pyx":505 * raise ValueError("size is not compatible with inputs") * for i from 0 <= i < multi.size: * oa_data = PyArray_MultiIter_DATA(multi, 1) # <<<<<<<<<<<<<< @@ -4374,7 +4384,7 @@ */ __pyx_v_oa_data = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 1)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":506 + /* "mtrand.pyx":506 * for i from 0 <= i < multi.size: * oa_data = PyArray_MultiIter_DATA(multi, 1) * array_data[i] = func(state, oa_data[0]) # <<<<<<<<<<<<<< @@ -4383,7 +4393,7 @@ */ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state, (__pyx_v_oa_data[0])); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":507 + /* "mtrand.pyx":507 * oa_data = PyArray_MultiIter_DATA(multi, 1) * array_data[i] = func(state, oa_data[0]) * PyArray_MultiIter_NEXTi(multi, 1) # <<<<<<<<<<<<<< @@ -4395,7 +4405,7 @@ } __pyx_L3:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":508 + /* "mtrand.pyx":508 * array_data[i] = func(state, oa_data[0]) * PyArray_MultiIter_NEXTi(multi, 1) * return array # <<<<<<<<<<<<<< @@ -4426,7 +4436,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":510 +/* "mtrand.pyx":510 * return array * * cdef double kahan_sum(double *darr, long n): # <<<<<<<<<<<<<< @@ -4444,7 +4454,7 @@ long __pyx_t_1; __Pyx_RefNannySetupContext("kahan_sum"); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":513 + /* "mtrand.pyx":513 * cdef double c, y, t, sum * cdef long i * sum = darr[0] # <<<<<<<<<<<<<< @@ -4453,7 +4463,7 @@ */ __pyx_v_sum = (__pyx_v_darr[0]); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":514 + /* "mtrand.pyx":514 * cdef long i * sum = darr[0] * c = 0.0 # <<<<<<<<<<<<<< @@ -4462,7 +4472,7 @@ */ __pyx_v_c = 0.0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":515 + /* "mtrand.pyx":515 * sum = darr[0] * c = 0.0 * for i from 1 <= i < n: # <<<<<<<<<<<<<< @@ -4472,7 +4482,7 @@ __pyx_t_1 = __pyx_v_n; for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":516 + /* "mtrand.pyx":516 * c = 0.0 * for i from 1 <= i < n: * y = darr[i] - c # <<<<<<<<<<<<<< @@ -4481,7 +4491,7 @@ */ __pyx_v_y = ((__pyx_v_darr[__pyx_v_i]) - __pyx_v_c); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":517 + /* "mtrand.pyx":517 * for i from 1 <= i < n: * y = darr[i] - c * t = sum + y # <<<<<<<<<<<<<< @@ -4490,7 +4500,7 @@ */ __pyx_v_t = (__pyx_v_sum + __pyx_v_y); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":518 + /* "mtrand.pyx":518 * y = darr[i] - c * t = sum + y * c = (t-sum) - y # <<<<<<<<<<<<<< @@ -4499,7 +4509,7 @@ */ __pyx_v_c = ((__pyx_v_t - __pyx_v_sum) - __pyx_v_y); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":519 + /* "mtrand.pyx":519 * t = sum + y * c = (t-sum) - y * sum = t # <<<<<<<<<<<<<< @@ -4509,7 +4519,7 @@ __pyx_v_sum = __pyx_v_t; } - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":520 + /* "mtrand.pyx":520 * c = (t-sum) - y * sum = t * return sum # <<<<<<<<<<<<<< @@ -4525,7 +4535,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":557 +/* "mtrand.pyx":557 * cdef rk_state *internal_state * * def __init__(self, seed=None): # <<<<<<<<<<<<<< @@ -4578,7 +4588,7 @@ return -1; __pyx_L4_argument_unpacking_done:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":558 + /* "mtrand.pyx":558 * * def __init__(self, seed=None): * self.internal_state = PyMem_Malloc(sizeof(rk_state)) # <<<<<<<<<<<<<< @@ -4587,7 +4597,7 @@ */ ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state = ((rk_state *)PyMem_Malloc((sizeof(rk_state)))); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":560 + /* "mtrand.pyx":560 * self.internal_state = PyMem_Malloc(sizeof(rk_state)) * * self.seed(seed) # <<<<<<<<<<<<<< @@ -4620,7 +4630,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":562 +/* "mtrand.pyx":562 * self.seed(seed) * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -4634,7 +4644,7 @@ __Pyx_RefNannySetupContext("__dealloc__"); __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":563 + /* "mtrand.pyx":563 * * def __dealloc__(self): * if self.internal_state != NULL: # <<<<<<<<<<<<<< @@ -4644,7 +4654,7 @@ __pyx_t_1 = (((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state != NULL); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":564 + /* "mtrand.pyx":564 * def __dealloc__(self): * if self.internal_state != NULL: * PyMem_Free(self.internal_state) # <<<<<<<<<<<<<< @@ -4653,7 +4663,7 @@ */ PyMem_Free(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":565 + /* "mtrand.pyx":565 * if self.internal_state != NULL: * PyMem_Free(self.internal_state) * self.internal_state = NULL # <<<<<<<<<<<<<< @@ -4669,7 +4679,7 @@ __Pyx_RefNannyFinishContext(); } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":567 +/* "mtrand.pyx":567 * self.internal_state = NULL * * def seed(self, seed=None): # <<<<<<<<<<<<<< @@ -4686,8 +4696,8 @@ PyObject *__pyx_v_iseed; PyObject *__pyx_r = NULL; int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - unsigned long __pyx_t_3; + unsigned long __pyx_t_2; + PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__seed,0}; __Pyx_RefNannySetupContext("seed"); @@ -4731,7 +4741,7 @@ arrayObject_obj = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_iseed = Py_None; __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":588 + /* "mtrand.pyx":588 * cdef rk_error errcode * cdef ndarray obj "arrayObject_obj" * if seed is None: # <<<<<<<<<<<<<< @@ -4741,7 +4751,7 @@ __pyx_t_1 = (__pyx_v_seed == Py_None); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":589 + /* "mtrand.pyx":589 * cdef ndarray obj "arrayObject_obj" * if seed is None: * errcode = rk_randomseed(self.internal_state) # <<<<<<<<<<<<<< @@ -4752,48 +4762,45 @@ goto __pyx_L6; } - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":590 + /* "mtrand.pyx":590 * if seed is None: * errcode = rk_randomseed(self.internal_state) * elif type(seed) is int: # <<<<<<<<<<<<<< * rk_seed(seed, self.internal_state) * elif isinstance(seed, np.integer): */ - __pyx_t_2 = ((PyObject *)__Pyx_Type(__pyx_v_seed)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_1 = (__pyx_t_2 == ((PyObject*)&PyInt_Type)); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_seed)) == ((PyObject *)((PyObject*)&PyInt_Type))); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":591 + /* "mtrand.pyx":591 * errcode = rk_randomseed(self.internal_state) * elif type(seed) is int: * rk_seed(seed, self.internal_state) # <<<<<<<<<<<<<< * elif isinstance(seed, np.integer): * iseed = int(seed) */ - __pyx_t_3 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_seed); if (unlikely((__pyx_t_3 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - rk_seed(__pyx_t_3, ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); + __pyx_t_2 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_seed); if (unlikely((__pyx_t_2 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + rk_seed(__pyx_t_2, ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); goto __pyx_L6; } - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":592 + /* "mtrand.pyx":592 * elif type(seed) is int: * rk_seed(seed, self.internal_state) * elif isinstance(seed, np.integer): # <<<<<<<<<<<<<< * iseed = int(seed) * rk_seed(iseed, self.internal_state) */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__integer); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __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 = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__integer); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __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_t_1 = PyObject_IsInstance(__pyx_v_seed, __pyx_t_4); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":593 + /* "mtrand.pyx":593 * rk_seed(seed, self.internal_state) * elif isinstance(seed, np.integer): * iseed = int(seed) # <<<<<<<<<<<<<< @@ -4805,41 +4812,41 @@ __Pyx_INCREF(__pyx_v_seed); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_seed); __Pyx_GIVEREF(__pyx_v_seed); - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_iseed); - __pyx_v_iseed = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_v_iseed = __pyx_t_3; + __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":594 + /* "mtrand.pyx":594 * elif isinstance(seed, np.integer): * iseed = int(seed) * rk_seed(iseed, self.internal_state) # <<<<<<<<<<<<<< * else: * obj = PyArray_ContiguousFromObject(seed, NPY_LONG, 1, 1) */ - __pyx_t_3 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_iseed); if (unlikely((__pyx_t_3 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - rk_seed(__pyx_t_3, ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); + __pyx_t_2 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_iseed); if (unlikely((__pyx_t_2 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + rk_seed(__pyx_t_2, ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); goto __pyx_L6; } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":596 + /* "mtrand.pyx":596 * rk_seed(iseed, self.internal_state) * else: * obj = PyArray_ContiguousFromObject(seed, NPY_LONG, 1, 1) # <<<<<<<<<<<<<< * init_by_array(self.internal_state, (obj.data), * obj.dimensions[0]) */ - __pyx_t_2 = PyArray_ContiguousFromObject(__pyx_v_seed, NPY_LONG, 1, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2))); + __pyx_t_3 = PyArray_ContiguousFromObject(__pyx_v_seed, NPY_LONG, 1, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3))); __Pyx_DECREF(((PyObject *)arrayObject_obj)); - arrayObject_obj = ((PyArrayObject *)__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + arrayObject_obj = ((PyArrayObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":598 + /* "mtrand.pyx":598 * obj = PyArray_ContiguousFromObject(seed, NPY_LONG, 1, 1) * init_by_array(self.internal_state, (obj.data), * obj.dimensions[0]) # <<<<<<<<<<<<<< @@ -4853,7 +4860,7 @@ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("mtrand.RandomState.seed"); __pyx_r = NULL; @@ -4867,7 +4874,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":600 +/* "mtrand.pyx":600 * obj.dimensions[0]) * * def get_state(self): # <<<<<<<<<<<<<< @@ -4887,7 +4894,7 @@ __Pyx_RefNannySetupContext("get_state"); arrayObject_state = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":631 + /* "mtrand.pyx":631 * """ * cdef ndarray state "arrayObject_state" * state = np.empty(624, np.uint) # <<<<<<<<<<<<<< @@ -4921,7 +4928,7 @@ arrayObject_state = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":632 + /* "mtrand.pyx":632 * cdef ndarray state "arrayObject_state" * state = np.empty(624, np.uint) * memcpy((state.data), (self.internal_state.key), 624*sizeof(long)) # <<<<<<<<<<<<<< @@ -4930,7 +4937,7 @@ */ memcpy(((void *)arrayObject_state->data), ((void *)((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->key), (624 * (sizeof(long)))); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":633 + /* "mtrand.pyx":633 * state = np.empty(624, np.uint) * memcpy((state.data), (self.internal_state.key), 624*sizeof(long)) * state = np.asarray(state, np.uint32) # <<<<<<<<<<<<<< @@ -4964,7 +4971,7 @@ arrayObject_state = ((PyArrayObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":634 + /* "mtrand.pyx":634 * memcpy((state.data), (self.internal_state.key), 624*sizeof(long)) * state = np.asarray(state, np.uint32) * return ('MT19937', state, self.internal_state.pos, # <<<<<<<<<<<<<< @@ -4975,7 +4982,7 @@ __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":635 + /* "mtrand.pyx":635 * state = np.asarray(state, np.uint32) * return ('MT19937', state, self.internal_state.pos, * self.internal_state.has_gauss, self.internal_state.gauss) # <<<<<<<<<<<<<< @@ -5023,7 +5030,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":637 +/* "mtrand.pyx":637 * self.internal_state.has_gauss, self.internal_state.gauss) * * def set_state(self, state): # <<<<<<<<<<<<<< @@ -5058,7 +5065,7 @@ __pyx_v_has_gauss = Py_None; __Pyx_INCREF(Py_None); __pyx_v_cached_gaussian = Py_None; __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":686 + /* "mtrand.pyx":686 * cdef ndarray obj "arrayObject_obj" * cdef int pos * algorithm_name = state[0] # <<<<<<<<<<<<<< @@ -5071,7 +5078,7 @@ __pyx_v_algorithm_name = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":687 + /* "mtrand.pyx":687 * cdef int pos * algorithm_name = state[0] * if algorithm_name != 'MT19937': # <<<<<<<<<<<<<< @@ -5084,7 +5091,7 @@ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":688 + /* "mtrand.pyx":688 * algorithm_name = state[0] * if algorithm_name != 'MT19937': * raise ValueError("algorithm must be 'MT19937'") # <<<<<<<<<<<<<< @@ -5106,7 +5113,7 @@ } __pyx_L5:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":689 + /* "mtrand.pyx":689 * if algorithm_name != 'MT19937': * raise ValueError("algorithm must be 'MT19937'") * key, pos = state[1:3] # <<<<<<<<<<<<<< @@ -5144,7 +5151,7 @@ __pyx_v_pos = __pyx_t_5; } - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":690 + /* "mtrand.pyx":690 * raise ValueError("algorithm must be 'MT19937'") * key, pos = state[1:3] * if len(state) == 3: # <<<<<<<<<<<<<< @@ -5155,7 +5162,7 @@ __pyx_t_2 = (__pyx_t_7 == 3); if (__pyx_t_2) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":691 + /* "mtrand.pyx":691 * key, pos = state[1:3] * if len(state) == 3: * has_gauss = 0 # <<<<<<<<<<<<<< @@ -5166,7 +5173,7 @@ __Pyx_DECREF(__pyx_v_has_gauss); __pyx_v_has_gauss = __pyx_int_0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":692 + /* "mtrand.pyx":692 * if len(state) == 3: * has_gauss = 0 * cached_gaussian = 0.0 # <<<<<<<<<<<<<< @@ -5182,7 +5189,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":694 + /* "mtrand.pyx":694 * cached_gaussian = 0.0 * else: * has_gauss, cached_gaussian = state[3:5] # <<<<<<<<<<<<<< @@ -5222,7 +5229,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":695 + /* "mtrand.pyx":695 * else: * has_gauss, cached_gaussian = state[3:5] * try: # <<<<<<<<<<<<<< @@ -5237,7 +5244,7 @@ __Pyx_XGOTREF(__pyx_save_exc_tb); /*try:*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":696 + /* "mtrand.pyx":696 * has_gauss, cached_gaussian = state[3:5] * try: * obj = PyArray_ContiguousFromObject(key, NPY_ULONG, 1, 1) # <<<<<<<<<<<<<< @@ -5261,7 +5268,7 @@ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":697 + /* "mtrand.pyx":697 * try: * obj = PyArray_ContiguousFromObject(key, NPY_ULONG, 1, 1) * except TypeError: # <<<<<<<<<<<<<< @@ -5276,7 +5283,7 @@ __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_4); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":699 + /* "mtrand.pyx":699 * except TypeError: * # compatibility -- could be an older pickle * obj = PyArray_ContiguousFromObject(key, NPY_LONG, 1, 1) # <<<<<<<<<<<<<< @@ -5308,7 +5315,7 @@ __pyx_L14_try_end:; } - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":700 + /* "mtrand.pyx":700 * # compatibility -- could be an older pickle * obj = PyArray_ContiguousFromObject(key, NPY_LONG, 1, 1) * if obj.dimensions[0] != 624: # <<<<<<<<<<<<<< @@ -5318,7 +5325,7 @@ __pyx_t_2 = ((arrayObject_obj->dimensions[0]) != 624); if (__pyx_t_2) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":701 + /* "mtrand.pyx":701 * obj = PyArray_ContiguousFromObject(key, NPY_LONG, 1, 1) * if obj.dimensions[0] != 624: * raise ValueError("state must be 624 longs") # <<<<<<<<<<<<<< @@ -5340,7 +5347,7 @@ } __pyx_L17:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":702 + /* "mtrand.pyx":702 * if obj.dimensions[0] != 624: * raise ValueError("state must be 624 longs") * memcpy((self.internal_state.key), (obj.data), 624*sizeof(long)) # <<<<<<<<<<<<<< @@ -5349,7 +5356,7 @@ */ memcpy(((void *)((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->key), ((void *)arrayObject_obj->data), (624 * (sizeof(long)))); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":703 + /* "mtrand.pyx":703 * raise ValueError("state must be 624 longs") * memcpy((self.internal_state.key), (obj.data), 624*sizeof(long)) * self.internal_state.pos = pos # <<<<<<<<<<<<<< @@ -5358,7 +5365,7 @@ */ ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos = __pyx_v_pos; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":704 + /* "mtrand.pyx":704 * memcpy((self.internal_state.key), (obj.data), 624*sizeof(long)) * self.internal_state.pos = pos * self.internal_state.has_gauss = has_gauss # <<<<<<<<<<<<<< @@ -5368,14 +5375,14 @@ __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_has_gauss); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;} ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->has_gauss = __pyx_t_5; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":705 + /* "mtrand.pyx":705 * self.internal_state.pos = pos * self.internal_state.has_gauss = has_gauss * self.internal_state.gauss = cached_gaussian # <<<<<<<<<<<<<< * * # Pickling support: */ - __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_v_cached_gaussian); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_v_cached_gaussian); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->gauss = __pyx_t_8; __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -5400,7 +5407,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":708 +/* "mtrand.pyx":708 * * # Pickling support: * def __getstate__(self): # <<<<<<<<<<<<<< @@ -5415,7 +5422,7 @@ PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__getstate__"); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":709 + /* "mtrand.pyx":709 * # Pickling support: * def __getstate__(self): * return self.get_state() # <<<<<<<<<<<<<< @@ -5445,7 +5452,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":711 +/* "mtrand.pyx":711 * return self.get_state() * * def __setstate__(self, state): # <<<<<<<<<<<<<< @@ -5461,7 +5468,7 @@ PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("__setstate__"); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":712 + /* "mtrand.pyx":712 * * def __setstate__(self, state): * self.set_state(state) # <<<<<<<<<<<<<< @@ -5495,7 +5502,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":714 +/* "mtrand.pyx":714 * self.set_state(state) * * def __reduce__(self): # <<<<<<<<<<<<<< @@ -5511,7 +5518,7 @@ PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("__reduce__"); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":715 + /* "mtrand.pyx":715 * * def __reduce__(self): * return (np.random.__RandomState_ctor, (), self.get_state()) # <<<<<<<<<<<<<< @@ -5561,7 +5568,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":718 +/* "mtrand.pyx":718 * * # Basic distributions: * def random_sample(self, size=None): # <<<<<<<<<<<<<< @@ -5613,7 +5620,7 @@ return NULL; __pyx_L4_argument_unpacking_done:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":759 + /* "mtrand.pyx":759 * * """ * return cont0_array(self.internal_state, rk_double, size) # <<<<<<<<<<<<<< @@ -5639,7 +5646,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":761 +/* "mtrand.pyx":761 * return cont0_array(self.internal_state, rk_double, size) * * def tomaxint(self, size=None): # <<<<<<<<<<<<<< @@ -5691,7 +5698,7 @@ return NULL; __pyx_L4_argument_unpacking_done:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":787 + /* "mtrand.pyx":787 * * """ * return disc0_array(self.internal_state, rk_long, size) # <<<<<<<<<<<<<< @@ -5717,7 +5724,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":789 +/* "mtrand.pyx":789 * return disc0_array(self.internal_state, rk_long, size) * * def randint(self, low, high=None, size=None): # <<<<<<<<<<<<<< @@ -5804,7 +5811,7 @@ __Pyx_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":845 + /* "mtrand.pyx":845 * cdef long i * * if high is None: # <<<<<<<<<<<<<< @@ -5814,7 +5821,7 @@ __pyx_t_1 = (__pyx_v_high == Py_None); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":846 + /* "mtrand.pyx":846 * * if high is None: * lo = 0 # <<<<<<<<<<<<<< @@ -5823,7 +5830,7 @@ */ __pyx_v_lo = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":847 + /* "mtrand.pyx":847 * if high is None: * lo = 0 * hi = low # <<<<<<<<<<<<<< @@ -5836,7 +5843,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":849 + /* "mtrand.pyx":849 * hi = low * else: * lo = low # <<<<<<<<<<<<<< @@ -5846,7 +5853,7 @@ __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_v_low); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_lo = __pyx_t_2; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":850 + /* "mtrand.pyx":850 * else: * lo = low * hi = high # <<<<<<<<<<<<<< @@ -5858,7 +5865,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":852 + /* "mtrand.pyx":852 * hi = high * * diff = hi - lo - 1 # <<<<<<<<<<<<<< @@ -5867,7 +5874,7 @@ */ __pyx_v_diff = ((__pyx_v_hi - __pyx_v_lo) - 1); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":853 + /* "mtrand.pyx":853 * * diff = hi - lo - 1 * if diff < 0: # <<<<<<<<<<<<<< @@ -5877,7 +5884,7 @@ __pyx_t_1 = (__pyx_v_diff < 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":854 + /* "mtrand.pyx":854 * diff = hi - lo - 1 * if diff < 0: * raise ValueError("low >= high") # <<<<<<<<<<<<<< @@ -5899,7 +5906,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":856 + /* "mtrand.pyx":856 * raise ValueError("low >= high") * * if size is None: # <<<<<<<<<<<<<< @@ -5909,7 +5916,7 @@ __pyx_t_1 = (__pyx_v_size == Py_None); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":857 + /* "mtrand.pyx":857 * * if size is None: * return rk_interval(diff, self.internal_state) + lo # <<<<<<<<<<<<<< @@ -5926,7 +5933,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":859 + /* "mtrand.pyx":859 * return rk_interval(diff, self.internal_state) + lo * else: * array = np.empty(size, int) # <<<<<<<<<<<<<< @@ -5955,7 +5962,7 @@ arrayObject = ((PyArrayObject *)__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":860 + /* "mtrand.pyx":860 * else: * array = np.empty(size, int) * length = PyArray_SIZE(array) # <<<<<<<<<<<<<< @@ -5964,7 +5971,7 @@ */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":861 + /* "mtrand.pyx":861 * array = np.empty(size, int) * length = PyArray_SIZE(array) * array_data = array.data # <<<<<<<<<<<<<< @@ -5973,7 +5980,7 @@ */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":862 + /* "mtrand.pyx":862 * length = PyArray_SIZE(array) * array_data = array.data * for i from 0 <= i < length: # <<<<<<<<<<<<<< @@ -5983,7 +5990,7 @@ __pyx_t_2 = __pyx_v_length; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":863 + /* "mtrand.pyx":863 * array_data = array.data * for i from 0 <= i < length: * array_data[i] = lo + rk_interval(diff, self.internal_state) # <<<<<<<<<<<<<< @@ -5993,7 +6000,7 @@ (__pyx_v_array_data[__pyx_v_i]) = (__pyx_v_lo + ((long)rk_interval(__pyx_v_diff, ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state))); } - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":864 + /* "mtrand.pyx":864 * for i from 0 <= i < length: * array_data[i] = lo + rk_interval(diff, self.internal_state) * return array # <<<<<<<<<<<<<< @@ -6026,7 +6033,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":866 +/* "mtrand.pyx":866 * return array * * def bytes(self, unsigned int length): # <<<<<<<<<<<<<< @@ -6053,7 +6060,7 @@ __pyx_L4_argument_unpacking_done:; __pyx_v_bytestring = Py_None; __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":889 + /* "mtrand.pyx":889 * """ * cdef void *bytes * bytestring = empty_py_bytes(length, &bytes) # <<<<<<<<<<<<<< @@ -6066,7 +6073,7 @@ __pyx_v_bytestring = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":890 + /* "mtrand.pyx":890 * cdef void *bytes * bytestring = empty_py_bytes(length, &bytes) * rk_fill(bytes, length, self.internal_state) # <<<<<<<<<<<<<< @@ -6075,7 +6082,7 @@ */ rk_fill(__pyx_v_bytes, __pyx_v_length, ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":891 + /* "mtrand.pyx":891 * bytestring = empty_py_bytes(length, &bytes) * rk_fill(bytes, length, self.internal_state) * return bytestring # <<<<<<<<<<<<<< @@ -6100,7 +6107,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":893 +/* "mtrand.pyx":893 * return bytestring * * def uniform(self, low=0.0, high=1.0, size=None): # <<<<<<<<<<<<<< @@ -6191,7 +6198,7 @@ __pyx_v_odiff = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_temp = Py_None; __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":968 + /* "mtrand.pyx":968 * cdef object temp * * flow = PyFloat_AsDouble(low) # <<<<<<<<<<<<<< @@ -6200,7 +6207,7 @@ */ __pyx_v_flow = PyFloat_AsDouble(__pyx_v_low); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":969 + /* "mtrand.pyx":969 * * flow = PyFloat_AsDouble(low) * fhigh = PyFloat_AsDouble(high) # <<<<<<<<<<<<<< @@ -6209,7 +6216,7 @@ */ __pyx_v_fhigh = PyFloat_AsDouble(__pyx_v_high); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":970 + /* "mtrand.pyx":970 * flow = PyFloat_AsDouble(low) * fhigh = PyFloat_AsDouble(high) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -6219,7 +6226,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":971 + /* "mtrand.pyx":971 * fhigh = PyFloat_AsDouble(high) * if not PyErr_Occurred(): * return cont2_array_sc(self.internal_state, rk_uniform, size, flow, fhigh-flow) # <<<<<<<<<<<<<< @@ -6236,7 +6243,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":972 + /* "mtrand.pyx":972 * if not PyErr_Occurred(): * return cont2_array_sc(self.internal_state, rk_uniform, size, flow, fhigh-flow) * PyErr_Clear() # <<<<<<<<<<<<<< @@ -6245,7 +6252,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":973 + /* "mtrand.pyx":973 * return cont2_array_sc(self.internal_state, rk_uniform, size, flow, fhigh-flow) * PyErr_Clear() * olow = PyArray_FROM_OTF(low, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -6259,7 +6266,7 @@ __pyx_v_olow = ((PyArrayObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":974 + /* "mtrand.pyx":974 * PyErr_Clear() * olow = PyArray_FROM_OTF(low, NPY_DOUBLE, NPY_ALIGNED) * ohigh = PyArray_FROM_OTF(high, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -6273,7 +6280,7 @@ __pyx_v_ohigh = ((PyArrayObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":975 + /* "mtrand.pyx":975 * olow = PyArray_FROM_OTF(low, NPY_DOUBLE, NPY_ALIGNED) * ohigh = PyArray_FROM_OTF(high, NPY_DOUBLE, NPY_ALIGNED) * temp = np.subtract(ohigh, olow) # <<<<<<<<<<<<<< @@ -6301,7 +6308,7 @@ __pyx_v_temp = __pyx_t_4; __pyx_t_4 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":976 + /* "mtrand.pyx":976 * ohigh = PyArray_FROM_OTF(high, NPY_DOUBLE, NPY_ALIGNED) * temp = np.subtract(ohigh, olow) * Py_INCREF(temp) # needed to get around Pyrex's automatic reference-counting # <<<<<<<<<<<<<< @@ -6310,7 +6317,7 @@ */ Py_INCREF(__pyx_v_temp); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":978 + /* "mtrand.pyx":978 * Py_INCREF(temp) # needed to get around Pyrex's automatic reference-counting * # rules because EnsureArray steals a reference * odiff = PyArray_EnsureArray(temp) # <<<<<<<<<<<<<< @@ -6324,7 +6331,7 @@ __pyx_v_odiff = ((PyArrayObject *)__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":979 + /* "mtrand.pyx":979 * # rules because EnsureArray steals a reference * odiff = PyArray_EnsureArray(temp) * return cont2_array(self.internal_state, rk_uniform, size, olow, odiff) # <<<<<<<<<<<<<< @@ -6360,7 +6367,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":981 +/* "mtrand.pyx":981 * return cont2_array(self.internal_state, rk_uniform, size, olow, odiff) * * def rand(self, *args): # <<<<<<<<<<<<<< @@ -6384,7 +6391,7 @@ __pyx_v_args = __pyx_args; __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1019 + /* "mtrand.pyx":1019 * * """ * if len(args) == 0: # <<<<<<<<<<<<<< @@ -6395,7 +6402,7 @@ __pyx_t_2 = (__pyx_t_1 == 0); if (__pyx_t_2) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1020 + /* "mtrand.pyx":1020 * """ * if len(args) == 0: * return self.random_sample() # <<<<<<<<<<<<<< @@ -6415,7 +6422,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1022 + /* "mtrand.pyx":1022 * return self.random_sample() * else: * return self.random_sample(size=args) # <<<<<<<<<<<<<< @@ -6454,7 +6461,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1024 +/* "mtrand.pyx":1024 * return self.random_sample(size=args) * * def randn(self, *args): # <<<<<<<<<<<<<< @@ -6478,7 +6485,7 @@ __pyx_v_args = __pyx_args; __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1075 + /* "mtrand.pyx":1075 * * """ * if len(args) == 0: # <<<<<<<<<<<<<< @@ -6489,7 +6496,7 @@ __pyx_t_2 = (__pyx_t_1 == 0); if (__pyx_t_2) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1076 + /* "mtrand.pyx":1076 * """ * if len(args) == 0: * return self.standard_normal() # <<<<<<<<<<<<<< @@ -6509,7 +6516,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1078 + /* "mtrand.pyx":1078 * return self.standard_normal() * else: * return self.standard_normal(args) # <<<<<<<<<<<<<< @@ -6550,7 +6557,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1080 +/* "mtrand.pyx":1080 * return self.standard_normal(args) * * def random_integers(self, low, high=None, size=None): # <<<<<<<<<<<<<< @@ -6628,7 +6635,7 @@ __Pyx_INCREF(__pyx_v_high); __Pyx_INCREF(__pyx_v_size); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1152 + /* "mtrand.pyx":1152 * * """ * if high is None: # <<<<<<<<<<<<<< @@ -6638,7 +6645,7 @@ __pyx_t_1 = (__pyx_v_high == Py_None); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1153 + /* "mtrand.pyx":1153 * """ * if high is None: * high = low # <<<<<<<<<<<<<< @@ -6649,7 +6656,7 @@ __Pyx_DECREF(__pyx_v_high); __pyx_v_high = __pyx_v_low; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1154 + /* "mtrand.pyx":1154 * if high is None: * high = low * low = 1 # <<<<<<<<<<<<<< @@ -6663,7 +6670,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1155 + /* "mtrand.pyx":1155 * high = low * low = 1 * return self.randint(low, high+1, size) # <<<<<<<<<<<<<< @@ -6712,7 +6719,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1158 +/* "mtrand.pyx":1158 * * # Complicated, continuous distributions: * def standard_normal(self, size=None): # <<<<<<<<<<<<<< @@ -6764,7 +6771,7 @@ return NULL; __pyx_L4_argument_unpacking_done:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1188 + /* "mtrand.pyx":1188 * * """ * return cont0_array(self.internal_state, rk_gauss, size) # <<<<<<<<<<<<<< @@ -6790,7 +6797,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1190 +/* "mtrand.pyx":1190 * return cont0_array(self.internal_state, rk_gauss, size) * * def normal(self, loc=0.0, scale=1.0, size=None): # <<<<<<<<<<<<<< @@ -6878,7 +6885,7 @@ __pyx_v_oloc = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_oscale = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1275 + /* "mtrand.pyx":1275 * cdef double floc, fscale * * floc = PyFloat_AsDouble(loc) # <<<<<<<<<<<<<< @@ -6887,7 +6894,7 @@ */ __pyx_v_floc = PyFloat_AsDouble(__pyx_v_loc); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1276 + /* "mtrand.pyx":1276 * * floc = PyFloat_AsDouble(loc) * fscale = PyFloat_AsDouble(scale) # <<<<<<<<<<<<<< @@ -6896,7 +6903,7 @@ */ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1277 + /* "mtrand.pyx":1277 * floc = PyFloat_AsDouble(loc) * fscale = PyFloat_AsDouble(scale) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -6906,7 +6913,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1278 + /* "mtrand.pyx":1278 * fscale = PyFloat_AsDouble(scale) * if not PyErr_Occurred(): * if fscale <= 0: # <<<<<<<<<<<<<< @@ -6916,7 +6923,7 @@ __pyx_t_1 = (__pyx_v_fscale <= 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1279 + /* "mtrand.pyx":1279 * if not PyErr_Occurred(): * if fscale <= 0: * raise ValueError("scale <= 0") # <<<<<<<<<<<<<< @@ -6938,7 +6945,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1280 + /* "mtrand.pyx":1280 * if fscale <= 0: * raise ValueError("scale <= 0") * return cont2_array_sc(self.internal_state, rk_normal, size, floc, fscale) # <<<<<<<<<<<<<< @@ -6955,7 +6962,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1282 + /* "mtrand.pyx":1282 * return cont2_array_sc(self.internal_state, rk_normal, size, floc, fscale) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -6964,7 +6971,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1284 + /* "mtrand.pyx":1284 * PyErr_Clear() * * oloc = PyArray_FROM_OTF(loc, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -6978,7 +6985,7 @@ __pyx_v_oloc = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1285 + /* "mtrand.pyx":1285 * * oloc = PyArray_FROM_OTF(loc, NPY_DOUBLE, NPY_ALIGNED) * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -6992,7 +6999,7 @@ __pyx_v_oscale = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1286 + /* "mtrand.pyx":1286 * oloc = PyArray_FROM_OTF(loc, NPY_DOUBLE, NPY_ALIGNED) * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(oscale, 0)): # <<<<<<<<<<<<<< @@ -7034,7 +7041,7 @@ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1287 + /* "mtrand.pyx":1287 * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(oscale, 0)): * raise ValueError("scale <= 0") # <<<<<<<<<<<<<< @@ -7056,7 +7063,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1288 + /* "mtrand.pyx":1288 * if np.any(np.less_equal(oscale, 0)): * raise ValueError("scale <= 0") * return cont2_array(self.internal_state, rk_normal, size, oloc, oscale) # <<<<<<<<<<<<<< @@ -7091,7 +7098,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1290 +/* "mtrand.pyx":1290 * return cont2_array(self.internal_state, rk_normal, size, oloc, oscale) * * def beta(self, a, b, size=None): # <<<<<<<<<<<<<< @@ -7177,7 +7184,7 @@ __pyx_v_oa = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_ob = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1330 + /* "mtrand.pyx":1330 * cdef double fa, fb * * fa = PyFloat_AsDouble(a) # <<<<<<<<<<<<<< @@ -7186,7 +7193,7 @@ */ __pyx_v_fa = PyFloat_AsDouble(__pyx_v_a); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1331 + /* "mtrand.pyx":1331 * * fa = PyFloat_AsDouble(a) * fb = PyFloat_AsDouble(b) # <<<<<<<<<<<<<< @@ -7195,7 +7202,7 @@ */ __pyx_v_fb = PyFloat_AsDouble(__pyx_v_b); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1332 + /* "mtrand.pyx":1332 * fa = PyFloat_AsDouble(a) * fb = PyFloat_AsDouble(b) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -7205,7 +7212,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1333 + /* "mtrand.pyx":1333 * fb = PyFloat_AsDouble(b) * if not PyErr_Occurred(): * if fa <= 0: # <<<<<<<<<<<<<< @@ -7215,7 +7222,7 @@ __pyx_t_1 = (__pyx_v_fa <= 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1334 + /* "mtrand.pyx":1334 * if not PyErr_Occurred(): * if fa <= 0: * raise ValueError("a <= 0") # <<<<<<<<<<<<<< @@ -7237,7 +7244,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1335 + /* "mtrand.pyx":1335 * if fa <= 0: * raise ValueError("a <= 0") * if fb <= 0: # <<<<<<<<<<<<<< @@ -7247,7 +7254,7 @@ __pyx_t_1 = (__pyx_v_fb <= 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1336 + /* "mtrand.pyx":1336 * raise ValueError("a <= 0") * if fb <= 0: * raise ValueError("b <= 0") # <<<<<<<<<<<<<< @@ -7269,7 +7276,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1337 + /* "mtrand.pyx":1337 * if fb <= 0: * raise ValueError("b <= 0") * return cont2_array_sc(self.internal_state, rk_beta, size, fa, fb) # <<<<<<<<<<<<<< @@ -7286,7 +7293,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1339 + /* "mtrand.pyx":1339 * return cont2_array_sc(self.internal_state, rk_beta, size, fa, fb) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -7295,7 +7302,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1341 + /* "mtrand.pyx":1341 * PyErr_Clear() * * oa = PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -7309,7 +7316,7 @@ __pyx_v_oa = ((PyArrayObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1342 + /* "mtrand.pyx":1342 * * oa = PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED) * ob = PyArray_FROM_OTF(b, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -7323,7 +7330,7 @@ __pyx_v_ob = ((PyArrayObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1343 + /* "mtrand.pyx":1343 * oa = PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED) * ob = PyArray_FROM_OTF(b, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(oa, 0)): # <<<<<<<<<<<<<< @@ -7365,7 +7372,7 @@ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1344 + /* "mtrand.pyx":1344 * ob = PyArray_FROM_OTF(b, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(oa, 0)): * raise ValueError("a <= 0") # <<<<<<<<<<<<<< @@ -7387,7 +7394,7 @@ } __pyx_L9:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1345 + /* "mtrand.pyx":1345 * if np.any(np.less_equal(oa, 0)): * raise ValueError("a <= 0") * if np.any(np.less_equal(ob, 0)): # <<<<<<<<<<<<<< @@ -7429,7 +7436,7 @@ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1346 + /* "mtrand.pyx":1346 * raise ValueError("a <= 0") * if np.any(np.less_equal(ob, 0)): * raise ValueError("b <= 0") # <<<<<<<<<<<<<< @@ -7451,7 +7458,7 @@ } __pyx_L10:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1347 + /* "mtrand.pyx":1347 * if np.any(np.less_equal(ob, 0)): * raise ValueError("b <= 0") * return cont2_array(self.internal_state, rk_beta, size, oa, ob) # <<<<<<<<<<<<<< @@ -7486,7 +7493,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1349 +/* "mtrand.pyx":1349 * return cont2_array(self.internal_state, rk_beta, size, oa, ob) * * def exponential(self, scale=1.0, size=None): # <<<<<<<<<<<<<< @@ -7559,7 +7566,7 @@ __Pyx_INCREF(__pyx_v_size); __pyx_v_oscale = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1390 + /* "mtrand.pyx":1390 * cdef double fscale * * fscale = PyFloat_AsDouble(scale) # <<<<<<<<<<<<<< @@ -7568,7 +7575,7 @@ */ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1391 + /* "mtrand.pyx":1391 * * fscale = PyFloat_AsDouble(scale) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -7578,7 +7585,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1392 + /* "mtrand.pyx":1392 * fscale = PyFloat_AsDouble(scale) * if not PyErr_Occurred(): * if fscale <= 0: # <<<<<<<<<<<<<< @@ -7588,7 +7595,7 @@ __pyx_t_1 = (__pyx_v_fscale <= 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1393 + /* "mtrand.pyx":1393 * if not PyErr_Occurred(): * if fscale <= 0: * raise ValueError("scale <= 0") # <<<<<<<<<<<<<< @@ -7610,7 +7617,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1394 + /* "mtrand.pyx":1394 * if fscale <= 0: * raise ValueError("scale <= 0") * return cont1_array_sc(self.internal_state, rk_exponential, size, fscale) # <<<<<<<<<<<<<< @@ -7627,7 +7634,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1396 + /* "mtrand.pyx":1396 * return cont1_array_sc(self.internal_state, rk_exponential, size, fscale) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -7636,7 +7643,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1398 + /* "mtrand.pyx":1398 * PyErr_Clear() * * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -7650,7 +7657,7 @@ __pyx_v_oscale = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1399 + /* "mtrand.pyx":1399 * * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(oscale, 0.0)): # <<<<<<<<<<<<<< @@ -7694,7 +7701,7 @@ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1400 + /* "mtrand.pyx":1400 * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(oscale, 0.0)): * raise ValueError("scale <= 0") # <<<<<<<<<<<<<< @@ -7716,7 +7723,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1401 + /* "mtrand.pyx":1401 * if np.any(np.less_equal(oscale, 0.0)): * raise ValueError("scale <= 0") * return cont1_array(self.internal_state, rk_exponential, size, oscale) # <<<<<<<<<<<<<< @@ -7749,7 +7756,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1403 +/* "mtrand.pyx":1403 * return cont1_array(self.internal_state, rk_exponential, size, oscale) * * def standard_exponential(self, size=None): # <<<<<<<<<<<<<< @@ -7801,7 +7808,7 @@ return NULL; __pyx_L4_argument_unpacking_done:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1429 + /* "mtrand.pyx":1429 * * """ * return cont0_array(self.internal_state, rk_standard_exponential, size) # <<<<<<<<<<<<<< @@ -7827,7 +7834,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1431 +/* "mtrand.pyx":1431 * return cont0_array(self.internal_state, rk_standard_exponential, size) * * def standard_gamma(self, shape, size=None): # <<<<<<<<<<<<<< @@ -7897,7 +7904,7 @@ __Pyx_INCREF(__pyx_v_size); __pyx_v_oshape = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1501 + /* "mtrand.pyx":1501 * cdef double fshape * * fshape = PyFloat_AsDouble(shape) # <<<<<<<<<<<<<< @@ -7906,7 +7913,7 @@ */ __pyx_v_fshape = PyFloat_AsDouble(__pyx_v_shape); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1502 + /* "mtrand.pyx":1502 * * fshape = PyFloat_AsDouble(shape) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -7916,7 +7923,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1503 + /* "mtrand.pyx":1503 * fshape = PyFloat_AsDouble(shape) * if not PyErr_Occurred(): * if fshape <= 0: # <<<<<<<<<<<<<< @@ -7926,7 +7933,7 @@ __pyx_t_1 = (__pyx_v_fshape <= 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1504 + /* "mtrand.pyx":1504 * if not PyErr_Occurred(): * if fshape <= 0: * raise ValueError("shape <= 0") # <<<<<<<<<<<<<< @@ -7948,7 +7955,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1505 + /* "mtrand.pyx":1505 * if fshape <= 0: * raise ValueError("shape <= 0") * return cont1_array_sc(self.internal_state, rk_standard_gamma, size, fshape) # <<<<<<<<<<<<<< @@ -7965,7 +7972,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1507 + /* "mtrand.pyx":1507 * return cont1_array_sc(self.internal_state, rk_standard_gamma, size, fshape) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -7974,7 +7981,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1508 + /* "mtrand.pyx":1508 * * PyErr_Clear() * oshape = PyArray_FROM_OTF(shape, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -7988,7 +7995,7 @@ __pyx_v_oshape = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1509 + /* "mtrand.pyx":1509 * PyErr_Clear() * oshape = PyArray_FROM_OTF(shape, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(oshape, 0.0)): # <<<<<<<<<<<<<< @@ -8032,7 +8039,7 @@ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1510 + /* "mtrand.pyx":1510 * oshape = PyArray_FROM_OTF(shape, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(oshape, 0.0)): * raise ValueError("shape <= 0") # <<<<<<<<<<<<<< @@ -8054,7 +8061,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1511 + /* "mtrand.pyx":1511 * if np.any(np.less_equal(oshape, 0.0)): * raise ValueError("shape <= 0") * return cont1_array(self.internal_state, rk_standard_gamma, size, oshape) # <<<<<<<<<<<<<< @@ -8087,7 +8094,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1513 +/* "mtrand.pyx":1513 * return cont1_array(self.internal_state, rk_standard_gamma, size, oshape) * * def gamma(self, shape, scale=1.0, size=None): # <<<<<<<<<<<<<< @@ -8172,7 +8179,7 @@ __pyx_v_oshape = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_oscale = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1586 + /* "mtrand.pyx":1586 * cdef double fshape, fscale * * fshape = PyFloat_AsDouble(shape) # <<<<<<<<<<<<<< @@ -8181,7 +8188,7 @@ */ __pyx_v_fshape = PyFloat_AsDouble(__pyx_v_shape); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1587 + /* "mtrand.pyx":1587 * * fshape = PyFloat_AsDouble(shape) * fscale = PyFloat_AsDouble(scale) # <<<<<<<<<<<<<< @@ -8190,7 +8197,7 @@ */ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1588 + /* "mtrand.pyx":1588 * fshape = PyFloat_AsDouble(shape) * fscale = PyFloat_AsDouble(scale) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -8200,7 +8207,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1589 + /* "mtrand.pyx":1589 * fscale = PyFloat_AsDouble(scale) * if not PyErr_Occurred(): * if fshape <= 0: # <<<<<<<<<<<<<< @@ -8210,7 +8217,7 @@ __pyx_t_1 = (__pyx_v_fshape <= 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1590 + /* "mtrand.pyx":1590 * if not PyErr_Occurred(): * if fshape <= 0: * raise ValueError("shape <= 0") # <<<<<<<<<<<<<< @@ -8232,7 +8239,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1591 + /* "mtrand.pyx":1591 * if fshape <= 0: * raise ValueError("shape <= 0") * if fscale <= 0: # <<<<<<<<<<<<<< @@ -8242,7 +8249,7 @@ __pyx_t_1 = (__pyx_v_fscale <= 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1592 + /* "mtrand.pyx":1592 * raise ValueError("shape <= 0") * if fscale <= 0: * raise ValueError("scale <= 0") # <<<<<<<<<<<<<< @@ -8264,7 +8271,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1593 + /* "mtrand.pyx":1593 * if fscale <= 0: * raise ValueError("scale <= 0") * return cont2_array_sc(self.internal_state, rk_gamma, size, fshape, fscale) # <<<<<<<<<<<<<< @@ -8281,7 +8288,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1595 + /* "mtrand.pyx":1595 * return cont2_array_sc(self.internal_state, rk_gamma, size, fshape, fscale) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -8290,7 +8297,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1596 + /* "mtrand.pyx":1596 * * PyErr_Clear() * oshape = PyArray_FROM_OTF(shape, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -8304,7 +8311,7 @@ __pyx_v_oshape = ((PyArrayObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1597 + /* "mtrand.pyx":1597 * PyErr_Clear() * oshape = PyArray_FROM_OTF(shape, NPY_DOUBLE, NPY_ALIGNED) * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -8318,7 +8325,7 @@ __pyx_v_oscale = ((PyArrayObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1598 + /* "mtrand.pyx":1598 * oshape = PyArray_FROM_OTF(shape, NPY_DOUBLE, NPY_ALIGNED) * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(oshape, 0.0)): # <<<<<<<<<<<<<< @@ -8362,7 +8369,7 @@ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1599 + /* "mtrand.pyx":1599 * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(oshape, 0.0)): * raise ValueError("shape <= 0") # <<<<<<<<<<<<<< @@ -8384,7 +8391,7 @@ } __pyx_L9:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1600 + /* "mtrand.pyx":1600 * if np.any(np.less_equal(oshape, 0.0)): * raise ValueError("shape <= 0") * if np.any(np.less_equal(oscale, 0.0)): # <<<<<<<<<<<<<< @@ -8428,7 +8435,7 @@ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1601 + /* "mtrand.pyx":1601 * raise ValueError("shape <= 0") * if np.any(np.less_equal(oscale, 0.0)): * raise ValueError("scale <= 0") # <<<<<<<<<<<<<< @@ -8450,7 +8457,7 @@ } __pyx_L10:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1602 + /* "mtrand.pyx":1602 * if np.any(np.less_equal(oscale, 0.0)): * raise ValueError("scale <= 0") * return cont2_array(self.internal_state, rk_gamma, size, oshape, oscale) # <<<<<<<<<<<<<< @@ -8485,7 +8492,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1604 +/* "mtrand.pyx":1604 * return cont2_array(self.internal_state, rk_gamma, size, oshape, oscale) * * def f(self, dfnum, dfden, size=None): # <<<<<<<<<<<<<< @@ -8571,7 +8578,7 @@ __pyx_v_odfnum = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_odfden = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1688 + /* "mtrand.pyx":1688 * cdef double fdfnum, fdfden * * fdfnum = PyFloat_AsDouble(dfnum) # <<<<<<<<<<<<<< @@ -8580,7 +8587,7 @@ */ __pyx_v_fdfnum = PyFloat_AsDouble(__pyx_v_dfnum); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1689 + /* "mtrand.pyx":1689 * * fdfnum = PyFloat_AsDouble(dfnum) * fdfden = PyFloat_AsDouble(dfden) # <<<<<<<<<<<<<< @@ -8589,7 +8596,7 @@ */ __pyx_v_fdfden = PyFloat_AsDouble(__pyx_v_dfden); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1690 + /* "mtrand.pyx":1690 * fdfnum = PyFloat_AsDouble(dfnum) * fdfden = PyFloat_AsDouble(dfden) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -8599,7 +8606,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1691 + /* "mtrand.pyx":1691 * fdfden = PyFloat_AsDouble(dfden) * if not PyErr_Occurred(): * if fdfnum <= 0: # <<<<<<<<<<<<<< @@ -8609,7 +8616,7 @@ __pyx_t_1 = (__pyx_v_fdfnum <= 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1692 + /* "mtrand.pyx":1692 * if not PyErr_Occurred(): * if fdfnum <= 0: * raise ValueError("shape <= 0") # <<<<<<<<<<<<<< @@ -8631,7 +8638,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1693 + /* "mtrand.pyx":1693 * if fdfnum <= 0: * raise ValueError("shape <= 0") * if fdfden <= 0: # <<<<<<<<<<<<<< @@ -8641,7 +8648,7 @@ __pyx_t_1 = (__pyx_v_fdfden <= 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1694 + /* "mtrand.pyx":1694 * raise ValueError("shape <= 0") * if fdfden <= 0: * raise ValueError("scale <= 0") # <<<<<<<<<<<<<< @@ -8663,7 +8670,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1695 + /* "mtrand.pyx":1695 * if fdfden <= 0: * raise ValueError("scale <= 0") * return cont2_array_sc(self.internal_state, rk_f, size, fdfnum, fdfden) # <<<<<<<<<<<<<< @@ -8680,7 +8687,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1697 + /* "mtrand.pyx":1697 * return cont2_array_sc(self.internal_state, rk_f, size, fdfnum, fdfden) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -8689,7 +8696,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1699 + /* "mtrand.pyx":1699 * PyErr_Clear() * * odfnum = PyArray_FROM_OTF(dfnum, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -8703,7 +8710,7 @@ __pyx_v_odfnum = ((PyArrayObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1700 + /* "mtrand.pyx":1700 * * odfnum = PyArray_FROM_OTF(dfnum, NPY_DOUBLE, NPY_ALIGNED) * odfden = PyArray_FROM_OTF(dfden, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -8717,7 +8724,7 @@ __pyx_v_odfden = ((PyArrayObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1701 + /* "mtrand.pyx":1701 * odfnum = PyArray_FROM_OTF(dfnum, NPY_DOUBLE, NPY_ALIGNED) * odfden = PyArray_FROM_OTF(dfden, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(odfnum, 0.0)): # <<<<<<<<<<<<<< @@ -8761,7 +8768,7 @@ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1702 + /* "mtrand.pyx":1702 * odfden = PyArray_FROM_OTF(dfden, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(odfnum, 0.0)): * raise ValueError("dfnum <= 0") # <<<<<<<<<<<<<< @@ -8783,7 +8790,7 @@ } __pyx_L9:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1703 + /* "mtrand.pyx":1703 * if np.any(np.less_equal(odfnum, 0.0)): * raise ValueError("dfnum <= 0") * if np.any(np.less_equal(odfden, 0.0)): # <<<<<<<<<<<<<< @@ -8827,7 +8834,7 @@ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1704 + /* "mtrand.pyx":1704 * raise ValueError("dfnum <= 0") * if np.any(np.less_equal(odfden, 0.0)): * raise ValueError("dfden <= 0") # <<<<<<<<<<<<<< @@ -8849,7 +8856,7 @@ } __pyx_L10:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1705 + /* "mtrand.pyx":1705 * if np.any(np.less_equal(odfden, 0.0)): * raise ValueError("dfden <= 0") * return cont2_array(self.internal_state, rk_f, size, odfnum, odfden) # <<<<<<<<<<<<<< @@ -8884,7 +8891,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1707 +/* "mtrand.pyx":1707 * return cont2_array(self.internal_state, rk_f, size, odfnum, odfden) * * def noncentral_f(self, dfnum, dfden, nonc, size=None): # <<<<<<<<<<<<<< @@ -8984,7 +8991,7 @@ __pyx_v_odfden = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_ononc = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1774 + /* "mtrand.pyx":1774 * cdef double fdfnum, fdfden, fnonc * * fdfnum = PyFloat_AsDouble(dfnum) # <<<<<<<<<<<<<< @@ -8993,7 +9000,7 @@ */ __pyx_v_fdfnum = PyFloat_AsDouble(__pyx_v_dfnum); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1775 + /* "mtrand.pyx":1775 * * fdfnum = PyFloat_AsDouble(dfnum) * fdfden = PyFloat_AsDouble(dfden) # <<<<<<<<<<<<<< @@ -9002,7 +9009,7 @@ */ __pyx_v_fdfden = PyFloat_AsDouble(__pyx_v_dfden); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1776 + /* "mtrand.pyx":1776 * fdfnum = PyFloat_AsDouble(dfnum) * fdfden = PyFloat_AsDouble(dfden) * fnonc = PyFloat_AsDouble(nonc) # <<<<<<<<<<<<<< @@ -9011,7 +9018,7 @@ */ __pyx_v_fnonc = PyFloat_AsDouble(__pyx_v_nonc); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1777 + /* "mtrand.pyx":1777 * fdfden = PyFloat_AsDouble(dfden) * fnonc = PyFloat_AsDouble(nonc) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -9021,7 +9028,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1778 + /* "mtrand.pyx":1778 * fnonc = PyFloat_AsDouble(nonc) * if not PyErr_Occurred(): * if fdfnum <= 1: # <<<<<<<<<<<<<< @@ -9031,7 +9038,7 @@ __pyx_t_1 = (__pyx_v_fdfnum <= 1); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1779 + /* "mtrand.pyx":1779 * if not PyErr_Occurred(): * if fdfnum <= 1: * raise ValueError("dfnum <= 1") # <<<<<<<<<<<<<< @@ -9053,7 +9060,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1780 + /* "mtrand.pyx":1780 * if fdfnum <= 1: * raise ValueError("dfnum <= 1") * if fdfden <= 0: # <<<<<<<<<<<<<< @@ -9063,7 +9070,7 @@ __pyx_t_1 = (__pyx_v_fdfden <= 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1781 + /* "mtrand.pyx":1781 * raise ValueError("dfnum <= 1") * if fdfden <= 0: * raise ValueError("dfden <= 0") # <<<<<<<<<<<<<< @@ -9085,7 +9092,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1782 + /* "mtrand.pyx":1782 * if fdfden <= 0: * raise ValueError("dfden <= 0") * if fnonc < 0: # <<<<<<<<<<<<<< @@ -9095,7 +9102,7 @@ __pyx_t_1 = (__pyx_v_fnonc < 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1783 + /* "mtrand.pyx":1783 * raise ValueError("dfden <= 0") * if fnonc < 0: * raise ValueError("nonc < 0") # <<<<<<<<<<<<<< @@ -9117,7 +9124,7 @@ } __pyx_L9:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1784 + /* "mtrand.pyx":1784 * if fnonc < 0: * raise ValueError("nonc < 0") * return cont3_array_sc(self.internal_state, rk_noncentral_f, size, # <<<<<<<<<<<<<< @@ -9126,7 +9133,7 @@ */ __Pyx_XDECREF(__pyx_r); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1785 + /* "mtrand.pyx":1785 * raise ValueError("nonc < 0") * return cont3_array_sc(self.internal_state, rk_noncentral_f, size, * fdfnum, fdfden, fnonc) # <<<<<<<<<<<<<< @@ -9142,7 +9149,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1787 + /* "mtrand.pyx":1787 * fdfnum, fdfden, fnonc) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -9151,7 +9158,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1789 + /* "mtrand.pyx":1789 * PyErr_Clear() * * odfnum = PyArray_FROM_OTF(dfnum, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -9165,7 +9172,7 @@ __pyx_v_odfnum = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1790 + /* "mtrand.pyx":1790 * * odfnum = PyArray_FROM_OTF(dfnum, NPY_DOUBLE, NPY_ALIGNED) * odfden = PyArray_FROM_OTF(dfden, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -9179,7 +9186,7 @@ __pyx_v_odfden = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1791 + /* "mtrand.pyx":1791 * odfnum = PyArray_FROM_OTF(dfnum, NPY_DOUBLE, NPY_ALIGNED) * odfden = PyArray_FROM_OTF(dfden, NPY_DOUBLE, NPY_ALIGNED) * ononc = PyArray_FROM_OTF(nonc, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -9193,7 +9200,7 @@ __pyx_v_ononc = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1793 + /* "mtrand.pyx":1793 * ononc = PyArray_FROM_OTF(nonc, NPY_DOUBLE, NPY_ALIGNED) * * if np.any(np.less_equal(odfnum, 1.0)): # <<<<<<<<<<<<<< @@ -9237,7 +9244,7 @@ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1794 + /* "mtrand.pyx":1794 * * if np.any(np.less_equal(odfnum, 1.0)): * raise ValueError("dfnum <= 1") # <<<<<<<<<<<<<< @@ -9259,7 +9266,7 @@ } __pyx_L10:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1795 + /* "mtrand.pyx":1795 * if np.any(np.less_equal(odfnum, 1.0)): * raise ValueError("dfnum <= 1") * if np.any(np.less_equal(odfden, 0.0)): # <<<<<<<<<<<<<< @@ -9303,7 +9310,7 @@ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1796 + /* "mtrand.pyx":1796 * raise ValueError("dfnum <= 1") * if np.any(np.less_equal(odfden, 0.0)): * raise ValueError("dfden <= 0") # <<<<<<<<<<<<<< @@ -9325,7 +9332,7 @@ } __pyx_L11:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1797 + /* "mtrand.pyx":1797 * if np.any(np.less_equal(odfden, 0.0)): * raise ValueError("dfden <= 0") * if np.any(np.less(ononc, 0.0)): # <<<<<<<<<<<<<< @@ -9369,7 +9376,7 @@ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1798 + /* "mtrand.pyx":1798 * raise ValueError("dfden <= 0") * if np.any(np.less(ononc, 0.0)): * raise ValueError("nonc < 0") # <<<<<<<<<<<<<< @@ -9391,7 +9398,7 @@ } __pyx_L12:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1799 + /* "mtrand.pyx":1799 * if np.any(np.less(ononc, 0.0)): * raise ValueError("nonc < 0") * return cont3_array(self.internal_state, rk_noncentral_f, size, odfnum, # <<<<<<<<<<<<<< @@ -9400,7 +9407,7 @@ */ __Pyx_XDECREF(__pyx_r); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1800 + /* "mtrand.pyx":1800 * raise ValueError("nonc < 0") * return cont3_array(self.internal_state, rk_noncentral_f, size, odfnum, * odfden, ononc) # <<<<<<<<<<<<<< @@ -9436,7 +9443,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1802 +/* "mtrand.pyx":1802 * odfden, ononc) * * def chisquare(self, df, size=None): # <<<<<<<<<<<<<< @@ -9506,7 +9513,7 @@ __Pyx_INCREF(__pyx_v_size); __pyx_v_odf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1869 + /* "mtrand.pyx":1869 * cdef double fdf * * fdf = PyFloat_AsDouble(df) # <<<<<<<<<<<<<< @@ -9515,7 +9522,7 @@ */ __pyx_v_fdf = PyFloat_AsDouble(__pyx_v_df); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1870 + /* "mtrand.pyx":1870 * * fdf = PyFloat_AsDouble(df) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -9525,7 +9532,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1871 + /* "mtrand.pyx":1871 * fdf = PyFloat_AsDouble(df) * if not PyErr_Occurred(): * if fdf <= 0: # <<<<<<<<<<<<<< @@ -9535,7 +9542,7 @@ __pyx_t_1 = (__pyx_v_fdf <= 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1872 + /* "mtrand.pyx":1872 * if not PyErr_Occurred(): * if fdf <= 0: * raise ValueError("df <= 0") # <<<<<<<<<<<<<< @@ -9557,7 +9564,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1873 + /* "mtrand.pyx":1873 * if fdf <= 0: * raise ValueError("df <= 0") * return cont1_array_sc(self.internal_state, rk_chisquare, size, fdf) # <<<<<<<<<<<<<< @@ -9574,7 +9581,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1875 + /* "mtrand.pyx":1875 * return cont1_array_sc(self.internal_state, rk_chisquare, size, fdf) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -9583,7 +9590,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1877 + /* "mtrand.pyx":1877 * PyErr_Clear() * * odf = PyArray_FROM_OTF(df, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -9597,7 +9604,7 @@ __pyx_v_odf = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1878 + /* "mtrand.pyx":1878 * * odf = PyArray_FROM_OTF(df, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(odf, 0.0)): # <<<<<<<<<<<<<< @@ -9641,7 +9648,7 @@ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1879 + /* "mtrand.pyx":1879 * odf = PyArray_FROM_OTF(df, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(odf, 0.0)): * raise ValueError("df <= 0") # <<<<<<<<<<<<<< @@ -9663,7 +9670,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1880 + /* "mtrand.pyx":1880 * if np.any(np.less_equal(odf, 0.0)): * raise ValueError("df <= 0") * return cont1_array(self.internal_state, rk_chisquare, size, odf) # <<<<<<<<<<<<<< @@ -9696,7 +9703,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1882 +/* "mtrand.pyx":1882 * return cont1_array(self.internal_state, rk_chisquare, size, odf) * * def noncentral_chisquare(self, df, nonc, size=None): # <<<<<<<<<<<<<< @@ -9782,7 +9789,7 @@ __pyx_v_odf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_ononc = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1953 + /* "mtrand.pyx":1953 * cdef ndarray odf, ononc * cdef double fdf, fnonc * fdf = PyFloat_AsDouble(df) # <<<<<<<<<<<<<< @@ -9791,7 +9798,7 @@ */ __pyx_v_fdf = PyFloat_AsDouble(__pyx_v_df); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1954 + /* "mtrand.pyx":1954 * cdef double fdf, fnonc * fdf = PyFloat_AsDouble(df) * fnonc = PyFloat_AsDouble(nonc) # <<<<<<<<<<<<<< @@ -9800,7 +9807,7 @@ */ __pyx_v_fnonc = PyFloat_AsDouble(__pyx_v_nonc); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1955 + /* "mtrand.pyx":1955 * fdf = PyFloat_AsDouble(df) * fnonc = PyFloat_AsDouble(nonc) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -9810,7 +9817,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1956 + /* "mtrand.pyx":1956 * fnonc = PyFloat_AsDouble(nonc) * if not PyErr_Occurred(): * if fdf <= 1: # <<<<<<<<<<<<<< @@ -9820,7 +9827,7 @@ __pyx_t_1 = (__pyx_v_fdf <= 1); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1957 + /* "mtrand.pyx":1957 * if not PyErr_Occurred(): * if fdf <= 1: * raise ValueError("df <= 0") # <<<<<<<<<<<<<< @@ -9842,7 +9849,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1958 + /* "mtrand.pyx":1958 * if fdf <= 1: * raise ValueError("df <= 0") * if fnonc <= 0: # <<<<<<<<<<<<<< @@ -9852,7 +9859,7 @@ __pyx_t_1 = (__pyx_v_fnonc <= 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1959 + /* "mtrand.pyx":1959 * raise ValueError("df <= 0") * if fnonc <= 0: * raise ValueError("nonc <= 0") # <<<<<<<<<<<<<< @@ -9874,7 +9881,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1960 + /* "mtrand.pyx":1960 * if fnonc <= 0: * raise ValueError("nonc <= 0") * return cont2_array_sc(self.internal_state, rk_noncentral_chisquare, # <<<<<<<<<<<<<< @@ -9883,7 +9890,7 @@ */ __Pyx_XDECREF(__pyx_r); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1961 + /* "mtrand.pyx":1961 * raise ValueError("nonc <= 0") * return cont2_array_sc(self.internal_state, rk_noncentral_chisquare, * size, fdf, fnonc) # <<<<<<<<<<<<<< @@ -9899,7 +9906,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1963 + /* "mtrand.pyx":1963 * size, fdf, fnonc) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -9908,7 +9915,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1965 + /* "mtrand.pyx":1965 * PyErr_Clear() * * odf = PyArray_FROM_OTF(df, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -9922,7 +9929,7 @@ __pyx_v_odf = ((PyArrayObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1966 + /* "mtrand.pyx":1966 * * odf = PyArray_FROM_OTF(df, NPY_DOUBLE, NPY_ALIGNED) * ononc = PyArray_FROM_OTF(nonc, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -9936,7 +9943,7 @@ __pyx_v_ononc = ((PyArrayObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1967 + /* "mtrand.pyx":1967 * odf = PyArray_FROM_OTF(df, NPY_DOUBLE, NPY_ALIGNED) * ononc = PyArray_FROM_OTF(nonc, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(odf, 0.0)): # <<<<<<<<<<<<<< @@ -9980,7 +9987,7 @@ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1968 + /* "mtrand.pyx":1968 * ononc = PyArray_FROM_OTF(nonc, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(odf, 0.0)): * raise ValueError("df <= 1") # <<<<<<<<<<<<<< @@ -10002,7 +10009,7 @@ } __pyx_L9:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1969 + /* "mtrand.pyx":1969 * if np.any(np.less_equal(odf, 0.0)): * raise ValueError("df <= 1") * if np.any(np.less_equal(ononc, 0.0)): # <<<<<<<<<<<<<< @@ -10046,7 +10053,7 @@ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1970 + /* "mtrand.pyx":1970 * raise ValueError("df <= 1") * if np.any(np.less_equal(ononc, 0.0)): * raise ValueError("nonc < 0") # <<<<<<<<<<<<<< @@ -10068,7 +10075,7 @@ } __pyx_L10:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1971 + /* "mtrand.pyx":1971 * if np.any(np.less_equal(ononc, 0.0)): * raise ValueError("nonc < 0") * return cont2_array(self.internal_state, rk_noncentral_chisquare, size, # <<<<<<<<<<<<<< @@ -10077,7 +10084,7 @@ */ __Pyx_XDECREF(__pyx_r); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1972 + /* "mtrand.pyx":1972 * raise ValueError("nonc < 0") * return cont2_array(self.internal_state, rk_noncentral_chisquare, size, * odf, ononc) # <<<<<<<<<<<<<< @@ -10111,7 +10118,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1974 +/* "mtrand.pyx":1974 * odf, ononc) * * def standard_cauchy(self, size=None): # <<<<<<<<<<<<<< @@ -10163,7 +10170,7 @@ return NULL; __pyx_L4_argument_unpacking_done:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2033 + /* "mtrand.pyx":2033 * * """ * return cont0_array(self.internal_state, rk_standard_cauchy, size) # <<<<<<<<<<<<<< @@ -10189,7 +10196,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2035 +/* "mtrand.pyx":2035 * return cont0_array(self.internal_state, rk_standard_cauchy, size) * * def standard_t(self, df, size=None): # <<<<<<<<<<<<<< @@ -10259,7 +10266,7 @@ __Pyx_INCREF(__pyx_v_size); __pyx_v_odf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2123 + /* "mtrand.pyx":2123 * cdef double fdf * * fdf = PyFloat_AsDouble(df) # <<<<<<<<<<<<<< @@ -10268,7 +10275,7 @@ */ __pyx_v_fdf = PyFloat_AsDouble(__pyx_v_df); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2124 + /* "mtrand.pyx":2124 * * fdf = PyFloat_AsDouble(df) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -10278,7 +10285,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2125 + /* "mtrand.pyx":2125 * fdf = PyFloat_AsDouble(df) * if not PyErr_Occurred(): * if fdf <= 0: # <<<<<<<<<<<<<< @@ -10288,7 +10295,7 @@ __pyx_t_1 = (__pyx_v_fdf <= 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2126 + /* "mtrand.pyx":2126 * if not PyErr_Occurred(): * if fdf <= 0: * raise ValueError("df <= 0") # <<<<<<<<<<<<<< @@ -10310,7 +10317,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2127 + /* "mtrand.pyx":2127 * if fdf <= 0: * raise ValueError("df <= 0") * return cont1_array_sc(self.internal_state, rk_standard_t, size, fdf) # <<<<<<<<<<<<<< @@ -10327,7 +10334,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2129 + /* "mtrand.pyx":2129 * return cont1_array_sc(self.internal_state, rk_standard_t, size, fdf) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -10336,7 +10343,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2131 + /* "mtrand.pyx":2131 * PyErr_Clear() * * odf = PyArray_FROM_OTF(df, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -10350,7 +10357,7 @@ __pyx_v_odf = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2132 + /* "mtrand.pyx":2132 * * odf = PyArray_FROM_OTF(df, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(odf, 0.0)): # <<<<<<<<<<<<<< @@ -10394,7 +10401,7 @@ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2133 + /* "mtrand.pyx":2133 * odf = PyArray_FROM_OTF(df, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(odf, 0.0)): * raise ValueError("df <= 0") # <<<<<<<<<<<<<< @@ -10416,7 +10423,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2134 + /* "mtrand.pyx":2134 * if np.any(np.less_equal(odf, 0.0)): * raise ValueError("df <= 0") * return cont1_array(self.internal_state, rk_standard_t, size, odf) # <<<<<<<<<<<<<< @@ -10449,7 +10456,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2136 +/* "mtrand.pyx":2136 * return cont1_array(self.internal_state, rk_standard_t, size, odf) * * def vonmises(self, mu, kappa, size=None): # <<<<<<<<<<<<<< @@ -10535,7 +10542,7 @@ __pyx_v_omu = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_okappa = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2216 + /* "mtrand.pyx":2216 * cdef double fmu, fkappa * * fmu = PyFloat_AsDouble(mu) # <<<<<<<<<<<<<< @@ -10544,7 +10551,7 @@ */ __pyx_v_fmu = PyFloat_AsDouble(__pyx_v_mu); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2217 + /* "mtrand.pyx":2217 * * fmu = PyFloat_AsDouble(mu) * fkappa = PyFloat_AsDouble(kappa) # <<<<<<<<<<<<<< @@ -10553,7 +10560,7 @@ */ __pyx_v_fkappa = PyFloat_AsDouble(__pyx_v_kappa); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2218 + /* "mtrand.pyx":2218 * fmu = PyFloat_AsDouble(mu) * fkappa = PyFloat_AsDouble(kappa) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -10563,7 +10570,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2219 + /* "mtrand.pyx":2219 * fkappa = PyFloat_AsDouble(kappa) * if not PyErr_Occurred(): * if fkappa < 0: # <<<<<<<<<<<<<< @@ -10573,7 +10580,7 @@ __pyx_t_1 = (__pyx_v_fkappa < 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2220 + /* "mtrand.pyx":2220 * if not PyErr_Occurred(): * if fkappa < 0: * raise ValueError("kappa < 0") # <<<<<<<<<<<<<< @@ -10595,7 +10602,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2221 + /* "mtrand.pyx":2221 * if fkappa < 0: * raise ValueError("kappa < 0") * return cont2_array_sc(self.internal_state, rk_vonmises, size, fmu, fkappa) # <<<<<<<<<<<<<< @@ -10612,7 +10619,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2223 + /* "mtrand.pyx":2223 * return cont2_array_sc(self.internal_state, rk_vonmises, size, fmu, fkappa) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -10621,7 +10628,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2225 + /* "mtrand.pyx":2225 * PyErr_Clear() * * omu = PyArray_FROM_OTF(mu, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -10635,7 +10642,7 @@ __pyx_v_omu = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2226 + /* "mtrand.pyx":2226 * * omu = PyArray_FROM_OTF(mu, NPY_DOUBLE, NPY_ALIGNED) * okappa = PyArray_FROM_OTF(kappa, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -10649,7 +10656,7 @@ __pyx_v_okappa = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2227 + /* "mtrand.pyx":2227 * omu = PyArray_FROM_OTF(mu, NPY_DOUBLE, NPY_ALIGNED) * okappa = PyArray_FROM_OTF(kappa, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less(okappa, 0.0)): # <<<<<<<<<<<<<< @@ -10693,7 +10700,7 @@ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2228 + /* "mtrand.pyx":2228 * okappa = PyArray_FROM_OTF(kappa, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less(okappa, 0.0)): * raise ValueError("kappa < 0") # <<<<<<<<<<<<<< @@ -10715,7 +10722,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2229 + /* "mtrand.pyx":2229 * if np.any(np.less(okappa, 0.0)): * raise ValueError("kappa < 0") * return cont2_array(self.internal_state, rk_vonmises, size, omu, okappa) # <<<<<<<<<<<<<< @@ -10750,7 +10757,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2231 +/* "mtrand.pyx":2231 * return cont2_array(self.internal_state, rk_vonmises, size, omu, okappa) * * def pareto(self, a, size=None): # <<<<<<<<<<<<<< @@ -10820,7 +10827,7 @@ __Pyx_INCREF(__pyx_v_size); __pyx_v_oa = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2307 + /* "mtrand.pyx":2307 * cdef double fa * * fa = PyFloat_AsDouble(a) # <<<<<<<<<<<<<< @@ -10829,7 +10836,7 @@ */ __pyx_v_fa = PyFloat_AsDouble(__pyx_v_a); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2308 + /* "mtrand.pyx":2308 * * fa = PyFloat_AsDouble(a) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -10839,7 +10846,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2309 + /* "mtrand.pyx":2309 * fa = PyFloat_AsDouble(a) * if not PyErr_Occurred(): * if fa <= 0: # <<<<<<<<<<<<<< @@ -10849,7 +10856,7 @@ __pyx_t_1 = (__pyx_v_fa <= 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2310 + /* "mtrand.pyx":2310 * if not PyErr_Occurred(): * if fa <= 0: * raise ValueError("a <= 0") # <<<<<<<<<<<<<< @@ -10871,7 +10878,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2311 + /* "mtrand.pyx":2311 * if fa <= 0: * raise ValueError("a <= 0") * return cont1_array_sc(self.internal_state, rk_pareto, size, fa) # <<<<<<<<<<<<<< @@ -10888,7 +10895,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2313 + /* "mtrand.pyx":2313 * return cont1_array_sc(self.internal_state, rk_pareto, size, fa) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -10897,7 +10904,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2315 + /* "mtrand.pyx":2315 * PyErr_Clear() * * oa = PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -10911,7 +10918,7 @@ __pyx_v_oa = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2316 + /* "mtrand.pyx":2316 * * oa = PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(oa, 0.0)): # <<<<<<<<<<<<<< @@ -10955,7 +10962,7 @@ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2317 + /* "mtrand.pyx":2317 * oa = PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(oa, 0.0)): * raise ValueError("a <= 0") # <<<<<<<<<<<<<< @@ -10977,7 +10984,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2318 + /* "mtrand.pyx":2318 * if np.any(np.less_equal(oa, 0.0)): * raise ValueError("a <= 0") * return cont1_array(self.internal_state, rk_pareto, size, oa) # <<<<<<<<<<<<<< @@ -11010,7 +11017,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2320 +/* "mtrand.pyx":2320 * return cont1_array(self.internal_state, rk_pareto, size, oa) * * def weibull(self, a, size=None): # <<<<<<<<<<<<<< @@ -11080,7 +11087,7 @@ __Pyx_INCREF(__pyx_v_size); __pyx_v_oa = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2407 + /* "mtrand.pyx":2407 * cdef double fa * * fa = PyFloat_AsDouble(a) # <<<<<<<<<<<<<< @@ -11089,7 +11096,7 @@ */ __pyx_v_fa = PyFloat_AsDouble(__pyx_v_a); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2408 + /* "mtrand.pyx":2408 * * fa = PyFloat_AsDouble(a) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -11099,7 +11106,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2409 + /* "mtrand.pyx":2409 * fa = PyFloat_AsDouble(a) * if not PyErr_Occurred(): * if fa <= 0: # <<<<<<<<<<<<<< @@ -11109,7 +11116,7 @@ __pyx_t_1 = (__pyx_v_fa <= 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2410 + /* "mtrand.pyx":2410 * if not PyErr_Occurred(): * if fa <= 0: * raise ValueError("a <= 0") # <<<<<<<<<<<<<< @@ -11131,7 +11138,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2411 + /* "mtrand.pyx":2411 * if fa <= 0: * raise ValueError("a <= 0") * return cont1_array_sc(self.internal_state, rk_weibull, size, fa) # <<<<<<<<<<<<<< @@ -11148,7 +11155,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2413 + /* "mtrand.pyx":2413 * return cont1_array_sc(self.internal_state, rk_weibull, size, fa) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -11157,7 +11164,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2415 + /* "mtrand.pyx":2415 * PyErr_Clear() * * oa = PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -11171,7 +11178,7 @@ __pyx_v_oa = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2416 + /* "mtrand.pyx":2416 * * oa = PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(oa, 0.0)): # <<<<<<<<<<<<<< @@ -11215,7 +11222,7 @@ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2417 + /* "mtrand.pyx":2417 * oa = PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(oa, 0.0)): * raise ValueError("a <= 0") # <<<<<<<<<<<<<< @@ -11237,7 +11244,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2418 + /* "mtrand.pyx":2418 * if np.any(np.less_equal(oa, 0.0)): * raise ValueError("a <= 0") * return cont1_array(self.internal_state, rk_weibull, size, oa) # <<<<<<<<<<<<<< @@ -11270,7 +11277,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2420 +/* "mtrand.pyx":2420 * return cont1_array(self.internal_state, rk_weibull, size, oa) * * def power(self, a, size=None): # <<<<<<<<<<<<<< @@ -11340,7 +11347,7 @@ __Pyx_INCREF(__pyx_v_size); __pyx_v_oa = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2516 + /* "mtrand.pyx":2516 * cdef double fa * * fa = PyFloat_AsDouble(a) # <<<<<<<<<<<<<< @@ -11349,7 +11356,7 @@ */ __pyx_v_fa = PyFloat_AsDouble(__pyx_v_a); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2517 + /* "mtrand.pyx":2517 * * fa = PyFloat_AsDouble(a) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -11359,7 +11366,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2518 + /* "mtrand.pyx":2518 * fa = PyFloat_AsDouble(a) * if not PyErr_Occurred(): * if fa <= 0: # <<<<<<<<<<<<<< @@ -11369,7 +11376,7 @@ __pyx_t_1 = (__pyx_v_fa <= 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2519 + /* "mtrand.pyx":2519 * if not PyErr_Occurred(): * if fa <= 0: * raise ValueError("a <= 0") # <<<<<<<<<<<<<< @@ -11391,7 +11398,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2520 + /* "mtrand.pyx":2520 * if fa <= 0: * raise ValueError("a <= 0") * return cont1_array_sc(self.internal_state, rk_power, size, fa) # <<<<<<<<<<<<<< @@ -11408,7 +11415,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2522 + /* "mtrand.pyx":2522 * return cont1_array_sc(self.internal_state, rk_power, size, fa) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -11417,7 +11424,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2524 + /* "mtrand.pyx":2524 * PyErr_Clear() * * oa = PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -11431,7 +11438,7 @@ __pyx_v_oa = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2525 + /* "mtrand.pyx":2525 * * oa = PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(oa, 0.0)): # <<<<<<<<<<<<<< @@ -11475,7 +11482,7 @@ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2526 + /* "mtrand.pyx":2526 * oa = PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(oa, 0.0)): * raise ValueError("a <= 0") # <<<<<<<<<<<<<< @@ -11497,7 +11504,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2527 + /* "mtrand.pyx":2527 * if np.any(np.less_equal(oa, 0.0)): * raise ValueError("a <= 0") * return cont1_array(self.internal_state, rk_power, size, oa) # <<<<<<<<<<<<<< @@ -11530,7 +11537,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2529 +/* "mtrand.pyx":2529 * return cont1_array(self.internal_state, rk_power, size, oa) * * def laplace(self, loc=0.0, scale=1.0, size=None): # <<<<<<<<<<<<<< @@ -11618,7 +11625,7 @@ __pyx_v_oloc = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_oscale = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2605 + /* "mtrand.pyx":2605 * cdef double floc, fscale * * floc = PyFloat_AsDouble(loc) # <<<<<<<<<<<<<< @@ -11627,7 +11634,7 @@ */ __pyx_v_floc = PyFloat_AsDouble(__pyx_v_loc); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2606 + /* "mtrand.pyx":2606 * * floc = PyFloat_AsDouble(loc) * fscale = PyFloat_AsDouble(scale) # <<<<<<<<<<<<<< @@ -11636,7 +11643,7 @@ */ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2607 + /* "mtrand.pyx":2607 * floc = PyFloat_AsDouble(loc) * fscale = PyFloat_AsDouble(scale) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -11646,7 +11653,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2608 + /* "mtrand.pyx":2608 * fscale = PyFloat_AsDouble(scale) * if not PyErr_Occurred(): * if fscale <= 0: # <<<<<<<<<<<<<< @@ -11656,7 +11663,7 @@ __pyx_t_1 = (__pyx_v_fscale <= 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2609 + /* "mtrand.pyx":2609 * if not PyErr_Occurred(): * if fscale <= 0: * raise ValueError("scale <= 0") # <<<<<<<<<<<<<< @@ -11678,7 +11685,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2610 + /* "mtrand.pyx":2610 * if fscale <= 0: * raise ValueError("scale <= 0") * return cont2_array_sc(self.internal_state, rk_laplace, size, floc, fscale) # <<<<<<<<<<<<<< @@ -11695,7 +11702,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2612 + /* "mtrand.pyx":2612 * return cont2_array_sc(self.internal_state, rk_laplace, size, floc, fscale) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -11704,7 +11711,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2613 + /* "mtrand.pyx":2613 * * PyErr_Clear() * oloc = PyArray_FROM_OTF(loc, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -11718,7 +11725,7 @@ __pyx_v_oloc = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2614 + /* "mtrand.pyx":2614 * PyErr_Clear() * oloc = PyArray_FROM_OTF(loc, NPY_DOUBLE, NPY_ALIGNED) * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -11732,7 +11739,7 @@ __pyx_v_oscale = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2615 + /* "mtrand.pyx":2615 * oloc = PyArray_FROM_OTF(loc, NPY_DOUBLE, NPY_ALIGNED) * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(oscale, 0.0)): # <<<<<<<<<<<<<< @@ -11776,7 +11783,7 @@ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2616 + /* "mtrand.pyx":2616 * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(oscale, 0.0)): * raise ValueError("scale <= 0") # <<<<<<<<<<<<<< @@ -11798,7 +11805,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2617 + /* "mtrand.pyx":2617 * if np.any(np.less_equal(oscale, 0.0)): * raise ValueError("scale <= 0") * return cont2_array(self.internal_state, rk_laplace, size, oloc, oscale) # <<<<<<<<<<<<<< @@ -11833,7 +11840,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2619 +/* "mtrand.pyx":2619 * return cont2_array(self.internal_state, rk_laplace, size, oloc, oscale) * * def gumbel(self, loc=0.0, scale=1.0, size=None): # <<<<<<<<<<<<<< @@ -11921,7 +11928,7 @@ __pyx_v_oloc = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_oscale = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2729 + /* "mtrand.pyx":2729 * cdef double floc, fscale * * floc = PyFloat_AsDouble(loc) # <<<<<<<<<<<<<< @@ -11930,7 +11937,7 @@ */ __pyx_v_floc = PyFloat_AsDouble(__pyx_v_loc); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2730 + /* "mtrand.pyx":2730 * * floc = PyFloat_AsDouble(loc) * fscale = PyFloat_AsDouble(scale) # <<<<<<<<<<<<<< @@ -11939,7 +11946,7 @@ */ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2731 + /* "mtrand.pyx":2731 * floc = PyFloat_AsDouble(loc) * fscale = PyFloat_AsDouble(scale) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -11949,7 +11956,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2732 + /* "mtrand.pyx":2732 * fscale = PyFloat_AsDouble(scale) * if not PyErr_Occurred(): * if fscale <= 0: # <<<<<<<<<<<<<< @@ -11959,7 +11966,7 @@ __pyx_t_1 = (__pyx_v_fscale <= 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2733 + /* "mtrand.pyx":2733 * if not PyErr_Occurred(): * if fscale <= 0: * raise ValueError("scale <= 0") # <<<<<<<<<<<<<< @@ -11981,7 +11988,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2734 + /* "mtrand.pyx":2734 * if fscale <= 0: * raise ValueError("scale <= 0") * return cont2_array_sc(self.internal_state, rk_gumbel, size, floc, fscale) # <<<<<<<<<<<<<< @@ -11998,7 +12005,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2736 + /* "mtrand.pyx":2736 * return cont2_array_sc(self.internal_state, rk_gumbel, size, floc, fscale) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -12007,7 +12014,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2737 + /* "mtrand.pyx":2737 * * PyErr_Clear() * oloc = PyArray_FROM_OTF(loc, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -12021,7 +12028,7 @@ __pyx_v_oloc = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2738 + /* "mtrand.pyx":2738 * PyErr_Clear() * oloc = PyArray_FROM_OTF(loc, NPY_DOUBLE, NPY_ALIGNED) * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -12035,7 +12042,7 @@ __pyx_v_oscale = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2739 + /* "mtrand.pyx":2739 * oloc = PyArray_FROM_OTF(loc, NPY_DOUBLE, NPY_ALIGNED) * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(oscale, 0.0)): # <<<<<<<<<<<<<< @@ -12079,7 +12086,7 @@ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2740 + /* "mtrand.pyx":2740 * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(oscale, 0.0)): * raise ValueError("scale <= 0") # <<<<<<<<<<<<<< @@ -12101,7 +12108,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2741 + /* "mtrand.pyx":2741 * if np.any(np.less_equal(oscale, 0.0)): * raise ValueError("scale <= 0") * return cont2_array(self.internal_state, rk_gumbel, size, oloc, oscale) # <<<<<<<<<<<<<< @@ -12136,7 +12143,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2743 +/* "mtrand.pyx":2743 * return cont2_array(self.internal_state, rk_gumbel, size, oloc, oscale) * * def logistic(self, loc=0.0, scale=1.0, size=None): # <<<<<<<<<<<<<< @@ -12224,7 +12231,7 @@ __pyx_v_oloc = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_oscale = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2817 + /* "mtrand.pyx":2817 * cdef double floc, fscale * * floc = PyFloat_AsDouble(loc) # <<<<<<<<<<<<<< @@ -12233,7 +12240,7 @@ */ __pyx_v_floc = PyFloat_AsDouble(__pyx_v_loc); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2818 + /* "mtrand.pyx":2818 * * floc = PyFloat_AsDouble(loc) * fscale = PyFloat_AsDouble(scale) # <<<<<<<<<<<<<< @@ -12242,7 +12249,7 @@ */ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2819 + /* "mtrand.pyx":2819 * floc = PyFloat_AsDouble(loc) * fscale = PyFloat_AsDouble(scale) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -12252,7 +12259,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2820 + /* "mtrand.pyx":2820 * fscale = PyFloat_AsDouble(scale) * if not PyErr_Occurred(): * if fscale <= 0: # <<<<<<<<<<<<<< @@ -12262,7 +12269,7 @@ __pyx_t_1 = (__pyx_v_fscale <= 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2821 + /* "mtrand.pyx":2821 * if not PyErr_Occurred(): * if fscale <= 0: * raise ValueError("scale <= 0") # <<<<<<<<<<<<<< @@ -12284,7 +12291,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2822 + /* "mtrand.pyx":2822 * if fscale <= 0: * raise ValueError("scale <= 0") * return cont2_array_sc(self.internal_state, rk_logistic, size, floc, fscale) # <<<<<<<<<<<<<< @@ -12301,7 +12308,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2824 + /* "mtrand.pyx":2824 * return cont2_array_sc(self.internal_state, rk_logistic, size, floc, fscale) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -12310,7 +12317,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2825 + /* "mtrand.pyx":2825 * * PyErr_Clear() * oloc = PyArray_FROM_OTF(loc, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -12324,7 +12331,7 @@ __pyx_v_oloc = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2826 + /* "mtrand.pyx":2826 * PyErr_Clear() * oloc = PyArray_FROM_OTF(loc, NPY_DOUBLE, NPY_ALIGNED) * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -12338,7 +12345,7 @@ __pyx_v_oscale = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2827 + /* "mtrand.pyx":2827 * oloc = PyArray_FROM_OTF(loc, NPY_DOUBLE, NPY_ALIGNED) * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(oscale, 0.0)): # <<<<<<<<<<<<<< @@ -12382,7 +12389,7 @@ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2828 + /* "mtrand.pyx":2828 * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(oscale, 0.0)): * raise ValueError("scale <= 0") # <<<<<<<<<<<<<< @@ -12404,7 +12411,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2829 + /* "mtrand.pyx":2829 * if np.any(np.less_equal(oscale, 0.0)): * raise ValueError("scale <= 0") * return cont2_array(self.internal_state, rk_logistic, size, oloc, oscale) # <<<<<<<<<<<<<< @@ -12439,7 +12446,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2831 +/* "mtrand.pyx":2831 * return cont2_array(self.internal_state, rk_logistic, size, oloc, oscale) * * def lognormal(self, mean=0.0, sigma=1.0, size=None): # <<<<<<<<<<<<<< @@ -12527,7 +12534,7 @@ __pyx_v_omean = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_osigma = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2946 + /* "mtrand.pyx":2946 * cdef double fmean, fsigma * * fmean = PyFloat_AsDouble(mean) # <<<<<<<<<<<<<< @@ -12536,7 +12543,7 @@ */ __pyx_v_fmean = PyFloat_AsDouble(__pyx_v_mean); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2947 + /* "mtrand.pyx":2947 * * fmean = PyFloat_AsDouble(mean) * fsigma = PyFloat_AsDouble(sigma) # <<<<<<<<<<<<<< @@ -12545,7 +12552,7 @@ */ __pyx_v_fsigma = PyFloat_AsDouble(__pyx_v_sigma); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2949 + /* "mtrand.pyx":2949 * fsigma = PyFloat_AsDouble(sigma) * * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -12555,7 +12562,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2950 + /* "mtrand.pyx":2950 * * if not PyErr_Occurred(): * if fsigma <= 0: # <<<<<<<<<<<<<< @@ -12565,7 +12572,7 @@ __pyx_t_1 = (__pyx_v_fsigma <= 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2951 + /* "mtrand.pyx":2951 * if not PyErr_Occurred(): * if fsigma <= 0: * raise ValueError("sigma <= 0") # <<<<<<<<<<<<<< @@ -12587,7 +12594,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2952 + /* "mtrand.pyx":2952 * if fsigma <= 0: * raise ValueError("sigma <= 0") * return cont2_array_sc(self.internal_state, rk_lognormal, size, fmean, fsigma) # <<<<<<<<<<<<<< @@ -12604,7 +12611,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2954 + /* "mtrand.pyx":2954 * return cont2_array_sc(self.internal_state, rk_lognormal, size, fmean, fsigma) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -12613,7 +12620,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2956 + /* "mtrand.pyx":2956 * PyErr_Clear() * * omean = PyArray_FROM_OTF(mean, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -12627,7 +12634,7 @@ __pyx_v_omean = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2957 + /* "mtrand.pyx":2957 * * omean = PyArray_FROM_OTF(mean, NPY_DOUBLE, NPY_ALIGNED) * osigma = PyArray_FROM_OTF(sigma, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -12641,7 +12648,7 @@ __pyx_v_osigma = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2958 + /* "mtrand.pyx":2958 * omean = PyArray_FROM_OTF(mean, NPY_DOUBLE, NPY_ALIGNED) * osigma = PyArray_FROM_OTF(sigma, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(osigma, 0.0)): # <<<<<<<<<<<<<< @@ -12685,7 +12692,7 @@ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2959 + /* "mtrand.pyx":2959 * osigma = PyArray_FROM_OTF(sigma, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(osigma, 0.0)): * raise ValueError("sigma <= 0.0") # <<<<<<<<<<<<<< @@ -12707,7 +12714,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2960 + /* "mtrand.pyx":2960 * if np.any(np.less_equal(osigma, 0.0)): * raise ValueError("sigma <= 0.0") * return cont2_array(self.internal_state, rk_lognormal, size, omean, osigma) # <<<<<<<<<<<<<< @@ -12742,7 +12749,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2962 +/* "mtrand.pyx":2962 * return cont2_array(self.internal_state, rk_lognormal, size, omean, osigma) * * def rayleigh(self, scale=1.0, size=None): # <<<<<<<<<<<<<< @@ -12815,7 +12822,7 @@ __Pyx_INCREF(__pyx_v_size); __pyx_v_oscale = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3020 + /* "mtrand.pyx":3020 * cdef double fscale * * fscale = PyFloat_AsDouble(scale) # <<<<<<<<<<<<<< @@ -12824,7 +12831,7 @@ */ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3022 + /* "mtrand.pyx":3022 * fscale = PyFloat_AsDouble(scale) * * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -12834,7 +12841,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3023 + /* "mtrand.pyx":3023 * * if not PyErr_Occurred(): * if fscale <= 0: # <<<<<<<<<<<<<< @@ -12844,7 +12851,7 @@ __pyx_t_1 = (__pyx_v_fscale <= 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3024 + /* "mtrand.pyx":3024 * if not PyErr_Occurred(): * if fscale <= 0: * raise ValueError("scale <= 0") # <<<<<<<<<<<<<< @@ -12866,7 +12873,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3025 + /* "mtrand.pyx":3025 * if fscale <= 0: * raise ValueError("scale <= 0") * return cont1_array_sc(self.internal_state, rk_rayleigh, size, fscale) # <<<<<<<<<<<<<< @@ -12883,7 +12890,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3027 + /* "mtrand.pyx":3027 * return cont1_array_sc(self.internal_state, rk_rayleigh, size, fscale) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -12892,7 +12899,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3029 + /* "mtrand.pyx":3029 * PyErr_Clear() * * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -12906,7 +12913,7 @@ __pyx_v_oscale = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3030 + /* "mtrand.pyx":3030 * * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(oscale, 0.0)): # <<<<<<<<<<<<<< @@ -12950,7 +12957,7 @@ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3031 + /* "mtrand.pyx":3031 * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(oscale, 0.0)): * raise ValueError("scale <= 0.0") # <<<<<<<<<<<<<< @@ -12972,7 +12979,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3032 + /* "mtrand.pyx":3032 * if np.any(np.less_equal(oscale, 0.0)): * raise ValueError("scale <= 0.0") * return cont1_array(self.internal_state, rk_rayleigh, size, oscale) # <<<<<<<<<<<<<< @@ -13005,7 +13012,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3034 +/* "mtrand.pyx":3034 * return cont1_array(self.internal_state, rk_rayleigh, size, oscale) * * def wald(self, mean, scale, size=None): # <<<<<<<<<<<<<< @@ -13091,7 +13098,7 @@ __pyx_v_omean = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_oscale = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3100 + /* "mtrand.pyx":3100 * cdef double fmean, fscale * * fmean = PyFloat_AsDouble(mean) # <<<<<<<<<<<<<< @@ -13100,7 +13107,7 @@ */ __pyx_v_fmean = PyFloat_AsDouble(__pyx_v_mean); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3101 + /* "mtrand.pyx":3101 * * fmean = PyFloat_AsDouble(mean) * fscale = PyFloat_AsDouble(scale) # <<<<<<<<<<<<<< @@ -13109,7 +13116,7 @@ */ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3102 + /* "mtrand.pyx":3102 * fmean = PyFloat_AsDouble(mean) * fscale = PyFloat_AsDouble(scale) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -13119,7 +13126,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3103 + /* "mtrand.pyx":3103 * fscale = PyFloat_AsDouble(scale) * if not PyErr_Occurred(): * if fmean <= 0: # <<<<<<<<<<<<<< @@ -13129,7 +13136,7 @@ __pyx_t_1 = (__pyx_v_fmean <= 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3104 + /* "mtrand.pyx":3104 * if not PyErr_Occurred(): * if fmean <= 0: * raise ValueError("mean <= 0") # <<<<<<<<<<<<<< @@ -13151,7 +13158,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3105 + /* "mtrand.pyx":3105 * if fmean <= 0: * raise ValueError("mean <= 0") * if fscale <= 0: # <<<<<<<<<<<<<< @@ -13161,7 +13168,7 @@ __pyx_t_1 = (__pyx_v_fscale <= 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3106 + /* "mtrand.pyx":3106 * raise ValueError("mean <= 0") * if fscale <= 0: * raise ValueError("scale <= 0") # <<<<<<<<<<<<<< @@ -13183,7 +13190,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3107 + /* "mtrand.pyx":3107 * if fscale <= 0: * raise ValueError("scale <= 0") * return cont2_array_sc(self.internal_state, rk_wald, size, fmean, fscale) # <<<<<<<<<<<<<< @@ -13200,7 +13207,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3109 + /* "mtrand.pyx":3109 * return cont2_array_sc(self.internal_state, rk_wald, size, fmean, fscale) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -13209,7 +13216,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3110 + /* "mtrand.pyx":3110 * * PyErr_Clear() * omean = PyArray_FROM_OTF(mean, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -13223,7 +13230,7 @@ __pyx_v_omean = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3111 + /* "mtrand.pyx":3111 * PyErr_Clear() * omean = PyArray_FROM_OTF(mean, NPY_DOUBLE, NPY_ALIGNED) * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -13237,7 +13244,7 @@ __pyx_v_oscale = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3112 + /* "mtrand.pyx":3112 * omean = PyArray_FROM_OTF(mean, NPY_DOUBLE, NPY_ALIGNED) * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(omean,0.0)): # <<<<<<<<<<<<<< @@ -13281,7 +13288,7 @@ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3113 + /* "mtrand.pyx":3113 * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(omean,0.0)): * raise ValueError("mean <= 0.0") # <<<<<<<<<<<<<< @@ -13302,7 +13309,7 @@ goto __pyx_L9; } - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3114 + /* "mtrand.pyx":3114 * if np.any(np.less_equal(omean,0.0)): * raise ValueError("mean <= 0.0") * elif np.any(np.less_equal(oscale,0.0)): # <<<<<<<<<<<<<< @@ -13346,7 +13353,7 @@ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3115 + /* "mtrand.pyx":3115 * raise ValueError("mean <= 0.0") * elif np.any(np.less_equal(oscale,0.0)): * raise ValueError("scale <= 0.0") # <<<<<<<<<<<<<< @@ -13368,7 +13375,7 @@ } __pyx_L9:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3116 + /* "mtrand.pyx":3116 * elif np.any(np.less_equal(oscale,0.0)): * raise ValueError("scale <= 0.0") * return cont2_array(self.internal_state, rk_wald, size, omean, oscale) # <<<<<<<<<<<<<< @@ -13403,7 +13410,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3120 +/* "mtrand.pyx":3120 * * * def triangular(self, left, mode, right, size=None): # <<<<<<<<<<<<<< @@ -13503,7 +13510,7 @@ __pyx_v_omode = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_oright = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3180 + /* "mtrand.pyx":3180 * cdef double fleft, fmode, fright * * fleft = PyFloat_AsDouble(left) # <<<<<<<<<<<<<< @@ -13512,7 +13519,7 @@ */ __pyx_v_fleft = PyFloat_AsDouble(__pyx_v_left); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3181 + /* "mtrand.pyx":3181 * * fleft = PyFloat_AsDouble(left) * fright = PyFloat_AsDouble(right) # <<<<<<<<<<<<<< @@ -13521,7 +13528,7 @@ */ __pyx_v_fright = PyFloat_AsDouble(__pyx_v_right); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3182 + /* "mtrand.pyx":3182 * fleft = PyFloat_AsDouble(left) * fright = PyFloat_AsDouble(right) * fmode = PyFloat_AsDouble(mode) # <<<<<<<<<<<<<< @@ -13530,7 +13537,7 @@ */ __pyx_v_fmode = PyFloat_AsDouble(__pyx_v_mode); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3183 + /* "mtrand.pyx":3183 * fright = PyFloat_AsDouble(right) * fmode = PyFloat_AsDouble(mode) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -13540,7 +13547,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3184 + /* "mtrand.pyx":3184 * fmode = PyFloat_AsDouble(mode) * if not PyErr_Occurred(): * if fleft > fmode: # <<<<<<<<<<<<<< @@ -13550,7 +13557,7 @@ __pyx_t_1 = (__pyx_v_fleft > __pyx_v_fmode); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3185 + /* "mtrand.pyx":3185 * if not PyErr_Occurred(): * if fleft > fmode: * raise ValueError("left > mode") # <<<<<<<<<<<<<< @@ -13572,7 +13579,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3186 + /* "mtrand.pyx":3186 * if fleft > fmode: * raise ValueError("left > mode") * if fmode > fright: # <<<<<<<<<<<<<< @@ -13582,7 +13589,7 @@ __pyx_t_1 = (__pyx_v_fmode > __pyx_v_fright); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3187 + /* "mtrand.pyx":3187 * raise ValueError("left > mode") * if fmode > fright: * raise ValueError("mode > right") # <<<<<<<<<<<<<< @@ -13604,7 +13611,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3188 + /* "mtrand.pyx":3188 * if fmode > fright: * raise ValueError("mode > right") * if fleft == fright: # <<<<<<<<<<<<<< @@ -13614,7 +13621,7 @@ __pyx_t_1 = (__pyx_v_fleft == __pyx_v_fright); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3189 + /* "mtrand.pyx":3189 * raise ValueError("mode > right") * if fleft == fright: * raise ValueError("left == right") # <<<<<<<<<<<<<< @@ -13636,7 +13643,7 @@ } __pyx_L9:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3190 + /* "mtrand.pyx":3190 * if fleft == fright: * raise ValueError("left == right") * return cont3_array_sc(self.internal_state, rk_triangular, size, fleft, # <<<<<<<<<<<<<< @@ -13645,7 +13652,7 @@ */ __Pyx_XDECREF(__pyx_r); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3191 + /* "mtrand.pyx":3191 * raise ValueError("left == right") * return cont3_array_sc(self.internal_state, rk_triangular, size, fleft, * fmode, fright) # <<<<<<<<<<<<<< @@ -13661,7 +13668,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3193 + /* "mtrand.pyx":3193 * fmode, fright) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -13670,7 +13677,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3194 + /* "mtrand.pyx":3194 * * PyErr_Clear() * oleft = PyArray_FROM_OTF(left, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -13684,7 +13691,7 @@ __pyx_v_oleft = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3195 + /* "mtrand.pyx":3195 * PyErr_Clear() * oleft = PyArray_FROM_OTF(left, NPY_DOUBLE, NPY_ALIGNED) * omode = PyArray_FROM_OTF(mode, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -13698,7 +13705,7 @@ __pyx_v_omode = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3196 + /* "mtrand.pyx":3196 * oleft = PyArray_FROM_OTF(left, NPY_DOUBLE, NPY_ALIGNED) * omode = PyArray_FROM_OTF(mode, NPY_DOUBLE, NPY_ALIGNED) * oright = PyArray_FROM_OTF(right, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -13712,7 +13719,7 @@ __pyx_v_oright = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3198 + /* "mtrand.pyx":3198 * oright = PyArray_FROM_OTF(right, NPY_DOUBLE, NPY_ALIGNED) * * if np.any(np.greater(oleft, omode)): # <<<<<<<<<<<<<< @@ -13754,7 +13761,7 @@ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3199 + /* "mtrand.pyx":3199 * * if np.any(np.greater(oleft, omode)): * raise ValueError("left > mode") # <<<<<<<<<<<<<< @@ -13776,7 +13783,7 @@ } __pyx_L10:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3200 + /* "mtrand.pyx":3200 * if np.any(np.greater(oleft, omode)): * raise ValueError("left > mode") * if np.any(np.greater(omode, oright)): # <<<<<<<<<<<<<< @@ -13818,7 +13825,7 @@ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3201 + /* "mtrand.pyx":3201 * raise ValueError("left > mode") * if np.any(np.greater(omode, oright)): * raise ValueError("mode > right") # <<<<<<<<<<<<<< @@ -13840,7 +13847,7 @@ } __pyx_L11:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3202 + /* "mtrand.pyx":3202 * if np.any(np.greater(omode, oright)): * raise ValueError("mode > right") * if np.any(np.equal(oleft, oright)): # <<<<<<<<<<<<<< @@ -13882,7 +13889,7 @@ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3203 + /* "mtrand.pyx":3203 * raise ValueError("mode > right") * if np.any(np.equal(oleft, oright)): * raise ValueError("left == right") # <<<<<<<<<<<<<< @@ -13904,7 +13911,7 @@ } __pyx_L12:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3204 + /* "mtrand.pyx":3204 * if np.any(np.equal(oleft, oright)): * raise ValueError("left == right") * return cont3_array(self.internal_state, rk_triangular, size, oleft, # <<<<<<<<<<<<<< @@ -13913,7 +13920,7 @@ */ __Pyx_XDECREF(__pyx_r); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3205 + /* "mtrand.pyx":3205 * raise ValueError("left == right") * return cont3_array(self.internal_state, rk_triangular, size, oleft, * omode, oright) # <<<<<<<<<<<<<< @@ -13949,7 +13956,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3208 +/* "mtrand.pyx":3208 * * # Complicated, discrete distributions: * def binomial(self, n, p, size=None): # <<<<<<<<<<<<<< @@ -14035,7 +14042,7 @@ __pyx_v_on = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_op = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3293 + /* "mtrand.pyx":3293 * cdef double fp * * fp = PyFloat_AsDouble(p) # <<<<<<<<<<<<<< @@ -14044,7 +14051,7 @@ */ __pyx_v_fp = PyFloat_AsDouble(__pyx_v_p); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3294 + /* "mtrand.pyx":3294 * * fp = PyFloat_AsDouble(p) * ln = PyInt_AsLong(n) # <<<<<<<<<<<<<< @@ -14053,7 +14060,7 @@ */ __pyx_v_ln = PyInt_AsLong(__pyx_v_n); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3295 + /* "mtrand.pyx":3295 * fp = PyFloat_AsDouble(p) * ln = PyInt_AsLong(n) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -14063,7 +14070,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3296 + /* "mtrand.pyx":3296 * ln = PyInt_AsLong(n) * if not PyErr_Occurred(): * if ln <= 0: # <<<<<<<<<<<<<< @@ -14073,7 +14080,7 @@ __pyx_t_1 = (__pyx_v_ln <= 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3297 + /* "mtrand.pyx":3297 * if not PyErr_Occurred(): * if ln <= 0: * raise ValueError("n <= 0") # <<<<<<<<<<<<<< @@ -14095,7 +14102,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3298 + /* "mtrand.pyx":3298 * if ln <= 0: * raise ValueError("n <= 0") * if fp < 0: # <<<<<<<<<<<<<< @@ -14105,7 +14112,7 @@ __pyx_t_1 = (__pyx_v_fp < 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3299 + /* "mtrand.pyx":3299 * raise ValueError("n <= 0") * if fp < 0: * raise ValueError("p < 0") # <<<<<<<<<<<<<< @@ -14126,7 +14133,7 @@ goto __pyx_L8; } - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3300 + /* "mtrand.pyx":3300 * if fp < 0: * raise ValueError("p < 0") * elif fp > 1: # <<<<<<<<<<<<<< @@ -14136,7 +14143,7 @@ __pyx_t_1 = (__pyx_v_fp > 1); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3301 + /* "mtrand.pyx":3301 * raise ValueError("p < 0") * elif fp > 1: * raise ValueError("p > 1") # <<<<<<<<<<<<<< @@ -14158,7 +14165,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3302 + /* "mtrand.pyx":3302 * elif fp > 1: * raise ValueError("p > 1") * return discnp_array_sc(self.internal_state, rk_binomial, size, ln, fp) # <<<<<<<<<<<<<< @@ -14175,7 +14182,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3304 + /* "mtrand.pyx":3304 * return discnp_array_sc(self.internal_state, rk_binomial, size, ln, fp) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -14184,7 +14191,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3306 + /* "mtrand.pyx":3306 * PyErr_Clear() * * on = PyArray_FROM_OTF(n, NPY_LONG, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -14198,7 +14205,7 @@ __pyx_v_on = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3307 + /* "mtrand.pyx":3307 * * on = PyArray_FROM_OTF(n, NPY_LONG, NPY_ALIGNED) * op = PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -14212,7 +14219,7 @@ __pyx_v_op = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3308 + /* "mtrand.pyx":3308 * on = PyArray_FROM_OTF(n, NPY_LONG, NPY_ALIGNED) * op = PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(n, 0)): # <<<<<<<<<<<<<< @@ -14254,7 +14261,7 @@ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3309 + /* "mtrand.pyx":3309 * op = PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(n, 0)): * raise ValueError("n <= 0") # <<<<<<<<<<<<<< @@ -14276,7 +14283,7 @@ } __pyx_L9:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3310 + /* "mtrand.pyx":3310 * if np.any(np.less_equal(n, 0)): * raise ValueError("n <= 0") * if np.any(np.less(p, 0)): # <<<<<<<<<<<<<< @@ -14318,7 +14325,7 @@ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3311 + /* "mtrand.pyx":3311 * raise ValueError("n <= 0") * if np.any(np.less(p, 0)): * raise ValueError("p < 0") # <<<<<<<<<<<<<< @@ -14340,7 +14347,7 @@ } __pyx_L10:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3312 + /* "mtrand.pyx":3312 * if np.any(np.less(p, 0)): * raise ValueError("p < 0") * if np.any(np.greater(p, 1)): # <<<<<<<<<<<<<< @@ -14382,7 +14389,7 @@ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3313 + /* "mtrand.pyx":3313 * raise ValueError("p < 0") * if np.any(np.greater(p, 1)): * raise ValueError("p > 1") # <<<<<<<<<<<<<< @@ -14404,7 +14411,7 @@ } __pyx_L11:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3314 + /* "mtrand.pyx":3314 * if np.any(np.greater(p, 1)): * raise ValueError("p > 1") * return discnp_array(self.internal_state, rk_binomial, size, on, op) # <<<<<<<<<<<<<< @@ -14439,7 +14446,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3316 +/* "mtrand.pyx":3316 * return discnp_array(self.internal_state, rk_binomial, size, on, op) * * def negative_binomial(self, n, p, size=None): # <<<<<<<<<<<<<< @@ -14525,7 +14532,7 @@ __pyx_v_on = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_op = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3386 + /* "mtrand.pyx":3386 * cdef double fp * * fp = PyFloat_AsDouble(p) # <<<<<<<<<<<<<< @@ -14534,7 +14541,7 @@ */ __pyx_v_fp = PyFloat_AsDouble(__pyx_v_p); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3387 + /* "mtrand.pyx":3387 * * fp = PyFloat_AsDouble(p) * fn = PyFloat_AsDouble(n) # <<<<<<<<<<<<<< @@ -14543,7 +14550,7 @@ */ __pyx_v_fn = PyFloat_AsDouble(__pyx_v_n); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3388 + /* "mtrand.pyx":3388 * fp = PyFloat_AsDouble(p) * fn = PyFloat_AsDouble(n) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -14553,7 +14560,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3389 + /* "mtrand.pyx":3389 * fn = PyFloat_AsDouble(n) * if not PyErr_Occurred(): * if fn <= 0: # <<<<<<<<<<<<<< @@ -14563,7 +14570,7 @@ __pyx_t_1 = (__pyx_v_fn <= 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3390 + /* "mtrand.pyx":3390 * if not PyErr_Occurred(): * if fn <= 0: * raise ValueError("n <= 0") # <<<<<<<<<<<<<< @@ -14585,7 +14592,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3391 + /* "mtrand.pyx":3391 * if fn <= 0: * raise ValueError("n <= 0") * if fp < 0: # <<<<<<<<<<<<<< @@ -14595,7 +14602,7 @@ __pyx_t_1 = (__pyx_v_fp < 0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3392 + /* "mtrand.pyx":3392 * raise ValueError("n <= 0") * if fp < 0: * raise ValueError("p < 0") # <<<<<<<<<<<<<< @@ -14616,7 +14623,7 @@ goto __pyx_L8; } - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3393 + /* "mtrand.pyx":3393 * if fp < 0: * raise ValueError("p < 0") * elif fp > 1: # <<<<<<<<<<<<<< @@ -14626,7 +14633,7 @@ __pyx_t_1 = (__pyx_v_fp > 1); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3394 + /* "mtrand.pyx":3394 * raise ValueError("p < 0") * elif fp > 1: * raise ValueError("p > 1") # <<<<<<<<<<<<<< @@ -14648,7 +14655,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3395 + /* "mtrand.pyx":3395 * elif fp > 1: * raise ValueError("p > 1") * return discdd_array_sc(self.internal_state, rk_negative_binomial, # <<<<<<<<<<<<<< @@ -14657,7 +14664,7 @@ */ __Pyx_XDECREF(__pyx_r); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3396 + /* "mtrand.pyx":3396 * raise ValueError("p > 1") * return discdd_array_sc(self.internal_state, rk_negative_binomial, * size, fn, fp) # <<<<<<<<<<<<<< @@ -14673,7 +14680,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3398 + /* "mtrand.pyx":3398 * size, fn, fp) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -14682,7 +14689,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3400 + /* "mtrand.pyx":3400 * PyErr_Clear() * * on = PyArray_FROM_OTF(n, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -14696,7 +14703,7 @@ __pyx_v_on = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3401 + /* "mtrand.pyx":3401 * * on = PyArray_FROM_OTF(n, NPY_DOUBLE, NPY_ALIGNED) * op = PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -14710,7 +14717,7 @@ __pyx_v_op = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3402 + /* "mtrand.pyx":3402 * on = PyArray_FROM_OTF(n, NPY_DOUBLE, NPY_ALIGNED) * op = PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(n, 0)): # <<<<<<<<<<<<<< @@ -14752,7 +14759,7 @@ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3403 + /* "mtrand.pyx":3403 * op = PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(n, 0)): * raise ValueError("n <= 0") # <<<<<<<<<<<<<< @@ -14774,7 +14781,7 @@ } __pyx_L9:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3404 + /* "mtrand.pyx":3404 * if np.any(np.less_equal(n, 0)): * raise ValueError("n <= 0") * if np.any(np.less(p, 0)): # <<<<<<<<<<<<<< @@ -14816,7 +14823,7 @@ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3405 + /* "mtrand.pyx":3405 * raise ValueError("n <= 0") * if np.any(np.less(p, 0)): * raise ValueError("p < 0") # <<<<<<<<<<<<<< @@ -14838,7 +14845,7 @@ } __pyx_L10:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3406 + /* "mtrand.pyx":3406 * if np.any(np.less(p, 0)): * raise ValueError("p < 0") * if np.any(np.greater(p, 1)): # <<<<<<<<<<<<<< @@ -14880,7 +14887,7 @@ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3407 + /* "mtrand.pyx":3407 * raise ValueError("p < 0") * if np.any(np.greater(p, 1)): * raise ValueError("p > 1") # <<<<<<<<<<<<<< @@ -14902,7 +14909,7 @@ } __pyx_L11:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3408 + /* "mtrand.pyx":3408 * if np.any(np.greater(p, 1)): * raise ValueError("p > 1") * return discdd_array(self.internal_state, rk_negative_binomial, size, # <<<<<<<<<<<<<< @@ -14911,7 +14918,7 @@ */ __Pyx_XDECREF(__pyx_r); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3409 + /* "mtrand.pyx":3409 * raise ValueError("p > 1") * return discdd_array(self.internal_state, rk_negative_binomial, size, * on, op) # <<<<<<<<<<<<<< @@ -14945,7 +14952,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3411 +/* "mtrand.pyx":3411 * on, op) * * def poisson(self, lam=1.0, size=None): # <<<<<<<<<<<<<< @@ -15018,7 +15025,7 @@ __Pyx_INCREF(__pyx_v_size); __pyx_v_olam = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3461 + /* "mtrand.pyx":3461 * cdef ndarray olam * cdef double flam * flam = PyFloat_AsDouble(lam) # <<<<<<<<<<<<<< @@ -15027,7 +15034,7 @@ */ __pyx_v_flam = PyFloat_AsDouble(__pyx_v_lam); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3462 + /* "mtrand.pyx":3462 * cdef double flam * flam = PyFloat_AsDouble(lam) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -15037,7 +15044,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3463 + /* "mtrand.pyx":3463 * flam = PyFloat_AsDouble(lam) * if not PyErr_Occurred(): * if lam < 0: # <<<<<<<<<<<<<< @@ -15050,7 +15057,7 @@ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3464 + /* "mtrand.pyx":3464 * if not PyErr_Occurred(): * if lam < 0: * raise ValueError("lam < 0") # <<<<<<<<<<<<<< @@ -15072,7 +15079,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3465 + /* "mtrand.pyx":3465 * if lam < 0: * raise ValueError("lam < 0") * return discd_array_sc(self.internal_state, rk_poisson, size, flam) # <<<<<<<<<<<<<< @@ -15089,7 +15096,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3467 + /* "mtrand.pyx":3467 * return discd_array_sc(self.internal_state, rk_poisson, size, flam) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -15098,7 +15105,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3469 + /* "mtrand.pyx":3469 * PyErr_Clear() * * olam = PyArray_FROM_OTF(lam, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -15112,7 +15119,7 @@ __pyx_v_olam = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3470 + /* "mtrand.pyx":3470 * * olam = PyArray_FROM_OTF(lam, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less(olam, 0)): # <<<<<<<<<<<<<< @@ -15154,7 +15161,7 @@ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3471 + /* "mtrand.pyx":3471 * olam = PyArray_FROM_OTF(lam, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less(olam, 0)): * raise ValueError("lam < 0") # <<<<<<<<<<<<<< @@ -15176,7 +15183,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3472 + /* "mtrand.pyx":3472 * if np.any(np.less(olam, 0)): * raise ValueError("lam < 0") * return discd_array(self.internal_state, rk_poisson, size, olam) # <<<<<<<<<<<<<< @@ -15209,7 +15216,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3474 +/* "mtrand.pyx":3474 * return discd_array(self.internal_state, rk_poisson, size, olam) * * def zipf(self, a, size=None): # <<<<<<<<<<<<<< @@ -15279,7 +15286,7 @@ __Pyx_INCREF(__pyx_v_size); __pyx_v_oa = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3553 + /* "mtrand.pyx":3553 * cdef double fa * * fa = PyFloat_AsDouble(a) # <<<<<<<<<<<<<< @@ -15288,7 +15295,7 @@ */ __pyx_v_fa = PyFloat_AsDouble(__pyx_v_a); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3554 + /* "mtrand.pyx":3554 * * fa = PyFloat_AsDouble(a) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -15298,7 +15305,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3555 + /* "mtrand.pyx":3555 * fa = PyFloat_AsDouble(a) * if not PyErr_Occurred(): * if fa <= 1.0: # <<<<<<<<<<<<<< @@ -15308,7 +15315,7 @@ __pyx_t_1 = (__pyx_v_fa <= 1.0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3556 + /* "mtrand.pyx":3556 * if not PyErr_Occurred(): * if fa <= 1.0: * raise ValueError("a <= 1.0") # <<<<<<<<<<<<<< @@ -15330,7 +15337,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3557 + /* "mtrand.pyx":3557 * if fa <= 1.0: * raise ValueError("a <= 1.0") * return discd_array_sc(self.internal_state, rk_zipf, size, fa) # <<<<<<<<<<<<<< @@ -15347,7 +15354,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3559 + /* "mtrand.pyx":3559 * return discd_array_sc(self.internal_state, rk_zipf, size, fa) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -15356,7 +15363,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3561 + /* "mtrand.pyx":3561 * PyErr_Clear() * * oa = PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -15370,7 +15377,7 @@ __pyx_v_oa = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3562 + /* "mtrand.pyx":3562 * * oa = PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(oa, 1.0)): # <<<<<<<<<<<<<< @@ -15414,7 +15421,7 @@ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3563 + /* "mtrand.pyx":3563 * oa = PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(oa, 1.0)): * raise ValueError("a <= 1.0") # <<<<<<<<<<<<<< @@ -15436,7 +15443,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3564 + /* "mtrand.pyx":3564 * if np.any(np.less_equal(oa, 1.0)): * raise ValueError("a <= 1.0") * return discd_array(self.internal_state, rk_zipf, size, oa) # <<<<<<<<<<<<<< @@ -15469,7 +15476,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3566 +/* "mtrand.pyx":3566 * return discd_array(self.internal_state, rk_zipf, size, oa) * * def geometric(self, p, size=None): # <<<<<<<<<<<<<< @@ -15539,7 +15546,7 @@ __Pyx_INCREF(__pyx_v_size); __pyx_v_op = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3614 + /* "mtrand.pyx":3614 * cdef double fp * * fp = PyFloat_AsDouble(p) # <<<<<<<<<<<<<< @@ -15548,7 +15555,7 @@ */ __pyx_v_fp = PyFloat_AsDouble(__pyx_v_p); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3615 + /* "mtrand.pyx":3615 * * fp = PyFloat_AsDouble(p) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -15558,7 +15565,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3616 + /* "mtrand.pyx":3616 * fp = PyFloat_AsDouble(p) * if not PyErr_Occurred(): * if fp < 0.0: # <<<<<<<<<<<<<< @@ -15568,7 +15575,7 @@ __pyx_t_1 = (__pyx_v_fp < 0.0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3617 + /* "mtrand.pyx":3617 * if not PyErr_Occurred(): * if fp < 0.0: * raise ValueError("p < 0.0") # <<<<<<<<<<<<<< @@ -15590,7 +15597,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3618 + /* "mtrand.pyx":3618 * if fp < 0.0: * raise ValueError("p < 0.0") * if fp > 1.0: # <<<<<<<<<<<<<< @@ -15600,7 +15607,7 @@ __pyx_t_1 = (__pyx_v_fp > 1.0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3619 + /* "mtrand.pyx":3619 * raise ValueError("p < 0.0") * if fp > 1.0: * raise ValueError("p > 1.0") # <<<<<<<<<<<<<< @@ -15622,7 +15629,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3620 + /* "mtrand.pyx":3620 * if fp > 1.0: * raise ValueError("p > 1.0") * return discd_array_sc(self.internal_state, rk_geometric, size, fp) # <<<<<<<<<<<<<< @@ -15639,7 +15646,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3622 + /* "mtrand.pyx":3622 * return discd_array_sc(self.internal_state, rk_geometric, size, fp) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -15648,7 +15655,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3625 + /* "mtrand.pyx":3625 * * * op = PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -15662,7 +15669,7 @@ __pyx_v_op = ((PyArrayObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3626 + /* "mtrand.pyx":3626 * * op = PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less(op, 0.0)): # <<<<<<<<<<<<<< @@ -15706,7 +15713,7 @@ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3627 + /* "mtrand.pyx":3627 * op = PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less(op, 0.0)): * raise ValueError("p < 0.0") # <<<<<<<<<<<<<< @@ -15728,7 +15735,7 @@ } __pyx_L9:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3628 + /* "mtrand.pyx":3628 * if np.any(np.less(op, 0.0)): * raise ValueError("p < 0.0") * if np.any(np.greater(op, 1.0)): # <<<<<<<<<<<<<< @@ -15772,7 +15779,7 @@ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3629 + /* "mtrand.pyx":3629 * raise ValueError("p < 0.0") * if np.any(np.greater(op, 1.0)): * raise ValueError("p > 1.0") # <<<<<<<<<<<<<< @@ -15794,7 +15801,7 @@ } __pyx_L10:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3630 + /* "mtrand.pyx":3630 * if np.any(np.greater(op, 1.0)): * raise ValueError("p > 1.0") * return discd_array(self.internal_state, rk_geometric, size, op) # <<<<<<<<<<<<<< @@ -15827,7 +15834,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3632 +/* "mtrand.pyx":3632 * return discd_array(self.internal_state, rk_geometric, size, op) * * def hypergeometric(self, ngood, nbad, nsample, size=None): # <<<<<<<<<<<<<< @@ -15928,7 +15935,7 @@ __pyx_v_onbad = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_onsample = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3719 + /* "mtrand.pyx":3719 * cdef long lngood, lnbad, lnsample * * lngood = PyInt_AsLong(ngood) # <<<<<<<<<<<<<< @@ -15937,7 +15944,7 @@ */ __pyx_v_lngood = PyInt_AsLong(__pyx_v_ngood); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3720 + /* "mtrand.pyx":3720 * * lngood = PyInt_AsLong(ngood) * lnbad = PyInt_AsLong(nbad) # <<<<<<<<<<<<<< @@ -15946,7 +15953,7 @@ */ __pyx_v_lnbad = PyInt_AsLong(__pyx_v_nbad); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3721 + /* "mtrand.pyx":3721 * lngood = PyInt_AsLong(ngood) * lnbad = PyInt_AsLong(nbad) * lnsample = PyInt_AsLong(nsample) # <<<<<<<<<<<<<< @@ -15955,7 +15962,7 @@ */ __pyx_v_lnsample = PyInt_AsLong(__pyx_v_nsample); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3722 + /* "mtrand.pyx":3722 * lnbad = PyInt_AsLong(nbad) * lnsample = PyInt_AsLong(nsample) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -15965,7 +15972,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3723 + /* "mtrand.pyx":3723 * lnsample = PyInt_AsLong(nsample) * if not PyErr_Occurred(): * if ngood < 1: # <<<<<<<<<<<<<< @@ -15978,7 +15985,7 @@ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3724 + /* "mtrand.pyx":3724 * if not PyErr_Occurred(): * if ngood < 1: * raise ValueError("ngood < 1") # <<<<<<<<<<<<<< @@ -16000,7 +16007,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3725 + /* "mtrand.pyx":3725 * if ngood < 1: * raise ValueError("ngood < 1") * if nbad < 1: # <<<<<<<<<<<<<< @@ -16013,7 +16020,7 @@ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3726 + /* "mtrand.pyx":3726 * raise ValueError("ngood < 1") * if nbad < 1: * raise ValueError("nbad < 1") # <<<<<<<<<<<<<< @@ -16035,7 +16042,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3727 + /* "mtrand.pyx":3727 * if nbad < 1: * raise ValueError("nbad < 1") * if nsample < 1: # <<<<<<<<<<<<<< @@ -16048,7 +16055,7 @@ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3728 + /* "mtrand.pyx":3728 * raise ValueError("nbad < 1") * if nsample < 1: * raise ValueError("nsample < 1") # <<<<<<<<<<<<<< @@ -16070,7 +16077,7 @@ } __pyx_L9:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3729 + /* "mtrand.pyx":3729 * if nsample < 1: * raise ValueError("nsample < 1") * if ngood + nbad < nsample: # <<<<<<<<<<<<<< @@ -16086,7 +16093,7 @@ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3730 + /* "mtrand.pyx":3730 * raise ValueError("nsample < 1") * if ngood + nbad < nsample: * raise ValueError("ngood + nbad < nsample") # <<<<<<<<<<<<<< @@ -16108,7 +16115,7 @@ } __pyx_L10:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3731 + /* "mtrand.pyx":3731 * if ngood + nbad < nsample: * raise ValueError("ngood + nbad < nsample") * return discnmN_array_sc(self.internal_state, rk_hypergeometric, size, # <<<<<<<<<<<<<< @@ -16117,7 +16124,7 @@ */ __Pyx_XDECREF(__pyx_r); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3732 + /* "mtrand.pyx":3732 * raise ValueError("ngood + nbad < nsample") * return discnmN_array_sc(self.internal_state, rk_hypergeometric, size, * lngood, lnbad, lnsample) # <<<<<<<<<<<<<< @@ -16133,7 +16140,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3735 + /* "mtrand.pyx":3735 * * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -16142,7 +16149,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3737 + /* "mtrand.pyx":3737 * PyErr_Clear() * * ongood = PyArray_FROM_OTF(ngood, NPY_LONG, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -16156,7 +16163,7 @@ __pyx_v_ongood = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3738 + /* "mtrand.pyx":3738 * * ongood = PyArray_FROM_OTF(ngood, NPY_LONG, NPY_ALIGNED) * onbad = PyArray_FROM_OTF(nbad, NPY_LONG, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -16170,7 +16177,7 @@ __pyx_v_onbad = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3739 + /* "mtrand.pyx":3739 * ongood = PyArray_FROM_OTF(ngood, NPY_LONG, NPY_ALIGNED) * onbad = PyArray_FROM_OTF(nbad, NPY_LONG, NPY_ALIGNED) * onsample = PyArray_FROM_OTF(nsample, NPY_LONG, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -16184,7 +16191,7 @@ __pyx_v_onsample = ((PyArrayObject *)__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3740 + /* "mtrand.pyx":3740 * onbad = PyArray_FROM_OTF(nbad, NPY_LONG, NPY_ALIGNED) * onsample = PyArray_FROM_OTF(nsample, NPY_LONG, NPY_ALIGNED) * if np.any(np.less(ongood, 1)): # <<<<<<<<<<<<<< @@ -16226,7 +16233,7 @@ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3741 + /* "mtrand.pyx":3741 * onsample = PyArray_FROM_OTF(nsample, NPY_LONG, NPY_ALIGNED) * if np.any(np.less(ongood, 1)): * raise ValueError("ngood < 1") # <<<<<<<<<<<<<< @@ -16248,7 +16255,7 @@ } __pyx_L11:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3742 + /* "mtrand.pyx":3742 * if np.any(np.less(ongood, 1)): * raise ValueError("ngood < 1") * if np.any(np.less(onbad, 1)): # <<<<<<<<<<<<<< @@ -16290,7 +16297,7 @@ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3743 + /* "mtrand.pyx":3743 * raise ValueError("ngood < 1") * if np.any(np.less(onbad, 1)): * raise ValueError("nbad < 1") # <<<<<<<<<<<<<< @@ -16312,7 +16319,7 @@ } __pyx_L12:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3744 + /* "mtrand.pyx":3744 * if np.any(np.less(onbad, 1)): * raise ValueError("nbad < 1") * if np.any(np.less(onsample, 1)): # <<<<<<<<<<<<<< @@ -16354,7 +16361,7 @@ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3745 + /* "mtrand.pyx":3745 * raise ValueError("nbad < 1") * if np.any(np.less(onsample, 1)): * raise ValueError("nsample < 1") # <<<<<<<<<<<<<< @@ -16376,7 +16383,7 @@ } __pyx_L13:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3746 + /* "mtrand.pyx":3746 * if np.any(np.less(onsample, 1)): * raise ValueError("nsample < 1") * if np.any(np.less(np.add(ongood, onbad),onsample)): # <<<<<<<<<<<<<< @@ -16435,7 +16442,7 @@ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3747 + /* "mtrand.pyx":3747 * raise ValueError("nsample < 1") * if np.any(np.less(np.add(ongood, onbad),onsample)): * raise ValueError("ngood + nbad < nsample") # <<<<<<<<<<<<<< @@ -16457,7 +16464,7 @@ } __pyx_L14:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3748 + /* "mtrand.pyx":3748 * if np.any(np.less(np.add(ongood, onbad),onsample)): * raise ValueError("ngood + nbad < nsample") * return discnmN_array(self.internal_state, rk_hypergeometric, size, # <<<<<<<<<<<<<< @@ -16466,7 +16473,7 @@ */ __Pyx_XDECREF(__pyx_r); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3749 + /* "mtrand.pyx":3749 * raise ValueError("ngood + nbad < nsample") * return discnmN_array(self.internal_state, rk_hypergeometric, size, * ongood, onbad, onsample) # <<<<<<<<<<<<<< @@ -16503,7 +16510,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3751 +/* "mtrand.pyx":3751 * ongood, onbad, onsample) * * def logseries(self, p, size=None): # <<<<<<<<<<<<<< @@ -16573,7 +16580,7 @@ __Pyx_INCREF(__pyx_v_size); __pyx_v_op = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3828 + /* "mtrand.pyx":3828 * cdef double fp * * fp = PyFloat_AsDouble(p) # <<<<<<<<<<<<<< @@ -16582,7 +16589,7 @@ */ __pyx_v_fp = PyFloat_AsDouble(__pyx_v_p); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3829 + /* "mtrand.pyx":3829 * * fp = PyFloat_AsDouble(p) * if not PyErr_Occurred(): # <<<<<<<<<<<<<< @@ -16592,7 +16599,7 @@ __pyx_t_1 = (!PyErr_Occurred()); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3830 + /* "mtrand.pyx":3830 * fp = PyFloat_AsDouble(p) * if not PyErr_Occurred(): * if fp <= 0.0: # <<<<<<<<<<<<<< @@ -16602,7 +16609,7 @@ __pyx_t_1 = (__pyx_v_fp <= 0.0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3831 + /* "mtrand.pyx":3831 * if not PyErr_Occurred(): * if fp <= 0.0: * raise ValueError("p <= 0.0") # <<<<<<<<<<<<<< @@ -16624,7 +16631,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3832 + /* "mtrand.pyx":3832 * if fp <= 0.0: * raise ValueError("p <= 0.0") * if fp >= 1.0: # <<<<<<<<<<<<<< @@ -16634,7 +16641,7 @@ __pyx_t_1 = (__pyx_v_fp >= 1.0); if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3833 + /* "mtrand.pyx":3833 * raise ValueError("p <= 0.0") * if fp >= 1.0: * raise ValueError("p >= 1.0") # <<<<<<<<<<<<<< @@ -16656,7 +16663,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3834 + /* "mtrand.pyx":3834 * if fp >= 1.0: * raise ValueError("p >= 1.0") * return discd_array_sc(self.internal_state, rk_logseries, size, fp) # <<<<<<<<<<<<<< @@ -16673,7 +16680,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3836 + /* "mtrand.pyx":3836 * return discd_array_sc(self.internal_state, rk_logseries, size, fp) * * PyErr_Clear() # <<<<<<<<<<<<<< @@ -16682,7 +16689,7 @@ */ PyErr_Clear(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3838 + /* "mtrand.pyx":3838 * PyErr_Clear() * * op = PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<< @@ -16696,7 +16703,7 @@ __pyx_v_op = ((PyArrayObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3839 + /* "mtrand.pyx":3839 * * op = PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(op, 0.0)): # <<<<<<<<<<<<<< @@ -16740,7 +16747,7 @@ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3840 + /* "mtrand.pyx":3840 * op = PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED) * if np.any(np.less_equal(op, 0.0)): * raise ValueError("p <= 0.0") # <<<<<<<<<<<<<< @@ -16762,7 +16769,7 @@ } __pyx_L9:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3841 + /* "mtrand.pyx":3841 * if np.any(np.less_equal(op, 0.0)): * raise ValueError("p <= 0.0") * if np.any(np.greater_equal(op, 1.0)): # <<<<<<<<<<<<<< @@ -16806,7 +16813,7 @@ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_1) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3842 + /* "mtrand.pyx":3842 * raise ValueError("p <= 0.0") * if np.any(np.greater_equal(op, 1.0)): * raise ValueError("p >= 1.0") # <<<<<<<<<<<<<< @@ -16828,7 +16835,7 @@ } __pyx_L10:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3843 + /* "mtrand.pyx":3843 * if np.any(np.greater_equal(op, 1.0)): * raise ValueError("p >= 1.0") * return discd_array(self.internal_state, rk_logseries, size, op) # <<<<<<<<<<<<<< @@ -16861,7 +16868,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3846 +/* "mtrand.pyx":3846 * * # Multivariate distributions: * def multivariate_normal(self, mean, cov, size=None): # <<<<<<<<<<<<<< @@ -16959,7 +16966,7 @@ __pyx_v_s = Py_None; __Pyx_INCREF(Py_None); __pyx_v_v = Py_None; __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3939 + /* "mtrand.pyx":3939 * """ * # Check preconditions on arguments * mean = np.array(mean) # <<<<<<<<<<<<<< @@ -16984,7 +16991,7 @@ __pyx_v_mean = __pyx_t_3; __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3940 + /* "mtrand.pyx":3940 * # Check preconditions on arguments * mean = np.array(mean) * cov = np.array(cov) # <<<<<<<<<<<<<< @@ -17009,7 +17016,7 @@ __pyx_v_cov = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3941 + /* "mtrand.pyx":3941 * mean = np.array(mean) * cov = np.array(cov) * if size is None: # <<<<<<<<<<<<<< @@ -17019,7 +17026,7 @@ __pyx_t_4 = (__pyx_v_size == Py_None); if (__pyx_t_4) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3942 + /* "mtrand.pyx":3942 * cov = np.array(cov) * if size is None: * shape = [] # <<<<<<<<<<<<<< @@ -17035,7 +17042,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3944 + /* "mtrand.pyx":3944 * shape = [] * else: * shape = size # <<<<<<<<<<<<<< @@ -17048,7 +17055,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3945 + /* "mtrand.pyx":3945 * else: * shape = size * if len(mean.shape) != 1: # <<<<<<<<<<<<<< @@ -17062,7 +17069,7 @@ __pyx_t_4 = (__pyx_t_5 != 1); if (__pyx_t_4) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3946 + /* "mtrand.pyx":3946 * shape = size * if len(mean.shape) != 1: * raise ValueError("mean must be 1 dimensional") # <<<<<<<<<<<<<< @@ -17084,7 +17091,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3947 + /* "mtrand.pyx":3947 * if len(mean.shape) != 1: * raise ValueError("mean must be 1 dimensional") * if (len(cov.shape) != 2) or (cov.shape[0] != cov.shape[1]): # <<<<<<<<<<<<<< @@ -17119,7 +17126,7 @@ } if (__pyx_t_7) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3948 + /* "mtrand.pyx":3948 * raise ValueError("mean must be 1 dimensional") * if (len(cov.shape) != 2) or (cov.shape[0] != cov.shape[1]): * raise ValueError("cov must be 2 dimensional and square") # <<<<<<<<<<<<<< @@ -17141,7 +17148,7 @@ } __pyx_L8:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3949 + /* "mtrand.pyx":3949 * if (len(cov.shape) != 2) or (cov.shape[0] != cov.shape[1]): * raise ValueError("cov must be 2 dimensional and square") * if mean.shape[0] != cov.shape[0]: # <<<<<<<<<<<<<< @@ -17166,7 +17173,7 @@ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_7) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3950 + /* "mtrand.pyx":3950 * raise ValueError("cov must be 2 dimensional and square") * if mean.shape[0] != cov.shape[0]: * raise ValueError("mean and cov must have same length") # <<<<<<<<<<<<<< @@ -17188,7 +17195,7 @@ } __pyx_L9:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3952 + /* "mtrand.pyx":3952 * raise ValueError("mean and cov must have same length") * # Compute shape of output * if isinstance(shape, int): # <<<<<<<<<<<<<< @@ -17198,7 +17205,7 @@ __pyx_t_7 = PyObject_TypeCheck(__pyx_v_shape, ((PyTypeObject *)((PyObject*)&PyInt_Type))); if (__pyx_t_7) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3953 + /* "mtrand.pyx":3953 * # Compute shape of output * if isinstance(shape, int): * shape = [shape] # <<<<<<<<<<<<<< @@ -17217,7 +17224,7 @@ } __pyx_L10:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3954 + /* "mtrand.pyx":3954 * if isinstance(shape, int): * shape = [shape] * final_shape = list(shape[:]) # <<<<<<<<<<<<<< @@ -17238,7 +17245,7 @@ __pyx_v_final_shape = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3955 + /* "mtrand.pyx":3955 * shape = [shape] * final_shape = list(shape[:]) * final_shape.append(mean.shape[0]) # <<<<<<<<<<<<<< @@ -17255,7 +17262,7 @@ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3959 + /* "mtrand.pyx":3959 * # numbers. The matrix has rows with the same length as mean and as * # many rows are necessary to form a matrix of shape final_shape. * x = self.standard_normal(np.multiply.reduce(final_shape)) # <<<<<<<<<<<<<< @@ -17294,7 +17301,7 @@ __pyx_v_x = __pyx_t_8; __pyx_t_8 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3960 + /* "mtrand.pyx":3960 * # many rows are necessary to form a matrix of shape final_shape. * x = self.standard_normal(np.multiply.reduce(final_shape)) * x.shape = (np.multiply.reduce(final_shape[0:len(final_shape)-1]), # <<<<<<<<<<<<<< @@ -17322,7 +17329,7 @@ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3961 + /* "mtrand.pyx":3961 * x = self.standard_normal(np.multiply.reduce(final_shape)) * x.shape = (np.multiply.reduce(final_shape[0:len(final_shape)-1]), * mean.shape[0]) # <<<<<<<<<<<<<< @@ -17343,7 +17350,7 @@ __pyx_t_3 = 0; __pyx_t_8 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3960 + /* "mtrand.pyx":3960 * # many rows are necessary to form a matrix of shape final_shape. * x = self.standard_normal(np.multiply.reduce(final_shape)) * x.shape = (np.multiply.reduce(final_shape[0:len(final_shape)-1]), # <<<<<<<<<<<<<< @@ -17353,7 +17360,7 @@ if (PyObject_SetAttr(__pyx_v_x, __pyx_n_s__shape, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3969 + /* "mtrand.pyx":3969 * # decomposition of cov is such an A. * * from numpy.dual import svd # <<<<<<<<<<<<<< @@ -17376,7 +17383,7 @@ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3971 + /* "mtrand.pyx":3971 * from numpy.dual import svd * # XXX: we really should be doing this by Cholesky decomposition * (u,s,v) = svd(cov) # <<<<<<<<<<<<<< @@ -17429,7 +17436,7 @@ __pyx_t_1 = 0; } - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3972 + /* "mtrand.pyx":3972 * # XXX: we really should be doing this by Cholesky decomposition * (u,s,v) = svd(cov) * x = np.dot(x*np.sqrt(s),v) # <<<<<<<<<<<<<< @@ -17474,7 +17481,7 @@ __pyx_v_x = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3975 + /* "mtrand.pyx":3975 * # The rows of x now have the correct covariance but mean 0. Add * # mean to each row. Then each row will have mean mean. * np.add(mean,x,x) # <<<<<<<<<<<<<< @@ -17503,7 +17510,7 @@ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3976 + /* "mtrand.pyx":3976 * # mean to each row. Then each row will have mean mean. * np.add(mean,x,x) * x.shape = tuple(final_shape) # <<<<<<<<<<<<<< @@ -17521,7 +17528,7 @@ if (PyObject_SetAttr(__pyx_v_x, __pyx_n_s__shape, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3976; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3977 + /* "mtrand.pyx":3977 * np.add(mean,x,x) * x.shape = tuple(final_shape) * return x # <<<<<<<<<<<<<< @@ -17560,7 +17567,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3979 +/* "mtrand.pyx":3979 * return x * * def multinomial(self, long n, object pvals, size=None): # <<<<<<<<<<<<<< @@ -17656,7 +17663,7 @@ __pyx_v_shape = Py_None; __Pyx_INCREF(Py_None); __pyx_v_multin = Py_None; __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4038 + /* "mtrand.pyx":4038 * cdef double Sum * * d = len(pvals) # <<<<<<<<<<<<<< @@ -17666,7 +17673,7 @@ __pyx_t_1 = PyObject_Length(__pyx_v_pvals); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4038; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_d = __pyx_t_1; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4039 + /* "mtrand.pyx":4039 * * d = len(pvals) * parr = PyArray_ContiguousFromObject(pvals, NPY_DOUBLE, 1, 1) # <<<<<<<<<<<<<< @@ -17680,7 +17687,7 @@ arrayObject_parr = ((PyArrayObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4040 + /* "mtrand.pyx":4040 * d = len(pvals) * parr = PyArray_ContiguousFromObject(pvals, NPY_DOUBLE, 1, 1) * pix = parr.data # <<<<<<<<<<<<<< @@ -17689,7 +17696,7 @@ */ __pyx_v_pix = ((double *)arrayObject_parr->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4042 + /* "mtrand.pyx":4042 * pix = parr.data * * if kahan_sum(pix, d-1) > (1.0 + 1e-12): # <<<<<<<<<<<<<< @@ -17699,7 +17706,7 @@ __pyx_t_3 = (__pyx_f_6mtrand_kahan_sum(__pyx_v_pix, (__pyx_v_d - 1)) > (1.0 + 9.9999999999999998e-13)); if (__pyx_t_3) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4043 + /* "mtrand.pyx":4043 * * if kahan_sum(pix, d-1) > (1.0 + 1e-12): * raise ValueError("sum(pvals[:-1]) > 1.0") # <<<<<<<<<<<<<< @@ -17721,7 +17728,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4045 + /* "mtrand.pyx":4045 * raise ValueError("sum(pvals[:-1]) > 1.0") * * if size is None: # <<<<<<<<<<<<<< @@ -17731,7 +17738,7 @@ __pyx_t_3 = (__pyx_v_size == Py_None); if (__pyx_t_3) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4046 + /* "mtrand.pyx":4046 * * if size is None: * shape = (d,) # <<<<<<<<<<<<<< @@ -17751,20 +17758,17 @@ goto __pyx_L7; } - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4047 + /* "mtrand.pyx":4047 * if size is None: * shape = (d,) * elif type(size) is int: # <<<<<<<<<<<<<< * shape = (size, d) * else: */ - __pyx_t_2 = ((PyObject *)__Pyx_Type(__pyx_v_size)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_3 = (__pyx_t_2 == ((PyObject*)&PyInt_Type)); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_size)) == ((PyObject *)((PyObject*)&PyInt_Type))); if (__pyx_t_3) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4048 + /* "mtrand.pyx":4048 * shape = (d,) * elif type(size) is int: * shape = (size, d) # <<<<<<<<<<<<<< @@ -17788,7 +17792,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4050 + /* "mtrand.pyx":4050 * shape = (size, d) * else: * shape = size + (d,) # <<<<<<<<<<<<<< @@ -17811,7 +17815,7 @@ } __pyx_L7:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4052 + /* "mtrand.pyx":4052 * shape = size + (d,) * * multin = np.zeros(shape, int) # <<<<<<<<<<<<<< @@ -17839,7 +17843,7 @@ __pyx_v_multin = __pyx_t_5; __pyx_t_5 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4053 + /* "mtrand.pyx":4053 * * multin = np.zeros(shape, int) * mnarr = multin # <<<<<<<<<<<<<< @@ -17850,7 +17854,7 @@ __Pyx_DECREF(((PyObject *)arrayObject_mnarr)); arrayObject_mnarr = ((PyArrayObject *)__pyx_v_multin); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4054 + /* "mtrand.pyx":4054 * multin = np.zeros(shape, int) * mnarr = multin * mnix = mnarr.data # <<<<<<<<<<<<<< @@ -17859,7 +17863,7 @@ */ __pyx_v_mnix = ((long *)arrayObject_mnarr->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4055 + /* "mtrand.pyx":4055 * mnarr = multin * mnix = mnarr.data * i = 0 # <<<<<<<<<<<<<< @@ -17868,7 +17872,7 @@ */ __pyx_v_i = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4056 + /* "mtrand.pyx":4056 * mnix = mnarr.data * i = 0 * while i < PyArray_SIZE(mnarr): # <<<<<<<<<<<<<< @@ -17879,7 +17883,7 @@ __pyx_t_3 = (__pyx_v_i < PyArray_SIZE(arrayObject_mnarr)); if (!__pyx_t_3) break; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4057 + /* "mtrand.pyx":4057 * i = 0 * while i < PyArray_SIZE(mnarr): * Sum = 1.0 # <<<<<<<<<<<<<< @@ -17888,7 +17892,7 @@ */ __pyx_v_Sum = 1.0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4058 + /* "mtrand.pyx":4058 * while i < PyArray_SIZE(mnarr): * Sum = 1.0 * dn = n # <<<<<<<<<<<<<< @@ -17897,7 +17901,7 @@ */ __pyx_v_dn = __pyx_v_n; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4059 + /* "mtrand.pyx":4059 * Sum = 1.0 * dn = n * for j from 0 <= j < d-1: # <<<<<<<<<<<<<< @@ -17907,7 +17911,7 @@ __pyx_t_6 = (__pyx_v_d - 1); for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_6; __pyx_v_j++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4060 + /* "mtrand.pyx":4060 * dn = n * for j from 0 <= j < d-1: * mnix[i+j] = rk_binomial(self.internal_state, dn, pix[j]/Sum) # <<<<<<<<<<<<<< @@ -17921,7 +17925,7 @@ } (__pyx_v_mnix[(__pyx_v_i + __pyx_v_j)]) = rk_binomial(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, __pyx_v_dn, (__pyx_t_7 / __pyx_v_Sum)); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4061 + /* "mtrand.pyx":4061 * for j from 0 <= j < d-1: * mnix[i+j] = rk_binomial(self.internal_state, dn, pix[j]/Sum) * dn = dn - mnix[i+j] # <<<<<<<<<<<<<< @@ -17930,7 +17934,7 @@ */ __pyx_v_dn = (__pyx_v_dn - (__pyx_v_mnix[(__pyx_v_i + __pyx_v_j)])); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4062 + /* "mtrand.pyx":4062 * mnix[i+j] = rk_binomial(self.internal_state, dn, pix[j]/Sum) * dn = dn - mnix[i+j] * if dn <= 0: # <<<<<<<<<<<<<< @@ -17940,7 +17944,7 @@ __pyx_t_3 = (__pyx_v_dn <= 0); if (__pyx_t_3) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4063 + /* "mtrand.pyx":4063 * dn = dn - mnix[i+j] * if dn <= 0: * break # <<<<<<<<<<<<<< @@ -17952,7 +17956,7 @@ } __pyx_L12:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4064 + /* "mtrand.pyx":4064 * if dn <= 0: * break * Sum = Sum - pix[j] # <<<<<<<<<<<<<< @@ -17963,7 +17967,7 @@ } __pyx_L11_break:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4065 + /* "mtrand.pyx":4065 * break * Sum = Sum - pix[j] * if dn > 0: # <<<<<<<<<<<<<< @@ -17973,7 +17977,7 @@ __pyx_t_3 = (__pyx_v_dn > 0); if (__pyx_t_3) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4066 + /* "mtrand.pyx":4066 * Sum = Sum - pix[j] * if dn > 0: * mnix[i+d-1] = dn # <<<<<<<<<<<<<< @@ -17985,7 +17989,7 @@ } __pyx_L13:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4068 + /* "mtrand.pyx":4068 * mnix[i+d-1] = dn * * i = i + d # <<<<<<<<<<<<<< @@ -17995,7 +17999,7 @@ __pyx_v_i = (__pyx_v_i + __pyx_v_d); } - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4070 + /* "mtrand.pyx":4070 * i = i + d * * return multin # <<<<<<<<<<<<<< @@ -18028,7 +18032,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4072 +/* "mtrand.pyx":4072 * return multin * * def dirichlet(self, object alpha, size=None): # <<<<<<<<<<<<<< @@ -18112,7 +18116,7 @@ __pyx_v_shape = Py_None; __Pyx_INCREF(Py_None); __pyx_v_diric = Py_None; __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4136 + /* "mtrand.pyx":4136 * cdef double acc, invacc * * k = len(alpha) # <<<<<<<<<<<<<< @@ -18122,7 +18126,7 @@ __pyx_t_1 = PyObject_Length(__pyx_v_alpha); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_k = __pyx_t_1; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4137 + /* "mtrand.pyx":4137 * * k = len(alpha) * alpha_arr = PyArray_ContiguousFromObject(alpha, NPY_DOUBLE, 1, 1) # <<<<<<<<<<<<<< @@ -18136,7 +18140,7 @@ __pyx_v_alpha_arr = ((PyArrayObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4138 + /* "mtrand.pyx":4138 * k = len(alpha) * alpha_arr = PyArray_ContiguousFromObject(alpha, NPY_DOUBLE, 1, 1) * alpha_data = alpha_arr.data # <<<<<<<<<<<<<< @@ -18145,7 +18149,7 @@ */ __pyx_v_alpha_data = ((double *)__pyx_v_alpha_arr->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4140 + /* "mtrand.pyx":4140 * alpha_data = alpha_arr.data * * if size is None: # <<<<<<<<<<<<<< @@ -18155,7 +18159,7 @@ __pyx_t_3 = (__pyx_v_size == Py_None); if (__pyx_t_3) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4141 + /* "mtrand.pyx":4141 * * if size is None: * shape = (k,) # <<<<<<<<<<<<<< @@ -18175,20 +18179,17 @@ goto __pyx_L6; } - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4142 + /* "mtrand.pyx":4142 * if size is None: * shape = (k,) * elif type(size) is int: # <<<<<<<<<<<<<< * shape = (size, k) * else: */ - __pyx_t_4 = ((PyObject *)__Pyx_Type(__pyx_v_size)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_3 = (__pyx_t_4 == ((PyObject*)&PyInt_Type)); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_size)) == ((PyObject *)((PyObject*)&PyInt_Type))); if (__pyx_t_3) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4143 + /* "mtrand.pyx":4143 * shape = (k,) * elif type(size) is int: * shape = (size, k) # <<<<<<<<<<<<<< @@ -18212,7 +18213,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4145 + /* "mtrand.pyx":4145 * shape = (size, k) * else: * shape = size + (k,) # <<<<<<<<<<<<<< @@ -18235,7 +18236,7 @@ } __pyx_L6:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4147 + /* "mtrand.pyx":4147 * shape = size + (k,) * * diric = np.zeros(shape, np.float64) # <<<<<<<<<<<<<< @@ -18268,7 +18269,7 @@ __pyx_v_diric = __pyx_t_5; __pyx_t_5 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4148 + /* "mtrand.pyx":4148 * * diric = np.zeros(shape, np.float64) * val_arr = diric # <<<<<<<<<<<<<< @@ -18279,7 +18280,7 @@ __Pyx_DECREF(((PyObject *)__pyx_v_val_arr)); __pyx_v_val_arr = ((PyArrayObject *)__pyx_v_diric); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4149 + /* "mtrand.pyx":4149 * diric = np.zeros(shape, np.float64) * val_arr = diric * val_data= val_arr.data # <<<<<<<<<<<<<< @@ -18288,7 +18289,7 @@ */ __pyx_v_val_data = ((double *)__pyx_v_val_arr->data); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4151 + /* "mtrand.pyx":4151 * val_data= val_arr.data * * i = 0 # <<<<<<<<<<<<<< @@ -18297,7 +18298,7 @@ */ __pyx_v_i = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4152 + /* "mtrand.pyx":4152 * * i = 0 * totsize = PyArray_SIZE(val_arr) # <<<<<<<<<<<<<< @@ -18306,7 +18307,7 @@ */ __pyx_v_totsize = PyArray_SIZE(__pyx_v_val_arr); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4153 + /* "mtrand.pyx":4153 * i = 0 * totsize = PyArray_SIZE(val_arr) * while i < totsize: # <<<<<<<<<<<<<< @@ -18317,7 +18318,7 @@ __pyx_t_3 = (__pyx_v_i < __pyx_v_totsize); if (!__pyx_t_3) break; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4154 + /* "mtrand.pyx":4154 * totsize = PyArray_SIZE(val_arr) * while i < totsize: * acc = 0.0 # <<<<<<<<<<<<<< @@ -18326,7 +18327,7 @@ */ __pyx_v_acc = 0.0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4155 + /* "mtrand.pyx":4155 * while i < totsize: * acc = 0.0 * for j from 0 <= j < k: # <<<<<<<<<<<<<< @@ -18336,7 +18337,7 @@ __pyx_t_6 = __pyx_v_k; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_6; __pyx_v_j++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4156 + /* "mtrand.pyx":4156 * acc = 0.0 * for j from 0 <= j < k: * val_data[i+j] = rk_standard_gamma(self.internal_state, alpha_data[j]) # <<<<<<<<<<<<<< @@ -18345,7 +18346,7 @@ */ (__pyx_v_val_data[(__pyx_v_i + __pyx_v_j)]) = rk_standard_gamma(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, (__pyx_v_alpha_data[__pyx_v_j])); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4157 + /* "mtrand.pyx":4157 * for j from 0 <= j < k: * val_data[i+j] = rk_standard_gamma(self.internal_state, alpha_data[j]) * acc = acc + val_data[i+j] # <<<<<<<<<<<<<< @@ -18355,7 +18356,7 @@ __pyx_v_acc = (__pyx_v_acc + (__pyx_v_val_data[(__pyx_v_i + __pyx_v_j)])); } - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4158 + /* "mtrand.pyx":4158 * val_data[i+j] = rk_standard_gamma(self.internal_state, alpha_data[j]) * acc = acc + val_data[i+j] * invacc = 1/acc # <<<<<<<<<<<<<< @@ -18368,7 +18369,7 @@ } __pyx_v_invacc = (1 / __pyx_v_acc); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4159 + /* "mtrand.pyx":4159 * acc = acc + val_data[i+j] * invacc = 1/acc * for j from 0 <= j < k: # <<<<<<<<<<<<<< @@ -18378,7 +18379,7 @@ __pyx_t_6 = __pyx_v_k; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_6; __pyx_v_j++) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4160 + /* "mtrand.pyx":4160 * invacc = 1/acc * for j from 0 <= j < k: * val_data[i+j] = val_data[i+j] * invacc # <<<<<<<<<<<<<< @@ -18388,7 +18389,7 @@ (__pyx_v_val_data[(__pyx_v_i + __pyx_v_j)]) = ((__pyx_v_val_data[(__pyx_v_i + __pyx_v_j)]) * __pyx_v_invacc); } - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4161 + /* "mtrand.pyx":4161 * for j from 0 <= j < k: * val_data[i+j] = val_data[i+j] * invacc * i = i + k # <<<<<<<<<<<<<< @@ -18398,7 +18399,7 @@ __pyx_v_i = (__pyx_v_i + __pyx_v_k); } - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4163 + /* "mtrand.pyx":4163 * i = i + k * * return diric # <<<<<<<<<<<<<< @@ -18431,7 +18432,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4166 +/* "mtrand.pyx":4166 * * # Shuffling and permutations: * def shuffle(self, object x): # <<<<<<<<<<<<<< @@ -18456,7 +18457,7 @@ __Pyx_INCREF((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_v_x); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4176 + /* "mtrand.pyx":4176 * cdef int copy * * i = len(x) - 1 # <<<<<<<<<<<<<< @@ -18466,7 +18467,7 @@ __pyx_t_1 = PyObject_Length(__pyx_v_x); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_i = (__pyx_t_1 - 1); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4177 + /* "mtrand.pyx":4177 * * i = len(x) - 1 * try: # <<<<<<<<<<<<<< @@ -18481,7 +18482,7 @@ __Pyx_XGOTREF(__pyx_save_exc_tb); /*try:*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4178 + /* "mtrand.pyx":4178 * i = len(x) - 1 * try: * j = len(x[0]) # <<<<<<<<<<<<<< @@ -18501,7 +18502,7 @@ __pyx_L5_error:; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4179 + /* "mtrand.pyx":4179 * try: * j = len(x[0]) * except: # <<<<<<<<<<<<<< @@ -18515,7 +18516,7 @@ __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_4); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4180 + /* "mtrand.pyx":4180 * j = len(x[0]) * except: * j = 0 # <<<<<<<<<<<<<< @@ -18542,7 +18543,7 @@ __pyx_L12_try_end:; } - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4182 + /* "mtrand.pyx":4182 * j = 0 * * if (j == 0): # <<<<<<<<<<<<<< @@ -18552,7 +18553,7 @@ __pyx_t_5 = (__pyx_v_j == 0); if (__pyx_t_5) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4184 + /* "mtrand.pyx":4184 * if (j == 0): * # adaptation of random.shuffle() * while i > 0: # <<<<<<<<<<<<<< @@ -18563,7 +18564,7 @@ __pyx_t_5 = (__pyx_v_i > 0); if (!__pyx_t_5) break; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4185 + /* "mtrand.pyx":4185 * # adaptation of random.shuffle() * while i > 0: * j = rk_interval(i, self.internal_state) # <<<<<<<<<<<<<< @@ -18572,7 +18573,7 @@ */ __pyx_v_j = rk_interval(__pyx_v_i, ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4186 + /* "mtrand.pyx":4186 * while i > 0: * j = rk_interval(i, self.internal_state) * x[i], x[j] = x[j], x[i] # <<<<<<<<<<<<<< @@ -18588,7 +18589,7 @@ if (__Pyx_SetItemInt(__pyx_v_x, __pyx_v_j, __pyx_t_3, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4187 + /* "mtrand.pyx":4187 * j = rk_interval(i, self.internal_state) * x[i], x[j] = x[j], x[i] * i = i - 1 # <<<<<<<<<<<<<< @@ -18601,7 +18602,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4190 + /* "mtrand.pyx":4190 * else: * # make copies * copy = hasattr(x[0], 'copy') # <<<<<<<<<<<<<< @@ -18614,7 +18615,7 @@ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_copy = __pyx_t_5; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4191 + /* "mtrand.pyx":4191 * # make copies * copy = hasattr(x[0], 'copy') * if copy: # <<<<<<<<<<<<<< @@ -18624,7 +18625,7 @@ __pyx_t_6 = __pyx_v_copy; if (__pyx_t_6) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4192 + /* "mtrand.pyx":4192 * copy = hasattr(x[0], 'copy') * if copy: * while(i > 0): # <<<<<<<<<<<<<< @@ -18635,7 +18636,7 @@ __pyx_t_5 = (__pyx_v_i > 0); if (!__pyx_t_5) break; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4193 + /* "mtrand.pyx":4193 * if copy: * while(i > 0): * j = rk_interval(i, self.internal_state) # <<<<<<<<<<<<<< @@ -18644,7 +18645,7 @@ */ __pyx_v_j = rk_interval(__pyx_v_i, ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4194 + /* "mtrand.pyx":4194 * while(i > 0): * j = rk_interval(i, self.internal_state) * x[i], x[j] = x[j].copy(), x[i].copy() # <<<<<<<<<<<<<< @@ -18672,7 +18673,7 @@ if (__Pyx_SetItemInt(__pyx_v_x, __pyx_v_j, __pyx_t_4, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4195 + /* "mtrand.pyx":4195 * j = rk_interval(i, self.internal_state) * x[i], x[j] = x[j].copy(), x[i].copy() * i = i - 1 # <<<<<<<<<<<<<< @@ -18685,7 +18686,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4197 + /* "mtrand.pyx":4197 * i = i - 1 * else: * while(i > 0): # <<<<<<<<<<<<<< @@ -18696,7 +18697,7 @@ __pyx_t_5 = (__pyx_v_i > 0); if (!__pyx_t_5) break; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4198 + /* "mtrand.pyx":4198 * else: * while(i > 0): * j = rk_interval(i, self.internal_state) # <<<<<<<<<<<<<< @@ -18705,7 +18706,7 @@ */ __pyx_v_j = rk_interval(__pyx_v_i, ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4199 + /* "mtrand.pyx":4199 * while(i > 0): * j = rk_interval(i, self.internal_state) * x[i], x[j] = x[j][:], x[i][:] # <<<<<<<<<<<<<< @@ -18727,7 +18728,7 @@ if (__Pyx_SetItemInt(__pyx_v_x, __pyx_v_j, __pyx_t_2, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4200 + /* "mtrand.pyx":4200 * j = rk_interval(i, self.internal_state) * x[i], x[j] = x[j][:], x[i][:] * i = i - 1 # <<<<<<<<<<<<<< @@ -18757,7 +18758,7 @@ return __pyx_r; } -/* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4202 +/* "mtrand.pyx":4202 * i = i - 1 * * def permutation(self, object x): # <<<<<<<<<<<<<< @@ -18779,10 +18780,10 @@ __Pyx_INCREF(__pyx_v_x); __pyx_v_arr = Py_None; __Pyx_INCREF(Py_None); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4229 + /* "mtrand.pyx":4229 * * """ - * if isinstance(x, (int, np.integer)): # <<<<<<<<<<<<<< + * if isinstance(x, (int, long, np.integer)): # <<<<<<<<<<<<<< * arr = np.arange(x) * else: */ @@ -18791,21 +18792,24 @@ __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__integer); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)((PyObject*)&PyInt_Type))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)&PyInt_Type))); __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyInt_Type))); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); + __Pyx_INCREF(((PyObject *)((PyObject*)&PyLong_Type))); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)((PyObject*)&PyLong_Type))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyLong_Type))); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_3 = PyObject_IsInstance(__pyx_v_x, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4230 + /* "mtrand.pyx":4230 * """ - * if isinstance(x, (int, np.integer)): + * if isinstance(x, (int, long, np.integer)): * arr = np.arange(x) # <<<<<<<<<<<<<< * else: * arr = np.array(x) @@ -18831,7 +18835,7 @@ } /*else*/ { - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4232 + /* "mtrand.pyx":4232 * arr = np.arange(x) * else: * arr = np.array(x) # <<<<<<<<<<<<<< @@ -18858,7 +18862,7 @@ } __pyx_L5:; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4233 + /* "mtrand.pyx":4233 * else: * arr = np.array(x) * self.shuffle(arr) # <<<<<<<<<<<<<< @@ -18878,7 +18882,7 @@ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4234 + /* "mtrand.pyx":4234 * arr = np.array(x) * self.shuffle(arr) * return arr # <<<<<<<<<<<<<< @@ -19437,10 +19441,10 @@ /*--- Global init code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ - __pyx_ptype_6mtrand_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr)); if (unlikely(!__pyx_ptype_6mtrand_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6mtrand_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject)); if (unlikely(!__pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6mtrand_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject)); if (unlikely(!__pyx_ptype_6mtrand_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6mtrand_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject)); if (unlikely(!__pyx_ptype_6mtrand_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6mtrand_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_6mtrand_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6mtrand_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6mtrand_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_6mtrand_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6mtrand_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_6mtrand_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyType_Ready(&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "RandomState", (PyObject *)&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_6mtrand_RandomState = &__pyx_type_6mtrand_RandomState; @@ -19448,7 +19452,7 @@ /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":124 + /* "mtrand.pyx":124 * * # Initialize numpy * import_array() # <<<<<<<<<<<<<< @@ -19457,7 +19461,7 @@ */ import_array(); - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":126 + /* "mtrand.pyx":126 * import_array() * * import numpy as np # <<<<<<<<<<<<<< @@ -19469,7 +19473,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":893 + /* "mtrand.pyx":893 * return bytestring * * def uniform(self, low=0.0, high=1.0, size=None): # <<<<<<<<<<<<<< @@ -19487,7 +19491,7 @@ __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1190 + /* "mtrand.pyx":1190 * return cont0_array(self.internal_state, rk_gauss, size) * * def normal(self, loc=0.0, scale=1.0, size=None): # <<<<<<<<<<<<<< @@ -19505,7 +19509,7 @@ __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1349 + /* "mtrand.pyx":1349 * return cont2_array(self.internal_state, rk_beta, size, oa, ob) * * def exponential(self, scale=1.0, size=None): # <<<<<<<<<<<<<< @@ -19518,7 +19522,7 @@ __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1513 + /* "mtrand.pyx":1513 * return cont1_array(self.internal_state, rk_standard_gamma, size, oshape) * * def gamma(self, shape, scale=1.0, size=None): # <<<<<<<<<<<<<< @@ -19531,7 +19535,7 @@ __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2529 + /* "mtrand.pyx":2529 * return cont1_array(self.internal_state, rk_power, size, oa) * * def laplace(self, loc=0.0, scale=1.0, size=None): # <<<<<<<<<<<<<< @@ -19549,7 +19553,7 @@ __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2619 + /* "mtrand.pyx":2619 * return cont2_array(self.internal_state, rk_laplace, size, oloc, oscale) * * def gumbel(self, loc=0.0, scale=1.0, size=None): # <<<<<<<<<<<<<< @@ -19567,7 +19571,7 @@ __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2743 + /* "mtrand.pyx":2743 * return cont2_array(self.internal_state, rk_gumbel, size, oloc, oscale) * * def logistic(self, loc=0.0, scale=1.0, size=None): # <<<<<<<<<<<<<< @@ -19585,7 +19589,7 @@ __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2831 + /* "mtrand.pyx":2831 * return cont2_array(self.internal_state, rk_logistic, size, oloc, oscale) * * def lognormal(self, mean=0.0, sigma=1.0, size=None): # <<<<<<<<<<<<<< @@ -19603,7 +19607,7 @@ __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":2962 + /* "mtrand.pyx":2962 * return cont2_array(self.internal_state, rk_lognormal, size, omean, osigma) * * def rayleigh(self, scale=1.0, size=None): # <<<<<<<<<<<<<< @@ -19616,7 +19620,7 @@ __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":3411 + /* "mtrand.pyx":3411 * on, op) * * def poisson(self, lam=1.0, size=None): # <<<<<<<<<<<<<< @@ -19629,7 +19633,7 @@ __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4236 + /* "mtrand.pyx":4236 * return arr * * _rand = RandomState() # <<<<<<<<<<<<<< @@ -19641,7 +19645,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s___rand, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4237 + /* "mtrand.pyx":4237 * * _rand = RandomState() * seed = _rand.seed # <<<<<<<<<<<<<< @@ -19656,7 +19660,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__seed, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4238 + /* "mtrand.pyx":4238 * _rand = RandomState() * seed = _rand.seed * get_state = _rand.get_state # <<<<<<<<<<<<<< @@ -19671,7 +19675,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_state, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4239 + /* "mtrand.pyx":4239 * seed = _rand.seed * get_state = _rand.get_state * set_state = _rand.set_state # <<<<<<<<<<<<<< @@ -19686,7 +19690,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_state, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4240 + /* "mtrand.pyx":4240 * get_state = _rand.get_state * set_state = _rand.set_state * random_sample = _rand.random_sample # <<<<<<<<<<<<<< @@ -19701,7 +19705,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__random_sample, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4241 + /* "mtrand.pyx":4241 * set_state = _rand.set_state * random_sample = _rand.random_sample * randint = _rand.randint # <<<<<<<<<<<<<< @@ -19716,7 +19720,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__randint, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4242 + /* "mtrand.pyx":4242 * random_sample = _rand.random_sample * randint = _rand.randint * bytes = _rand.bytes # <<<<<<<<<<<<<< @@ -19731,7 +19735,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__bytes, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4243 + /* "mtrand.pyx":4243 * randint = _rand.randint * bytes = _rand.bytes * uniform = _rand.uniform # <<<<<<<<<<<<<< @@ -19746,7 +19750,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__uniform, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4244 + /* "mtrand.pyx":4244 * bytes = _rand.bytes * uniform = _rand.uniform * rand = _rand.rand # <<<<<<<<<<<<<< @@ -19761,7 +19765,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__rand, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4245 + /* "mtrand.pyx":4245 * uniform = _rand.uniform * rand = _rand.rand * randn = _rand.randn # <<<<<<<<<<<<<< @@ -19776,7 +19780,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__randn, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4246 + /* "mtrand.pyx":4246 * rand = _rand.rand * randn = _rand.randn * random_integers = _rand.random_integers # <<<<<<<<<<<<<< @@ -19791,7 +19795,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__random_integers, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4247 + /* "mtrand.pyx":4247 * randn = _rand.randn * random_integers = _rand.random_integers * standard_normal = _rand.standard_normal # <<<<<<<<<<<<<< @@ -19806,7 +19810,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__standard_normal, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4248 + /* "mtrand.pyx":4248 * random_integers = _rand.random_integers * standard_normal = _rand.standard_normal * normal = _rand.normal # <<<<<<<<<<<<<< @@ -19821,7 +19825,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__normal, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4249 + /* "mtrand.pyx":4249 * standard_normal = _rand.standard_normal * normal = _rand.normal * beta = _rand.beta # <<<<<<<<<<<<<< @@ -19836,7 +19840,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__beta, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4250 + /* "mtrand.pyx":4250 * normal = _rand.normal * beta = _rand.beta * exponential = _rand.exponential # <<<<<<<<<<<<<< @@ -19851,7 +19855,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__exponential, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4251 + /* "mtrand.pyx":4251 * beta = _rand.beta * exponential = _rand.exponential * standard_exponential = _rand.standard_exponential # <<<<<<<<<<<<<< @@ -19866,7 +19870,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s_59, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4252 + /* "mtrand.pyx":4252 * exponential = _rand.exponential * standard_exponential = _rand.standard_exponential * standard_gamma = _rand.standard_gamma # <<<<<<<<<<<<<< @@ -19881,7 +19885,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__standard_gamma, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4253 + /* "mtrand.pyx":4253 * standard_exponential = _rand.standard_exponential * standard_gamma = _rand.standard_gamma * gamma = _rand.gamma # <<<<<<<<<<<<<< @@ -19896,7 +19900,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gamma, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4254 + /* "mtrand.pyx":4254 * standard_gamma = _rand.standard_gamma * gamma = _rand.gamma * f = _rand.f # <<<<<<<<<<<<<< @@ -19911,7 +19915,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__f, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4255 + /* "mtrand.pyx":4255 * gamma = _rand.gamma * f = _rand.f * noncentral_f = _rand.noncentral_f # <<<<<<<<<<<<<< @@ -19926,7 +19930,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__noncentral_f, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4256 + /* "mtrand.pyx":4256 * f = _rand.f * noncentral_f = _rand.noncentral_f * chisquare = _rand.chisquare # <<<<<<<<<<<<<< @@ -19941,7 +19945,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__chisquare, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4257 + /* "mtrand.pyx":4257 * noncentral_f = _rand.noncentral_f * chisquare = _rand.chisquare * noncentral_chisquare = _rand.noncentral_chisquare # <<<<<<<<<<<<<< @@ -19956,7 +19960,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s_60, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4258 + /* "mtrand.pyx":4258 * chisquare = _rand.chisquare * noncentral_chisquare = _rand.noncentral_chisquare * standard_cauchy = _rand.standard_cauchy # <<<<<<<<<<<<<< @@ -19971,7 +19975,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__standard_cauchy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4259 + /* "mtrand.pyx":4259 * noncentral_chisquare = _rand.noncentral_chisquare * standard_cauchy = _rand.standard_cauchy * standard_t = _rand.standard_t # <<<<<<<<<<<<<< @@ -19986,7 +19990,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__standard_t, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4260 + /* "mtrand.pyx":4260 * standard_cauchy = _rand.standard_cauchy * standard_t = _rand.standard_t * vonmises = _rand.vonmises # <<<<<<<<<<<<<< @@ -20001,7 +20005,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__vonmises, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4261 + /* "mtrand.pyx":4261 * standard_t = _rand.standard_t * vonmises = _rand.vonmises * pareto = _rand.pareto # <<<<<<<<<<<<<< @@ -20016,7 +20020,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pareto, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4262 + /* "mtrand.pyx":4262 * vonmises = _rand.vonmises * pareto = _rand.pareto * weibull = _rand.weibull # <<<<<<<<<<<<<< @@ -20031,7 +20035,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__weibull, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4263 + /* "mtrand.pyx":4263 * pareto = _rand.pareto * weibull = _rand.weibull * power = _rand.power # <<<<<<<<<<<<<< @@ -20046,7 +20050,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__power, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4264 + /* "mtrand.pyx":4264 * weibull = _rand.weibull * power = _rand.power * laplace = _rand.laplace # <<<<<<<<<<<<<< @@ -20061,7 +20065,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__laplace, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4265 + /* "mtrand.pyx":4265 * power = _rand.power * laplace = _rand.laplace * gumbel = _rand.gumbel # <<<<<<<<<<<<<< @@ -20076,7 +20080,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gumbel, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4266 + /* "mtrand.pyx":4266 * laplace = _rand.laplace * gumbel = _rand.gumbel * logistic = _rand.logistic # <<<<<<<<<<<<<< @@ -20091,7 +20095,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__logistic, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4267 + /* "mtrand.pyx":4267 * gumbel = _rand.gumbel * logistic = _rand.logistic * lognormal = _rand.lognormal # <<<<<<<<<<<<<< @@ -20106,7 +20110,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__lognormal, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4268 + /* "mtrand.pyx":4268 * logistic = _rand.logistic * lognormal = _rand.lognormal * rayleigh = _rand.rayleigh # <<<<<<<<<<<<<< @@ -20121,7 +20125,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__rayleigh, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4269 + /* "mtrand.pyx":4269 * lognormal = _rand.lognormal * rayleigh = _rand.rayleigh * wald = _rand.wald # <<<<<<<<<<<<<< @@ -20136,7 +20140,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__wald, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4270 + /* "mtrand.pyx":4270 * rayleigh = _rand.rayleigh * wald = _rand.wald * triangular = _rand.triangular # <<<<<<<<<<<<<< @@ -20151,7 +20155,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__triangular, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4272 + /* "mtrand.pyx":4272 * triangular = _rand.triangular * * binomial = _rand.binomial # <<<<<<<<<<<<<< @@ -20166,7 +20170,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__binomial, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4273 + /* "mtrand.pyx":4273 * * binomial = _rand.binomial * negative_binomial = _rand.negative_binomial # <<<<<<<<<<<<<< @@ -20181,7 +20185,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__negative_binomial, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4274 + /* "mtrand.pyx":4274 * binomial = _rand.binomial * negative_binomial = _rand.negative_binomial * poisson = _rand.poisson # <<<<<<<<<<<<<< @@ -20196,7 +20200,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__poisson, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4275 + /* "mtrand.pyx":4275 * negative_binomial = _rand.negative_binomial * poisson = _rand.poisson * zipf = _rand.zipf # <<<<<<<<<<<<<< @@ -20211,7 +20215,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__zipf, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4276 + /* "mtrand.pyx":4276 * poisson = _rand.poisson * zipf = _rand.zipf * geometric = _rand.geometric # <<<<<<<<<<<<<< @@ -20226,7 +20230,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__geometric, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4277 + /* "mtrand.pyx":4277 * zipf = _rand.zipf * geometric = _rand.geometric * hypergeometric = _rand.hypergeometric # <<<<<<<<<<<<<< @@ -20241,7 +20245,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__hypergeometric, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4278 + /* "mtrand.pyx":4278 * geometric = _rand.geometric * hypergeometric = _rand.hypergeometric * logseries = _rand.logseries # <<<<<<<<<<<<<< @@ -20256,7 +20260,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__logseries, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4280 + /* "mtrand.pyx":4280 * logseries = _rand.logseries * * multivariate_normal = _rand.multivariate_normal # <<<<<<<<<<<<<< @@ -20271,7 +20275,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__multivariate_normal, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4281 + /* "mtrand.pyx":4281 * * multivariate_normal = _rand.multivariate_normal * multinomial = _rand.multinomial # <<<<<<<<<<<<<< @@ -20286,7 +20290,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__multinomial, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4282 + /* "mtrand.pyx":4282 * multivariate_normal = _rand.multivariate_normal * multinomial = _rand.multinomial * dirichlet = _rand.dirichlet # <<<<<<<<<<<<<< @@ -20301,7 +20305,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__dirichlet, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4284 + /* "mtrand.pyx":4284 * dirichlet = _rand.dirichlet * * shuffle = _rand.shuffle # <<<<<<<<<<<<<< @@ -20315,7 +20319,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__shuffle, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":4285 + /* "mtrand.pyx":4285 * * shuffle = _rand.shuffle * permutation = _rand.permutation # <<<<<<<<<<<<<< @@ -20328,7 +20332,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__permutation, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/charris/Workspace/numpy.git/numpy/random/mtrand/mtrand.pyx":1 + /* "mtrand.pyx":1 * # mtrand.pyx -- A Pyrex wrapper of Jean-Sebastien Roy's RandomKit # <<<<<<<<<<<<<< * # * # Copyright 2005 Robert Kern (robert.kern at gmail.com) @@ -20961,7 +20965,7 @@ } -static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, #if PY_VERSION_HEX < 0x02050000 "need more than %d value%s to unpack", (int)index, @@ -20971,7 +20975,7 @@ (index == 1) ? "" : "s"); } -static INLINE void __Pyx_RaiseTooManyValuesError(void) { +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void) { PyErr_SetString(PyExc_ValueError, "too many values to unpack"); } @@ -21044,7 +21048,7 @@ } -static INLINE int __Pyx_CheckKeywordStrings( +static CYTHON_INLINE int __Pyx_CheckKeywordStrings( PyObject *kwdict, const char* function_name, int kw_allowed) @@ -21078,7 +21082,7 @@ return 0; } -static INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; @@ -21091,7 +21095,7 @@ } -static INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->exc_type; *value = tstate->exc_value; @@ -21156,7 +21160,7 @@ return result; } -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); @@ -21171,7 +21175,7 @@ Py_XDECREF(tmp_tb); } -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; @@ -21293,7 +21297,7 @@ } #endif -static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { const unsigned char neg_one = (unsigned char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { @@ -21312,7 +21316,7 @@ return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { const unsigned short neg_one = (unsigned short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { @@ -21331,7 +21335,7 @@ return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { const unsigned int neg_one = (unsigned int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { @@ -21350,7 +21354,7 @@ return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE char __Pyx_PyInt_AsChar(PyObject* x) { +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { const char neg_one = (char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { @@ -21369,7 +21373,7 @@ return (char)__Pyx_PyInt_AsLong(x); } -static INLINE short __Pyx_PyInt_AsShort(PyObject* x) { +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { const short neg_one = (short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { @@ -21388,7 +21392,7 @@ return (short)__Pyx_PyInt_AsLong(x); } -static INLINE int __Pyx_PyInt_AsInt(PyObject* x) { +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { @@ -21407,7 +21411,7 @@ return (int)__Pyx_PyInt_AsLong(x); } -static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { const signed char neg_one = (signed char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { @@ -21426,7 +21430,7 @@ return (signed char)__Pyx_PyInt_AsSignedLong(x); } -static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { const signed short neg_one = (signed short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { @@ -21445,7 +21449,7 @@ return (signed short)__Pyx_PyInt_AsSignedLong(x); } -static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { const signed int neg_one = (signed int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { @@ -21464,7 +21468,7 @@ return (signed int)__Pyx_PyInt_AsSignedLong(x); } -static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -21499,7 +21503,7 @@ } } -static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -21534,7 +21538,7 @@ } } -static INLINE long __Pyx_PyInt_AsLong(PyObject* x) { +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { const long neg_one = (long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -21569,7 +21573,7 @@ } } -static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -21604,7 +21608,7 @@ } } -static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { const signed long neg_one = (signed long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -21639,7 +21643,7 @@ } } -static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -21677,11 +21681,12 @@ #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - long size) + long size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; + char warning[200]; py_module = __Pyx_ImportModule(module_name); if (!py_module) @@ -21706,9 +21711,15 @@ module_name, class_name); goto bad; } - if (((PyTypeObject *)result)->tp_basicsize != size) { + if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + PyErr_WarnEx(NULL, warning, 0); + } + else if (((PyTypeObject *)result)->tp_basicsize != size) { PyErr_Format(PyExc_ValueError, - "%s.%s does not appear to be the correct type object", + "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; } @@ -21844,13 +21855,13 @@ /* Type Conversion Functions */ -static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (x == Py_True) return 1; else if ((x == Py_False) | (x == Py_None)) return 0; else return PyObject_IsTrue(x); } -static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; @@ -21896,7 +21907,7 @@ return res; } -static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; @@ -21905,7 +21916,7 @@ return ival; } -static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); @@ -21919,7 +21930,7 @@ #endif } -static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { return (size_t)-1; From numpy-svn at scipy.org Fri Jul 9 04:12:06 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 9 Jul 2010 03:12:06 -0500 (CDT) Subject: [Numpy-svn] r8476 - trunk/numpy/random/mtrand Message-ID: <20100709081206.C4D9B39CAEA@scipy.org> Author: ptvirtan Date: 2010-07-09 03:12:04 -0500 (Fri, 09 Jul 2010) New Revision: 8476 Modified: trunk/numpy/random/mtrand/generate_mtrand_c.py Log: ENH: random: strip absolute paths from generated mtrand.c line number comments; they just add unnecessary noise to the changesets Modified: trunk/numpy/random/mtrand/generate_mtrand_c.py =================================================================== --- trunk/numpy/random/mtrand/generate_mtrand_c.py 2010-07-09 08:11:54 UTC (rev 8475) +++ trunk/numpy/random/mtrand/generate_mtrand_c.py 2010-07-09 08:12:04 UTC (rev 8476) @@ -20,6 +20,7 @@ processed = open('mtrand_pp.c', 'w') unused_funcs_str = '(' + '|'.join(unused_internal_funcs) + ')' uifpat = re.compile(r'static \w+ \*?'+unused_funcs_str+r'.*/\*proto\*/') + linepat = re.compile(r'/\* ".*/mtrand.pyx":') for linenum, line in enumerate(mtrand_c): m = re.match(r'^(\s+arrayObject\w*\s*=\s*[(])[(]PyObject\s*[*][)]', line) @@ -33,6 +34,7 @@ print >>sys.stderr, \ "%s was declared unused, but is used at line %d" % (m.group(), linenum+1) + line = linepat.sub(r'/* "mtrand.pyx":', line) processed.write(line) mtrand_c.close() processed.close() From numpy-svn at scipy.org Fri Jul 9 04:12:15 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 9 Jul 2010 03:12:15 -0500 (CDT) Subject: [Numpy-svn] r8477 - in trunk/numpy/core: src/multiarray tests Message-ID: <20100709081215.5B71B39CAEA@scipy.org> Author: ptvirtan Date: 2010-07-09 03:12:15 -0500 (Fri, 09 Jul 2010) New Revision: 8477 Modified: trunk/numpy/core/src/multiarray/convert_datatype.c trunk/numpy/core/tests/test_regression.py Log: BUG: core: handle sizeof(double) == sizeof(longdouble) in PyArray_CanCastSafely (fixes #1539) Thanks to Christoph Gohlke for the patch. Modified: trunk/numpy/core/src/multiarray/convert_datatype.c =================================================================== --- trunk/numpy/core/src/multiarray/convert_datatype.c 2010-07-09 08:12:04 UTC (rev 8476) +++ trunk/numpy/core/src/multiarray/convert_datatype.c 2010-07-09 08:12:15 UTC (rev 8477) @@ -634,13 +634,23 @@ if (PyTypeNum_ISCOMPLEX(totype)) { return (telsize >> 1) >= felsize; } + else if (PyTypeNum_ISFLOAT(totype) && (telsize == felsize)) { + /* On some systems, double == longdouble */ + return 1; + } else { return totype > fromtype; } case PyArray_CFLOAT: case PyArray_CDOUBLE: case PyArray_CLONGDOUBLE: - return totype > fromtype; + if (PyTypeNum_ISCOMPLEX(totype) && (telsize == felsize)) { + /* On some systems, double == longdouble */ + return 1; + } + else { + return totype > fromtype; + } case PyArray_STRING: case PyArray_UNICODE: return totype > fromtype; Modified: trunk/numpy/core/tests/test_regression.py =================================================================== --- trunk/numpy/core/tests/test_regression.py 2010-07-09 08:12:04 UTC (rev 8476) +++ trunk/numpy/core/tests/test_regression.py 2010-07-09 08:12:15 UTC (rev 8477) @@ -1302,5 +1302,23 @@ # Ticket #1345: the following should not cause a crash np.fromstring(asbytes('aa, aa, 1.0'), sep=',') + def test_issue1539(self): + dtypes = [x for x in np.typeDict.values() + if (issubclass(x, np.number) + and not issubclass(x, np.timeinteger))] + a = np.array([], dtypes[0]) + failures = [] + for x in dtypes: + b = a.astype(x) + for y in dtypes: + c = a.astype(y) + try: + np.dot(b, c) + except TypeError, e: + failures.append((x, y)) + if failures: + raise AssertionError("Failures: %r" % failures) + + if __name__ == "__main__": run_module_suite() From numpy-svn at scipy.org Sun Jul 11 02:06:58 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 11 Jul 2010 01:06:58 -0500 (CDT) Subject: [Numpy-svn] r8478 - trunk/numpy/f2py Message-ID: <20100711060658.5AD5A39CAE7@scipy.org> Author: pearu Date: 2010-07-11 01:06:58 -0500 (Sun, 11 Jul 2010) New Revision: 8478 Modified: trunk/numpy/f2py/cfuncs.py Log: f2py: fixed typos in TRYCOMPLEXPYARRAYTEMPLATE. Modified: trunk/numpy/f2py/cfuncs.py =================================================================== --- trunk/numpy/f2py/cfuncs.py 2010-07-09 08:12:15 UTC (rev 8477) +++ trunk/numpy/f2py/cfuncs.py 2010-07-11 06:06:58 UTC (rev 8478) @@ -342,10 +342,7 @@ case PyArray_SHORT: *(short *)(arr->data)=(*v).r; break;\\ case PyArray_UBYTE: *(unsigned char *)(arr->data)=(*v).r; break;\\ case PyArray_BYTE: *(signed char *)(arr->data)=(*v).r; break;\\ - case PyArray_BOOL: *(npy_bool *)(arr->data)=((*v).r!=0 && (*v).i!=0)); break;\\ - case PyArray_UBYTE: *(unsigned char *)(arr->data)=(*v).r; break;\\ - case PyArray_BYTE: *(signed char *)(arr->data)=(*v).r; break;\\ - case PyArray_SHORT: *(short *)(arr->data)=(*v).r; break;\\ + case PyArray_BOOL: *(npy_bool *)(arr->data)=((*v).r!=0 && (*v).i!=0); break;\\ case PyArray_USHORT: *(npy_ushort *)(arr->data)=(*v).r; break;\\ case PyArray_UINT: *(npy_uint *)(arr->data)=(*v).r; break;\\ case PyArray_ULONG: *(npy_ulong *)(arr->data)=(*v).r; break;\\ From numpy-svn at scipy.org Sun Jul 11 09:56:55 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 11 Jul 2010 08:56:55 -0500 (CDT) Subject: [Numpy-svn] r8479 - trunk/doc Message-ID: <20100711135655.89D1939CAEA@scipy.org> Author: ptvirtan Date: 2010-07-11 08:56:55 -0500 (Sun, 11 Jul 2010) New Revision: 8479 Modified: trunk/doc/Py3K.txt Log: DOC: update Py3K.txt a bit Modified: trunk/doc/Py3K.txt =================================================================== --- trunk/doc/Py3K.txt 2010-07-11 06:06:58 UTC (rev 8478) +++ trunk/doc/Py3K.txt 2010-07-11 13:56:55 UTC (rev 8479) @@ -4,7 +4,7 @@ Developer notes on the transition to Python 3 ********************************************* -:date: 2009-12-05 +:date: 2010-07-11 :author: Charles R. Harris :author: Pauli Virtanen @@ -45,7 +45,7 @@ As a side effect, the Py3 adaptation has caused the following semantic changes that are visible on Py2. -* Objects (non-string, non-unicode) that implement the PEP 3118 array interface +* Objects (except bytes and str) that implement the PEP 3118 array interface will behave as ndarrays in `array(...)` and `asarray(...)`; the same way as if they had ``__array_interface__`` defined. @@ -72,12 +72,8 @@ ``__array_interface__`` attribute, ie., they behave as if they were an ndarray view on the data. -.. todo:: - Check for any other changes ... This we want in the end to include - in the release notes, and also in a "how to port" document. - Python code =========== @@ -93,8 +89,8 @@ Only changed files will be re-converted when setup.py is called a second time, making development much faster. -Currently, this seems to handle most (all?) of the necessary Python -code conversion. +Currently, this seems to handle all of the necessary Python code +conversion. Not all of the 2to3 transformations are appropriate for all files. Especially, 2to3 seems to be quite trigger-happy in replacing e.g. @@ -102,25 +98,24 @@ For files that need special handling, add entries to ``tools/py3tool.py``. -.. todo:: - Should we be a good citizen and use ``lib2to3`` instead? -.. todo:: - - Do we want to get rid of this hack in the long run? - - numpy.compat.py3k ----------------- There are some utility functions needed for 3K compatibility in ``numpy.compat.py3k`` -- they can be imported from ``numpy.compat``: -- bytes: bytes constructor +- bytes, unicode: bytes and unicode constructors - asbytes: convert string to bytes (no-op on Py2) +- asbytes_nested: convert strings in lists to Bytes +- asunicode: convert string to unicode +- asunicode_nested: convert strings in lists to Unicode +- asstr: convert item to the str type - getexception: get current exception (see below) - isfileobj: detect Python file objects +- strchar: character for Unicode (Py3) or Strings (Py2) +- open_latin1: open file in the latin1 text mode More can be added as needed. @@ -128,17 +123,9 @@ numpy.f2py ---------- -F2py is now mostly ported to Py3. +F2py is ported to Py3. -Simple programs seem to work, as well as its test suite (which does -not exercise all its features). -.. todo:: - - Extend the test suite to more complicated cases, and fix bugs - encountered. - - Bytes vs. strings ----------------- @@ -151,16 +138,9 @@ Syntax change: "except FooException, bar:" -> "except FooException as bar:" -Code that wants to cater both for Py2 and Py3 should do something like:: +This is taken care by 2to3, however. - try: - spam - except SpamException: - exc = getexception() -This is taken care also by 2to3, however. - - Relative imports ---------------- @@ -174,7 +154,7 @@ to work. 2to3, however, converts the old syntax to new syntax, so as long as we -use the hack, it takes care of most parts. +use the converter, it takes care of most parts. Print @@ -182,14 +162,8 @@ The Print statement changed to a builtin function in Py3. -Probably can generally be replaced by something like:: +Also this is taken care of by 2to3. - print("%s %s %s" % (a, b, c)) - -and in any case, there shouldn't be many print() statements in a -library as low-level as Numpy is. When writing to a file, `file.write` -should also be preferred to print. - types module ------------ @@ -208,11 +182,7 @@ In ``numerictypes.py``, the "common" types were replaced by their plain equivalents, and `IntType` was dropped. -.. todo:: - BufferType should probably be replaced with `memoryview` in most places. - This was currently changed in a couple of places. - numpy.core.numerictypes ----------------------- @@ -227,18 +197,14 @@ unicode_ str_ alias =========== ============ -.. todo:: - Check if I missed something here. - - numpy.loadtxt et al ------------------- These routines are difficult to duck-type to read both Unicode and Bytes input. -I assume they are meant for reading Bytes streams -- this is probably +I assumed they are meant for reading Bytes streams -- this is probably the far more common use case with scientific data. @@ -254,7 +220,7 @@ .. todo:: Currently, this is generated as a part of the config. - Is this sensible (we could also use PY_MAJOR_VERSION)? + Is this sensible (we could also use Py_VERSION_HEX)? private/npy_3kcompat.h @@ -265,10 +231,12 @@ - PyInt -> PyLong on Py3 - PyString -> PyBytes on Py3 - PyUString -> PyUnicode on Py3 and PyString on Py2 -- PyBytes on Py3 +- PyBytes on Py2 +- PyUnicode_ConcatAndDel, PyUnicode_Concat2 - Py_SIZE et al., for older Python versions -- PyFile compatibility on Py3 +- npy_PyFile_Dup, etc. to get FILE* from Py3 file objects - PyObject_Cmp, convenience comparison function on Py3 +- NpyCapsule_* helpers: PyCObject Any new ones that need to be added should be added in this file. @@ -284,6 +252,7 @@ These use Py_SIZE, etc. macros now. The macros are also defined in npy_3kcompat.h for the Python versions that don't have them natively. + Py_TPFLAGS_CHECKTYPES --------------------- @@ -388,18 +357,8 @@ #endif }; -.. todo:: - Check if semantics of the methods have changed -.. todo:: - - We will also have to make sure the - ``*_true_divide`` variants are defined. This should also be done for - python < 3.x, but that introduces a requirement for the - Py_TPFLAGS_HAVE_CLASS in the type flag. - - PyBuffer (provider) ------------------- @@ -616,20 +575,19 @@ tp_doc -- it's a char* pointer, but what is the encoding? Check esp. lib/src/_compiled_base + Currently, UTF-8 is assumed. + .. todo:: ufunc names -- again, what's the encoding? .. todo:: - Replace all occurrences of PyString by PyBytes, PyUnicode, or PyUString. + Cleanup to do later on: Replace all occurrences of PyString by + PyBytes, PyUnicode, or PyUString. .. todo:: - Finally, remove the convenience PyString #define from npy_3kcompat.h - -.. todo:: - Revise errobj decision? .. todo:: @@ -655,42 +613,13 @@ Fate of the 'S' dtype --------------------- -"Strings" in Py3 are now Unicode, so it might make sense to -re-associate Numpy's dtype letter 'S' with Unicode, and introduce -a separate letter for Bytes. +On Python 3, the 'S' dtype will still be Bytes. -Already I changed str_ == unicode_. +However,:: -The Bytes dtype can probably not be wholly dropped -- there may be -some use for 1-byte character strings in e.g. genetics? + str, str_ == unicode_ -.. todo:: - 'S' dtype should be aliased to 'U'. One of the two should be deprecated. - -.. todo:: - - All dtype code should be checked for usage of ``*_STRINGLTR``. - -.. todo:: - - A new 'bytes' dtype? Should the type code be 'y' - -.. todo:: - - Catch all worms that come out of the can because of this change. - In any case, I guess many of the current failures in our test suite - are because code 'S' does not correspond to the `str` type. - -.. todo:: - - Currently, in parts of the code, both Bytes and Unicode strings - are classified as "strings", and share some of the code paths. - - It should probably be checked if preferring Unicode for Py3 requires - changing some of these parts. - - PyInt ----- @@ -708,26 +637,10 @@ Dtype decision rules were changed accordingly, so that Numpy understands Py3 int translate to NPY_LONG as far as dtypes are concerned. -.. todo:: +array([1]).dtype will be the default NPY_LONG integer. - Decide on - - * what is: array([1]).dtype - * what is: array([2**40]).dtype - * what is: array([2**256]).dtype - * what is: array([1]) + 2**40 - * what is: array([1]) + 2**256 - - ie. dtype casting rules. It seems to that we will want to - fix the dtype of Python 3 int to be the machine integer size, - despite the fact that the actual Python 3 object is not fixed-size. - .. todo:: - Audit the automatic dtype decision -- did I plug all the cases? - -.. todo:: - Not inheriting from `int` on Python 3 makes the following not work: ``np.intp("0xff", 16)`` -- because the Numpy type does not take the second argument. This could perhaps be fixed... @@ -757,12 +670,7 @@ On the consumer side, we have a convenience wrapper in npy_3kcompat.h providing PyObject_Cmp also on Py3. -.. todo:: - Ensure that all types that had only tp_compare have also - tp_richcompare. - - Pickling -------- @@ -798,13 +706,7 @@ Most Numpy modules are now converted. -.. todo:: - Except numarray/_capi.c and _blasdot.c show compilation warnings. - This indicates return values are not handled OK -- the init function - is not void any more. - - PyTypeObject ------------ @@ -922,11 +824,7 @@ (ssizeargfunc)0 /* sq_inplace_repeat */ }; -.. todo:: - Check semantics of the PySequence methods. - - PyMappingMethods ---------------- @@ -947,11 +845,7 @@ (objobjargproc)0 /* mp_ass_subscript */ }; -.. todo:: - Check semantics of the PyMapping methods. - - PyFile ------ @@ -965,13 +859,15 @@ from the Python file object. There are, however, new PyFile_* functions for writing and reading data from the file. -Temporary compatibility wrappers that return a dup-ed `fdopen` file pointer are -in private/npy_3kcompat.h. This causes more flushing to be necessary, but it -appears there is no alternative solution. The FILE pointer so obtained must be -closed with fclose after use. +Compatibility wrappers that return a dup-ed `fdopen` file pointer are +in private/npy_3kcompat.h. This causes more flushing to be necessary, +but it appears there is no alternative solution. The FILE pointer so +obtained must be closed with fclose after use. .. todo:: + Should probably be done much later on... + Adapt all Numpy I/O to use the PyFile_* methods or the low-level IO routines. In any case, it's unlikely that C stdio can be used any more. @@ -1002,7 +898,7 @@ There are some checks for PyInstance in ``common.c`` and ``ctors.c``. Currently, ``PyInstance_Check`` is just #ifdef'd out for Py3. This is, -quite likely, not the correct thing to do. +possibly, not the correct thing to do. .. todo:: @@ -1015,4 +911,4 @@ The PyCObject API is removed in Python 3.2, so we need to rewrite it using PyCapsule. -Numpy was changed to use the Capsule API. +Numpy was changed to use the Capsule API, using NpyCapsule* wrappers. From numpy-svn at scipy.org Sun Jul 11 11:02:36 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 11 Jul 2010 10:02:36 -0500 (CDT) Subject: [Numpy-svn] r8480 - trunk/doc Message-ID: <20100711150236.62C9439CAE9@scipy.org> Author: ptvirtan Date: 2010-07-11 10:02:36 -0500 (Sun, 11 Jul 2010) New Revision: 8480 Modified: trunk/doc/Py3K.txt Log: DOC: more updates to Py3K.txt Modified: trunk/doc/Py3K.txt =================================================================== --- trunk/doc/Py3K.txt 2010-07-11 13:56:55 UTC (rev 8479) +++ trunk/doc/Py3K.txt 2010-07-11 15:02:36 UTC (rev 8480) @@ -11,8 +11,12 @@ General ======= -If you work on Py3 transition, please try to keep this document up-to-date. +Numpy has now been ported to Python 3. +Some glitches may still be present; however, we are not aware of any +significant ones, the test suite passes. + + Resources --------- @@ -22,14 +26,6 @@ - http://wiki.python.org/moin/PortingExtensionModulesToPy3k -Git trees ---------- - -- http://github.com/pv/numpy-work/commits/py3k -- http://github.com/cournape/numpy/commits/py3_bootstrap -- http://github.com/illume/numpy3k/commits/work - - Prerequisites ------------- @@ -208,6 +204,13 @@ the far more common use case with scientific data. +Cyclic imports +-------------- + +Python 3 is less forgiving about cyclic imports than Python 2. Cycles +need to be broken to have the same code work both on Python 2 and 3. + + C Code ====== From numpy-svn at scipy.org Sat Jul 17 09:10:39 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 17 Jul 2010 08:10:39 -0500 (CDT) Subject: [Numpy-svn] r8481 - in trunk/numpy/core: include/numpy src src/multiarray src/private src/umath Message-ID: <20100717131039.9A2CC39CAEA@scipy.org> Author: ptvirtan Date: 2010-07-17 08:10:39 -0500 (Sat, 17 Jul 2010) New Revision: 8481 Added: trunk/numpy/core/include/numpy/npy_3kcompat.h Removed: trunk/numpy/core/src/private/npy_3kcompat.h Modified: trunk/numpy/core/src/multiarray/arrayobject.c trunk/numpy/core/src/multiarray/arraytypes.c.src trunk/numpy/core/src/multiarray/buffer.c trunk/numpy/core/src/multiarray/calculation.c trunk/numpy/core/src/multiarray/common.c trunk/numpy/core/src/multiarray/conversion_utils.c trunk/numpy/core/src/multiarray/convert.c trunk/numpy/core/src/multiarray/convert_datatype.c trunk/numpy/core/src/multiarray/ctors.c trunk/numpy/core/src/multiarray/datetime.c trunk/numpy/core/src/multiarray/descriptor.c trunk/numpy/core/src/multiarray/flagsobject.c trunk/numpy/core/src/multiarray/getset.c trunk/numpy/core/src/multiarray/hashdescr.c trunk/numpy/core/src/multiarray/item_selection.c trunk/numpy/core/src/multiarray/iterators.c trunk/numpy/core/src/multiarray/mapping.c trunk/numpy/core/src/multiarray/methods.c trunk/numpy/core/src/multiarray/multiarray_tests.c.src trunk/numpy/core/src/multiarray/multiarraymodule.c trunk/numpy/core/src/multiarray/number.c trunk/numpy/core/src/multiarray/numpymemoryview.c trunk/numpy/core/src/multiarray/numpyos.c trunk/numpy/core/src/multiarray/refcount.c trunk/numpy/core/src/multiarray/scalarapi.c trunk/numpy/core/src/multiarray/scalartypes.c.src trunk/numpy/core/src/multiarray/sequence.c trunk/numpy/core/src/multiarray/shape.c trunk/numpy/core/src/multiarray/ucsnarrow.c trunk/numpy/core/src/multiarray/usertypes.c trunk/numpy/core/src/scalarmathmodule.c.src trunk/numpy/core/src/umath/funcs.inc.src trunk/numpy/core/src/umath/loops.c.src trunk/numpy/core/src/umath/ufunc_object.c trunk/numpy/core/src/umath/umath_tests.c.src Log: ENH: core: make npy_3kcompat.h header public, for easier usage in Scipy Copied: trunk/numpy/core/include/numpy/npy_3kcompat.h (from rev 8480, trunk/numpy/core/src/private/npy_3kcompat.h) =================================================================== --- trunk/numpy/core/include/numpy/npy_3kcompat.h (rev 0) +++ trunk/numpy/core/include/numpy/npy_3kcompat.h 2010-07-17 13:10:39 UTC (rev 8481) @@ -0,0 +1,315 @@ +/* + * This is a convenience header file providing compatibility utilities + * for supporting Python 2 and Python 3 in the same code base. + * + * If you want to use this for your own projects, it's recommended to make a + * copy of it. Although the stuff below is unlikely to change, we don't provide + * strong backwards compatibility guarantees at the moment. + */ + +#ifndef _NPY_3KCOMPAT_H_ +#define _NPY_3KCOMPAT_H_ + +#include +#include + +#if PY_VERSION_HEX >= 0x03000000 +#define NPY_PY3K +#endif + +#include "numpy/npy_common.h" +#include "numpy/ndarrayobject.h" + +/* + * PyInt -> PyLong + */ + +#if defined(NPY_PY3K) +/* Return True only if the long fits in a C long */ +static NPY_INLINE int PyInt_Check(PyObject *op) { + int overflow = 0; + if (!PyLong_Check(op)) { + return 0; + } + PyLong_AsLongAndOverflow(op, &overflow); + return (overflow == 0); +} + +#define PyInt_FromLong PyLong_FromLong +#define PyInt_AsLong PyLong_AsLong +#define PyInt_AS_LONG PyLong_AsLong +#define PyInt_AsSsize_t PyLong_AsSsize_t + +/* NOTE: + * + * Since the PyLong type is very different from the fixed-range PyInt, + * we don't define PyInt_Type -> PyLong_Type. + */ +#endif /* NPY_PY3K */ + +/* + * PyString -> PyBytes + */ + +#if defined(NPY_PY3K) + +#define PyString_Type PyBytes_Type +#define PyString_Check PyBytes_Check +#define PyStringObject PyBytesObject +#define PyString_FromString PyBytes_FromString +#define PyString_FromStringAndSize PyBytes_FromStringAndSize +#define PyString_AS_STRING PyBytes_AS_STRING +#define PyString_AsStringAndSize PyBytes_AsStringAndSize +#define PyString_FromFormat PyBytes_FromFormat +#define PyString_Concat PyBytes_Concat +#define PyString_ConcatAndDel PyBytes_ConcatAndDel +#define PyString_AsString PyBytes_AsString +#define PyString_GET_SIZE PyBytes_GET_SIZE +#define PyString_Size PyBytes_Size + +#define PyUString_Type PyUnicode_Type +#define PyUString_Check PyUnicode_Check +#define PyUStringObject PyUnicodeObject +#define PyUString_FromString PyUnicode_FromString +#define PyUString_FromStringAndSize PyUnicode_FromStringAndSize +#define PyUString_FromFormat PyUnicode_FromFormat +#define PyUString_Concat PyUnicode_Concat2 +#define PyUString_ConcatAndDel PyUnicode_ConcatAndDel +#define PyUString_GET_SIZE PyUnicode_GET_SIZE +#define PyUString_Size PyUnicode_Size +#define PyUString_InternFromString PyUnicode_InternFromString +#define PyUString_Format PyUnicode_Format + +#else + +#define PyBytes_Type PyString_Type +#define PyBytes_Check PyString_Check +#define PyBytesObject PyStringObject +#define PyBytes_FromString PyString_FromString +#define PyBytes_FromStringAndSize PyString_FromStringAndSize +#define PyBytes_AS_STRING PyString_AS_STRING +#define PyBytes_AsStringAndSize PyString_AsStringAndSize +#define PyBytes_FromFormat PyString_FromFormat +#define PyBytes_Concat PyString_Concat +#define PyBytes_ConcatAndDel PyString_ConcatAndDel +#define PyBytes_AsString PyString_AsString +#define PyBytes_GET_SIZE PyString_GET_SIZE +#define PyBytes_Size PyString_Size + +#define PyUString_Type PyString_Type +#define PyUString_Check PyString_Check +#define PyUStringObject PyStringObject +#define PyUString_FromString PyString_FromString +#define PyUString_FromStringAndSize PyString_FromStringAndSize +#define PyUString_FromFormat PyString_FromFormat +#define PyUString_Concat PyString_Concat +#define PyUString_ConcatAndDel PyString_ConcatAndDel +#define PyUString_GET_SIZE PyString_GET_SIZE +#define PyUString_Size PyString_Size +#define PyUString_InternFromString PyString_InternFromString +#define PyUString_Format PyString_Format + +#endif /* NPY_PY3K */ + + +static NPY_INLINE void +PyUnicode_ConcatAndDel(PyObject **left, PyObject *right) +{ + PyObject *new; + new = PyUnicode_Concat(*left, right); + Py_DECREF(*left); + Py_DECREF(right); + *left = new; +} + +static NPY_INLINE void +PyUnicode_Concat2(PyObject **left, PyObject *right) +{ + PyObject *new; + new = PyUnicode_Concat(*left, right); + Py_DECREF(*left); + *left = new; +} + + +/* + * Accessing items of ob_base + */ + +#if (PY_VERSION_HEX < 0x02060000) +#define Py_TYPE(o) (((PyObject*)(o))->ob_type) +#define Py_REFCNT(o) (((PyObject*)(o))->ob_refcnt) +#define Py_SIZE(o) (((PyVarObject*)(o))->ob_size) +#endif + +/* + * PyFile_AsFile + */ +#if defined(NPY_PY3K) +static NPY_INLINE FILE* +npy_PyFile_Dup(PyObject *file, char *mode) +{ + int fd, fd2; + PyObject *ret, *os; + /* Flush first to ensure things end up in the file in the correct order */ + ret = PyObject_CallMethod(file, "flush", ""); + if (ret == NULL) { + return NULL; + } + Py_DECREF(ret); + fd = PyObject_AsFileDescriptor(file); + if (fd == -1) { + return NULL; + } + os = PyImport_ImportModule("os"); + if (os == NULL) { + return NULL; + } + ret = PyObject_CallMethod(os, "dup", "i", fd); + Py_DECREF(os); + if (ret == NULL) { + return NULL; + } + fd2 = PyNumber_AsSsize_t(ret, NULL); + Py_DECREF(ret); + return fdopen(fd2, mode); +} +#endif + +static NPY_INLINE PyObject* +npy_PyFile_OpenFile(PyObject *filename, char *mode) +{ + PyObject *open; + open = PyDict_GetItemString(PyEval_GetBuiltins(), "open"); + if (open == NULL) { + return NULL; + } + return PyObject_CallFunction(open, "Os", filename, mode); +} + +/* + * PyObject_Cmp + */ +#if defined(NPY_PY3K) +static NPY_INLINE int +PyObject_Cmp(PyObject *i1, PyObject *i2, int *cmp) +{ + int v; + v = PyObject_RichCompareBool(i1, i2, Py_LT); + if (v == 0) { + *cmp = -1; + return 1; + } + else if (v == -1) { + return -1; + } + + v = PyObject_RichCompareBool(i1, i2, Py_GT); + if (v == 0) { + *cmp = 1; + return 1; + } + else if (v == -1) { + return -1; + } + + v = PyObject_RichCompareBool(i1, i2, Py_EQ); + if (v == 0) { + *cmp = 0; + return 1; + } + else { + *cmp = 0; + return -1; + } +} +#endif + +/* + * PyCObject functions adapted to PyCapsules. + * + * The main job here is to get rid of the improved error handling + * of PyCapsules. It's a shame... + */ +#if PY_VERSION_HEX >= 0x02070000 + +static NPY_INLINE PyObject * +NpyCapsule_FromVoidPtr(void *ptr, void (*dtor)(PyObject *)) +{ + PyObject *ret = PyCapsule_New(ptr, NULL, dtor); + if (ret == NULL) { + PyErr_Clear(); + } + return ret; +} + +static NPY_INLINE PyObject * +NpyCapsule_FromVoidPtrAndDesc(void *ptr, void* context, void (*dtor)(PyObject *)) +{ + PyObject *ret = NpyCapsule_FromVoidPtr(ptr, dtor); + if (ret != NULL && PyCapsule_SetContext(ret, context) != 0) { + PyErr_Clear(); + Py_DECREF(ret); + ret = NULL; + } + return ret; +} + +static NPY_INLINE void * +NpyCapsule_AsVoidPtr(PyObject *obj) +{ + void *ret = PyCapsule_GetPointer(obj, NULL); + if (ret == NULL) { + PyErr_Clear(); + } + return ret; +} + +static NPY_INLINE int +NpyCapsule_Check(PyObject *ptr) +{ + return PyCapsule_CheckExact(ptr); +} + +static void +simple_capsule_dtor(PyObject *cap) +{ + PyArray_free(PyCapsule_GetPointer(cap, NULL)); +} + +#else + +static NPY_INLINE PyObject * +NpyCapsule_FromVoidPtr(void *ptr, void (*dtor)(void *)) +{ + return PyCObject_FromVoidPtr(ptr, dtor); +} + +static NPY_INLINE PyObject * +NpyCapsule_FromVoidPtrAndDesc(void *ptr, void* context, + void (*dtor)(void *, void *)) +{ + return PyCObject_FromVoidPtrAndDesc(ptr, context, dtor); +} + +static NPY_INLINE void * +NpyCapsule_AsVoidPtr(PyObject *ptr) +{ + return PyCObject_AsVoidPtr(ptr); +} + +static NPY_INLINE int +NpyCapsule_Check(PyObject *ptr) +{ + return PyCObject_Check(ptr); +} + +static void +simple_capsule_dtor(void *ptr) +{ + PyArray_free(ptr); +} + +#endif + +#endif /* _NPY_3KCOMPAT_H_ */ Modified: trunk/numpy/core/src/multiarray/arrayobject.c =================================================================== --- trunk/numpy/core/src/multiarray/arrayobject.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/arrayobject.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -32,7 +32,7 @@ #include "npy_config.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "common.h" Modified: trunk/numpy/core/src/multiarray/arraytypes.c.src =================================================================== --- trunk/numpy/core/src/multiarray/arraytypes.c.src 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/arraytypes.c.src 2010-07-17 13:10:39 UTC (rev 8481) @@ -9,7 +9,7 @@ #include "numpy/arrayobject.h" #include "numpy/arrayscalars.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "numpy/npy_math.h" Modified: trunk/numpy/core/src/multiarray/buffer.c =================================================================== --- trunk/numpy/core/src/multiarray/buffer.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/buffer.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -9,7 +9,7 @@ #include "npy_config.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "buffer.h" #include "numpyos.h" Modified: trunk/numpy/core/src/multiarray/calculation.c =================================================================== --- trunk/numpy/core/src/multiarray/calculation.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/calculation.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -8,7 +8,7 @@ #include "npy_config.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "common.h" #include "number.h" Modified: trunk/numpy/core/src/multiarray/common.c =================================================================== --- trunk/numpy/core/src/multiarray/common.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/common.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -6,7 +6,7 @@ #include "numpy/arrayobject.h" #include "npy_config.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "usertypes.h" Modified: trunk/numpy/core/src/multiarray/conversion_utils.c =================================================================== --- trunk/numpy/core/src/multiarray/conversion_utils.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/conversion_utils.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -8,7 +8,7 @@ #include "numpy/arrayscalars.h" #include "npy_config.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "common.h" #include "arraytypes.h" Modified: trunk/numpy/core/src/multiarray/convert.c =================================================================== --- trunk/numpy/core/src/multiarray/convert.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/convert.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -9,7 +9,7 @@ #include "npy_config.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "arrayobject.h" #include "mapping.h" Modified: trunk/numpy/core/src/multiarray/convert_datatype.c =================================================================== --- trunk/numpy/core/src/multiarray/convert_datatype.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/convert_datatype.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -9,7 +9,7 @@ #include "npy_config.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "common.h" #include "scalartypes.h" Modified: trunk/numpy/core/src/multiarray/ctors.c =================================================================== --- trunk/numpy/core/src/multiarray/ctors.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/ctors.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -11,7 +11,7 @@ #include "npy_config.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "common.h" Modified: trunk/numpy/core/src/multiarray/datetime.c =================================================================== --- trunk/numpy/core/src/multiarray/datetime.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/datetime.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -10,7 +10,7 @@ #include "npy_config.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "_datetime.h" Modified: trunk/numpy/core/src/multiarray/descriptor.c =================================================================== --- trunk/numpy/core/src/multiarray/descriptor.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/descriptor.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -11,7 +11,7 @@ #include "npy_config.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "common.h" Modified: trunk/numpy/core/src/multiarray/flagsobject.c =================================================================== --- trunk/numpy/core/src/multiarray/flagsobject.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/flagsobject.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -11,7 +11,7 @@ #include "npy_config.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "common.h" Modified: trunk/numpy/core/src/multiarray/getset.c =================================================================== --- trunk/numpy/core/src/multiarray/getset.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/getset.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -10,7 +10,7 @@ #include "npy_config.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "common.h" #include "scalartypes.h" Modified: trunk/numpy/core/src/multiarray/hashdescr.c =================================================================== --- trunk/numpy/core/src/multiarray/hashdescr.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/hashdescr.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -5,7 +5,7 @@ #include "npy_config.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "hashdescr.h" Modified: trunk/numpy/core/src/multiarray/item_selection.c =================================================================== --- trunk/numpy/core/src/multiarray/item_selection.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/item_selection.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -11,7 +11,7 @@ #include "npy_config.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "common.h" #include "ctors.h" Modified: trunk/numpy/core/src/multiarray/iterators.c =================================================================== --- trunk/numpy/core/src/multiarray/iterators.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/iterators.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -9,7 +9,7 @@ #include "npy_config.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "arrayobject.h" #include "iterators.h" Modified: trunk/numpy/core/src/multiarray/mapping.c =================================================================== --- trunk/numpy/core/src/multiarray/mapping.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/mapping.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -9,7 +9,7 @@ #include "npy_config.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "common.h" #include "iterators.h" Modified: trunk/numpy/core/src/multiarray/methods.c =================================================================== --- trunk/numpy/core/src/multiarray/methods.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/methods.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -10,7 +10,7 @@ #include "npy_config.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "common.h" #include "ctors.h" Modified: trunk/numpy/core/src/multiarray/multiarray_tests.c.src =================================================================== --- trunk/numpy/core/src/multiarray/multiarray_tests.c.src 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/multiarray_tests.c.src 2010-07-17 13:10:39 UTC (rev 8481) @@ -1,7 +1,7 @@ #include #include "numpy/ndarrayobject.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" /* * TODO: Modified: trunk/numpy/core/src/multiarray/multiarraymodule.c =================================================================== --- trunk/numpy/core/src/multiarray/multiarraymodule.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/multiarraymodule.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -27,7 +27,7 @@ #include "npy_config.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" NPY_NO_EXPORT int NPY_NUMUSERTYPES = 0; Modified: trunk/numpy/core/src/multiarray/number.c =================================================================== --- trunk/numpy/core/src/multiarray/number.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/number.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -9,7 +9,7 @@ #include "npy_config.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "number.h" Modified: trunk/numpy/core/src/multiarray/numpymemoryview.c =================================================================== --- trunk/numpy/core/src/multiarray/numpymemoryview.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/numpymemoryview.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -16,7 +16,7 @@ #include "numpy/arrayscalars.h" #include "npy_config.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "numpymemoryview.h" Modified: trunk/numpy/core/src/multiarray/numpyos.c =================================================================== --- trunk/numpy/core/src/multiarray/numpyos.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/numpyos.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -11,7 +11,7 @@ #include "npy_config.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" /* * From the C99 standard, section 7.19.6: The exponent always contains at least Modified: trunk/numpy/core/src/multiarray/refcount.c =================================================================== --- trunk/numpy/core/src/multiarray/refcount.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/refcount.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -14,7 +14,7 @@ #include "npy_config.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" static void _fillobject(char *optr, PyObject *obj, PyArray_Descr *dtype); Modified: trunk/numpy/core/src/multiarray/scalarapi.c =================================================================== --- trunk/numpy/core/src/multiarray/scalarapi.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/scalarapi.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -11,7 +11,7 @@ #include "npy_config.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "ctors.h" #include "descriptor.h" Modified: trunk/numpy/core/src/multiarray/scalartypes.c.src =================================================================== --- trunk/numpy/core/src/multiarray/scalartypes.c.src 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/scalartypes.c.src 2010-07-17 13:10:39 UTC (rev 8481) @@ -11,7 +11,7 @@ #include "numpy/npy_math.h" #include "numpy/arrayscalars.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "npy_config.h" #include "mapping.h" Modified: trunk/numpy/core/src/multiarray/sequence.c =================================================================== --- trunk/numpy/core/src/multiarray/sequence.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/sequence.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -9,7 +9,7 @@ #include "npy_config.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "common.h" #include "mapping.h" Modified: trunk/numpy/core/src/multiarray/shape.c =================================================================== --- trunk/numpy/core/src/multiarray/shape.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/shape.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -11,7 +11,7 @@ #include "npy_config.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "ctors.h" Modified: trunk/numpy/core/src/multiarray/ucsnarrow.c =================================================================== --- trunk/numpy/core/src/multiarray/ucsnarrow.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/ucsnarrow.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -11,7 +11,7 @@ #include "npy_config.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" /* Functions only needed on narrow builds of Python for converting back and forth between the NumPy Unicode data-type Modified: trunk/numpy/core/src/multiarray/usertypes.c =================================================================== --- trunk/numpy/core/src/multiarray/usertypes.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/multiarray/usertypes.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -34,7 +34,7 @@ #include "common.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "usertypes.h" Deleted: trunk/numpy/core/src/private/npy_3kcompat.h =================================================================== --- trunk/numpy/core/src/private/npy_3kcompat.h 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/private/npy_3kcompat.h 2010-07-17 13:10:39 UTC (rev 8481) @@ -1,303 +0,0 @@ -#ifndef _NPY_3KCOMPAT_H_ -#define _NPY_3KCOMPAT_H_ - -#include -#include - -#include "npy_config.h" -#include "numpy/npy_common.h" -#include "numpy/ndarrayobject.h" - -/* - * PyInt -> PyLong - */ - -#if defined(NPY_PY3K) -/* Return True only if the long fits in a C long */ -static NPY_INLINE int PyInt_Check(PyObject *op) { - int overflow = 0; - if (!PyLong_Check(op)) { - return 0; - } - PyLong_AsLongAndOverflow(op, &overflow); - return (overflow == 0); -} - -#define PyInt_FromLong PyLong_FromLong -#define PyInt_AsLong PyLong_AsLong -#define PyInt_AS_LONG PyLong_AsLong -#define PyInt_AsSsize_t PyLong_AsSsize_t - -/* NOTE: - * - * Since the PyLong type is very different from the fixed-range PyInt, - * we don't define PyInt_Type -> PyLong_Type. - */ -#endif /* NPY_PY3K */ - -/* - * PyString -> PyBytes - */ - -#if defined(NPY_PY3K) - -#define PyString_Type PyBytes_Type -#define PyString_Check PyBytes_Check -#define PyStringObject PyBytesObject -#define PyString_FromString PyBytes_FromString -#define PyString_FromStringAndSize PyBytes_FromStringAndSize -#define PyString_AS_STRING PyBytes_AS_STRING -#define PyString_AsStringAndSize PyBytes_AsStringAndSize -#define PyString_FromFormat PyBytes_FromFormat -#define PyString_Concat PyBytes_Concat -#define PyString_ConcatAndDel PyBytes_ConcatAndDel -#define PyString_AsString PyBytes_AsString -#define PyString_GET_SIZE PyBytes_GET_SIZE -#define PyString_Size PyBytes_Size - -#define PyUString_Type PyUnicode_Type -#define PyUString_Check PyUnicode_Check -#define PyUStringObject PyUnicodeObject -#define PyUString_FromString PyUnicode_FromString -#define PyUString_FromStringAndSize PyUnicode_FromStringAndSize -#define PyUString_FromFormat PyUnicode_FromFormat -#define PyUString_Concat PyUnicode_Concat2 -#define PyUString_ConcatAndDel PyUnicode_ConcatAndDel -#define PyUString_GET_SIZE PyUnicode_GET_SIZE -#define PyUString_Size PyUnicode_Size -#define PyUString_InternFromString PyUnicode_InternFromString -#define PyUString_Format PyUnicode_Format - -#else - -#define PyBytes_Type PyString_Type -#define PyBytes_Check PyString_Check -#define PyBytesObject PyStringObject -#define PyBytes_FromString PyString_FromString -#define PyBytes_FromStringAndSize PyString_FromStringAndSize -#define PyBytes_AS_STRING PyString_AS_STRING -#define PyBytes_AsStringAndSize PyString_AsStringAndSize -#define PyBytes_FromFormat PyString_FromFormat -#define PyBytes_Concat PyString_Concat -#define PyBytes_ConcatAndDel PyString_ConcatAndDel -#define PyBytes_AsString PyString_AsString -#define PyBytes_GET_SIZE PyString_GET_SIZE -#define PyBytes_Size PyString_Size - -#define PyUString_Type PyString_Type -#define PyUString_Check PyString_Check -#define PyUStringObject PyStringObject -#define PyUString_FromString PyString_FromString -#define PyUString_FromStringAndSize PyString_FromStringAndSize -#define PyUString_FromFormat PyString_FromFormat -#define PyUString_Concat PyString_Concat -#define PyUString_ConcatAndDel PyString_ConcatAndDel -#define PyUString_GET_SIZE PyString_GET_SIZE -#define PyUString_Size PyString_Size -#define PyUString_InternFromString PyString_InternFromString -#define PyUString_Format PyString_Format - -#endif /* NPY_PY3K */ - - -static NPY_INLINE void -PyUnicode_ConcatAndDel(PyObject **left, PyObject *right) -{ - PyObject *new; - new = PyUnicode_Concat(*left, right); - Py_DECREF(*left); - Py_DECREF(right); - *left = new; -} - -static NPY_INLINE void -PyUnicode_Concat2(PyObject **left, PyObject *right) -{ - PyObject *new; - new = PyUnicode_Concat(*left, right); - Py_DECREF(*left); - *left = new; -} - - -/* - * Accessing items of ob_base - */ - -#if (PY_VERSION_HEX < 0x02060000) -#define Py_TYPE(o) (((PyObject*)(o))->ob_type) -#define Py_REFCNT(o) (((PyObject*)(o))->ob_refcnt) -#define Py_SIZE(o) (((PyVarObject*)(o))->ob_size) -#endif - -/* - * PyFile_AsFile - */ -#if defined(NPY_PY3K) -static NPY_INLINE FILE* -npy_PyFile_Dup(PyObject *file, char *mode) -{ - int fd, fd2; - PyObject *ret, *os; - /* Flush first to ensure things end up in the file in the correct order */ - ret = PyObject_CallMethod(file, "flush", ""); - if (ret == NULL) { - return NULL; - } - Py_DECREF(ret); - fd = PyObject_AsFileDescriptor(file); - if (fd == -1) { - return NULL; - } - os = PyImport_ImportModule("os"); - if (os == NULL) { - return NULL; - } - ret = PyObject_CallMethod(os, "dup", "i", fd); - Py_DECREF(os); - if (ret == NULL) { - return NULL; - } - fd2 = PyNumber_AsSsize_t(ret, NULL); - Py_DECREF(ret); - return fdopen(fd2, mode); -} -#endif - -static NPY_INLINE PyObject* -npy_PyFile_OpenFile(PyObject *filename, char *mode) -{ - PyObject *open; - open = PyDict_GetItemString(PyEval_GetBuiltins(), "open"); - if (open == NULL) { - return NULL; - } - return PyObject_CallFunction(open, "Os", filename, mode); -} - -/* - * PyObject_Cmp - */ -#if defined(NPY_PY3K) -static NPY_INLINE int -PyObject_Cmp(PyObject *i1, PyObject *i2, int *cmp) -{ - int v; - v = PyObject_RichCompareBool(i1, i2, Py_LT); - if (v == 0) { - *cmp = -1; - return 1; - } - else if (v == -1) { - return -1; - } - - v = PyObject_RichCompareBool(i1, i2, Py_GT); - if (v == 0) { - *cmp = 1; - return 1; - } - else if (v == -1) { - return -1; - } - - v = PyObject_RichCompareBool(i1, i2, Py_EQ); - if (v == 0) { - *cmp = 0; - return 1; - } - else { - *cmp = 0; - return -1; - } -} -#endif - -/* - * PyCObject functions adapted to PyCapsules. - * - * The main job here is to get rid of the improved error handling - * of PyCapsules. It's a shame... - */ -#if PY_VERSION_HEX >= 0x02070000 - -static NPY_INLINE PyObject * -NpyCapsule_FromVoidPtr(void *ptr, void (*dtor)(PyObject *)) -{ - PyObject *ret = PyCapsule_New(ptr, NULL, dtor); - if (ret == NULL) { - PyErr_Clear(); - } - return ret; -} - -static NPY_INLINE PyObject * -NpyCapsule_FromVoidPtrAndDesc(void *ptr, void* context, void (*dtor)(PyObject *)) -{ - PyObject *ret = NpyCapsule_FromVoidPtr(ptr, dtor); - if (ret != NULL && PyCapsule_SetContext(ret, context) != 0) { - PyErr_Clear(); - Py_DECREF(ret); - ret = NULL; - } - return ret; -} - -static NPY_INLINE void * -NpyCapsule_AsVoidPtr(PyObject *obj) -{ - void *ret = PyCapsule_GetPointer(obj, NULL); - if (ret == NULL) { - PyErr_Clear(); - } - return ret; -} - -static NPY_INLINE int -NpyCapsule_Check(PyObject *ptr) -{ - return PyCapsule_CheckExact(ptr); -} - -static void -simple_capsule_dtor(PyObject *cap) -{ - PyArray_free(PyCapsule_GetPointer(cap, NULL)); -} - -#else - -static NPY_INLINE PyObject * -NpyCapsule_FromVoidPtr(void *ptr, void (*dtor)(void *)) -{ - return PyCObject_FromVoidPtr(ptr, dtor); -} - -static NPY_INLINE PyObject * -NpyCapsule_FromVoidPtrAndDesc(void *ptr, void* context, - void (*dtor)(void *, void *)) -{ - return PyCObject_FromVoidPtrAndDesc(ptr, context, dtor); -} - -static NPY_INLINE void * -NpyCapsule_AsVoidPtr(PyObject *ptr) -{ - return PyCObject_AsVoidPtr(ptr); -} - -static NPY_INLINE int -NpyCapsule_Check(PyObject *ptr) -{ - return PyCObject_Check(ptr); -} - -static void -simple_capsule_dtor(void *ptr) -{ - PyArray_free(ptr); -} - -#endif - -#endif /* _NPY_3KCOMPAT_H_ */ Modified: trunk/numpy/core/src/scalarmathmodule.c.src =================================================================== --- trunk/numpy/core/src/scalarmathmodule.c.src 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/scalarmathmodule.c.src 2010-07-17 13:10:39 UTC (rev 8481) @@ -11,7 +11,7 @@ #include "numpy/ufuncobject.h" #include "numpy/arrayscalars.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" /** numarray adapted routines.... **/ Modified: trunk/numpy/core/src/umath/funcs.inc.src =================================================================== --- trunk/numpy/core/src/umath/funcs.inc.src 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/umath/funcs.inc.src 2010-07-17 13:10:39 UTC (rev 8481) @@ -6,7 +6,7 @@ * object functions. */ -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" /* Modified: trunk/numpy/core/src/umath/loops.c.src =================================================================== --- trunk/numpy/core/src/umath/loops.c.src 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/umath/loops.c.src 2010-07-17 13:10:39 UTC (rev 8481) @@ -14,7 +14,7 @@ #include "numpy/ufuncobject.h" #include "numpy/npy_math.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "ufunc_object.h" Modified: trunk/numpy/core/src/umath/ufunc_object.c =================================================================== --- trunk/numpy/core/src/umath/ufunc_object.c 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/umath/ufunc_object.c 2010-07-17 13:10:39 UTC (rev 8481) @@ -33,7 +33,7 @@ #define NO_IMPORT_ARRAY #endif -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "numpy/noprefix.h" #include "numpy/ufuncobject.h" Modified: trunk/numpy/core/src/umath/umath_tests.c.src =================================================================== --- trunk/numpy/core/src/umath/umath_tests.c.src 2010-07-11 15:02:36 UTC (rev 8480) +++ trunk/numpy/core/src/umath/umath_tests.c.src 2010-07-17 13:10:39 UTC (rev 8481) @@ -9,7 +9,7 @@ #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" -#include "npy_3kcompat.h" +#include "numpy/npy_3kcompat.h" #include "npy_config.h" From numpy-svn at scipy.org Sat Jul 17 09:11:05 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 17 Jul 2010 08:11:05 -0500 (CDT) Subject: [Numpy-svn] r8482 - trunk/numpy/core/include/numpy Message-ID: <20100717131105.8539739CAEA@scipy.org> Author: ptvirtan Date: 2010-07-17 08:11:05 -0500 (Sat, 17 Jul 2010) New Revision: 8482 Modified: trunk/numpy/core/include/numpy/npy_3kcompat.h Log: BUG: core: fix C++ issues in npy_3kcompat.h Modified: trunk/numpy/core/include/numpy/npy_3kcompat.h =================================================================== --- trunk/numpy/core/include/numpy/npy_3kcompat.h 2010-07-17 13:10:39 UTC (rev 8481) +++ trunk/numpy/core/include/numpy/npy_3kcompat.h 2010-07-17 13:11:05 UTC (rev 8482) @@ -20,6 +20,10 @@ #include "numpy/npy_common.h" #include "numpy/ndarrayobject.h" +#ifdef __cplusplus +extern "C" { +#endif + /* * PyInt -> PyLong */ @@ -115,20 +119,20 @@ static NPY_INLINE void PyUnicode_ConcatAndDel(PyObject **left, PyObject *right) { - PyObject *new; - new = PyUnicode_Concat(*left, right); + PyObject *newobj; + newobj = PyUnicode_Concat(*left, right); Py_DECREF(*left); Py_DECREF(right); - *left = new; + *left = newobj; } static NPY_INLINE void PyUnicode_Concat2(PyObject **left, PyObject *right) { - PyObject *new; - new = PyUnicode_Concat(*left, right); + PyObject *newobj; + newobj = PyUnicode_Concat(*left, right); Py_DECREF(*left); - *left = new; + *left = newobj; } @@ -312,4 +316,8 @@ #endif +#ifdef __cplusplus +} +#endif + #endif /* _NPY_3KCOMPAT_H_ */ From numpy-svn at scipy.org Sat Jul 17 09:11:20 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 17 Jul 2010 08:11:20 -0500 (CDT) Subject: [Numpy-svn] r8483 - trunk/numpy/core/include/numpy Message-ID: <20100717131120.5768A39CAEA@scipy.org> Author: ptvirtan Date: 2010-07-17 08:11:20 -0500 (Sat, 17 Jul 2010) New Revision: 8483 Modified: trunk/numpy/core/include/numpy/npy_3kcompat.h Log: ENH: 3K: add some extra NpyCapsule functions Modified: trunk/numpy/core/include/numpy/npy_3kcompat.h =================================================================== --- trunk/numpy/core/include/numpy/npy_3kcompat.h 2010-07-17 13:11:05 UTC (rev 8482) +++ trunk/numpy/core/include/numpy/npy_3kcompat.h 2010-07-17 13:11:20 UTC (rev 8483) @@ -269,6 +269,12 @@ return ret; } +static NPY_INLINE void * +NpyCapsule_GetDesc(PyObject *obj) +{ + return PyCapsule_GetContext(obj); +} + static NPY_INLINE int NpyCapsule_Check(PyObject *ptr) { @@ -302,6 +308,12 @@ return PyCObject_AsVoidPtr(ptr); } +static NPY_INLINE void * +NpyCapsule_GetDesc(PyObject *obj) +{ + return PyCObject_GetDesc(obj); +} + static NPY_INLINE int NpyCapsule_Check(PyObject *ptr) { From numpy-svn at scipy.org Sat Jul 17 09:11:39 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 17 Jul 2010 08:11:39 -0500 (CDT) Subject: [Numpy-svn] r8484 - trunk/numpy/core/include/numpy Message-ID: <20100717131139.2531739CAEA@scipy.org> Author: ptvirtan Date: 2010-07-17 08:11:39 -0500 (Sat, 17 Jul 2010) New Revision: 8484 Modified: trunk/numpy/core/include/numpy/npy_3kcompat.h Log: TMP Modified: trunk/numpy/core/include/numpy/npy_3kcompat.h =================================================================== --- trunk/numpy/core/include/numpy/npy_3kcompat.h 2010-07-17 13:11:20 UTC (rev 8483) +++ trunk/numpy/core/include/numpy/npy_3kcompat.h 2010-07-17 13:11:39 UTC (rev 8484) @@ -14,8 +14,10 @@ #include #if PY_VERSION_HEX >= 0x03000000 +#ifndef NPY_PY3K #define NPY_PY3K #endif +#endif #include "numpy/npy_common.h" #include "numpy/ndarrayobject.h" From numpy-svn at scipy.org Sat Jul 17 11:15:15 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 17 Jul 2010 10:15:15 -0500 (CDT) Subject: [Numpy-svn] r8485 - in trunk/numpy: core/code_generators core/include/numpy core/src/multiarray core/src/umath f2py/src lib numarray numarray/include/numpy random/mtrand Message-ID: <20100717151515.C007A39CBD5@scipy.org> Author: ptvirtan Date: 2010-07-17 10:15:15 -0500 (Sat, 17 Jul 2010) New Revision: 8485 Modified: trunk/numpy/core/code_generators/generate_numpy_api.py trunk/numpy/core/code_generators/generate_ufunc_api.py trunk/numpy/core/include/numpy/ndarraytypes.h trunk/numpy/core/include/numpy/npy_3kcompat.h trunk/numpy/core/src/multiarray/scalartypes.c.src trunk/numpy/core/src/multiarray/scalartypes.h trunk/numpy/core/src/umath/ufunc_object.c trunk/numpy/f2py/src/fortranobject.c trunk/numpy/f2py/src/fortranobject.h trunk/numpy/lib/type_check.py trunk/numpy/numarray/_capi.c trunk/numpy/numarray/include/numpy/libnumarray.h trunk/numpy/random/mtrand/Python.pxi Log: BUG: core: use PyCapsule objects only on Python >= 3.0, stay with PyCObjects on Python 2.x Modified: trunk/numpy/core/code_generators/generate_numpy_api.py =================================================================== --- trunk/numpy/core/code_generators/generate_numpy_api.py 2010-07-17 13:11:39 UTC (rev 8484) +++ trunk/numpy/core/code_generators/generate_numpy_api.py 2010-07-17 15:15:15 UTC (rev 8485) @@ -63,7 +63,7 @@ return -1; } -#if PY_VERSION_HEX >= 0x02070000 +#if PY_VERSION_HEX >= 0x03000000 if (!PyCapsule_CheckExact(c_api)) { PyErr_SetString(PyExc_RuntimeError, "_ARRAY_API is not PyCapsule object"); Py_DECREF(c_api); Modified: trunk/numpy/core/code_generators/generate_ufunc_api.py =================================================================== --- trunk/numpy/core/code_generators/generate_ufunc_api.py 2010-07-17 13:11:39 UTC (rev 8484) +++ trunk/numpy/core/code_generators/generate_ufunc_api.py 2010-07-17 15:15:15 UTC (rev 8485) @@ -52,7 +52,7 @@ return -1; } -#if PY_VERSION_HEX >= 0x02070000 +#if PY_VERSION_HEX >= 0x03000000 if (!PyCapsule_CheckExact(c_api)) { PyErr_SetString(PyExc_RuntimeError, "_UFUNC_API is not PyCapsule object"); Py_DECREF(c_api); Modified: trunk/numpy/core/include/numpy/ndarraytypes.h =================================================================== --- trunk/numpy/core/include/numpy/ndarraytypes.h 2010-07-17 13:11:39 UTC (rev 8484) +++ trunk/numpy/core/include/numpy/ndarraytypes.h 2010-07-17 15:15:15 UTC (rev 8485) @@ -658,7 +658,7 @@ int sec, us, ps, as; } npy_timedeltastruct; -#if PY_VERSION_HEX >= 0x02070000 +#if PY_VERSION_HEX >= 0x03000000 #define PyDataType_GetDatetimeMetaData(descr) \ ((descr->metadata == NULL) ? NULL : \ ((PyArray_DatetimeMetaData *)(PyCapsule_GetPointer( \ Modified: trunk/numpy/core/include/numpy/npy_3kcompat.h =================================================================== --- trunk/numpy/core/include/numpy/npy_3kcompat.h 2010-07-17 13:11:39 UTC (rev 8484) +++ trunk/numpy/core/include/numpy/npy_3kcompat.h 2010-07-17 15:15:15 UTC (rev 8485) @@ -237,7 +237,7 @@ * The main job here is to get rid of the improved error handling * of PyCapsules. It's a shame... */ -#if PY_VERSION_HEX >= 0x02070000 +#if PY_VERSION_HEX >= 0x03000000 static NPY_INLINE PyObject * NpyCapsule_FromVoidPtr(void *ptr, void (*dtor)(PyObject *)) Modified: trunk/numpy/core/src/multiarray/scalartypes.c.src =================================================================== --- trunk/numpy/core/src/multiarray/scalartypes.c.src 2010-07-17 13:11:39 UTC (rev 8484) +++ trunk/numpy/core/src/multiarray/scalartypes.c.src 2010-07-17 15:15:15 UTC (rev 8485) @@ -810,7 +810,7 @@ return PyInt_FromLong(1); } -#if PY_VERSION_HEX >= 0x02070000 +#if PY_VERSION_HEX >= 0x03000000 NPY_NO_EXPORT void gentype_struct_free(PyObject *ptr) { Modified: trunk/numpy/core/src/multiarray/scalartypes.h =================================================================== --- trunk/numpy/core/src/multiarray/scalartypes.h 2010-07-17 13:11:39 UTC (rev 8484) +++ trunk/numpy/core/src/multiarray/scalartypes.h 2010-07-17 15:15:15 UTC (rev 8485) @@ -7,7 +7,7 @@ NPY_NO_EXPORT void format_longdouble(char *buf, size_t buflen, longdouble val, unsigned int prec); -#if PY_VERSION_HEX >= 0x02070000 +#if PY_VERSION_HEX >= 0x03000000 NPY_NO_EXPORT void gentype_struct_free(PyObject *ptr); #else Modified: trunk/numpy/core/src/umath/ufunc_object.c =================================================================== --- trunk/numpy/core/src/umath/ufunc_object.c 2010-07-17 13:11:39 UTC (rev 8484) +++ trunk/numpy/core/src/umath/ufunc_object.c 2010-07-17 15:15:15 UTC (rev 8485) @@ -3887,14 +3887,13 @@ } } -#if PY_VERSION_HEX >= 0x02070000 +#if PY_VERSION_HEX >= 0x03000000 static void _loop1d_list_free(PyObject *ptr) { PyUFunc_Loop1d *data = (PyUFunc_Loop1d *)PyCapsule_GetPointer(ptr, NULL); _free_loop1d_list(data); } - #else static void _loop1d_list_free(void *ptr) Modified: trunk/numpy/f2py/src/fortranobject.c =================================================================== --- trunk/numpy/f2py/src/fortranobject.c 2010-07-17 13:11:39 UTC (rev 8484) +++ trunk/numpy/f2py/src/fortranobject.c 2010-07-17 15:15:15 UTC (rev 8485) @@ -914,10 +914,10 @@ } /*********************************************/ -/* Compatibility functions for Python >= 2.7 */ +/* Compatibility functions for Python >= 3.0 */ /*********************************************/ -#if PY_VERSION_HEX >= 0X02070000 +#if PY_VERSION_HEX >= 0x03000000 PyObject * F2PyCapsule_FromVoidPtr(void *ptr, void (*dtor)(PyObject *)) Modified: trunk/numpy/f2py/src/fortranobject.h =================================================================== --- trunk/numpy/f2py/src/fortranobject.h 2010-07-17 13:11:39 UTC (rev 8484) +++ trunk/numpy/f2py/src/fortranobject.h 2010-07-17 15:15:15 UTC (rev 8485) @@ -121,7 +121,7 @@ extern PyObject * PyFortranObject_New(FortranDataDef* defs, f2py_void_func init); extern PyObject * PyFortranObject_NewAsAttr(FortranDataDef* defs); -#if PY_VERSION_HEX >= 0x02070000 +#if PY_VERSION_HEX >= 0x03000000 PyObject * F2PyCapsule_FromVoidPtr(void *ptr, void (*dtor)(PyObject *)); void * F2PyCapsule_AsVoidPtr(PyObject *obj); Modified: trunk/numpy/lib/type_check.py =================================================================== --- trunk/numpy/lib/type_check.py 2010-07-17 13:11:39 UTC (rev 8484) +++ trunk/numpy/lib/type_check.py 2010-07-17 15:15:15 UTC (rev 8485) @@ -620,7 +620,7 @@ ('events', ctypes.c_int)] import sys - if sys.version_info[:2] >= (2,7): + if sys.version_info[:2] >= (3, 0): func = ctypes.pythonapi.PyCapsule_GetPointer func.argtypes = [ctypes.py_object, ctypes.c_char_p] func.restype = ctypes.c_void_p Modified: trunk/numpy/numarray/_capi.c =================================================================== --- trunk/numpy/numarray/_capi.c 2010-07-17 13:11:39 UTC (rev 8484) +++ trunk/numpy/numarray/_capi.c 2010-07-17 15:15:15 UTC (rev 8485) @@ -3408,7 +3408,7 @@ m = Py_InitModule("_capi", _libnumarrayMethods); #endif -#if PY_VERSION_HEX >= 0x02070000 +#if PY_VERSION_HEX >= 0x03000000 c_api_object = PyCapsule_New((void *)libnumarray_API, NULL, NULL); if (c_api_object == NULL) { PyErr_Clear(); Modified: trunk/numpy/numarray/include/numpy/libnumarray.h =================================================================== --- trunk/numpy/numarray/include/numpy/libnumarray.h 2010-07-17 13:11:39 UTC (rev 8484) +++ trunk/numpy/numarray/include/numpy/libnumarray.h 2010-07-17 15:15:15 UTC (rev 8485) @@ -40,7 +40,7 @@ #endif #endif -#if PY_VERSION_HEX >= 0x02070000 +#if PY_VERSION_HEX >= 0x03000000 #define _import_libnumarray() \ { \ PyObject *module = PyImport_ImportModule("numpy.numarray._capi"); \ Modified: trunk/numpy/random/mtrand/Python.pxi =================================================================== --- trunk/numpy/random/mtrand/Python.pxi 2010-07-17 13:11:39 UTC (rev 8484) +++ trunk/numpy/random/mtrand/Python.pxi 2010-07-17 15:15:15 UTC (rev 8485) @@ -30,7 +30,7 @@ # CObject API # If this is uncommented it needs to be fixed to use PyCapsule -# for Python >= 2.7 +# for Python >= 3.0 # # ctypedef void (*destructor1)(void* cobj) # ctypedef void (*destructor2)(void* cobj, void* desc) From numpy-svn at scipy.org Sat Jul 17 11:15:57 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 17 Jul 2010 10:15:57 -0500 (CDT) Subject: [Numpy-svn] r8486 - trunk/numpy/core/src/multiarray Message-ID: <20100717151557.03D0B39CB17@scipy.org> Author: ptvirtan Date: 2010-07-17 10:15:56 -0500 (Sat, 17 Jul 2010) New Revision: 8486 Modified: trunk/numpy/core/src/multiarray/scalartypes.c.src Log: BUG: core: harmonize complex number formatting with Python 2.7 (#1534) Modified: trunk/numpy/core/src/multiarray/scalartypes.c.src =================================================================== --- trunk/numpy/core/src/multiarray/scalartypes.c.src 2010-07-17 15:15:15 UTC (rev 8485) +++ trunk/numpy/core/src/multiarray/scalartypes.c.src 2010-07-17 15:15:56 UTC (rev 8486) @@ -410,7 +410,7 @@ /* * Ideally, we should handle this nan/inf stuff in NumpyOS_ascii_format* */ -#if PY_VERSION_HEX >= 0x03000000 +#if PY_VERSION_HEX >= 0x02070000 if (val.real == 0.0 && npy_signbit(val.real) == 0) { #else if (val.real == 0.0) { From numpy-svn at scipy.org Sat Jul 17 11:32:21 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 17 Jul 2010 10:32:21 -0500 (CDT) Subject: [Numpy-svn] r8487 - in trunk/numpy/core: . tests Message-ID: <20100717153221.E069939CB17@scipy.org> Author: ptvirtan Date: 2010-07-17 10:32:21 -0500 (Sat, 17 Jul 2010) New Revision: 8487 Modified: trunk/numpy/core/getlimits.py trunk/numpy/core/tests/test_regression.py Log: BUG: core: finfo.tiny, resolution, and epsneg should be scalars (#1538) Modified: trunk/numpy/core/getlimits.py =================================================================== --- trunk/numpy/core/getlimits.py 2010-07-17 15:15:56 UTC (rev 8486) +++ trunk/numpy/core/getlimits.py 2010-07-17 15:32:21 UTC (rev 8487) @@ -145,7 +145,7 @@ 'machep']: setattr(self,word,getattr(machar, word)) for word in ['tiny','resolution','epsneg']: - setattr(self,word,getattr(machar, word).squeeze()) + setattr(self,word,getattr(machar, word).flat[0]) self.max = machar.huge.flat[0] self.min = -self.max self.eps = machar.eps.flat[0] Modified: trunk/numpy/core/tests/test_regression.py =================================================================== --- trunk/numpy/core/tests/test_regression.py 2010-07-17 15:15:56 UTC (rev 8486) +++ trunk/numpy/core/tests/test_regression.py 2010-07-17 15:32:21 UTC (rev 8487) @@ -1302,7 +1302,7 @@ # Ticket #1345: the following should not cause a crash np.fromstring(asbytes('aa, aa, 1.0'), sep=',') - def test_issue1539(self): + def test_ticket_1539(self): dtypes = [x for x in np.typeDict.values() if (issubclass(x, np.number) and not issubclass(x, np.timeinteger))] @@ -1319,6 +1319,11 @@ if failures: raise AssertionError("Failures: %r" % failures) + def test_ticket_1538(self): + x = np.finfo(np.float32) + for name in 'eps epsneg max min resolution tiny'.split(): + assert_equal(type(getattr(x, name)), np.float32, + err_msg=name) if __name__ == "__main__": run_module_suite() From numpy-svn at scipy.org Sat Jul 17 13:36:25 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 17 Jul 2010 12:36:25 -0500 (CDT) Subject: [Numpy-svn] r8488 - branches Message-ID: <20100717173625.960FE39CAF3@scipy.org> Author: ptvirtan Date: 2010-07-17 12:36:25 -0500 (Sat, 17 Jul 2010) New Revision: 8488 Added: branches/1.5.x/ Log: Branch for 1.5.x Copied: branches/1.5.x (from rev 8487, trunk) From numpy-svn at scipy.org Sat Jul 17 14:14:26 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 17 Jul 2010 13:14:26 -0500 (CDT) Subject: [Numpy-svn] r8489 - trunk/numpy/lib/tests Message-ID: <20100717181426.BCBB239CB11@scipy.org> Author: ptvirtan Date: 2010-07-17 13:14:26 -0500 (Sat, 17 Jul 2010) New Revision: 8489 Modified: trunk/numpy/lib/tests/test_io.py Log: 3K: lib/tests: fix test_io.RoundtripTest on Python3 + Windows Modified: trunk/numpy/lib/tests/test_io.py =================================================================== --- trunk/numpy/lib/tests/test_io.py 2010-07-17 17:36:25 UTC (rev 8488) +++ trunk/numpy/lib/tests/test_io.py 2010-07-17 18:14:26 UTC (rev 8489) @@ -23,6 +23,7 @@ return BytesIO(asbytes(s)) else: from StringIO import StringIO + BytesIO = StringIO MAJVER, MINVER = sys.version_info[:2] @@ -76,7 +77,7 @@ target_file.flush() target_file.seek(0) - if sys.platform == 'win32' and not isinstance(target_file, StringIO): + if sys.platform == 'win32' and not isinstance(target_file, BytesIO): target_file.close() arr_reloaded = np.load(load_file, **load_kwds) From numpy-svn at scipy.org Sat Jul 17 14:14:46 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 17 Jul 2010 13:14:46 -0500 (CDT) Subject: [Numpy-svn] r8490 - trunk/numpy/f2py Message-ID: <20100717181446.222F239CB11@scipy.org> Author: ptvirtan Date: 2010-07-17 13:14:46 -0500 (Sat, 17 Jul 2010) New Revision: 8490 Modified: trunk/numpy/f2py/__version__.py Log: 3K: f2py: catch a misc import error Modified: trunk/numpy/f2py/__version__.py =================================================================== --- trunk/numpy/f2py/__version__.py 2010-07-17 18:14:26 UTC (rev 8489) +++ trunk/numpy/f2py/__version__.py 2010-07-17 18:14:46 UTC (rev 8490) @@ -4,5 +4,5 @@ from __svn_version__ import version version_info = (major, version) version = '%s_%s' % version_info -except ImportError: +except (ImportError, ValueError): version = str(major) From numpy-svn at scipy.org Sat Jul 17 14:15:12 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 17 Jul 2010 13:15:12 -0500 (CDT) Subject: [Numpy-svn] r8491 - trunk/numpy/numarray Message-ID: <20100717181512.3947239CB11@scipy.org> Author: ptvirtan Date: 2010-07-17 13:15:12 -0500 (Sat, 17 Jul 2010) New Revision: 8491 Modified: trunk/numpy/numarray/_capi.c Log: 3K: numarray: Python3 fixes in _capi.c Thanks to Christoph Gohlke. Modified: trunk/numpy/numarray/_capi.c =================================================================== --- trunk/numpy/numarray/_capi.c 2010-07-17 18:14:46 UTC (rev 8490) +++ trunk/numpy/numarray/_capi.c 2010-07-17 18:15:12 UTC (rev 8491) @@ -2,7 +2,7 @@ #define _libnumarray_MODULE #include "include/numpy/libnumarray.h" -#include "npy_config.h" +#include "numpy/npy_3kcompat.h" #include #if (defined(__unix__) || defined(unix)) && !defined(USG) @@ -940,12 +940,16 @@ me->descr.name, (unsigned long ) me->descr.fptr, me->descr.chkself, me->descr.align, me->descr.wantIn, me->descr.wantOut); - return PyString_FromString(buf); + return PyUString_FromString(buf); } static PyTypeObject CfuncType = { - PyObject_HEAD_INIT(NULL) - 0, +#if defined(NPY_PY3K) + PyVarObject_HEAD_INIT(0,0) +#else + PyObject_HEAD_INIT(0) + 0, /* ob_size */ +#endif "Cfunc", sizeof(CfuncObject), 0, @@ -2048,8 +2052,7 @@ getShape(PyObject *a, maybelong *shape, int dims) { long slen; - - if (PyString_Check(a)) { + if (PyBytes_Check(a)) { PyErr_Format(PyExc_TypeError, "getShape: numerical sequences can't contain strings."); return -1; @@ -2124,11 +2127,12 @@ if (NA_setFromPythonScalar(a, offset, o) < 0) return -2; mustbe = NUMBER; - } else if (PyString_Check(o)) { + } else if (PyBytes_Check(o)) { PyErr_SetString( PyExc_ValueError, "setArrayFromSequence: strings can't define numeric numarray."); return -3; } else if (PySequence_Check(o)) { + if ((mustbe == NOTHING) || (mustbe == SEQUENCE)) { if (mustbe == NOTHING) { mustbe = SEQUENCE; @@ -2219,7 +2223,7 @@ "Expecting a python numeric type, got something else."); return -1; } - } else if (PySequence_Check(seq) && !PyString_Check(seq)) { + } else if (PySequence_Check(seq) && !PyBytes_Check(seq)) { long i, maxtype=BOOL_SCALAR, slen; slen = PySequence_Length(seq); @@ -2246,9 +2250,13 @@ return BOOL_SCALAR; else #endif +#if defined(NPY_PY3K) if (PyInt_Check(seq)) return INT_SCALAR; else if (PyLong_Check(seq)) +#else + if (PyLong_Check(seq)) +#endif return LONG_SCALAR; else if (PyFloat_Check(seq)) return FLOAT_SCALAR; @@ -2278,7 +2286,7 @@ PyLong_Check(o) || PyFloat_Check(o) || PyComplex_Check(o) || - (PyString_Check(o) && (PyString_Size(o) == 1)); + (PyBytes_Check(o) && (PyBytes_Size(o) == 1)); return rval; } @@ -2455,18 +2463,14 @@ rval = _setFromPythonScalarCore(a, offset, value, entries+1); Py_DECREF(value); return rval; - } else if (PyString_Check(value)) { - long size = PyString_Size(value); + } else if (PyBytes_Check(value)) { + long size = PyBytes_Size(value); if ((size <= 0) || (size > 1)) { PyErr_Format( PyExc_ValueError, "NA_setFromPythonScalar: len(string) must be 1."); return -1; } -#if defined(NPY_PY3K) NA_set_Int64(a, offset, *PyBytes_AsString(value)); -#else - NA_set_Int64(a, offset, *PyString_AsString(value)); -#endif } else { PyErr_Format(PyExc_TypeError, "NA_setFromPythonScalar: bad value type."); @@ -3372,7 +3376,7 @@ #endif /* boiler plate API init */ -#if PY_VERSION_HEX >= 0x03010000 +#if defined(NPY_PY3K) #define RETVAL m @@ -3388,7 +3392,7 @@ NULL }; -PyObject *PyInit___capi(void) +PyObject *PyInit__capi(void) #else #define RETVAL @@ -3402,13 +3406,13 @@ _Error = PyErr_NewException("numpy.numarray._capi.error", NULL, NULL); /* Create a CObject containing the API pointer array's address */ -#if PY_VERSION_HEX >= 0x03010000 +#if defined(NPY_PY3K) m = PyModule_Create(&moduledef); #else m = Py_InitModule("_capi", _libnumarrayMethods); #endif -#if PY_VERSION_HEX >= 0x03000000 +#if defined(NPY_PY3K) c_api_object = PyCapsule_New((void *)libnumarray_API, NULL, NULL); if (c_api_object == NULL) { PyErr_Clear(); @@ -3428,7 +3432,7 @@ else { return RETVAL; } - if (PyModule_AddObject(m, "__version__", PyString_FromString("0.9")) < 0) { + if (PyModule_AddObject(m, "__version__", PyUString_FromString("0.9")) < 0) { return RETVAL; } if (_import_array() < 0) { From numpy-svn at scipy.org Sat Jul 17 14:17:50 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 17 Jul 2010 13:17:50 -0500 (CDT) Subject: [Numpy-svn] r8492 - branches/1.5.x/numpy/lib/tests Message-ID: <20100717181750.A717239CB11@scipy.org> Author: ptvirtan Date: 2010-07-17 13:17:50 -0500 (Sat, 17 Jul 2010) New Revision: 8492 Modified: branches/1.5.x/numpy/lib/tests/test_io.py Log: 3K: lib/tests: fix test_io.RoundtripTest on Python3 + Windows Modified: branches/1.5.x/numpy/lib/tests/test_io.py =================================================================== --- branches/1.5.x/numpy/lib/tests/test_io.py 2010-07-17 18:15:12 UTC (rev 8491) +++ branches/1.5.x/numpy/lib/tests/test_io.py 2010-07-17 18:17:50 UTC (rev 8492) @@ -23,6 +23,7 @@ return BytesIO(asbytes(s)) else: from StringIO import StringIO + BytesIO = StringIO MAJVER, MINVER = sys.version_info[:2] @@ -76,7 +77,7 @@ target_file.flush() target_file.seek(0) - if sys.platform == 'win32' and not isinstance(target_file, StringIO): + if sys.platform == 'win32' and not isinstance(target_file, BytesIO): target_file.close() arr_reloaded = np.load(load_file, **load_kwds) From numpy-svn at scipy.org Sat Jul 17 14:18:08 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 17 Jul 2010 13:18:08 -0500 (CDT) Subject: [Numpy-svn] r8493 - branches/1.5.x/numpy/f2py Message-ID: <20100717181808.CD3CF39CB11@scipy.org> Author: ptvirtan Date: 2010-07-17 13:18:08 -0500 (Sat, 17 Jul 2010) New Revision: 8493 Modified: branches/1.5.x/numpy/f2py/__version__.py Log: 3K: f2py: catch a misc import error Modified: branches/1.5.x/numpy/f2py/__version__.py =================================================================== --- branches/1.5.x/numpy/f2py/__version__.py 2010-07-17 18:17:50 UTC (rev 8492) +++ branches/1.5.x/numpy/f2py/__version__.py 2010-07-17 18:18:08 UTC (rev 8493) @@ -4,5 +4,5 @@ from __svn_version__ import version version_info = (major, version) version = '%s_%s' % version_info -except ImportError: +except (ImportError, ValueError): version = str(major) From numpy-svn at scipy.org Sat Jul 17 14:18:25 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 17 Jul 2010 13:18:25 -0500 (CDT) Subject: [Numpy-svn] r8494 - branches/1.5.x/numpy/numarray Message-ID: <20100717181825.91A4F39CB11@scipy.org> Author: ptvirtan Date: 2010-07-17 13:18:25 -0500 (Sat, 17 Jul 2010) New Revision: 8494 Modified: branches/1.5.x/numpy/numarray/_capi.c Log: 3K: numarray: Python3 fixes in _capi.c Thanks to Christoph Gohlke. Modified: branches/1.5.x/numpy/numarray/_capi.c =================================================================== --- branches/1.5.x/numpy/numarray/_capi.c 2010-07-17 18:18:08 UTC (rev 8493) +++ branches/1.5.x/numpy/numarray/_capi.c 2010-07-17 18:18:25 UTC (rev 8494) @@ -2,7 +2,7 @@ #define _libnumarray_MODULE #include "include/numpy/libnumarray.h" -#include "npy_config.h" +#include "numpy/npy_3kcompat.h" #include #if (defined(__unix__) || defined(unix)) && !defined(USG) @@ -940,12 +940,16 @@ me->descr.name, (unsigned long ) me->descr.fptr, me->descr.chkself, me->descr.align, me->descr.wantIn, me->descr.wantOut); - return PyString_FromString(buf); + return PyUString_FromString(buf); } static PyTypeObject CfuncType = { - PyObject_HEAD_INIT(NULL) - 0, +#if defined(NPY_PY3K) + PyVarObject_HEAD_INIT(0,0) +#else + PyObject_HEAD_INIT(0) + 0, /* ob_size */ +#endif "Cfunc", sizeof(CfuncObject), 0, @@ -2048,8 +2052,7 @@ getShape(PyObject *a, maybelong *shape, int dims) { long slen; - - if (PyString_Check(a)) { + if (PyBytes_Check(a)) { PyErr_Format(PyExc_TypeError, "getShape: numerical sequences can't contain strings."); return -1; @@ -2124,11 +2127,12 @@ if (NA_setFromPythonScalar(a, offset, o) < 0) return -2; mustbe = NUMBER; - } else if (PyString_Check(o)) { + } else if (PyBytes_Check(o)) { PyErr_SetString( PyExc_ValueError, "setArrayFromSequence: strings can't define numeric numarray."); return -3; } else if (PySequence_Check(o)) { + if ((mustbe == NOTHING) || (mustbe == SEQUENCE)) { if (mustbe == NOTHING) { mustbe = SEQUENCE; @@ -2219,7 +2223,7 @@ "Expecting a python numeric type, got something else."); return -1; } - } else if (PySequence_Check(seq) && !PyString_Check(seq)) { + } else if (PySequence_Check(seq) && !PyBytes_Check(seq)) { long i, maxtype=BOOL_SCALAR, slen; slen = PySequence_Length(seq); @@ -2246,9 +2250,13 @@ return BOOL_SCALAR; else #endif +#if defined(NPY_PY3K) if (PyInt_Check(seq)) return INT_SCALAR; else if (PyLong_Check(seq)) +#else + if (PyLong_Check(seq)) +#endif return LONG_SCALAR; else if (PyFloat_Check(seq)) return FLOAT_SCALAR; @@ -2278,7 +2286,7 @@ PyLong_Check(o) || PyFloat_Check(o) || PyComplex_Check(o) || - (PyString_Check(o) && (PyString_Size(o) == 1)); + (PyBytes_Check(o) && (PyBytes_Size(o) == 1)); return rval; } @@ -2455,18 +2463,14 @@ rval = _setFromPythonScalarCore(a, offset, value, entries+1); Py_DECREF(value); return rval; - } else if (PyString_Check(value)) { - long size = PyString_Size(value); + } else if (PyBytes_Check(value)) { + long size = PyBytes_Size(value); if ((size <= 0) || (size > 1)) { PyErr_Format( PyExc_ValueError, "NA_setFromPythonScalar: len(string) must be 1."); return -1; } -#if defined(NPY_PY3K) NA_set_Int64(a, offset, *PyBytes_AsString(value)); -#else - NA_set_Int64(a, offset, *PyString_AsString(value)); -#endif } else { PyErr_Format(PyExc_TypeError, "NA_setFromPythonScalar: bad value type."); @@ -3372,7 +3376,7 @@ #endif /* boiler plate API init */ -#if PY_VERSION_HEX >= 0x03010000 +#if defined(NPY_PY3K) #define RETVAL m @@ -3388,7 +3392,7 @@ NULL }; -PyObject *PyInit___capi(void) +PyObject *PyInit__capi(void) #else #define RETVAL @@ -3402,13 +3406,13 @@ _Error = PyErr_NewException("numpy.numarray._capi.error", NULL, NULL); /* Create a CObject containing the API pointer array's address */ -#if PY_VERSION_HEX >= 0x03010000 +#if defined(NPY_PY3K) m = PyModule_Create(&moduledef); #else m = Py_InitModule("_capi", _libnumarrayMethods); #endif -#if PY_VERSION_HEX >= 0x03000000 +#if defined(NPY_PY3K) c_api_object = PyCapsule_New((void *)libnumarray_API, NULL, NULL); if (c_api_object == NULL) { PyErr_Clear(); @@ -3428,7 +3432,7 @@ else { return RETVAL; } - if (PyModule_AddObject(m, "__version__", PyString_FromString("0.9")) < 0) { + if (PyModule_AddObject(m, "__version__", PyUString_FromString("0.9")) < 0) { return RETVAL; } if (_import_array() < 0) { From numpy-svn at scipy.org Sat Jul 17 14:31:17 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 17 Jul 2010 13:31:17 -0500 (CDT) Subject: [Numpy-svn] r8495 - in branches/1.5.x/numpy: core core/code_generators core/include/numpy core/src/multiarray core/src/umath core/tests f2py lib/tests random/mtrand Message-ID: <20100717183117.D842E39CB11@scipy.org> Author: ptvirtan Date: 2010-07-17 13:31:17 -0500 (Sat, 17 Jul 2010) New Revision: 8495 Modified: branches/1.5.x/numpy/core/SConscript branches/1.5.x/numpy/core/_internal.py branches/1.5.x/numpy/core/arrayprint.py branches/1.5.x/numpy/core/code_generators/cversions.txt branches/1.5.x/numpy/core/code_generators/genapi.py branches/1.5.x/numpy/core/code_generators/generate_umath.py branches/1.5.x/numpy/core/code_generators/numpy_api.py branches/1.5.x/numpy/core/include/numpy/arrayscalars.h branches/1.5.x/numpy/core/include/numpy/ndarraytypes.h branches/1.5.x/numpy/core/numerictypes.py branches/1.5.x/numpy/core/setup.py branches/1.5.x/numpy/core/setup_common.py branches/1.5.x/numpy/core/src/multiarray/arrayobject.c branches/1.5.x/numpy/core/src/multiarray/arraytypes.c.src branches/1.5.x/numpy/core/src/multiarray/convert_datatype.c branches/1.5.x/numpy/core/src/multiarray/descriptor.c branches/1.5.x/numpy/core/src/multiarray/hashdescr.c branches/1.5.x/numpy/core/src/multiarray/multiarraymodule.c branches/1.5.x/numpy/core/src/multiarray/multiarraymodule_onefile.c branches/1.5.x/numpy/core/src/multiarray/scalarapi.c branches/1.5.x/numpy/core/src/multiarray/scalartypes.c.src branches/1.5.x/numpy/core/src/umath/loops.c.src branches/1.5.x/numpy/core/src/umath/loops.h branches/1.5.x/numpy/core/src/umath/loops.h.src branches/1.5.x/numpy/core/src/umath/ufunc_object.c branches/1.5.x/numpy/core/tests/test_regression.py branches/1.5.x/numpy/f2py/__version__.py branches/1.5.x/numpy/lib/tests/test_type_check.py branches/1.5.x/numpy/random/mtrand/numpy.pxi Log: ENH: restore ABI for 1.5.x branch - remove the datetime functionality. - roll back hasobject -> flags change - roll back several other rearrangements in ndarraytypes - restore ABI compatibility with numpy 1.4. The patch is based on the following changesets/tickets: r8098, r8113, r8107, r8108, r8115, #1502 Thanks to Christoph Gohlke for contributing this patch. Modified: branches/1.5.x/numpy/core/SConscript =================================================================== --- branches/1.5.x/numpy/core/SConscript 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/core/SConscript 2010-07-17 18:31:17 UTC (rev 8495) @@ -426,7 +426,6 @@ multiarray_src = [pjoin('src', 'multiarray', 'multiarraymodule.c'), pjoin('src', 'multiarray', 'hashdescr.c'), pjoin('src', 'multiarray', 'arrayobject.c'), - pjoin('src', 'multiarray', 'datetime.c'), pjoin('src', 'multiarray', 'numpyos.c'), pjoin('src', 'multiarray', 'flagsobject.c'), pjoin('src', 'multiarray', 'descriptor.c'), Modified: branches/1.5.x/numpy/core/_internal.py =================================================================== --- branches/1.5.x/numpy/core/_internal.py 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/core/_internal.py 2010-07-17 18:31:17 UTC (rev 8495) @@ -165,36 +165,7 @@ return newlist -format_datetime = re.compile(asbytes(r""" - (?PM8|m8|datetime64|timedelta64) - ([[] - ((?P\d+)? - (?PY|M|W|B|D|h|m|s|ms|us|ns|ps|fs|as) - (/(?P\d+))? - []]) - (//(?P\d+))?)?"""), re.X) -# Return (baseunit, num, den, events), datetime -# from date-time string -def _datetimestring(astr): - res = format_datetime.match(astr) - if res is None: - raise ValueError("Incorrect date-time string.") - typecode = res.group('typecode') - datetime = (typecode == asbytes('M8') or typecode == asbytes('datetime64')) - defaults = [asbytes('us'), 1, 1, 1] - names = ['baseunit', 'num', 'den', 'events'] - func = [bytes, int, int, int] - dt_tuple = [] - for i, name in enumerate(names): - value = res.group(name) - if value: - dt_tuple.append(func[i](value)) - else: - dt_tuple.append(defaults[i]) - - return tuple(dt_tuple), datetime - format_re = re.compile(asbytes(r'(?P[<>|=]?)(?P *[(]?[ ,0-9]*[)]? *)(?P[<>|=]?)(?P[A-Za-z0-9.]*)')) # astr is a string (perhaps comma separated) Modified: branches/1.5.x/numpy/core/arrayprint.py =================================================================== --- branches/1.5.x/numpy/core/arrayprint.py 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/core/arrayprint.py 2010-07-17 18:31:17 UTC (rev 8495) @@ -199,13 +199,10 @@ # make sure True and False line up. format_function = _boolFormatter elif issubclass(dtypeobj, _nt.integer): - if issubclass(dtypeobj, _nt.timeinteger): - format_function = str - else: - max_str_len = max(len(str(maximum.reduce(data))), - len(str(minimum.reduce(data)))) - format = '%' + str(max_str_len) + 'd' - format_function = lambda x: _formatInteger(x, format) + max_str_len = max(len(str(maximum.reduce(data))), + len(str(minimum.reduce(data)))) + format = '%' + str(max_str_len) + 'd' + format_function = lambda x: _formatInteger(x, format) elif issubclass(dtypeobj, _nt.floating): if issubclass(dtypeobj, _nt.longfloat): format_function = _longfloatFormatter(precision) Modified: branches/1.5.x/numpy/core/code_generators/cversions.txt =================================================================== --- branches/1.5.x/numpy/core/code_generators/cversions.txt 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/core/code_generators/cversions.txt 2010-07-17 18:31:17 UTC (rev 8495) @@ -5,4 +5,4 @@ # Starting from here, the hash is defined from numpy_api.full_api dict # version 4 added neighborhood iterators and PyArray_Correlate2 0x00000004 = 3d8940bf7b0d2a4e25be4338c14c3c85 -0x00000005 = 77e2e846db87f25d7cf99f9d812076f0 + Modified: branches/1.5.x/numpy/core/code_generators/genapi.py =================================================================== --- branches/1.5.x/numpy/core/code_generators/genapi.py 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/core/code_generators/genapi.py 2010-07-17 18:31:17 UTC (rev 8495) @@ -43,7 +43,6 @@ join('multiarray', 'refcount.c'), join('multiarray', 'conversion_utils.c'), join('multiarray', 'buffer.c'), - join('multiarray', 'datetime.c'), join('umath', 'ufunc_object.c'), join('umath', 'loops.c.src'), ] Modified: branches/1.5.x/numpy/core/code_generators/generate_umath.py =================================================================== --- branches/1.5.x/numpy/core/code_generators/generate_umath.py 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/core/code_generators/generate_umath.py 2010-07-17 18:31:17 UTC (rev 8495) @@ -172,19 +172,16 @@ 'F': 'cfloat', 'D': 'cdouble', 'G': 'clongdouble', - 'M': 'datetime', - 'm': 'timedelta', 'O': 'OBJECT', # '.' is like 'O', but calls a method of the object instead # of a function 'P': 'OBJECT', } -all = '?bBhHiIlLqQfdgFDGOMm' +all = '?bBhHiIlLqQfdgFDGO' O = 'O' P = 'P' ints = 'bBhHiIlLqQ' -times = 'Mm' intsO = ints + O bints = '?' + ints bintsO = bints + O @@ -197,13 +194,13 @@ inexact = flts + cmplx noint = inexact+O nointP = inexact+P -allP = bints+times+flts+cmplxP +allP = bints+flts+cmplxP nobool = all[1:] -noobj = all[:-3]+all[-2:] -nobool_or_obj = all[1:-3]+all[-2:] +noobj = all[:-2] +nobool_or_obj = all[1:-2] intflt = ints+flts intfltcmplx = ints+flts+cmplx -nocmplx = bints+times+flts +nocmplx = bints+flts nocmplxO = nocmplx+O nocmplxP = nocmplx+P notimes_or_obj = bints + inexact @@ -222,20 +219,12 @@ Ufunc(2, 1, Zero, docstrings.get('numpy.core.umath.add'), TD(notimes_or_obj), - [TypeDescription('M', UsesArraysAsData, 'Mm', 'M'), - TypeDescription('m', UsesArraysAsData, 'mm', 'm'), - TypeDescription('M', UsesArraysAsData, 'mM', 'M'), - ], TD(O, f='PyNumber_Add'), ), 'subtract' : Ufunc(2, 1, Zero, docstrings.get('numpy.core.umath.subtract'), TD(notimes_or_obj), - [TypeDescription('M', UsesArraysAsData, 'Mm', 'M'), - TypeDescription('m', UsesArraysAsData, 'mm', 'm'), - TypeDescription('M', UsesArraysAsData, 'MM', 'm'), - ], TD(O, f='PyNumber_Subtract'), ), 'multiply' : @@ -305,7 +294,7 @@ 'absolute' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.absolute'), - TD(bints+flts+times), + TD(bints+flts), TD(cmplx, out=('f', 'd', 'g')), TD(O, f='PyNumber_Absolute'), ), @@ -317,7 +306,7 @@ 'negative' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.negative'), - TD(bints+flts+times), + TD(bints+flts), TD(cmplx, f='neg'), TD(O, f='PyNumber_Negative'), ), Modified: branches/1.5.x/numpy/core/code_generators/numpy_api.py =================================================================== --- branches/1.5.x/numpy/core/code_generators/numpy_api.py 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/core/code_generators/numpy_api.py 2010-07-17 18:31:17 UTC (rev 8495) @@ -13,7 +13,7 @@ """ multiarray_global_vars = { - 'NPY_NUMUSERTYPES': 6, + 'NPY_NUMUSERTYPES': 7, } multiarray_global_vars_types = { @@ -21,236 +21,239 @@ } multiarray_scalar_bool_values = { - '_PyArrayScalar_BoolValues': 8 + '_PyArrayScalar_BoolValues': 9 } multiarray_types_api = { - 'PyArray_Type': 1, - 'PyArrayDescr_Type': 2, - 'PyArrayFlags_Type': 3, - 'PyArrayIter_Type': 4, - 'PyArrayMultiIter_Type': 5, - 'PyBoolArrType_Type': 7, - 'PyGenericArrType_Type': 9, - 'PyNumberArrType_Type': 10, - 'PyIntegerArrType_Type': 11, - 'PySignedIntegerArrType_Type': 12, - 'PyUnsignedIntegerArrType_Type': 13, - 'PyInexactArrType_Type': 14, - 'PyFloatingArrType_Type': 15, - 'PyComplexFloatingArrType_Type': 16, - 'PyFlexibleArrType_Type': 17, - 'PyCharacterArrType_Type': 18, - 'PyByteArrType_Type': 19, - 'PyShortArrType_Type': 20, - 'PyIntArrType_Type': 21, - 'PyLongArrType_Type': 22, - 'PyLongLongArrType_Type': 23, - 'PyUByteArrType_Type': 24, - 'PyUShortArrType_Type': 25, - 'PyUIntArrType_Type': 26, - 'PyULongArrType_Type': 27, - 'PyULongLongArrType_Type': 28, - 'PyFloatArrType_Type': 29, - 'PyDoubleArrType_Type': 30, - 'PyLongDoubleArrType_Type': 31, - 'PyCFloatArrType_Type': 32, - 'PyCDoubleArrType_Type': 33, - 'PyCLongDoubleArrType_Type': 34, - 'PyObjectArrType_Type': 35, - 'PyStringArrType_Type': 36, - 'PyUnicodeArrType_Type': 37, - 'PyVoidArrType_Type': 38, - 'PyTimeIntegerArrType_Type': 39, - 'PyDatetimeArrType_Type': 40, - 'PyTimedeltaArrType_Type': 41, + 'PyBigArray_Type': 1, + 'PyArray_Type': 2, + 'PyArrayDescr_Type': 3, + 'PyArrayFlags_Type': 4, + 'PyArrayIter_Type': 5, + 'PyArrayMultiIter_Type': 6, + 'PyBoolArrType_Type': 8, + 'PyGenericArrType_Type': 10, + 'PyNumberArrType_Type': 11, + 'PyIntegerArrType_Type': 12, + 'PySignedIntegerArrType_Type': 13, + 'PyUnsignedIntegerArrType_Type': 14, + 'PyInexactArrType_Type': 15, + 'PyFloatingArrType_Type': 16, + 'PyComplexFloatingArrType_Type': 17, + 'PyFlexibleArrType_Type': 18, + 'PyCharacterArrType_Type': 19, + 'PyByteArrType_Type': 20, + 'PyShortArrType_Type': 21, + 'PyIntArrType_Type': 22, + 'PyLongArrType_Type': 23, + 'PyLongLongArrType_Type': 24, + 'PyUByteArrType_Type': 25, + 'PyUShortArrType_Type': 26, + 'PyUIntArrType_Type': 27, + 'PyULongArrType_Type': 28, + 'PyULongLongArrType_Type': 29, + 'PyFloatArrType_Type': 30, + 'PyDoubleArrType_Type': 31, + 'PyLongDoubleArrType_Type': 32, + 'PyCFloatArrType_Type': 33, + 'PyCDoubleArrType_Type': 34, + 'PyCLongDoubleArrType_Type': 35, + 'PyObjectArrType_Type': 36, + 'PyStringArrType_Type': 37, + 'PyUnicodeArrType_Type': 38, + 'PyVoidArrType_Type': 39, +# Those were added much later, and there is no space anymore between Void and +# first functions from multiarray API +# 'PyTimeIntegerArrType_Type': 215, +# 'PyDatetimeArrType_Type': 216, +# 'PyTimedeltaArrType_Type': 217, } -#define NPY_NUMUSERTYPES (*(int *)PyArray_API[6]) -#define PyBoolArrType_Type (*(PyTypeObject *)PyArray_API[7]) -#define _PyArrayScalar_BoolValues ((PyBoolScalarObject *)PyArray_API[8]) +#define NPY_NUMUSERTYPES (*(int *)PyArray_API[7]) +#define PyBoolArrType_Type (*(PyTypeObject *)PyArray_API[8]) +#define _PyArrayScalar_BoolValues ((PyBoolScalarObject *)PyArray_API[9]) multiarray_funcs_api = { 'PyArray_GetNDArrayCVersion': 0, - 'PyArray_SetNumericOps': 42, - 'PyArray_GetNumericOps': 43, - 'PyArray_INCREF': 44, - 'PyArray_XDECREF': 45, - 'PyArray_SetStringFunction': 46, - 'PyArray_DescrFromType': 47, - 'PyArray_TypeObjectFromType': 48, - 'PyArray_Zero': 49, - 'PyArray_One': 50, - 'PyArray_CastToType': 51, - 'PyArray_CastTo': 52, - 'PyArray_CastAnyTo': 53, - 'PyArray_CanCastSafely': 54, - 'PyArray_CanCastTo': 55, - 'PyArray_ObjectType': 56, - 'PyArray_DescrFromObject': 57, - 'PyArray_ConvertToCommonType': 58, - 'PyArray_DescrFromScalar': 59, - 'PyArray_DescrFromTypeObject': 60, - 'PyArray_Size': 61, - 'PyArray_Scalar': 62, - 'PyArray_FromScalar': 63, - 'PyArray_ScalarAsCtype': 64, - 'PyArray_CastScalarToCtype': 65, - 'PyArray_CastScalarDirect': 66, - 'PyArray_ScalarFromObject': 67, - 'PyArray_GetCastFunc': 68, - 'PyArray_FromDims': 69, - 'PyArray_FromDimsAndDataAndDescr': 70, - 'PyArray_FromAny': 71, - 'PyArray_EnsureArray': 72, - 'PyArray_EnsureAnyArray': 73, - 'PyArray_FromFile': 74, - 'PyArray_FromString': 75, - 'PyArray_FromBuffer': 76, - 'PyArray_FromIter': 77, - 'PyArray_Return': 78, - 'PyArray_GetField': 79, - 'PyArray_SetField': 80, - 'PyArray_Byteswap': 81, - 'PyArray_Resize': 82, - 'PyArray_MoveInto': 83, - 'PyArray_CopyInto': 84, - 'PyArray_CopyAnyInto': 85, - 'PyArray_CopyObject': 86, - 'PyArray_NewCopy': 87, - 'PyArray_ToList': 88, - 'PyArray_ToString': 89, - 'PyArray_ToFile': 90, - 'PyArray_Dump': 91, - 'PyArray_Dumps': 92, - 'PyArray_ValidType': 93, - 'PyArray_UpdateFlags': 94, - 'PyArray_New': 95, - 'PyArray_NewFromDescr': 96, - 'PyArray_DescrNew': 97, - 'PyArray_DescrNewFromType': 98, - 'PyArray_GetPriority': 99, - 'PyArray_IterNew': 100, - 'PyArray_MultiIterNew': 101, - 'PyArray_PyIntAsInt': 102, - 'PyArray_PyIntAsIntp': 103, - 'PyArray_Broadcast': 104, - 'PyArray_FillObjectArray': 105, - 'PyArray_FillWithScalar': 106, - 'PyArray_CheckStrides': 107, - 'PyArray_DescrNewByteorder': 108, - 'PyArray_IterAllButAxis': 109, - 'PyArray_CheckFromAny': 110, - 'PyArray_FromArray': 111, - 'PyArray_FromInterface': 112, - 'PyArray_FromStructInterface': 113, - 'PyArray_FromArrayAttr': 114, - 'PyArray_ScalarKind': 115, - 'PyArray_CanCoerceScalar': 116, - 'PyArray_NewFlagsObject': 117, - 'PyArray_CanCastScalar': 118, - 'PyArray_CompareUCS4': 119, - 'PyArray_RemoveSmallest': 120, - 'PyArray_ElementStrides': 121, - 'PyArray_Item_INCREF': 122, - 'PyArray_Item_XDECREF': 123, - 'PyArray_FieldNames': 124, - 'PyArray_Transpose': 125, - 'PyArray_TakeFrom': 126, - 'PyArray_PutTo': 127, - 'PyArray_PutMask': 128, - 'PyArray_Repeat': 129, - 'PyArray_Choose': 130, - 'PyArray_Sort': 131, - 'PyArray_ArgSort': 132, - 'PyArray_SearchSorted': 133, - 'PyArray_ArgMax': 134, - 'PyArray_ArgMin': 135, - 'PyArray_Reshape': 136, - 'PyArray_Newshape': 137, - 'PyArray_Squeeze': 138, - 'PyArray_View': 139, - 'PyArray_SwapAxes': 140, - 'PyArray_Max': 141, - 'PyArray_Min': 142, - 'PyArray_Ptp': 143, - 'PyArray_Mean': 144, - 'PyArray_Trace': 145, - 'PyArray_Diagonal': 146, - 'PyArray_Clip': 147, - 'PyArray_Conjugate': 148, - 'PyArray_Nonzero': 149, - 'PyArray_Std': 150, - 'PyArray_Sum': 151, - 'PyArray_CumSum': 152, - 'PyArray_Prod': 153, - 'PyArray_CumProd': 154, - 'PyArray_All': 155, - 'PyArray_Any': 156, - 'PyArray_Compress': 157, - 'PyArray_Flatten': 158, - 'PyArray_Ravel': 159, - 'PyArray_MultiplyList': 160, - 'PyArray_MultiplyIntList': 161, - 'PyArray_GetPtr': 162, - 'PyArray_CompareLists': 163, - 'PyArray_AsCArray': 164, - 'PyArray_As1D': 165, - 'PyArray_As2D': 166, - 'PyArray_Free': 167, - 'PyArray_Converter': 168, - 'PyArray_IntpFromSequence': 169, - 'PyArray_Concatenate': 170, - 'PyArray_InnerProduct': 171, - 'PyArray_MatrixProduct': 172, - 'PyArray_CopyAndTranspose': 173, - 'PyArray_Correlate': 174, - 'PyArray_TypestrConvert': 175, - 'PyArray_DescrConverter': 176, - 'PyArray_DescrConverter2': 177, - 'PyArray_IntpConverter': 178, - 'PyArray_BufferConverter': 179, - 'PyArray_AxisConverter': 180, - 'PyArray_BoolConverter': 181, - 'PyArray_ByteorderConverter': 182, - 'PyArray_OrderConverter': 183, - 'PyArray_EquivTypes': 184, - 'PyArray_Zeros': 185, - 'PyArray_Empty': 186, - 'PyArray_Where': 187, - 'PyArray_Arange': 188, - 'PyArray_ArangeObj': 189, - 'PyArray_SortkindConverter': 190, - 'PyArray_LexSort': 191, - 'PyArray_Round': 192, - 'PyArray_EquivTypenums': 193, - 'PyArray_RegisterDataType': 194, - 'PyArray_RegisterCastFunc': 195, - 'PyArray_RegisterCanCast': 196, - 'PyArray_InitArrFuncs': 197, - 'PyArray_IntTupleFromIntp': 198, - 'PyArray_TypeNumFromName': 199, - 'PyArray_ClipmodeConverter': 200, - 'PyArray_OutputConverter': 201, - 'PyArray_BroadcastToShape': 202, - '_PyArray_SigintHandler': 203, - '_PyArray_GetSigintBuf': 204, - 'PyArray_DescrAlignConverter': 205, - 'PyArray_DescrAlignConverter2': 206, - 'PyArray_SearchsideConverter': 207, - 'PyArray_CheckAxis': 208, - 'PyArray_OverflowMultiplyList': 209, - 'PyArray_CompareString': 210, - 'PyArray_MultiIterFromObjects': 211, - 'PyArray_GetEndianness': 212, - 'PyArray_GetNDArrayCFeatureVersion': 213, - 'PyArray_Correlate2': 214, - 'PyArray_NeighborhoodIterNew': 215, - 'PyArray_SetDatetimeParseFunction': 216, - 'PyArray_DatetimeToDatetimeStruct': 217, - 'PyArray_TimedeltaToTimedeltaStruct': 218, - 'PyArray_DatetimeStructToDatetime': 219, - 'PyArray_TimedeltaStructToTimedelta': 220, + 'PyArray_SetNumericOps': 40, + 'PyArray_GetNumericOps': 41, + 'PyArray_INCREF': 42, + 'PyArray_XDECREF': 43, + 'PyArray_SetStringFunction': 44, + 'PyArray_DescrFromType': 45, + 'PyArray_TypeObjectFromType': 46, + 'PyArray_Zero': 47, + 'PyArray_One': 48, + 'PyArray_CastToType': 49, + 'PyArray_CastTo': 50, + 'PyArray_CastAnyTo': 51, + 'PyArray_CanCastSafely': 52, + 'PyArray_CanCastTo': 53, + 'PyArray_ObjectType': 54, + 'PyArray_DescrFromObject': 55, + 'PyArray_ConvertToCommonType': 56, + 'PyArray_DescrFromScalar': 57, + 'PyArray_DescrFromTypeObject': 58, + 'PyArray_Size': 59, + 'PyArray_Scalar': 60, + 'PyArray_FromScalar': 61, + 'PyArray_ScalarAsCtype': 62, + 'PyArray_CastScalarToCtype': 63, + 'PyArray_CastScalarDirect': 64, + 'PyArray_ScalarFromObject': 65, + 'PyArray_GetCastFunc': 66, + 'PyArray_FromDims': 67, + 'PyArray_FromDimsAndDataAndDescr': 68, + 'PyArray_FromAny': 69, + 'PyArray_EnsureArray': 70, + 'PyArray_EnsureAnyArray': 71, + 'PyArray_FromFile': 72, + 'PyArray_FromString': 73, + 'PyArray_FromBuffer': 74, + 'PyArray_FromIter': 75, + 'PyArray_Return': 76, + 'PyArray_GetField': 77, + 'PyArray_SetField': 78, + 'PyArray_Byteswap': 79, + 'PyArray_Resize': 80, + 'PyArray_MoveInto': 81, + 'PyArray_CopyInto': 82, + 'PyArray_CopyAnyInto': 83, + 'PyArray_CopyObject': 84, + 'PyArray_NewCopy': 85, + 'PyArray_ToList': 86, + 'PyArray_ToString': 87, + 'PyArray_ToFile': 88, + 'PyArray_Dump': 89, + 'PyArray_Dumps': 90, + 'PyArray_ValidType': 91, + 'PyArray_UpdateFlags': 92, + 'PyArray_New': 93, + 'PyArray_NewFromDescr': 94, + 'PyArray_DescrNew': 95, + 'PyArray_DescrNewFromType': 96, + 'PyArray_GetPriority': 97, + 'PyArray_IterNew': 98, + 'PyArray_MultiIterNew': 99, + 'PyArray_PyIntAsInt': 100, + 'PyArray_PyIntAsIntp': 101, + 'PyArray_Broadcast': 102, + 'PyArray_FillObjectArray': 103, + 'PyArray_FillWithScalar': 104, + 'PyArray_CheckStrides': 105, + 'PyArray_DescrNewByteorder': 106, + 'PyArray_IterAllButAxis': 107, + 'PyArray_CheckFromAny': 108, + 'PyArray_FromArray': 109, + 'PyArray_FromInterface': 110, + 'PyArray_FromStructInterface': 111, + 'PyArray_FromArrayAttr': 112, + 'PyArray_ScalarKind': 113, + 'PyArray_CanCoerceScalar': 114, + 'PyArray_NewFlagsObject': 115, + 'PyArray_CanCastScalar': 116, + 'PyArray_CompareUCS4': 117, + 'PyArray_RemoveSmallest': 118, + 'PyArray_ElementStrides': 119, + 'PyArray_Item_INCREF': 120, + 'PyArray_Item_XDECREF': 121, + 'PyArray_FieldNames': 122, + 'PyArray_Transpose': 123, + 'PyArray_TakeFrom': 124, + 'PyArray_PutTo': 125, + 'PyArray_PutMask': 126, + 'PyArray_Repeat': 127, + 'PyArray_Choose': 128, + 'PyArray_Sort': 129, + 'PyArray_ArgSort': 130, + 'PyArray_SearchSorted': 131, + 'PyArray_ArgMax': 132, + 'PyArray_ArgMin': 133, + 'PyArray_Reshape': 134, + 'PyArray_Newshape': 135, + 'PyArray_Squeeze': 136, + 'PyArray_View': 137, + 'PyArray_SwapAxes': 138, + 'PyArray_Max': 139, + 'PyArray_Min': 140, + 'PyArray_Ptp': 141, + 'PyArray_Mean': 142, + 'PyArray_Trace': 143, + 'PyArray_Diagonal': 144, + 'PyArray_Clip': 145, + 'PyArray_Conjugate': 146, + 'PyArray_Nonzero': 147, + 'PyArray_Std': 148, + 'PyArray_Sum': 149, + 'PyArray_CumSum': 150, + 'PyArray_Prod': 151, + 'PyArray_CumProd': 152, + 'PyArray_All': 153, + 'PyArray_Any': 154, + 'PyArray_Compress': 155, + 'PyArray_Flatten': 156, + 'PyArray_Ravel': 157, + 'PyArray_MultiplyList': 158, + 'PyArray_MultiplyIntList': 159, + 'PyArray_GetPtr': 160, + 'PyArray_CompareLists': 161, + 'PyArray_AsCArray': 162, + 'PyArray_As1D': 163, + 'PyArray_As2D': 164, + 'PyArray_Free': 165, + 'PyArray_Converter': 166, + 'PyArray_IntpFromSequence': 167, + 'PyArray_Concatenate': 168, + 'PyArray_InnerProduct': 169, + 'PyArray_MatrixProduct': 170, + 'PyArray_CopyAndTranspose': 171, + 'PyArray_Correlate': 172, + 'PyArray_TypestrConvert': 173, + 'PyArray_DescrConverter': 174, + 'PyArray_DescrConverter2': 175, + 'PyArray_IntpConverter': 176, + 'PyArray_BufferConverter': 177, + 'PyArray_AxisConverter': 178, + 'PyArray_BoolConverter': 179, + 'PyArray_ByteorderConverter': 180, + 'PyArray_OrderConverter': 181, + 'PyArray_EquivTypes': 182, + 'PyArray_Zeros': 183, + 'PyArray_Empty': 184, + 'PyArray_Where': 185, + 'PyArray_Arange': 186, + 'PyArray_ArangeObj': 187, + 'PyArray_SortkindConverter': 188, + 'PyArray_LexSort': 189, + 'PyArray_Round': 190, + 'PyArray_EquivTypenums': 191, + 'PyArray_RegisterDataType': 192, + 'PyArray_RegisterCastFunc': 193, + 'PyArray_RegisterCanCast': 194, + 'PyArray_InitArrFuncs': 195, + 'PyArray_IntTupleFromIntp': 196, + 'PyArray_TypeNumFromName': 197, + 'PyArray_ClipmodeConverter': 198, + 'PyArray_OutputConverter': 199, + 'PyArray_BroadcastToShape': 200, + '_PyArray_SigintHandler': 201, + '_PyArray_GetSigintBuf': 202, + 'PyArray_DescrAlignConverter': 203, + 'PyArray_DescrAlignConverter2': 204, + 'PyArray_SearchsideConverter': 205, + 'PyArray_CheckAxis': 206, + 'PyArray_OverflowMultiplyList': 207, + 'PyArray_CompareString': 208, + 'PyArray_MultiIterFromObjects': 209, + 'PyArray_GetEndianness': 210, + 'PyArray_GetNDArrayCFeatureVersion': 211, + 'PyArray_Correlate2': 212, + 'PyArray_NeighborhoodIterNew': 213, +# 'PyArray_SetDatetimeParseFunction': 214, +# 'PyArray_DatetimeToDatetimeStruct': 218, +# 'PyArray_TimedeltaToTimedeltaStruct': 219, +# 'PyArray_DatetimeStructToDatetime': 220, +# 'PyArray_TimedeltaStructToTimedelta': 221, } ufunc_types_api = { Modified: branches/1.5.x/numpy/core/include/numpy/arrayscalars.h =================================================================== --- branches/1.5.x/numpy/core/include/numpy/arrayscalars.h 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/core/include/numpy/arrayscalars.h 2010-07-17 18:31:17 UTC (rev 8495) @@ -110,21 +110,9 @@ PyObject * obval; } PyObjectScalarObject; -typedef struct { - PyObject_HEAD - npy_datetime obval; - PyArray_DatetimeMetaData obmeta; -} PyDatetimeScalarObject; typedef struct { PyObject_HEAD - npy_timedelta obval; - PyArray_DatetimeMetaData obmeta; -} PyTimedeltaScalarObject; - - -typedef struct { - PyObject_HEAD char obval; } PyScalarObject; Modified: branches/1.5.x/numpy/core/include/numpy/ndarraytypes.h =================================================================== --- branches/1.5.x/numpy/core/include/numpy/ndarraytypes.h 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/core/include/numpy/ndarraytypes.h 2010-07-17 18:31:17 UTC (rev 8495) @@ -66,8 +66,7 @@ NPY_LONGLONG, NPY_ULONGLONG, NPY_FLOAT, NPY_DOUBLE, NPY_LONGDOUBLE, NPY_CFLOAT, NPY_CDOUBLE, NPY_CLONGDOUBLE, - NPY_DATETIME, NPY_TIMEDELTA, - NPY_OBJECT=19, + NPY_OBJECT=17, NPY_STRING, NPY_UNICODE, NPY_VOID, NPY_NTYPES, @@ -204,6 +203,7 @@ #define NPY_DATETIME_NUMUNITS (NPY_FR_as + 1) #define NPY_DATETIME_DEFAULTUNIT NPY_FR_us + #define NPY_STR_Y "Y" #define NPY_STR_M "M" #define NPY_STR_W "W" @@ -387,6 +387,10 @@ } PyArray_Dims; typedef struct { + /* Functions to cast to all other standard types*/ + /* Can have some NULL entries */ + PyArray_VectorUnaryFunc *cast[NPY_NTYPES]; + /* The next four functions *cannot* be NULL */ /* @@ -480,24 +484,9 @@ PyArray_FastClipFunc *fastclip; PyArray_FastPutmaskFunc *fastputmask; PyArray_FastTakeFunc *fasttake; - - /* - * A little room to grow --- should use generic function - * interface for most additions - */ - void *pad1; - void *pad2; - void *pad3; - void *pad4; - - /* - * Functions to cast to all other standard types - * Can have some NULL entries - */ - PyArray_VectorUnaryFunc *cast[NPY_NTYPES]; - } PyArray_ArrFuncs; + /* The item must be reference counted when it is inserted or extracted. */ #define NPY_ITEM_REFCOUNT 0x01 /* Same as needing REFCOUNT */ @@ -528,50 +517,41 @@ NPY_NEEDS_INIT | NPY_NEEDS_PYAPI) #define PyDataType_FLAGCHK(dtype, flag) \ - (((dtype)->flags & (flag)) == (flag)) + (((dtype)->hasobject & (flag)) == (flag)) #define PyDataType_REFCHK(dtype) \ PyDataType_FLAGCHK(dtype, NPY_ITEM_REFCOUNT) +/* Change dtype hasobject to 32-bit in 1.1 and change its name */ typedef struct _PyArray_Descr { PyObject_HEAD - PyTypeObject *typeobj; /* - * the type object representing an - * instance of this type -- should not - * be two type_numbers with the same type - * object. - */ + PyTypeObject *typeobj; /* the type object representing an + instance of this type -- should not + be two type_numbers with the same type + object. */ char kind; /* kind for this type */ char type; /* unique-character representing this type */ - char byteorder; /* - * '>' (big), '<' (little), '|' - * (not-applicable), or '=' (native). - */ - char unused; - int flags; /* flag describing data type */ - int type_num; /* number representing this type */ + char byteorder; /* '>' (big), '<' (little), '|' + (not-applicable), or '=' (native). */ + char hasobject; /* non-zero if it has object arrays + in fields */ + int type_num; /* number representing this type */ int elsize; /* element size for this type */ int alignment; /* alignment needed for this type */ struct _arr_descr \ - *subarray; /* - * Non-NULL if this type is - * is an array (C-contiguous) - * of some other type - */ - PyObject *fields; /* The fields dictionary for this type - * For statically defined descr this - * is always Py_None - */ + *subarray; /* Non-NULL if this type is + is an array (C-contiguous) + of some other type + */ + PyObject *fields; /* The fields dictionary for this type */ + /* For statically defined descr this + is always Py_None */ - PyObject *names; /* - * An ordered tuple of field names or NULL - * if no fields are defined - */ + PyObject *names; /* An ordered tuple of field names or NULL + if no fields are defined */ - PyArray_ArrFuncs *f; /* - * a table of functions specific for each - * basic data descriptor - */ + PyArray_ArrFuncs *f; /* a table of functions specific for each + basic data descriptor */ PyObject *metadata; /* Metadata about this dtype */ } PyArray_Descr; @@ -638,39 +618,6 @@ } PyArray_Chunk; -typedef struct { - NPY_DATETIMEUNIT base; - int num; - int den; /* - * Converted to 1 on input for now -- an - * input-only mechanism - */ - int events; -} PyArray_DatetimeMetaData; - -typedef struct { - npy_longlong year; - int month, day, hour, min, sec, us, ps, as; -} npy_datetimestruct; - -typedef struct { - npy_longlong day; - int sec, us, ps, as; -} npy_timedeltastruct; - -#if PY_VERSION_HEX >= 0x03000000 -#define PyDataType_GetDatetimeMetaData(descr) \ - ((descr->metadata == NULL) ? NULL : \ - ((PyArray_DatetimeMetaData *)(PyCapsule_GetPointer( \ - PyDict_GetItemString( \ - descr->metadata, NPY_METADATA_DTSTR), NULL)))) -#else -#define PyDataType_GetDatetimeMetaData(descr) \ - ((descr->metadata == NULL) ? NULL : \ - ((PyArray_DatetimeMetaData *)(PyCObject_AsVoidPtr( \ - PyDict_GetItemString(descr->metadata, NPY_METADATA_DTSTR))))) -#endif - typedef int (PyArray_FinalizeFunc)(PyArrayObject *, PyObject *); /* @@ -1245,9 +1192,6 @@ #define PyTypeNum_ISFLEXIBLE(type) (((type) >=NPY_STRING) && \ ((type) <=NPY_VOID)) -#define PyTypeNum_ISDATETIME(type) (((type) >=NPY_DATETIME) && \ - ((type) <=NPY_TIMEDELTA)) - #define PyTypeNum_ISUSERDEF(type) (((type) >= NPY_USERDEF) && \ ((type) < NPY_USERDEF+ \ NPY_NUMUSERTYPES)) @@ -1268,7 +1212,6 @@ #define PyDataType_ISCOMPLEX(obj) PyTypeNum_ISCOMPLEX(((PyArray_Descr*)(obj))->type_num) #define PyDataType_ISPYTHON(obj) PyTypeNum_ISPYTHON(((PyArray_Descr*)(obj))->type_num) #define PyDataType_ISFLEXIBLE(obj) PyTypeNum_ISFLEXIBLE(((PyArray_Descr*)(obj))->type_num) -#define PyDataType_ISDATETIME(obj) PyTypeNum_ISDATETIME(((PyArray_Descr*)(obj))->type_num) #define PyDataType_ISUSERDEF(obj) PyTypeNum_ISUSERDEF(((PyArray_Descr*)(obj))->type_num) #define PyDataType_ISEXTENDED(obj) PyTypeNum_ISEXTENDED(((PyArray_Descr*)(obj))->type_num) #define PyDataType_ISOBJECT(obj) PyTypeNum_ISOBJECT(((PyArray_Descr*)(obj))->type_num) @@ -1284,7 +1227,6 @@ #define PyArray_ISCOMPLEX(obj) PyTypeNum_ISCOMPLEX(PyArray_TYPE(obj)) #define PyArray_ISPYTHON(obj) PyTypeNum_ISPYTHON(PyArray_TYPE(obj)) #define PyArray_ISFLEXIBLE(obj) PyTypeNum_ISFLEXIBLE(PyArray_TYPE(obj)) -#define PyArray_ISDATETIME(obj) PyTypeNum_ISDATETIME(PyArray_TYPE(obj)) #define PyArray_ISUSERDEF(obj) PyTypeNum_ISUSERDEF(PyArray_TYPE(obj)) #define PyArray_ISEXTENDED(obj) PyTypeNum_ISEXTENDED(PyArray_TYPE(obj)) #define PyArray_ISOBJECT(obj) PyTypeNum_ISOBJECT(PyArray_TYPE(obj)) Modified: branches/1.5.x/numpy/core/numerictypes.py =================================================================== --- branches/1.5.x/numpy/core/numerictypes.py 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/core/numerictypes.py 2010-07-17 18:31:17 UTC (rev 8495) @@ -39,10 +39,6 @@ longfloat, clongfloat, - datetime_, timedelta_, (these inherit from timeinteger which inherits - from signedinteger) - - As part of the type-hierarchy: xx -- is bit-width generic @@ -396,9 +392,7 @@ ('longcomplex', 'clongdouble'), ('bool_', 'bool'), ('unicode_', 'unicode'), - ('object_', 'object'), - ('timedelta_', 'timedelta'), - ('datetime_', 'datetime')] + ('object_', 'object')] if sys.version_info[0] >= 3: type_pairs.extend([('bytes_', 'string'), ('str_', 'unicode'), @@ -412,7 +406,7 @@ sctypeDict[alias] = sctypeDict[t] # Remove aliases overriding python types and modules to_remove = ['ulong', 'object', 'unicode', 'int', 'long', 'float', - 'complex', 'bool', 'string', 'datetime', 'timedelta'] + 'complex', 'bool', 'string'] if sys.version_info[0] >= 3: # Py3K to_remove.append('bytes') @@ -832,8 +826,7 @@ 'Complex':'FDG', 'AllInteger':'bBhHiIlLqQpP', 'AllFloat':'fdgFDG', - 'Datetime': 'Mm', - 'All':'?bhilqpBHILQPfdgFDGSUVOMm'} + 'All':'?bhilqpBHILQPfdgFDGSUVO'} # backwards compatibility --- deprecated name typeDict = sctypeDict @@ -844,13 +837,11 @@ # i -> signed integer # f -> floating point # c -> complex -# M -> datetime -# m -> timedelta # S -> string # U -> Unicode string # V -> record # O -> Python object -_kind_list = ['b', 'u', 'i', 'f', 'c', 'S', 'U', 'V', 'O', 'M', 'm'] +_kind_list = ['b', 'u', 'i', 'f', 'c', 'S', 'U', 'V', 'O'] __test_types = typecodes['AllInteger'][:-2]+typecodes['AllFloat']+'O' __len_test_types = len(__test_types) Modified: branches/1.5.x/numpy/core/setup.py =================================================================== --- branches/1.5.x/numpy/core/setup.py 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/core/setup.py 2010-07-17 18:31:17 UTC (rev 8495) @@ -723,7 +723,6 @@ join('src', 'multiarray', 'arrayobject.c'), join('src', 'multiarray', 'numpymemoryview.c'), join('src', 'multiarray', 'buffer.c'), - join('src', 'multiarray', 'datetime.c'), join('src', 'multiarray', 'numpyos.c'), join('src', 'multiarray', 'conversion_utils.c'), join('src', 'multiarray', 'flagsobject.c'), Modified: branches/1.5.x/numpy/core/setup_common.py =================================================================== --- branches/1.5.x/numpy/core/setup_common.py 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/core/setup_common.py 2010-07-17 18:31:17 UTC (rev 8495) @@ -21,7 +21,7 @@ # Binary compatibility version number. This number is increased whenever the # C-API is changed such that binary compatibility is broken, i.e. whenever a # recompile of extension modules is needed. -C_ABI_VERSION = 0x02000000 +C_ABI_VERSION = 0x01000009 # Minor API version. This number is increased whenever a change is made to the # C-API -- whether it breaks binary compatibility or not. Some changes, such @@ -29,7 +29,7 @@ # without breaking binary compatibility. In this case, only the C_API_VERSION # (*not* C_ABI_VERSION) would be increased. Whenever binary compatibility is # broken, both C_API_VERSION and C_ABI_VERSION should be increased. -C_API_VERSION = 0x00000005 +C_API_VERSION = 0x00000004 class MismatchCAPIWarning(Warning): pass Modified: branches/1.5.x/numpy/core/src/multiarray/arrayobject.c =================================================================== --- branches/1.5.x/numpy/core/src/multiarray/arrayobject.c 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/core/src/multiarray/arrayobject.c 2010-07-17 18:31:17 UTC (rev 8495) @@ -323,7 +323,6 @@ static PyObject *PyArray_StrFunction = NULL; static PyObject *PyArray_ReprFunction = NULL; -static PyObject *PyArray_DatetimeParseFunction = NULL; /*NUMPY_API * Set the array print function to be a Python function. @@ -349,21 +348,6 @@ } } -/*NUMPY_API - * Set the date time print function to be a Python function. - */ -NPY_NO_EXPORT void -PyArray_SetDatetimeParseFunction(PyObject *op) -{ - /* Dispose of previous callback */ - Py_XDECREF(PyArray_DatetimeParseFunction); - /* Add a reference to the new callback */ - Py_XINCREF(op); - /* Remember new callback */ - PyArray_DatetimeParseFunction = op; -} - - static PyObject * array_repr(PyArrayObject *self) { Modified: branches/1.5.x/numpy/core/src/multiarray/arraytypes.c.src =================================================================== --- branches/1.5.x/numpy/core/src/multiarray/arraytypes.c.src 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/core/src/multiarray/arraytypes.c.src 2010-07-17 18:31:17 UTC (rev 8495) @@ -1,7 +1,6 @@ /* -*- c -*- */ #define PY_SSIZE_T_CLEAN #include "Python.h" -#include "datetime.h" #include "structmember.h" #define _MULTIARRAYMODULE @@ -17,7 +16,6 @@ #include "ctors.h" #include "usertypes.h" #include "npy_config.h" -#include "_datetime.h" #include "numpyos.h" @@ -761,464 +759,8 @@ return -1; } -/* - * Acknowledgement: Example code contributed by Marty Fuhr sponsored by - * Google Summer of Code 2009 was used to integrate and adapt the mxDateTime - * parser - */ -/* #include "datetime.c" --- now included in multiarray_onefile */ - - -/* DateTime Objects in Python only keep microsecond resolution. - * - * When converting from datetime objects with an event component return a - * tuple: * (baseunit, number of event) where baseunit follows is a datetime - * type and number of events is a Python integer - */ - - /* - * Return a Python Datetime Object from a number representing the number of - * units since the epoch (1970-01-01T00:00:00Z) ignoring leap seconds. - */ - -NPY_NO_EXPORT PyObject * -PyDateTime_FromNormalized(npy_datetime val, NPY_DATETIMEUNIT base) -{ - npy_datetimestruct ydate; - - /* Must be here to use PyDateTime_FromDateAndTime */ - PyDateTime_IMPORT; - - /* We just truncate the unused variables and don't wory about overflow */ - PyArray_DatetimeToDatetimeStruct(val, base, &ydate); - - /* FIXME?: We discard ydate.ns, ydate.ps, ydate.fs, and ydate.as */ - return PyDateTime_FromDateAndTime(ydate.year, ydate.month, ydate.day, - ydate.hour, ydate.min, ydate.sec, - ydate.us); -} - -/* - * We also can lose precision and range here. Ignored. - * Don't use this function if you care. - */ - -NPY_NO_EXPORT PyObject * -PyTimeDelta_FromNormalized(npy_timedelta val, NPY_DATETIMEUNIT base) -{ - npy_timedeltastruct td; - - PyDateTime_IMPORT; - PyArray_TimedeltaToTimedeltaStruct(val, base, &td); - - /* We discard td.ps and td.as */ - return PyDelta_FromDSU(td.day, td.sec, td.us); -} - - -NPY_NO_EXPORT PyObject * -PyDateTime_FromInt64(datetime val, PyArray_Descr *descr) -{ - PyArray_DatetimeMetaData *meta; - - meta = PyDataType_GetDatetimeMetaData(descr); - if (meta == NULL) { - PyErr_SetString(PyExc_RuntimeError, - "metadata not set for descriptor"); - return NULL; - } - - if (meta->events > 1) { - int events, rem, div; - PyObject *obj; - - obj = PyTuple_New(2); - events = meta->events; - div = val/events; - rem = val % events; - PyTuple_SET_ITEM(obj, 1, PyInt_FromLong(rem)); - /* This resets meta->events for recursive call */ - meta->events = 1; - PyTuple_SET_ITEM(obj, 0, PyDateTime_FromInt64(div, descr)); - meta->events = events; - if (PyErr_Occurred()) { - Py_DECREF(obj); - return NULL; - } - return obj; - } - - /* - * We normalize the number to a base-unit and then return a - * Python Datetime Object - * - * FIXME? : We silently truncate if it doesn't fit, either too - * wide (e.g. 10 BC) or too narrow (nanoseconds) - */ - - /* Normalization and then conversion to Datetime */ - /* FIXME? : Check for Overflow... */ - return PyDateTime_FromNormalized(val*meta->num, meta->base); -} - - -NPY_NO_EXPORT PyObject * -PyTimeDelta_FromInt64(timedelta val, PyArray_Descr *descr) -{ - PyArray_DatetimeMetaData *meta; - meta = PyDataType_GetDatetimeMetaData(descr); - if (meta == NULL) { - PyErr_SetString(PyExc_RuntimeError, - "metadata not set for descriptor"); - return NULL; - } - - if (meta->events > 1) { - int events, rem, div; - PyObject *obj; - - obj = PyTuple_New(2); - events = meta->events; - div = val/events; - rem = val % events; - PyTuple_SET_ITEM(obj, 1, PyInt_FromLong(rem)); - /* This resets meta->events for recursive call */ - meta->events = 1; - PyTuple_SET_ITEM(obj, 0, PyTimeDelta_FromInt64(div, descr)); - meta->events = events; - if (PyErr_Occurred()) { - Py_DECREF(obj); - return NULL; - } - return obj; - } - - /* FIXME? : Check for Overflow */ - return PyTimeDelta_FromNormalized(val*meta->num, meta->base); -} - - - -NPY_NO_EXPORT npy_datetime -PyDateTime_AsNormalized(PyObject *obj, NPY_DATETIMEUNIT base) -{ - npy_datetimestruct ydate; - - /* Must be here to use PyDateTime_FromDateAndTime */ - PyDateTime_IMPORT; - - if (!PyDateTime_Check(obj) && !PyDate_Check(obj)) { - PyErr_SetString(PyExc_ValueError, - "Must be a datetime.date or datetime.datetime object"); - return -1; - } - - ydate.year = PyDateTime_GET_YEAR(obj); - ydate.month = PyDateTime_GET_MONTH(obj); - ydate.day = PyDateTime_GET_DAY(obj); - - if (PyDateTime_Check(obj)) { - ydate.hour = PyDateTime_DATE_GET_HOUR(obj); - ydate.min = PyDateTime_DATE_GET_MINUTE(obj); - ydate.sec = PyDateTime_DATE_GET_SECOND(obj); - ydate.us = PyDateTime_DATE_GET_MICROSECOND(obj); - } - else { - ydate.hour = 0; - ydate.min = 0; - ydate.sec = 0; - ydate.us = 0; - } - - ydate.ps = 0; - ydate.as = 0; - - /* We just truncate the unused variables and don't wory about overflow */ - return PyArray_DatetimeStructToDatetime(base, &ydate); -} - -NPY_NO_EXPORT npy_timedelta -PyTimeDelta_AsNormalized(PyObject *obj, NPY_DATETIMEUNIT base) -{ - npy_timedeltastruct td; - - PyDateTime_IMPORT; - - if (!PyDelta_Check(obj)) { - PyErr_SetString(PyExc_ValueError, - "Must be a datetime.timedelta object"); - return -1; - } - - td.day = ((PyDateTime_Delta *)obj)->days; - td.sec = ((PyDateTime_Delta *)obj)->seconds; - td.us = ((PyDateTime_Delta *)obj)->microseconds; - td.ps = 0; - td.as = 0; - - return PyArray_TimedeltaStructToTimedelta(base, &td); -} - - -/* - * These expect a 2-tuple if meta->events > 1 (baseobj, num-counts) - * where baseobj is a datetime object or a timedelta object respectively. - * - */ - -NPY_NO_EXPORT npy_datetime -PyDateTime_AsInt64(PyObject *obj, PyArray_Descr *descr) -{ - PyArray_DatetimeMetaData *meta; - npy_datetime res; - - meta = PyDataType_GetDatetimeMetaData(descr); - if (meta == NULL) { - PyErr_SetString(PyExc_RuntimeError, - "metadata not set for descriptor"); - return -1; - } - - - if (meta->events > 1) { - datetime tmp; - int events; - - if (!PyTuple_Check(obj) || PyTuple_GET_SIZE(obj) != 2) { - PyErr_SetString(PyExc_ValueError, - "need a 2-tuple on setting if events > 1"); - return -1; - } - /* Alter the dictionary and call again */ - /* FIXME: not thread safe */ - events = meta->events; - meta->events = 1; - tmp = PyDateTime_AsInt64(PyTuple_GET_ITEM(obj, 0), descr); - meta->events = events; - if (PyErr_Occurred()) { - return -1; - } - /* FIXME: Check for overflow */ - tmp *= events; - tmp += MyPyLong_AsLongLong(PyTuple_GET_ITEM(obj, 1)); - if (PyErr_Occurred()) { - return -1; - } - return tmp; - } - - res = PyDateTime_AsNormalized(obj, meta->base); - return res/meta->num; -} - - -NPY_NO_EXPORT timedelta -PyTimeDelta_AsInt64(PyObject *obj, PyArray_Descr *descr) -{ - PyArray_DatetimeMetaData *meta; - npy_timedelta res; - - meta = PyDataType_GetDatetimeMetaData(descr); - if (meta == NULL) { - PyErr_SetString(PyExc_RuntimeError, - "metadata not set for descriptor"); - return -1; - } - - if (meta->events > 1) { - timedelta tmp; - int events; - - if (!PyTuple_Check(obj) || PyTuple_GET_SIZE(obj) != 2) { - PyErr_SetString(PyExc_ValueError, - "need a 2-tuple on setting if events > 1"); - return -1; - } - /* Alter the dictionary and call again (not thread safe) */ - events = meta->events; - meta->events = 1; - tmp = PyTimeDelta_AsInt64(PyTuple_GET_ITEM(obj, 0), descr); - meta->events = events; - if (PyErr_Occurred()) { - return -1; - } - /* FIXME: Check for overflow */ - tmp *= events; - tmp += MyPyLong_AsLongLong(PyTuple_GET_ITEM(obj, 1)); - if (PyErr_Occurred()) { - return -1; - } - return tmp; - } - - res = PyTimeDelta_AsNormalized(obj, meta->base); - return res / meta->num; -} - - -/* - * Always return DateTime Object after normalizing to basic units (or a tuple - * if meta->events > 1): - * - * Problem: DateTime does not support all the resolutions (ns) nor the - * dynamic range (pre 1 AD) of NumPy Date-times. - * - * getitem is not used that much --- if losing resolution hurts, stick - * with the array scalar versions of the date-time. - * - * considered returning array scalars here just like longdouble. This has the - * problem of recursion in some cases (because in a few places the code - * expects getitem to return a Python-system object) - * - * considered returning different things depending on the resolution but this - * would make it hard to write generic code --- but do you need to write - * generic code on all the frequencies because they cover a wide range. - * - * Solution: The use-case of actually wanting a date-time object when the - * resolution and dynamic range match, make it the compelling default. When it - * does fails, there are alternatives for the programmer to use. - * - * New question: Should we change (c)longdouble at this point? to return Python Float? - */ - -static PyObject * -DATETIME_getitem(char *ip, PyArrayObject *ap) { - datetime t1; - - if ((ap == NULL) || PyArray_ISBEHAVED_RO(ap)) { - t1 = *((datetime *)ip); - return PyDateTime_FromInt64((datetime)t1, ap->descr); - } - else { - ap->descr->f->copyswap(&t1, ip, !PyArray_ISNOTSWAPPED(ap), ap); - return PyDateTime_FromInt64((datetime)t1, ap->descr); - } -} - - -static PyObject * -TIMEDELTA_getitem(char *ip, PyArrayObject *ap) { - timedelta t1; - - if ((ap == NULL) || PyArray_ISBEHAVED_RO(ap)) { - t1 = *((timedelta *)ip); - return PyTimeDelta_FromInt64((timedelta)t1, ap->descr); - } - else { - ap->descr->f->copyswap(&t1, ip, !PyArray_ISNOTSWAPPED(ap), ap); - return PyTimeDelta_FromInt64((timedelta)t1, ap->descr); - } -} - -/* FIXME: - * This needs to take - * 1) Integers and Longs (anything that can be converted to an Int) - * 2) Strings (ISO-style dates) - * 3) Datetime Scalars (that it converts based on scalar dtype. - * 4) Datetime and Date objects - * Plus a tuple for meta->events > 1 - * - * 3) is partially implemented, 4) is implemented - */ - -static int -DATETIME_setitem(PyObject *op, char *ov, PyArrayObject *ap) { - /* ensure alignment */ - datetime temp; - - if (PyArray_IsScalar(op, Datetime)) { - /* This needs to convert based on type */ - temp = ((PyDatetimeScalarObject *)op)->obval; - } -#if defined(NPY_PY3K) - else if (PyUString_Check(op)) { -#else - else if (PyUString_Check(op) || PyUnicode_Check(op)) { -#endif - /* FIXME: Converts to DateTime first and therefore does not handle extended notation */ - /* import _mx_datetime_parser - * res = _mx_datetime_parser(name) - * Convert from datetime to Int - */ - PyObject *res, *module; - - module = PyImport_ImportModule("numpy.core._mx_datetime_parser"); - if (module == NULL) { return -1; } - res = PyObject_CallMethod(module, "datetime_from_string", "O", op); - Py_DECREF(module); - if (res == NULL) { return -1; } - temp = PyDateTime_AsInt64(res, ap->descr); - Py_DECREF(res); - if (PyErr_Occurred()) return -1; - } - else if (PyInt_Check(op)) { - temp = PyInt_AS_LONG(op); - } - else if (PyLong_Check(op)) { - temp = PyLong_AsLongLong(op); - } - else { - temp = PyDateTime_AsInt64(op, ap->descr); - } - if (PyErr_Occurred()) { - if (PySequence_Check(op)) { - PyErr_Clear(); - PyErr_SetString(PyExc_ValueError, _SEQUENCE_MESSAGE); - } - return -1; - } - if (ap == NULL || PyArray_ISBEHAVED(ap)) - *((datetime *)ov)=temp; - else { - ap->descr->f->copyswap(ov, &temp, !PyArray_ISNOTSWAPPED(ap), ap); - } - return 0; -} - -/* FIXME: This needs to take - * 1) Integers and Longs (anything that can be converted to an Int) - * 2) Timedelta scalar objects (with resolution conversion) - * 3) Python Timedelta objects - * - * Plus a tuple for meta->events > 1 - */ - -static int -TIMEDELTA_setitem(PyObject *op, char *ov, PyArrayObject *ap) { - /* ensure alignment */ - timedelta temp; - - if (PyArray_IsScalar(op, Timedelta)) { - temp = ((PyTimedeltaScalarObject *)op)->obval; - } - else if (PyInt_Check(op)) { - temp = PyInt_AS_LONG(op); - } - else if (PyLong_Check(op)) { - temp = PyLong_AsLongLong(op); - } - else { - temp = PyTimeDelta_AsInt64(op, ap->descr); - } - if (PyErr_Occurred()) { - if (PySequence_Check(op)) { - PyErr_Clear(); - PyErr_SetString(PyExc_ValueError, _SEQUENCE_MESSAGE); - } - return -1; - } - if (ap == NULL || PyArray_ISBEHAVED(ap)) - *((timedelta *)ov)=temp; - else { - ap->descr->f->copyswap(ov, &temp, !PyArray_ISNOTSWAPPED(ap), ap); - } - return 0; -} - - -/* ***************************************************************************** ** TYPE TO TYPE CONVERSIONS ** ***************************************************************************** @@ -1231,21 +773,17 @@ /**begin repeat * * #TOTYPE = BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, - * LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, DATETIME, - * TIMEDELTA# + * LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE# * #totype = byte, ubyte, short, ushort, int, uint, long, ulong, - * longlong, ulonglong, float, double, longdouble, datetime, - * timedelta# + * longlong, ulonglong, float, double, longdouble# */ /**begin repeat1 * * #FROMTYPE = BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, - * LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, DATETIME, - * TIMEDELTA# + * LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE# * #fromtype = byte, ubyte, short, ushort, int, uint, long, ulong, - * longlong, ulonglong, float, double, longdouble, datetime, - * timedelta# + * longlong, ulonglong, float, double, longdouble# */ static void @FROMTYPE at _to_@TOTYPE@(@fromtype@ *ip, @totype@ *op, intp n, @@ -1279,11 +817,9 @@ /**begin repeat * * #FROMTYPE = BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, - * LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, DATETIME, - * TIMEDELTA# + * LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE# * #fromtype = Bool, byte, ubyte, short, ushort, int, uint, long, ulong, - * longlong, ulonglong, float, double, longdouble, datetime, - * timedelta# + * longlong, ulonglong, float, double, longdouble# */ static void @FROMTYPE at _to_BOOL(@fromtype@ *ip, Bool *op, intp n, @@ -1314,11 +850,9 @@ /**begin repeat * #TOTYPE = BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, - * LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, DATETIME, - * TIMEDELTA# + * LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE# * #totype = byte, ubyte, short, ushort, int, uint, long, ulong, - * longlong, ulonglong, float, double, longdouble, datetime, - * timedelta# + * longlong, ulonglong, float, double, longdouble# */ static void BOOL_to_ at TOTYPE@(Bool *ip, @totype@ *op, intp n, @@ -1338,11 +872,9 @@ /**begin repeat1 * #FROMTYPE = BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, - * LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, DATETIME, - * TIMEDELTA# + * LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE# * #fromtype = Bool, byte, ubyte, short, ushort, int, uint, long, ulong, - * longlong, ulonglong, float, double, longdouble, datetime, - * timedelta# + * longlong, ulonglong, float, double, longdouble# */ static void @FROMTYPE at _to_@TOTYPE@(@fromtype@ *ip, @totype@ *op, intp n, @@ -1384,13 +916,11 @@ * * #FROMTYPE = BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, * LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, - * CFLOAT, CDOUBLE, CLONGDOUBLE, STRING, UNICODE, VOID, OBJECT, - * DATETIME, TIMEDELTA# + * CFLOAT, CDOUBLE, CLONGDOUBLE, STRING, UNICODE, VOID, OBJECT# * #fromtype = Bool, byte, ubyte, short, ushort, int, uint, long, ulong, * longlong, ulonglong, float, double, longdouble, - * cfloat, cdouble, clongdouble, char, char, char, PyObject *, - * datetime, timedelta# - * #skip = 1*17, aip->descr->elsize*3, 1*3# + * cfloat, cdouble, clongdouble, char, char, char, PyObject *# + * #skip = 1*17, aip->descr->elsize*3, 1*1# */ static void @FROMTYPE at _to_OBJECT(@fromtype@ *ip, PyObject **op, intp n, PyArrayObject *aip, @@ -1432,13 +962,11 @@ * * #TOTYPE = BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, * LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, - * CFLOAT, CDOUBLE, CLONGDOUBLE, STRING, UNICODE, VOID, DATETIME, - * TIMEDELTA# + * CFLOAT, CDOUBLE, CLONGDOUBLE, STRING, UNICODE, VOID# * #totype = Bool, byte, ubyte, short, ushort, int, uint, long, ulong, * longlong, ulonglong, float, double, longdouble, - * cfloat, cdouble, clongdouble, char, char, char, datetime, - * timedelta# - * #skip = 1*17, aop->descr->elsize*3, 1*2# + * cfloat, cdouble, clongdouble, char, char, char# + * #skip = 1*17, aop->descr->elsize*3# */ static void OBJECT_to_ at TOTYPE@(PyObject **ip, @totype@ *op, intp n, @@ -1461,13 +989,13 @@ /**begin repeat * - * #from = STRING*22, UNICODE*22, VOID*22# - * #fromtyp = char*66# - * #to = (BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, STRING, UNICODE, VOID, DATETIME, TIMEDELTA)*3# - * #totyp = (Bool, byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble, cfloat, cdouble, clongdouble, char, char, char, datetime, timedelta)*3# - * #oskip = (1*17,aop->descr->elsize*3,1*2)*3# - * #convert = 1*17, 0*3, 1*2, 1*17, 0*3, 1*2, 0*22# - * #convstr = (Int*9, Long*2, Float*3, Complex*3, Tuple*3, Long*2)*3# + * #from = STRING*20, UNICODE*20, VOID*20# + * #fromtyp = char*60# + * #to = (BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, STRING, UNICODE, VOID)*3# + * #totyp = (Bool, byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble, cfloat, cdouble, clongdouble, char, char, char)*3# + * #oskip = (1*17,aop->descr->elsize*3)*3# + * #convert = 1*17, 0*3, 1*17, 0*3, 0*20# + * #convstr = (Int*9, Long*2, Float*3, Complex*3, Tuple*3)*3# */ static void @from at _to_@to@(@fromtyp@ *ip, @totyp@ *op, intp n, PyArrayObject *aip, @@ -1513,14 +1041,14 @@ /**begin repeat * - * #to = STRING*19, UNICODE*19, VOID*19# - * #totyp = char*19, char*19, char*19# + * #to = STRING*17, UNICODE*17, VOID*17# + * #totyp = char*17, char*17, char*17# * #from = (BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, * LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, - * CFLOAT, CDOUBLE, CLONGDOUBLE, DATETIME, TIMEDELTA)*3# + * CFLOAT, CDOUBLE, CLONGDOUBLE)*3# * #fromtyp = (Bool, byte, ubyte, short, ushort, int, uint, long, ulong, * longlong, ulonglong, float, double, longdouble, - * cfloat, cdouble, clongdouble, datetime, timedelta)*3# + * cfloat, cdouble, clongdouble)*3# */ static void @from at _to_@to@(@fromtyp@ *ip, @totyp@ *op, intp n, PyArrayObject *aip, @@ -1617,8 +1145,7 @@ } /**begin repeat - * #fname = CFLOAT, CDOUBLE, CLONGDOUBLE, OBJECT, STRING, UNICODE, VOID, - * DATETIME, TIMEDELTA# + * #fname = CFLOAT, CDOUBLE, CLONGDOUBLE, OBJECT, STRING, UNICODE, VOID# */ #define @fname at _scan NULL /**end repeat**/ @@ -1633,11 +1160,11 @@ /**begin repeat * #fname = BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, - * ULONGLONG, DATETIME, TIMEDELTA# + * ULONGLONG# * #type = byte, ubyte, short, ushort, int, uint, long, ulong, longlong, - * ulonglong, datetime, timedelta# - * #func = (l, ul)*5, l, l# - * #btype = (long, ulong)*5, long, long# + * ulonglong# + * #func = (l, ul)*5# + * #btype = (long, ulong)*5# */ static int @fname at _fromstr(char *str, @type@ *ip, char **endptr, PyArray_Descr *NPY_UNUSED(ignore)) @@ -1685,11 +1212,11 @@ /**begin repeat * * #fname = SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, FLOAT, - * DOUBLE, LONGDOUBLE, DATETIME, TIMEDELTA# + * DOUBLE, LONGDOUBLE# * #fsize = SHORT, SHORT, INT, INT, LONG, LONG, LONGLONG, LONGLONG, FLOAT, - * DOUBLE, LONGDOUBLE, DATETIME, TIMEDELTA# + * DOUBLE, LONGDOUBLE# * #type = short, ushort, int, uint, long, ulong, longlong, ulonglong, float, - * double, longdouble, datetime, timedelta# + * double, longdouble# */ static void @fname at _copyswapn (void *dst, intp dstride, void *src, intp sstride, @@ -2226,11 +1753,9 @@ /**begin repeat * * #fname = BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, - * LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, - * DATETIME, TIMEDELTA# + * LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE# * #type = Bool, byte, ubyte, short, ushort, int, uint, long, ulong, - * longlong, ulonglong, float, double, longdouble, - * datetime, timedelta# + * longlong, ulonglong, float, double, longdouble# */ static Bool @fname at _nonzero (char *ip, PyArrayObject *ap) @@ -2447,9 +1972,9 @@ /**begin repeat * #TYPE = BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, - * LONGLONG, ULONGLONG, DATETIME, TIMEDELTA# + * LONGLONG, ULONGLONG# * #type = byte, ubyte, short, ushort, int, uint, long, ulong, - * longlong, ulonglong, datetime, timedelta# + * longlong, ulonglong# */ static int @@ -2731,11 +2256,11 @@ * * #fname = BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, * LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, - * CFLOAT, CDOUBLE, CLONGDOUBLE, DATETIME, TIMEDELTA# + * CFLOAT, CDOUBLE, CLONGDOUBLE# * #type = Bool, byte, ubyte, short, ushort, int, uint, long, ulong, * longlong, ulonglong, float, double, longdouble, - * float, double, longdouble, datetime, timedelta# - * #incr = ip++*14, ip+=2*3, ip++*2# + * float, double, longdouble# + * #incr= ip++*14, ip+=2*3# */ static int @fname at _argmax(@type@ *ip, intp n, intp *max_ind, PyArrayObject *NPY_UNUSED(aip)) @@ -2842,14 +2367,11 @@ /**begin repeat * * #name = BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, - * LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, - * DATETIME, TIMEDELTA# + * LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE# * #type = byte, ubyte, short, ushort, int, uint, long, ulong, - * longlong, ulonglong, float, double, longdouble, - * datetime, timedelta# + * longlong, ulonglong, float, double, longdouble# * #out = long, ulong, long, ulong, long, ulong, long, ulong, - * longlong, ulonglong, float, double, longdouble, - * datetime, timedelta# + * longlong, ulonglong, float, double, longdouble# */ static void @name at _dot(char *ip1, intp is1, char *ip2, intp is2, char *op, intp n, @@ -2977,11 +2499,9 @@ /**begin repeat * * #NAME = BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, - * LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, - * DATETIME, TIMEDELTA# + * LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE# * #typ = byte, ubyte, short, ushort, int, uint, long, ulong, - * longlong, ulonglong, float, double, longdouble, - * datetime, timedelta# + * longlong, ulonglong, float, double, longdouble# */ static void @NAME at _fill(@typ@ *buffer, intp length, void *NPY_UNUSED(ignored)) @@ -3051,11 +2571,9 @@ /**begin repeat * * #NAME = SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, - * FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, - * DATETIME, TIMEDELTA# + * FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE# * #typ = short, ushort, int, uint, long, ulong, longlong, ulonglong, - * float, double, longdouble, cfloat, cdouble, clongdouble, - * datetime, timedelta# + * float, double, longdouble, cfloat, cdouble, clongdouble# */ static void @NAME at _fillwithscalar(@typ@ *buffer, intp length, @typ@ *value, void *NPY_UNUSED(ignored)) @@ -3080,11 +2598,9 @@ /**begin repeat * * #name = BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, - * LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, - * DATETIME, TIMEDELTA# + * LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE# * #type = Bool, byte, ubyte, short, ushort, int, uint, long, ulong, - * longlong, ulonglong, float, double, longdouble, - * datetime, timedelta# + * longlong, ulonglong, float, double, longdouble# */ static void @name at _fastclip(@type@ *in, intp ni, @type@ *min, @type@ *max, @type@ *out) @@ -3186,10 +2702,10 @@ * * #name = BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, * LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, - * CFLOAT, CDOUBLE, CLONGDOUBLE, DATETIME, TIMEDELTA# + * CFLOAT, CDOUBLE, CLONGDOUBLE# * #type = Bool, byte, ubyte, short, ushort, int, uint, long, ulong, * longlong, ulonglong, float, double, longdouble, - * cfloat, cdouble, clongdouble, datetime, timedelta# + * cfloat, cdouble, clongdouble# */ static void @name at _fastputmask(@type@ *in, Bool *mask, intp ni, @type@ *vals, intp nv) @@ -3230,10 +2746,10 @@ * * #name = BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, * LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, - * CFLOAT, CDOUBLE, CLONGDOUBLE, DATETIME, TIMEDELTA# + * CFLOAT, CDOUBLE, CLONGDOUBLE# * #type = Bool, byte, ubyte, short, ushort, int, uint, long, ulong, * longlong, ulonglong, float, double, longdouble, - * cfloat, cdouble, clongdouble, datetime, timedelta# + * cfloat, cdouble, clongdouble# */ static int @name at _fasttake(@type@ *dest, @type@ *src, intp *indarray, @@ -3349,6 +2865,29 @@ * #endian = |, |, =# */ static PyArray_ArrFuncs _Py at NAME@_ArrFuncs = { + { + (PyArray_VectorUnaryFunc*)@from at _to_BOOL, + (PyArray_VectorUnaryFunc*)@from at _to_BYTE, + (PyArray_VectorUnaryFunc*)@from at _to_UBYTE, + (PyArray_VectorUnaryFunc*)@from at _to_SHORT, + (PyArray_VectorUnaryFunc*)@from at _to_USHORT, + (PyArray_VectorUnaryFunc*)@from at _to_INT, + (PyArray_VectorUnaryFunc*)@from at _to_UINT, + (PyArray_VectorUnaryFunc*)@from at _to_LONG, + (PyArray_VectorUnaryFunc*)@from at _to_ULONG, + (PyArray_VectorUnaryFunc*)@from at _to_LONGLONG, + (PyArray_VectorUnaryFunc*)@from at _to_ULONGLONG, + (PyArray_VectorUnaryFunc*)@from at _to_FLOAT, + (PyArray_VectorUnaryFunc*)@from at _to_DOUBLE, + (PyArray_VectorUnaryFunc*)@from at _to_LONGDOUBLE, + (PyArray_VectorUnaryFunc*)@from at _to_CFLOAT, + (PyArray_VectorUnaryFunc*)@from at _to_CDOUBLE, + (PyArray_VectorUnaryFunc*)@from at _to_CLONGDOUBLE, + (PyArray_VectorUnaryFunc*)@from at _to_OBJECT, + (PyArray_VectorUnaryFunc*)@from at _to_STRING, + (PyArray_VectorUnaryFunc*)@from at _to_UNICODE, + (PyArray_VectorUnaryFunc*)@from at _to_VOID, + }, (PyArray_GetItemFunc*)@from at _getitem, (PyArray_SetItemFunc*)@from at _setitem, (PyArray_CopySwapNFunc*)@from at _copyswapn, @@ -3373,33 +2912,7 @@ NULL, (PyArray_FastClipFunc *)NULL, (PyArray_FastPutmaskFunc *)NULL, - (PyArray_FastTakeFunc *)NULL, - NULL, NULL, NULL, NULL, - { - (PyArray_VectorUnaryFunc*)@from at _to_BOOL, - (PyArray_VectorUnaryFunc*)@from at _to_BYTE, - (PyArray_VectorUnaryFunc*)@from at _to_UBYTE, - (PyArray_VectorUnaryFunc*)@from at _to_SHORT, - (PyArray_VectorUnaryFunc*)@from at _to_USHORT, - (PyArray_VectorUnaryFunc*)@from at _to_INT, - (PyArray_VectorUnaryFunc*)@from at _to_UINT, - (PyArray_VectorUnaryFunc*)@from at _to_LONG, - (PyArray_VectorUnaryFunc*)@from at _to_ULONG, - (PyArray_VectorUnaryFunc*)@from at _to_LONGLONG, - (PyArray_VectorUnaryFunc*)@from at _to_ULONGLONG, - (PyArray_VectorUnaryFunc*)@from at _to_FLOAT, - (PyArray_VectorUnaryFunc*)@from at _to_DOUBLE, - (PyArray_VectorUnaryFunc*)@from at _to_LONGDOUBLE, - (PyArray_VectorUnaryFunc*)@from at _to_CFLOAT, - (PyArray_VectorUnaryFunc*)@from at _to_CDOUBLE, - (PyArray_VectorUnaryFunc*)@from at _to_CLONGDOUBLE, - (PyArray_VectorUnaryFunc*)@from at _to_DATETIME, - (PyArray_VectorUnaryFunc*)@from at _to_TIMEDELTA, - (PyArray_VectorUnaryFunc*)@from at _to_OBJECT, - (PyArray_VectorUnaryFunc*)@from at _to_STRING, - (PyArray_VectorUnaryFunc*)@from at _to_UNICODE, - (PyArray_VectorUnaryFunc*)@from at _to_VOID - } + (PyArray_FastTakeFunc *)NULL }; /* @@ -3412,7 +2925,6 @@ PyArray_ at from@LTR, '@endian@', 0, - 0, PyArray_ at from@, 0, _ALIGN(@align@), @@ -3430,21 +2942,44 @@ * * #from = BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, * LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, - * CFLOAT, CDOUBLE, CLONGDOUBLE, OBJECT, DATETIME, TIMEDELTA# - * #num = 1*14, 2*3, 1*3# + * CFLOAT, CDOUBLE, CLONGDOUBLE, OBJECT# + * #num = 1*14, 2*3, 1*1# * #fromtyp = Bool, byte, ubyte, short, ushort, int, uint, long, ulong, * longlong, ulonglong, float, double, longdouble, - * float, double, longdouble, PyObject *, datetime, timedelta# + * float, double, longdouble, PyObject *# * #NAME = Bool, Byte, UByte, Short, UShort, Int, UInt, Long, ULong, * LongLong, ULongLong, Float, Double, LongDouble, - * CFloat, CDouble, CLongDouble, Object, Datetime, Timedelta# + * CFloat, CDouble, CLongDouble, Object# * #kind = GENBOOL, SIGNED, UNSIGNED, SIGNED, UNSIGNED, SIGNED, UNSIGNED, SIGNED, UNSIGNED, * SIGNED, UNSIGNED, FLOATING, FLOATING, FLOATING, - * COMPLEX, COMPLEX, COMPLEX, OBJECT, DATETIME, TIMEDELTA# - * #endian = |*3, =*14, |, =*2# - * #isobject= 0*17,NPY_OBJECT_DTYPE_FLAGS,0*2# + * COMPLEX, COMPLEX, COMPLEX, OBJECT# + * #endian = |*3, =*14, |# + * #isobject= 0*17,NPY_OBJECT_DTYPE_FLAGS# */ static PyArray_ArrFuncs _Py at NAME@_ArrFuncs = { + { + (PyArray_VectorUnaryFunc*)@from at _to_BOOL, + (PyArray_VectorUnaryFunc*)@from at _to_BYTE, + (PyArray_VectorUnaryFunc*)@from at _to_UBYTE, + (PyArray_VectorUnaryFunc*)@from at _to_SHORT, + (PyArray_VectorUnaryFunc*)@from at _to_USHORT, + (PyArray_VectorUnaryFunc*)@from at _to_INT, + (PyArray_VectorUnaryFunc*)@from at _to_UINT, + (PyArray_VectorUnaryFunc*)@from at _to_LONG, + (PyArray_VectorUnaryFunc*)@from at _to_ULONG, + (PyArray_VectorUnaryFunc*)@from at _to_LONGLONG, + (PyArray_VectorUnaryFunc*)@from at _to_ULONGLONG, + (PyArray_VectorUnaryFunc*)@from at _to_FLOAT, + (PyArray_VectorUnaryFunc*)@from at _to_DOUBLE, + (PyArray_VectorUnaryFunc*)@from at _to_LONGDOUBLE, + (PyArray_VectorUnaryFunc*)@from at _to_CFLOAT, + (PyArray_VectorUnaryFunc*)@from at _to_CDOUBLE, + (PyArray_VectorUnaryFunc*)@from at _to_CLONGDOUBLE, + (PyArray_VectorUnaryFunc*)@from at _to_OBJECT, + (PyArray_VectorUnaryFunc*)@from at _to_STRING, + (PyArray_VectorUnaryFunc*)@from at _to_UNICODE, + (PyArray_VectorUnaryFunc*)@from at _to_VOID, + }, (PyArray_GetItemFunc*)@from at _getitem, (PyArray_SetItemFunc*)@from at _setitem, (PyArray_CopySwapNFunc*)@from at _copyswapn, @@ -3469,33 +3004,7 @@ NULL, (PyArray_FastClipFunc*)@from at _fastclip, (PyArray_FastPutmaskFunc*)@from at _fastputmask, - (PyArray_FastTakeFunc*)@from at _fasttake, - NULL, NULL, NULL, NULL, - { - (PyArray_VectorUnaryFunc*)@from at _to_BOOL, - (PyArray_VectorUnaryFunc*)@from at _to_BYTE, - (PyArray_VectorUnaryFunc*)@from at _to_UBYTE, - (PyArray_VectorUnaryFunc*)@from at _to_SHORT, - (PyArray_VectorUnaryFunc*)@from at _to_USHORT, - (PyArray_VectorUnaryFunc*)@from at _to_INT, - (PyArray_VectorUnaryFunc*)@from at _to_UINT, - (PyArray_VectorUnaryFunc*)@from at _to_LONG, - (PyArray_VectorUnaryFunc*)@from at _to_ULONG, - (PyArray_VectorUnaryFunc*)@from at _to_LONGLONG, - (PyArray_VectorUnaryFunc*)@from at _to_ULONGLONG, - (PyArray_VectorUnaryFunc*)@from at _to_FLOAT, - (PyArray_VectorUnaryFunc*)@from at _to_DOUBLE, - (PyArray_VectorUnaryFunc*)@from at _to_LONGDOUBLE, - (PyArray_VectorUnaryFunc*)@from at _to_CFLOAT, - (PyArray_VectorUnaryFunc*)@from at _to_CDOUBLE, - (PyArray_VectorUnaryFunc*)@from at _to_CLONGDOUBLE, - (PyArray_VectorUnaryFunc*)@from at _to_DATETIME, - (PyArray_VectorUnaryFunc*)@from at _to_TIMEDELTA, - (PyArray_VectorUnaryFunc*)@from at _to_OBJECT, - (PyArray_VectorUnaryFunc*)@from at _to_STRING, - (PyArray_VectorUnaryFunc*)@from at _to_UNICODE, - (PyArray_VectorUnaryFunc*)@from at _to_VOID - } + (PyArray_FastTakeFunc*)@from at _fasttake }; /* @@ -3507,7 +3016,6 @@ PyArray_ at kind@LTR, PyArray_ at from@LTR, '@endian@', - 0, @isobject@, PyArray_ at from@, @num@*sizeof(@fromtyp@), @@ -3521,29 +3029,6 @@ /**end repeat**/ -static void -_init_datetime_descr(PyArray_Descr *descr) -{ - PyArray_DatetimeMetaData *dt_data; - PyObject *cobj; - - dt_data = _pya_malloc(sizeof(PyArray_DatetimeMetaData)); - dt_data->base = NPY_FR_us; - dt_data->num = 1; - dt_data->den = 1; - dt_data->events = 1; - -/* FIXME - * There is no error check here and no way to indicate an error - * until the metadata turns up NULL. - */ - cobj = NpyCapsule_FromVoidPtr((void *)dt_data, simple_capsule_dtor); - descr->metadata = PyDict_New(); - PyDict_SetItemString(descr->metadata, NPY_METADATA_DTSTR, cobj); - Py_DECREF(cobj); - -} - #define _MAX_LETTER 128 static char _letter_to_num[_MAX_LETTER]; @@ -3565,8 +3050,6 @@ &CFLOAT_Descr, &CDOUBLE_Descr, &CLONGDOUBLE_Descr, - &DATETIME_Descr, - &TIMEDELTA_Descr, &OBJECT_Descr, &STRING_Descr, &UNICODE_Descr, @@ -3624,13 +3107,6 @@ Py_INCREF(ret); } - /* Make sure dtype metadata is initialized for DATETIME */ - if (PyTypeNum_ISDATETIME(type)) { - if (ret->metadata == NULL) { - _init_datetime_descr(ret); - } - } - return ret; } @@ -3656,8 +3132,7 @@ * * #name = BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, INTP, UINTP, * LONG, ULONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, - * CFLOAT, CDOUBLE, CLONGDOUBLE, OBJECT, STRING, UNICODE, VOID, - * DATETIME,TIMEDELTA# + * CFLOAT, CDOUBLE, CLONGDOUBLE, OBJECT, STRING, UNICODE, VOID# */ _letter_to_num[PyArray_ at name@LTR] = PyArray_ at name@; /**end repeat**/ @@ -3666,8 +3141,7 @@ /**begin repeat * #name = BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, * LONG, ULONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, - * CFLOAT, CDOUBLE, CLONGDOUBLE, OBJECT, STRING, UNICODE, VOID, - * DATETIME, TIMEDELTA# + * CFLOAT, CDOUBLE, CLONGDOUBLE, OBJECT, STRING, UNICODE, VOID# */ @name at _Descr.fields = Py_None; /**end repeat**/ @@ -3783,32 +3257,6 @@ _ALIGN(char), (PyObject *) &PyVoidArrType_Type)); Py_DECREF(s); - PyDict_SetItemString(infodict, "DATETIME", -#if defined(NPY_PY3K) - s = Py_BuildValue("CiiiNNO", PyArray_DATETIMELTR, -#else - s = Py_BuildValue("ciiiNNO", PyArray_DATETIMELTR, -#endif - PyArray_DATETIME, - sizeof(npy_datetime) * CHAR_BIT, - _ALIGN(npy_datetime), - MyPyLong_FromInt64(MAX_DATETIME), - MyPyLong_FromInt64(MIN_DATETIME), - (PyObject *) &PyDatetimeArrType_Type)); - Py_DECREF(s); - PyDict_SetItemString(infodict, "TIMEDELTA", -#if defined(NPY_PY3K) - s = Py_BuildValue("CiiiNNO", PyArray_TIMEDELTALTR, -#else - s = Py_BuildValue("ciiiNNO",PyArray_TIMEDELTALTR, -#endif - PyArray_TIMEDELTA, - sizeof(npy_timedelta) * CHAR_BIT, - _ALIGN(npy_timedelta), - MyPyLong_FromInt64(MAX_TIMEDELTA), - MyPyLong_FromInt64(MIN_TIMEDELTA), - (PyObject *)&PyTimedeltaArrType_Type)); - Py_DECREF(s); #define SETTYPE(name) \ Py_INCREF(&Py##name##ArrType_Type); \ @@ -3820,7 +3268,6 @@ SETTYPE(Integer); SETTYPE(Inexact); SETTYPE(SignedInteger); - SETTYPE(TimeInteger); SETTYPE(UnsignedInteger); SETTYPE(Floating); SETTYPE(ComplexFloating); Modified: branches/1.5.x/numpy/core/src/multiarray/convert_datatype.c =================================================================== --- branches/1.5.x/numpy/core/src/multiarray/convert_datatype.c 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/core/src/multiarray/convert_datatype.c 2010-07-17 18:31:17 UTC (rev 8495) @@ -530,10 +530,6 @@ if (totype == PyArray_BOOL) { return 0; } - if (fromtype == PyArray_DATETIME || fromtype == PyArray_TIMEDELTA || - totype == PyArray_DATETIME || totype == PyArray_TIMEDELTA) { - return 0; - } if (totype == PyArray_OBJECT || totype == PyArray_VOID) { return 1; } Modified: branches/1.5.x/numpy/core/src/multiarray/descriptor.c =================================================================== --- branches/1.5.x/numpy/core/src/multiarray/descriptor.c 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/core/src/multiarray/descriptor.c 2010-07-17 18:31:17 UTC (rev 8495) @@ -134,32 +134,7 @@ return 0; } -static int -_check_for_datetime(char *type, int len) -{ - if (len < 1) { - return 0; - } - if (type[1] == '8' && (type[0] == 'M' || type[0] == 'm')) { - return 1; - } - if (len < 10) { - return 0; - } - if (strncmp(type, "datetime64", 10) == 0) { - return 1; - } - if (len < 11) { - return 0; - } - if (strncmp(type, "timedelta64", 11) == 0) { - return 1; - } - return 0; -} - - #undef _chk_byteorder static PyArray_Descr * @@ -253,7 +228,7 @@ PyDimMem_FREE(shape.ptr); newdescr->subarray = _pya_malloc(sizeof(PyArray_ArrayDescr)); newdescr->subarray->base = type; - newdescr->flags = type->flags; + newdescr->hasobject = type->hasobject; Py_INCREF(val); newdescr->subarray->shape = val; Py_XDECREF(newdescr->fields); @@ -381,7 +356,7 @@ "two fields with the same name"); goto fail; } - dtypeflags |= (conv->flags & NPY_FROM_FIELDS); + dtypeflags |= (conv->hasobject & NPY_FROM_FIELDS); tup = PyTuple_New((title == NULL ? 2 : 3)); PyTuple_SET_ITEM(tup, 0, (PyObject *)conv); if (align) { @@ -426,7 +401,7 @@ new->fields = fields; new->names = nameslist; new->elsize = totalsize; - new->flags=dtypeflags; + new->hasobject=dtypeflags; if (maxalign > 1) { totalsize = ((totalsize + maxalign - 1)/maxalign)*maxalign; } @@ -489,7 +464,7 @@ Py_DECREF(key); goto fail; } - dtypeflags |= (conv->flags & NPY_FROM_FIELDS); + dtypeflags |= (conv->hasobject & NPY_FROM_FIELDS); PyTuple_SET_ITEM(tup, 0, (PyObject *)conv); if (align) { int _align; @@ -509,7 +484,7 @@ new = PyArray_DescrNewFromType(PyArray_VOID); new->fields = fields; new->names = nameslist; - new->flags=dtypeflags; + new->hasobject=dtypeflags; if (maxalign > 1) { totalsize = ((totalsize+maxalign-1)/maxalign)*maxalign; } @@ -525,263 +500,7 @@ return NULL; } -/* Exported as DATETIMEUNITS in multiarraymodule.c */ -NPY_NO_EXPORT char *_datetime_strings[] = { - NPY_STR_Y, - NPY_STR_M, - NPY_STR_W, - NPY_STR_B, - NPY_STR_D, - NPY_STR_h, - NPY_STR_m, - NPY_STR_s, - NPY_STR_ms, - NPY_STR_us, - NPY_STR_ns, - NPY_STR_ps, - NPY_STR_fs, - NPY_STR_as -}; -static NPY_DATETIMEUNIT - _unit_from_str(char *base) -{ - NPY_DATETIMEUNIT unit; - - if (base == NULL) { - return NPY_DATETIME_DEFAULTUNIT; - } - - unit = NPY_FR_Y; - while (unit < NPY_DATETIME_NUMUNITS) { - if (strcmp(base, _datetime_strings[unit]) == 0) { - break; - } - unit++; - } - if (unit == NPY_DATETIME_NUMUNITS) { - return NPY_DATETIME_DEFAULTUNIT; - } - - return unit; -} - -static int _multiples_table[16][4] = { - {12, 52, 365}, /* NPY_FR_Y */ - {NPY_FR_M, NPY_FR_W, NPY_FR_D}, - {4, 30, 720}, /* NPY_FR_M */ - {NPY_FR_W, NPY_FR_D, NPY_FR_h}, - {5, 7, 168, 10080}, /* NPY_FR_W */ - {NPY_FR_B, NPY_FR_D, NPY_FR_h, NPY_FR_m}, - {24, 1440, 86400}, /* NPY_FR_B */ - {NPY_FR_h, NPY_FR_m, NPY_FR_s}, - {24, 1440, 86400}, /* NPY_FR_D */ - {NPY_FR_h, NPY_FR_m, NPY_FR_s}, - {60, 3600}, /* NPY_FR_h */ - {NPY_FR_m, NPY_FR_s}, - {60, 60000}, /* NPY_FR_m */ - {NPY_FR_s, NPY_FR_ms}, - {1000, 1000000}, /* >=NPY_FR_s */ - {0, 0} -}; - - -/* Translate divisors into multiples of smaller units */ -static int -_convert_divisor_to_multiple(PyArray_DatetimeMetaData *meta) -{ - int i, num, ind; - int *totry; - NPY_DATETIMEUNIT *baseunit; - int q, r; - - ind = ((int)meta->base - (int)NPY_FR_Y)*2; - totry = _multiples_table[ind]; - baseunit = (NPY_DATETIMEUNIT *)_multiples_table[ind + 1]; - - num = 3; - if (meta->base == NPY_FR_W) { - num = 4; - } - else if (meta->base > NPY_FR_D) { - num = 2; - } - if (meta->base >= NPY_FR_s) { - ind = ((int)NPY_FR_s - (int)NPY_FR_Y)*2; - totry = _multiples_table[ind]; - baseunit = (NPY_DATETIMEUNIT *)_multiples_table[ind + 1]; - baseunit[0] = meta->base + 1; - baseunit[1] = meta->base + 2; - if (meta->base == NPY_DATETIME_NUMUNITS - 2) { - num = 1; - } - if (meta->base == NPY_DATETIME_NUMUNITS - 1) { - num = 0; - } - } - - for (i = 0; i < num; i++) { - q = totry[i] / meta->den; - r = totry[i] % meta->den; - if (r == 0) { - break; - } - } - if (i == num) { - PyErr_Format(PyExc_ValueError, - "divisor (%d) is not a multiple of a lower-unit", meta->den); - return -1; - } - meta->base = baseunit[i]; - meta->den = 1; - meta->num *= q; - - return 0; -} - - -static PyObject * -_get_datetime_tuple_from_cobj(PyObject *cobj) -{ - PyArray_DatetimeMetaData *dt_data; - PyObject *dt_tuple; - - dt_data = NpyCapsule_AsVoidPtr(cobj); - dt_tuple = PyTuple_New(4); - - PyTuple_SET_ITEM(dt_tuple, 0, - PyBytes_FromString(_datetime_strings[dt_data->base])); - PyTuple_SET_ITEM(dt_tuple, 1, - PyInt_FromLong(dt_data->num)); - PyTuple_SET_ITEM(dt_tuple, 2, - PyInt_FromLong(dt_data->den)); - PyTuple_SET_ITEM(dt_tuple, 3, - PyInt_FromLong(dt_data->events)); - - return dt_tuple; -} - -static PyObject * -_convert_datetime_tuple_to_cobj(PyObject *tuple) -{ - PyArray_DatetimeMetaData *dt_data; - PyObject *ret; - - dt_data = _pya_malloc(sizeof(PyArray_DatetimeMetaData)); - dt_data->base = _unit_from_str( - PyBytes_AsString(PyTuple_GET_ITEM(tuple, 0))); - - /* Assumes other objects are Python integers */ - dt_data->num = PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, 1)); - dt_data->den = PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, 2)); - dt_data->events = PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, 3)); - - if (dt_data->den > 1) { - if (_convert_divisor_to_multiple(dt_data) < 0) { - return NULL; - } - } - -/* FIXME - * There is no error handling here. - */ - ret = NpyCapsule_FromVoidPtr((void *)dt_data, simple_capsule_dtor); - return ret; -} - -static PyArray_Descr * -_convert_from_datetime_tuple(PyObject *obj) -{ - PyArray_Descr *new; - PyObject *dt_tuple; - PyObject *dt_cobj; - PyObject *datetime; - - if (!PyTuple_Check(obj) || PyTuple_GET_SIZE(obj)!=2) { - PyErr_SetString(PyExc_RuntimeError, - "_datetimestring is not returning a tuple with length 2"); - return NULL; - } - - dt_tuple = PyTuple_GET_ITEM(obj, 0); - datetime = PyTuple_GET_ITEM(obj, 1); - if (!PyTuple_Check(dt_tuple) - || PyTuple_GET_SIZE(dt_tuple) != 4 - || !PyInt_Check(datetime)) { - PyErr_SetString(PyExc_RuntimeError, - "_datetimestring is not returning a length 4 tuple"\ - " and an integer"); - return NULL; - } - - /* Create new timedelta or datetime dtype */ - if (PyObject_IsTrue(datetime)) { - new = PyArray_DescrNewFromType(PyArray_DATETIME); - } - else { - new = PyArray_DescrNewFromType(PyArray_TIMEDELTA); - } - - if (new == NULL) { - return NULL; - } - /* - * Remove any reference to old metadata dictionary - * And create a new one for this new dtype - */ - Py_XDECREF(new->metadata); - if ((new->metadata = PyDict_New()) == NULL) { - return NULL; - } - dt_cobj = _convert_datetime_tuple_to_cobj(dt_tuple); - if (dt_cobj == NULL) { - /* Failure in conversion */ - Py_DECREF(new); - return NULL; - } - - /* Assume this sets a new reference to dt_cobj */ - PyDict_SetItemString(new->metadata, NPY_METADATA_DTSTR, dt_cobj); - Py_DECREF(dt_cobj); - return new; -} - - -static PyArray_Descr * -_convert_from_datetime(PyObject *obj) -{ - PyObject *tupleobj; - PyArray_Descr *res; - PyObject *_numpy_internal; - - if (!PyBytes_Check(obj)) { - return NULL; - } - _numpy_internal = PyImport_ImportModule("numpy.core._internal"); - if (_numpy_internal == NULL) { - return NULL; - } - tupleobj = PyObject_CallMethod(_numpy_internal, - "_datetimestring", "O", obj); - Py_DECREF(_numpy_internal); - if (!tupleobj) { - return NULL; - } - /* - * tuple of a standard tuple (baseunit, num, den, events) and a timedelta - * boolean - */ - res = _convert_from_datetime_tuple(tupleobj); - Py_DECREF(tupleobj); - if (!res && !PyErr_Occurred()) { - PyErr_SetString(PyExc_ValueError, - "invalid data-type"); - return NULL; - } - return res; -} - - /* * comma-separated string * this is the format developed by the numarray records module and implemented @@ -892,7 +611,7 @@ new->names = conv->names; Py_XINCREF(new->names); } - new->flags = conv->flags; + new->hasobject = conv->hasobject; Py_DECREF(conv); *errflag = 0; return new; @@ -1092,7 +811,7 @@ if ((ret == PY_FAIL) || (newdescr->elsize == 0)) { goto fail; } - dtypeflags |= (newdescr->flags & NPY_FROM_FIELDS); + dtypeflags |= (newdescr->hasobject & NPY_FROM_FIELDS); totalsize += newdescr->elsize; } @@ -1115,7 +834,7 @@ } new->names = names; new->fields = fields; - new->flags = dtypeflags; + new->hasobject = dtypeflags; metadata = PyDict_GetItemString(obj, "metadata"); @@ -1277,14 +996,7 @@ if (len <= 0) { goto fail; } - /* check for datetime format */ - if ((len > 1) && _check_for_datetime(type, len)) { - *at = _convert_from_datetime(obj); - if (*at) { - return PY_SUCCEED; - } - return PY_FAIL; - } + /* check for commas present or first (or second) element a digit */ if (_check_for_commastring(type, len)) { *at = _convert_from_commastring(obj, 0); @@ -1529,7 +1241,7 @@ {"alignment", T_INT, offsetof(PyArray_Descr, alignment), READONLY, NULL}, {"flags", - T_INT, offsetof(PyArray_Descr, flags), READONLY, NULL}, + T_UBYTE, offsetof(PyArray_Descr, hasobject), READONLY, NULL}, {NULL, 0, 0, 0, NULL}, }; @@ -1544,48 +1256,7 @@ (PyObject *)self->subarray->base, self->subarray->shape); } -static PyObject * -_append_to_datetime_typestr(PyArray_Descr *self, PyObject *ret) -{ - PyObject *tmp; - PyObject *res; - int num, den, events; - char *basestr; - PyArray_DatetimeMetaData *dt_data; - /* This shouldn't happen */ - if (self->metadata == NULL) { - return ret; - } - tmp = PyDict_GetItemString(self->metadata, NPY_METADATA_DTSTR); - dt_data = NpyCapsule_AsVoidPtr(tmp); - num = dt_data->num; - den = dt_data->den; - events = dt_data->events; - basestr = _datetime_strings[dt_data->base]; - - if (num == 1) { - tmp = PyUString_FromString(basestr); - } - else { - tmp = PyUString_FromFormat("%d%s", num, basestr); - } - if (den != 1) { - res = PyUString_FromFormat("/%d", den); - PyUString_ConcatAndDel(&tmp, res); - } - - res = PyUString_FromString("["); - PyUString_ConcatAndDel(&res, tmp); - PyUString_ConcatAndDel(&res, PyUString_FromString("]")); - if (events != 1) { - tmp = PyUString_FromFormat("//%d", events); - PyUString_ConcatAndDel(&res, tmp); - } - PyUString_ConcatAndDel(&ret, res); - return ret; -} - NPY_NO_EXPORT PyObject * arraydescr_protocol_typestr_get(PyArray_Descr *self) { @@ -1605,9 +1276,6 @@ } ret = PyUString_FromFormat("%c%c%d", endian, basic_, size); - if (PyDataType_ISDATETIME(self)) { - ret = _append_to_datetime_typestr(self, ret); - } return ret; } @@ -1648,9 +1316,6 @@ p = PyUString_FromFormat("%d", self->elsize * 8); PyUString_ConcatAndDel(&res, p); } - if (PyDataType_ISDATETIME(self)) { - res = _append_to_datetime_typestr(self, res); - } return res; } @@ -2013,31 +1678,7 @@ return (PyObject *)conv; } -/* - * Return a tuple of - * (cleaned metadata dictionary, tuple with (str, num, events)) - */ -static PyObject * -_get_pickleabletype_from_metadata(PyObject *metadata) -{ - PyObject *newdict; - PyObject *newtup, *dt_tuple; - PyObject *cobj; - newdict = PyDict_Copy(metadata); - PyDict_DelItemString(newdict, NPY_METADATA_DTSTR); - newtup = PyTuple_New(2); - PyTuple_SET_ITEM(newtup, 0, newdict); - - cobj = PyDict_GetItemString(metadata, NPY_METADATA_DTSTR); - dt_tuple = _get_datetime_tuple_from_cobj(cobj); - - PyTuple_SET_ITEM(newtup, 1, dt_tuple); - - return newtup; -} - - /* return a tuple of (callable object, args, state). */ static PyObject * arraydescr_reduce(PyArray_Descr *self, PyObject *NPY_UNUSED(args)) @@ -2098,20 +1739,8 @@ if (self->metadata) { state = PyTuple_New(9); PyTuple_SET_ITEM(state, 0, PyInt_FromLong(version)); - if (PyDataType_ISDATETIME(self)) { - PyObject *newobj; - /* Handle CObject in NPY_METADATA_DTSTR key separately */ - /* - * newobj is a tuple of cleaned metadata dictionary - * and tuple of date_time info (str, num, den, events) - */ - newobj = _get_pickleabletype_from_metadata(self->metadata); - PyTuple_SET_ITEM(state, 8, newobj); - } - else { - Py_INCREF(self->metadata); - PyTuple_SET_ITEM(state, 8, self->metadata); - } + Py_INCREF(self->metadata); + PyTuple_SET_ITEM(state, 8, self->metadata); } else { /* Use version 3 pickle format */ state = PyTuple_New(8); @@ -2144,7 +1773,7 @@ } PyTuple_SET_ITEM(state, 5, PyInt_FromLong(elsize)); PyTuple_SET_ITEM(state, 6, PyInt_FromLong(alignment)); - PyTuple_SET_ITEM(state, 7, PyInt_FromLong(self->flags)); + PyTuple_SET_ITEM(state, 7, PyInt_FromLong(self->hasobject)); PyTuple_SET_ITEM(ret, 2, state); return ret; @@ -2157,7 +1786,7 @@ static int _descr_find_object(PyArray_Descr *self) { - if (self->flags + if (self->hasobject || self->type_num == PyArray_OBJECT || self->kind == 'O') { return NPY_OBJECT_DTYPE_FLAGS; @@ -2177,7 +1806,7 @@ return 0; } if (_descr_find_object(new)) { - new->flags = NPY_OBJECT_DTYPE_FLAGS; + new->hasobject = NPY_OBJECT_DTYPE_FLAGS; return NPY_OBJECT_DTYPE_FLAGS; } } @@ -2361,33 +1990,22 @@ self->alignment = alignment; } - self->flags = dtypeflags; + self->hasobject = dtypeflags; if (version < 3) { - self->flags = _descr_find_object(self); + self->hasobject = _descr_find_object(self); } Py_XDECREF(self->metadata); - if (PyDataType_ISDATETIME(self) - && (metadata != Py_None) - && (metadata != NULL)) { - PyObject *cobj; - self->metadata = PyTuple_GET_ITEM(metadata, 0); - Py_INCREF(self->metadata); - cobj = _convert_datetime_tuple_to_cobj(PyTuple_GET_ITEM(metadata, 1)); - PyDict_SetItemString(self->metadata, NPY_METADATA_DTSTR, cobj); - Py_DECREF(cobj); + + /* + * We have a borrowed reference to metadata so no need + * to alter reference count + */ + if (metadata == Py_None) { + metadata = NULL; } - else { - /* - * We have a borrowed reference to metadata so no need - * to alter reference count - */ - if (metadata == Py_None) { - metadata = NULL; - } - self->metadata = metadata; - Py_XINCREF(metadata); - } + self->metadata = metadata; + Py_XINCREF(metadata); Py_INCREF(Py_None); return Py_None; Modified: branches/1.5.x/numpy/core/src/multiarray/hashdescr.c =================================================================== --- branches/1.5.x/numpy/core/src/multiarray/hashdescr.c 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/core/src/multiarray/hashdescr.c 2010-07-17 18:31:17 UTC (rev 8495) @@ -53,11 +53,11 @@ PyObject *t, *item; /* - * For builtin type, hash relies on : kind + byteorder + flags + + * For builtin type, hash relies on : kind + byteorder + hasobject + * type_num + elsize + alignment */ - t = Py_BuildValue("(cciiii)", descr->kind, descr->byteorder, - descr->flags, descr->type_num, descr->elsize, + t = Py_BuildValue("(ccciii)", descr->kind, descr->byteorder, + descr->hasobject, descr->type_num, descr->elsize, descr->alignment); for(i = 0; i < PyTuple_Size(t); ++i) { Modified: branches/1.5.x/numpy/core/src/multiarray/multiarraymodule.c =================================================================== --- branches/1.5.x/numpy/core/src/multiarray/multiarraymodule.c 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/core/src/multiarray/multiarraymodule.c 2010-07-17 18:31:17 UTC (rev 8495) @@ -43,6 +43,8 @@ #include "scalartypes.h" #include "numpymemoryview.h" +NPY_NO_EXPORT PyTypeObject PyBigArray_Type; + /*NUMPY_API * Get Priority from object */ @@ -1328,40 +1330,7 @@ return same; } -/* - * compare the metadata for two date-times - * return 1 if they are the same - * or 0 if not - */ -static int -_equivalent_units(PyObject *meta1, PyObject *meta2) -{ - PyObject *cobj1, *cobj2; - PyArray_DatetimeMetaData *data1, *data2; - /* Same meta object */ - if (meta1 == meta2) { - return 1; - } - - cobj1 = PyDict_GetItemString(meta1, NPY_METADATA_DTSTR); - cobj2 = PyDict_GetItemString(meta2, NPY_METADATA_DTSTR); - if (cobj1 == cobj2) { - return 1; - } - -/* FIXME - * There is no err handling here. - */ - data1 = NpyCapsule_AsVoidPtr(cobj1); - data2 = NpyCapsule_AsVoidPtr(cobj2); - return ((data1->base == data2->base) - && (data1->num == data2->num) - && (data1->den == data2->den) - && (data1->events == data2->events)); -} - - /*NUMPY_API * * This function returns true if the two typecodes are @@ -1386,13 +1355,7 @@ return ((typenum1 == typenum2) && _equivalent_fields(typ1->fields, typ2->fields)); } - if (typenum1 == PyArray_DATETIME - || typenum1 == PyArray_DATETIME - || typenum2 == PyArray_TIMEDELTA - || typenum2 == PyArray_TIMEDELTA) { - return ((typenum1 == typenum2) - && _equivalent_units(typ1->metadata, typ2->metadata)); - } + return typ1->kind == typ2->kind; } @@ -2012,40 +1975,7 @@ return oldops; } -static PyObject * -array_set_datetimeparse_function(PyObject *NPY_UNUSED(self), PyObject *args, - PyObject *kwds) -{ - PyObject *op = NULL; - static char *kwlist[] = {"f", NULL}; - PyObject *_numpy_internal; - if(!PyArg_ParseTupleAndKeywords(args, kwds, "|O", kwlist, &op)) { - return NULL; - } - /* reset the array_repr function to built-in */ - if (op == Py_None) { - _numpy_internal = PyImport_ImportModule("numpy.core._internal"); - if (_numpy_internal == NULL) { - return NULL; - } - op = PyObject_GetAttrString(_numpy_internal, "datetime_from_string"); - } - else { /* Must balance reference count increment in both branches */ - if (!PyCallable_Check(op)) { - PyErr_SetString(PyExc_TypeError, - "Argument must be callable."); - return NULL; - } - Py_INCREF(op); - } - PyArray_SetDatetimeParseFunction(op); - Py_DECREF(op); - Py_INCREF(Py_None); - return Py_None; -} - - /*NUMPY_API * Where */ @@ -2684,9 +2614,6 @@ {"set_numeric_ops", (PyCFunction)array_set_ops_function, METH_VARARGS|METH_KEYWORDS, NULL}, - {"set_datetimeparse_function", - (PyCFunction)array_set_datetimeparse_function, - METH_VARARGS|METH_KEYWORDS, NULL}, {"set_typeDict", (PyCFunction)array_set_typeDict, METH_VARARGS, NULL}, @@ -2891,10 +2818,6 @@ SINGLE_INHERIT(LongLong, SignedInteger); #endif - SINGLE_INHERIT(TimeInteger, SignedInteger); - SINGLE_INHERIT(Datetime, TimeInteger); - SINGLE_INHERIT(Timedelta, TimeInteger); - /* fprintf(stderr, "tp_free = %p, PyObject_Del = %p, int_tp_free = %p, base.tp_free = %p\n", @@ -3084,13 +3007,6 @@ PyDict_SetItemString(d, "METADATA_DTSTR", s); Py_DECREF(s); -/* FIXME - * There is no error handling here - */ - s = NpyCapsule_FromVoidPtr((void *)_datetime_strings, NULL); - PyDict_SetItemString(d, "DATETIMEUNITS", s); - Py_DECREF(s); - #define ADDCONST(NAME) \ s = PyInt_FromLong(NPY_##NAME); \ PyDict_SetItemString(d, #NAME, s); \ Modified: branches/1.5.x/numpy/core/src/multiarray/multiarraymodule_onefile.c =================================================================== --- branches/1.5.x/numpy/core/src/multiarray/multiarraymodule_onefile.c 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/core/src/multiarray/multiarraymodule_onefile.c 2010-07-17 18:31:17 UTC (rev 8495) @@ -10,7 +10,6 @@ #include "scalartypes.c" #include "scalarapi.c" -#include "datetime.c" #include "arraytypes.c" #include "hashdescr.c" Modified: branches/1.5.x/numpy/core/src/multiarray/scalarapi.c =================================================================== --- branches/1.5.x/numpy/core/src/multiarray/scalarapi.c 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/core/src/multiarray/scalarapi.c 2010-07-17 18:31:17 UTC (rev 8495) @@ -64,8 +64,6 @@ CASE(CDOUBLE, CDouble); CASE(CLONGDOUBLE, CLongDouble); CASE(OBJECT, Object); - CASE(DATETIME, Datetime); - CASE(TIMEDELTA, Timedelta); #undef CASE case NPY_STRING: return (void *)PyString_AS_STRING(scalar); @@ -93,10 +91,6 @@ _IFCASE(Int); _IFCASE(Long); _IFCASE(LongLong); - if _CHK(TimeInteger) { - _IFCASE(Datetime); - _IFCASE(Timedelta); - } } else { /* Unsigned Integer */ @@ -516,42 +510,6 @@ return descr; } - if (PyArray_IsScalar(sc, TimeInteger)) { - PyObject *cobj; - PyArray_DatetimeMetaData *dt_data; - - dt_data = _pya_malloc(sizeof(PyArray_DatetimeMetaData)); - if (PyArray_IsScalar(sc, Datetime)) { - descr = PyArray_DescrNewFromType(PyArray_DATETIME); - memcpy(dt_data, &((PyDatetimeScalarObject *)sc)->obmeta, - sizeof(PyArray_DatetimeMetaData)); - } - else { - /* Timedelta */ - descr = PyArray_DescrNewFromType(PyArray_TIMEDELTA); - memcpy(dt_data, &((PyTimedeltaScalarObject *)sc)->obmeta, - sizeof(PyArray_DatetimeMetaData)); - } - cobj = NpyCapsule_FromVoidPtr((void *)dt_data, simple_capsule_dtor); - - /* Add correct meta-data to the data-type */ - if (descr == NULL) { - Py_DECREF(cobj); - return NULL; - } - Py_XDECREF(descr->metadata); - if ((descr->metadata = PyDict_New()) == NULL) { - Py_DECREF(descr); - Py_DECREF(cobj); - return NULL; - } - - /* Assume this sets a new reference to cobj */ - PyDict_SetItemString(descr->metadata, NPY_METADATA_DTSTR, cobj); - Py_DECREF(cobj); - return descr; - } - descr = PyArray_DescrFromTypeObject((PyObject *)Py_TYPE(sc)); if (descr->elsize == 0) { PyArray_DESCR_REPLACE(descr); @@ -656,22 +614,6 @@ if (obj == NULL) { return NULL; } - if (PyTypeNum_ISDATETIME(type_num)) { - /* - * We need to copy the resolution information over to the scalar - * Get the void * from the metadata dictionary - */ - PyObject *cobj; - PyArray_DatetimeMetaData *dt_data; - cobj = PyDict_GetItemString(descr->metadata, NPY_METADATA_DTSTR); - -/* FIXME - * There is no error handling here. - */ - dt_data = NpyCapsule_AsVoidPtr(cobj); - memcpy(&(((PyDatetimeScalarObject *)obj)->obmeta), dt_data, - sizeof(PyArray_DatetimeMetaData)); - } if (PyTypeNum_ISFLEXIBLE(type_num)) { if (type_num == PyArray_STRING) { destptr = PyString_AS_STRING(obj); Modified: branches/1.5.x/numpy/core/src/multiarray/scalartypes.c.src =================================================================== --- branches/1.5.x/numpy/core/src/multiarray/scalartypes.c.src 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/core/src/multiarray/scalartypes.c.src 2010-07-17 18:31:17 UTC (rev 8495) @@ -2091,12 +2091,12 @@ /**begin repeat * #name = byte, short, int, long, longlong, ubyte, ushort, uint, ulong, * ulonglong, float, double, longdouble, cfloat, cdouble, clongdouble, - * string, unicode, object, datetime, timedelta# + * string, unicode, object# * #TYPE = BYTE, SHORT, INT, LONG, LONGLONG, UBYTE, USHORT, UINT, ULONG, * ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, - * STRING, UNICODE, OBJECT, DATETIME, TIMEDELTA# - * #work = 0,0,1,1,1,0,0,0,0,0,0,1,0,0,0,0,z,z,0,0,0# - * #default = 0*16,1*2,2,0*2# + * STRING, UNICODE, OBJECT# + * #work = 0,0,1,1,1,0,0,0,0,0,0,1,0,0,0,0,z,z,0# + * #default = 0*16,1*2,2# */ #define _NPY_UNUSED2_1 @@ -2518,49 +2518,6 @@ /**end repeat**/ -/**begin repeat - * #lname=datetime, timedelta# - * #name=Datetime,Timedelta# - */ -#if SIZEOF_LONG==SIZEOF_DATETIME -static long - at lname@_arrtype_hash(PyObject *obj) -{ - long x = (long)(((Py at name@ScalarObject *)obj)->obval); - if (x == -1) { - x = -2; - } - return x; -} -#elif SIZEOF_LONGLONG==SIZEOF_DATETIME -static long - at lname@_arrtype_hash(PyObject *obj) -{ - long y; - longlong x = (((Py at name@ScalarObject *)obj)->obval); - - if ((x <= LONG_MAX)) { - y = (long) x; - } - else { - union Mask { - long hashvals[2]; - longlong v; - } both; - - both.v = x; - y = both.hashvals[0] + (1000003)*both.hashvals[1]; - } - if (y == -1) { - y = -2; - } - return y; -} -#endif -/**end repeat**/ - - - /* Wrong thing to do for longdouble, but....*/ /**begin repeat @@ -3031,10 +2988,9 @@ /**begin repeat * #NAME = Byte, Short, Int, Long, LongLong, UByte, UShort, UInt, ULong, - * ULongLong, Float, Double, LongDouble, Datetime, Timedelta# - * #name = int*5, uint*5, float*3, datetime, timedelta# - * #CNAME = (CHAR, SHORT, INT, LONG, LONGLONG)*2, FLOAT, DOUBLE, LONGDOUBLE, - * DATETIME, TIMEDELTA# + * ULongLong, Float, Double, LongDouble# + * #name = int*5, uint*5, float*3# + * #CNAME = (CHAR, SHORT, INT, LONG, LONGLONG)*2, FLOAT, DOUBLE, LONGDOUBLE# */ #if BITSOF_ at CNAME@ == 8 #define _THIS_SIZE "8" @@ -3286,10 +3242,10 @@ /**begin repeat * #name = bool, byte, short, int, long, longlong, ubyte, ushort, uint, * ulong, ulonglong, float, double, longdouble, cfloat, cdouble, - * clongdouble, string, unicode, void, object, datetime, timedelta# + * clongdouble, string, unicode, void, object# * #NAME = Bool, Byte, Short, Int, Long, LongLong, UByte, UShort, UInt, * ULong, ULongLong, Float, Double, LongDouble, CFloat, CDouble, - * CLongDouble, String, Unicode, Void, Object, Datetime, Timedelta# + * CLongDouble, String, Unicode, Void, Object# */ Py at NAME@ArrType_Type.tp_flags = BASEFLAGS; Py at NAME@ArrType_Type.tp_new = @name at _arrtype_new; @@ -3298,11 +3254,9 @@ /**begin repeat * #name = bool, byte, short, ubyte, ushort, uint, ulong, ulonglong, - * float, longdouble, cfloat, clongdouble, void, object, datetime, - * timedelta# + * float, longdouble, cfloat, clongdouble, void, object# * #NAME = Bool, Byte, Short, UByte, UShort, UInt, ULong, ULongLong, - * Float, LongDouble, CFloat, CLongDouble, Void, Object, Datetime, - * Timedelta# + * Float, LongDouble, CFloat, CLongDouble, Void, Object# */ Py at NAME@ArrType_Type.tp_hash = @name at _arrtype_hash; /**end repeat**/ @@ -3393,8 +3347,6 @@ &PyCFloatArrType_Type, &PyCDoubleArrType_Type, &PyCLongDoubleArrType_Type, - &PyDatetimeArrType_Type, - &PyTimedeltaArrType_Type, &PyObjectArrType_Type, &PyStringArrType_Type, &PyUnicodeArrType_Type, Modified: branches/1.5.x/numpy/core/src/umath/loops.c.src =================================================================== --- branches/1.5.x/numpy/core/src/umath/loops.c.src 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/core/src/umath/loops.c.src 2010-07-17 18:31:17 UTC (rev 8495) @@ -849,170 +849,7 @@ /**end repeat**/ -/* - ***************************************************************************** - ** DATETIME LOOPS ** - ***************************************************************************** - */ -/**begin repeat - * #type = datetime, timedelta# - * #TYPE = DATETIME, TIMEDELTA# - * #ftype = double, double# - */ - -NPY_NO_EXPORT void - at TYPE@_ones_like(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) -{ - OUTPUT_LOOP { - *((@type@ *)op1) = 1; - } -} - -NPY_NO_EXPORT void - at TYPE@_negative(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) -{ - UNARY_LOOP { - const @type@ in1 = *(@type@ *)ip1; - *((@type@ *)op1) = (@type@)(-(@type@)in1); - } -} - -NPY_NO_EXPORT void - at TYPE@_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) -{ - UNARY_LOOP { - const @type@ in1 = *(@type@ *)ip1; - *((Bool *)op1) = !in1; - } -} - - -/**begin repeat1 - * #kind = equal, not_equal, greater, greater_equal, less, less_equal, - * logical_and, logical_or# - * #OP = ==, !=, >, >=, <, <=, &&, ||# - */ -NPY_NO_EXPORT void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) -{ - BINARY_LOOP { - const @type@ in1 = *(@type@ *)ip1; - const @type@ in2 = *(@type@ *)ip2; - *((Bool *)op1) = in1 @OP@ in2; - } -} -/**end repeat1**/ - -NPY_NO_EXPORT void - at TYPE@_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) -{ - BINARY_LOOP { - const @type@ in1 = *(@type@ *)ip1; - const @type@ in2 = *(@type@ *)ip2; - *((Bool *)op1)= (in1 && !in2) || (!in1 && in2); - } -} - -/**begin repeat1 - * #kind = maximum, minimum# - * #OP = >, <# - **/ -NPY_NO_EXPORT void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) -{ - BINARY_LOOP { - const @type@ in1 = *(@type@ *)ip1; - const @type@ in2 = *(@type@ *)ip2; - *((@type@ *)op1) = (in1 @OP@ in2) ? in1 : in2; - } -} -/**end repeat1**/ - -NPY_NO_EXPORT void - at TYPE@_absolute(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) -{ - UNARY_LOOP { - const @type@ in1 = *(@type@ *)ip1; - *((@type@ *)op1) = (in1 >= 0) ? in1 : -in1; - } -} - -NPY_NO_EXPORT void - at TYPE@_sign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) -{ - UNARY_LOOP { - const @type@ in1 = *(@type@ *)ip1; - *((@type@ *)op1) = in1 > 0 ? 1 : (in1 < 0 ? -1 : 0); - } -} - -/**end repeat**/ - -/* FIXME: implement the following correctly using the metadata: data is the - sequence of ndarrays in the same order as args. - */ -NPY_NO_EXPORT void -DATETIME_Mm_M_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) -{ - BINARY_LOOP { - const datetime in1 = *(datetime *)ip1; - const timedelta in2 = *(timedelta *)ip2; - *((datetime *)op1) = in1 + in2; - } -} - -NPY_NO_EXPORT void -DATETIME_mM_M_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) -{ - BINARY_LOOP { - const timedelta in1 = *(timedelta *)ip1; - const datetime in2 = *(datetime *)ip2; - *((datetime *)op1) = in1 + in2; - } -} - -NPY_NO_EXPORT void -TIMEDELTA_mm_m_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) -{ - BINARY_LOOP { - const timedelta in1 = *(timedelta *)ip1; - const timedelta in2 = *(timedelta *)ip2; - *((timedelta *)op1) = in1 + in2; - } -} - -NPY_NO_EXPORT void -DATETIME_Mm_M_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) -{ - BINARY_LOOP { - const datetime in1 = *(datetime *)ip1; - const timedelta in2 = *(timedelta *)ip2; - *((datetime *)op1) = in1 - in2; - } -} - -NPY_NO_EXPORT void -DATETIME_MM_m_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) -{ - BINARY_LOOP { - const datetime in1 = *(datetime *)ip1; - const datetime in2 = *(datetime *)ip2; - *((timedelta *)op1) = in1 - in2; - } -} - -NPY_NO_EXPORT void -TIMEDELTA_mm_m_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) -{ - BINARY_LOOP { - const timedelta in1 = *(timedelta *)ip1; - const timedelta in2 = *(timedelta *)ip2; - *((timedelta *)op1) = in1 - in2; - } -} - - /* ***************************************************************************** ** FLOAT LOOPS ** Modified: branches/1.5.x/numpy/core/src/umath/loops.h =================================================================== --- branches/1.5.x/numpy/core/src/umath/loops.h 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/core/src/umath/loops.h 2010-07-17 18:31:17 UTC (rev 8495) @@ -2355,179 +2355,34 @@ #undef CEQ #undef CNE -/* - ***************************************************************************** - ** DATETIME LOOPS ** - ***************************************************************************** - */ -#line 406 -#define DATETIME_fmax DATETIME_maximum -#define DATETIME_fmin DATETIME_minimum - -#line 406 -#define TIMEDELTA_fmax TIMEDELTA_maximum -#define TIMEDELTA_fmin TIMEDELTA_minimum - - -#line 415 -NPY_NO_EXPORT void -DATETIME_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -TIMEDELTA_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -#line 415 -NPY_NO_EXPORT void -DATETIME_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -TIMEDELTA_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -#line 415 -NPY_NO_EXPORT void -DATETIME_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -TIMEDELTA_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -#line 415 -NPY_NO_EXPORT void -DATETIME_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -TIMEDELTA_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -#line 415 -NPY_NO_EXPORT void -DATETIME_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -TIMEDELTA_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -#line 415 -NPY_NO_EXPORT void -DATETIME_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -TIMEDELTA_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -#line 415 -NPY_NO_EXPORT void -DATETIME_absolute(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -TIMEDELTA_absolute(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -#line 415 -NPY_NO_EXPORT void -DATETIME_logical_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -TIMEDELTA_logical_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -#line 415 -NPY_NO_EXPORT void -DATETIME_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -TIMEDELTA_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -#line 415 -NPY_NO_EXPORT void -DATETIME_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -TIMEDELTA_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -#line 415 -NPY_NO_EXPORT void -DATETIME_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -TIMEDELTA_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -#line 415 -NPY_NO_EXPORT void -DATETIME_maximum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -TIMEDELTA_maximum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -#line 415 -NPY_NO_EXPORT void -DATETIME_minimum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -TIMEDELTA_minimum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -#line 415 -NPY_NO_EXPORT void -DATETIME_negative(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -TIMEDELTA_negative(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -#line 415 -NPY_NO_EXPORT void -DATETIME_ones_like(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -TIMEDELTA_ones_like(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -#line 415 -NPY_NO_EXPORT void -DATETIME_sign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -TIMEDELTA_sign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - - -NPY_NO_EXPORT void -DATETIME_Mm_M_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -DATETIME_mM_M_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -DATETIME_Mm_M_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -DATETIME_MM_m_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -TIMEDELTA_mm_m_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -TIMEDELTA_mm_m_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - /* ***************************************************************************** ** OBJECT LOOPS ** ***************************************************************************** */ -#line 450 +#line 407 NPY_NO_EXPORT void OBJECT_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 450 +#line 407 NPY_NO_EXPORT void OBJECT_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 450 +#line 407 NPY_NO_EXPORT void OBJECT_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 450 +#line 407 NPY_NO_EXPORT void OBJECT_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 450 +#line 407 NPY_NO_EXPORT void OBJECT_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 450 +#line 407 NPY_NO_EXPORT void OBJECT_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); Modified: branches/1.5.x/numpy/core/src/umath/loops.h.src =================================================================== --- branches/1.5.x/numpy/core/src/umath/loops.h.src 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/core/src/umath/loops.h.src 2010-07-17 18:31:17 UTC (rev 8495) @@ -396,49 +396,6 @@ /* ***************************************************************************** - ** DATETIME LOOPS ** - ***************************************************************************** - */ - -/**begin repeat - * #TYPE = DATETIME, TIMEDELTA# - */ -#define @TYPE at _fmax @TYPE at _maximum -#define @TYPE at _fmin @TYPE at _minimum -/**end repeat**/ - -/**begin repeat - * #kind = equal, not_equal, greater, greater_equal, less, less_equal, - * absolute, logical_and, logical_not, logical_or, logical_xor, maximum, - * minimum, negative, ones_like, sign# - */ -NPY_NO_EXPORT void -DATETIME_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -TIMEDELTA_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -/**end repeat**/ - -NPY_NO_EXPORT void -DATETIME_Mm_M_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -DATETIME_mM_M_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -DATETIME_Mm_M_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -DATETIME_MM_m_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -TIMEDELTA_mm_m_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -NPY_NO_EXPORT void -TIMEDELTA_mm_m_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); - -/* - ***************************************************************************** ** OBJECT LOOPS ** ***************************************************************************** */ Modified: branches/1.5.x/numpy/core/src/umath/ufunc_object.c =================================================================== --- branches/1.5.x/numpy/core/src/umath/ufunc_object.c 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/core/src/umath/ufunc_object.c 2010-07-17 18:31:17 UTC (rev 8495) @@ -215,8 +215,6 @@ case PyArray_INT: case PyArray_LONG: case PyArray_LONGLONG: - case PyArray_DATETIME: - case PyArray_TIMEDELTA: return PyArray_BYTE; /* case PyArray_UBYTE */ case PyArray_USHORT: @@ -1541,13 +1539,6 @@ || (arg_types[i] == PyArray_OBJECT))) { loop->obj = UFUNC_OBJ_ISOBJECT|UFUNC_OBJ_NEEDS_API; } - if (!(loop->obj & UFUNC_OBJ_NEEDS_API) - && ((mps[i]->descr->type_num == PyArray_DATETIME) - || (mps[i]->descr->type_num == PyArray_TIMEDELTA) - || (arg_types[i] == PyArray_DATETIME) - || (arg_types[i] == PyArray_TIMEDELTA))) { - loop->obj = UFUNC_OBJ_NEEDS_API; - } } if (self->core_enabled && (loop->obj & UFUNC_OBJ_ISOBJECT)) { @@ -2504,13 +2495,6 @@ if (otype == PyArray_OBJECT || aar->descr->type_num == PyArray_OBJECT) { loop->obj = UFUNC_OBJ_ISOBJECT | UFUNC_OBJ_NEEDS_API; } - else if ((otype == PyArray_DATETIME) - || (aar->descr->type_num == PyArray_DATETIME) - || (otype == PyArray_TIMEDELTA) - || (aar->descr->type_num == PyArray_TIMEDELTA)) - { - loop->obj = UFUNC_OBJ_NEEDS_API; - } else { loop->obj = 0; } Modified: branches/1.5.x/numpy/core/tests/test_regression.py =================================================================== --- branches/1.5.x/numpy/core/tests/test_regression.py 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/core/tests/test_regression.py 2010-07-17 18:31:17 UTC (rev 8495) @@ -1304,8 +1304,7 @@ def test_ticket_1539(self): dtypes = [x for x in np.typeDict.values() - if (issubclass(x, np.number) - and not issubclass(x, np.timeinteger))] + if issubclass(x, np.number)] a = np.array([], dtypes[0]) failures = [] for x in dtypes: Modified: branches/1.5.x/numpy/f2py/__version__.py =================================================================== --- branches/1.5.x/numpy/f2py/__version__.py 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/f2py/__version__.py 2010-07-17 18:31:17 UTC (rev 8495) @@ -1,4 +1,4 @@ -major = 2 +major = 1 try: from __svn_version__ import version Modified: branches/1.5.x/numpy/lib/tests/test_type_check.py =================================================================== --- branches/1.5.x/numpy/lib/tests/test_type_check.py 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/lib/tests/test_type_check.py 2010-07-17 18:31:17 UTC (rev 8495) @@ -376,12 +376,5 @@ assert issubdtype(a.dtype,float) -class TestDateTimeData: - - def test_basic(self): - a = array(['1980-03-23'], dtype=datetime64) - assert_equal(datetime_data(a.dtype), (asbytes('us'), 1, 1, 1)) - - if __name__ == "__main__": run_module_suite() Modified: branches/1.5.x/numpy/random/mtrand/numpy.pxi =================================================================== --- branches/1.5.x/numpy/random/mtrand/numpy.pxi 2010-07-17 18:18:25 UTC (rev 8494) +++ branches/1.5.x/numpy/random/mtrand/numpy.pxi 2010-07-17 18:31:17 UTC (rev 8495) @@ -73,7 +73,7 @@ ctypedef extern class numpy.dtype [object PyArray_Descr]: cdef int type_num, elsize, alignment - cdef char type, kind, byteorder, flags + cdef char type, kind, byteorder, hasobject cdef object fields, typeobj ctypedef extern class numpy.ndarray [object PyArrayObject]: From numpy-svn at scipy.org Sat Jul 17 14:31:42 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 17 Jul 2010 13:31:42 -0500 (CDT) Subject: [Numpy-svn] r8496 - in branches/1.5.x/numpy/core: src/multiarray tests Message-ID: <20100717183142.7003D39CB11@scipy.org> Author: ptvirtan Date: 2010-07-17 13:31:42 -0500 (Sat, 17 Jul 2010) New Revision: 8496 Removed: branches/1.5.x/numpy/core/src/multiarray/_datetime.h branches/1.5.x/numpy/core/src/multiarray/datetime.c branches/1.5.x/numpy/core/tests/test_datetime.py Log: ENH: remove extraneous files from 1.5.x branch Deleted: branches/1.5.x/numpy/core/src/multiarray/_datetime.h =================================================================== --- branches/1.5.x/numpy/core/src/multiarray/_datetime.h 2010-07-17 18:31:17 UTC (rev 8495) +++ branches/1.5.x/numpy/core/src/multiarray/_datetime.h 2010-07-17 18:31:42 UTC (rev 8496) @@ -1,18 +0,0 @@ -#ifndef _NPY_PRIVATE__DATETIME_H_ -#define _NPY_PRIVATE__DATETIME_H_ - -NPY_NO_EXPORT void -PyArray_DatetimeToDatetimeStruct(npy_datetime val, NPY_DATETIMEUNIT fr, - npy_datetimestruct *result); - -NPY_NO_EXPORT void -PyArray_TimedeltaToTimedeltaStruct(npy_timedelta val, NPY_DATETIMEUNIT fr, - npy_timedeltastruct *result); - -NPY_NO_EXPORT npy_datetime -PyArray_DatetimeStructToDatetime(NPY_DATETIMEUNIT fr, npy_datetimestruct *d); - -NPY_NO_EXPORT npy_datetime -PyArray_TimedeltaStructToTimedelta(NPY_DATETIMEUNIT fr, npy_timedeltastruct *d); - -#endif Deleted: branches/1.5.x/numpy/core/src/multiarray/datetime.c =================================================================== --- branches/1.5.x/numpy/core/src/multiarray/datetime.c 2010-07-17 18:31:17 UTC (rev 8495) +++ branches/1.5.x/numpy/core/src/multiarray/datetime.c 2010-07-17 18:31:42 UTC (rev 8496) @@ -1,922 +0,0 @@ -#define PY_SSIZE_T_CLEAN -#include -#include - -#include - -#define _MULTIARRAYMODULE -#define NPY_NO_PREFIX -#include - -#include "npy_config.h" - -#include "numpy/npy_3kcompat.h" - -#include "_datetime.h" - -/* For defaults and errors */ -#define NPY_FR_ERR -1 - -/* Offset for number of days between Dec 31, 1969 and Jan 1, 0001 -* Assuming Gregorian calendar was always in effect (proleptic Gregorian calendar) -*/ - -/* Calendar Structure for Parsing Long -> Date */ -typedef struct { - int year, month, day; -} ymdstruct; - -typedef struct { - int hour, min, sec; -} hmsstruct; - - -/* - ==================================================== - == Beginning of section borrowed from mx.DateTime == - ==================================================== -*/ - -/* - * Functions in the following section are borrowed from mx.DateTime version - * 2.0.6, and hence this code is subject to the terms of the egenix public - * license version 1.0.0 - */ - -#define Py_AssertWithArg(x,errortype,errorstr,a1) {if (!(x)) {PyErr_Format(errortype,errorstr,a1);goto onError;}} - -/* Table with day offsets for each month (0-based, without and with leap) */ -static int month_offset[2][13] = { - { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }, - { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 } -}; - -/* Table of number of days in a month (0-based, without and with leap) */ -static int days_in_month[2][12] = { - { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, - { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } -}; - -/* Return 1/0 iff year points to a leap year in calendar. */ -static int -is_leapyear(long year) -{ - return (year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0)); -} - - -/* - * Return the day of the week for the given absolute date. - * Monday is 0 and Sunday is 6 - */ -static int -day_of_week(npy_longlong absdate) -{ - /* Add in four for the Thursday on Jan 1, 1970 (epoch offset)*/ - absdate += 4; - - if (absdate >= 0) { - return absdate % 7; - } - else { - return 6 + (absdate + 1) % 7; - } -} - -/* - * Return the year offset, that is the absolute date of the day - * 31.12.(year-1) since 31.12.1969 in the proleptic Gregorian calendar. - */ -static npy_longlong -year_offset(npy_longlong year) -{ - /* Note that 477 == 1969/4 - 1969/100 + 1969/400 */ - year--; - if (year >= 0 || -1/4 == -1) - return (year-1969)*365 + year/4 - year/100 + year/400 - 477; - else - return (year-1969)*365 + (year-3)/4 - (year-99)/100 + (year-399)/400 - 477; -} - -/* - * Modified version of mxDateTime function - * Returns absolute number of days since Jan 1, 1970 - * assuming a proleptic Gregorian Calendar - * Raises a ValueError if out of range month or day - * day -1 is Dec 31, 1969, day 0 is Jan 1, 1970, day 1 is Jan 2, 1970 - */ -static npy_longlong -days_from_ymd(int year, int month, int day) -{ - - /* Calculate the absolute date */ - int leap; - npy_longlong yearoffset, absdate; - - /* Is it a leap year ? */ - leap = is_leapyear(year); - - /* Negative month values indicate months relative to the years end */ - if (month < 0) month += 13; - Py_AssertWithArg(month >= 1 && month <= 12, - PyExc_ValueError, - "month out of range (1-12): %i", - month); - - /* Negative values indicate days relative to the months end */ - if (day < 0) day += days_in_month[leap][month - 1] + 1; - Py_AssertWithArg(day >= 1 && day <= days_in_month[leap][month - 1], - PyExc_ValueError, - "day out of range: %i", - day); - - /* - * Number of days between Dec 31, (year - 1) and Dec 31, 1969 - * (can be negative). - */ - yearoffset = year_offset(year); - - if (PyErr_Occurred()) goto onError; - - /* - * Calculate the number of days using yearoffset - * Jan 1, 1970 is day 0 and thus Dec. 31, 1969 is day -1 - */ - absdate = day-1 + month_offset[leap][month - 1] + yearoffset; - - return absdate; - - onError: - return 0; - -} - -/* Returns absolute seconds from an hour, minute, and second - */ -#define secs_from_hms(hour, min, sec, multiplier) (\ - ((hour)*3600 + (min)*60 + (sec)) * (npy_int64)(multiplier)\ -) - -/* - * Takes a number of days since Jan 1, 1970 (positive or negative) - * and returns the year. month, and day in the proleptic - * Gregorian calendar - * - * Examples: - * - * -1 returns 1969, 12, 31 - * 0 returns 1970, 1, 1 - * 1 returns 1970, 1, 2 - */ - -static ymdstruct -days_to_ymdstruct(npy_datetime dlong) -{ - ymdstruct ymd; - long year; - npy_longlong yearoffset; - int leap, dayoffset; - int month = 1, day = 1; - int *monthoffset; - - dlong += 1; - - /* Approximate year */ - year = 1970 + dlong / 365.2425; - - /* Apply corrections to reach the correct year */ - while (1) { - /* Calculate the year offset */ - yearoffset = year_offset(year); - - /* - * Backward correction: absdate must be greater than the - * yearoffset - */ - if (yearoffset >= dlong) { - year--; - continue; - } - - dayoffset = dlong - yearoffset; - leap = is_leapyear(year); - - /* Forward correction: non leap years only have 365 days */ - if (dayoffset > 365 && !leap) { - year++; - continue; - } - break; - } - - /* Now iterate to find the month */ - monthoffset = month_offset[leap]; - for (month = 1; month < 13; month++) { - if (monthoffset[month] >= dayoffset) - break; - } - day = dayoffset - month_offset[leap][month-1]; - - ymd.year = year; - ymd.month = month; - ymd.day = day; - - return ymd; -} - -/* - * Converts an integer number of seconds in a day to hours minutes seconds. - * It assumes seconds is between 0 and 86399. - */ - -static hmsstruct -seconds_to_hmsstruct(npy_longlong dlong) -{ - int hour, minute, second; - hmsstruct hms; - - hour = dlong / 3600; - minute = (dlong % 3600) / 60; - second = dlong - (hour*3600 + minute*60); - - hms.hour = hour; - hms.min = minute; - hms.sec = second; - - return hms; -} - -/* - ==================================================== - == End of section adapted from mx.DateTime == - ==================================================== -*/ - - -/*================================================== -// Parsing DateTime struct and returns a date-time number -// ================================================= - - Structure is assumed to be already normalized -*/ - -/*NUMPY_API - * Create a datetime value from a filled datetime struct and resolution unit. - */ -NPY_NO_EXPORT npy_datetime -PyArray_DatetimeStructToDatetime(NPY_DATETIMEUNIT fr, npy_datetimestruct *d) -{ - npy_datetime ret; - npy_longlong days; /* The absolute number of days since Jan 1, 1970 */ - - if (fr > NPY_FR_M) { - days = days_from_ymd(d->year, d->month, d->day); - } - if (fr == NPY_FR_Y) { - ret = d->year - 1970; - } - else if (fr == NPY_FR_M) { - ret = (d->year - 1970) * 12 + d->month - 1; - } - else if (fr == NPY_FR_W) { - /* This is just 7-days for now. */ - if (days >= 0) { - ret = days / 7; - } - else { - ret = (days - 6) / 7; - } - } - else if (fr == NPY_FR_B) { - npy_longlong x; - int dotw = day_of_week(days); - - if (dotw > 4) { - /* Invalid business day */ - ret = 0; - } - else { - if (days >= 0) { - /* offset to adjust first week */ - x = days - 4; - } - else { - x = days - 2; - } - ret = 2 + (x / 7) * 5 + x % 7; - } - } - else if (fr == NPY_FR_D) { - ret = days; - } - else if (fr == NPY_FR_h) { - ret = days * 24 + d->hour; - } - else if (fr == NPY_FR_m) { - ret = days * 1440 + d->hour * 60 + d->min; - } - else if (fr == NPY_FR_s) { - ret = days * (npy_int64)(86400) + - secs_from_hms(d->hour, d->min, d->sec, 1); - } - else if (fr == NPY_FR_ms) { - ret = days * (npy_int64)(86400000) - + secs_from_hms(d->hour, d->min, d->sec, 1000) - + (d->us / 1000); - } - else if (fr == NPY_FR_us) { - npy_int64 num = 86400 * 1000; - num *= (npy_int64)(1000); - ret = days * num + secs_from_hms(d->hour, d->min, d->sec, 1000000) - + d->us; - } - else if (fr == NPY_FR_ns) { - npy_int64 num = 86400 * 1000; - num *= (npy_int64)(1000 * 1000); - ret = days * num + secs_from_hms(d->hour, d->min, d->sec, 1000000000) - + d->us * (npy_int64)(1000) + (d->ps / 1000); - } - else if (fr == NPY_FR_ps) { - npy_int64 num2 = 1000 * 1000; - npy_int64 num1; - - num2 *= (npy_int64)(1000 * 1000); - num1 = (npy_int64)(86400) * num2; - ret = days * num1 + secs_from_hms(d->hour, d->min, d->sec, num2) - + d->us * (npy_int64)(1000000) + d->ps; - } - else if (fr == NPY_FR_fs) { - /* only 2.6 hours */ - npy_int64 num2 = 1000000; - num2 *= (npy_int64)(1000000); - num2 *= (npy_int64)(1000); - - /* get number of seconds as a postive or negative number */ - if (days >= 0) { - ret = secs_from_hms(d->hour, d->min, d->sec, 1); - } - else { - ret = ((d->hour - 24)*3600 + d->min*60 + d->sec); - } - ret = ret * num2 + d->us * (npy_int64)(1000000000) - + d->ps * (npy_int64)(1000) + (d->as / 1000); - } - else if (fr == NPY_FR_as) { - /* only 9.2 secs */ - npy_int64 num1, num2; - - num1 = 1000000; - num1 *= (npy_int64)(1000000); - num2 = num1 * (npy_int64)(1000000); - - if (days >= 0) { - ret = d->sec; - } - else { - ret = d->sec - 60; - } - ret = ret * num2 + d->us * num1 + d->ps * (npy_int64)(1000000) - + d->as; - } - else { - /* Shouldn't get here */ - PyErr_SetString(PyExc_ValueError, "invalid internal frequency"); - ret = -1; - } - - return ret; -} - -/* Uses Average values when frequency is Y, M, or B */ - -#define _DAYS_PER_MONTH 30.436875 -#define _DAYS_PER_YEAR 365.2425 - -/*NUMPY_API - * Create a timdelta value from a filled timedelta struct and resolution unit. - */ -NPY_NO_EXPORT npy_datetime -PyArray_TimedeltaStructToTimedelta(NPY_DATETIMEUNIT fr, npy_timedeltastruct *d) -{ - npy_datetime ret; - - if (fr == NPY_FR_Y) { - ret = d->day / _DAYS_PER_YEAR; - } - else if (fr == NPY_FR_M) { - ret = d->day / _DAYS_PER_MONTH; - } - else if (fr == NPY_FR_W) { - /* This is just 7-days for now. */ - if (d->day >= 0) { - ret = d->day / 7; - } - else { - ret = (d->day - 6) / 7; - } - } - else if (fr == NPY_FR_B) { - /* - * What is the meaning of a relative Business day? - * - * This assumes you want to take the day difference and - * convert it to business-day difference (removing 2 every 7). - */ - ret = (d->day / 7) * 5 + d->day % 7; - } - else if (fr == NPY_FR_D) { - ret = d->day; - } - else if (fr == NPY_FR_h) { - ret = d->day + d->sec / 3600; - } - else if (fr == NPY_FR_m) { - ret = d->day * (npy_int64)(1440) + d->sec / 60; - } - else if (fr == NPY_FR_s) { - ret = d->day * (npy_int64)(86400) + d->sec; - } - else if (fr == NPY_FR_ms) { - ret = d->day * (npy_int64)(86400000) + d->sec * 1000 + d->us / 1000; - } - else if (fr == NPY_FR_us) { - npy_int64 num = 86400000; - num *= (npy_int64)(1000); - ret = d->day * num + d->sec * (npy_int64)(1000000) + d->us; - } - else if (fr == NPY_FR_ns) { - npy_int64 num = 86400000; - num *= (npy_int64)(1000000); - ret = d->day * num + d->sec * (npy_int64)(1000000000) - + d->us * (npy_int64)(1000) + (d->ps / 1000); - } - else if (fr == NPY_FR_ps) { - npy_int64 num2, num1; - - num2 = 1000000; - num2 *= (npy_int64)(1000000); - num1 = (npy_int64)(86400) * num2; - - ret = d->day * num1 + d->sec * num2 + d->us * (npy_int64)(1000000) - + d->ps; - } - else if (fr == NPY_FR_fs) { - /* only 2.6 hours */ - npy_int64 num2 = 1000000000; - num2 *= (npy_int64)(1000000); - ret = d->sec * num2 + d->us * (npy_int64)(1000000000) - + d->ps * (npy_int64)(1000) + (d->as / 1000); - } - else if (fr == NPY_FR_as) { - /* only 9.2 secs */ - npy_int64 num1, num2; - - num1 = 1000000; - num1 *= (npy_int64)(1000000); - num2 = num1 * (npy_int64)(1000000); - ret = d->sec * num2 + d->us * num1 + d->ps * (npy_int64)(1000000) - + d->as; - } - else { - /* Shouldn't get here */ - PyErr_SetString(PyExc_ValueError, "invalid internal frequency"); - ret = -1; - } - - return ret; -} - - - -/*NUMPY_API - * Fill the datetime struct from the value and resolution unit. - */ -NPY_NO_EXPORT void -PyArray_DatetimeToDatetimeStruct(npy_datetime val, NPY_DATETIMEUNIT fr, - npy_datetimestruct *result) -{ - int year = 1970, month = 1, day = 1, - hour = 0, min = 0, sec = 0, - us = 0, ps = 0, as = 0; - - npy_int64 tmp; - ymdstruct ymd; - hmsstruct hms; - - /* - * Note that what looks like val / N and val % N for positive numbers maps to - * [val - (N-1)] / N and [N-1 + (val+1) % N] for negative numbers (with the 2nd - * value, the remainder, being positive in both cases). - */ - if (fr == NPY_FR_Y) { - year = 1970 + val; - } - else if (fr == NPY_FR_M) { - if (val >= 0) { - year = 1970 + val / 12; - month = val % 12 + 1; - } - else { - year = 1969 + (val + 1) / 12; - month = 12 + (val + 1)% 12; - } - } - else if (fr == NPY_FR_W) { - /* A week is the same as 7 days */ - ymd = days_to_ymdstruct(val * 7); - year = ymd.year; - month = ymd.month; - day = ymd.day; - } - else if (fr == NPY_FR_B) { - /* Number of business days since Thursday, 1-1-70 */ - npy_longlong absdays; - /* - * A buisness day is M T W Th F (i.e. all but Sat and Sun.) - * Convert the business day to the number of actual days. - * - * Must convert [0,1,2,3,4,5,6,7,...] to - * [0,1,4,5,6,7,8,11,...] - * and [...,-9,-8,-7,-6,-5,-4,-3,-2,-1,0] to - * [...,-13,-10,-9,-8,-7,-6,-3,-2,-1,0] - */ - if (val >= 0) { - absdays = 7 * ((val + 3) / 5) + ((val + 3) % 5) - 3; - } - else { - /* Recall how C computes / and % with negative numbers */ - absdays = 7 * ((val - 1) / 5) + ((val - 1) % 5) + 1; - } - ymd = days_to_ymdstruct(absdays); - year = ymd.year; - month = ymd.month; - day = ymd.day; - } - else if (fr == NPY_FR_D) { - ymd = days_to_ymdstruct(val); - year = ymd.year; - month = ymd.month; - day = ymd.day; - } - else if (fr == NPY_FR_h) { - if (val >= 0) { - ymd = days_to_ymdstruct(val / 24); - hour = val % 24; - } - else { - ymd = days_to_ymdstruct((val - 23) / 24); - hour = 23 + (val + 1) % 24; - } - year = ymd.year; - month = ymd.month; - day = ymd.day; - } - else if (fr == NPY_FR_m) { - if (val >= 0) { - ymd = days_to_ymdstruct(val / 1440); - min = val % 1440; - } - else { - ymd = days_to_ymdstruct((val - 1439) / 1440); - min = 1439 + (val + 1) % 1440; - } - hms = seconds_to_hmsstruct(min * 60); - year = ymd.year; - month = ymd.month; - day = ymd.day; - hour = hms.hour; - min = hms.min; - } - else if (fr == NPY_FR_s) { - if (val >= 0) { - ymd = days_to_ymdstruct(val / 86400); - sec = val % 86400; - } - else { - ymd = days_to_ymdstruct((val - 86399) / 86400); - sec = 86399 + (val + 1) % 86400; - } - hms = seconds_to_hmsstruct(val); - year = ymd.year; - month = ymd.month; - day = ymd.day; - hour = hms.hour; - min = hms.min; - sec = hms.sec; - } - else if (fr == NPY_FR_ms) { - if (val >= 0) { - ymd = days_to_ymdstruct(val / 86400000); - tmp = val % 86400000; - } - else { - ymd = days_to_ymdstruct((val - 86399999) / 86400000); - tmp = 86399999 + (val + 1) % 86399999; - } - hms = seconds_to_hmsstruct(tmp / 1000); - us = (tmp % 1000)*1000; - year = ymd.year; - month = ymd.month; - day = ymd.day; - hour = hms.hour; - min = hms.min; - sec = hms.sec; - } - else if (fr == NPY_FR_us) { - npy_int64 num1, num2; - num1 = 86400000; - num1 *= 1000; - num2 = num1 - 1; - if (val >= 0) { - ymd = days_to_ymdstruct(val / num1); - tmp = val % num1; - } - else { - ymd = days_to_ymdstruct((val - num2)/ num1); - tmp = num2 + (val + 1) % num1; - } - hms = seconds_to_hmsstruct(tmp / 1000000); - us = tmp % 1000000; - year = ymd.year; - month = ymd.month; - day = ymd.day; - hour = hms.hour; - min = hms.min; - sec = hms.sec; - } - else if (fr == NPY_FR_ns) { - npy_int64 num1, num2, num3; - num1 = 86400000; - num1 *= 1000000000; - num2 = num1 - 1; - num3 = 1000000; - num3 *= 1000000; - if (val >= 0) { - ymd = days_to_ymdstruct(val / num1); - tmp = val % num1; - } - else { - ymd = days_to_ymdstruct((val - num2)/ num1); - tmp = num2 + (val + 1) % num1; - } - hms = seconds_to_hmsstruct(tmp / 1000000000); - tmp = tmp % 1000000000; - us = tmp / 1000; - ps = (tmp % 1000) * (npy_int64)(1000); - year = ymd.year; - month = ymd.month; - day = ymd.day; - hour = hms.hour; - min = hms.min; - sec = hms.sec; - } - else if (fr == NPY_FR_ps) { - npy_int64 num1, num2, num3; - num3 = 1000000000; - num3 *= (npy_int64)(1000); - num1 = (npy_int64)(86400) * num3; - num2 = num1 - 1; - - if (val >= 0) { - ymd = days_to_ymdstruct(val / num1); - tmp = val % num1; - } - else { - ymd = days_to_ymdstruct((val - num2) / num1); - tmp = num2 + (val + 1) % num1; - } - hms = seconds_to_hmsstruct(tmp / num3); - tmp = tmp % num3; - us = tmp / 1000000; - ps = tmp % 1000000; - year = ymd.year; - month = ymd.month; - day = ymd.day; - hour = hms.hour; - min = hms.min; - sec = hms.sec; - } - else if (fr == NPY_FR_fs) { - /* entire range is only += 2.6 hours */ - npy_int64 num1, num2; - num1 = 1000000000; - num1 *= (npy_int64)(1000); - num2 = num1 * (npy_int64)(1000); - - if (val >= 0) { - sec = val / num2; - tmp = val % num2; - hms = seconds_to_hmsstruct(sec); - hour = hms.hour; - min = hms.min; - sec = hms.sec; - } - else { - /* tmp (number of fs) will be positive after this segment */ - year = 1969; - day = 31; - month = 12; - sec = (val - (num2-1))/num2; - tmp = (num2-1) + (val + 1) % num2; - if (sec == 0) { - /* we are at the last second */ - hour = 23; - min = 59; - sec = 59; - } - else { - hour = 24 + (sec - 3599)/3600; - sec = 3599 + (sec+1)%3600; - min = sec / 60; - sec = sec % 60; - } - } - us = tmp / 1000000000; - tmp = tmp % 1000000000; - ps = tmp / 1000; - as = (tmp % 1000) * (npy_int64)(1000); - } - else if (fr == NPY_FR_as) { - /* entire range is only += 9.2 seconds */ - npy_int64 num1, num2, num3; - num1 = 1000000; - num2 = num1 * (npy_int64)(1000000); - num3 = num2 * (npy_int64)(1000000); - if (val >= 0) { - hour = 0; - min = 0; - sec = val / num3; - tmp = val % num3; - } - else { - year = 1969; - day = 31; - month = 12; - hour = 23; - min = 59; - sec = 60 + (val - (num3-1)) / num3; - tmp = (num3-1) + (val+1) % num3; - } - us = tmp / num2; - tmp = tmp % num2; - ps = tmp / num1; - as = tmp % num1; - } - else { - PyErr_SetString(PyExc_RuntimeError, "invalid internal time resolution"); - } - - result->year = year; - result->month = month; - result->day = day; - result->hour = hour; - result->min = min; - result->sec = sec; - result->us = us; - result->ps = ps; - result->as = as; - - return; -} - -/* - * FIXME: Overflow is not handled at all - * To convert from Years, Months, and Business Days, multiplication by the average is done - */ - -/*NUMPY_API - * Fill the timedelta struct from the timedelta value and resolution unit. - */ -NPY_NO_EXPORT void -PyArray_TimedeltaToTimedeltaStruct(npy_timedelta val, NPY_DATETIMEUNIT fr, - npy_timedeltastruct *result) -{ - npy_longlong day=0; - int sec=0, us=0, ps=0, as=0; - npy_bool negative=0; - - /* - * Note that what looks like val / N and val % N for positive numbers maps to - * [val - (N-1)] / N and [N-1 + (val+1) % N] for negative numbers (with the 2nd - * value, the remainder, being positive in both cases). - */ - - if (val < 0) { - val = -val; - negative = 1; - } - if (fr == NPY_FR_Y) { - day = val * _DAYS_PER_YEAR; - } - else if (fr == NPY_FR_M) { - day = val * _DAYS_PER_MONTH; - } - else if (fr == NPY_FR_W) { - day = val * 7; - } - else if (fr == NPY_FR_B) { - /* Number of business days since Thursday, 1-1-70 */ - day = (val * 7) / 5; - } - else if (fr == NPY_FR_D) { - day = val; - } - else if (fr == NPY_FR_h) { - day = val / 24; - sec = (val % 24)*3600; - } - else if (fr == NPY_FR_m) { - day = val / 1440; - sec = (val % 1440)*60; - } - else if (fr == NPY_FR_s) { - day = val / (86400); - sec = val % 86400; - } - else if (fr == NPY_FR_ms) { - day = val / 86400000; - val = val % 86400000; - sec = val / 1000; - us = (val % 1000)*1000; - } - else if (fr == NPY_FR_us) { - npy_int64 num1; - num1 = 86400000; - num1 *= 1000; - day = val / num1; - us = val % num1; - sec = us / 1000000; - us = us % 1000000; - } - else if (fr == NPY_FR_ns) { - npy_int64 num1; - num1 = 86400000; - num1 *= 1000000; - day = val / num1; - val = val % num1; - sec = val / 1000000000; - val = val % 1000000000; - us = val / 1000; - ps = (val % 1000) * (npy_int64)(1000); - } - else if (fr == NPY_FR_ps) { - npy_int64 num1, num2; - num2 = 1000000000; - num2 *= (npy_int64)(1000); - num1 = (npy_int64)(86400) * num2; - - day = val / num1; - ps = val % num1; - sec = ps / num2; - ps = ps % num2; - us = ps / 1000000; - ps = ps % 1000000; - } - else if (fr == NPY_FR_fs) { - /* entire range is only += 9.2 hours */ - npy_int64 num1, num2; - num1 = 1000000000; - num2 = num1 * (npy_int64)(1000000); - - day = 0; - sec = val / num2; - val = val % num2; - us = val / num1; - val = val % num1; - ps = val / 1000; - as = (val % 1000) * (npy_int64)(1000); - } - else if (fr == NPY_FR_as) { - /* entire range is only += 2.6 seconds */ - npy_int64 num1, num2, num3; - num1 = 1000000; - num2 = num1 * (npy_int64)(1000000); - num3 = num2 * (npy_int64)(1000000); - day = 0; - sec = val / num3; - as = val % num3; - us = as / num2; - as = as % num2; - ps = as / num1; - as = as % num1; - } - else { - PyErr_SetString(PyExc_RuntimeError, "invalid internal time resolution"); - } - - if (negative) { - result->day = -day; - result->sec = -sec; - result->us = -us; - result->ps = -ps; - result->as = -as; - } - else { - result->day = day; - result->sec = sec; - result->us = us; - result->ps = ps; - result->as = as; - } - return; -} Deleted: branches/1.5.x/numpy/core/tests/test_datetime.py =================================================================== --- branches/1.5.x/numpy/core/tests/test_datetime.py 2010-07-17 18:31:17 UTC (rev 8495) +++ branches/1.5.x/numpy/core/tests/test_datetime.py 2010-07-17 18:31:42 UTC (rev 8496) @@ -1,73 +0,0 @@ -from os import path -import numpy as np -from numpy.testing import * - -class TestDateTime(TestCase): - def test_creation(self): - for unit in ['Y', 'M', 'W', 'B', 'D', - 'h', 'm', 's', 'ms', 'us', - 'ns', 'ps', 'fs', 'as']: - dt1 = np.dtype('M8[750%s]'%unit) - assert dt1 == np.dtype('datetime64[750%s]' % unit) - dt2 = np.dtype('m8[%s]' % unit) - assert dt2 == np.dtype('timedelta64[%s]' % unit) - - def test_divisor_conversion_year(self): - assert np.dtype('M8[Y/4]') == np.dtype('M8[3M]') - assert np.dtype('M8[Y/13]') == np.dtype('M8[4W]') - assert np.dtype('M8[3Y/73]') == np.dtype('M8[15D]') - - def test_divisor_conversion_month(self): - assert np.dtype('M8[M/2]') == np.dtype('M8[2W]') - assert np.dtype('M8[M/15]') == np.dtype('M8[2D]') - assert np.dtype('M8[3M/40]') == np.dtype('M8[54h]') - - def test_divisor_conversion_week(self): - assert np.dtype('m8[W/5]') == np.dtype('m8[B]') - assert np.dtype('m8[W/7]') == np.dtype('m8[D]') - assert np.dtype('m8[3W/14]') == np.dtype('m8[36h]') - assert np.dtype('m8[5W/140]') == np.dtype('m8[360m]') - - def test_divisor_conversion_bday(self): - assert np.dtype('M8[B/12]') == np.dtype('M8[2h]') - assert np.dtype('M8[B/120]') == np.dtype('M8[12m]') - assert np.dtype('M8[3B/960]') == np.dtype('M8[270s]') - - def test_divisor_conversion_day(self): - assert np.dtype('M8[D/12]') == np.dtype('M8[2h]') - assert np.dtype('M8[D/120]') == np.dtype('M8[12m]') - assert np.dtype('M8[3D/960]') == np.dtype('M8[270s]') - - def test_divisor_conversion_hour(self): - assert np.dtype('m8[h/30]') == np.dtype('m8[2m]') - assert np.dtype('m8[3h/300]') == np.dtype('m8[36s]') - - def test_divisor_conversion_minute(self): - assert np.dtype('m8[m/30]') == np.dtype('m8[2s]') - assert np.dtype('m8[3m/300]') == np.dtype('m8[600ms]') - - def test_divisor_conversion_second(self): - assert np.dtype('m8[s/100]') == np.dtype('m8[10ms]') - assert np.dtype('m8[3s/10000]') == np.dtype('m8[300us]') - - def test_divisor_conversion_fs(self): - assert np.dtype('M8[fs/100]') == np.dtype('M8[10as]') - self.assertRaises(ValueError, lambda : np.dtype('M8[3fs/10000]')) - - def test_divisor_conversion_as(self): - self.assertRaises(ValueError, lambda : np.dtype('M8[as/10]')) - - def test_creation_overflow(self): - date = '1980-03-23 20:00:00' - timesteps = np.array([date], dtype='datetime64[s]')[0].astype(np.int64) - for unit in ['ms', 'us', 'ns']: - timesteps *= 1000 - x = np.array([date], dtype='datetime64[%s]' % unit) - - assert_equal(timesteps, x[0].astype(np.int64), - err_msg='Datetime conversion error for unit %s' % unit) - - assert_equal(x[0].astype(np.int64), 322689600000000000) - -if __name__ == "__main__": - run_module_suite() From numpy-svn at scipy.org Sat Jul 17 14:32:22 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 17 Jul 2010 13:32:22 -0500 (CDT) Subject: [Numpy-svn] r8497 - in branches/1.5.x/doc: . cython numpybook numpybook/comparison/pyrex pyrex source/reference Message-ID: <20100717183222.6411639CB11@scipy.org> Author: ptvirtan Date: 2010-07-17 13:32:22 -0500 (Sat, 17 Jul 2010) New Revision: 8497 Modified: branches/1.5.x/doc/CAPI.txt branches/1.5.x/doc/cython/c_numpy.pxd branches/1.5.x/doc/numpybook/capi.lyx branches/1.5.x/doc/numpybook/comparison/pyrex/c_numpy.pxd branches/1.5.x/doc/pyrex/c_numpy.pxd branches/1.5.x/doc/source/reference/c-api.types-and-structures.rst Log: ENH: doc: roll back documentation changes to 1.5.x branch Modified: branches/1.5.x/doc/CAPI.txt =================================================================== --- branches/1.5.x/doc/CAPI.txt 2010-07-17 18:31:42 UTC (rev 8496) +++ branches/1.5.x/doc/CAPI.txt 2010-07-17 18:32:22 UTC (rev 8497) @@ -61,9 +61,9 @@ ``subtype`` : ``PyTypeObject *`` The subtype that should be created (either pass in - ``&PyArray_Type``, or ``obj->ob_type``, + ``&PyArray_Type``, ``&PyBigArray_Type``, or ``obj->ob_type``, where ``obj`` is a an instance of a subtype (or subclass) of - ``PyArray_Type``). + ``PyArray_Type`` or ``&PyBigArray_Type``). ``descr`` : ``PyArray_Descr *`` The type descriptor for the array. This is a Python object (this @@ -114,7 +114,7 @@ order array. See below for an explanation of the flags. ``obj`` : ``PyObject *`` - If subtypes is ``&PyArray_Type``, this argument is + If subtypes is ``&PyArray_Type`` or ``&PyBigArray_Type``, this argument is ignored. Otherwise, the ``__array_finalize__`` method of the subtype is called (if present) and passed this object. This is usually an array of the type to be created (so the ``__array_finalize__`` method Modified: branches/1.5.x/doc/cython/c_numpy.pxd =================================================================== --- branches/1.5.x/doc/cython/c_numpy.pxd 2010-07-17 18:31:42 UTC (rev 8496) +++ branches/1.5.x/doc/cython/c_numpy.pxd 2010-07-17 18:32:22 UTC (rev 8497) @@ -76,8 +76,7 @@ ctypedef extern class numpy.dtype [object PyArray_Descr]: cdef int type_num, elsize, alignment - cdef char type, kind, byteorder - cdef int flags + cdef char type, kind, byteorder, hasobject cdef object fields, typeobj ctypedef extern class numpy.ndarray [object PyArrayObject]: Modified: branches/1.5.x/doc/numpybook/capi.lyx =================================================================== --- branches/1.5.x/doc/numpybook/capi.lyx 2010-07-17 18:31:42 UTC (rev 8496) +++ branches/1.5.x/doc/numpybook/capi.lyx 2010-07-17 18:32:22 UTC (rev 8497) @@ -599,18 +599,10 @@ \emph on char \emph default - unused; + hasobject; \end_layout \begin_layout LyX-Code - -\emph on -int -\emph default - flags; -\end_layout - -\begin_layout LyX-Code \emph on int @@ -682,9 +674,9 @@ \family default flags should be set in the \family typewriter -flags +hasobject \family default - member. + flag. \end_layout \begin_layout Description @@ -710,7 +702,7 @@ \end_layout \begin_layout Description -flags A data-type bit-flag that determines if the data-type exhibits +hasobject A data-type bit-flag that determines if the data-type exhibits object-array like behavior. Each bit in this member is a flag which are named as: \end_layout Modified: branches/1.5.x/doc/numpybook/comparison/pyrex/c_numpy.pxd =================================================================== --- branches/1.5.x/doc/numpybook/comparison/pyrex/c_numpy.pxd 2010-07-17 18:31:42 UTC (rev 8496) +++ branches/1.5.x/doc/numpybook/comparison/pyrex/c_numpy.pxd 2010-07-17 18:32:22 UTC (rev 8497) @@ -73,8 +73,7 @@ ctypedef extern class numpy.dtype [object PyArray_Descr]: cdef int type_num, elsize, alignment - cdef char type, kind, byteorder - cdef int flags + cdef char type, kind, byteorder, hasobject cdef object fields, typeobj ctypedef extern class numpy.ndarray [object PyArrayObject]: Modified: branches/1.5.x/doc/pyrex/c_numpy.pxd =================================================================== --- branches/1.5.x/doc/pyrex/c_numpy.pxd 2010-07-17 18:31:42 UTC (rev 8496) +++ branches/1.5.x/doc/pyrex/c_numpy.pxd 2010-07-17 18:32:22 UTC (rev 8497) @@ -75,8 +75,7 @@ ctypedef extern class numpy.dtype [object PyArray_Descr]: cdef int type_num, elsize, alignment - cdef char type, kind, byteorder - cdef int flags + cdef char type, kind, byteorder, hasobject cdef object fields, typeobj ctypedef extern class numpy.ndarray [object PyArrayObject]: Modified: branches/1.5.x/doc/source/reference/c-api.types-and-structures.rst =================================================================== --- branches/1.5.x/doc/source/reference/c-api.types-and-structures.rst 2010-07-17 18:31:42 UTC (rev 8496) +++ branches/1.5.x/doc/source/reference/c-api.types-and-structures.rst 2010-07-17 18:32:22 UTC (rev 8497) @@ -191,8 +191,7 @@ char kind; char type; char byteorder; - char unused; - int flags; + char hasobject; int type_num; int elsize; int alignment; @@ -209,7 +208,7 @@ should point to a user-defined typeobject. This typeobject can either inherit from array scalars or not. If it does not inherit from array scalars, then the :cdata:`NPY_USE_GETITEM` and - :cdata:`NPY_USE_SETITEM` flags should be set in the ``flags`` member. + :cdata:`NPY_USE_SETITEM` flags should be set in the ``hasobject`` flag. .. cmember:: char PyArray_Descr.kind @@ -230,7 +229,7 @@ endian), '=' (native), '\|' (irrelevant, ignore). All builtin data- types have byteorder '='. -.. cmember:: int PyArray_Descr.flags +.. cmember:: char PyArray_Descr.hasobject A data-type bit-flag that determines if the data-type exhibits object- array like behavior. Each bit in this member is a flag which are named From numpy-svn at scipy.org Sat Jul 17 14:40:50 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 17 Jul 2010 13:40:50 -0500 (CDT) Subject: [Numpy-svn] r8498 - branches/1.5.x Message-ID: <20100717184050.F3BC739CB11@scipy.org> Author: ptvirtan Date: 2010-07-17 13:40:50 -0500 (Sat, 17 Jul 2010) New Revision: 8498 Modified: branches/1.5.x/setup.py Log: 1.5.x: set version number to 1.5.0 Modified: branches/1.5.x/setup.py =================================================================== --- branches/1.5.x/setup.py 2010-07-17 18:32:22 UTC (rev 8497) +++ branches/1.5.x/setup.py 2010-07-17 18:40:50 UTC (rev 8498) @@ -53,8 +53,8 @@ AUTHOR = "Travis E. Oliphant, et.al." AUTHOR_EMAIL = "oliphant at enthought.com" PLATFORMS = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"] -MAJOR = 2 -MINOR = 0 +MAJOR = 1 +MINOR = 5 MICRO = 0 ISRELEASED = False VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO) From numpy-svn at scipy.org Sun Jul 18 00:01:19 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 17 Jul 2010 23:01:19 -0500 (CDT) Subject: [Numpy-svn] r8499 - in trunk: doc/release numpy/polynomial numpy/polynomial/tests Message-ID: <20100718040119.BC0D439CAEF@scipy.org> Author: charris Date: 2010-07-17 23:01:19 -0500 (Sat, 17 Jul 2010) New Revision: 8499 Added: trunk/doc/release/1.5.0-notes.rst Removed: trunk/doc/release/2.0.0-notes.rst Modified: trunk/numpy/polynomial/chebyshev.py trunk/numpy/polynomial/polynomial.py trunk/numpy/polynomial/polytemplate.py trunk/numpy/polynomial/tests/test_chebyshev.py trunk/numpy/polynomial/tests/test_polynomial.py Log: Merge branch 'wgt' Copied: trunk/doc/release/1.5.0-notes.rst (from rev 8491, trunk/doc/release/2.0.0-notes.rst) =================================================================== --- trunk/doc/release/1.5.0-notes.rst (rev 0) +++ trunk/doc/release/1.5.0-notes.rst 2010-07-18 04:01:19 UTC (rev 8499) @@ -0,0 +1,106 @@ +========================= +NumPy 1.5.0 Release Notes +========================= + + +Plans +===== + +This release has the following aims: + +* Python 3 compatibility +* :pep:`3118` compatibility + + +Highlights +========== + + +New features +============ + +Warning on casting complex to real +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Numpy now emits a `numpy.ComplexWarning` when a complex number is cast +into a real number. For example: + + >>> x = np.array([1,2,3]) + >>> x[:2] = np.array([1+2j, 1-2j]) + ComplexWarning: Casting complex values to real discards the imaginary part + +The cast indeed discards the imaginary part, and this may not be the +intended behavior in all cases, hence the warning. This warning can be +turned off in the standard way: + + >>> import warnings + >>> warnings.simplefilter("ignore", np.ComplexWarning) + +Dot method for ndarrays +~~~~~~~~~~~~~~~~~~~~~~~ + +Ndarrays now have the dot product also as a method, which allows writing +chains of matrix products as + + >>> a.dot(b).dot(c) + +instead of the longer alternative + + >>> np.dot(a, np.dot(b, c)) + +linalg.slogdet function +~~~~~~~~~~~~~~~~~~~~~~~ + +The slogdet function returns the sign and logarithm of the determinant +of a matrix. Because the determinant may involve the product of many +small/large values, the result is often more accurate than that obtained +by simple multiplication. + +new header +~~~~~~~~~~ + +The new header file ndarraytypes.h contains the symbols from +ndarrayobject.h that do not depend on the PY_ARRAY_UNIQUE_SYMBOL and +NO_IMPORT/_ARRAY macros. Broadly, these symbols are types, typedefs, +and enumerations; the array function calls are left in +ndarrayobject.h. This allows users to include array-related types and +enumerations without needing to concern themselves with the macro +expansions and their side- effects. + +Changes +======= + +polynomial.polynomial +--------------------- + +* The polyint and polyder functions now check that the specified number + integrations or derivations is a non-negative integer. The number 0 is + a valid value for both functions. +* A degree method has been added to the Polynomial class. +* A trimdeg method has been added to the Polynomial class. It operates like + truncate except that the argument is the desired degree of the result, + not the number of coefficients. +* Polynomial.fit now uses None as the default domain for the fit. The default + Polynomial domain can be specified by using [] as the domain value. +* Weights can be used in both polyfit and Polynomial.fit +* A linspace method has been added to the Polynomial class to ease plotting. + +polynomial.chebyshev +-------------------- + +* The chebint and chebder functions now check that the specified number + integrations or derivations is a non-negative integer. The number 0 is + a valid value for both functions. +* A degree method has been added to the Chebyshev class. +* A trimdeg method has been added to the Chebyshev class. It operates like + truncate except that the argument is the desired degree of the result, + not the number of coefficients. +* Chebyshev.fit now uses None as the default domain for the fit. The default + Chebyshev domain can be specified by using [] as the domain value. +* Weights can be used in both chebfit and Chebyshev.fit +* A linspace method has been added to the Chebyshev class to ease plotting. + +histogram +--------- +After a two years transition period, the old behavior of the histogram function +has been phased out, and the "new" keyword has been removed. Deleted: trunk/doc/release/2.0.0-notes.rst =================================================================== --- trunk/doc/release/2.0.0-notes.rst 2010-07-17 18:40:50 UTC (rev 8498) +++ trunk/doc/release/2.0.0-notes.rst 2010-07-18 04:01:19 UTC (rev 8499) @@ -1,104 +0,0 @@ -========================= -NumPy 2.0.0 Release Notes -========================= - - -Plans -===== - -This release has the following aims: - -* Python 3 compatibility -* :pep:`3118` compatibility - - -Highlights -========== - - -New features -============ - -Warning on casting complex to real -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Numpy now emits a `numpy.ComplexWarning` when a complex number is cast -into a real number. For example: - - >>> x = np.array([1,2,3]) - >>> x[:2] = np.array([1+2j, 1-2j]) - ComplexWarning: Casting complex values to real discards the imaginary part - -The cast indeed discards the imaginary part, and this may not be the -intended behavior in all cases, hence the warning. This warning can be -turned off in the standard way: - - >>> import warnings - >>> warnings.simplefilter("ignore", np.ComplexWarning) - -Dot method for ndarrays -~~~~~~~~~~~~~~~~~~~~~~~ - -Ndarrays now have the dot product also as a method, which allows writing -chains of matrix products as - - >>> a.dot(b).dot(c) - -instead of the longer alternative - - >>> np.dot(a, np.dot(b, c)) - -linalg.slogdet function -~~~~~~~~~~~~~~~~~~~~~~~ - -The slogdet function returns the sign and logarithm of the determinant -of a matrix. Because the determinant may involve the product of many -small/large values, the result is often more accurate than that obtained -by simple multiplication. - -new header -~~~~~~~~~~ - -The new header file ndarraytypes.h contains the symbols from -ndarrayobject.h that do not depend on the PY_ARRAY_UNIQUE_SYMBOL and -NO_IMPORT/_ARRAY macros. Broadly, these symbols are types, typedefs, -and enumerations; the array function calls are left in -ndarrayobject.h. This allows users to include array-related types and -enumerations without needing to concern themselves with the macro -expansions and their side- effects. - -Changes -======= - -polynomial.polynomial ---------------------- - -* The polyint and polyder functions now check that the specified number integrations or - derivations is a non-negative integer. The number 0 is a valid value for both - functions. -* A degree method has been added to the Polynomial class. -* A cutdeg method has been added to the Polynomial class. It operates like - truncate except that the argument is the desired degree of the result, - not the number of coefficients. -* The fit class function of the Polynomial class now uses None as the default - domain for the fit. The default Polynomial domain can be specified by using - [] as the domain value. - -polynomial.chebyshev --------------------- - -* The chebint and chebder functions now check that the specified number integrations or - derivations is a non-negative integer. The number 0 is a valid value for both - functions. -* A degree method has been added to the Chebyshev class. -* A cutdeg method has been added to the Chebyshev class. It operates like - truncate except that the argument is the desired degree of the result, - not the number of coefficients. -* The fit class function of the Chebyshev class now uses None as the default - domain for the fit. The default Chebyshev domain can be specified by using - [] as the domain value. - -histogram ---------- -After a two years transition period, the old behavior of the histogram function -has been phased out, and the "new" keyword has been removed. Modified: trunk/numpy/polynomial/chebyshev.py =================================================================== --- trunk/numpy/polynomial/chebyshev.py 2010-07-17 18:40:50 UTC (rev 8498) +++ trunk/numpy/polynomial/chebyshev.py 2010-07-18 04:01:19 UTC (rev 8499) @@ -1046,7 +1046,8 @@ Parameters ---------- x : array_like - Array of points. The values are converted to double or complex doubles. + Array of points. The values are converted to double or complex + doubles. deg : integer Degree of the resulting matrix. @@ -1059,15 +1060,15 @@ """ x = np.asarray(x) + 0.0 order = int(deg) + 1 - v = np.ones(x.shape + (order,), dtype=x.dtype) + v = np.ones((order,) + x.shape, dtype=x.dtype) if order > 1 : x2 = 2*x - v[...,1] = x + v[1] = x for i in range(2, order) : - v[...,i] = x2*v[...,i-1] - v[...,i-2] - return v + v[i] = v[i-1]*x2 - v[i-2] + return np.rollaxis(v, 0, v.ndim) -def chebfit(x, y, deg, rcond=None, full=False): +def chebfit(x, y, deg, rcond=None, full=False, w=None): """ Least squares fit of Chebyshev series to data. @@ -1094,6 +1095,12 @@ Switch determining nature of return value. When it is False (the default) just the coefficients are returned, when True diagnostic information from the singular value decomposition is also returned. + w : array_like, shape (`M`,), optional + Weights. If not None, the contribution of each point + ``(x[i],y[i])`` to the fit is weighted by `w[i]`. Ideally the + weights are chosen so that the errors of the products ``w[i]*y[i]`` + all have the same variance. The default value is None. + .. versionadded:: 1.5.0 Returns ------- @@ -1176,17 +1183,33 @@ raise TypeError, "expected non-empty vector for x" if y.ndim < 1 or y.ndim > 2 : raise TypeError, "expected 1D or 2D array for y" - if x.shape[0] != y.shape[0] : + if len(x) != len(y): raise TypeError, "expected x and y to have same length" + # set up the least squares matrices + lhs = chebvander(x, deg) + rhs = y + if w is not None: + w = np.asarray(w) + 0.0 + if w.ndim != 1: + raise TypeError, "expected 1D vector for w" + if len(x) != len(w): + raise TypeError, "expected x and w to have same length" + # apply weights + if rhs.ndim == 2: + lhs *= w[:, np.newaxis] + rhs *= w[:, np.newaxis] + else: + lhs *= w[:, np.newaxis] + rhs *= w + # set rcond if rcond is None : rcond = len(x)*np.finfo(x.dtype).eps - # set up the design matrix and solve the least squares equation - A = chebvander(x, deg) - scl = np.sqrt((A*A).sum(0)) - c, resids, rank, s = la.lstsq(A/scl, y, rcond) + # scale the design matrix and solve the least squares equation + scl = np.sqrt((lhs*lhs).sum(0)) + c, resids, rank, s = la.lstsq(lhs/scl, rhs, rcond) c = (c.T/scl).T # warn on rank reduction Modified: trunk/numpy/polynomial/polynomial.py =================================================================== --- trunk/numpy/polynomial/polynomial.py 2010-07-17 18:40:50 UTC (rev 8498) +++ trunk/numpy/polynomial/polynomial.py 2010-07-18 04:01:19 UTC (rev 8499) @@ -646,14 +646,14 @@ """ x = np.asarray(x) + 0.0 order = int(deg) + 1 - v = np.ones(x.shape + (order,), dtype=x.dtype) + v = np.ones((order,) + x.shape, dtype=x.dtype) if order > 1 : - v[...,1] = x + v[1] = x for i in range(2, order) : - v[...,i] = x*v[...,i-1] - return v + v[i] = v[i-1]*x + return np.rollaxis(v, 0, v.ndim) -def polyfit(x, y, deg, rcond=None, full=False): +def polyfit(x, y, deg, rcond=None, full=False, w=None): """ Least-squares fit of a polynomial to data. @@ -684,6 +684,12 @@ (the default) just the coefficients are returned; when ``True``, diagnostic information from the singular value decomposition (used to solve the fit's matrix equation) is also returned. + w : array_like, shape (`M`,), optional + Weights. If not None, the contribution of each point + ``(x[i],y[i])`` to the fit is weighted by `w[i]`. Ideally the + weights are chosen so that the errors of the products ``w[i]*y[i]`` + all have the same variance. The default value is None. + .. versionadded:: 1.5.0 Returns ------- @@ -787,17 +793,33 @@ raise TypeError, "expected non-empty vector for x" if y.ndim < 1 or y.ndim > 2 : raise TypeError, "expected 1D or 2D array for y" - if x.shape[0] != y.shape[0] : + if len(x) != len(y): raise TypeError, "expected x and y to have same length" + # set up the least squares matrices + lhs = polyvander(x, deg) + rhs = y + if w is not None: + w = np.asarray(w) + 0.0 + if w.ndim != 1: + raise TypeError, "expected 1D vector for w" + if len(x) != len(w): + raise TypeError, "expected x and w to have same length" + # apply weights + if rhs.ndim == 2: + lhs *= w[:, np.newaxis] + rhs *= w[:, np.newaxis] + else: + lhs *= w[:, np.newaxis] + rhs *= w + # set rcond if rcond is None : rcond = len(x)*np.finfo(x.dtype).eps - # set up the design matrix and solve the least squares equation - A = polyvander(x, deg) - scl = np.sqrt((A*A).sum(0)) - c, resids, rank, s = la.lstsq(A/scl, y, rcond) + # scale the design matrix and solve the least squares equation + scl = np.sqrt((lhs*lhs).sum(0)) + c, resids, rank, s = la.lstsq(lhs/scl, rhs, rcond) c = (c.T/scl).T # warn on rank reduction Modified: trunk/numpy/polynomial/polytemplate.py =================================================================== --- trunk/numpy/polynomial/polytemplate.py 2010-07-17 18:40:50 UTC (rev 8498) +++ trunk/numpy/polynomial/polytemplate.py 2010-07-18 04:01:19 UTC (rev 8499) @@ -322,13 +322,13 @@ squares where the coefficients of the high degree terms may be very small. - Parameters: - ----------- + Parameters + ---------- deg : non-negative int The series is reduced to degree `deg` by discarding the high order terms. The value of `deg` must be a non-negative integer. - Returns: + Returns ------- new_instance : $name New instance of $name with reduced degree. @@ -343,8 +343,8 @@ def convert(self, domain=None, kind=None) : """Convert to different class and/or domain. - Parameters: - ----------- + Parameters + ---------- domain : {None, array_like} The domain of the new series type instance. If the value is is ``None``, then the default domain of `kind` is used. @@ -353,17 +353,17 @@ should be converted. If kind is ``None``, then the class of the current instance is used. - Returns: - -------- + Returns + ------- new_series_instance : `kind` The returned class can be of different type than the current instance and/or have a different domain. - Examples: - --------- + Examples + -------- - Notes: - ------ + Notes + ----- Conversion between domains and class types can result in numerically ill defined series. @@ -385,8 +385,8 @@ separately, then the linear function must be substituted for the ``x`` in the standard representation of the base polynomials. - Returns: - -------- + Returns + ------- off, scl : floats or complex The mapping function is defined by ``off + scl*x``. @@ -411,12 +411,12 @@ ``[0]``. A new $name instance is returned with the new coefficients. The current instance remains unchanged. - Parameters: - ----------- + Parameters + ---------- tol : non-negative number. All trailing coefficients less than `tol` will be removed. - Returns: + Returns ------- new_instance : $name Contains the new set of coefficients. @@ -432,13 +432,13 @@ can be useful in least squares where the coefficients of the high degree terms may be very small. - Parameters: - ----------- + Parameters + ---------- size : positive int The series is reduced to length `size` by discarding the high degree terms. The value of `size` must be a positive integer. - Returns: + Returns ------- new_instance : $name New instance of $name with truncated coefficients. @@ -458,8 +458,8 @@ A new instance of $name is returned that has the same coefficients and domain as the current instance. - Returns: - -------- + Returns + ------- new_instance : $name New instance of $name with the same coefficients and domain. @@ -472,8 +472,8 @@ Return an instance of $name that is the definite integral of the current series. Refer to `${nick}int` for full documentation. - Parameters: - ----------- + Parameters + ---------- m : non-negative int The number of integrations to perform. k : array_like @@ -484,8 +484,8 @@ lbnd : Scalar The lower bound of the definite integral. - Returns: - -------- + Returns + ------- integral : $name The integral of the series using the same domain. @@ -509,13 +509,13 @@ Return an instance of $name that is the derivative of the current series. Refer to `${nick}der` for full documentation. - Parameters: - ----------- + Parameters + ---------- m : non-negative int The number of integrations to perform. - Returns: - -------- + Returns + ------- derivative : $name The derivative of the series using the same domain. @@ -545,8 +545,35 @@ roots = ${nick}roots(self.coef) return pu.mapdomain(roots, $domain, self.domain) + def linspace(self, n): + """Return x,y values at equally spaced points in domain. + + Returns x, y values at `n` equally spaced points across domain. + Here y is the value of the polynomial at the points x. This is + intended as a plotting aid. + + Paramters + --------- + n : int + Number of point pairs to return. + + Returns + ------- + x, y : ndarrays + ``x`` is equal to linspace(self.domain[0], self.domain[1], n) + ``y`` is the polynomial evaluated at ``x``. + + .. versionadded:: 1.5.0 + + """ + x = np.linspace(self.domain[0], self.domain[1], n) + y = self(x) + return x, y + + + @staticmethod - def fit(x, y, deg, domain=None, rcond=None, full=False) : + def fit(x, y, deg, domain=None, rcond=None, full=False, w=None) : """Least squares fit to data. Return a `$name` instance that is the least squares fit to the data @@ -565,12 +592,12 @@ passing in a 2D-array that contains one dataset per column. deg : int Degree of the fitting polynomial - domain : {None, [], [beg, end]}, optional + domain : {None, [beg, end], []}, optional Domain to use for the returned $name instance. If ``None``, - then a minimal domain that covers the points `x` is chosen. - If ``[]`` the default domain ``$domain`` is used. The - default value is $domain in numpy 1.4.x and ``None`` in - numpy 2.0.0. The keyword value ``[]`` was added in numpy 2.0.0. + then a minimal domain that covers the points `x` is chosen. If + ``[]`` the default domain ``$domain`` is used. The default + value is $domain in numpy 1.4.x and ``None`` in later versions. + The ``'[]`` value was added in numpy 1.5.0. rcond : float, optional Relative condition number of the fit. Singular values smaller than this relative to the largest singular value will be @@ -582,6 +609,13 @@ (the default) just the coefficients are returned, when True diagnostic information from the singular value decomposition is also returned. + w : array_like, shape (M,), optional + Weights. If not None the contribution of each point + ``(x[i],y[i])`` to the fit is weighted by `w[i]`. Ideally the + weights are chosen so that the errors of the products + ``w[i]*y[i]`` all have the same variance. The default value is + None. + .. versionadded:: 1.5.0 Returns ------- @@ -605,7 +639,7 @@ elif domain == [] : domain = $domain xnew = pu.mapdomain(x, domain, $domain) - res = ${nick}fit(xnew, y, deg, rcond=None, full=full) + res = ${nick}fit(xnew, y, deg, w=w, rcond=rcond, full=full) if full : [coef, status] = res return $name(coef, domain=domain), status Modified: trunk/numpy/polynomial/tests/test_chebyshev.py =================================================================== --- trunk/numpy/polynomial/tests/test_chebyshev.py 2010-07-17 18:40:50 UTC (rev 8498) +++ trunk/numpy/polynomial/tests/test_chebyshev.py 2010-07-18 04:01:19 UTC (rev 8499) @@ -283,18 +283,33 @@ assert_raises(TypeError, ch.chebfit, [1], [[[1]]], 0) assert_raises(TypeError, ch.chebfit, [1, 2], [1], 0) assert_raises(TypeError, ch.chebfit, [1], [1, 2], 0) + assert_raises(TypeError, ch.chebfit, [1], [1], 0, w=[[1]]) + assert_raises(TypeError, ch.chebfit, [1], [1], 0, w=[1,1]) # Test fit x = np.linspace(0,2) y = f(x) - coef = ch.chebfit(x, y, 3) - assert_equal(len(coef), 4) - assert_almost_equal(ch.chebval(x, coef), y) - coef = ch.chebfit(x, y, 4) - assert_equal(len(coef), 5) - assert_almost_equal(ch.chebval(x, coef), y) - coef2d = ch.chebfit(x, np.array([y,y]).T, 4) - assert_almost_equal(coef2d, np.array([coef,coef]).T) + # + coef3 = ch.chebfit(x, y, 3) + assert_equal(len(coef3), 4) + assert_almost_equal(ch.chebval(x, coef3), y) + # + coef4 = ch.chebfit(x, y, 4) + assert_equal(len(coef4), 5) + assert_almost_equal(ch.chebval(x, coef4), y) + # + coef2d = ch.chebfit(x, np.array([y,y]).T, 3) + assert_almost_equal(coef2d, np.array([coef3,coef3]).T) + # test weighting + w = np.zeros_like(x) + yw = y.copy() + w[1::2] = 1 + y[0::2] = 0 + wcoef3 = ch.chebfit(x, yw, 3, w=w) + assert_almost_equal(wcoef3, coef3) + # + wcoef2d = ch.chebfit(x, np.array([yw,yw]).T, 3, w=w) + assert_almost_equal(wcoef2d, np.array([coef3,coef3]).T) def test_chebtrim(self) : coef = [2, -1, 1, 0] @@ -402,7 +417,7 @@ def test_degree(self) : assert_equal(self.p1.degree(), 2) - def test_cutdeg(self) : + def test_trimdeg(self) : assert_raises(ValueError, self.p1.cutdeg, .5) assert_raises(ValueError, self.p1.cutdeg, -1) assert_equal(len(self.p1.cutdeg(3)), 3) @@ -459,6 +474,13 @@ tgt = [0, .5, 1] assert_almost_equal(res, tgt) + def test_linspace(self): + xdes = np.linspace(0, 1, 20) + ydes = self.p2(xdes) + xres, yres = self.p2.linspace(20) + assert_almost_equal(xres, xdes) + assert_almost_equal(yres, ydes) + def test_fromroots(self) : roots = [0, .5, 1] p = ch.Chebyshev.fromroots(roots, domain=[0, 1]) @@ -483,6 +505,13 @@ p = ch.Chebyshev.fit(x, y, 3, []) assert_almost_equal(p(x), y) assert_almost_equal(p.domain, [-1, 1]) + # test that fit accepts weights. + w = np.zeros_like(x) + yw = y.copy() + w[1::2] = 1 + yw[0::2] = 0 + p = ch.Chebyshev.fit(x, yw, 3, w=w) + assert_almost_equal(p(x), y) def test_identity(self) : x = np.linspace(0,3) Modified: trunk/numpy/polynomial/tests/test_polynomial.py =================================================================== --- trunk/numpy/polynomial/tests/test_polynomial.py 2010-07-17 18:40:50 UTC (rev 8498) +++ trunk/numpy/polynomial/tests/test_polynomial.py 2010-07-18 04:01:19 UTC (rev 8499) @@ -263,18 +263,33 @@ assert_raises(TypeError, poly.polyfit, [1], [[[1]]], 0) assert_raises(TypeError, poly.polyfit, [1, 2], [1], 0) assert_raises(TypeError, poly.polyfit, [1], [1, 2], 0) + assert_raises(TypeError, poly.polyfit, [1], [1], 0, w=[[1]]) + assert_raises(TypeError, poly.polyfit, [1], [1], 0, w=[1,1]) # Test fit x = np.linspace(0,2) y = f(x) - coef = poly.polyfit(x, y, 3) - assert_equal(len(coef), 4) - assert_almost_equal(poly.polyval(x, coef), y) - coef = poly.polyfit(x, y, 4) - assert_equal(len(coef), 5) - assert_almost_equal(poly.polyval(x, coef), y) - coef2d = poly.polyfit(x, np.array([y,y]).T, 4) - assert_almost_equal(coef2d, np.array([coef,coef]).T) + # + coef3 = poly.polyfit(x, y, 3) + assert_equal(len(coef3), 4) + assert_almost_equal(poly.polyval(x, coef3), y) + # + coef4 = poly.polyfit(x, y, 4) + assert_equal(len(coef4), 5) + assert_almost_equal(poly.polyval(x, coef4), y) + # + coef2d = poly.polyfit(x, np.array([y,y]).T, 3) + assert_almost_equal(coef2d, np.array([coef3,coef3]).T) + # test weighting + w = np.zeros_like(x) + yw = y.copy() + w[1::2] = 1 + yw[0::2] = 0 + wcoef3 = poly.polyfit(x, yw, 3, w=w) + assert_almost_equal(wcoef3, coef3) + # + wcoef2d = poly.polyfit(x, np.array([yw,yw]).T, 3, w=w) + assert_almost_equal(wcoef2d, np.array([coef3,coef3]).T) def test_polytrim(self) : coef = [2, -1, 1, 0] @@ -373,7 +388,7 @@ def test_degree(self) : assert_equal(self.p1.degree(), 2) - def test_cutdeg(self) : + def test_trimdeg(self) : assert_raises(ValueError, self.p1.cutdeg, .5) assert_raises(ValueError, self.p1.cutdeg, -1) assert_equal(len(self.p1.cutdeg(3)), 3) @@ -430,6 +445,13 @@ tgt = [0, .5, 1] assert_almost_equal(res, tgt) + def test_linspace(self): + xdes = np.linspace(0, 1, 20) + ydes = self.p2(xdes) + xres, yres = self.p2.linspace(20) + assert_almost_equal(xres, xdes) + assert_almost_equal(yres, ydes) + def test_fromroots(self) : roots = [0, .5, 1] p = poly.Polynomial.fromroots(roots, domain=[0, 1]) @@ -454,6 +476,13 @@ p = poly.Polynomial.fit(x, y, 3, []) assert_almost_equal(p(x), y) assert_almost_equal(p.domain, [-1, 1]) + # test that fit accepts weights. + w = np.zeros_like(x) + yw = y.copy() + w[1::2] = 1 + yw[0::2] = 0 + p = poly.Polynomial.fit(x, yw, 3, w=w) + assert_almost_equal(p(x), y) def test_identity(self) : x = np.linspace(0,3) From numpy-svn at scipy.org Sun Jul 18 00:29:29 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 17 Jul 2010 23:29:29 -0500 (CDT) Subject: [Numpy-svn] r8500 - in branches/1.5.x: doc/release numpy/polynomial numpy/polynomial/tests Message-ID: <20100718042929.147D639CAEF@scipy.org> Author: charris Date: 2010-07-17 23:29:28 -0500 (Sat, 17 Jul 2010) New Revision: 8500 Added: branches/1.5.x/doc/release/1.5.0-notes.rst Removed: branches/1.5.x/doc/release/2.0.0-notes.rst Modified: branches/1.5.x/numpy/polynomial/chebyshev.py branches/1.5.x/numpy/polynomial/polynomial.py branches/1.5.x/numpy/polynomial/polytemplate.py branches/1.5.x/numpy/polynomial/tests/test_chebyshev.py branches/1.5.x/numpy/polynomial/tests/test_polynomial.py Log: BACK: Backport r8499 from trunk. Added: branches/1.5.x/doc/release/1.5.0-notes.rst =================================================================== --- branches/1.5.x/doc/release/1.5.0-notes.rst (rev 0) +++ branches/1.5.x/doc/release/1.5.0-notes.rst 2010-07-18 04:29:28 UTC (rev 8500) @@ -0,0 +1,106 @@ +========================= +NumPy 1.5.0 Release Notes +========================= + + +Plans +===== + +This release has the following aims: + +* Python 3 compatibility +* :pep:`3118` compatibility + + +Highlights +========== + + +New features +============ + +Warning on casting complex to real +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Numpy now emits a `numpy.ComplexWarning` when a complex number is cast +into a real number. For example: + + >>> x = np.array([1,2,3]) + >>> x[:2] = np.array([1+2j, 1-2j]) + ComplexWarning: Casting complex values to real discards the imaginary part + +The cast indeed discards the imaginary part, and this may not be the +intended behavior in all cases, hence the warning. This warning can be +turned off in the standard way: + + >>> import warnings + >>> warnings.simplefilter("ignore", np.ComplexWarning) + +Dot method for ndarrays +~~~~~~~~~~~~~~~~~~~~~~~ + +Ndarrays now have the dot product also as a method, which allows writing +chains of matrix products as + + >>> a.dot(b).dot(c) + +instead of the longer alternative + + >>> np.dot(a, np.dot(b, c)) + +linalg.slogdet function +~~~~~~~~~~~~~~~~~~~~~~~ + +The slogdet function returns the sign and logarithm of the determinant +of a matrix. Because the determinant may involve the product of many +small/large values, the result is often more accurate than that obtained +by simple multiplication. + +new header +~~~~~~~~~~ + +The new header file ndarraytypes.h contains the symbols from +ndarrayobject.h that do not depend on the PY_ARRAY_UNIQUE_SYMBOL and +NO_IMPORT/_ARRAY macros. Broadly, these symbols are types, typedefs, +and enumerations; the array function calls are left in +ndarrayobject.h. This allows users to include array-related types and +enumerations without needing to concern themselves with the macro +expansions and their side- effects. + +Changes +======= + +polynomial.polynomial +--------------------- + +* The polyint and polyder functions now check that the specified number + integrations or derivations is a non-negative integer. The number 0 is + a valid value for both functions. +* A degree method has been added to the Polynomial class. +* A trimdeg method has been added to the Polynomial class. It operates like + truncate except that the argument is the desired degree of the result, + not the number of coefficients. +* Polynomial.fit now uses None as the default domain for the fit. The default + Polynomial domain can be specified by using [] as the domain value. +* Weights can be used in both polyfit and Polynomial.fit +* A linspace method has been added to the Polynomial class to ease plotting. + +polynomial.chebyshev +-------------------- + +* The chebint and chebder functions now check that the specified number + integrations or derivations is a non-negative integer. The number 0 is + a valid value for both functions. +* A degree method has been added to the Chebyshev class. +* A trimdeg method has been added to the Chebyshev class. It operates like + truncate except that the argument is the desired degree of the result, + not the number of coefficients. +* Chebyshev.fit now uses None as the default domain for the fit. The default + Chebyshev domain can be specified by using [] as the domain value. +* Weights can be used in both chebfit and Chebyshev.fit +* A linspace method has been added to the Chebyshev class to ease plotting. + +histogram +--------- +After a two years transition period, the old behavior of the histogram function +has been phased out, and the "new" keyword has been removed. Deleted: branches/1.5.x/doc/release/2.0.0-notes.rst =================================================================== --- branches/1.5.x/doc/release/2.0.0-notes.rst 2010-07-18 04:01:19 UTC (rev 8499) +++ branches/1.5.x/doc/release/2.0.0-notes.rst 2010-07-18 04:29:28 UTC (rev 8500) @@ -1,104 +0,0 @@ -========================= -NumPy 2.0.0 Release Notes -========================= - - -Plans -===== - -This release has the following aims: - -* Python 3 compatibility -* :pep:`3118` compatibility - - -Highlights -========== - - -New features -============ - -Warning on casting complex to real -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Numpy now emits a `numpy.ComplexWarning` when a complex number is cast -into a real number. For example: - - >>> x = np.array([1,2,3]) - >>> x[:2] = np.array([1+2j, 1-2j]) - ComplexWarning: Casting complex values to real discards the imaginary part - -The cast indeed discards the imaginary part, and this may not be the -intended behavior in all cases, hence the warning. This warning can be -turned off in the standard way: - - >>> import warnings - >>> warnings.simplefilter("ignore", np.ComplexWarning) - -Dot method for ndarrays -~~~~~~~~~~~~~~~~~~~~~~~ - -Ndarrays now have the dot product also as a method, which allows writing -chains of matrix products as - - >>> a.dot(b).dot(c) - -instead of the longer alternative - - >>> np.dot(a, np.dot(b, c)) - -linalg.slogdet function -~~~~~~~~~~~~~~~~~~~~~~~ - -The slogdet function returns the sign and logarithm of the determinant -of a matrix. Because the determinant may involve the product of many -small/large values, the result is often more accurate than that obtained -by simple multiplication. - -new header -~~~~~~~~~~ - -The new header file ndarraytypes.h contains the symbols from -ndarrayobject.h that do not depend on the PY_ARRAY_UNIQUE_SYMBOL and -NO_IMPORT/_ARRAY macros. Broadly, these symbols are types, typedefs, -and enumerations; the array function calls are left in -ndarrayobject.h. This allows users to include array-related types and -enumerations without needing to concern themselves with the macro -expansions and their side- effects. - -Changes -======= - -polynomial.polynomial ---------------------- - -* The polyint and polyder functions now check that the specified number integrations or - derivations is a non-negative integer. The number 0 is a valid value for both - functions. -* A degree method has been added to the Polynomial class. -* A cutdeg method has been added to the Polynomial class. It operates like - truncate except that the argument is the desired degree of the result, - not the number of coefficients. -* The fit class function of the Polynomial class now uses None as the default - domain for the fit. The default Polynomial domain can be specified by using - [] as the domain value. - -polynomial.chebyshev --------------------- - -* The chebint and chebder functions now check that the specified number integrations or - derivations is a non-negative integer. The number 0 is a valid value for both - functions. -* A degree method has been added to the Chebyshev class. -* A cutdeg method has been added to the Chebyshev class. It operates like - truncate except that the argument is the desired degree of the result, - not the number of coefficients. -* The fit class function of the Chebyshev class now uses None as the default - domain for the fit. The default Chebyshev domain can be specified by using - [] as the domain value. - -histogram ---------- -After a two years transition period, the old behavior of the histogram function -has been phased out, and the "new" keyword has been removed. Modified: branches/1.5.x/numpy/polynomial/chebyshev.py =================================================================== --- branches/1.5.x/numpy/polynomial/chebyshev.py 2010-07-18 04:01:19 UTC (rev 8499) +++ branches/1.5.x/numpy/polynomial/chebyshev.py 2010-07-18 04:29:28 UTC (rev 8500) @@ -1046,7 +1046,8 @@ Parameters ---------- x : array_like - Array of points. The values are converted to double or complex doubles. + Array of points. The values are converted to double or complex + doubles. deg : integer Degree of the resulting matrix. @@ -1059,15 +1060,15 @@ """ x = np.asarray(x) + 0.0 order = int(deg) + 1 - v = np.ones(x.shape + (order,), dtype=x.dtype) + v = np.ones((order,) + x.shape, dtype=x.dtype) if order > 1 : x2 = 2*x - v[...,1] = x + v[1] = x for i in range(2, order) : - v[...,i] = x2*v[...,i-1] - v[...,i-2] - return v + v[i] = v[i-1]*x2 - v[i-2] + return np.rollaxis(v, 0, v.ndim) -def chebfit(x, y, deg, rcond=None, full=False): +def chebfit(x, y, deg, rcond=None, full=False, w=None): """ Least squares fit of Chebyshev series to data. @@ -1094,6 +1095,12 @@ Switch determining nature of return value. When it is False (the default) just the coefficients are returned, when True diagnostic information from the singular value decomposition is also returned. + w : array_like, shape (`M`,), optional + Weights. If not None, the contribution of each point + ``(x[i],y[i])`` to the fit is weighted by `w[i]`. Ideally the + weights are chosen so that the errors of the products ``w[i]*y[i]`` + all have the same variance. The default value is None. + .. versionadded:: 1.5.0 Returns ------- @@ -1176,17 +1183,33 @@ raise TypeError, "expected non-empty vector for x" if y.ndim < 1 or y.ndim > 2 : raise TypeError, "expected 1D or 2D array for y" - if x.shape[0] != y.shape[0] : + if len(x) != len(y): raise TypeError, "expected x and y to have same length" + # set up the least squares matrices + lhs = chebvander(x, deg) + rhs = y + if w is not None: + w = np.asarray(w) + 0.0 + if w.ndim != 1: + raise TypeError, "expected 1D vector for w" + if len(x) != len(w): + raise TypeError, "expected x and w to have same length" + # apply weights + if rhs.ndim == 2: + lhs *= w[:, np.newaxis] + rhs *= w[:, np.newaxis] + else: + lhs *= w[:, np.newaxis] + rhs *= w + # set rcond if rcond is None : rcond = len(x)*np.finfo(x.dtype).eps - # set up the design matrix and solve the least squares equation - A = chebvander(x, deg) - scl = np.sqrt((A*A).sum(0)) - c, resids, rank, s = la.lstsq(A/scl, y, rcond) + # scale the design matrix and solve the least squares equation + scl = np.sqrt((lhs*lhs).sum(0)) + c, resids, rank, s = la.lstsq(lhs/scl, rhs, rcond) c = (c.T/scl).T # warn on rank reduction Modified: branches/1.5.x/numpy/polynomial/polynomial.py =================================================================== --- branches/1.5.x/numpy/polynomial/polynomial.py 2010-07-18 04:01:19 UTC (rev 8499) +++ branches/1.5.x/numpy/polynomial/polynomial.py 2010-07-18 04:29:28 UTC (rev 8500) @@ -646,14 +646,14 @@ """ x = np.asarray(x) + 0.0 order = int(deg) + 1 - v = np.ones(x.shape + (order,), dtype=x.dtype) + v = np.ones((order,) + x.shape, dtype=x.dtype) if order > 1 : - v[...,1] = x + v[1] = x for i in range(2, order) : - v[...,i] = x*v[...,i-1] - return v + v[i] = v[i-1]*x + return np.rollaxis(v, 0, v.ndim) -def polyfit(x, y, deg, rcond=None, full=False): +def polyfit(x, y, deg, rcond=None, full=False, w=None): """ Least-squares fit of a polynomial to data. @@ -684,6 +684,12 @@ (the default) just the coefficients are returned; when ``True``, diagnostic information from the singular value decomposition (used to solve the fit's matrix equation) is also returned. + w : array_like, shape (`M`,), optional + Weights. If not None, the contribution of each point + ``(x[i],y[i])`` to the fit is weighted by `w[i]`. Ideally the + weights are chosen so that the errors of the products ``w[i]*y[i]`` + all have the same variance. The default value is None. + .. versionadded:: 1.5.0 Returns ------- @@ -787,17 +793,33 @@ raise TypeError, "expected non-empty vector for x" if y.ndim < 1 or y.ndim > 2 : raise TypeError, "expected 1D or 2D array for y" - if x.shape[0] != y.shape[0] : + if len(x) != len(y): raise TypeError, "expected x and y to have same length" + # set up the least squares matrices + lhs = polyvander(x, deg) + rhs = y + if w is not None: + w = np.asarray(w) + 0.0 + if w.ndim != 1: + raise TypeError, "expected 1D vector for w" + if len(x) != len(w): + raise TypeError, "expected x and w to have same length" + # apply weights + if rhs.ndim == 2: + lhs *= w[:, np.newaxis] + rhs *= w[:, np.newaxis] + else: + lhs *= w[:, np.newaxis] + rhs *= w + # set rcond if rcond is None : rcond = len(x)*np.finfo(x.dtype).eps - # set up the design matrix and solve the least squares equation - A = polyvander(x, deg) - scl = np.sqrt((A*A).sum(0)) - c, resids, rank, s = la.lstsq(A/scl, y, rcond) + # scale the design matrix and solve the least squares equation + scl = np.sqrt((lhs*lhs).sum(0)) + c, resids, rank, s = la.lstsq(lhs/scl, rhs, rcond) c = (c.T/scl).T # warn on rank reduction Modified: branches/1.5.x/numpy/polynomial/polytemplate.py =================================================================== --- branches/1.5.x/numpy/polynomial/polytemplate.py 2010-07-18 04:01:19 UTC (rev 8499) +++ branches/1.5.x/numpy/polynomial/polytemplate.py 2010-07-18 04:29:28 UTC (rev 8500) @@ -322,13 +322,13 @@ squares where the coefficients of the high degree terms may be very small. - Parameters: - ----------- + Parameters + ---------- deg : non-negative int The series is reduced to degree `deg` by discarding the high order terms. The value of `deg` must be a non-negative integer. - Returns: + Returns ------- new_instance : $name New instance of $name with reduced degree. @@ -343,8 +343,8 @@ def convert(self, domain=None, kind=None) : """Convert to different class and/or domain. - Parameters: - ----------- + Parameters + ---------- domain : {None, array_like} The domain of the new series type instance. If the value is is ``None``, then the default domain of `kind` is used. @@ -353,17 +353,17 @@ should be converted. If kind is ``None``, then the class of the current instance is used. - Returns: - -------- + Returns + ------- new_series_instance : `kind` The returned class can be of different type than the current instance and/or have a different domain. - Examples: - --------- + Examples + -------- - Notes: - ------ + Notes + ----- Conversion between domains and class types can result in numerically ill defined series. @@ -385,8 +385,8 @@ separately, then the linear function must be substituted for the ``x`` in the standard representation of the base polynomials. - Returns: - -------- + Returns + ------- off, scl : floats or complex The mapping function is defined by ``off + scl*x``. @@ -411,12 +411,12 @@ ``[0]``. A new $name instance is returned with the new coefficients. The current instance remains unchanged. - Parameters: - ----------- + Parameters + ---------- tol : non-negative number. All trailing coefficients less than `tol` will be removed. - Returns: + Returns ------- new_instance : $name Contains the new set of coefficients. @@ -432,13 +432,13 @@ can be useful in least squares where the coefficients of the high degree terms may be very small. - Parameters: - ----------- + Parameters + ---------- size : positive int The series is reduced to length `size` by discarding the high degree terms. The value of `size` must be a positive integer. - Returns: + Returns ------- new_instance : $name New instance of $name with truncated coefficients. @@ -458,8 +458,8 @@ A new instance of $name is returned that has the same coefficients and domain as the current instance. - Returns: - -------- + Returns + ------- new_instance : $name New instance of $name with the same coefficients and domain. @@ -472,8 +472,8 @@ Return an instance of $name that is the definite integral of the current series. Refer to `${nick}int` for full documentation. - Parameters: - ----------- + Parameters + ---------- m : non-negative int The number of integrations to perform. k : array_like @@ -484,8 +484,8 @@ lbnd : Scalar The lower bound of the definite integral. - Returns: - -------- + Returns + ------- integral : $name The integral of the series using the same domain. @@ -509,13 +509,13 @@ Return an instance of $name that is the derivative of the current series. Refer to `${nick}der` for full documentation. - Parameters: - ----------- + Parameters + ---------- m : non-negative int The number of integrations to perform. - Returns: - -------- + Returns + ------- derivative : $name The derivative of the series using the same domain. @@ -545,8 +545,35 @@ roots = ${nick}roots(self.coef) return pu.mapdomain(roots, $domain, self.domain) + def linspace(self, n): + """Return x,y values at equally spaced points in domain. + + Returns x, y values at `n` equally spaced points across domain. + Here y is the value of the polynomial at the points x. This is + intended as a plotting aid. + + Paramters + --------- + n : int + Number of point pairs to return. + + Returns + ------- + x, y : ndarrays + ``x`` is equal to linspace(self.domain[0], self.domain[1], n) + ``y`` is the polynomial evaluated at ``x``. + + .. versionadded:: 1.5.0 + + """ + x = np.linspace(self.domain[0], self.domain[1], n) + y = self(x) + return x, y + + + @staticmethod - def fit(x, y, deg, domain=None, rcond=None, full=False) : + def fit(x, y, deg, domain=None, rcond=None, full=False, w=None) : """Least squares fit to data. Return a `$name` instance that is the least squares fit to the data @@ -565,12 +592,12 @@ passing in a 2D-array that contains one dataset per column. deg : int Degree of the fitting polynomial - domain : {None, [], [beg, end]}, optional + domain : {None, [beg, end], []}, optional Domain to use for the returned $name instance. If ``None``, - then a minimal domain that covers the points `x` is chosen. - If ``[]`` the default domain ``$domain`` is used. The - default value is $domain in numpy 1.4.x and ``None`` in - numpy 2.0.0. The keyword value ``[]`` was added in numpy 2.0.0. + then a minimal domain that covers the points `x` is chosen. If + ``[]`` the default domain ``$domain`` is used. The default + value is $domain in numpy 1.4.x and ``None`` in later versions. + The ``'[]`` value was added in numpy 1.5.0. rcond : float, optional Relative condition number of the fit. Singular values smaller than this relative to the largest singular value will be @@ -582,6 +609,13 @@ (the default) just the coefficients are returned, when True diagnostic information from the singular value decomposition is also returned. + w : array_like, shape (M,), optional + Weights. If not None the contribution of each point + ``(x[i],y[i])`` to the fit is weighted by `w[i]`. Ideally the + weights are chosen so that the errors of the products + ``w[i]*y[i]`` all have the same variance. The default value is + None. + .. versionadded:: 1.5.0 Returns ------- @@ -605,7 +639,7 @@ elif domain == [] : domain = $domain xnew = pu.mapdomain(x, domain, $domain) - res = ${nick}fit(xnew, y, deg, rcond=None, full=full) + res = ${nick}fit(xnew, y, deg, w=w, rcond=rcond, full=full) if full : [coef, status] = res return $name(coef, domain=domain), status Modified: branches/1.5.x/numpy/polynomial/tests/test_chebyshev.py =================================================================== --- branches/1.5.x/numpy/polynomial/tests/test_chebyshev.py 2010-07-18 04:01:19 UTC (rev 8499) +++ branches/1.5.x/numpy/polynomial/tests/test_chebyshev.py 2010-07-18 04:29:28 UTC (rev 8500) @@ -283,18 +283,33 @@ assert_raises(TypeError, ch.chebfit, [1], [[[1]]], 0) assert_raises(TypeError, ch.chebfit, [1, 2], [1], 0) assert_raises(TypeError, ch.chebfit, [1], [1, 2], 0) + assert_raises(TypeError, ch.chebfit, [1], [1], 0, w=[[1]]) + assert_raises(TypeError, ch.chebfit, [1], [1], 0, w=[1,1]) # Test fit x = np.linspace(0,2) y = f(x) - coef = ch.chebfit(x, y, 3) - assert_equal(len(coef), 4) - assert_almost_equal(ch.chebval(x, coef), y) - coef = ch.chebfit(x, y, 4) - assert_equal(len(coef), 5) - assert_almost_equal(ch.chebval(x, coef), y) - coef2d = ch.chebfit(x, np.array([y,y]).T, 4) - assert_almost_equal(coef2d, np.array([coef,coef]).T) + # + coef3 = ch.chebfit(x, y, 3) + assert_equal(len(coef3), 4) + assert_almost_equal(ch.chebval(x, coef3), y) + # + coef4 = ch.chebfit(x, y, 4) + assert_equal(len(coef4), 5) + assert_almost_equal(ch.chebval(x, coef4), y) + # + coef2d = ch.chebfit(x, np.array([y,y]).T, 3) + assert_almost_equal(coef2d, np.array([coef3,coef3]).T) + # test weighting + w = np.zeros_like(x) + yw = y.copy() + w[1::2] = 1 + y[0::2] = 0 + wcoef3 = ch.chebfit(x, yw, 3, w=w) + assert_almost_equal(wcoef3, coef3) + # + wcoef2d = ch.chebfit(x, np.array([yw,yw]).T, 3, w=w) + assert_almost_equal(wcoef2d, np.array([coef3,coef3]).T) def test_chebtrim(self) : coef = [2, -1, 1, 0] @@ -402,7 +417,7 @@ def test_degree(self) : assert_equal(self.p1.degree(), 2) - def test_cutdeg(self) : + def test_trimdeg(self) : assert_raises(ValueError, self.p1.cutdeg, .5) assert_raises(ValueError, self.p1.cutdeg, -1) assert_equal(len(self.p1.cutdeg(3)), 3) @@ -459,6 +474,13 @@ tgt = [0, .5, 1] assert_almost_equal(res, tgt) + def test_linspace(self): + xdes = np.linspace(0, 1, 20) + ydes = self.p2(xdes) + xres, yres = self.p2.linspace(20) + assert_almost_equal(xres, xdes) + assert_almost_equal(yres, ydes) + def test_fromroots(self) : roots = [0, .5, 1] p = ch.Chebyshev.fromroots(roots, domain=[0, 1]) @@ -483,6 +505,13 @@ p = ch.Chebyshev.fit(x, y, 3, []) assert_almost_equal(p(x), y) assert_almost_equal(p.domain, [-1, 1]) + # test that fit accepts weights. + w = np.zeros_like(x) + yw = y.copy() + w[1::2] = 1 + yw[0::2] = 0 + p = ch.Chebyshev.fit(x, yw, 3, w=w) + assert_almost_equal(p(x), y) def test_identity(self) : x = np.linspace(0,3) Modified: branches/1.5.x/numpy/polynomial/tests/test_polynomial.py =================================================================== --- branches/1.5.x/numpy/polynomial/tests/test_polynomial.py 2010-07-18 04:01:19 UTC (rev 8499) +++ branches/1.5.x/numpy/polynomial/tests/test_polynomial.py 2010-07-18 04:29:28 UTC (rev 8500) @@ -263,18 +263,33 @@ assert_raises(TypeError, poly.polyfit, [1], [[[1]]], 0) assert_raises(TypeError, poly.polyfit, [1, 2], [1], 0) assert_raises(TypeError, poly.polyfit, [1], [1, 2], 0) + assert_raises(TypeError, poly.polyfit, [1], [1], 0, w=[[1]]) + assert_raises(TypeError, poly.polyfit, [1], [1], 0, w=[1,1]) # Test fit x = np.linspace(0,2) y = f(x) - coef = poly.polyfit(x, y, 3) - assert_equal(len(coef), 4) - assert_almost_equal(poly.polyval(x, coef), y) - coef = poly.polyfit(x, y, 4) - assert_equal(len(coef), 5) - assert_almost_equal(poly.polyval(x, coef), y) - coef2d = poly.polyfit(x, np.array([y,y]).T, 4) - assert_almost_equal(coef2d, np.array([coef,coef]).T) + # + coef3 = poly.polyfit(x, y, 3) + assert_equal(len(coef3), 4) + assert_almost_equal(poly.polyval(x, coef3), y) + # + coef4 = poly.polyfit(x, y, 4) + assert_equal(len(coef4), 5) + assert_almost_equal(poly.polyval(x, coef4), y) + # + coef2d = poly.polyfit(x, np.array([y,y]).T, 3) + assert_almost_equal(coef2d, np.array([coef3,coef3]).T) + # test weighting + w = np.zeros_like(x) + yw = y.copy() + w[1::2] = 1 + yw[0::2] = 0 + wcoef3 = poly.polyfit(x, yw, 3, w=w) + assert_almost_equal(wcoef3, coef3) + # + wcoef2d = poly.polyfit(x, np.array([yw,yw]).T, 3, w=w) + assert_almost_equal(wcoef2d, np.array([coef3,coef3]).T) def test_polytrim(self) : coef = [2, -1, 1, 0] @@ -373,7 +388,7 @@ def test_degree(self) : assert_equal(self.p1.degree(), 2) - def test_cutdeg(self) : + def test_trimdeg(self) : assert_raises(ValueError, self.p1.cutdeg, .5) assert_raises(ValueError, self.p1.cutdeg, -1) assert_equal(len(self.p1.cutdeg(3)), 3) @@ -430,6 +445,13 @@ tgt = [0, .5, 1] assert_almost_equal(res, tgt) + def test_linspace(self): + xdes = np.linspace(0, 1, 20) + ydes = self.p2(xdes) + xres, yres = self.p2.linspace(20) + assert_almost_equal(xres, xdes) + assert_almost_equal(yres, ydes) + def test_fromroots(self) : roots = [0, .5, 1] p = poly.Polynomial.fromroots(roots, domain=[0, 1]) @@ -454,6 +476,13 @@ p = poly.Polynomial.fit(x, y, 3, []) assert_almost_equal(p(x), y) assert_almost_equal(p.domain, [-1, 1]) + # test that fit accepts weights. + w = np.zeros_like(x) + yw = y.copy() + w[1::2] = 1 + yw[0::2] = 0 + p = poly.Polynomial.fit(x, yw, 3, w=w) + assert_almost_equal(p(x), y) def test_identity(self) : x = np.linspace(0,3) From numpy-svn at scipy.org Sun Jul 18 09:24:53 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 18 Jul 2010 08:24:53 -0500 (CDT) Subject: [Numpy-svn] r8501 - trunk/doc Message-ID: <20100718132453.1B85939CBE1@scipy.org> Author: rgommers Date: 2010-07-18 08:24:52 -0500 (Sun, 18 Jul 2010) New Revision: 8501 Modified: trunk/doc/HOWTO_RELEASE.txt Log: DOC: Add "check deprecations" step to HOWTO_RELEASE. Modified: trunk/doc/HOWTO_RELEASE.txt =================================================================== --- trunk/doc/HOWTO_RELEASE.txt 2010-07-18 04:29:28 UTC (rev 8500) +++ trunk/doc/HOWTO_RELEASE.txt 2010-07-18 13:24:52 UTC (rev 8501) @@ -35,7 +35,7 @@ Supported platforms and versions ================================ Python 2.4-2.6 are the currently supported versions on all platforms. -NumPy 2.0 should include support for Python >=3.1. +NumPy 1.5 and 2.0 should include support for Python 2.7 and >=3.1. OS X ---- @@ -194,6 +194,13 @@ .. note:: The following steps are repeated for the beta(s), release candidates(s) and the final release. +Check deprecations +------------------ +Before the release branch is made, it should be checked that all deprecated +code that should be removed is actually removed, and all new deprecations say +in the dostring or deprecation warning at what version the code will be +removed. + Check the release notes ----------------------- Check that the release notes are up-to-date, and mention at least the From numpy-svn at scipy.org Sun Jul 18 10:22:10 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 18 Jul 2010 09:22:10 -0500 (CDT) Subject: [Numpy-svn] r8502 - trunk/tools Message-ID: <20100718142210.ED7F939CBF2@scipy.org> Author: ptvirtan Date: 2010-07-18 09:22:10 -0500 (Sun, 18 Jul 2010) New Revision: 8502 Modified: trunk/tools/py3tool.py Log: ENH: 3K: optionally use lib2to3cache in 2to3 conversion Modified: trunk/tools/py3tool.py =================================================================== --- trunk/tools/py3tool.py 2010-07-18 13:24:52 UTC (rev 8501) +++ trunk/tools/py3tool.py 2010-07-18 14:22:10 UTC (rev 8502) @@ -26,6 +26,9 @@ import subprocess import fnmatch +if os.environ.get('USE_2TO3CACHE'): + import lib2to3cache + BASE = os.path.normpath(os.path.join(os.path.dirname(__file__), '..')) TEMP = os.path.normpath(os.path.join(BASE, '_py3k')) From numpy-svn at scipy.org Sun Jul 18 10:57:31 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 18 Jul 2010 09:57:31 -0500 (CDT) Subject: [Numpy-svn] r8503 - branches/1.5.x/doc Message-ID: <20100718145731.B0E9D39CC03@scipy.org> Author: ptvirtan Date: 2010-07-18 09:57:31 -0500 (Sun, 18 Jul 2010) New Revision: 8503 Modified: branches/1.5.x/doc/HOWTO_RELEASE.txt Log: DOC: Add "check deprecations" step to HOWTO_RELEASE. (cherry picked from commit r8501) Modified: branches/1.5.x/doc/HOWTO_RELEASE.txt =================================================================== --- branches/1.5.x/doc/HOWTO_RELEASE.txt 2010-07-18 14:22:10 UTC (rev 8502) +++ branches/1.5.x/doc/HOWTO_RELEASE.txt 2010-07-18 14:57:31 UTC (rev 8503) @@ -35,7 +35,7 @@ Supported platforms and versions ================================ Python 2.4-2.6 are the currently supported versions on all platforms. -NumPy 2.0 should include support for Python >=3.1. +NumPy 1.5 and 2.0 should include support for Python 2.7 and >=3.1. OS X ---- @@ -194,6 +194,13 @@ .. note:: The following steps are repeated for the beta(s), release candidates(s) and the final release. +Check deprecations +------------------ +Before the release branch is made, it should be checked that all deprecated +code that should be removed is actually removed, and all new deprecations say +in the dostring or deprecation warning at what version the code will be +removed. + Check the release notes ----------------------- Check that the release notes are up-to-date, and mention at least the From numpy-svn at scipy.org Sun Jul 18 10:58:06 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 18 Jul 2010 09:58:06 -0500 (CDT) Subject: [Numpy-svn] r8504 - branches/1.5.x/tools Message-ID: <20100718145806.1B1B539CC03@scipy.org> Author: ptvirtan Date: 2010-07-18 09:58:06 -0500 (Sun, 18 Jul 2010) New Revision: 8504 Modified: branches/1.5.x/tools/py3tool.py Log: ENH: 3K: optionally use lib2to3cache in 2to3 conversion (cherry picked from commit r8502) Modified: branches/1.5.x/tools/py3tool.py =================================================================== --- branches/1.5.x/tools/py3tool.py 2010-07-18 14:57:31 UTC (rev 8503) +++ branches/1.5.x/tools/py3tool.py 2010-07-18 14:58:06 UTC (rev 8504) @@ -26,6 +26,9 @@ import subprocess import fnmatch +if os.environ.get('USE_2TO3CACHE'): + import lib2to3cache + BASE = os.path.normpath(os.path.join(os.path.dirname(__file__), '..')) TEMP = os.path.normpath(os.path.join(BASE, '_py3k')) From numpy-svn at scipy.org Sun Jul 18 12:52:48 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 18 Jul 2010 11:52:48 -0500 (CDT) Subject: [Numpy-svn] r8505 - in trunk/numpy/core: src/multiarray tests Message-ID: <20100718165248.44D5E39CAFF@scipy.org> Author: ptvirtan Date: 2010-07-18 11:52:48 -0500 (Sun, 18 Jul 2010) New Revision: 8505 Modified: trunk/numpy/core/src/multiarray/calculation.c trunk/numpy/core/tests/test_regression.py Log: BUG: core: make .std() and .var() respect the out= keyword (#1434) Modified: trunk/numpy/core/src/multiarray/calculation.c =================================================================== --- trunk/numpy/core/src/multiarray/calculation.c 2010-07-18 14:58:06 UTC (rev 8504) +++ trunk/numpy/core/src/multiarray/calculation.c 2010-07-18 16:52:48 UTC (rev 8505) @@ -393,11 +393,14 @@ ret = PyArray_GenericUnaryFunction((PyAO *)obj1, n_ops.sqrt); Py_DECREF(obj1); } - if (ret == NULL || PyArray_CheckExact(self)) { - return ret; + if (ret == NULL) { + return NULL; } + if (PyArray_CheckExact(self)) { + goto finish; + } if (PyArray_Check(self) && Py_TYPE(self) == Py_TYPE(ret)) { - return ret; + goto finish; } obj1 = PyArray_EnsureArray(ret); if (obj1 == NULL) { @@ -405,6 +408,8 @@ } ret = PyArray_View((PyAO *)obj1, NULL, Py_TYPE(self)); Py_DECREF(obj1); + +finish: if (out) { if (PyArray_CopyAnyInto(out, (PyArrayObject *)ret) < 0) { Py_DECREF(ret); Modified: trunk/numpy/core/tests/test_regression.py =================================================================== --- trunk/numpy/core/tests/test_regression.py 2010-07-18 14:58:06 UTC (rev 8504) +++ trunk/numpy/core/tests/test_regression.py 2010-07-18 16:52:48 UTC (rev 8505) @@ -1325,5 +1325,18 @@ assert_equal(type(getattr(x, name)), np.float32, err_msg=name) + def test_ticket_1434(self): + # Check that the out= argument in var and std has an effect + data = np.array(((1,2,3),(4,5,6),(7,8,9))) + out = np.zeros((3,)) + + ret = data.var(axis=1, out=out) + assert_(ret is out) + assert_array_equal(ret, data.var(axis=1)) + + ret = data.std(axis=1, out=out) + assert_(ret is out) + assert_array_equal(ret, data.std(axis=1)) + if __name__ == "__main__": run_module_suite() From numpy-svn at scipy.org Sun Jul 18 13:17:58 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 18 Jul 2010 12:17:58 -0500 (CDT) Subject: [Numpy-svn] r8506 - in trunk/numpy/core: . tests Message-ID: <20100718171758.3862639CC0C@scipy.org> Author: ptvirtan Date: 2010-07-18 12:17:58 -0500 (Sun, 18 Jul 2010) New Revision: 8506 Added: trunk/numpy/core/tests/test_arrayprint.py Modified: trunk/numpy/core/arrayprint.py Log: BUG: core: format 'nan' and 'inf' also in array repr by default (#1050) Modified: trunk/numpy/core/arrayprint.py =================================================================== --- trunk/numpy/core/arrayprint.py 2010-07-18 16:52:48 UTC (rev 8505) +++ trunk/numpy/core/arrayprint.py 2010-07-18 17:17:58 UTC (rev 8506) @@ -27,8 +27,8 @@ _float_output_precision = 8 _float_output_suppress_small = False _line_width = 75 -_nan_str = 'NaN' -_inf_str = 'Inf' +_nan_str = 'nan' +_inf_str = 'inf' if sys.version_info[0] >= 3: from functools import reduce @@ -59,9 +59,9 @@ Whether or not suppress printing of small floating point values using scientific notation (default False). nanstr : str, optional - String representation of floating point not-a-number (default NaN). + String representation of floating point not-a-number (default nan). infstr : str, optional - String representation of floating point infinity (default Inf). + String representation of floating point infinity (default inf). See Also -------- Added: trunk/numpy/core/tests/test_arrayprint.py =================================================================== --- trunk/numpy/core/tests/test_arrayprint.py (rev 0) +++ trunk/numpy/core/tests/test_arrayprint.py 2010-07-18 17:17:58 UTC (rev 8506) @@ -0,0 +1,10 @@ +import numpy as np +from numpy.testing import * + +class TestArrayRepr(object): + def test_nan_inf(self): + x = np.array([np.nan, np.inf]) + assert_equal(repr(x), 'array([ nan, inf])') + +if __name__ == "__main__": + run_module_suite() From numpy-svn at scipy.org Sun Jul 18 13:50:28 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 18 Jul 2010 12:50:28 -0500 (CDT) Subject: [Numpy-svn] r8507 - in trunk/numpy: . core core/tests Message-ID: <20100718175028.E3D9239CB00@scipy.org> Author: ptvirtan Date: 2010-07-18 12:50:28 -0500 (Sun, 18 Jul 2010) New Revision: 8507 Modified: trunk/numpy/add_newdocs.py trunk/numpy/core/numeric.py trunk/numpy/core/tests/test_numeric.py Log: BUG: core: make set_string_function(None) to restore the functions to what they are on import (#1130) Modified: trunk/numpy/add_newdocs.py =================================================================== --- trunk/numpy/add_newdocs.py 2010-07-18 17:17:58 UTC (rev 8506) +++ trunk/numpy/add_newdocs.py 2010-07-18 17:50:28 UTC (rev 8507) @@ -923,54 +923,8 @@ """ set_string_function(f, repr=1) - Set a Python function to be used when pretty printing arrays. + Internal method to set a function to be used when pretty printing arrays. - Parameters - ---------- - f : function or None - Function to be used to pretty print arrays. The function should expect - a single array argument and return a string of the representation of - the array. If None, the function is reset to the default NumPy function - to print arrays. - repr : bool, optional - If True (default), the function for pretty printing (``__repr__``) - is set, if False the function that returns the default string - representation (``__str__``) is set. - - See Also - -------- - set_printoptions, get_printoptions - - Examples - -------- - >>> def pprint(arr): - ... return 'HA! - What are you going to do now?' - ... - >>> np.set_string_function(pprint) - >>> a = np.arange(10) - >>> a - HA! - What are you going to do now? - >>> print a - [0 1 2 3 4 5 6 7 8 9] - - We can reset the function to the default: - - >>> np.set_string_function(None) - >>> a - array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 'l') - - `repr` affects either pretty printing or normal string representation. - Note that ``__repr__`` is still affected by setting ``__str__`` - because the width of each array element in the returned string becomes - equal to the length of the result of ``__str__()``. - - >>> x = np.arange(4) - >>> np.set_string_function(lambda x:'random', repr=False) - >>> x.__str__() - 'random' - >>> x.__repr__() - 'array([ 0, 1, 2, 3])' - """) add_newdoc('numpy.core.multiarray', 'set_numeric_ops', Modified: trunk/numpy/core/numeric.py =================================================================== --- trunk/numpy/core/numeric.py 2010-07-18 17:17:58 UTC (rev 8506) +++ trunk/numpy/core/numeric.py 2010-07-18 17:50:28 UTC (rev 8507) @@ -1430,7 +1430,65 @@ """ return array2string(a, max_line_width, precision, suppress_small, ' ', "", str) -set_string_function = multiarray.set_string_function +def set_string_function(f, repr=True): + """ + Set a Python function to be used when pretty printing arrays. + + Parameters + ---------- + f : function or None + Function to be used to pretty print arrays. The function should expect + a single array argument and return a string of the representation of + the array. If None, the function is reset to the default NumPy function + to print arrays. + repr : bool, optional + If True (default), the function for pretty printing (``__repr__``) + is set, if False the function that returns the default string + representation (``__str__``) is set. + + See Also + -------- + set_printoptions, get_printoptions + + Examples + -------- + >>> def pprint(arr): + ... return 'HA! - What are you going to do now?' + ... + >>> np.set_string_function(pprint) + >>> a = np.arange(10) + >>> a + HA! - What are you going to do now? + >>> print a + [0 1 2 3 4 5 6 7 8 9] + + We can reset the function to the default: + + >>> np.set_string_function(None) + >>> a + array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) + + `repr` affects either pretty printing or normal string representation. + Note that ``__repr__`` is still affected by setting ``__str__`` + because the width of each array element in the returned string becomes + equal to the length of the result of ``__str__()``. + + >>> x = np.arange(4) + >>> np.set_string_function(lambda x:'random', repr=False) + >>> x.__str__() + 'random' + >>> x.__repr__() + 'array([ 0, 1, 2, 3])' + + """ + if f is None: + if repr: + return multiarray.set_string_function(array_repr, 1) + else: + return multiarray.set_string_function(array_str, 0) + else: + return multiarray.set_string_function(f, repr) + set_string_function(array_str, 0) set_string_function(array_repr, 1) Modified: trunk/numpy/core/tests/test_numeric.py =================================================================== --- trunk/numpy/core/tests/test_numeric.py 2010-07-18 17:17:58 UTC (rev 8506) +++ trunk/numpy/core/tests/test_numeric.py 2010-07-18 17:50:28 UTC (rev 8507) @@ -960,5 +960,18 @@ def test_list(self): assert_equal(np.argwhere([4, 0, 2, 1, 3]), [[0], [2], [3], [4]]) +class TestStringFunction: + def test_set_string_function(self): + a = np.array([1]) + np.set_string_function(lambda x: "FOO", repr=True) + assert_equal(repr(a), "FOO") + np.set_string_function(None, repr=True) + assert_equal(repr(a), "array([1])") + + np.set_string_function(lambda x: "FOO", repr=False) + assert_equal(str(a), "FOO") + np.set_string_function(None, repr=False) + assert_equal(str(a), "[1]") + if __name__ == "__main__": run_module_suite() From numpy-svn at scipy.org Sun Jul 18 16:55:33 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 18 Jul 2010 15:55:33 -0500 (CDT) Subject: [Numpy-svn] r8508 - in trunk/numpy/core: src/umath tests Message-ID: <20100718205533.A408F39CC26@scipy.org> Author: ptvirtan Date: 2010-07-18 15:55:33 -0500 (Sun, 18 Jul 2010) New Revision: 8508 Modified: trunk/numpy/core/src/umath/loops.c.src trunk/numpy/core/tests/test_regression.py trunk/numpy/core/tests/test_umath.py Log: BUG: core/umath: make complex number comparisons False when *either* element is nan This also fixes NaN propagation in np.maximum/minimum, for example in the case for maximum(1, complex(0, nan)) -> (0, nan) which previously yielded (1, 0). Modified: trunk/numpy/core/src/umath/loops.c.src =================================================================== --- trunk/numpy/core/src/umath/loops.c.src 2010-07-18 17:50:28 UTC (rev 8507) +++ trunk/numpy/core/src/umath/loops.c.src 2010-07-18 20:55:33 UTC (rev 8508) @@ -1299,10 +1299,14 @@ ***************************************************************************** */ -#define CGE(xr,xi,yr,yi) (xr > yr || (xr == yr && xi >= yi)) -#define CLE(xr,xi,yr,yi) (xr < yr || (xr == yr && xi <= yi)) -#define CGT(xr,xi,yr,yi) (xr > yr || (xr == yr && xi > yi)) -#define CLT(xr,xi,yr,yi) (xr < yr || (xr == yr && xi < yi)) +#define CGE(xr,xi,yr,yi) ((xr > yr && !npy_isnan(xi) && !npy_isnan(yi)) \ + || (xr == yr && xi >= yi)) +#define CLE(xr,xi,yr,yi) ((xr < yr && !npy_isnan(xi) && !npy_isnan(yi)) \ + || (xr == yr && xi <= yi)) +#define CGT(xr,xi,yr,yi) ((xr > yr && !npy_isnan(xi) && !npy_isnan(yi)) \ + || (xr == yr && xi > yi)) +#define CLT(xr,xi,yr,yi) ((xr < yr && !npy_isnan(xi) && !npy_isnan(yi)) \ + || (xr == yr && xi < yi)) #define CEQ(xr,xi,yr,yi) (xr == yr && xi == yi) #define CNE(xr,xi,yr,yi) (xr != yr || xi != yi) Modified: trunk/numpy/core/tests/test_regression.py =================================================================== --- trunk/numpy/core/tests/test_regression.py 2010-07-18 17:50:28 UTC (rev 8507) +++ trunk/numpy/core/tests/test_regression.py 2010-07-18 20:55:33 UTC (rev 8508) @@ -1338,5 +1338,9 @@ assert_(ret is out) assert_array_equal(ret, data.std(axis=1)) + def test_complex_nan_maximum(self): + cnan = complex(0, np.nan) + assert_equal(np.maximum(1, cnan), cnan) + if __name__ == "__main__": run_module_suite() Modified: trunk/numpy/core/tests/test_umath.py =================================================================== --- trunk/numpy/core/tests/test_umath.py 2010-07-18 17:50:28 UTC (rev 8507) +++ trunk/numpy/core/tests/test_umath.py 2010-07-18 20:55:33 UTC (rev 8508) @@ -378,7 +378,7 @@ def test_complex_nans(self): nan = np.nan - for cnan in [nan, nan*1j, nan + nan*1j] : + for cnan in [complex(nan, 0), complex(0, nan), complex(nan, nan)] : arg1 = np.array([0, cnan, cnan], dtype=np.complex) arg2 = np.array([cnan, 0, cnan], dtype=np.complex) out = np.array([nan, nan, nan], dtype=np.complex) @@ -399,7 +399,7 @@ def test_complex_nans(self): nan = np.nan - for cnan in [nan, nan*1j, nan + nan*1j] : + for cnan in [complex(nan, 0), complex(0, nan), complex(nan, nan)] : arg1 = np.array([0, cnan, cnan], dtype=np.complex) arg2 = np.array([cnan, 0, cnan], dtype=np.complex) out = np.array([nan, nan, nan], dtype=np.complex) @@ -420,7 +420,7 @@ def test_complex_nans(self): nan = np.nan - for cnan in [nan, nan*1j, nan + nan*1j] : + for cnan in [complex(nan, 0), complex(0, nan), complex(nan, nan)] : arg1 = np.array([0, cnan, cnan], dtype=np.complex) arg2 = np.array([cnan, 0, cnan], dtype=np.complex) out = np.array([0, 0, nan], dtype=np.complex) @@ -441,7 +441,7 @@ def test_complex_nans(self): nan = np.nan - for cnan in [nan, nan*1j, nan + nan*1j] : + for cnan in [complex(nan, 0), complex(0, nan), complex(nan, nan)] : arg1 = np.array([0, cnan, cnan], dtype=np.complex) arg2 = np.array([cnan, 0, cnan], dtype=np.complex) out = np.array([0, 0, nan], dtype=np.complex) @@ -1050,5 +1050,24 @@ assert_array_almost_equal(h1, h2) +def test_complex_nan_comparisons(): + nans = [complex(np.nan, 0), complex(0, np.nan), complex(np.nan, np.nan)] + fins = [complex(1, 0), complex(-1, 0), complex(0, 1), complex(0, -1), + complex(1, 1), complex(-1, -1), complex(0, 0)] + + for x in nans + fins: + x = np.array([x]) + for y in nans + fins: + y = np.array([y]) + + if np.isfinite(x) and np.isfinite(y): + continue + + assert_equal(x < y, False, err_msg="%r < %r" % (x, y)) + assert_equal(x > y, False, err_msg="%r > %r" % (x, y)) + assert_equal(x <= y, False, err_msg="%r <= %r" % (x, y)) + assert_equal(x >= y, False, err_msg="%r >= %r" % (x, y)) + assert_equal(x == y, False, err_msg="%r == %r" % (x, y)) + if __name__ == "__main__": run_module_suite() From numpy-svn at scipy.org Sun Jul 18 16:55:56 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 18 Jul 2010 15:55:56 -0500 (CDT) Subject: [Numpy-svn] r8509 - in trunk/numpy/core: src/multiarray tests Message-ID: <20100718205556.51B5C39CC26@scipy.org> Author: ptvirtan Date: 2010-07-18 15:55:56 -0500 (Sun, 18 Jul 2010) New Revision: 8509 Modified: trunk/numpy/core/src/multiarray/arraytypes.c.src trunk/numpy/core/tests/test_multiarray.py Log: BUG: core: fix argmax and argmin NaN handling to conform with max/min (#1429) This makes `argmax` and `argmix` treat NaN as a maximal element. Effectively, this causes propagation of NaNs, which is consistent with the current behavior of amax & amin. Modified: trunk/numpy/core/src/multiarray/arraytypes.c.src =================================================================== --- trunk/numpy/core/src/multiarray/arraytypes.c.src 2010-07-18 20:55:33 UTC (rev 8508) +++ trunk/numpy/core/src/multiarray/arraytypes.c.src 2010-07-18 20:55:56 UTC (rev 8509) @@ -2735,6 +2735,8 @@ * #type = Bool, byte, ubyte, short, ushort, int, uint, long, ulong, * longlong, ulonglong, float, double, longdouble, * float, double, longdouble, datetime, timedelta# + * #isfloat = 0*11, 1*6, 0*2# + * #iscomplex = 0*14, 1*3, 0*2# * #incr = ip++*14, ip+=2*3, ip++*2# */ static int @@ -2742,14 +2744,54 @@ { intp i; @type@ mp = *ip; +#if @iscomplex@ + @type@ mp_im = ip[1]; +#endif *max_ind = 0; + +#if @isfloat@ + if (npy_isnan(mp)) { + /* nan encountered; it's maximal */ + return 0; + } +#endif +#if @iscomplex@ + if (npy_isnan(mp_im)) { + /* nan encountered; it's maximal */ + return 0; + } +#endif + for (i = 1; i < n; i++) { @incr@; - if (*ip > mp) { + /* + * Propagate nans, similarly as max() and min() + */ +#if @iscomplex@ + /* Lexical order for complex numbers */ + if ((ip[0] > mp) || ((ip[0] == mp) && (ip[1] > mp_im)) + || npy_isnan(ip[0]) || npy_isnan(ip[1])) { + mp = ip[0]; + mp_im = ip[1]; + *max_ind = i; + if (npy_isnan(mp) || npy_isnan(mp_im)) { + /* nan encountered, it's maximal */ + break; + } + } +#else + if (!(*ip <= mp)) { /* negated, for correct nan handling */ mp = *ip; *max_ind = i; +#if @isfloat@ + if (npy_isnan(mp)) { + /* nan encountered, it's maximal */ + break; + } +#endif } +#endif } return 0; } Modified: trunk/numpy/core/tests/test_multiarray.py =================================================================== --- trunk/numpy/core/tests/test_multiarray.py 2010-07-18 20:55:33 UTC (rev 8508) +++ trunk/numpy/core/tests/test_multiarray.py 2010-07-18 20:55:56 UTC (rev 8509) @@ -671,6 +671,27 @@ class TestArgmax(TestCase): + + nan_arr = [ + ([0, 1, 2, 3, np.nan], 4), + ([0, 1, 2, np.nan, 3], 3), + ([np.nan, 0, 1, 2, 3], 0), + ([np.nan, 0, np.nan, 2, 3], 0), + ([0, 1, 2, 3, complex(0,np.nan)], 4), + ([0, 1, 2, 3, complex(np.nan,0)], 4), + ([0, 1, 2, complex(np.nan,0), 3], 3), + ([0, 1, 2, complex(0,np.nan), 3], 3), + ([complex(0,np.nan), 0, 1, 2, 3], 0), + ([complex(np.nan, np.nan), 0, 1, 2, 3], 0), + ([complex(np.nan, 0), complex(np.nan, 2), complex(np.nan, 1)], 0), + ([complex(np.nan, np.nan), complex(np.nan, 2), complex(np.nan, 1)], 0), + ([complex(np.nan, 0), complex(np.nan, 2), complex(np.nan, np.nan)], 0), + + ([complex(0, 0), complex(0, 2), complex(0, 1)], 1), + ([complex(1, 0), complex(0, 2), complex(0, 1)], 0), + ([complex(1, 0), complex(0, 2), complex(1, 1)], 2), + ] + def test_all(self): a = np.random.normal(0,1,(4,5,6,7,8)) for i in xrange(a.ndim): @@ -680,6 +701,12 @@ axes.remove(i) assert all(amax == aargmax.choose(*a.transpose(i,*axes))) + def test_combinations(self): + for arr, pos in self.nan_arr: + assert_equal(np.argmax(arr), pos, err_msg="%r"%arr) + assert_equal(arr[np.argmax(arr)], np.max(arr), err_msg="%r"%arr) + + class TestMinMax(TestCase): def test_scalar(self): assert_raises(ValueError, np.amax, 1, 1) From numpy-svn at scipy.org Mon Jul 19 04:49:50 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 19 Jul 2010 03:49:50 -0500 (CDT) Subject: [Numpy-svn] r8510 - in trunk/numpy/core: . src/npymath Message-ID: <20100719084950.35A3D39CD07@scipy.org> Author: cdavid Date: 2010-07-19 03:49:50 -0500 (Mon, 19 Jul 2010) New Revision: 8510 Modified: trunk/numpy/core/setup.py trunk/numpy/core/setup_common.py trunk/numpy/core/src/npymath/npy_math_private.h Log: ENH: fix long double detection for linux ppc This does not fix build on linux ppc, as the implementation for long double functions is missing. Modified: trunk/numpy/core/setup.py =================================================================== --- trunk/numpy/core/setup.py 2010-07-18 20:55:56 UTC (rev 8509) +++ trunk/numpy/core/setup.py 2010-07-19 08:49:50 UTC (rev 8510) @@ -428,7 +428,8 @@ if rep in ['INTEL_EXTENDED_12_BYTES_LE', 'INTEL_EXTENDED_16_BYTES_LE', 'IEEE_QUAD_LE', 'IEEE_QUAD_BE', - 'IEEE_DOUBLE_LE', 'IEEE_DOUBLE_BE']: + 'IEEE_DOUBLE_LE', 'IEEE_DOUBLE_BE', + 'DOUBLE_DOUBLE_BE']: moredefs.append(('HAVE_LDOUBLE_%s' % rep, 1)) else: raise ValueError("Unrecognized long double format: %s" % rep) Modified: trunk/numpy/core/setup_common.py =================================================================== --- trunk/numpy/core/setup_common.py 2010-07-18 20:55:56 UTC (rev 8509) +++ trunk/numpy/core/setup_common.py 2010-07-19 08:49:50 UTC (rev 8510) @@ -219,6 +219,8 @@ _IEEE_QUAD_PREC_BE = ['300', '031', '326', '363', '105', '100', '000', '000', '000', '000', '000', '000', '000', '000', '000', '000'] _IEEE_QUAD_PREC_LE = _IEEE_QUAD_PREC_BE[::-1] +_DOUBLE_DOUBLE_BE = ['301', '235', '157', '064', '124', '000', '000', '000'] + \ + ['000'] * 8 def long_double_representation(lines): """Given a binary dump as given by GNU od -b, look for long double @@ -254,6 +256,8 @@ return 'IEEE_QUAD_BE' elif read[8:-8] == _IEEE_QUAD_PREC_LE: return 'IEEE_QUAD_LE' + elif read[8:-8] == _DOUBLE_DOUBLE_BE: + return 'DOUBLE_DOUBLE_BE' elif read[:16] == _BEFORE_SEQ: if read[16:-8] == _IEEE_DOUBLE_LE: return 'IEEE_DOUBLE_LE' Modified: trunk/numpy/core/src/npymath/npy_math_private.h =================================================================== --- trunk/numpy/core/src/npymath/npy_math_private.h 2010-07-18 20:55:56 UTC (rev 8509) +++ trunk/numpy/core/src/npymath/npy_math_private.h 2010-07-19 08:49:50 UTC (rev 8510) @@ -363,6 +363,7 @@ typedef npy_uint32 ldouble_sign_t; #endif +#ifndef HAVE_LDOUBLE_DOUBLE_DOUBLE_BE /* Get the sign bit of x. x should be of type IEEEl2bitsrep */ #define GET_LDOUBLE_SIGN(x) \ (((x).a[LDBL_SIGN_INDEX] & LDBL_SIGN_MASK) >> LDBL_SIGN_SHIFT) @@ -403,6 +404,8 @@ ((x).a[LDBL_MANH_INDEX] & ~LDBL_MANH_MASK) | \ (((IEEEl2bitsrep_part)(v) << LDBL_MANH_SHIFT) & LDBL_MANH_MASK)) +#endif /* #ifndef HAVE_LDOUBLE_DOUBLE_DOUBLE_BE */ + /* * Those unions are used to convert a pointer of npy_cdouble to native C99 * complex or our own complex type independently on whether C99 complex From numpy-svn at scipy.org Tue Jul 20 04:33:00 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 20 Jul 2010 03:33:00 -0500 (CDT) Subject: [Numpy-svn] r8511 - in trunk/numpy/core/src: npymath private Message-ID: <20100720083300.463C439CD30@scipy.org> Author: cdavid Date: 2010-07-20 03:33:00 -0500 (Tue, 20 Jul 2010) New Revision: 8511 Modified: trunk/numpy/core/src/npymath/ieee754.c.src trunk/numpy/core/src/private/npy_fpmath.h Log: BUG: quick and ugly fix for long double on linux ppc. Modified: trunk/numpy/core/src/npymath/ieee754.c.src =================================================================== --- trunk/numpy/core/src/npymath/ieee754.c.src 2010-07-19 08:49:50 UTC (rev 8510) +++ trunk/numpy/core/src/npymath/ieee754.c.src 2010-07-20 08:33:00 UTC (rev 8511) @@ -126,8 +126,131 @@ return x; } +#ifdef HAVE_LDOUBLE_DOUBLE_DOUBLE_BE + +/* + * FIXME: this is ugly and untested. The asm part only works with gcc, and we + * should consolidate the GET_LDOUBLE* / SET_LDOUBLE macros + */ +#define math_opt_barrier(x) \ + ({ __typeof (x) __x = x; __asm ("" : "+m" (__x)); __x; }) +#define math_force_eval(x) __asm __volatile ("" : : "m" (x)) + +/* only works for big endian */ +typedef union +{ + npy_longdouble value; + struct + { + npy_uint64 msw; + npy_uint64 lsw; + } parts64; + struct + { + npy_uint32 w0, w1, w2, w3; + } parts32; +} ieee854_long_double_shape_type; + +/* Get two 64 bit ints from a long double. */ + +#define GET_LDOUBLE_WORDS64(ix0,ix1,d) \ +do { \ + ieee854_long_double_shape_type qw_u; \ + qw_u.value = (d); \ + (ix0) = qw_u.parts64.msw; \ + (ix1) = qw_u.parts64.lsw; \ +} while (0) + +/* Set a long double from two 64 bit ints. */ + +#define SET_LDOUBLE_WORDS64(d,ix0,ix1) \ +do { \ + ieee854_long_double_shape_type qw_u; \ + qw_u.parts64.msw = (ix0); \ + qw_u.parts64.lsw = (ix1); \ + (d) = qw_u.value; \ +} while (0) + npy_longdouble _nextl(npy_longdouble x, int p) { + npy_int64 hx,ihx,ilx; + npy_uint64 lx; + + GET_LDOUBLE_WORDS64(hx, lx, x); + ihx = hx & 0x7fffffffffffffffLL; /* |hx| */ + ilx = lx & 0x7fffffffffffffffLL; /* |lx| */ + + if(((ihx & 0x7ff0000000000000LL)==0x7ff0000000000000LL)&& + ((ihx & 0x000fffffffffffffLL)!=0)) { + return x; /* signal the nan */ + } + if(ihx == 0 && ilx == 0) { /* x == 0 */ + npy_longdouble u; + SET_LDOUBLE_WORDS64(x, p, 0ULL);/* return +-minsubnormal */ + u = x * x; + if (u == x) { + return u; + } else { + return x; /* raise underflow flag */ + } + } + + npy_longdouble u; + if(p < 0) { /* p < 0, x -= ulp */ + if((hx==0xffefffffffffffffLL)&&(lx==0xfc8ffffffffffffeLL)) + return x+x; /* overflow, return -inf */ + if (hx >= 0x7ff0000000000000LL) { + SET_LDOUBLE_WORDS64(u,0x7fefffffffffffffLL,0x7c8ffffffffffffeLL); + return u; + } + if(ihx <= 0x0360000000000000LL) { /* x <= LDBL_MIN */ + u = math_opt_barrier (x); + x -= __LDBL_DENORM_MIN__; + if (ihx < 0x0360000000000000LL + || (hx > 0 && (npy_int64) lx <= 0) + || (hx < 0 && (npy_int64) lx > 1)) { + u = u * u; + math_force_eval (u); /* raise underflow flag */ + } + return x; + } + if (ihx < 0x06a0000000000000LL) { /* ulp will denormal */ + SET_LDOUBLE_WORDS64(u,(hx&0x7ff0000000000000LL),0ULL); + u *= 0x1.0000000000000p-105L; + } else + SET_LDOUBLE_WORDS64(u,(hx&0x7ff0000000000000LL)-0x0690000000000000LL,0ULL); + return x - u; + } else { /* p >= 0, x += ulp */ + if((hx==0x7fefffffffffffffLL)&&(lx==0x7c8ffffffffffffeLL)) + return x+x; /* overflow, return +inf */ + if ((npy_uint64) hx >= 0xfff0000000000000ULL) { + SET_LDOUBLE_WORDS64(u,0xffefffffffffffffLL,0xfc8ffffffffffffeLL); + return u; + } + if(ihx <= 0x0360000000000000LL) { /* x <= LDBL_MIN */ + u = math_opt_barrier (x); + x += __LDBL_DENORM_MIN__; + if (ihx < 0x0360000000000000LL + || (hx > 0 && (npy_int64) lx < 0 && lx != 0x8000000000000001LL) + || (hx < 0 && (npy_int64) lx >= 0)) { + u = u * u; + math_force_eval (u); /* raise underflow flag */ + } + if (x == 0.0L) /* handle negative __LDBL_DENORM_MIN__ case */ + x = -0.0L; + return x; + } + if (ihx < 0x06a0000000000000LL) { /* ulp will denormal */ + SET_LDOUBLE_WORDS64(u,(hx&0x7ff0000000000000LL),0ULL); + u *= 0x1.0000000000000p-105L; + } else + SET_LDOUBLE_WORDS64(u,(hx&0x7ff0000000000000LL)-0x0690000000000000LL,0ULL); + return x + u; + } +} +#else +npy_longdouble _nextl(npy_longdouble x, int p) +{ volatile npy_longdouble t; union IEEEl2bitsrep ux; @@ -188,6 +311,7 @@ return ux.e; } +#endif /* * nextafter code taken from BSD math lib, the code contains the following Modified: trunk/numpy/core/src/private/npy_fpmath.h =================================================================== --- trunk/numpy/core/src/private/npy_fpmath.h 2010-07-19 08:49:50 UTC (rev 8510) +++ trunk/numpy/core/src/private/npy_fpmath.h 2010-07-20 08:33:00 UTC (rev 8511) @@ -39,7 +39,8 @@ defined(HAVE_LDOUBLE_IEEE_DOUBLE_BE) || \ defined(HAVE_LDOUBLE_IEEE_DOUBLE_16_BYTES_BE) || \ defined(HAVE_LDOUBLE_INTEL_EXTENDED_16_BYTES_LE) || \ - defined(HAVE_LDOUBLE_INTEL_EXTENDED_12_BYTES_LE)) + defined(HAVE_LDOUBLE_INTEL_EXTENDED_12_BYTES_LE) || \ + defined(HAVE_LDOUBLE_DOUBLE_DOUBLE_BE)) #error No long double representation defined #endif From numpy-svn at scipy.org Wed Jul 21 04:33:57 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 21 Jul 2010 03:33:57 -0500 (CDT) Subject: [Numpy-svn] r8512 - trunk/doc/source/reference Message-ID: <20100721083357.6720639CB51@scipy.org> Author: ptvirtan Date: 2010-07-21 03:33:57 -0500 (Wed, 21 Jul 2010) New Revision: 8512 Modified: trunk/doc/source/reference/arrays.interface.rst Log: DOC: update the blurb about the array interface Modified: trunk/doc/source/reference/arrays.interface.rst =================================================================== --- trunk/doc/source/reference/arrays.interface.rst 2010-07-20 08:33:00 UTC (rev 8511) +++ trunk/doc/source/reference/arrays.interface.rst 2010-07-21 08:33:57 UTC (rev 8512) @@ -8,15 +8,15 @@ The Array Interface ******************* -.. warning:: +.. note:: - This page describes the old, deprecated array interface. Everything still - works as described as of numpy 1.2 and on into the foreseeable future, but - new development should target :pep:`3118` -- - :cfunc:`The Revised Buffer Protocol `. - :pep:`3118` was incorporated into Python 2.6 and 3.0, and is additionally - supported by Cython__'s numpy buffer support. (See the `Cython numpy - tutorial`__.) Cython provides a way to write code that supports the buffer + This page describes the numpy-specific API for accessing the contents of + a numpy array from other C extensions. :pep:`3118` -- + :cfunc:`The Revised Buffer Protocol ` introduces + similar, standardized API to Python 2.6 and 3.0 for any extension + module to use. Cython__'s buffer array support + uses the :pep:`3118` API; see the `Cython numpy + tutorial`__. Cython provides a way to write code that supports the buffer protocol with Python versions older than 2.6 because it has a backward-compatible implementation utilizing the legacy array interface described here. From numpy-svn at scipy.org Sat Jul 24 05:36:50 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 24 Jul 2010 04:36:50 -0500 (CDT) Subject: [Numpy-svn] r8513 - trunk Message-ID: <20100724093650.5FA9839CD55@scipy.org> Author: rgommers Date: 2010-07-24 04:36:50 -0500 (Sat, 24 Jul 2010) New Revision: 8513 Modified: trunk/pavement.py Log: ENH: Several changes to Paver script taken from 1.4.x branch. Modified: trunk/pavement.py =================================================================== --- trunk/pavement.py 2010-07-21 08:33:57 UTC (rev 8512) +++ trunk/pavement.py 2010-07-24 09:36:50 UTC (rev 8513) @@ -15,7 +15,7 @@ # remove build dir, and everything generated by previous paver calls # (included generated installers). Use with care ! paver nuke - paver bootstrap && source boostrap/bin/activate + paver bootstrap && source bootstrap/bin/activate # Installing numpy is necessary to build the correct documentation (because # of autodoc) python setupegg.py install @@ -93,7 +93,7 @@ superpack=Bunch(builddir="build-superpack"), installers=Bunch(releasedir="release", installersdir=os.path.join("release", "installers")), - doc=Bunch(doc_root="doc", + doc=Bunch(doc_root="doc", sdir=os.path.join("doc", "source"), bdir=os.path.join("doc", "build"), bdir_latex=os.path.join("doc", "build", "latex"), @@ -117,8 +117,8 @@ if sys.platform =="darwin": WINDOWS_PYTHON = { - "2.6": ["wine", "/Users/david/.wine/drive_c/Python26/python.exe"], - "2.5": ["wine", "/Users/david/.wine/drive_c/Python25/python.exe"] + "2.6": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python26/python.exe"], + "2.5": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python25/python.exe"] } WINDOWS_ENV = os.environ WINDOWS_ENV["DYLD_FALLBACK_LIBRARY_PATH"] = "/usr/X11/lib:/usr/lib" @@ -134,16 +134,16 @@ MAKENSIS = ["makensis"] else: WINDOWS_PYTHON = { - "2.6": ["wine", "/home/david/.wine/drive_c/Python26/python.exe"], - "2.5": ["wine", "/home/david/.wine/drive_c/Python25/python.exe"] + "2.6": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python26/python.exe"], + "2.5": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python25/python.exe"] } WINDOWS_ENV = os.environ MAKENSIS = ["wine", "makensis"] # Start/end of the log (from git) -LOG_START = 'svn/tags/1.3.0' +LOG_START = 'svn/tags/1.4.0' LOG_END = 'master' -RELEASE_NOTES = 'doc/release/1.4.0-notes.rst' +RELEASE_NOTES = 'doc/release/1.5.0-notes.rst' #------------------- # Windows installers @@ -208,7 +208,7 @@ copy_bdist("sse2") bdist_wininst_arch(pyver, 'sse3') copy_bdist("sse3") - + idirs = options.installers.installersdir pyver = options.python_version prepare_nsis_script(pyver, FULLVERSION) @@ -275,8 +275,8 @@ options.virtualenv.script_name = os.path.join(options.bootstrap_dir, bscript) - options.virtualenv.no_site_packages = True - options.bootstrap.no_site_packages = True + options.virtualenv.no_site_packages = False + options.bootstrap.no_site_packages = False call_task('paver.virtual.bootstrap') sh('cd %s; %s %s' % (bdir, sys.executable, bscript)) From numpy-svn at scipy.org Sat Jul 24 05:39:13 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 24 Jul 2010 04:39:13 -0500 (CDT) Subject: [Numpy-svn] r8514 - branches/1.5.x Message-ID: <20100724093913.54CA139CDD1@scipy.org> Author: rgommers Date: 2010-07-24 04:39:13 -0500 (Sat, 24 Jul 2010) New Revision: 8514 Modified: branches/1.5.x/pavement.py Log: ENH: Several changes to Paver script taken from 1.4.x branch. Backport of r8513. Modified: branches/1.5.x/pavement.py =================================================================== --- branches/1.5.x/pavement.py 2010-07-24 09:36:50 UTC (rev 8513) +++ branches/1.5.x/pavement.py 2010-07-24 09:39:13 UTC (rev 8514) @@ -15,7 +15,7 @@ # remove build dir, and everything generated by previous paver calls # (included generated installers). Use with care ! paver nuke - paver bootstrap && source boostrap/bin/activate + paver bootstrap && source bootstrap/bin/activate # Installing numpy is necessary to build the correct documentation (because # of autodoc) python setupegg.py install @@ -93,7 +93,7 @@ superpack=Bunch(builddir="build-superpack"), installers=Bunch(releasedir="release", installersdir=os.path.join("release", "installers")), - doc=Bunch(doc_root="doc", + doc=Bunch(doc_root="doc", sdir=os.path.join("doc", "source"), bdir=os.path.join("doc", "build"), bdir_latex=os.path.join("doc", "build", "latex"), @@ -117,8 +117,8 @@ if sys.platform =="darwin": WINDOWS_PYTHON = { - "2.6": ["wine", "/Users/david/.wine/drive_c/Python26/python.exe"], - "2.5": ["wine", "/Users/david/.wine/drive_c/Python25/python.exe"] + "2.6": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python26/python.exe"], + "2.5": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python25/python.exe"] } WINDOWS_ENV = os.environ WINDOWS_ENV["DYLD_FALLBACK_LIBRARY_PATH"] = "/usr/X11/lib:/usr/lib" @@ -134,16 +134,16 @@ MAKENSIS = ["makensis"] else: WINDOWS_PYTHON = { - "2.6": ["wine", "/home/david/.wine/drive_c/Python26/python.exe"], - "2.5": ["wine", "/home/david/.wine/drive_c/Python25/python.exe"] + "2.6": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python26/python.exe"], + "2.5": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python25/python.exe"] } WINDOWS_ENV = os.environ MAKENSIS = ["wine", "makensis"] # Start/end of the log (from git) -LOG_START = 'svn/tags/1.3.0' +LOG_START = 'svn/tags/1.4.0' LOG_END = 'master' -RELEASE_NOTES = 'doc/release/1.4.0-notes.rst' +RELEASE_NOTES = 'doc/release/1.5.0-notes.rst' #------------------- # Windows installers @@ -208,7 +208,7 @@ copy_bdist("sse2") bdist_wininst_arch(pyver, 'sse3') copy_bdist("sse3") - + idirs = options.installers.installersdir pyver = options.python_version prepare_nsis_script(pyver, FULLVERSION) @@ -275,8 +275,8 @@ options.virtualenv.script_name = os.path.join(options.bootstrap_dir, bscript) - options.virtualenv.no_site_packages = True - options.bootstrap.no_site_packages = True + options.virtualenv.no_site_packages = False + options.bootstrap.no_site_packages = False call_task('paver.virtual.bootstrap') sh('cd %s; %s %s' % (bdir, sys.executable, bscript)) From numpy-svn at scipy.org Sat Jul 24 06:40:54 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 24 Jul 2010 05:40:54 -0500 (CDT) Subject: [Numpy-svn] r8515 - in branches/1.5.x/numpy/core: src/multiarray tests Message-ID: <20100724104054.CE82D39CDBF@scipy.org> Author: ptvirtan Date: 2010-07-24 05:40:54 -0500 (Sat, 24 Jul 2010) New Revision: 8515 Modified: branches/1.5.x/numpy/core/src/multiarray/calculation.c branches/1.5.x/numpy/core/tests/test_regression.py Log: BUG: core: make .std() and .var() respect the out= keyword (#1434) (cherry picked from commit r8505) Modified: branches/1.5.x/numpy/core/src/multiarray/calculation.c =================================================================== --- branches/1.5.x/numpy/core/src/multiarray/calculation.c 2010-07-24 09:39:13 UTC (rev 8514) +++ branches/1.5.x/numpy/core/src/multiarray/calculation.c 2010-07-24 10:40:54 UTC (rev 8515) @@ -393,11 +393,14 @@ ret = PyArray_GenericUnaryFunction((PyAO *)obj1, n_ops.sqrt); Py_DECREF(obj1); } - if (ret == NULL || PyArray_CheckExact(self)) { - return ret; + if (ret == NULL) { + return NULL; } + if (PyArray_CheckExact(self)) { + goto finish; + } if (PyArray_Check(self) && Py_TYPE(self) == Py_TYPE(ret)) { - return ret; + goto finish; } obj1 = PyArray_EnsureArray(ret); if (obj1 == NULL) { @@ -405,6 +408,8 @@ } ret = PyArray_View((PyAO *)obj1, NULL, Py_TYPE(self)); Py_DECREF(obj1); + +finish: if (out) { if (PyArray_CopyAnyInto(out, (PyArrayObject *)ret) < 0) { Py_DECREF(ret); Modified: branches/1.5.x/numpy/core/tests/test_regression.py =================================================================== --- branches/1.5.x/numpy/core/tests/test_regression.py 2010-07-24 09:39:13 UTC (rev 8514) +++ branches/1.5.x/numpy/core/tests/test_regression.py 2010-07-24 10:40:54 UTC (rev 8515) @@ -1324,5 +1324,18 @@ assert_equal(type(getattr(x, name)), np.float32, err_msg=name) + def test_ticket_1434(self): + # Check that the out= argument in var and std has an effect + data = np.array(((1,2,3),(4,5,6),(7,8,9))) + out = np.zeros((3,)) + + ret = data.var(axis=1, out=out) + assert_(ret is out) + assert_array_equal(ret, data.var(axis=1)) + + ret = data.std(axis=1, out=out) + assert_(ret is out) + assert_array_equal(ret, data.std(axis=1)) + if __name__ == "__main__": run_module_suite() From numpy-svn at scipy.org Sat Jul 24 06:41:15 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 24 Jul 2010 05:41:15 -0500 (CDT) Subject: [Numpy-svn] r8516 - in branches/1.5.x/numpy/core: . tests Message-ID: <20100724104115.68E6339CDDE@scipy.org> Author: ptvirtan Date: 2010-07-24 05:41:15 -0500 (Sat, 24 Jul 2010) New Revision: 8516 Added: branches/1.5.x/numpy/core/tests/test_arrayprint.py Modified: branches/1.5.x/numpy/core/arrayprint.py Log: BUG: core: format 'nan' and 'inf' also in array repr by default (#1050) (cherry picked from commit r8506) Modified: branches/1.5.x/numpy/core/arrayprint.py =================================================================== --- branches/1.5.x/numpy/core/arrayprint.py 2010-07-24 10:40:54 UTC (rev 8515) +++ branches/1.5.x/numpy/core/arrayprint.py 2010-07-24 10:41:15 UTC (rev 8516) @@ -27,8 +27,8 @@ _float_output_precision = 8 _float_output_suppress_small = False _line_width = 75 -_nan_str = 'NaN' -_inf_str = 'Inf' +_nan_str = 'nan' +_inf_str = 'inf' if sys.version_info[0] >= 3: from functools import reduce @@ -59,9 +59,9 @@ Whether or not suppress printing of small floating point values using scientific notation (default False). nanstr : str, optional - String representation of floating point not-a-number (default NaN). + String representation of floating point not-a-number (default nan). infstr : str, optional - String representation of floating point infinity (default Inf). + String representation of floating point infinity (default inf). See Also -------- Added: branches/1.5.x/numpy/core/tests/test_arrayprint.py =================================================================== --- branches/1.5.x/numpy/core/tests/test_arrayprint.py (rev 0) +++ branches/1.5.x/numpy/core/tests/test_arrayprint.py 2010-07-24 10:41:15 UTC (rev 8516) @@ -0,0 +1,10 @@ +import numpy as np +from numpy.testing import * + +class TestArrayRepr(object): + def test_nan_inf(self): + x = np.array([np.nan, np.inf]) + assert_equal(repr(x), 'array([ nan, inf])') + +if __name__ == "__main__": + run_module_suite() From numpy-svn at scipy.org Sat Jul 24 06:41:35 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 24 Jul 2010 05:41:35 -0500 (CDT) Subject: [Numpy-svn] r8517 - in branches/1.5.x/numpy: . core core/tests Message-ID: <20100724104135.B9B1C39CDEE@scipy.org> Author: ptvirtan Date: 2010-07-24 05:41:35 -0500 (Sat, 24 Jul 2010) New Revision: 8517 Modified: branches/1.5.x/numpy/add_newdocs.py branches/1.5.x/numpy/core/numeric.py branches/1.5.x/numpy/core/tests/test_numeric.py Log: BUG: core: make set_string_function(None) to restore the functions to what they are on import (#1130) (cherry picked from commit r8507) Modified: branches/1.5.x/numpy/add_newdocs.py =================================================================== --- branches/1.5.x/numpy/add_newdocs.py 2010-07-24 10:41:15 UTC (rev 8516) +++ branches/1.5.x/numpy/add_newdocs.py 2010-07-24 10:41:35 UTC (rev 8517) @@ -923,54 +923,8 @@ """ set_string_function(f, repr=1) - Set a Python function to be used when pretty printing arrays. + Internal method to set a function to be used when pretty printing arrays. - Parameters - ---------- - f : function or None - Function to be used to pretty print arrays. The function should expect - a single array argument and return a string of the representation of - the array. If None, the function is reset to the default NumPy function - to print arrays. - repr : bool, optional - If True (default), the function for pretty printing (``__repr__``) - is set, if False the function that returns the default string - representation (``__str__``) is set. - - See Also - -------- - set_printoptions, get_printoptions - - Examples - -------- - >>> def pprint(arr): - ... return 'HA! - What are you going to do now?' - ... - >>> np.set_string_function(pprint) - >>> a = np.arange(10) - >>> a - HA! - What are you going to do now? - >>> print a - [0 1 2 3 4 5 6 7 8 9] - - We can reset the function to the default: - - >>> np.set_string_function(None) - >>> a - array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 'l') - - `repr` affects either pretty printing or normal string representation. - Note that ``__repr__`` is still affected by setting ``__str__`` - because the width of each array element in the returned string becomes - equal to the length of the result of ``__str__()``. - - >>> x = np.arange(4) - >>> np.set_string_function(lambda x:'random', repr=False) - >>> x.__str__() - 'random' - >>> x.__repr__() - 'array([ 0, 1, 2, 3])' - """) add_newdoc('numpy.core.multiarray', 'set_numeric_ops', Modified: branches/1.5.x/numpy/core/numeric.py =================================================================== --- branches/1.5.x/numpy/core/numeric.py 2010-07-24 10:41:15 UTC (rev 8516) +++ branches/1.5.x/numpy/core/numeric.py 2010-07-24 10:41:35 UTC (rev 8517) @@ -1430,7 +1430,65 @@ """ return array2string(a, max_line_width, precision, suppress_small, ' ', "", str) -set_string_function = multiarray.set_string_function +def set_string_function(f, repr=True): + """ + Set a Python function to be used when pretty printing arrays. + + Parameters + ---------- + f : function or None + Function to be used to pretty print arrays. The function should expect + a single array argument and return a string of the representation of + the array. If None, the function is reset to the default NumPy function + to print arrays. + repr : bool, optional + If True (default), the function for pretty printing (``__repr__``) + is set, if False the function that returns the default string + representation (``__str__``) is set. + + See Also + -------- + set_printoptions, get_printoptions + + Examples + -------- + >>> def pprint(arr): + ... return 'HA! - What are you going to do now?' + ... + >>> np.set_string_function(pprint) + >>> a = np.arange(10) + >>> a + HA! - What are you going to do now? + >>> print a + [0 1 2 3 4 5 6 7 8 9] + + We can reset the function to the default: + + >>> np.set_string_function(None) + >>> a + array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) + + `repr` affects either pretty printing or normal string representation. + Note that ``__repr__`` is still affected by setting ``__str__`` + because the width of each array element in the returned string becomes + equal to the length of the result of ``__str__()``. + + >>> x = np.arange(4) + >>> np.set_string_function(lambda x:'random', repr=False) + >>> x.__str__() + 'random' + >>> x.__repr__() + 'array([ 0, 1, 2, 3])' + + """ + if f is None: + if repr: + return multiarray.set_string_function(array_repr, 1) + else: + return multiarray.set_string_function(array_str, 0) + else: + return multiarray.set_string_function(f, repr) + set_string_function(array_str, 0) set_string_function(array_repr, 1) Modified: branches/1.5.x/numpy/core/tests/test_numeric.py =================================================================== --- branches/1.5.x/numpy/core/tests/test_numeric.py 2010-07-24 10:41:15 UTC (rev 8516) +++ branches/1.5.x/numpy/core/tests/test_numeric.py 2010-07-24 10:41:35 UTC (rev 8517) @@ -960,5 +960,18 @@ def test_list(self): assert_equal(np.argwhere([4, 0, 2, 1, 3]), [[0], [2], [3], [4]]) +class TestStringFunction: + def test_set_string_function(self): + a = np.array([1]) + np.set_string_function(lambda x: "FOO", repr=True) + assert_equal(repr(a), "FOO") + np.set_string_function(None, repr=True) + assert_equal(repr(a), "array([1])") + + np.set_string_function(lambda x: "FOO", repr=False) + assert_equal(str(a), "FOO") + np.set_string_function(None, repr=False) + assert_equal(str(a), "[1]") + if __name__ == "__main__": run_module_suite() From numpy-svn at scipy.org Sat Jul 24 06:41:57 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 24 Jul 2010 05:41:57 -0500 (CDT) Subject: [Numpy-svn] r8518 - in branches/1.5.x/numpy/core: src/umath tests Message-ID: <20100724104157.8AD1F39CDEF@scipy.org> Author: ptvirtan Date: 2010-07-24 05:41:57 -0500 (Sat, 24 Jul 2010) New Revision: 8518 Modified: branches/1.5.x/numpy/core/src/umath/loops.c.src branches/1.5.x/numpy/core/tests/test_regression.py branches/1.5.x/numpy/core/tests/test_umath.py Log: BUG: core/umath: make complex number comparisons False when *either* element is nan This also fixes NaN propagation in np.maximum/minimum, for example in the case for maximum(1, complex(0, nan)) -> (0, nan) which previously yielded (1, 0). (cherry picked from commit r8508) Modified: branches/1.5.x/numpy/core/src/umath/loops.c.src =================================================================== --- branches/1.5.x/numpy/core/src/umath/loops.c.src 2010-07-24 10:41:35 UTC (rev 8517) +++ branches/1.5.x/numpy/core/src/umath/loops.c.src 2010-07-24 10:41:57 UTC (rev 8518) @@ -1136,10 +1136,14 @@ ***************************************************************************** */ -#define CGE(xr,xi,yr,yi) (xr > yr || (xr == yr && xi >= yi)) -#define CLE(xr,xi,yr,yi) (xr < yr || (xr == yr && xi <= yi)) -#define CGT(xr,xi,yr,yi) (xr > yr || (xr == yr && xi > yi)) -#define CLT(xr,xi,yr,yi) (xr < yr || (xr == yr && xi < yi)) +#define CGE(xr,xi,yr,yi) ((xr > yr && !npy_isnan(xi) && !npy_isnan(yi)) \ + || (xr == yr && xi >= yi)) +#define CLE(xr,xi,yr,yi) ((xr < yr && !npy_isnan(xi) && !npy_isnan(yi)) \ + || (xr == yr && xi <= yi)) +#define CGT(xr,xi,yr,yi) ((xr > yr && !npy_isnan(xi) && !npy_isnan(yi)) \ + || (xr == yr && xi > yi)) +#define CLT(xr,xi,yr,yi) ((xr < yr && !npy_isnan(xi) && !npy_isnan(yi)) \ + || (xr == yr && xi < yi)) #define CEQ(xr,xi,yr,yi) (xr == yr && xi == yi) #define CNE(xr,xi,yr,yi) (xr != yr || xi != yi) Modified: branches/1.5.x/numpy/core/tests/test_regression.py =================================================================== --- branches/1.5.x/numpy/core/tests/test_regression.py 2010-07-24 10:41:35 UTC (rev 8517) +++ branches/1.5.x/numpy/core/tests/test_regression.py 2010-07-24 10:41:57 UTC (rev 8518) @@ -1337,5 +1337,9 @@ assert_(ret is out) assert_array_equal(ret, data.std(axis=1)) + def test_complex_nan_maximum(self): + cnan = complex(0, np.nan) + assert_equal(np.maximum(1, cnan), cnan) + if __name__ == "__main__": run_module_suite() Modified: branches/1.5.x/numpy/core/tests/test_umath.py =================================================================== --- branches/1.5.x/numpy/core/tests/test_umath.py 2010-07-24 10:41:35 UTC (rev 8517) +++ branches/1.5.x/numpy/core/tests/test_umath.py 2010-07-24 10:41:57 UTC (rev 8518) @@ -378,7 +378,7 @@ def test_complex_nans(self): nan = np.nan - for cnan in [nan, nan*1j, nan + nan*1j] : + for cnan in [complex(nan, 0), complex(0, nan), complex(nan, nan)] : arg1 = np.array([0, cnan, cnan], dtype=np.complex) arg2 = np.array([cnan, 0, cnan], dtype=np.complex) out = np.array([nan, nan, nan], dtype=np.complex) @@ -399,7 +399,7 @@ def test_complex_nans(self): nan = np.nan - for cnan in [nan, nan*1j, nan + nan*1j] : + for cnan in [complex(nan, 0), complex(0, nan), complex(nan, nan)] : arg1 = np.array([0, cnan, cnan], dtype=np.complex) arg2 = np.array([cnan, 0, cnan], dtype=np.complex) out = np.array([nan, nan, nan], dtype=np.complex) @@ -420,7 +420,7 @@ def test_complex_nans(self): nan = np.nan - for cnan in [nan, nan*1j, nan + nan*1j] : + for cnan in [complex(nan, 0), complex(0, nan), complex(nan, nan)] : arg1 = np.array([0, cnan, cnan], dtype=np.complex) arg2 = np.array([cnan, 0, cnan], dtype=np.complex) out = np.array([0, 0, nan], dtype=np.complex) @@ -441,7 +441,7 @@ def test_complex_nans(self): nan = np.nan - for cnan in [nan, nan*1j, nan + nan*1j] : + for cnan in [complex(nan, 0), complex(0, nan), complex(nan, nan)] : arg1 = np.array([0, cnan, cnan], dtype=np.complex) arg2 = np.array([cnan, 0, cnan], dtype=np.complex) out = np.array([0, 0, nan], dtype=np.complex) @@ -1050,5 +1050,24 @@ assert_array_almost_equal(h1, h2) +def test_complex_nan_comparisons(): + nans = [complex(np.nan, 0), complex(0, np.nan), complex(np.nan, np.nan)] + fins = [complex(1, 0), complex(-1, 0), complex(0, 1), complex(0, -1), + complex(1, 1), complex(-1, -1), complex(0, 0)] + + for x in nans + fins: + x = np.array([x]) + for y in nans + fins: + y = np.array([y]) + + if np.isfinite(x) and np.isfinite(y): + continue + + assert_equal(x < y, False, err_msg="%r < %r" % (x, y)) + assert_equal(x > y, False, err_msg="%r > %r" % (x, y)) + assert_equal(x <= y, False, err_msg="%r <= %r" % (x, y)) + assert_equal(x >= y, False, err_msg="%r >= %r" % (x, y)) + assert_equal(x == y, False, err_msg="%r == %r" % (x, y)) + if __name__ == "__main__": run_module_suite() From numpy-svn at scipy.org Sat Jul 24 06:42:20 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 24 Jul 2010 05:42:20 -0500 (CDT) Subject: [Numpy-svn] r8519 - in branches/1.5.x/numpy/core: src/multiarray tests Message-ID: <20100724104220.0E0AF39CDF1@scipy.org> Author: ptvirtan Date: 2010-07-24 05:42:19 -0500 (Sat, 24 Jul 2010) New Revision: 8519 Modified: branches/1.5.x/numpy/core/src/multiarray/arraytypes.c.src branches/1.5.x/numpy/core/tests/test_multiarray.py Log: BUG: core: fix argmax and argmin NaN handling to conform with max/min (#1429) This makes `argmax` and `argmix` treat NaN as a maximal element. Effectively, this causes propagation of NaNs, which is consistent with the current behavior of amax & amin. (cherry picked from commit r8509) Modified: branches/1.5.x/numpy/core/src/multiarray/arraytypes.c.src =================================================================== --- branches/1.5.x/numpy/core/src/multiarray/arraytypes.c.src 2010-07-24 10:41:57 UTC (rev 8518) +++ branches/1.5.x/numpy/core/src/multiarray/arraytypes.c.src 2010-07-24 10:42:19 UTC (rev 8519) @@ -2260,6 +2260,8 @@ * #type = Bool, byte, ubyte, short, ushort, int, uint, long, ulong, * longlong, ulonglong, float, double, longdouble, * float, double, longdouble# + * #isfloat = 0*11, 1*6# + * #iscomplex = 0*14, 1*3# * #incr= ip++*14, ip+=2*3# */ static int @@ -2267,14 +2269,54 @@ { intp i; @type@ mp = *ip; +#if @iscomplex@ + @type@ mp_im = ip[1]; +#endif *max_ind = 0; + +#if @isfloat@ + if (npy_isnan(mp)) { + /* nan encountered; it's maximal */ + return 0; + } +#endif +#if @iscomplex@ + if (npy_isnan(mp_im)) { + /* nan encountered; it's maximal */ + return 0; + } +#endif + for (i = 1; i < n; i++) { @incr@; - if (*ip > mp) { + /* + * Propagate nans, similarly as max() and min() + */ +#if @iscomplex@ + /* Lexical order for complex numbers */ + if ((ip[0] > mp) || ((ip[0] == mp) && (ip[1] > mp_im)) + || npy_isnan(ip[0]) || npy_isnan(ip[1])) { + mp = ip[0]; + mp_im = ip[1]; + *max_ind = i; + if (npy_isnan(mp) || npy_isnan(mp_im)) { + /* nan encountered, it's maximal */ + break; + } + } +#else + if (!(*ip <= mp)) { /* negated, for correct nan handling */ mp = *ip; *max_ind = i; +#if @isfloat@ + if (npy_isnan(mp)) { + /* nan encountered, it's maximal */ + break; + } +#endif } +#endif } return 0; } Modified: branches/1.5.x/numpy/core/tests/test_multiarray.py =================================================================== --- branches/1.5.x/numpy/core/tests/test_multiarray.py 2010-07-24 10:41:57 UTC (rev 8518) +++ branches/1.5.x/numpy/core/tests/test_multiarray.py 2010-07-24 10:42:19 UTC (rev 8519) @@ -671,6 +671,27 @@ class TestArgmax(TestCase): + + nan_arr = [ + ([0, 1, 2, 3, np.nan], 4), + ([0, 1, 2, np.nan, 3], 3), + ([np.nan, 0, 1, 2, 3], 0), + ([np.nan, 0, np.nan, 2, 3], 0), + ([0, 1, 2, 3, complex(0,np.nan)], 4), + ([0, 1, 2, 3, complex(np.nan,0)], 4), + ([0, 1, 2, complex(np.nan,0), 3], 3), + ([0, 1, 2, complex(0,np.nan), 3], 3), + ([complex(0,np.nan), 0, 1, 2, 3], 0), + ([complex(np.nan, np.nan), 0, 1, 2, 3], 0), + ([complex(np.nan, 0), complex(np.nan, 2), complex(np.nan, 1)], 0), + ([complex(np.nan, np.nan), complex(np.nan, 2), complex(np.nan, 1)], 0), + ([complex(np.nan, 0), complex(np.nan, 2), complex(np.nan, np.nan)], 0), + + ([complex(0, 0), complex(0, 2), complex(0, 1)], 1), + ([complex(1, 0), complex(0, 2), complex(0, 1)], 0), + ([complex(1, 0), complex(0, 2), complex(1, 1)], 2), + ] + def test_all(self): a = np.random.normal(0,1,(4,5,6,7,8)) for i in xrange(a.ndim): @@ -680,6 +701,12 @@ axes.remove(i) assert all(amax == aargmax.choose(*a.transpose(i,*axes))) + def test_combinations(self): + for arr, pos in self.nan_arr: + assert_equal(np.argmax(arr), pos, err_msg="%r"%arr) + assert_equal(arr[np.argmax(arr)], np.max(arr), err_msg="%r"%arr) + + class TestMinMax(TestCase): def test_scalar(self): assert_raises(ValueError, np.amax, 1, 1) From numpy-svn at scipy.org Sat Jul 24 06:42:41 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 24 Jul 2010 05:42:41 -0500 (CDT) Subject: [Numpy-svn] r8520 - in branches/1.5.x/numpy/core: . src/npymath Message-ID: <20100724104241.52CDC39CDF2@scipy.org> Author: ptvirtan Date: 2010-07-24 05:42:41 -0500 (Sat, 24 Jul 2010) New Revision: 8520 Modified: branches/1.5.x/numpy/core/setup.py branches/1.5.x/numpy/core/setup_common.py branches/1.5.x/numpy/core/src/npymath/npy_math_private.h Log: ENH: fix long double detection for linux ppc This does not fix build on linux ppc, as the implementation for long double functions is missing. (cherry picked from commit r8510) Modified: branches/1.5.x/numpy/core/setup.py =================================================================== --- branches/1.5.x/numpy/core/setup.py 2010-07-24 10:42:19 UTC (rev 8519) +++ branches/1.5.x/numpy/core/setup.py 2010-07-24 10:42:41 UTC (rev 8520) @@ -428,7 +428,8 @@ if rep in ['INTEL_EXTENDED_12_BYTES_LE', 'INTEL_EXTENDED_16_BYTES_LE', 'IEEE_QUAD_LE', 'IEEE_QUAD_BE', - 'IEEE_DOUBLE_LE', 'IEEE_DOUBLE_BE']: + 'IEEE_DOUBLE_LE', 'IEEE_DOUBLE_BE', + 'DOUBLE_DOUBLE_BE']: moredefs.append(('HAVE_LDOUBLE_%s' % rep, 1)) else: raise ValueError("Unrecognized long double format: %s" % rep) Modified: branches/1.5.x/numpy/core/setup_common.py =================================================================== --- branches/1.5.x/numpy/core/setup_common.py 2010-07-24 10:42:19 UTC (rev 8519) +++ branches/1.5.x/numpy/core/setup_common.py 2010-07-24 10:42:41 UTC (rev 8520) @@ -219,6 +219,8 @@ _IEEE_QUAD_PREC_BE = ['300', '031', '326', '363', '105', '100', '000', '000', '000', '000', '000', '000', '000', '000', '000', '000'] _IEEE_QUAD_PREC_LE = _IEEE_QUAD_PREC_BE[::-1] +_DOUBLE_DOUBLE_BE = ['301', '235', '157', '064', '124', '000', '000', '000'] + \ + ['000'] * 8 def long_double_representation(lines): """Given a binary dump as given by GNU od -b, look for long double @@ -254,6 +256,8 @@ return 'IEEE_QUAD_BE' elif read[8:-8] == _IEEE_QUAD_PREC_LE: return 'IEEE_QUAD_LE' + elif read[8:-8] == _DOUBLE_DOUBLE_BE: + return 'DOUBLE_DOUBLE_BE' elif read[:16] == _BEFORE_SEQ: if read[16:-8] == _IEEE_DOUBLE_LE: return 'IEEE_DOUBLE_LE' Modified: branches/1.5.x/numpy/core/src/npymath/npy_math_private.h =================================================================== --- branches/1.5.x/numpy/core/src/npymath/npy_math_private.h 2010-07-24 10:42:19 UTC (rev 8519) +++ branches/1.5.x/numpy/core/src/npymath/npy_math_private.h 2010-07-24 10:42:41 UTC (rev 8520) @@ -363,6 +363,7 @@ typedef npy_uint32 ldouble_sign_t; #endif +#ifndef HAVE_LDOUBLE_DOUBLE_DOUBLE_BE /* Get the sign bit of x. x should be of type IEEEl2bitsrep */ #define GET_LDOUBLE_SIGN(x) \ (((x).a[LDBL_SIGN_INDEX] & LDBL_SIGN_MASK) >> LDBL_SIGN_SHIFT) @@ -403,6 +404,8 @@ ((x).a[LDBL_MANH_INDEX] & ~LDBL_MANH_MASK) | \ (((IEEEl2bitsrep_part)(v) << LDBL_MANH_SHIFT) & LDBL_MANH_MASK)) +#endif /* #ifndef HAVE_LDOUBLE_DOUBLE_DOUBLE_BE */ + /* * Those unions are used to convert a pointer of npy_cdouble to native C99 * complex or our own complex type independently on whether C99 complex From numpy-svn at scipy.org Sat Jul 24 06:43:02 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 24 Jul 2010 05:43:02 -0500 (CDT) Subject: [Numpy-svn] r8521 - in branches/1.5.x/numpy/core/src: npymath private Message-ID: <20100724104302.CEAB839CDF3@scipy.org> Author: ptvirtan Date: 2010-07-24 05:43:02 -0500 (Sat, 24 Jul 2010) New Revision: 8521 Modified: branches/1.5.x/numpy/core/src/npymath/ieee754.c.src branches/1.5.x/numpy/core/src/private/npy_fpmath.h Log: BUG: quick and ugly fix for long double on linux ppc. (cherry picked from commit r8511) Modified: branches/1.5.x/numpy/core/src/npymath/ieee754.c.src =================================================================== --- branches/1.5.x/numpy/core/src/npymath/ieee754.c.src 2010-07-24 10:42:41 UTC (rev 8520) +++ branches/1.5.x/numpy/core/src/npymath/ieee754.c.src 2010-07-24 10:43:02 UTC (rev 8521) @@ -126,8 +126,131 @@ return x; } +#ifdef HAVE_LDOUBLE_DOUBLE_DOUBLE_BE + +/* + * FIXME: this is ugly and untested. The asm part only works with gcc, and we + * should consolidate the GET_LDOUBLE* / SET_LDOUBLE macros + */ +#define math_opt_barrier(x) \ + ({ __typeof (x) __x = x; __asm ("" : "+m" (__x)); __x; }) +#define math_force_eval(x) __asm __volatile ("" : : "m" (x)) + +/* only works for big endian */ +typedef union +{ + npy_longdouble value; + struct + { + npy_uint64 msw; + npy_uint64 lsw; + } parts64; + struct + { + npy_uint32 w0, w1, w2, w3; + } parts32; +} ieee854_long_double_shape_type; + +/* Get two 64 bit ints from a long double. */ + +#define GET_LDOUBLE_WORDS64(ix0,ix1,d) \ +do { \ + ieee854_long_double_shape_type qw_u; \ + qw_u.value = (d); \ + (ix0) = qw_u.parts64.msw; \ + (ix1) = qw_u.parts64.lsw; \ +} while (0) + +/* Set a long double from two 64 bit ints. */ + +#define SET_LDOUBLE_WORDS64(d,ix0,ix1) \ +do { \ + ieee854_long_double_shape_type qw_u; \ + qw_u.parts64.msw = (ix0); \ + qw_u.parts64.lsw = (ix1); \ + (d) = qw_u.value; \ +} while (0) + npy_longdouble _nextl(npy_longdouble x, int p) { + npy_int64 hx,ihx,ilx; + npy_uint64 lx; + + GET_LDOUBLE_WORDS64(hx, lx, x); + ihx = hx & 0x7fffffffffffffffLL; /* |hx| */ + ilx = lx & 0x7fffffffffffffffLL; /* |lx| */ + + if(((ihx & 0x7ff0000000000000LL)==0x7ff0000000000000LL)&& + ((ihx & 0x000fffffffffffffLL)!=0)) { + return x; /* signal the nan */ + } + if(ihx == 0 && ilx == 0) { /* x == 0 */ + npy_longdouble u; + SET_LDOUBLE_WORDS64(x, p, 0ULL);/* return +-minsubnormal */ + u = x * x; + if (u == x) { + return u; + } else { + return x; /* raise underflow flag */ + } + } + + npy_longdouble u; + if(p < 0) { /* p < 0, x -= ulp */ + if((hx==0xffefffffffffffffLL)&&(lx==0xfc8ffffffffffffeLL)) + return x+x; /* overflow, return -inf */ + if (hx >= 0x7ff0000000000000LL) { + SET_LDOUBLE_WORDS64(u,0x7fefffffffffffffLL,0x7c8ffffffffffffeLL); + return u; + } + if(ihx <= 0x0360000000000000LL) { /* x <= LDBL_MIN */ + u = math_opt_barrier (x); + x -= __LDBL_DENORM_MIN__; + if (ihx < 0x0360000000000000LL + || (hx > 0 && (npy_int64) lx <= 0) + || (hx < 0 && (npy_int64) lx > 1)) { + u = u * u; + math_force_eval (u); /* raise underflow flag */ + } + return x; + } + if (ihx < 0x06a0000000000000LL) { /* ulp will denormal */ + SET_LDOUBLE_WORDS64(u,(hx&0x7ff0000000000000LL),0ULL); + u *= 0x1.0000000000000p-105L; + } else + SET_LDOUBLE_WORDS64(u,(hx&0x7ff0000000000000LL)-0x0690000000000000LL,0ULL); + return x - u; + } else { /* p >= 0, x += ulp */ + if((hx==0x7fefffffffffffffLL)&&(lx==0x7c8ffffffffffffeLL)) + return x+x; /* overflow, return +inf */ + if ((npy_uint64) hx >= 0xfff0000000000000ULL) { + SET_LDOUBLE_WORDS64(u,0xffefffffffffffffLL,0xfc8ffffffffffffeLL); + return u; + } + if(ihx <= 0x0360000000000000LL) { /* x <= LDBL_MIN */ + u = math_opt_barrier (x); + x += __LDBL_DENORM_MIN__; + if (ihx < 0x0360000000000000LL + || (hx > 0 && (npy_int64) lx < 0 && lx != 0x8000000000000001LL) + || (hx < 0 && (npy_int64) lx >= 0)) { + u = u * u; + math_force_eval (u); /* raise underflow flag */ + } + if (x == 0.0L) /* handle negative __LDBL_DENORM_MIN__ case */ + x = -0.0L; + return x; + } + if (ihx < 0x06a0000000000000LL) { /* ulp will denormal */ + SET_LDOUBLE_WORDS64(u,(hx&0x7ff0000000000000LL),0ULL); + u *= 0x1.0000000000000p-105L; + } else + SET_LDOUBLE_WORDS64(u,(hx&0x7ff0000000000000LL)-0x0690000000000000LL,0ULL); + return x + u; + } +} +#else +npy_longdouble _nextl(npy_longdouble x, int p) +{ volatile npy_longdouble t; union IEEEl2bitsrep ux; @@ -188,6 +311,7 @@ return ux.e; } +#endif /* * nextafter code taken from BSD math lib, the code contains the following Modified: branches/1.5.x/numpy/core/src/private/npy_fpmath.h =================================================================== --- branches/1.5.x/numpy/core/src/private/npy_fpmath.h 2010-07-24 10:42:41 UTC (rev 8520) +++ branches/1.5.x/numpy/core/src/private/npy_fpmath.h 2010-07-24 10:43:02 UTC (rev 8521) @@ -39,7 +39,8 @@ defined(HAVE_LDOUBLE_IEEE_DOUBLE_BE) || \ defined(HAVE_LDOUBLE_IEEE_DOUBLE_16_BYTES_BE) || \ defined(HAVE_LDOUBLE_INTEL_EXTENDED_16_BYTES_LE) || \ - defined(HAVE_LDOUBLE_INTEL_EXTENDED_12_BYTES_LE)) + defined(HAVE_LDOUBLE_INTEL_EXTENDED_12_BYTES_LE) || \ + defined(HAVE_LDOUBLE_DOUBLE_DOUBLE_BE)) #error No long double representation defined #endif From numpy-svn at scipy.org Sat Jul 24 06:43:16 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 24 Jul 2010 05:43:16 -0500 (CDT) Subject: [Numpy-svn] r8522 - branches/1.5.x/doc/source/reference Message-ID: <20100724104316.DDA5839CDF4@scipy.org> Author: ptvirtan Date: 2010-07-24 05:43:16 -0500 (Sat, 24 Jul 2010) New Revision: 8522 Modified: branches/1.5.x/doc/source/reference/arrays.interface.rst Log: DOC: update the blurb about the array interface (cherry picked from commit r8512) Modified: branches/1.5.x/doc/source/reference/arrays.interface.rst =================================================================== --- branches/1.5.x/doc/source/reference/arrays.interface.rst 2010-07-24 10:43:02 UTC (rev 8521) +++ branches/1.5.x/doc/source/reference/arrays.interface.rst 2010-07-24 10:43:16 UTC (rev 8522) @@ -8,15 +8,15 @@ The Array Interface ******************* -.. warning:: +.. note:: - This page describes the old, deprecated array interface. Everything still - works as described as of numpy 1.2 and on into the foreseeable future, but - new development should target :pep:`3118` -- - :cfunc:`The Revised Buffer Protocol `. - :pep:`3118` was incorporated into Python 2.6 and 3.0, and is additionally - supported by Cython__'s numpy buffer support. (See the `Cython numpy - tutorial`__.) Cython provides a way to write code that supports the buffer + This page describes the numpy-specific API for accessing the contents of + a numpy array from other C extensions. :pep:`3118` -- + :cfunc:`The Revised Buffer Protocol ` introduces + similar, standardized API to Python 2.6 and 3.0 for any extension + module to use. Cython__'s buffer array support + uses the :pep:`3118` API; see the `Cython numpy + tutorial`__. Cython provides a way to write code that supports the buffer protocol with Python versions older than 2.6 because it has a backward-compatible implementation utilizing the legacy array interface described here. From numpy-svn at scipy.org Sat Jul 24 08:30:09 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 24 Jul 2010 07:30:09 -0500 (CDT) Subject: [Numpy-svn] r8523 - trunk/numpy/f2py Message-ID: <20100724123009.22CE639CDE3@scipy.org> Author: pearu Date: 2010-07-24 07:30:08 -0500 (Sat, 24 Jul 2010) New Revision: 8523 Modified: trunk/numpy/f2py/crackfortran.py Log: f2py: fixed issue 1533 (scanning pyf files will report lines that do not match known patterns). Modified: trunk/numpy/f2py/crackfortran.py =================================================================== --- trunk/numpy/f2py/crackfortran.py 2010-07-24 10:43:16 UTC (rev 8522) +++ trunk/numpy/f2py/crackfortran.py 2010-07-24 12:30:08 UTC (rev 8523) @@ -589,7 +589,7 @@ return analyzeline(m,'callfun',line) return - if verbose>1: + if verbose>1 or (verbose==1 and currentfilename.lower().endswith('.pyf')): previous_context = None outmess('crackline:%d: No pattern for line\n'%(groupcounter)) return From numpy-svn at scipy.org Mon Jul 26 09:22:16 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 26 Jul 2010 08:22:16 -0500 (CDT) Subject: [Numpy-svn] r8524 - branches/1.5.x Message-ID: <20100726132216.1E02739CD51@scipy.org> Author: rgommers Date: 2010-07-26 08:22:16 -0500 (Mon, 26 Jul 2010) New Revision: 8524 Modified: branches/1.5.x/release.sh Log: REL: Change release script, I don't use 64-bit Python. Modified: branches/1.5.x/release.sh =================================================================== --- branches/1.5.x/release.sh 2010-07-24 12:30:08 UTC (rev 8523) +++ branches/1.5.x/release.sh 2010-07-26 13:22:16 UTC (rev 8524) @@ -2,7 +2,7 @@ # script to build tarballs, mac os x and windows installers on mac os x paver bootstrap source bootstrap/bin/activate -CFLAGS="-arch x86_64" FFLAGS="-arch x86_64" python setupsconsegg.py install +python setupsconsegg.py install paver sdist paver dmg -p 2.5 paver dmg -p 2.6 From numpy-svn at scipy.org Mon Jul 26 10:06:51 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 26 Jul 2010 09:06:51 -0500 (CDT) Subject: [Numpy-svn] r8525 - trunk/numpy/random/mtrand Message-ID: <20100726140651.147EC39CB51@scipy.org> Author: rgommers Date: 2010-07-26 09:06:51 -0500 (Mon, 26 Jul 2010) New Revision: 8525 Modified: trunk/numpy/random/mtrand/mtrand.pyx Log: DOC: Merge wiki changes for RandomState as far as possible. Closes #1503. Modified: trunk/numpy/random/mtrand/mtrand.pyx =================================================================== --- trunk/numpy/random/mtrand/mtrand.pyx 2010-07-26 13:22:16 UTC (rev 8524) +++ trunk/numpy/random/mtrand/mtrand.pyx 2010-07-26 14:06:51 UTC (rev 8525) @@ -762,15 +762,17 @@ """ tomaxint(size=None) - Uniformly sample discrete random integers `x` such that - ``0 <= x <= sys.maxint``. + Random integers between 0 and ``sys.maxint``, inclusive. + Return a sample of uniformly distributed random integers in the interval + [0, ``sys.maxint``]. + Parameters ---------- size : tuple of ints, int, optional - Shape of output. If the given size is, for example, (m,n,k), - m*n*k samples are generated. If no shape is specified, a single sample - is returned. + Shape of output. If this is, for example, (m,n,k), m*n*k samples + are generated. If no shape is specified, a single sample is + returned. Returns ------- @@ -783,6 +785,23 @@ random_integers : Uniform sampling over a given closed interval of integers. + Examples + -------- + >>> RS = np.random.mtrand.RandomState() # need a RandomState object + >>> RS.tomaxint((2,2,2)) + array([[[1170048599, 1600360186], + [ 739731006, 1947757578]], + [[1871712945, 752307660], + [1601631370, 1479324245]]]) + >>> import sys + >>> sys.maxint + 2147483647 + >>> RS.tomaxint((2,2,2)) < sys.maxint + array([[[ True, True], + [ True, True]], + [[ True, True], + [ True, True]]], dtype=bool) + """ return disc0_array(self.internal_state, rk_long, size) @@ -1805,10 +1824,10 @@ Draw samples from a chi-square distribution. - When `df` independent random variables, each with standard - normal distributions (mean 0, variance 1), are squared and summed, - the resulting distribution is chi-square (see Notes). This - distribution is often used in hypothesis testing. + When `df` independent random variables, each with standard normal + distributions (mean 0, variance 1), are squared and summed, the + resulting distribution is chi-square (see Notes). This distribution + is often used in hypothesis testing. Parameters ---------- @@ -1852,10 +1871,8 @@ References ---------- - .. [1] NIST/SEMATECH e-Handbook of Statistical Methods, - http://www.itl.nist.gov/div898/handbook/eda/section3/eda3666.htm - .. [2] Wikipedia, "Chi-square distribution", - http://en.wikipedia.org/wiki/Chi-square_distribution + `NIST/SEMATECH e-Handbook of Statistical Methods + `_ Examples -------- @@ -2135,36 +2152,37 @@ def vonmises(self, mu, kappa, size=None): """ - vonmises(mu=0.0, kappa=1.0, size=None) + vonmises(mu, kappa, size=None) Draw samples from a von Mises distribution. - Samples are drawn from a von Mises distribution with specified mode (mu) - and dispersion (kappa), on the interval [-pi, pi]. + Samples are drawn from a von Mises distribution with specified mode + (mu) and dispersion (kappa), on the interval [-pi, pi]. The von Mises distribution (also known as the circular normal - distribution) is a continuous probability distribution on the circle. It - may be thought of as the circular analogue of the normal distribution. + distribution) is a continuous probability distribution on the unit + circle. It may be thought of as the circular analogue of the normal + distribution. Parameters ---------- mu : float Mode ("center") of the distribution. - kappa : float, >= 0. - Dispersion of the distribution. - size : {tuple, int} + kappa : float + Dispersion of the distribution, has to be >=0. + size : int or tuple of int Output shape. If the given shape is, e.g., ``(m, n, k)``, then ``m * n * k`` samples are drawn. Returns ------- - samples : {ndarray, scalar} - The returned samples live on the unit circle [-\\pi, \\pi]. + samples : scalar or ndarray + The returned samples, which are in the interval [-pi, pi]. See Also -------- scipy.stats.distributions.vonmises : probability density function, - distribution or cumulative density function, etc. + distribution, or cumulative density function, etc. Notes ----- @@ -2175,22 +2193,20 @@ where :math:`\\mu` is the mode and :math:`\\kappa` the dispersion, and :math:`I_0(\\kappa)` is the modified Bessel function of order 0. - The von Mises, named for Richard Edler von Mises, born in - Austria-Hungary, in what is now the Ukraine. He fled to the United - States in 1939 and became a professor at Harvard. He worked in + The von Mises is named for Richard Edler von Mises, who was born in + Austria-Hungary, in what is now the Ukraine. He fled to the United + States in 1939 and became a professor at Harvard. He worked in probability theory, aerodynamics, fluid mechanics, and philosophy of science. References ---------- - .. [1] Abramowitz, M. and Stegun, I. A. (ed.), Handbook of Mathematical - Functions, National Bureau of Standards, 1964; reprinted Dover - Publications, 1965. - .. [2] von Mises, Richard, 1964, Mathematical Theory of Probability - and Statistics (New York: Academic Press). - .. [3] Wikipedia, "Von Mises distribution", - http://en.wikipedia.org/wiki/Von_Mises_distribution + Abramowitz, M. and Stegun, I. A. (ed.), *Handbook of Mathematical + Functions*, New York: Dover, 1965. + von Mises, R., *Mathematical Theory of Probability and Statistics*, + New York: Academic Press, 1964. + Examples -------- Draw samples from the distribution: @@ -3477,31 +3493,34 @@ Draw samples from a Zipf distribution. - Samples are drawn from a Zipf distribution with specified parameter (a), - where a > 1. + Samples are drawn from a Zipf distribution with specified parameter + `a` > 1. - The zipf distribution (also known as the zeta - distribution) is a continuous probability distribution that satisfies - Zipf's law, where the frequency of an item is inversely proportional to - its rank in a frequency table. + The Zipf distribution (also known as the zeta distribution) is a + continuous probability distribution that satisfies Zipf's law: the + frequency of an item is inversely proportional to its rank in a + frequency table. Parameters ---------- - a : float - parameter, > 1. - size : {tuple, int} + a : float > 1 + Distribution parameter. + size : int or tuple of int, optional Output shape. If the given shape is, e.g., ``(m, n, k)``, then - ``m * n * k`` samples are drawn. + ``m * n * k`` samples are drawn; a single integer is equivalent in + its result to providing a mono-tuple, i.e., a 1-D array of length + *size* is returned. The default is None, in which case a single + scalar is returned. Returns ------- - samples : {ndarray, scalar} + samples : scalar or ndarray The returned samples are greater than or equal to one. See Also -------- scipy.stats.distributions.zipf : probability density function, - distribution or cumulative density function, etc. + distribution, or cumulative density function, etc. Notes ----- @@ -3511,21 +3530,14 @@ where :math:`\\zeta` is the Riemann Zeta function. - Named after the American linguist George Kingsley Zipf, who noted that - the frequency of any word in a sample of a language is inversely + It is named for the American linguist George Kingsley Zipf, who noted + that the frequency of any word in a sample of a language is inversely proportional to its rank in the frequency table. - References ---------- - .. [1] Weisstein, Eric W. "Zipf Distribution." From MathWorld--A Wolfram - Web Resource. http://mathworld.wolfram.com/ZipfDistribution.html - .. [2] Wikipedia, "Zeta distribution", - http://en.wikipedia.org/wiki/Zeta_distribution - .. [3] Wikipedia, "Zipf's Law", - http://en.wikipedia.org/wiki/Zipf%27s_law - .. [4] Zipf, George Kingsley (1932): Selected Studies of the Principle - of Relative Frequency in Language. Cambridge (Mass.). + Zipf, G. K., *Selected Studies of the Principle of Relative Frequency + in Language*, Cambridge, MA: Harvard Univ. Press, 1932. Examples -------- From numpy-svn at scipy.org Tue Jul 27 06:02:17 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 27 Jul 2010 05:02:17 -0500 (CDT) Subject: [Numpy-svn] r8526 - trunk/numpy/core/src/npymath Message-ID: <20100727100217.3E17E39CC70@scipy.org> Author: cdavid Date: 2010-07-27 05:02:17 -0500 (Tue, 27 Jul 2010) New Revision: 8526 Modified: trunk/numpy/core/src/npymath/npy_math_private.h Log: BUG: attempt at fixing alpha build failure (quad prec little endian). Modified: trunk/numpy/core/src/npymath/npy_math_private.h =================================================================== --- trunk/numpy/core/src/npymath/npy_math_private.h 2010-07-26 14:06:51 UTC (rev 8525) +++ trunk/numpy/core/src/npymath/npy_math_private.h 2010-07-27 10:02:17 UTC (rev 8526) @@ -361,6 +361,41 @@ typedef npy_uint64 ldouble_man_t; typedef npy_uint64 ldouble_exp_t; typedef npy_uint32 ldouble_sign_t; +#elif defined(HAVE_LDOUBLE_IEEE_QUAD_LE) + /* + * IEEE quad precision, Little Endian. Bit representation is + * | s |eeeeeeeeeee|mmmmmmmm................mmmmmmm| + * |1 bit| 15 bits | 112 bits | + * | a[1] | a[0] | + */ + typedef npy_uint64 IEEEl2bitsrep_part; + + union IEEEl2bitsrep { + npy_longdouble e; + IEEEl2bitsrep_part a[2]; + }; + + #define LDBL_MANL_INDEX 0 + #define LDBL_MANL_MASK 0xFFFFFFFFFFFFFFFF + #define LDBL_MANL_SHIFT 0 + + #define LDBL_MANH_INDEX 1 + #define LDBL_MANH_MASK 0x0000FFFFFFFFFFFF + #define LDBL_MANH_SHIFT 0 + + #define LDBL_EXP_INDEX 1 + #define LDBL_EXP_MASK 0x7FFF000000000000 + #define LDBL_EXP_SHIFT 48 + + #define LDBL_SIGN_INDEX 1 + #define LDBL_SIGN_MASK 0x8000000000000000 + #define LDBL_SIGN_SHIFT 63 + + #define LDBL_NBIT 0 + + typedef npy_uint64 ldouble_man_t; + typedef npy_uint64 ldouble_exp_t; + typedef npy_uint32 ldouble_sign_t; #endif #ifndef HAVE_LDOUBLE_DOUBLE_DOUBLE_BE From numpy-svn at scipy.org Tue Jul 27 06:44:24 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 27 Jul 2010 05:44:24 -0500 (CDT) Subject: [Numpy-svn] r8527 - trunk/numpy/distutils Message-ID: <20100727104424.A165E39CCAA@scipy.org> Author: pearu Date: 2010-07-27 05:44:24 -0500 (Tue, 27 Jul 2010) New Revision: 8527 Modified: trunk/numpy/distutils/misc_util.py Log: numpy.distutils: Fixed bug in Configuration._get_svn_revision. Introduced make_hg_version_py method, get_version supports hg revision. Modified: trunk/numpy/distutils/misc_util.py =================================================================== --- trunk/numpy/distutils/misc_util.py 2010-07-27 10:02:17 UTC (rev 8526) +++ trunk/numpy/distutils/misc_util.py 2010-07-27 10:44:24 UTC (rev 8527) @@ -1810,14 +1810,17 @@ """ revision = None m = None + cwd = os.getcwd() try: + os.chdir(path or '.') p = subprocess.Popen(['svnversion'], shell=True, - stdout=subprocess.PIPE, stderr=STDOUT, + stdout=subprocess.PIPE, stderr=None, close_fds=True) sout = p.stdout m = re.match(r'(?P\d+)', sout.read()) except: pass + os.chdir(cwd) if m: revision = int(m.group('revision')) return revision @@ -1839,6 +1842,49 @@ revision = int(m.group('revision')) return revision + def _get_hg_revision(self,path): + """Return path's Mercurial revision number. + """ + revision = None + m = None + cwd = os.getcwd() + try: + os.chdir(path or '.') + p = subprocess.Popen(['hg identify --num'], shell=True, + stdout=subprocess.PIPE, stderr=None, + close_fds=True) + sout = p.stdout + m = re.match(r'(?P\d+)', sout.read()) + except: + pass + os.chdir(cwd) + if m: + revision = int(m.group('revision')) + return revision + branch_fn = njoin(path,'.hg','branch') + branch_cache_fn = njoin(path,'.hg','branch.cache') + + if os.path.isfile(branch_fn): + branch0 = None + f = open(branch_fn) + revision0 = f.read().strip() + f.close() + + branch_map = {} + for line in file(branch_cache_fn, 'r'): + branch1, revision1 = line.split()[:2] + if revision1==revision0: + branch0 = branch1 + try: + revision1 = int(revision1) + except ValueError: + continue + branch_map[branch1] = revision1 + + revision = branch_map.get(branch0) + return revision + + def get_version(self, version_file=None, version_variable=None): """Try to get version string of a package. @@ -1861,7 +1907,8 @@ files = ['__version__.py', self.name.split('.')[-1]+'_version.py', 'version.py', - '__svn_version__.py'] + '__svn_version__.py', + '__hg_version__.py'] else: files = [version_file] if version_variable is None: @@ -1896,8 +1943,11 @@ self.version = version return version - # Get version as SVN revision number + # Get version as SVN or Mercurial revision number revision = self._get_svn_revision(self.local_path) + if revision is None: + revision = self._get_hg_revision(self.local_path) + if revision is not None: version = str(revision) self.version = version @@ -1947,6 +1997,48 @@ self.add_data_files(('', generate_svn_version_py())) + def make_hg_version_py(self, delete=True): + """Appends a data function to the data_files list that will generate + __hg_version__.py file to the current package directory. + + Generate package __hg_version__.py file from Mercurial revision, + it will be removed after python exits but will be available + when sdist, etc commands are executed. + + Notes + ----- + If __hg_version__.py existed before, nothing is done. + + This is intended for working with source directories that are + in an Mercurial repository. + """ + target = njoin(self.local_path,'__hg_version__.py') + revision = self._get_hg_revision(self.local_path) + if os.path.isfile(target) or revision is None: + return + else: + def generate_hg_version_py(): + if not os.path.isfile(target): + version = str(revision) + self.info('Creating %s (version=%r)' % (target,version)) + f = open(target,'w') + f.write('version = %r\n' % (version)) + f.close() + + import atexit + def rm_file(f=target,p=self.info): + if delete: + try: os.remove(f); p('removed '+f) + except OSError: pass + try: os.remove(f+'c'); p('removed '+f+'c') + except OSError: pass + + atexit.register(rm_file) + + return target + + self.add_data_files(('', generate_hg_version_py())) + def make_config_py(self,name='__config__'): """Generate package __config__.py file containing system_info information used during building the package. From numpy-svn at scipy.org Tue Jul 27 18:48:45 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 27 Jul 2010 17:48:45 -0500 (CDT) Subject: [Numpy-svn] r8528 - branches/1.5.x/numpy/core/src/npymath Message-ID: <20100727224845.893A039CCFC@scipy.org> Author: cdavid Date: 2010-07-27 17:48:45 -0500 (Tue, 27 Jul 2010) New Revision: 8528 Modified: branches/1.5.x/numpy/core/src/npymath/npy_math_private.h Log: BUG (backport r8526): fix alpha build. (cherry picked from commit c11d86ee1da5841d92402a474d9c7c2d90873dc5) Modified: branches/1.5.x/numpy/core/src/npymath/npy_math_private.h =================================================================== --- branches/1.5.x/numpy/core/src/npymath/npy_math_private.h 2010-07-27 10:44:24 UTC (rev 8527) +++ branches/1.5.x/numpy/core/src/npymath/npy_math_private.h 2010-07-27 22:48:45 UTC (rev 8528) @@ -361,6 +361,41 @@ typedef npy_uint64 ldouble_man_t; typedef npy_uint64 ldouble_exp_t; typedef npy_uint32 ldouble_sign_t; +#elif defined(HAVE_LDOUBLE_IEEE_QUAD_LE) + /* + * IEEE quad precision, Little Endian. Bit representation is + * | s |eeeeeeeeeee|mmmmmmmm................mmmmmmm| + * |1 bit| 15 bits | 112 bits | + * | a[1] | a[0] | + */ + typedef npy_uint64 IEEEl2bitsrep_part; + + union IEEEl2bitsrep { + npy_longdouble e; + IEEEl2bitsrep_part a[2]; + }; + + #define LDBL_MANL_INDEX 0 + #define LDBL_MANL_MASK 0xFFFFFFFFFFFFFFFF + #define LDBL_MANL_SHIFT 0 + + #define LDBL_MANH_INDEX 1 + #define LDBL_MANH_MASK 0x0000FFFFFFFFFFFF + #define LDBL_MANH_SHIFT 0 + + #define LDBL_EXP_INDEX 1 + #define LDBL_EXP_MASK 0x7FFF000000000000 + #define LDBL_EXP_SHIFT 48 + + #define LDBL_SIGN_INDEX 1 + #define LDBL_SIGN_MASK 0x8000000000000000 + #define LDBL_SIGN_SHIFT 63 + + #define LDBL_NBIT 0 + + typedef npy_uint64 ldouble_man_t; + typedef npy_uint64 ldouble_exp_t; + typedef npy_uint32 ldouble_sign_t; #endif #ifndef HAVE_LDOUBLE_DOUBLE_DOUBLE_BE From numpy-svn at scipy.org Tue Jul 27 18:49:06 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 27 Jul 2010 17:49:06 -0500 (CDT) Subject: [Numpy-svn] r8529 - branches/1.4.x/numpy/core/src/npymath Message-ID: <20100727224906.12BDB39CD62@scipy.org> Author: cdavid Date: 2010-07-27 17:49:05 -0500 (Tue, 27 Jul 2010) New Revision: 8529 Modified: branches/1.4.x/numpy/core/src/npymath/npy_math_private.h Log: BUG (backport r8526): fix alpha build. (cherry picked from commit c11d86ee1da5841d92402a474d9c7c2d90873dc5) Modified: branches/1.4.x/numpy/core/src/npymath/npy_math_private.h =================================================================== --- branches/1.4.x/numpy/core/src/npymath/npy_math_private.h 2010-07-27 22:48:45 UTC (rev 8528) +++ branches/1.4.x/numpy/core/src/npymath/npy_math_private.h 2010-07-27 22:49:05 UTC (rev 8529) @@ -361,6 +361,41 @@ typedef npy_uint64 ldouble_man_t; typedef npy_uint64 ldouble_exp_t; typedef npy_uint32 ldouble_sign_t; +#elif defined(HAVE_LDOUBLE_IEEE_QUAD_LE) + /* + * IEEE quad precision, Little Endian. Bit representation is + * | s |eeeeeeeeeee|mmmmmmmm................mmmmmmm| + * |1 bit| 15 bits | 112 bits | + * | a[1] | a[0] | + */ + typedef npy_uint64 IEEEl2bitsrep_part; + + union IEEEl2bitsrep { + npy_longdouble e; + IEEEl2bitsrep_part a[2]; + }; + + #define LDBL_MANL_INDEX 0 + #define LDBL_MANL_MASK 0xFFFFFFFFFFFFFFFF + #define LDBL_MANL_SHIFT 0 + + #define LDBL_MANH_INDEX 1 + #define LDBL_MANH_MASK 0x0000FFFFFFFFFFFF + #define LDBL_MANH_SHIFT 0 + + #define LDBL_EXP_INDEX 1 + #define LDBL_EXP_MASK 0x7FFF000000000000 + #define LDBL_EXP_SHIFT 48 + + #define LDBL_SIGN_INDEX 1 + #define LDBL_SIGN_MASK 0x8000000000000000 + #define LDBL_SIGN_SHIFT 63 + + #define LDBL_NBIT 0 + + typedef npy_uint64 ldouble_man_t; + typedef npy_uint64 ldouble_exp_t; + typedef npy_uint32 ldouble_sign_t; #endif /* Get the sign bit of x. x should be of type IEEEl2bitsrep */ From numpy-svn at scipy.org Wed Jul 28 11:09:57 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 28 Jul 2010 10:09:57 -0500 (CDT) Subject: [Numpy-svn] r8530 - in trunk/numpy/core: . tests Message-ID: <20100728150957.450C939CD2F@scipy.org> Author: rgommers Date: 2010-07-28 10:09:57 -0500 (Wed, 28 Jul 2010) New Revision: 8530 Modified: trunk/numpy/core/numeric.py trunk/numpy/core/tests/test_numeric.py Log: BUG: New implementation of base_repr. Fixes #1549, is several times faster and adds tests. Thanks to K. Maglione. Modified: trunk/numpy/core/numeric.py =================================================================== --- trunk/numpy/core/numeric.py 2010-07-27 22:49:05 UTC (rev 8529) +++ trunk/numpy/core/numeric.py 2010-07-28 15:09:57 UTC (rev 8530) @@ -695,7 +695,7 @@ warnings.warn(""" The current behavior of correlate is deprecated for 1.4.0, and will be removed for NumPy 1.5.0. - + The new behavior fits the conventional definition of correlation: inputs are never swapped, and the second argument is conjugated for complex arrays.""", DeprecationWarning) @@ -1752,13 +1752,13 @@ bin = bin.zfill(width) return sign + bin -def base_repr (number, base=2, padding=0): +def base_repr(number, base=2, padding=0): """ Return a string representation of a number in the given base system. Parameters ---------- - number : scalar + number : int The value to convert. Only positive values are handled. base : int, optional Convert `number` to the `base` number system. The valid range is 2-36, @@ -1773,8 +1773,7 @@ See Also -------- - binary_repr : Faster version of `base_repr` for base 2 that also handles - negative numbers. + binary_repr : Faster version of `base_repr` for base 2. Examples -------- @@ -1791,26 +1790,21 @@ '20' """ + digits = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' + if base > len(digits): + raise ValueError("Bases greater than 36 not handled in base_repr.") + + num = abs(number) + res = [] + while num: + res.append(digits[num % base]) + num /= base + if padding: + res.append('0' * padding) if number < 0: - raise ValueError("negative numbers not handled in base_repr") - if base > 36: - raise ValueError("bases greater than 36 not handled in base_repr") + res.append('-') + return ''.join(reversed(res or '0')) - chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' - import math - lnb = math.log(base) - res = padding*chars[0] - if number == 0: - return res + chars[0] - exponent = int (math.log (number)/lnb) - while(exponent >= 0): - term = long(base)**exponent - lead_digit = int(number / term) - res += chars[lead_digit] - number -= term*lead_digit - exponent -= 1 - return res - from cPickle import load, loads _cload = load _file = open Modified: trunk/numpy/core/tests/test_numeric.py =================================================================== --- trunk/numpy/core/tests/test_numeric.py 2010-07-27 22:49:05 UTC (rev 8529) +++ trunk/numpy/core/tests/test_numeric.py 2010-07-28 15:09:57 UTC (rev 8530) @@ -306,7 +306,21 @@ assert_equal(binary_repr(-1), '-1') assert_equal(binary_repr(-1, width=8), '11111111') +class TestBaseRepr(TestCase): + def test_base3(self): + assert_equal(base_repr(3**5, 3), '100000') + def test_positive(self): + assert_equal(base_repr(12, 10), '12') + assert_equal(base_repr(12, 10, 4), '000012') + assert_equal(base_repr(12, 4), '30') + assert_equal(base_repr(3731624803700888, 36), '10QR0ROFCEW') + + def test_negative(self): + assert_equal(base_repr(-12, 10), '-12') + assert_equal(base_repr(-12, 10, 4), '-000012') + assert_equal(base_repr(-12, 4), '-30') + class TestArrayComparisons(TestCase): def test_array_equal(self): res = array_equal(array([1,2]), array([1,2])) From numpy-svn at scipy.org Wed Jul 28 11:13:28 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 28 Jul 2010 10:13:28 -0500 (CDT) Subject: [Numpy-svn] r8531 - in branches/1.5.x/numpy/core: . tests Message-ID: <20100728151328.7003F39CD4E@scipy.org> Author: rgommers Date: 2010-07-28 10:13:27 -0500 (Wed, 28 Jul 2010) New Revision: 8531 Modified: branches/1.5.x/numpy/core/numeric.py branches/1.5.x/numpy/core/tests/test_numeric.py Log: BUG: (backport of r8530) fix base_repr. Modified: branches/1.5.x/numpy/core/numeric.py =================================================================== --- branches/1.5.x/numpy/core/numeric.py 2010-07-28 15:09:57 UTC (rev 8530) +++ branches/1.5.x/numpy/core/numeric.py 2010-07-28 15:13:27 UTC (rev 8531) @@ -695,7 +695,7 @@ warnings.warn(""" The current behavior of correlate is deprecated for 1.4.0, and will be removed for NumPy 1.5.0. - + The new behavior fits the conventional definition of correlation: inputs are never swapped, and the second argument is conjugated for complex arrays.""", DeprecationWarning) @@ -1752,13 +1752,13 @@ bin = bin.zfill(width) return sign + bin -def base_repr (number, base=2, padding=0): +def base_repr(number, base=2, padding=0): """ Return a string representation of a number in the given base system. Parameters ---------- - number : scalar + number : int The value to convert. Only positive values are handled. base : int, optional Convert `number` to the `base` number system. The valid range is 2-36, @@ -1773,8 +1773,7 @@ See Also -------- - binary_repr : Faster version of `base_repr` for base 2 that also handles - negative numbers. + binary_repr : Faster version of `base_repr` for base 2. Examples -------- @@ -1791,26 +1790,21 @@ '20' """ + digits = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' + if base > len(digits): + raise ValueError("Bases greater than 36 not handled in base_repr.") + + num = abs(number) + res = [] + while num: + res.append(digits[num % base]) + num /= base + if padding: + res.append('0' * padding) if number < 0: - raise ValueError("negative numbers not handled in base_repr") - if base > 36: - raise ValueError("bases greater than 36 not handled in base_repr") + res.append('-') + return ''.join(reversed(res or '0')) - chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' - import math - lnb = math.log(base) - res = padding*chars[0] - if number == 0: - return res + chars[0] - exponent = int (math.log (number)/lnb) - while(exponent >= 0): - term = long(base)**exponent - lead_digit = int(number / term) - res += chars[lead_digit] - number -= term*lead_digit - exponent -= 1 - return res - from cPickle import load, loads _cload = load _file = open Modified: branches/1.5.x/numpy/core/tests/test_numeric.py =================================================================== --- branches/1.5.x/numpy/core/tests/test_numeric.py 2010-07-28 15:09:57 UTC (rev 8530) +++ branches/1.5.x/numpy/core/tests/test_numeric.py 2010-07-28 15:13:27 UTC (rev 8531) @@ -306,7 +306,21 @@ assert_equal(binary_repr(-1), '-1') assert_equal(binary_repr(-1, width=8), '11111111') +class TestBaseRepr(TestCase): + def test_base3(self): + assert_equal(base_repr(3**5, 3), '100000') + def test_positive(self): + assert_equal(base_repr(12, 10), '12') + assert_equal(base_repr(12, 10, 4), '000012') + assert_equal(base_repr(12, 4), '30') + assert_equal(base_repr(3731624803700888, 36), '10QR0ROFCEW') + + def test_negative(self): + assert_equal(base_repr(-12, 10), '-12') + assert_equal(base_repr(-12, 10, 4), '-000012') + assert_equal(base_repr(-12, 4), '-30') + class TestArrayComparisons(TestCase): def test_array_equal(self): res = array_equal(array([1,2]), array([1,2])) From numpy-svn at scipy.org Wed Jul 28 16:19:25 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 28 Jul 2010 15:19:25 -0500 (CDT) Subject: [Numpy-svn] r8532 - trunk/numpy/lib Message-ID: <20100728201925.76E2A39CD44@scipy.org> Author: ptvirtan Date: 2010-07-28 15:19:25 -0500 (Wed, 28 Jul 2010) New Revision: 8532 Modified: trunk/numpy/lib/utils.py Log: BUG: fix usability bugs in lookfor - allow numbers in function signature - print the items in relevance order (not reverse relevance) - include ufunc docstrings Modified: trunk/numpy/lib/utils.py =================================================================== --- trunk/numpy/lib/utils.py 2010-07-28 15:13:27 UTC (rev 8531) +++ trunk/numpy/lib/utils.py 2010-07-28 20:19:25 UTC (rev 8532) @@ -4,7 +4,7 @@ import re from numpy.core.numerictypes import issubclass_, issubsctype, issubdtype -from numpy.core import product, ndarray +from numpy.core import product, ndarray, ufunc __all__ = ['issubclass_', 'get_numpy_include', 'issubsctype', 'issubdtype', 'deprecate', 'deprecate_with_doc', 'get_numarray_include', @@ -695,7 +695,7 @@ _lookfor_caches = {} # regexp whose match indicates that the string may contain a function signature -_function_signature_re = re.compile(r"[a-z_]+\(.*[,=].*\)", re.I) +_function_signature_re = re.compile(r"[a-z0-9_]+\(.*[,=].*\)", re.I) def lookfor(what, module=None, import_modules=True, regenerate=False, output=None): @@ -797,7 +797,7 @@ # Pretty-print s = "Search results for '%s'" % (' '.join(whats)) help_text = [s, "-"*len(s)] - for name in found: + for name in found[::-1]: doc, kind, ix = cache[name] doclines = [line.strip() for line in doc.strip().split("\n") @@ -931,8 +931,12 @@ item_name = "%s.%s" % (mod_name, item_name) if not item_name.startswith(name + '.'): - # don't crawl foreign objects - continue + # don't crawl "foreign" objects + if isinstance(v, ufunc): + # ... unless they are ufuncs + pass + else: + continue elif not (inspect.ismodule(v) or _all is None or n in _all): continue stack.append(("%s.%s" % (name, n), v)) @@ -940,9 +944,6 @@ kind = "class" for n, v in _getmembers(item): stack.append(("%s.%s" % (name, n), v)) - # FIXME later: workaround python3.1 capsule callable bug - # by using old version of callable. - # elif callable(item): elif hasattr(item, "__call__"): kind = "func" From numpy-svn at scipy.org Wed Jul 28 16:20:34 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 28 Jul 2010 15:20:34 -0500 (CDT) Subject: [Numpy-svn] r8533 - branches/1.5.x/numpy/lib Message-ID: <20100728202034.8AE0D39CD49@scipy.org> Author: ptvirtan Date: 2010-07-28 15:20:34 -0500 (Wed, 28 Jul 2010) New Revision: 8533 Modified: branches/1.5.x/numpy/lib/utils.py Log: BUG: (backport r8532) fix usability bugs in lookfor - allow numbers in function signature - print the items in relevance order (not reverse relevance) - include ufunc docstrings Modified: branches/1.5.x/numpy/lib/utils.py =================================================================== --- branches/1.5.x/numpy/lib/utils.py 2010-07-28 20:19:25 UTC (rev 8532) +++ branches/1.5.x/numpy/lib/utils.py 2010-07-28 20:20:34 UTC (rev 8533) @@ -4,7 +4,7 @@ import re from numpy.core.numerictypes import issubclass_, issubsctype, issubdtype -from numpy.core import product, ndarray +from numpy.core import product, ndarray, ufunc __all__ = ['issubclass_', 'get_numpy_include', 'issubsctype', 'issubdtype', 'deprecate', 'deprecate_with_doc', 'get_numarray_include', @@ -695,7 +695,7 @@ _lookfor_caches = {} # regexp whose match indicates that the string may contain a function signature -_function_signature_re = re.compile(r"[a-z_]+\(.*[,=].*\)", re.I) +_function_signature_re = re.compile(r"[a-z0-9_]+\(.*[,=].*\)", re.I) def lookfor(what, module=None, import_modules=True, regenerate=False, output=None): @@ -797,7 +797,7 @@ # Pretty-print s = "Search results for '%s'" % (' '.join(whats)) help_text = [s, "-"*len(s)] - for name in found: + for name in found[::-1]: doc, kind, ix = cache[name] doclines = [line.strip() for line in doc.strip().split("\n") @@ -931,8 +931,12 @@ item_name = "%s.%s" % (mod_name, item_name) if not item_name.startswith(name + '.'): - # don't crawl foreign objects - continue + # don't crawl "foreign" objects + if isinstance(v, ufunc): + # ... unless they are ufuncs + pass + else: + continue elif not (inspect.ismodule(v) or _all is None or n in _all): continue stack.append(("%s.%s" % (name, n), v)) @@ -940,9 +944,6 @@ kind = "class" for n, v in _getmembers(item): stack.append(("%s.%s" % (name, n), v)) - # FIXME later: workaround python3.1 capsule callable bug - # by using old version of callable. - # elif callable(item): elif hasattr(item, "__call__"): kind = "func" From numpy-svn at scipy.org Wed Jul 28 16:33:20 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 28 Jul 2010 15:33:20 -0500 (CDT) Subject: [Numpy-svn] r8534 - trunk/numpy/core/src/multiarray Message-ID: <20100728203320.C3DC939CAEC@scipy.org> Author: oliphant Date: 2010-07-28 15:33:20 -0500 (Wed, 28 Jul 2010) New Revision: 8534 Modified: trunk/numpy/core/src/multiarray/convert_datatype.c Log: Fix copy-and-paste error discovered by re-factor testing... Modified: trunk/numpy/core/src/multiarray/convert_datatype.c =================================================================== --- trunk/numpy/core/src/multiarray/convert_datatype.c 2010-07-28 20:20:34 UTC (rev 8533) +++ trunk/numpy/core/src/multiarray/convert_datatype.c 2010-07-28 20:33:20 UTC (rev 8534) @@ -271,7 +271,7 @@ if (PyDataType_REFCHK(in->descr)) { obptr = buffers[1]; for (i = 0; i < N; i++, obptr+=selsize) { - PyArray_Item_XDECREF(obptr, out->descr); + PyArray_Item_XDECREF(obptr, in->descr); } } if (PyDataType_REFCHK(out->descr)) { From numpy-svn at scipy.org Wed Jul 28 17:00:15 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 28 Jul 2010 16:00:15 -0500 (CDT) Subject: [Numpy-svn] r8535 - in trunk/numpy/core: src/multiarray tests Message-ID: <20100728210015.EE44539CD46@scipy.org> Author: ptvirtan Date: 2010-07-28 16:00:15 -0500 (Wed, 28 Jul 2010) New Revision: 8535 Modified: trunk/numpy/core/src/multiarray/mapping.c trunk/numpy/core/tests/test_regression.py Log: BUG: support assignment x[(0,)] = foo in ndarray subtypes (#1563) The problem was a code path trying to assign x[0], which returns a scalar -- for actual ndarrays a internal function always returning arrays was used. Modified: trunk/numpy/core/src/multiarray/mapping.c =================================================================== --- trunk/numpy/core/src/multiarray/mapping.c 2010-07-28 20:33:20 UTC (rev 8534) +++ trunk/numpy/core/src/multiarray/mapping.c 2010-07-28 21:00:15 UTC (rev 8535) @@ -709,6 +709,12 @@ } else { PyObject *tmp0; + + /* + * Note: this code path should never be reached with an index that + * produces scalars -- those are handled earlier in array_ass_sub + */ + tmp0 = PyObject_GetItem((PyObject *)self, index); if (tmp0 == NULL) { return -1; @@ -841,9 +847,8 @@ return -1; } - /* optimization for integer-tuple */ - if (self->nd > 1 && - (PyTuple_Check(index) && (PyTuple_GET_SIZE(index) == self->nd)) + /* Integer-tuple */ + if (PyTuple_Check(index) && (PyTuple_GET_SIZE(index) == self->nd) && (_tuple_of_integers(index, vals, self->nd) >= 0)) { int i; char *item; Modified: trunk/numpy/core/tests/test_regression.py =================================================================== --- trunk/numpy/core/tests/test_regression.py 2010-07-28 20:33:20 UTC (rev 8534) +++ trunk/numpy/core/tests/test_regression.py 2010-07-28 21:00:15 UTC (rev 8535) @@ -1342,5 +1342,14 @@ cnan = complex(0, np.nan) assert_equal(np.maximum(1, cnan), cnan) + def test_subclass_int_tuple_assignment(self): + # ticket #1563 + class Subclass(np.ndarray): + def __new__(cls,i): + return np.ones((i,)).view(cls) + x = Subclass(5) + x[(0,)] = 2 # shouldn't raise an exception + assert_equal(x[0], 2) + if __name__ == "__main__": run_module_suite() From numpy-svn at scipy.org Wed Jul 28 17:12:16 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 28 Jul 2010 16:12:16 -0500 (CDT) Subject: [Numpy-svn] r8536 - branches/1.5.x/numpy/random/mtrand Message-ID: <20100728211216.52E8D39CD39@scipy.org> Author: ptvirtan Date: 2010-07-28 16:12:16 -0500 (Wed, 28 Jul 2010) New Revision: 8536 Modified: branches/1.5.x/numpy/random/mtrand/mtrand.pyx Log: DOC: (backport r8525) Merge wiki changes for RandomState as far as possible. Closes #1503. Modified: branches/1.5.x/numpy/random/mtrand/mtrand.pyx =================================================================== --- branches/1.5.x/numpy/random/mtrand/mtrand.pyx 2010-07-28 21:00:15 UTC (rev 8535) +++ branches/1.5.x/numpy/random/mtrand/mtrand.pyx 2010-07-28 21:12:16 UTC (rev 8536) @@ -762,15 +762,17 @@ """ tomaxint(size=None) - Uniformly sample discrete random integers `x` such that - ``0 <= x <= sys.maxint``. + Random integers between 0 and ``sys.maxint``, inclusive. + Return a sample of uniformly distributed random integers in the interval + [0, ``sys.maxint``]. + Parameters ---------- size : tuple of ints, int, optional - Shape of output. If the given size is, for example, (m,n,k), - m*n*k samples are generated. If no shape is specified, a single sample - is returned. + Shape of output. If this is, for example, (m,n,k), m*n*k samples + are generated. If no shape is specified, a single sample is + returned. Returns ------- @@ -783,6 +785,23 @@ random_integers : Uniform sampling over a given closed interval of integers. + Examples + -------- + >>> RS = np.random.mtrand.RandomState() # need a RandomState object + >>> RS.tomaxint((2,2,2)) + array([[[1170048599, 1600360186], + [ 739731006, 1947757578]], + [[1871712945, 752307660], + [1601631370, 1479324245]]]) + >>> import sys + >>> sys.maxint + 2147483647 + >>> RS.tomaxint((2,2,2)) < sys.maxint + array([[[ True, True], + [ True, True]], + [[ True, True], + [ True, True]]], dtype=bool) + """ return disc0_array(self.internal_state, rk_long, size) @@ -1805,10 +1824,10 @@ Draw samples from a chi-square distribution. - When `df` independent random variables, each with standard - normal distributions (mean 0, variance 1), are squared and summed, - the resulting distribution is chi-square (see Notes). This - distribution is often used in hypothesis testing. + When `df` independent random variables, each with standard normal + distributions (mean 0, variance 1), are squared and summed, the + resulting distribution is chi-square (see Notes). This distribution + is often used in hypothesis testing. Parameters ---------- @@ -1852,10 +1871,8 @@ References ---------- - .. [1] NIST/SEMATECH e-Handbook of Statistical Methods, - http://www.itl.nist.gov/div898/handbook/eda/section3/eda3666.htm - .. [2] Wikipedia, "Chi-square distribution", - http://en.wikipedia.org/wiki/Chi-square_distribution + `NIST/SEMATECH e-Handbook of Statistical Methods + `_ Examples -------- @@ -2135,36 +2152,37 @@ def vonmises(self, mu, kappa, size=None): """ - vonmises(mu=0.0, kappa=1.0, size=None) + vonmises(mu, kappa, size=None) Draw samples from a von Mises distribution. - Samples are drawn from a von Mises distribution with specified mode (mu) - and dispersion (kappa), on the interval [-pi, pi]. + Samples are drawn from a von Mises distribution with specified mode + (mu) and dispersion (kappa), on the interval [-pi, pi]. The von Mises distribution (also known as the circular normal - distribution) is a continuous probability distribution on the circle. It - may be thought of as the circular analogue of the normal distribution. + distribution) is a continuous probability distribution on the unit + circle. It may be thought of as the circular analogue of the normal + distribution. Parameters ---------- mu : float Mode ("center") of the distribution. - kappa : float, >= 0. - Dispersion of the distribution. - size : {tuple, int} + kappa : float + Dispersion of the distribution, has to be >=0. + size : int or tuple of int Output shape. If the given shape is, e.g., ``(m, n, k)``, then ``m * n * k`` samples are drawn. Returns ------- - samples : {ndarray, scalar} - The returned samples live on the unit circle [-\\pi, \\pi]. + samples : scalar or ndarray + The returned samples, which are in the interval [-pi, pi]. See Also -------- scipy.stats.distributions.vonmises : probability density function, - distribution or cumulative density function, etc. + distribution, or cumulative density function, etc. Notes ----- @@ -2175,22 +2193,20 @@ where :math:`\\mu` is the mode and :math:`\\kappa` the dispersion, and :math:`I_0(\\kappa)` is the modified Bessel function of order 0. - The von Mises, named for Richard Edler von Mises, born in - Austria-Hungary, in what is now the Ukraine. He fled to the United - States in 1939 and became a professor at Harvard. He worked in + The von Mises is named for Richard Edler von Mises, who was born in + Austria-Hungary, in what is now the Ukraine. He fled to the United + States in 1939 and became a professor at Harvard. He worked in probability theory, aerodynamics, fluid mechanics, and philosophy of science. References ---------- - .. [1] Abramowitz, M. and Stegun, I. A. (ed.), Handbook of Mathematical - Functions, National Bureau of Standards, 1964; reprinted Dover - Publications, 1965. - .. [2] von Mises, Richard, 1964, Mathematical Theory of Probability - and Statistics (New York: Academic Press). - .. [3] Wikipedia, "Von Mises distribution", - http://en.wikipedia.org/wiki/Von_Mises_distribution + Abramowitz, M. and Stegun, I. A. (ed.), *Handbook of Mathematical + Functions*, New York: Dover, 1965. + von Mises, R., *Mathematical Theory of Probability and Statistics*, + New York: Academic Press, 1964. + Examples -------- Draw samples from the distribution: @@ -3477,31 +3493,34 @@ Draw samples from a Zipf distribution. - Samples are drawn from a Zipf distribution with specified parameter (a), - where a > 1. + Samples are drawn from a Zipf distribution with specified parameter + `a` > 1. - The zipf distribution (also known as the zeta - distribution) is a continuous probability distribution that satisfies - Zipf's law, where the frequency of an item is inversely proportional to - its rank in a frequency table. + The Zipf distribution (also known as the zeta distribution) is a + continuous probability distribution that satisfies Zipf's law: the + frequency of an item is inversely proportional to its rank in a + frequency table. Parameters ---------- - a : float - parameter, > 1. - size : {tuple, int} + a : float > 1 + Distribution parameter. + size : int or tuple of int, optional Output shape. If the given shape is, e.g., ``(m, n, k)``, then - ``m * n * k`` samples are drawn. + ``m * n * k`` samples are drawn; a single integer is equivalent in + its result to providing a mono-tuple, i.e., a 1-D array of length + *size* is returned. The default is None, in which case a single + scalar is returned. Returns ------- - samples : {ndarray, scalar} + samples : scalar or ndarray The returned samples are greater than or equal to one. See Also -------- scipy.stats.distributions.zipf : probability density function, - distribution or cumulative density function, etc. + distribution, or cumulative density function, etc. Notes ----- @@ -3511,21 +3530,14 @@ where :math:`\\zeta` is the Riemann Zeta function. - Named after the American linguist George Kingsley Zipf, who noted that - the frequency of any word in a sample of a language is inversely + It is named for the American linguist George Kingsley Zipf, who noted + that the frequency of any word in a sample of a language is inversely proportional to its rank in the frequency table. - References ---------- - .. [1] Weisstein, Eric W. "Zipf Distribution." From MathWorld--A Wolfram - Web Resource. http://mathworld.wolfram.com/ZipfDistribution.html - .. [2] Wikipedia, "Zeta distribution", - http://en.wikipedia.org/wiki/Zeta_distribution - .. [3] Wikipedia, "Zipf's Law", - http://en.wikipedia.org/wiki/Zipf%27s_law - .. [4] Zipf, George Kingsley (1932): Selected Studies of the Principle - of Relative Frequency in Language. Cambridge (Mass.). + Zipf, G. K., *Selected Studies of the Principle of Relative Frequency + in Language*, Cambridge, MA: Harvard Univ. Press, 1932. Examples -------- From numpy-svn at scipy.org Wed Jul 28 17:12:34 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 28 Jul 2010 16:12:34 -0500 (CDT) Subject: [Numpy-svn] r8537 - branches/1.5.x/numpy/core/src/multiarray Message-ID: <20100728211234.7A1EC39CD5E@scipy.org> Author: ptvirtan Date: 2010-07-28 16:12:34 -0500 (Wed, 28 Jul 2010) New Revision: 8537 Modified: branches/1.5.x/numpy/core/src/multiarray/convert_datatype.c Log: (backport r8534) Fix copy-and-paste error discovered by re-factor testing... Modified: branches/1.5.x/numpy/core/src/multiarray/convert_datatype.c =================================================================== --- branches/1.5.x/numpy/core/src/multiarray/convert_datatype.c 2010-07-28 21:12:16 UTC (rev 8536) +++ branches/1.5.x/numpy/core/src/multiarray/convert_datatype.c 2010-07-28 21:12:34 UTC (rev 8537) @@ -271,7 +271,7 @@ if (PyDataType_REFCHK(in->descr)) { obptr = buffers[1]; for (i = 0; i < N; i++, obptr+=selsize) { - PyArray_Item_XDECREF(obptr, out->descr); + PyArray_Item_XDECREF(obptr, in->descr); } } if (PyDataType_REFCHK(out->descr)) { From numpy-svn at scipy.org Wed Jul 28 17:12:56 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 28 Jul 2010 16:12:56 -0500 (CDT) Subject: [Numpy-svn] r8538 - in branches/1.5.x/numpy/core: src/multiarray tests Message-ID: <20100728211256.B64AC39CD65@scipy.org> Author: ptvirtan Date: 2010-07-28 16:12:56 -0500 (Wed, 28 Jul 2010) New Revision: 8538 Modified: branches/1.5.x/numpy/core/src/multiarray/mapping.c branches/1.5.x/numpy/core/tests/test_regression.py Log: BUG: (backport r8535) support assignment x[(0,)] = foo in ndarray subtypes (#1563) The problem was a code path trying to assign x[0], which returns a scalar -- for actual ndarrays a internal function always returning arrays was used. Modified: branches/1.5.x/numpy/core/src/multiarray/mapping.c =================================================================== --- branches/1.5.x/numpy/core/src/multiarray/mapping.c 2010-07-28 21:12:34 UTC (rev 8537) +++ branches/1.5.x/numpy/core/src/multiarray/mapping.c 2010-07-28 21:12:56 UTC (rev 8538) @@ -709,6 +709,12 @@ } else { PyObject *tmp0; + + /* + * Note: this code path should never be reached with an index that + * produces scalars -- those are handled earlier in array_ass_sub + */ + tmp0 = PyObject_GetItem((PyObject *)self, index); if (tmp0 == NULL) { return -1; @@ -841,9 +847,8 @@ return -1; } - /* optimization for integer-tuple */ - if (self->nd > 1 && - (PyTuple_Check(index) && (PyTuple_GET_SIZE(index) == self->nd)) + /* Integer-tuple */ + if (PyTuple_Check(index) && (PyTuple_GET_SIZE(index) == self->nd) && (_tuple_of_integers(index, vals, self->nd) >= 0)) { int i; char *item; Modified: branches/1.5.x/numpy/core/tests/test_regression.py =================================================================== --- branches/1.5.x/numpy/core/tests/test_regression.py 2010-07-28 21:12:34 UTC (rev 8537) +++ branches/1.5.x/numpy/core/tests/test_regression.py 2010-07-28 21:12:56 UTC (rev 8538) @@ -1341,5 +1341,14 @@ cnan = complex(0, np.nan) assert_equal(np.maximum(1, cnan), cnan) + def test_subclass_int_tuple_assignment(self): + # ticket #1563 + class Subclass(np.ndarray): + def __new__(cls,i): + return np.ones((i,)).view(cls) + x = Subclass(5) + x[(0,)] = 2 # shouldn't raise an exception + assert_equal(x[0], 2) + if __name__ == "__main__": run_module_suite() From numpy-svn at scipy.org Wed Jul 28 18:31:01 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 28 Jul 2010 17:31:01 -0500 (CDT) Subject: [Numpy-svn] r8539 - in trunk/numpy/testing: . tests Message-ID: <20100728223101.5317339CD7A@scipy.org> Author: ptvirtan Date: 2010-07-28 17:31:01 -0500 (Wed, 28 Jul 2010) New Revision: 8539 Modified: trunk/numpy/testing/tests/test_utils.py trunk/numpy/testing/utils.py Log: ENH: testing: add assert_tol_equal for testing array equality with specified tolerances Modified: trunk/numpy/testing/tests/test_utils.py =================================================================== --- trunk/numpy/testing/tests/test_utils.py 2010-07-28 21:12:56 UTC (rev 8538) +++ trunk/numpy/testing/tests/test_utils.py 2010-07-28 22:31:01 UTC (rev 8539) @@ -336,6 +336,29 @@ if failed: raise AssertionError("wrong warning caught by assert_warn") +class TestAssertAllclose(unittest.TestCase): + def test_simple(self): + x = 1e-3 + y = 1e-9 + + assert_allclose(x, y, atol=1) + self.assertRaises(AssertionError, assert_allclose, x, y) + + a = np.array([x, y, x, y]) + b = np.array([x, y, x, x]) + + assert_allclose(a, b, atol=1) + self.assertRaises(AssertionError, assert_allclose, a, b) + + b[-1] = y * (1 + 1e-8) + assert_allclose(a, b) + self.assertRaises(AssertionError, assert_allclose, a, b, + rtol=1e-9) + + assert_allclose(6, 10, rtol=0.5) + self.assertRaises(AssertionError, assert_allclose, 10, 6, rtol=0.5) + + class TestArrayAlmostEqualNulp(unittest.TestCase): def test_simple(self): dev = np.random.randn(10) Modified: trunk/numpy/testing/utils.py =================================================================== --- trunk/numpy/testing/utils.py 2010-07-28 21:12:56 UTC (rev 8538) +++ trunk/numpy/testing/utils.py 2010-07-28 22:31:01 UTC (rev 8539) @@ -16,7 +16,7 @@ 'decorate_methods', 'jiffies', 'memusage', 'print_assert_equal', 'raises', 'rand', 'rundocs', 'runstring', 'verbose', 'measure', 'assert_', 'assert_array_almost_equal_nulp', - 'assert_array_max_ulp', 'assert_warns'] + 'assert_array_max_ulp', 'assert_warns', 'assert_allclose'] verbose = 0 @@ -1093,6 +1093,42 @@ assert(sys.getrefcount(i) >= rc) +def assert_allclose(actual, desired, rtol=1e-7, atol=0, + err_msg='', verbose=True): + """ + Raise an assertion if two objects are not equal up to desired tolerance. + + The test is equivalent to ``allclose(actual, desired, rtol, atol)`` + + Parameters + ---------- + actual : array_like + Array obtained. + desired : array_like + Array desired + rtol : float, optional + Relative tolerance + atol : float, optional + Absolute tolerance + err_msg : string + The error message to be printed in case of failure. + verbose : bool + If True, the conflicting values are appended to the error message. + + Raises + ------ + AssertionError + If actual and desired are not equal up to specified precision. + + """ + import numpy as np + def compare(x, y): + return np.allclose(x, y, rtol=rtol, atol=atol) + actual, desired = np.asanyarray(actual), np.asanyarray(desired) + header = 'Not equal to tolerance rtol=%g, atol=%g' % (rtol, atol) + assert_array_compare(compare, actual, desired, err_msg=str(err_msg), + verbose=verbose, header=header) + def assert_array_almost_equal_nulp(x, y, nulp=1): """ Compare two arrays relatively to their spacing. From numpy-svn at scipy.org Wed Jul 28 18:32:55 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 28 Jul 2010 17:32:55 -0500 (CDT) Subject: [Numpy-svn] r8540 - in branches/1.5.x/numpy/testing: . tests Message-ID: <20100728223255.E6A4939CD7F@scipy.org> Author: ptvirtan Date: 2010-07-28 17:32:55 -0500 (Wed, 28 Jul 2010) New Revision: 8540 Modified: branches/1.5.x/numpy/testing/tests/test_utils.py branches/1.5.x/numpy/testing/utils.py Log: ENH: (backport r8539) testing: add assert_tol_equal for testing array equality with specified tolerances Modified: branches/1.5.x/numpy/testing/tests/test_utils.py =================================================================== --- branches/1.5.x/numpy/testing/tests/test_utils.py 2010-07-28 22:31:01 UTC (rev 8539) +++ branches/1.5.x/numpy/testing/tests/test_utils.py 2010-07-28 22:32:55 UTC (rev 8540) @@ -336,6 +336,29 @@ if failed: raise AssertionError("wrong warning caught by assert_warn") +class TestAssertAllclose(unittest.TestCase): + def test_simple(self): + x = 1e-3 + y = 1e-9 + + assert_allclose(x, y, atol=1) + self.assertRaises(AssertionError, assert_allclose, x, y) + + a = np.array([x, y, x, y]) + b = np.array([x, y, x, x]) + + assert_allclose(a, b, atol=1) + self.assertRaises(AssertionError, assert_allclose, a, b) + + b[-1] = y * (1 + 1e-8) + assert_allclose(a, b) + self.assertRaises(AssertionError, assert_allclose, a, b, + rtol=1e-9) + + assert_allclose(6, 10, rtol=0.5) + self.assertRaises(AssertionError, assert_allclose, 10, 6, rtol=0.5) + + class TestArrayAlmostEqualNulp(unittest.TestCase): def test_simple(self): dev = np.random.randn(10) Modified: branches/1.5.x/numpy/testing/utils.py =================================================================== --- branches/1.5.x/numpy/testing/utils.py 2010-07-28 22:31:01 UTC (rev 8539) +++ branches/1.5.x/numpy/testing/utils.py 2010-07-28 22:32:55 UTC (rev 8540) @@ -16,7 +16,7 @@ 'decorate_methods', 'jiffies', 'memusage', 'print_assert_equal', 'raises', 'rand', 'rundocs', 'runstring', 'verbose', 'measure', 'assert_', 'assert_array_almost_equal_nulp', - 'assert_array_max_ulp', 'assert_warns'] + 'assert_array_max_ulp', 'assert_warns', 'assert_allclose'] verbose = 0 @@ -1093,6 +1093,42 @@ assert(sys.getrefcount(i) >= rc) +def assert_allclose(actual, desired, rtol=1e-7, atol=0, + err_msg='', verbose=True): + """ + Raise an assertion if two objects are not equal up to desired tolerance. + + The test is equivalent to ``allclose(actual, desired, rtol, atol)`` + + Parameters + ---------- + actual : array_like + Array obtained. + desired : array_like + Array desired + rtol : float, optional + Relative tolerance + atol : float, optional + Absolute tolerance + err_msg : string + The error message to be printed in case of failure. + verbose : bool + If True, the conflicting values are appended to the error message. + + Raises + ------ + AssertionError + If actual and desired are not equal up to specified precision. + + """ + import numpy as np + def compare(x, y): + return np.allclose(x, y, rtol=rtol, atol=atol) + actual, desired = np.asanyarray(actual), np.asanyarray(desired) + header = 'Not equal to tolerance rtol=%g, atol=%g' % (rtol, atol) + assert_array_compare(compare, actual, desired, err_msg=str(err_msg), + verbose=verbose, header=header) + def assert_array_almost_equal_nulp(x, y, nulp=1): """ Compare two arrays relatively to their spacing. From numpy-svn at scipy.org Wed Jul 28 21:38:14 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 28 Jul 2010 20:38:14 -0500 (CDT) Subject: [Numpy-svn] r8541 - in trunk/numpy/core: . include/numpy Message-ID: <20100729013814.8D8C939CD71@scipy.org> Author: cdavid Date: 2010-07-28 20:38:14 -0500 (Wed, 28 Jul 2010) New Revision: 8541 Modified: trunk/numpy/core/SConscript trunk/numpy/core/include/numpy/_numpyconfig.h.in trunk/numpy/core/setup.py Log: BUG: look for endian.h. We should use this header in npy_endian.h if available. Modified: trunk/numpy/core/SConscript =================================================================== --- trunk/numpy/core/SConscript 2010-07-28 22:32:55 UTC (rev 8540) +++ trunk/numpy/core/SConscript 2010-07-29 01:38:14 UTC (rev 8541) @@ -78,6 +78,10 @@ Configuration error log says: \n\n%s""" % ''.join(errmsg) Exit(-1) +st = config.CheckHeader("endian.h") +if st: + numpyconfig_sym.append(('DEFINE_NPY_HAVE_ENDIAN_H', '#define NPY_HAVE_ENDIAN_H 1')) + def check_type(type, include = None): st = config.CheckTypeSize(type, includes = include) type = type.replace(' ', '_') Modified: trunk/numpy/core/include/numpy/_numpyconfig.h.in =================================================================== --- trunk/numpy/core/include/numpy/_numpyconfig.h.in 2010-07-28 22:32:55 UTC (rev 8540) +++ trunk/numpy/core/include/numpy/_numpyconfig.h.in 2010-07-29 01:38:14 UTC (rev 8541) @@ -40,6 +40,8 @@ #define NPY_ABI_VERSION @NPY_ABI_VERSION@ #define NPY_API_VERSION @NPY_API_VERSION@ + at DEFINE_NPY_HAVE_ENDIAN_H@ + /* Ugly, but we can't test this in a proper manner without requiring a C++ * compiler at the configuration stage of numpy ? */ #ifndef __STDC_FORMAT_MACROS Modified: trunk/numpy/core/setup.py =================================================================== --- trunk/numpy/core/setup.py 2010-07-28 22:32:55 UTC (rev 8540) +++ trunk/numpy/core/setup.py 2010-07-29 01:38:14 UTC (rev 8541) @@ -259,6 +259,10 @@ raise SystemError( "Cannot compile 'Python.h'. Perhaps you need to "\ "install python-dev|python-devel.") + res = config_cmd.check_header("endian.h") + if res: + private_defines.append(('HAVE_ENDIAN_H', 1)) + public_defines.append(('NPY_HAVE_ENDIAN_H', 1)) # Check basic types sizes for type in ('short', 'int', 'long'): From numpy-svn at scipy.org Wed Jul 28 21:39:36 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 28 Jul 2010 20:39:36 -0500 (CDT) Subject: [Numpy-svn] r8542 - in branches/1.5.x/numpy/core: . include/numpy Message-ID: <20100729013936.B435B39CD7B@scipy.org> Author: cdavid Date: 2010-07-28 20:39:36 -0500 (Wed, 28 Jul 2010) New Revision: 8542 Modified: branches/1.5.x/numpy/core/SConscript branches/1.5.x/numpy/core/include/numpy/_numpyconfig.h.in branches/1.5.x/numpy/core/setup.py Log: BUG: look for endian.h. We should use this header in npy_endian.h if available. (cherry picked from commit 6f59b03b86868794328a39bd0542cc47957d2c80) Modified: branches/1.5.x/numpy/core/SConscript =================================================================== --- branches/1.5.x/numpy/core/SConscript 2010-07-29 01:38:14 UTC (rev 8541) +++ branches/1.5.x/numpy/core/SConscript 2010-07-29 01:39:36 UTC (rev 8542) @@ -78,6 +78,10 @@ Configuration error log says: \n\n%s""" % ''.join(errmsg) Exit(-1) +st = config.CheckHeader("endian.h") +if st: + numpyconfig_sym.append(('DEFINE_NPY_HAVE_ENDIAN_H', '#define NPY_HAVE_ENDIAN_H 1')) + def check_type(type, include = None): st = config.CheckTypeSize(type, includes = include) type = type.replace(' ', '_') Modified: branches/1.5.x/numpy/core/include/numpy/_numpyconfig.h.in =================================================================== --- branches/1.5.x/numpy/core/include/numpy/_numpyconfig.h.in 2010-07-29 01:38:14 UTC (rev 8541) +++ branches/1.5.x/numpy/core/include/numpy/_numpyconfig.h.in 2010-07-29 01:39:36 UTC (rev 8542) @@ -40,6 +40,8 @@ #define NPY_ABI_VERSION @NPY_ABI_VERSION@ #define NPY_API_VERSION @NPY_API_VERSION@ + at DEFINE_NPY_HAVE_ENDIAN_H@ + /* Ugly, but we can't test this in a proper manner without requiring a C++ * compiler at the configuration stage of numpy ? */ #ifndef __STDC_FORMAT_MACROS Modified: branches/1.5.x/numpy/core/setup.py =================================================================== --- branches/1.5.x/numpy/core/setup.py 2010-07-29 01:38:14 UTC (rev 8541) +++ branches/1.5.x/numpy/core/setup.py 2010-07-29 01:39:36 UTC (rev 8542) @@ -259,6 +259,10 @@ raise SystemError( "Cannot compile 'Python.h'. Perhaps you need to "\ "install python-dev|python-devel.") + res = config_cmd.check_header("endian.h") + if res: + private_defines.append(('HAVE_ENDIAN_H', 1)) + public_defines.append(('NPY_HAVE_ENDIAN_H', 1)) # Check basic types sizes for type in ('short', 'int', 'long'): From numpy-svn at scipy.org Wed Jul 28 21:39:55 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 28 Jul 2010 20:39:55 -0500 (CDT) Subject: [Numpy-svn] r8543 - in branches/1.4.x/numpy/core: . include/numpy Message-ID: <20100729013955.4728A39CD88@scipy.org> Author: cdavid Date: 2010-07-28 20:39:55 -0500 (Wed, 28 Jul 2010) New Revision: 8543 Modified: branches/1.4.x/numpy/core/SConscript branches/1.4.x/numpy/core/include/numpy/_numpyconfig.h.in branches/1.4.x/numpy/core/setup.py Log: BUG: look for endian.h. We should use this header in npy_endian.h if available. (cherry picked from commit 6f59b03b86868794328a39bd0542cc47957d2c80) Modified: branches/1.4.x/numpy/core/SConscript =================================================================== --- branches/1.4.x/numpy/core/SConscript 2010-07-29 01:39:36 UTC (rev 8542) +++ branches/1.4.x/numpy/core/SConscript 2010-07-29 01:39:55 UTC (rev 8543) @@ -78,6 +78,10 @@ Configuration error log says: \n\n%s""" % ''.join(errmsg) Exit(-1) +st = config.CheckHeader("endian.h") +if st: + numpyconfig_sym.append(('DEFINE_NPY_HAVE_ENDIAN_H', '#define NPY_HAVE_ENDIAN_H 1')) + def check_type(type, include = None): st = config.CheckTypeSize(type, includes = include) type = type.replace(' ', '_') Modified: branches/1.4.x/numpy/core/include/numpy/_numpyconfig.h.in =================================================================== --- branches/1.4.x/numpy/core/include/numpy/_numpyconfig.h.in 2010-07-29 01:39:36 UTC (rev 8542) +++ branches/1.4.x/numpy/core/include/numpy/_numpyconfig.h.in 2010-07-29 01:39:55 UTC (rev 8543) @@ -40,6 +40,8 @@ #define NPY_ABI_VERSION @NPY_ABI_VERSION@ #define NPY_API_VERSION @NPY_API_VERSION@ + at DEFINE_NPY_HAVE_ENDIAN_H@ + /* Ugly, but we can't test this in a proper manner without requiring a C++ * compiler at the configuration stage of numpy ? */ #ifndef __STDC_FORMAT_MACROS Modified: branches/1.4.x/numpy/core/setup.py =================================================================== --- branches/1.4.x/numpy/core/setup.py 2010-07-29 01:39:36 UTC (rev 8542) +++ branches/1.4.x/numpy/core/setup.py 2010-07-29 01:39:55 UTC (rev 8543) @@ -245,6 +245,10 @@ raise SystemError( "Cannot compiler 'Python.h'. Perhaps you need to "\ "install python-dev|python-devel.") + res = config_cmd.check_header("endian.h") + if res: + private_defines.append(('HAVE_ENDIAN_H', 1)) + public_defines.append(('NPY_HAVE_ENDIAN_H', 1)) # Check basic types sizes for type in ('short', 'int', 'long'): From numpy-svn at scipy.org Thu Jul 29 10:09:17 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 29 Jul 2010 09:09:17 -0500 (CDT) Subject: [Numpy-svn] r8544 - trunk/numpy/core/include/numpy Message-ID: <20100729140917.0E92F39CDF3@scipy.org> Author: cdavid Date: 2010-07-29 09:09:16 -0500 (Thu, 29 Jul 2010) New Revision: 8544 Modified: trunk/numpy/core/include/numpy/ndarraytypes.h Log: BUG: make sure npy_cpu.h is always included in ndarraytypes.h Modified: trunk/numpy/core/include/numpy/ndarraytypes.h =================================================================== --- trunk/numpy/core/include/numpy/ndarraytypes.h 2010-07-29 01:39:55 UTC (rev 8543) +++ trunk/numpy/core/include/numpy/ndarraytypes.h 2010-07-29 14:09:16 UTC (rev 8544) @@ -6,6 +6,7 @@ #include "npy_common.h" #include "npy_endian.h" +#include "npy_cpu.h" #include "utils.h" #ifdef NPY_ENABLE_SEPARATE_COMPILATION From numpy-svn at scipy.org Thu Jul 29 10:13:54 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 29 Jul 2010 09:13:54 -0500 (CDT) Subject: [Numpy-svn] r8545 - branches/1.4.x/numpy/core/include/numpy Message-ID: <20100729141354.1A43539CE0E@scipy.org> Author: cdavid Date: 2010-07-29 09:13:53 -0500 (Thu, 29 Jul 2010) New Revision: 8545 Modified: branches/1.4.x/numpy/core/include/numpy/ndarrayobject.h Log: BUG: make sure npy_cpu.h is always included in ndarrayobject.h Modified: branches/1.4.x/numpy/core/include/numpy/ndarrayobject.h =================================================================== --- branches/1.4.x/numpy/core/include/numpy/ndarrayobject.h 2010-07-29 14:09:16 UTC (rev 8544) +++ branches/1.4.x/numpy/core/include/numpy/ndarrayobject.h 2010-07-29 14:13:53 UTC (rev 8545) @@ -31,6 +31,7 @@ #endif #include "npy_endian.h" +#include "npy_cpu.h" #include "utils.h" From numpy-svn at scipy.org Thu Jul 29 10:18:42 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 29 Jul 2010 09:18:42 -0500 (CDT) Subject: [Numpy-svn] r8546 - branches/1.5.x/numpy/core/include/numpy Message-ID: <20100729141842.246A839CE16@scipy.org> Author: cdavid Date: 2010-07-29 09:18:42 -0500 (Thu, 29 Jul 2010) New Revision: 8546 Modified: branches/1.5.x/numpy/core/include/numpy/ndarraytypes.h Log: BUG: make sure npy_cpu.h is always included in ndarraytypes.h (cherry picked from commit b4d7338de5338daed4e543921cf3cb82eb2c3675) Modified: branches/1.5.x/numpy/core/include/numpy/ndarraytypes.h =================================================================== --- branches/1.5.x/numpy/core/include/numpy/ndarraytypes.h 2010-07-29 14:13:53 UTC (rev 8545) +++ branches/1.5.x/numpy/core/include/numpy/ndarraytypes.h 2010-07-29 14:18:42 UTC (rev 8546) @@ -6,6 +6,7 @@ #include "npy_common.h" #include "npy_endian.h" +#include "npy_cpu.h" #include "utils.h" #ifdef NPY_ENABLE_SEPARATE_COMPILATION From numpy-svn at scipy.org Thu Jul 29 11:54:22 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 29 Jul 2010 10:54:22 -0500 (CDT) Subject: [Numpy-svn] r8547 - in branches/1.5.x: . tools/numpy-macosx-installer Message-ID: <20100729155422.7DE5E39CE2A@scipy.org> Author: rgommers Date: 2010-07-29 10:54:22 -0500 (Thu, 29 Jul 2010) New Revision: 8547 Modified: branches/1.5.x/pavement.py branches/1.5.x/release.sh branches/1.5.x/tools/numpy-macosx-installer/new-create-dmg Log: REL: Update paver and release scripts for Python 2.7/3.1 binaries. Note that the increase in disk image size from 10Mb to 11Mb does not mean numpy is actually that large - more than half that is the included docs. It is the case though that the 2.7 binaries are slightly larger than the 2.5/2.6 ones, by 100kb on Windows and 800kb on OS X. Modified: branches/1.5.x/pavement.py =================================================================== --- branches/1.5.x/pavement.py 2010-07-29 14:18:42 UTC (rev 8546) +++ branches/1.5.x/pavement.py 2010-07-29 15:54:22 UTC (rev 8547) @@ -106,7 +106,9 @@ MPKG_PYTHON = { "2.5": ["/Library/Frameworks/Python.framework/Versions/2.5/bin/python"], - "2.6": ["/Library/Frameworks/Python.framework/Versions/2.6/bin/python"] + "2.6": ["/Library/Frameworks/Python.framework/Versions/2.6/bin/python"], + "2.7": ["/Library/Frameworks/Python.framework/Versions/2.7/bin/python"], + "3.1": ["/Library/Frameworks/Python.framework/Versions/3.1/bin/python3"], } SSE3_CFG = {'ATLAS': r'C:\local\lib\yop\sse3'} @@ -117,6 +119,8 @@ if sys.platform =="darwin": WINDOWS_PYTHON = { + "3.1": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python31/python.exe"], + "2.7": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python27/python.exe"], "2.6": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python26/python.exe"], "2.5": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python25/python.exe"] } @@ -125,6 +129,8 @@ MAKENSIS = ["wine", "makensis"] elif sys.platform == "win32": WINDOWS_PYTHON = { + "3.1": ["C:\Python31\python3.exe"], + "2.7": ["C:\Python27\python.exe"], "2.6": ["C:\Python26\python.exe"], "2.5": ["C:\Python25\python.exe"], } @@ -134,6 +140,8 @@ MAKENSIS = ["makensis"] else: WINDOWS_PYTHON = { + "3.1": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python31/python.exe"], + "2.7": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python27/python.exe"], "2.6": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python26/python.exe"], "2.5": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python25/python.exe"] } Modified: branches/1.5.x/release.sh =================================================================== --- branches/1.5.x/release.sh 2010-07-29 14:18:42 UTC (rev 8546) +++ branches/1.5.x/release.sh 2010-07-29 15:54:22 UTC (rev 8547) @@ -4,8 +4,10 @@ source bootstrap/bin/activate python setupsconsegg.py install paver sdist +paver dmg -p 2.7 +paver dmg -p 2.6 paver dmg -p 2.5 -paver dmg -p 2.6 +paver bdist_superpack -p 2.7 +paver bdist_superpack -p 2.6 paver bdist_superpack -p 2.5 -paver bdist_superpack -p 2.6 paver write_release_and_log Modified: branches/1.5.x/tools/numpy-macosx-installer/new-create-dmg =================================================================== --- branches/1.5.x/tools/numpy-macosx-installer/new-create-dmg 2010-07-29 14:18:42 UTC (rev 8546) +++ branches/1.5.x/tools/numpy-macosx-installer/new-create-dmg 2010-07-29 15:54:22 UTC (rev 8547) @@ -58,7 +58,7 @@ DMG_NAME="$(basename "$DMG_PATH")" DMG_TEMP_NAME="$DMG_DIR/rw.${DMG_NAME}" SRC_FOLDER="$(cd "$2" > /dev/null; pwd)" -DMG_SIZE=10m +DMG_SIZE=11m test -z "$VOLUME_NAME" && VOLUME_NAME="$(basename "$DMG_PATH" .dmg)" # AUX_PATH="$(cd "$(dirname $0)"; pwd)/support" From numpy-svn at scipy.org Thu Jul 29 16:07:58 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 29 Jul 2010 15:07:58 -0500 (CDT) Subject: [Numpy-svn] r8548 - in trunk/numpy/core: src/multiarray tests Message-ID: <20100729200758.0FEA639CC9C@scipy.org> Author: ptvirtan Date: 2010-07-29 15:07:57 -0500 (Thu, 29 Jul 2010) New Revision: 8548 Modified: trunk/numpy/core/src/multiarray/methods.c trunk/numpy/core/tests/test_regression.py Log: BUG: core/umath: do not create views unnecessarily in ndarray.__array_prepare__ (fixes #1548) Modified: trunk/numpy/core/src/multiarray/methods.c =================================================================== --- trunk/numpy/core/src/multiarray/methods.c 2010-07-29 15:54:22 UTC (rev 8547) +++ trunk/numpy/core/src/multiarray/methods.c 2010-07-29 20:07:57 UTC (rev 8548) @@ -843,6 +843,12 @@ return NULL; } + if (Py_TYPE(self) == Py_TYPE(arr)) { + /* No need to create a new view */ + Py_INCREF(arr); + return arr; + } + Py_INCREF(PyArray_DESCR(arr)); ret = PyArray_NewFromDescr(Py_TYPE(self), PyArray_DESCR(arr), Modified: trunk/numpy/core/tests/test_regression.py =================================================================== --- trunk/numpy/core/tests/test_regression.py 2010-07-29 15:54:22 UTC (rev 8547) +++ trunk/numpy/core/tests/test_regression.py 2010-07-29 20:07:57 UTC (rev 8548) @@ -1351,5 +1351,13 @@ x[(0,)] = 2 # shouldn't raise an exception assert_equal(x[0], 2) + def test_ufunc_no_unnecessary_views(self): + # ticket #1548 + class Subclass(np.ndarray): + pass + x = np.array([1,2,3]).view(Subclass) + y = np.add(x, x, x) + assert_equal(id(x), id(y)) + if __name__ == "__main__": run_module_suite() From numpy-svn at scipy.org Thu Jul 29 16:55:56 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 29 Jul 2010 15:55:56 -0500 (CDT) Subject: [Numpy-svn] r8549 - trunk/doc/sphinxext Message-ID: <20100729205556.2893F39CD2C@scipy.org> Author: ptvirtan Date: 2010-07-29 15:55:56 -0500 (Thu, 29 Jul 2010) New Revision: 8549 Modified: trunk/doc/sphinxext/README.txt trunk/doc/sphinxext/docscrape.py trunk/doc/sphinxext/numpydoc.py Log: DOC: sphinxext: replace directive mangling with domains (#1489) Only Sphinx >= 1.0 is supported now. Modified: trunk/doc/sphinxext/README.txt =================================================================== --- trunk/doc/sphinxext/README.txt 2010-07-29 20:07:57 UTC (rev 8548) +++ trunk/doc/sphinxext/README.txt 2010-07-29 20:55:56 UTC (rev 8549) @@ -9,7 +9,7 @@ The following extensions are available: - ``numpydoc``: support for the Numpy docstring format in Sphinx, and add - the code description directives ``np-function``, ``np-cfunction``, etc. + the code description directives ``np:function``, ``np-c:function``, etc. that support the Numpy docstring syntax. - ``numpydoc.traitsdoc``: For gathering documentation about Traits attributes. Modified: trunk/doc/sphinxext/docscrape.py =================================================================== --- trunk/doc/sphinxext/docscrape.py 2010-07-29 20:07:57 UTC (rev 8548) +++ trunk/doc/sphinxext/docscrape.py 2010-07-29 20:55:56 UTC (rev 8549) @@ -411,19 +411,14 @@ def __init__(self, func, role='func', doc=None, config={}): self._f = func self._role = role # e.g. "func" or "meth" + if doc is None: + if func is None: + raise ValueError("No function or docstring given") doc = inspect.getdoc(func) or '' - try: - NumpyDocString.__init__(self, doc) - except ValueError, e: - print '*'*78 - print "ERROR: '%s' while parsing `%s`" % (e, self._f) - print '*'*78 - #print "Docstring follows:" - #print doclines - #print '='*78 + NumpyDocString.__init__(self, doc) - if not self['Signature']: + if not self['Signature'] and func is not None: func, func_name = self.get_func() try: # try to read signature @@ -465,17 +460,17 @@ class ClassDoc(NumpyDocString): def __init__(self, cls, doc=None, modulename='', func_doc=FunctionDoc, config={}): - if not inspect.isclass(cls): - raise ValueError("Initialise using a class. Got %r" % cls) + if not inspect.isclass(cls) and cls is not None: + raise ValueError("Expected a class or None, but got %r" % cls) self._cls = cls if modulename and not modulename.endswith('.'): modulename += '.' self._mod = modulename - self._name = cls.__name__ - self._func_doc = func_doc if doc is None: + if cls is None: + raise ValueError("No class or documentation string given") doc = pydoc.getdoc(cls) NumpyDocString.__init__(self, doc) @@ -490,10 +485,14 @@ @property def methods(self): + if self._cls is None: + return [] return [name for name,func in inspect.getmembers(self._cls) if not name.startswith('_') and callable(func)] @property def properties(self): + if self._cls is None: + return [] return [name for name,func in inspect.getmembers(self._cls) if not name.startswith('_') and func is None] Modified: trunk/doc/sphinxext/numpydoc.py =================================================================== --- trunk/doc/sphinxext/numpydoc.py 2010-07-29 20:07:57 UTC (rev 8548) +++ trunk/doc/sphinxext/numpydoc.py 2010-07-29 20:55:56 UTC (rev 8549) @@ -85,74 +85,63 @@ sig = re.sub(u"^[^(]*", u"", doc['Signature']) return sig, u'' -def initialize(app): - try: - app.connect('autodoc-process-signature', mangle_signature) - except: - monkeypatch_sphinx_ext_autodoc() - def setup(app, get_doc_object_=get_doc_object): global get_doc_object get_doc_object = get_doc_object_ app.connect('autodoc-process-docstring', mangle_docstrings) - app.connect('builder-inited', initialize) + app.connect('autodoc-process-signature', mangle_signature) app.add_config_value('numpydoc_edit_link', None, False) app.add_config_value('numpydoc_use_plots', None, False) app.add_config_value('numpydoc_show_class_members', True, True) - # Extra mangling directives - name_type = { - 'cfunction': 'function', - 'cmember': 'attribute', - 'cmacro': 'function', - 'ctype': 'class', - 'cvar': 'object', - 'class': 'class', - 'function': 'function', - 'attribute': 'attribute', - 'method': 'function', - 'staticmethod': 'function', - 'classmethod': 'function', - } + # Extra mangling domains + app.add_domain(NumpyPythonDomain) + app.add_domain(NumpyCDomain) - for name, objtype in name_type.items(): - app.add_directive('np-' + name, wrap_mangling_directive(name, objtype)) - #------------------------------------------------------------------------------ -# Input-mangling directives +# Docstring-mangling domains #------------------------------------------------------------------------------ + from docutils.statemachine import ViewList +from sphinx.domains.c import CDomain +from sphinx.domains.python import PythonDomain -def get_directive(name): - from docutils.parsers.rst import directives - try: - return directives.directive(name, None, None)[0] - except AttributeError: - pass - try: - # docutils 0.4 - return directives._directives[name] - except (AttributeError, KeyError): - raise RuntimeError("No directive named '%s' found" % name) +class ManglingDomainBase(object): + directive_mangling_map = {} -def wrap_mangling_directive(base_directive_name, objtype): - base_directive = get_directive(base_directive_name) + def __init__(self, *a, **kw): + super(ManglingDomainBase, self).__init__(*a, **kw) + self.wrap_mangling_directives() - if inspect.isfunction(base_directive): - base_func = base_directive - class base_directive(Directive): - required_arguments = base_func.arguments[0] - optional_arguments = base_func.arguments[1] - final_argument_whitespace = base_func.arguments[2] - option_spec = base_func.options - has_content = base_func.content - def run(self): - return base_func(self.name, self.arguments, self.options, - self.content, self.lineno, - self.content_offset, self.block_text, - self.state, self.state_machine) + def wrap_mangling_directives(self): + for name, objtype in self.directive_mangling_map.items(): + self.directives[name] = wrap_mangling_directive( + self.directives[name], objtype) +class NumpyPythonDomain(ManglingDomainBase, PythonDomain): + name = 'np' + directive_mangling_map = { + 'function': 'function', + 'class': 'class', + 'exception': 'class', + 'method': 'function', + 'classmethod': 'function', + 'staticmethod': 'function', + 'attribute': 'attribute', + } + +class NumpyCDomain(ManglingDomainBase, CDomain): + name = 'np-c' + directive_mangling_map = { + 'function': 'function', + 'member': 'attribute', + 'macro': 'function', + 'type': 'class', + 'var': 'object', + } + +def wrap_mangling_directive(base_directive, objtype): class directive(base_directive): def run(self): env = self.state.document.settings.env @@ -173,24 +162,3 @@ return directive -#------------------------------------------------------------------------------ -# Monkeypatch sphinx.ext.autodoc to accept argspecless autodocs (Sphinx < 0.5) -#------------------------------------------------------------------------------ - -def monkeypatch_sphinx_ext_autodoc(): - global _original_format_signature - import sphinx.ext.autodoc - - if sphinx.ext.autodoc.format_signature is our_format_signature: - return - - print "[numpydoc] Monkeypatching sphinx.ext.autodoc ..." - _original_format_signature = sphinx.ext.autodoc.format_signature - sphinx.ext.autodoc.format_signature = our_format_signature - -def our_format_signature(what, obj): - r = mangle_signature(None, what, None, obj, None, None, None) - if r is not None: - return r[0] - else: - return _original_format_signature(what, obj) From numpy-svn at scipy.org Thu Jul 29 16:58:05 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 29 Jul 2010 15:58:05 -0500 (CDT) Subject: [Numpy-svn] r8550 - branches/1.5.x/doc/sphinxext Message-ID: <20100729205805.6344B39CD48@scipy.org> Author: ptvirtan Date: 2010-07-29 15:58:05 -0500 (Thu, 29 Jul 2010) New Revision: 8550 Modified: branches/1.5.x/doc/sphinxext/README.txt branches/1.5.x/doc/sphinxext/docscrape.py branches/1.5.x/doc/sphinxext/numpydoc.py Log: DOC: sphinxext: (backport r8549) replace directive mangling with domains (#1489) Only Sphinx >= 1.0 is supported now. Modified: branches/1.5.x/doc/sphinxext/README.txt =================================================================== --- branches/1.5.x/doc/sphinxext/README.txt 2010-07-29 20:55:56 UTC (rev 8549) +++ branches/1.5.x/doc/sphinxext/README.txt 2010-07-29 20:58:05 UTC (rev 8550) @@ -9,7 +9,7 @@ The following extensions are available: - ``numpydoc``: support for the Numpy docstring format in Sphinx, and add - the code description directives ``np-function``, ``np-cfunction``, etc. + the code description directives ``np:function``, ``np-c:function``, etc. that support the Numpy docstring syntax. - ``numpydoc.traitsdoc``: For gathering documentation about Traits attributes. Modified: branches/1.5.x/doc/sphinxext/docscrape.py =================================================================== --- branches/1.5.x/doc/sphinxext/docscrape.py 2010-07-29 20:55:56 UTC (rev 8549) +++ branches/1.5.x/doc/sphinxext/docscrape.py 2010-07-29 20:58:05 UTC (rev 8550) @@ -411,19 +411,14 @@ def __init__(self, func, role='func', doc=None, config={}): self._f = func self._role = role # e.g. "func" or "meth" + if doc is None: + if func is None: + raise ValueError("No function or docstring given") doc = inspect.getdoc(func) or '' - try: - NumpyDocString.__init__(self, doc) - except ValueError, e: - print '*'*78 - print "ERROR: '%s' while parsing `%s`" % (e, self._f) - print '*'*78 - #print "Docstring follows:" - #print doclines - #print '='*78 + NumpyDocString.__init__(self, doc) - if not self['Signature']: + if not self['Signature'] and func is not None: func, func_name = self.get_func() try: # try to read signature @@ -465,17 +460,17 @@ class ClassDoc(NumpyDocString): def __init__(self, cls, doc=None, modulename='', func_doc=FunctionDoc, config={}): - if not inspect.isclass(cls): - raise ValueError("Initialise using a class. Got %r" % cls) + if not inspect.isclass(cls) and cls is not None: + raise ValueError("Expected a class or None, but got %r" % cls) self._cls = cls if modulename and not modulename.endswith('.'): modulename += '.' self._mod = modulename - self._name = cls.__name__ - self._func_doc = func_doc if doc is None: + if cls is None: + raise ValueError("No class or documentation string given") doc = pydoc.getdoc(cls) NumpyDocString.__init__(self, doc) @@ -490,10 +485,14 @@ @property def methods(self): + if self._cls is None: + return [] return [name for name,func in inspect.getmembers(self._cls) if not name.startswith('_') and callable(func)] @property def properties(self): + if self._cls is None: + return [] return [name for name,func in inspect.getmembers(self._cls) if not name.startswith('_') and func is None] Modified: branches/1.5.x/doc/sphinxext/numpydoc.py =================================================================== --- branches/1.5.x/doc/sphinxext/numpydoc.py 2010-07-29 20:55:56 UTC (rev 8549) +++ branches/1.5.x/doc/sphinxext/numpydoc.py 2010-07-29 20:58:05 UTC (rev 8550) @@ -85,74 +85,63 @@ sig = re.sub(u"^[^(]*", u"", doc['Signature']) return sig, u'' -def initialize(app): - try: - app.connect('autodoc-process-signature', mangle_signature) - except: - monkeypatch_sphinx_ext_autodoc() - def setup(app, get_doc_object_=get_doc_object): global get_doc_object get_doc_object = get_doc_object_ app.connect('autodoc-process-docstring', mangle_docstrings) - app.connect('builder-inited', initialize) + app.connect('autodoc-process-signature', mangle_signature) app.add_config_value('numpydoc_edit_link', None, False) app.add_config_value('numpydoc_use_plots', None, False) app.add_config_value('numpydoc_show_class_members', True, True) - # Extra mangling directives - name_type = { - 'cfunction': 'function', - 'cmember': 'attribute', - 'cmacro': 'function', - 'ctype': 'class', - 'cvar': 'object', - 'class': 'class', - 'function': 'function', - 'attribute': 'attribute', - 'method': 'function', - 'staticmethod': 'function', - 'classmethod': 'function', - } + # Extra mangling domains + app.add_domain(NumpyPythonDomain) + app.add_domain(NumpyCDomain) - for name, objtype in name_type.items(): - app.add_directive('np-' + name, wrap_mangling_directive(name, objtype)) - #------------------------------------------------------------------------------ -# Input-mangling directives +# Docstring-mangling domains #------------------------------------------------------------------------------ + from docutils.statemachine import ViewList +from sphinx.domains.c import CDomain +from sphinx.domains.python import PythonDomain -def get_directive(name): - from docutils.parsers.rst import directives - try: - return directives.directive(name, None, None)[0] - except AttributeError: - pass - try: - # docutils 0.4 - return directives._directives[name] - except (AttributeError, KeyError): - raise RuntimeError("No directive named '%s' found" % name) +class ManglingDomainBase(object): + directive_mangling_map = {} -def wrap_mangling_directive(base_directive_name, objtype): - base_directive = get_directive(base_directive_name) + def __init__(self, *a, **kw): + super(ManglingDomainBase, self).__init__(*a, **kw) + self.wrap_mangling_directives() - if inspect.isfunction(base_directive): - base_func = base_directive - class base_directive(Directive): - required_arguments = base_func.arguments[0] - optional_arguments = base_func.arguments[1] - final_argument_whitespace = base_func.arguments[2] - option_spec = base_func.options - has_content = base_func.content - def run(self): - return base_func(self.name, self.arguments, self.options, - self.content, self.lineno, - self.content_offset, self.block_text, - self.state, self.state_machine) + def wrap_mangling_directives(self): + for name, objtype in self.directive_mangling_map.items(): + self.directives[name] = wrap_mangling_directive( + self.directives[name], objtype) +class NumpyPythonDomain(ManglingDomainBase, PythonDomain): + name = 'np' + directive_mangling_map = { + 'function': 'function', + 'class': 'class', + 'exception': 'class', + 'method': 'function', + 'classmethod': 'function', + 'staticmethod': 'function', + 'attribute': 'attribute', + } + +class NumpyCDomain(ManglingDomainBase, CDomain): + name = 'np-c' + directive_mangling_map = { + 'function': 'function', + 'member': 'attribute', + 'macro': 'function', + 'type': 'class', + 'var': 'object', + } + +def wrap_mangling_directive(base_directive, objtype): class directive(base_directive): def run(self): env = self.state.document.settings.env @@ -173,24 +162,3 @@ return directive -#------------------------------------------------------------------------------ -# Monkeypatch sphinx.ext.autodoc to accept argspecless autodocs (Sphinx < 0.5) -#------------------------------------------------------------------------------ - -def monkeypatch_sphinx_ext_autodoc(): - global _original_format_signature - import sphinx.ext.autodoc - - if sphinx.ext.autodoc.format_signature is our_format_signature: - return - - print "[numpydoc] Monkeypatching sphinx.ext.autodoc ..." - _original_format_signature = sphinx.ext.autodoc.format_signature - sphinx.ext.autodoc.format_signature = our_format_signature - -def our_format_signature(what, obj): - r = mangle_signature(None, what, None, obj, None, None, None) - if r is not None: - return r[0] - else: - return _original_format_signature(what, obj) From numpy-svn at scipy.org Sat Jul 31 00:41:08 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 30 Jul 2010 23:41:08 -0500 (CDT) Subject: [Numpy-svn] r8551 - in trunk/numpy/lib: . tests Message-ID: <20100731044108.A78DC39CD96@scipy.org> Author: rgommers Date: 2010-07-30 23:41:08 -0500 (Fri, 30 Jul 2010) New Revision: 8551 Modified: trunk/numpy/lib/function_base.py trunk/numpy/lib/tests/test_function_base.py Log: ENH: Make trapz work with ndarray subclasses. Thanks to Ryan May. Closes #1438. Modified: trunk/numpy/lib/function_base.py =================================================================== --- trunk/numpy/lib/function_base.py 2010-07-29 20:58:05 UTC (rev 8550) +++ trunk/numpy/lib/function_base.py 2010-07-31 04:41:08 UTC (rev 8551) @@ -2924,7 +2924,7 @@ ----- Given a vector V of length N, the qth percentile of V is the qth ranked value in a sorted copy of V. A weighted average of the two nearest neighbors - is used if the normalized ranking does not match q exactly. + is used if the normalized ranking does not match q exactly. The same as the median if q is 0.5; the same as the min if q is 0; and the same as the max if q is 1 @@ -2962,7 +2962,7 @@ return a.min(axis=axis, out=out) elif q == 100: return a.max(axis=axis, out=out) - + if overwrite_input: if axis is None: sorted = a.ravel() @@ -3072,11 +3072,11 @@ array([ 2., 8.]) """ - y = asarray(y) + y = asanyarray(y) if x is None: d = dx else: - x = asarray(x) + x = asanyarray(x) if x.ndim == 1: d = diff(x) # reshape to correct shape @@ -3090,7 +3090,13 @@ slice2 = [slice(None)]*nd slice1[axis] = slice(1,None) slice2[axis] = slice(None,-1) - return add.reduce(d * (y[slice1]+y[slice2])/2.0,axis) + try: + ret = (d * (y[slice1] +y [slice2]) / 2.0).sum(axis) + except ValueError: # Operations didn't work, cast to ndarray + d = np.asarray(d) + y = np.asarray(y) + ret = add.reduce(d * (y[slice1]+y[slice2])/2.0, axis) + return ret #always succeed def add_newdoc(place, obj, doc): Modified: trunk/numpy/lib/tests/test_function_base.py =================================================================== --- trunk/numpy/lib/tests/test_function_base.py 2010-07-29 20:58:05 UTC (rev 8550) +++ trunk/numpy/lib/tests/test_function_base.py 2010-07-31 04:41:08 UTC (rev 8551) @@ -491,7 +491,33 @@ r = trapz(q, x=z, axis=2) assert_almost_equal(r, qz) + def test_masked(self): + #Testing that masked arrays behave as if the function is 0 where + #masked + x = arange(5) + y = x * x + mask = x == 2 + ym = np.ma.array(y, mask=mask) + r = 13.0 # sum(0.5 * (0 + 1) * 1.0 + 0.5 * (9 + 16)) + assert_almost_equal(trapz(ym, x), r) + xm = np.ma.array(x, mask=mask) + assert_almost_equal(trapz(ym, xm), r) + + xm = np.ma.array(x, mask=mask) + assert_almost_equal(trapz(y, xm), r) + + def test_matrix(self): + #Test to make sure matrices give the same answer as ndarrays + x = linspace(0, 5) + y = x * x + r = trapz(y, x) + mx = matrix(x) + my = matrix(y) + mr = trapz(my, mx) + assert_almost_equal(mr, r) + + class TestSinc(TestCase): def test_simple(self): assert(sinc(0) == 1) From numpy-svn at scipy.org Sat Jul 31 00:44:00 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 30 Jul 2010 23:44:00 -0500 (CDT) Subject: [Numpy-svn] r8552 - in branches/1.5.x/numpy/lib: . tests Message-ID: <20100731044400.434A339CDBF@scipy.org> Author: rgommers Date: 2010-07-30 23:44:00 -0500 (Fri, 30 Jul 2010) New Revision: 8552 Modified: branches/1.5.x/numpy/lib/function_base.py branches/1.5.x/numpy/lib/tests/test_function_base.py Log: ENH: (backport of r8551) Make trapz work with ndarray subclasses. Thanks to Ryan May. Modified: branches/1.5.x/numpy/lib/function_base.py =================================================================== --- branches/1.5.x/numpy/lib/function_base.py 2010-07-31 04:41:08 UTC (rev 8551) +++ branches/1.5.x/numpy/lib/function_base.py 2010-07-31 04:44:00 UTC (rev 8552) @@ -2924,7 +2924,7 @@ ----- Given a vector V of length N, the qth percentile of V is the qth ranked value in a sorted copy of V. A weighted average of the two nearest neighbors - is used if the normalized ranking does not match q exactly. + is used if the normalized ranking does not match q exactly. The same as the median if q is 0.5; the same as the min if q is 0; and the same as the max if q is 1 @@ -2962,7 +2962,7 @@ return a.min(axis=axis, out=out) elif q == 100: return a.max(axis=axis, out=out) - + if overwrite_input: if axis is None: sorted = a.ravel() @@ -3072,11 +3072,11 @@ array([ 2., 8.]) """ - y = asarray(y) + y = asanyarray(y) if x is None: d = dx else: - x = asarray(x) + x = asanyarray(x) if x.ndim == 1: d = diff(x) # reshape to correct shape @@ -3090,7 +3090,13 @@ slice2 = [slice(None)]*nd slice1[axis] = slice(1,None) slice2[axis] = slice(None,-1) - return add.reduce(d * (y[slice1]+y[slice2])/2.0,axis) + try: + ret = (d * (y[slice1] +y [slice2]) / 2.0).sum(axis) + except ValueError: # Operations didn't work, cast to ndarray + d = np.asarray(d) + y = np.asarray(y) + ret = add.reduce(d * (y[slice1]+y[slice2])/2.0, axis) + return ret #always succeed def add_newdoc(place, obj, doc): Modified: branches/1.5.x/numpy/lib/tests/test_function_base.py =================================================================== --- branches/1.5.x/numpy/lib/tests/test_function_base.py 2010-07-31 04:41:08 UTC (rev 8551) +++ branches/1.5.x/numpy/lib/tests/test_function_base.py 2010-07-31 04:44:00 UTC (rev 8552) @@ -491,7 +491,33 @@ r = trapz(q, x=z, axis=2) assert_almost_equal(r, qz) + def test_masked(self): + #Testing that masked arrays behave as if the function is 0 where + #masked + x = arange(5) + y = x * x + mask = x == 2 + ym = np.ma.array(y, mask=mask) + r = 13.0 # sum(0.5 * (0 + 1) * 1.0 + 0.5 * (9 + 16)) + assert_almost_equal(trapz(ym, x), r) + xm = np.ma.array(x, mask=mask) + assert_almost_equal(trapz(ym, xm), r) + + xm = np.ma.array(x, mask=mask) + assert_almost_equal(trapz(y, xm), r) + + def test_matrix(self): + #Test to make sure matrices give the same answer as ndarrays + x = linspace(0, 5) + y = x * x + r = trapz(y, x) + mx = matrix(x) + my = matrix(y) + mr = trapz(my, mx) + assert_almost_equal(mr, r) + + class TestSinc(TestCase): def test_simple(self): assert(sinc(0) == 1) From numpy-svn at scipy.org Sat Jul 31 01:32:55 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 31 Jul 2010 00:32:55 -0500 (CDT) Subject: [Numpy-svn] r8553 - trunk/numpy/core Message-ID: <20100731053255.C928639CDC3@scipy.org> Author: rgommers Date: 2010-07-31 00:32:55 -0500 (Sat, 31 Jul 2010) New Revision: 8553 Modified: trunk/numpy/core/numeric.py Log: BUG: fix base_repr for py3k. strings can not be indexed with floats anymore. Modified: trunk/numpy/core/numeric.py =================================================================== --- trunk/numpy/core/numeric.py 2010-07-31 04:44:00 UTC (rev 8552) +++ trunk/numpy/core/numeric.py 2010-07-31 05:32:55 UTC (rev 8553) @@ -1798,7 +1798,7 @@ res = [] while num: res.append(digits[num % base]) - num /= base + num //= base if padding: res.append('0' * padding) if number < 0: From numpy-svn at scipy.org Sat Jul 31 01:35:06 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 31 Jul 2010 00:35:06 -0500 (CDT) Subject: [Numpy-svn] r8554 - branches/1.5.x/numpy/core Message-ID: <20100731053506.9B96939CDCD@scipy.org> Author: rgommers Date: 2010-07-31 00:35:06 -0500 (Sat, 31 Jul 2010) New Revision: 8554 Modified: branches/1.5.x/numpy/core/numeric.py Log: BUG: (backport of r8553) fix base_repr for py3k. Strings can not be indexed with floats anymore. Modified: branches/1.5.x/numpy/core/numeric.py =================================================================== --- branches/1.5.x/numpy/core/numeric.py 2010-07-31 05:32:55 UTC (rev 8553) +++ branches/1.5.x/numpy/core/numeric.py 2010-07-31 05:35:06 UTC (rev 8554) @@ -1798,7 +1798,7 @@ res = [] while num: res.append(digits[num % base]) - num /= base + num //= base if padding: res.append('0' * padding) if number < 0: From numpy-svn at scipy.org Sat Jul 31 06:02:42 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 31 Jul 2010 05:02:42 -0500 (CDT) Subject: [Numpy-svn] r8555 - trunk/numpy/distutils Message-ID: <20100731100242.E564539CD66@scipy.org> Author: rgommers Date: 2010-07-31 05:02:42 -0500 (Sat, 31 Jul 2010) New Revision: 8555 Modified: trunk/numpy/distutils/npy_pkg_config.py Log: DOC: wiki merge, add distutils.npy_pkg_config.read_config docstring. Modified: trunk/numpy/distutils/npy_pkg_config.py =================================================================== --- trunk/numpy/distutils/npy_pkg_config.py 2010-07-31 05:35:06 UTC (rev 8554) +++ trunk/numpy/distutils/npy_pkg_config.py 2010-07-31 10:02:42 UTC (rev 8555) @@ -325,12 +325,12 @@ if not vars.has_key("pkgdir") and vars.has_key("pkgname"): pkgname = vars["pkgname"] if not pkgname in sys.modules: - raise ValueError("You should import %s to get information on %s" % + raise ValueError("You should import %s to get information on %s" % (pkgname, meta["name"])) mod = sys.modules[pkgname] vars["pkgdir"] = _escape_backslash(os.path.dirname(mod.__file__)) - + return LibraryInfo(name=meta["name"], description=meta["description"], version=meta["version"], sections=sections, vars=VariableSet(vars)) @@ -340,6 +340,44 @@ # problem in practice _CACHE = {} def read_config(pkgname, dirs=None): + """ + Return library info for a package from its configuration file. + + Parameters + ---------- + pkgname : str + Name of the package (should match the name of the .ini file, without + the extension, e.g. foo for the file foo.ini). + dirs : sequence, optional + If given, should be a sequence of directories - usually including + the NumPy base directory - where to look for npy-pkg-config files. + + Returns + ------- + pkginfo : class instance + The `LibraryInfo` instance containing the build information. + + Raises + ------ + PkgNotFound + If the package is not found. + + See Also + -------- + misc_util.get_info, misc_util.get_pkg_info + + Examples + -------- + >>> npymath_info = np.distutils.npy_pkg_config.read_config('npymath') + >>> type(npymath_info) + + >>> print npymath_info + Name: npymath + Description: Portable, core math library implementing C99 standard + Requires: + Version: 0.1 #random + + """ try: return _CACHE[pkgname] except KeyError: From numpy-svn at scipy.org Sat Jul 31 06:02:56 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 31 Jul 2010 05:02:56 -0500 (CDT) Subject: [Numpy-svn] r8556 - trunk/numpy Message-ID: <20100731100256.6A84939CDCE@scipy.org> Author: rgommers Date: 2010-07-31 05:02:56 -0500 (Sat, 31 Jul 2010) New Revision: 8556 Modified: trunk/numpy/add_newdocs.py Log: DOC: wiki merge, add itemset method doc. Modified: trunk/numpy/add_newdocs.py =================================================================== --- trunk/numpy/add_newdocs.py 2010-07-31 10:02:42 UTC (rev 8555) +++ trunk/numpy/add_newdocs.py 2010-07-31 10:02:56 UTC (rev 8556) @@ -2566,6 +2566,52 @@ """)) +add_newdoc('numpy.core.multiarray', 'ndarray', ('itemset', + """ + a.itemset(*args) + + Insert scalar into an array (scalar is cast to array's dtype, if possible) + + There must be at least 1 argument, and define the last argument + as *item*. Then, ``a.itemset(*args)`` is equivalent to but faster + than ``a[args] = item``. The item should be a scalar value and `args` + must select a single item in the array `a`. + + Parameters + ---------- + \*args : Arguments + If one argument: a scalar, only used in case `a` is of size 1. + If two arguments: the last argument is the value to be set + and must be a scalar, the first argument specifies a single array + element location. It is either an int or a tuple. + + Notes + ----- + Compared to indexing syntax, `itemset` provides some speed increase + for placing a scalar into a particular location in an `ndarray`, + if you must do this. However, generally this is discouraged: + among other problems, it complicates the appearance of the code. + Also, when using `itemset` (and `item`) inside a loop, be sure + to assign the methods to a local variable to avoid the attribute + look-up at each loop iteration. + + Examples + -------- + >>> x = np.random.randint(9, size=(3, 3)) + >>> x + array([[3, 1, 7], + [2, 8, 3], + [8, 5, 3]]) + >>> x.itemset(4, 0) + >>> x.itemset((2, 2), 9) + >>> x + array([[3, 1, 7], + [2, 0, 3], + [8, 5, 9]]) + + """)) + + add_newdoc('numpy.core.multiarray', 'ndarray', ('max', """ a.max(axis=None, out=None) @@ -3990,10 +4036,10 @@ add_newdoc('numpy.core', 'ufunc', ('identity', """ The identity value. - + Data attribute containing the identity element for the ufunc, if it has one. If it does not, the attribute value is None. - + Examples -------- >>> np.add.identity @@ -4009,15 +4055,15 @@ add_newdoc('numpy.core', 'ufunc', ('nargs', """ The number of arguments. - + Data attribute containing the number of arguments the ufunc takes, including optional ones. - + Notes ----- Typically this value will be one more than what you might expect because all ufuncs take the optional "out" argument. - + Examples -------- >>> np.add.nargs @@ -4033,9 +4079,9 @@ add_newdoc('numpy.core', 'ufunc', ('nin', """ The number of inputs. - + Data attribute containing the number of arguments the ufunc treats as input. - + Examples -------- >>> np.add.nin @@ -4051,13 +4097,13 @@ add_newdoc('numpy.core', 'ufunc', ('nout', """ The number of outputs. - + Data attribute containing the number of arguments the ufunc treats as output. - + Notes ----- Since all ufuncs can take output arguments, this will always be (at least) 1. - + Examples -------- >>> np.add.nout @@ -4074,14 +4120,14 @@ add_newdoc('numpy.core', 'ufunc', ('ntypes', """ The number of types. - + The number of numerical NumPy types - of which there are 18 total - on which the ufunc can operate. - + See Also -------- numpy.ufunc.types - + Examples -------- >>> np.add.ntypes From numpy-svn at scipy.org Sat Jul 31 06:03:15 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 31 Jul 2010 05:03:15 -0500 (CDT) Subject: [Numpy-svn] r8557 - in trunk/doc/source: reference user Message-ID: <20100731100315.16B7B39CDD3@scipy.org> Author: rgommers Date: 2010-07-31 05:03:14 -0500 (Sat, 31 Jul 2010) New Revision: 8557 Modified: trunk/doc/source/reference/arrays.dtypes.rst trunk/doc/source/user/basics.byteswapping.rst trunk/doc/source/user/index.rst trunk/doc/source/user/install.rst Log: DOC: wiki merge, rst docs. Modified: trunk/doc/source/reference/arrays.dtypes.rst =================================================================== --- trunk/doc/source/reference/arrays.dtypes.rst 2010-07-31 10:02:56 UTC (rev 8556) +++ trunk/doc/source/reference/arrays.dtypes.rst 2010-07-31 10:03:14 UTC (rev 8557) @@ -246,7 +246,7 @@ on the shape if it is greater than 1-d. NumPy allows a modification on the format in that any string that can uniquely identify the type can be used to specify the data-type in a field. - The generated data-type fields are named ``'f0'``, ``'f2'``, ..., + The generated data-type fields are named ``'f0'``, ``'f1'``, ..., ``'f'`` where N (>1) is the number of comma-separated basic formats in the string. If the optional shape specifier is provided, then the data-type for the corresponding field describes a sub-array. Modified: trunk/doc/source/user/basics.byteswapping.rst =================================================================== --- trunk/doc/source/user/basics.byteswapping.rst 2010-07-31 10:02:56 UTC (rev 8556) +++ trunk/doc/source/user/basics.byteswapping.rst 2010-07-31 10:03:14 UTC (rev 8557) @@ -1,5 +1,5 @@ -************ -Broadcasting -************ +************* +Byte-swapping +************* .. automodule:: numpy.doc.byteswapping Modified: trunk/doc/source/user/index.rst =================================================================== --- trunk/doc/source/user/index.rst 2010-07-31 10:02:56 UTC (rev 8556) +++ trunk/doc/source/user/index.rst 2010-07-31 10:03:14 UTC (rev 8557) @@ -13,12 +13,16 @@ This "User Guide" is still a work in progress; some of the material is not organized, and several aspects of NumPy are not yet covered - in sufficient detail. However, we are continually working to - improve the documentation. + sufficient detail. We are an open source community continually + working to improve the documentation and eagerly encourage interested + parties to contribute. For information on how to do so, please visit + the NumPy `doc wiki `_. More documentation for NumPy can be found on the `numpy.org `__ website. + Thanks! + .. toctree:: :maxdepth: 2 Modified: trunk/doc/source/user/install.rst =================================================================== --- trunk/doc/source/user/install.rst 2010-07-31 10:02:56 UTC (rev 8556) +++ trunk/doc/source/user/install.rst 2010-07-31 10:03:14 UTC (rev 8557) @@ -15,11 +15,21 @@ `_ (which provides binary installers for Windows, OS X and Redhat) and `Python (x, y) `_. Both of these packages include Python, NumPy and -many additional packages. A lightweight alternative is to download the Python +many additional packages. + +A lightweight alternative is to download the Python installer from `www.python.org `_ and the NumPy installer for your Python version from the Sourceforge `download site `_ +The NumPy installer includes binaries for different CPU's (without SSE +instructions, with SSE2 or with SSE3) and installs the correct one +automatically. If needed, this can be bypassed from the command line with :: + + numpy-<1.y.z>-superpack-win32.exe /arch nosse + +or 'sse2' or 'sse3' instead of 'nosse'. + Linux ----- @@ -95,15 +105,15 @@ Choosing the fortran compiler ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -To build with g77: +To build with g77:: python setup.py build --fcompiler=gnu -To build with gfortran: +To build with gfortran:: python setup.py build --fcompiler=gnu95 -For more information see: +For more information see:: python setup.py build --help-fcompiler @@ -116,19 +126,27 @@ has been used. If both are dependencies, this means both have been used, which is almost always a very bad idea. +Disabling ATLAS and other accelerater libraries +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Usage of ATLAS and other accelerated libraries in Numpy can be disabled +via:: + + BLAS=None LAPACK=None ATLAS=None python setup.py build + Building with ATLAS support --------------------------- Ubuntu 8.10 (Intrepid) and 9.04 (Jaunty) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -You can install the necessary packages for optimized ATLAS with this command: +You can install the necessary packages for optimized ATLAS with this command:: sudo apt-get install libatlas-base-dev If you have a recent CPU with SIMD suppport (SSE, SSE2, etc...), you should also install the corresponding package for optimal performances. For example, -for SSE2: +for SSE2:: sudo apt-get install libatlas3gf-sse2 @@ -142,12 +160,12 @@ Ubuntu 8.04 and lower ~~~~~~~~~~~~~~~~~~~~~ -You can install the necessary packages for optimized ATLAS with this command: +You can install the necessary packages for optimized ATLAS with this command:: sudo apt-get install atlas3-base-dev If you have a recent CPU with SIMD suppport (SSE, SSE2, etc...), you should also install the corresponding package for optimal performances. For example, -for SSE2: +for SSE2:: sudo apt-get install atlas3-sse2 From numpy-svn at scipy.org Sat Jul 31 06:03:31 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 31 Jul 2010 05:03:31 -0500 (CDT) Subject: [Numpy-svn] r8558 - trunk/numpy/core Message-ID: <20100731100331.1DF5639CDD6@scipy.org> Author: rgommers Date: 2010-07-31 05:03:30 -0500 (Sat, 31 Jul 2010) New Revision: 8558 Modified: trunk/numpy/core/fromnumeric.py Log: DOC: wiki merge, fromnumeric.py Modified: trunk/numpy/core/fromnumeric.py =================================================================== --- trunk/numpy/core/fromnumeric.py 2010-07-31 10:03:14 UTC (rev 8557) +++ trunk/numpy/core/fromnumeric.py 2010-07-31 10:03:30 UTC (rev 8558) @@ -810,25 +810,25 @@ """ Return a new array with the specified shape. - If the new array is larger than the original array, then the new array - is filled with repeated copied of `a`. Note that this behavior is different - from a.resize(new_shape) which fills with zeros instead of repeated - copies of `a`. + If the new array is larger than the original array, then the new + array is filled with repeated copies of `a`. Note that this behavior + is different from a.resize(new_shape) which fills with zeros instead + of repeated copies of `a`. Parameters ---------- a : array_like Array to be resized. - new_shape : {tuple, int} + new_shape : int or tuple of int Shape of resized array. Returns ------- reshaped_array : ndarray The new array is formed from the data in the old array, repeated - if necessary to fill out the required number of elements. The data - are repeated in the order that the data are stored in memory. + if necessary to fill out the required number of elements. The + data are repeated in the order that they are stored in memory. See Also -------- @@ -903,33 +903,34 @@ Return specified diagonals. If `a` is 2-D, returns the diagonal of `a` with the given offset, - i.e., the collection of elements of the form `a[i,i+offset]`. - If `a` has more than two dimensions, then the axes specified - by `axis1` and `axis2` are used to determine the 2-D subarray - whose diagonal is returned. The shape of the resulting array - can be determined by removing `axis1` and `axis2` and appending - an index to the right equal to the size of the resulting diagonals. + i.e., the collection of elements of the form ``a[i, i+offset]``. If + `a` has more than two dimensions, then the axes specified by `axis1` + and `axis2` are used to determine the 2-D sub-array whose diagonal is + returned. The shape of the resulting array can be determined by + removing `axis1` and `axis2` and appending an index to the right equal + to the size of the resulting diagonals. Parameters ---------- a : array_like Array from which the diagonals are taken. offset : int, optional - Offset of the diagonal from the main diagonal. Can be both positive - and negative. Defaults to main diagonal (0). + Offset of the diagonal from the main diagonal. Can be positive or + negative. Defaults to main diagonal (0). axis1 : int, optional - Axis to be used as the first axis of the 2-D subarrays from which - the diagonals should be taken. Defaults to first axis (0). + Axis to be used as the first axis of the 2-D sub-arrays from which + the diagonals should be taken. Defaults to first axis (0). axis2 : int, optional - Axis to be used as the second axis of the 2-D subarrays from which - the diagonals should be taken. Defaults to second axis (1). + Axis to be used as the second axis of the 2-D sub-arrays from + which the diagonals should be taken. Defaults to second axis (1). Returns ------- array_of_diagonals : ndarray - If `a` is 2-D, a 1-D array containing the diagonal is - returned. If `a` has larger dimensions, then an array of - diagonals is returned. + If `a` is 2-D, a 1-D array containing the diagonal is returned. + If the dimension of `a` is larger, then an array of diagonals is + returned, "packed" from left-most dimension to right-most (e.g., + if `a` is 3-D, then the diagonals are "packed" along rows). Raises ------ @@ -938,7 +939,7 @@ See Also -------- - diag : Matlab workalike for 1-D and 2-D arrays. + diag : MATLAB work-a-like for 1-D and 2-D arrays. diagflat : Create diagonal arrays. trace : Sum along diagonals. @@ -953,16 +954,30 @@ >>> a.diagonal(1) array([1]) - >>> a = np.arange(8).reshape(2,2,2) - >>> a + A 3-D example: + + >>> a = np.arange(8).reshape(2,2,2); a array([[[0, 1], [2, 3]], [[4, 5], [6, 7]]]) - >>> a.diagonal(0,-2,-1) - array([[0, 3], - [4, 7]]) + >>> a.diagonal(0, # Main diagonals of two arrays created by skipping + ... 0, # across the outer(left)-most axis last and + ... 1) # the "middle" (row) axis first. + array([[0, 6], + [1, 7]]) + The sub-arrays whose main diagonals we just obtained; note that each + corresponds to fixing the right-most (column) axis, and that the + diagonals are "packed" in rows. + + >>> a[:,:,0] # main diagonal is [0 6] + array([[0, 2], + [4, 6]]) + >>> a[:,:,1] # main diagonal is [1 7] + array([[1, 3], + [5, 7]]) + """ return asarray(a).diagonal(offset, axis1, axis2) @@ -1470,33 +1485,33 @@ a : array_like Input array or object that can be converted to an array. axis : int, optional - Axis along which a logical OR is performed. - The default (`axis` = `None`) is to perform a logical OR - over a flattened input array. `axis` may be negative, in which - case it counts from the last to the first axis. + Axis along which a logical OR is performed. The default + (`axis` = `None`) is to perform a logical OR over a flattened + input array. `axis` may be negative, in which case it counts + from the last to the first axis. out : ndarray, optional - Alternative output array in which to place the result. - It must have the same shape as the expected output and - the type is preserved. See `doc.ufuncs` (Section - "Output arguments") for details. + Alternate output array in which to place the result. It must have + the same shape as the expected output and its type is preserved + (e.g., if it is of type float, then it will remain so, returning + 1.0 for True and 0.0 for False, regardless of the type of `a`). + See `doc.ufuncs` (Section "Output arguments") for details. Returns ------- - any : bool, ndarray - A new boolean or `ndarray` is returned unless `out` is - specified, in which case a reference to `out` is returned. + any : bool or ndarray + A new boolean or `ndarray` is returned unless `out` is specified, + in which case a reference to `out` is returned. See Also -------- ndarray.any : equivalent method - all : Test whether all array elements along a given axis evaluate - to True. + all : Test whether all elements along a given axis evaluate to True. Notes ----- - Not a Number (NaN), positive infinity and negative infinity - evaluate to `True` because these are not equal to zero. + Not a Number (NaN), positive infinity and negative infinity evaluate + to `True` because these are not equal to zero. Examples -------- @@ -1541,25 +1556,26 @@ axis : int, optional Axis along which a logical AND is performed. The default (`axis` = `None`) is to perform a logical AND - over a flattened input array. `axis` may be negative, in which + over a flattened input array. `axis` may be negative, in which case it counts from the last to the first axis. out : ndarray, optional - Alternative output array in which to place the result. - It must have the same shape as the expected output and - the type is preserved. See `doc.ufuncs` (Section "Output - arguments") for more details. + Alternate output array in which to place the result. + It must have the same shape as the expected output and its + type is preserved (e.g., if ``dtype(out)`` is float, the result + will consist of 0.0's and 1.0's). See `doc.ufuncs` (Section + "Output arguments") for more details. Returns ------- all : ndarray, bool - A new boolean or array is returned unless `out` is - specified, in which case a reference to `out` is returned. + A new boolean or array is returned unless `out` is specified, + in which case a reference to `out` is returned. See Also -------- ndarray.all : equivalent method - any : Test whether any array element along a given axis evaluates to True. + any : Test whether any element along a given axis evaluates to True. Notes ----- @@ -1735,26 +1751,26 @@ axis : int, optional Axis along which to operate. By default flattened input is used. out : ndarray, optional - Alternative output array in which to place the result. Must - be of the same shape and buffer length as the expected output. - See `doc.ufuncs` (Section "Output arguments") for more details. + Alternate output array in which to place the result. Must be of + the same shape and buffer length as the expected output. See + `doc.ufuncs` (Section "Output arguments") for more details. Returns ------- amax : ndarray - A new array or a scalar array with the result. + A new array or scalar array with the result. See Also -------- - nanmax : nan values are ignored instead of being propagated - fmax : same behavior as the C99 fmax function - argmax : Indices of the maximum values. + nanmax : NaN values are ignored instead of being propagated. + fmax : same behavior as the C99 fmax function. + argmax : indices of the maximum values. Notes ----- - NaN values are propagated, that is if at least one item is nan, the - corresponding max value will be nan as well. To ignore NaN values (matlab - behavior), please use nanmax. + NaN values are propagated, that is if at least one item is NaN, the + corresponding max value will be NaN as well. To ignore NaN values + (MATLAB behavior), please use nanmax. Examples -------- @@ -1969,14 +1985,14 @@ a : array_like Input array. axis : int, optional - Axis along which the cumulative product is computed. By default the - input is flattened. + Axis along which the cumulative product is computed. By default + the input is flattened. dtype : dtype, optional Type of the returned array, as well as of the accumulator in which - the elements are multiplied. If dtype is not specified, it defaults - to the dtype of `a`, unless `a` has an integer dtype with a precision - less than that of the default platform integer. In that case, the - default platform integer is used instead. + the elements are multiplied. If *dtype* is not specified, it + defaults to the dtype of `a`, unless `a` has an integer dtype with + a precision less than that of the default platform integer. In + that case, the default platform integer is used instead. out : ndarray, optional Alternative output array in which to place the result. It must have the same shape and buffer length as the expected output @@ -2007,15 +2023,13 @@ >>> np.cumprod(a, dtype=float) # specify type of output array([ 1., 2., 6., 24., 120., 720.]) - The cumulative product for each column (i.e., over the rows of) - `a`: + The cumulative product for each column (i.e., over the rows) of `a`: >>> np.cumprod(a, axis=0) array([[ 1, 2, 3], [ 4, 10, 18]]) - The cumulative product for each row (i.e. over the columns of) - `a`: + The cumulative product for each row (i.e. over the columns) of `a`: >>> np.cumprod(a,axis=1) array([[ 1, 2, 6], @@ -2253,10 +2267,9 @@ """ Compute the arithmetic mean along the specified axis. - Returns the average of the array elements. The average is taken - over the flattened array by default, otherwise over the specified - axis. float64 intermediate and return values are used for integer - inputs. + Returns the average of the array elements. The average is taken over + the flattened array by default, otherwise over the specified axis. + `float64` intermediate and return values are used for integer inputs. Parameters ---------- @@ -2266,14 +2279,15 @@ axis : int, optional Axis along which the means are computed. The default is to compute the mean of the flattened array. - dtype : dtype, optional - Type to use in computing the mean. For integer inputs, the default - is float64; for floating point, inputs it is the same as the input - dtype. + dtype : data-type, optional + Type to use in computing the mean. For integer inputs, the default + is `float64`; for floating point inputs, it is the same as the + input dtype. out : ndarray, optional - Alternative output array in which to place the result. It must have - the same shape as the expected output but the type will be cast if - necessary. See `doc.ufuncs` for details. + Alternate output array in which to place the result. The default + is ``None``; if provided, it must have the same shape as the + expected output, but the type will be cast if necessary. + See `doc.ufuncs` for details. Returns ------- @@ -2290,11 +2304,11 @@ The arithmetic mean is the sum of the elements along the axis divided by the number of elements. - Note that for floating-point input, the mean is computed using the same - precision the input has. Depending on the input data, this can cause - the results to be inaccurate, especially for float32 (see example below). - Specifying a higher-accuracy accumulator using the `dtype` keyword can - alleviate this issue. + Note that for floating-point input, the mean is computed using the + same precision the input has. Depending on the input data, this can + cause the results to be inaccurate, especially for `float32` (see + example below). Specifying a higher-precision accumulator using the + `dtype` keyword can alleviate this issue. Examples -------- @@ -2425,35 +2439,35 @@ Compute the variance along the specified axis. Returns the variance of the array elements, a measure of the spread of a - distribution. The variance is computed for the flattened array by default, - otherwise over the specified axis. + distribution. The variance is computed for the flattened array by + default, otherwise over the specified axis. Parameters ---------- a : array_like - Array containing numbers whose variance is desired. If `a` is not an + Array containing numbers whose variance is desired. If `a` is not an array, a conversion is attempted. axis : int, optional - Axis along which the variance is computed. The default is to compute + Axis along which the variance is computed. The default is to compute the variance of the flattened array. - dtype : dtype, optional - Type to use in computing the variance. For arrays of integer type - the default is float32; for arrays of float types it is the same as + dtype : data-type, optional + Type to use in computing the variance. For arrays of integer type + the default is `float32`; for arrays of float types it is the same as the array type. out : ndarray, optional - Alternative output array in which to place the result. It must have - the same shape as the expected output but the type is cast if + Alternate output array in which to place the result. It must have + the same shape as the expected output, but the type is cast if necessary. ddof : int, optional - "Delta Degrees of Freedom": the divisor used in calculation is + "Delta Degrees of Freedom": the divisor used in the calculation is ``N - ddof``, where ``N`` represents the number of elements. By default `ddof` is zero. Returns ------- variance : ndarray, see dtype parameter above - If out=None, returns a new array containing the variance; otherwise - a reference to the output array is returned. + If ``out=None``, returns a new array containing the variance; + otherwise, a reference to the output array is returned. See Also -------- @@ -2468,19 +2482,19 @@ The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is specified, the divisor ``N - ddof`` is used - instead. In standard statistical practice, ``ddof=1`` provides an - unbiased estimator of the variance of the infinite population. ``ddof=0`` - provides a maximum likelihood estimate of the variance for normally - distributed variables. + instead. In standard statistical practice, ``ddof=1`` provides an + unbiased estimator of the variance of a hypothetical infinite population. + ``ddof=0`` provides a maximum likelihood estimate of the variance for + normally distributed variables. Note that for complex numbers, the absolute value is taken before squaring, so that the result is always real and nonnegative. For floating-point input, the variance is computed using the same - precision the input has. Depending on the input data, this can cause - the results to be inaccurate, especially for float32 (see example below). - Specifying a higher-accuracy accumulator using the `dtype` keyword can - alleviate this issue. + precision the input has. Depending on the input data, this can cause + the results to be inaccurate, especially for `float32` (see example + below). Specifying a higher-accuracy accumulator using the ``dtype`` + keyword can alleviate this issue. Examples -------- From numpy-svn at scipy.org Sat Jul 31 06:03:46 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 31 Jul 2010 05:03:46 -0500 (CDT) Subject: [Numpy-svn] r8559 - trunk/numpy/core Message-ID: <20100731100346.C6DE339CDD7@scipy.org> Author: rgommers Date: 2010-07-31 05:03:46 -0500 (Sat, 31 Jul 2010) New Revision: 8559 Modified: trunk/numpy/core/numeric.py Log: DOC: wiki merge, core/numeric.py Modified: trunk/numpy/core/numeric.py =================================================================== --- trunk/numpy/core/numeric.py 2010-07-31 10:03:30 UTC (rev 8558) +++ trunk/numpy/core/numeric.py 2010-07-31 10:03:46 UTC (rev 8559) @@ -69,13 +69,13 @@ Parameters ---------- a : array_like - The shape and data-type of `a` define the parameters of + The shape and data-type of `a` define these same attributes of the returned array. Returns ------- out : ndarray - Array of zeros with same shape and type as `a`. + Array of zeros with the same shape and type as `a`. See Also -------- @@ -124,7 +124,7 @@ Parameters ---------- a : array_like - The shape and data-type of `a` define the parameters of the + The shape and data-type of `a` define these same attributes of the returned array. Returns @@ -143,8 +143,8 @@ Notes ----- This function does *not* initialize the returned array; to do that use - `zeros_like` or `ones_like` instead. It may be marginally faster than the - functions that do set the array values. + `zeros_like` or `ones_like` instead. It may be marginally faster than + the functions that do set the array values. Examples -------- @@ -154,7 +154,7 @@ [ 0, 0, -1073741821]]) >>> a = np.array([[1., 2., 3.],[4.,5.,6.]]) >>> np.empty_like(a) - array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000], #random + array([[ -2.00000715e+000, 1.48219694e-323, -2.00000572e+000],#random [ 4.38791518e-305, -2.00000715e+000, 4.17269252e-309]]) """ @@ -285,14 +285,14 @@ def asanyarray(a, dtype=None, order=None): """ - Convert the input to a ndarray, but pass ndarray subclasses through. + Convert the input to an ndarray, but pass ndarray subclasses through. Parameters ---------- a : array_like Input data, in any form that can be converted to an array. This includes scalars, lists, lists of tuples, tuples, tuples of tuples, - tuples of lists and ndarrays. + tuples of lists, and ndarrays. dtype : data-type, optional By default, the data-type is inferred from the input data. order : {'C', 'F'}, optional @@ -312,7 +312,8 @@ asfarray : Convert input to a floating point ndarray. asfortranarray : Convert input to an ndarray with column-major memory order. - asarray_chkfinite : Similar function which checks input for NaNs and Infs. + asarray_chkfinite : Similar function which checks input for NaNs and + Infs. fromiter : Create an array from an iterator. fromfunction : Construct an array by executing a function on grid positions. @@ -1133,7 +1134,8 @@ The axis to roll backwards. The positions of the other axes do not change relative to one another. start : int, optional - The axis is rolled until it lies before this position. + The axis is rolled until it lies before this position. The default, + 0, results in a "complete" roll. Returns ------- @@ -1143,7 +1145,7 @@ See Also -------- roll : Roll the elements of an array by a number of positions along a - given axis. + given axis. Examples -------- @@ -1400,23 +1402,25 @@ """ Return a string representation of the data in an array. - The data in the array is returned as a single string. This function - is similar to `array_repr`, the difference is that `array_repr` also - returns information on the type of array and data type. + The data in the array is returned as a single string. This function is + similar to `array_repr`, the difference being that `array_repr` also + returns information on the kind of array and its data type. Parameters ---------- a : ndarray Input array. max_line_width : int, optional - Inserts newlines if text is longer than `max_line_width`. + Inserts newlines if text is longer than `max_line_width`. The + default is, indirectly, 75. precision : int, optional - Floating point precision. Default is the current printing precision - (usually 8), which can be altered using set_printoptions. + Floating point precision. Default is the current printing precision + (usually 8), which can be altered using `set_printoptions`. suppress_small : bool, optional - Represent very small numbers as zero, default is False. Very small is - defined by precision, if the precision is 8 then numbers smaller than - 5e-9 are represented as zero. + Represent numbers "very close" to zero as zero; default is False. + Very close is defined by precision: if the precision is 8, e.g., + numbers smaller (in absolute value) than 5e-9 are represented as + zero. See Also -------- @@ -1844,11 +1848,11 @@ """ Return a new array of given shape and type, filled with ones. - Please refer to the documentation for `zeros`. + Please refer to the documentation for `zeros` for further details. See Also -------- - zeros + zeros, ones_like Examples -------- From numpy-svn at scipy.org Sat Jul 31 06:04:03 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 31 Jul 2010 05:04:03 -0500 (CDT) Subject: [Numpy-svn] r8560 - trunk/numpy/core/code_generators Message-ID: <20100731100403.AF7CF39CDD9@scipy.org> Author: rgommers Date: 2010-07-31 05:04:03 -0500 (Sat, 31 Jul 2010) New Revision: 8560 Modified: trunk/numpy/core/code_generators/ufunc_docstrings.py Log: DOC: wiki merge, core.umath Modified: trunk/numpy/core/code_generators/ufunc_docstrings.py =================================================================== --- trunk/numpy/core/code_generators/ufunc_docstrings.py 2010-07-31 10:03:46 UTC (rev 8559) +++ trunk/numpy/core/code_generators/ufunc_docstrings.py 2010-07-31 10:04:03 UTC (rev 8560) @@ -20,7 +20,7 @@ Returns ------- - res : ndarray + absolute : ndarray An ndarray containing the absolute value of each element in `x`. For complex input, ``a + ib``, the absolute value is :math:`\\sqrt{ a^2 + b^2 }`. @@ -56,12 +56,14 @@ Parameters ---------- x1, x2 : array_like - The arrays to be added. + The arrays to be added. If ``x1.shape != x2.shape``, they must be + broadcastable to a common shape (which may be the shape of one or + the other). Returns ------- - y : {ndarray, scalar} - The sum of `x1` and `x2`, element-wise. Returns scalar if + y : ndarray or scalar + The sum of `x1` and `x2`, element-wise. Returns a scalar if both `x1` and `x2` are scalars. Notes @@ -112,25 +114,23 @@ Notes ----- `arccos` is a multivalued function: for each `x` there are infinitely - many numbers `z` such that `cos(z) = x`. The convention is to return the - angle `z` whose real part lies in `[0, pi]`. + many numbers `z` such that `cos(z) = x`. The convention is to return + the angle `z` whose real part lies in `[0, pi]`. For real-valued input data types, `arccos` always returns real output. - For each value that cannot be expressed as a real number or infinity, it - yields ``nan`` and sets the `invalid` floating point error flag. + For each value that cannot be expressed as a real number or infinity, + it yields ``nan`` and sets the `invalid` floating point error flag. - For complex-valued input, `arccos` is a complex analytical function that - has branch cuts `[-inf, -1]` and `[1, inf]` and is continuous from above - on the former and from below on the latter. + For complex-valued input, `arccos` is a complex analytic function that + has branch cuts `[-inf, -1]` and `[1, inf]` and is continuous from + above on the former and from below on the latter. The inverse `cos` is also known as `acos` or cos^-1. References ---------- - .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", - 10th printing, 1964, pp. 79. http://www.math.sfu.ca/~cbm/aands/ - .. [2] Wikipedia, "Inverse trigonometric function", - http://en.wikipedia.org/wiki/Inverse_trigonometric_function + M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", + 10th printing, 1964, pp. 79. http://www.math.sfu.ca/~cbm/aands/ Examples -------- @@ -204,23 +204,23 @@ add_newdoc('numpy.core.umath', 'arcsin', """ - Inverse sine elementwise. + Inverse sine, element-wise. Parameters ---------- x : array_like - `y`-coordinate on the unit circle. + `y`-coordinate on the unit circle. out : ndarray, optional - Array of the same shape as `x`, to store results in. See - `doc.ufuncs` (Section "Output arguments") for more details. + Array of the same shape as `x`, in which to store the results. + See `doc.ufuncs` (Section "Output arguments") for more details. Returns ------- angle : ndarray - The angle of the ray intersecting the unit circle at the given - `y`-coordinate in radians ``[-pi, pi]``. If `x` is a scalar then - a scalar is returned, otherwise an array is returned. + The inverse sine of each element in `x`, in radians and in the + closed interval ``[-pi/2, pi/2]``. If `x` is a scalar, a scalar + is returned, otherwise an array. See Also -------- @@ -229,25 +229,24 @@ Notes ----- `arcsin` is a multivalued function: for each `x` there are infinitely - many numbers `z` such that `sin(z) = x`. The convention is to return the - angle `z` whose real part lies in `[-pi/2, pi/2]`. + many numbers `z` such that :math:`sin(z) = x`. The convention is to + return the angle `z` whose real part lies in [-pi/2, pi/2]. - For real-valued input data types, `arcsin` always returns real output. - For each value that cannot be expressed as a real number or infinity, it - yields ``nan`` and sets the `invalid` floating point error flag. + For real-valued input data types, *arcsin* always returns real output. + For each value that cannot be expressed as a real number or infinity, + it yields ``nan`` and sets the `invalid` floating point error flag. - For complex-valued input, `arcsin` is a complex analytical function that - has branch cuts `[-inf, -1]` and `[1, inf]` and is continuous from above - on the former and from below on the latter. + For complex-valued input, `arcsin` is a complex analytic function that + has, by convention, the branch cuts [-inf, -1] and [1, inf] and is + continuous from above on the former and from below on the latter. - The inverse sine is also known as `asin` or ``sin^-1``. + The inverse sine is also known as `asin` or sin^{-1}. References ---------- - .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", - 10th printing, 1964, pp. 79. http://www.math.sfu.ca/~cbm/aands/ - .. [2] Wikipedia, "Inverse trigonometric function", - http://en.wikipedia.org/wiki/Inverse_trigonometric_function + Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, + 10th printing, New York: Dover, 1964, pp. 79ff. + http://www.math.sfu.ca/~cbm/aands/ Examples -------- @@ -311,8 +310,7 @@ """ Trigonometric inverse tangent, element-wise. - The inverse of tan, so that if ``y = tan(x)`` then - ``x = arctan(y)``. + The inverse of tan, so that if ``y = tan(x)`` then ``x = arctan(y)``. Parameters ---------- @@ -322,39 +320,41 @@ Returns ------- out : ndarray - Out has the same shape as `x`. Its real part is - in ``[-pi/2, pi/2]``. It is a scalar if `x` is a scalar. + Out has the same shape as `x`. Its real part is in + ``[-pi/2, pi/2]`` (``arctan(+/-inf)`` returns ``+/-pi/2``). + It is a scalar if `x` is a scalar. See Also -------- - arctan2 : Calculate the arctan of y/x. + arctan2 : The "four quadrant" arctan of the angle formed by (`x`, `y`) + and the positive `x`-axis. + angle : Argument of complex values. Notes ----- - `arctan` is a multivalued function: for each `x` there are infinitely - many numbers `z` such that `tan(z) = x`. The convention is to return the - angle `z` whose real part lies in `[-pi/2, pi/2]`. + `arctan` is a multi-valued function: for each `x` there are infinitely + many numbers `z` such that tan(`z`) = `x`. The convention is to return + the angle `z` whose real part lies in [-pi/2, pi/2]. For real-valued input data types, `arctan` always returns real output. - For each value that cannot be expressed as a real number or infinity, it - yields ``nan`` and sets the `invalid` floating point error flag. + For each value that cannot be expressed as a real number or infinity, + it yields ``nan`` and sets the `invalid` floating point error flag. - For complex-valued input, `arctan` is a complex analytical function that - has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from the - left on the former and from the right on the latter. + For complex-valued input, `arctan` is a complex analytic function that + has [`1j, infj`] and [`-1j, -infj`] as branch cuts, and is continuous + from the left on the former and from the right on the latter. - The inverse tangent is also known as `atan` or ``tan^-1``. + The inverse tangent is also known as `atan` or tan^{-1}. References ---------- - .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", - 10th printing, 1964, pp. 79. http://www.math.sfu.ca/~cbm/aands/ - .. [2] Wikipedia, "Inverse trigonometric function", - http://en.wikipedia.org/wiki/Arctan + Abramowitz, M. and Stegun, I. A., *Handbook of Mathematical Functions*, + 10th printing, New York: Dover, 1964, pp. 79. + http://www.math.sfu.ca/~cbm/aands/ Examples -------- - We expect the arctan of 0 to be 0, and of 1 to be :math:`\\pi/4`: + We expect the arctan of 0 to be 0, and of 1 to be pi/4: >>> np.arctan([0, 1]) array([ 0. , 0.78539816]) @@ -374,22 +374,27 @@ add_newdoc('numpy.core.umath', 'arctan2', """ - Elementwise arc tangent of ``x1/x2`` choosing the quadrant correctly. + Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly. - The quadrant (ie. branch) is chosen so that ``arctan2(x1, x2)`` - is the signed angle in radians between the line segments - ``(0,0) - (1,0)`` and ``(0,0) - (x2,x1)``. This function is defined - also for `x2` = 0. + The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is + the signed angle in radians between the ray ending at the origin and + passing through the point (1,0), and the ray ending at the origin and + passing through the point (`x2`, `x1`). (Note the role reversal: the + "`y`-coordinate" is the first function parameter, the "`x`-coordinate" + is the second.) By IEEE convention, this function is defined for + `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see + Notes for specific values). - `arctan2` is not defined for complex-valued arguments. + This function is not defined for complex-valued arguments; for the + so-called argument of complex values, use `angle`. Parameters ---------- x1 : array_like, real-valued - y-coordinates. + `y`-coordinates. x2 : array_like, real-valued - x-coordinates. `x2` must be broadcastable to match the shape of `x1`, - or vice versa. + `x`-coordinates. `x2` must be broadcastable to match the shape of + `x1` or vice versa. Returns ------- @@ -398,12 +403,13 @@ See Also -------- - arctan, tan + arctan, tan, angle Notes ----- - `arctan2` is identical to the `atan2` function of the underlying - C library. The following special values are defined in the C standard [2]: + *arctan2* is identical to the `atan2` function of the underlying + C library. The following special values are defined in the C + standard: [1]_ ====== ====== ================ `x1` `x2` `arctan2(x1,x2)` @@ -416,13 +422,12 @@ +/-inf -inf +/- (3*pi/4) ====== ====== ================ - Note that +0 and -0 are distinct floating point numbers. + Note that +0 and -0 are distinct floating point numbers, as are +inf + and -inf. References ---------- - .. [1] Wikipedia, "atan2", - http://en.wikipedia.org/wiki/Atan2 - .. [2] ISO/IEC standard 9899:1999, "Programming language C", 1999. + .. [1] ISO/IEC standard 9899:1999, "Programming language C." Examples -------- @@ -841,7 +846,8 @@ Returns ------- y : ndarray of floats - The corresponding degree values. + The corresponding degree values; if `out` was supplied this is a + reference to it. See Also -------- @@ -1291,18 +1297,21 @@ add_newdoc('numpy.core.umath', 'greater', """ - Return (x1 > x2) element-wise. + Return the truth value of (x1 > x2) element-wise. Parameters ---------- x1, x2 : array_like - Input arrays. + Input arrays. If ``x1.shape != x2.shape``, they must be + broadcastable to a common shape (which may be the shape of one or + the other). Returns ------- - Out : {ndarray, bool} - Output array of bools, or a single bool if `x1` and `x2` are scalars. + out : bool or ndarray of bool + Array of bools, or a single bool if `x1` and `x2` are scalars. + See Also -------- greater_equal, less, less_equal, equal, not_equal @@ -1323,17 +1332,19 @@ add_newdoc('numpy.core.umath', 'greater_equal', """ - Return (x1 >= x2) element-wise. + Return the truth value of (x1 >= x2) element-wise. Parameters ---------- x1, x2 : array_like - Input arrays. + Input arrays. If ``x1.shape != x2.shape``, they must be + broadcastable to a common shape (which may be the shape of one or + the other). Returns ------- - out : {ndarray, bool} - Output array of bools, or a single bool if x1 and x2 are scalars. + out : bool or ndarray of bool + Array of bools, or a single bool if `x1` and `x2` are scalars. See Also -------- @@ -1532,30 +1543,33 @@ add_newdoc('numpy.core.umath', 'isinf', """ - Test element-wise for positive or negative infinity, return result as bool - array. + Test element-wise for positive or negative infinity. + Return a bool-type array, the same shape as `x`, True where ``x == + +/-inf``, False everywhere else. + Parameters ---------- x : array_like Input values - y : array_like, optional + out : array_like, optional An array with the same shape as `x` to store the result. Returns ------- - y : {ndarray, bool} + y : bool (scalar) or bool-type ndarray For scalar input, the result is a new boolean with value True if the input is positive or negative infinity; otherwise the value is False. For array input, the result is a boolean array with the same - dimensions as the input and the values are True if the corresponding - element of the input is positive or negative infinity; otherwise the - values are False. If a second argument is supplied the result is - stored there. If the type of that array is a numeric type the result - is represented as zeros and ones, if the type is boolean then as - False and True. The return value `y` is then a reference to that array. + shape as the input and the values are True where the + corresponding element of the input is positive or negative + infinity; elsewhere the values are False. If a second argument + was supplied the result is stored there. If the type of that array + is a numeric type the result is represented as zeros and ones, if + the type is boolean then as False and True, respectively. + The return value `y` is then a reference to that array. See Also -------- @@ -1566,8 +1580,9 @@ Numpy uses the IEEE Standard for Binary Floating-Point for Arithmetic (IEEE 754). - Errors result if second argument is also supplied with scalar input or - if first and second arguments have different shapes. + Errors result if the second argument is supplied when the first + argument is a scalar, or if the first and second arguments have + different shapes. Examples -------- @@ -1670,21 +1685,23 @@ add_newdoc('numpy.core.umath', 'less', """ - Return (x1 < x2) element-wise. + Return the truth value of (x1 < x2) element-wise. Parameters ---------- x1, x2 : array_like - Input arrays. + Input arrays. If ``x1.shape != x2.shape``, they must be + broadcastable to a common shape (which may be the shape of one or + the other). Returns ------- - Out : ndarray of bools - Output array of bools, or a single bool if `x1` and `x2` are scalars. + out : bool or ndarray of bool + Array of bools, or a single bool if `x1` and `x2` are scalars. See Also -------- - less_equal, greater, greater_equal, equal, not_equal + greater, less_equal, greater_equal, equal, not_equal Examples -------- @@ -1695,26 +1712,28 @@ add_newdoc('numpy.core.umath', 'less_equal', """ - Return (x1 <= x2) element-wise. + Return the truth value of (x1 =< x2) element-wise. Parameters ---------- x1, x2 : array_like - Input arrays. + Input arrays. If ``x1.shape != x2.shape``, they must be + broadcastable to a common shape (which may be the shape of one or + the other). Returns ------- - Out : {ndarray, bool} - Output array of bools, or a single bool if `x1` and `x2` are scalars. + out : bool or ndarray of bool + Array of bools, or a single bool if `x1` and `x2` are scalars. See Also -------- - less, greater_equal, greater, equal, not_equal + greater, less, greater_equal, equal, not_equal Examples -------- - >>> np.less_equal([1, 2, 3], [2, 2, 2]) - array([ True, True, False], dtype=bool) + >>> np.less_equal([4, 2, 1], [2, 2, 2]) + array([False, True, True], dtype=bool) """) @@ -2041,7 +2060,7 @@ Returns ------- - y : {ndarray, bool} + y : bool or ndarray of bool Boolean result with the same shape as `x` of the NOT operation on elements of `x`. @@ -2098,24 +2117,24 @@ add_newdoc('numpy.core.umath', 'logical_xor', """ - Compute the truth value of x1 XOR x2 elementwise. + Compute the truth value of x1 XOR x2, element-wise. Parameters ---------- x1, x2 : array_like - Logical XOR is applied to the elements of `x1` and `x2`. - They have to be of the same shape. + Logical XOR is applied to the elements of `x1` and `x2`. They must + be broadcastable to the same shape. Returns ------- - y : {ndarray, bool} - Boolean result with the same shape as `x1` and `x2` of the logical - XOR operation on elements of `x1` and `x2`. + y : bool or ndarray of bool + Boolean result of the logical XOR operation applied to the elements + of `x1` and `x2`; the shape is determined by whether or not + broadcasting of one or both arrays was required. See Also -------- - logical_and, logical_or, logical_not - bitwise_xor + logical_and, logical_or, logical_not, bitwise_xor Examples -------- @@ -2128,6 +2147,12 @@ >>> np.logical_xor(x < 1, x > 3) array([ True, False, False, False, True], dtype=bool) + Simple example showing support of broadcasting + + >>> np.logical_xor(0, np.eye(2)) + array([[ True, False], + [False, True]], dtype=bool) + """) add_newdoc('numpy.core.umath', 'maximum', @@ -2417,13 +2442,13 @@ Parameters ---------- - x : {array_like, scalar} + x : array_like or scalar Input array. Returns ------- - y : {ndarray, scalar} - Returned array or scalar `y=-x`. + y : ndarray or scalar + Returned array or scalar: `y = -x`. Examples -------- @@ -2471,11 +2496,11 @@ Equivalent to ``a.copy().fill(1)``. - Please refer to the documentation for `zeros_like`. + Please refer to the documentation for `zeros_like` for further details. See Also -------- - zeros_like + zeros_like, ones Examples -------- @@ -2488,10 +2513,10 @@ add_newdoc('numpy.core.umath', 'power', """ - Returns element-wise base array raised to power from second array. + First array elements raised to powers from second array, element-wise. - Raise each base in `x1` to the power of the exponents in `x2`. This - requires that `x1` and `x2` must be broadcastable to the same shape. + Raise each base in `x1` to the positionally-corresponding power in + `x2`. `x1` and `x2` must be broadcastable to the same shape. Parameters ---------- @@ -2542,7 +2567,7 @@ x : array_like Input array in degrees. out : ndarray, optional - Output array of same shape as x. + Output array of same shape as `x`. Returns ------- @@ -2776,12 +2801,13 @@ The input value(s). out : ndarray, optional Array into which the output is placed. Its type is preserved - and it must be of the right shape to hold the output. See doc.ufuncs. + and it must be of the right shape to hold the output. + See `doc.ufuncs`. Returns ------- - out : array_like, bool - Output array. + result : ndarray of bool + Output array, or reference to `out` if that was supplied. Examples -------- @@ -3011,24 +3037,32 @@ Parameters ---------- x : array_like - The square root of each element in this array is calculated. + The values whose square-roots are required. + out : ndarray, optional + Alternate array object in which to put the result; if provided, it + must have the same shape as `x` Returns ------- y : ndarray - An array of the same shape as `x`, containing the square-root of - each element in `x`. If any element in `x` - is complex, a complex array is returned. If all of the elements - of `x` are real, negative elements return numpy.nan elements. + An array of the same shape as `x`, containing the positive + square-root of each element in `x`. If any element in `x` is + complex, a complex array is returned (and the square-roots of + negative reals are calculated). If all of the elements in `x` + are real, so is `y`, with negative elements returning ``nan``. + If `out` was provided, `y` is a reference to it. See Also -------- - numpy.lib.scimath.sqrt + lib.scimath.sqrt A version which returns complex numbers when given negative reals. Notes ----- - `sqrt` has a branch cut ``[-inf, 0)`` and is continuous from above on it. + *sqrt* has--consistent with common convention--as its branch cut the + real "interval" [`-inf`, 0), and is continuous from above on it. + (A branch cut is a curve in the complex plane across which a given + complex function fails to be continuous.) Examples -------- From numpy-svn at scipy.org Sat Jul 31 06:04:19 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 31 Jul 2010 05:04:19 -0500 (CDT) Subject: [Numpy-svn] r8561 - trunk/numpy/lib Message-ID: <20100731100419.E4E8C39CDDB@scipy.org> Author: rgommers Date: 2010-07-31 05:04:19 -0500 (Sat, 31 Jul 2010) New Revision: 8561 Modified: trunk/numpy/lib/format.py trunk/numpy/lib/function_base.py trunk/numpy/lib/npyio.py Log: DOC: wiki merge, npyio, format and function_base Modified: trunk/numpy/lib/format.py =================================================================== --- trunk/numpy/lib/format.py 2010-07-31 10:04:03 UTC (rev 8560) +++ trunk/numpy/lib/format.py 2010-07-31 10:04:19 UTC (rev 8561) @@ -366,19 +366,19 @@ """ Write an array to an NPY file, including a header. - If the array is neither C-contiguous or Fortran-contiguous AND if the - filelike object is not a real file object, then this function will have - to copy data in memory. + If the array is neither C-contiguous nor Fortran-contiguous AND the + file_like object is not a real file object, this function will have to + copy data in memory. Parameters ---------- - fp : filelike object - An open, writable file object or similar object with a `.write()` + fp : file_like object + An open, writable file object, or similar object with a ``.write()`` method. - array : numpy.ndarray + array : ndarray The array to write to disk. version : (int, int), optional - The version number of the format. + The version number of the format. Default: (1, 0) Raises ------ @@ -386,7 +386,7 @@ If the array cannot be persisted. Various other errors If the array contains Python objects as part of its dtype, the - process of pickling them may raise arbitrary errors if the objects + process of pickling them may raise various errors if the objects are not picklable. """ @@ -418,13 +418,13 @@ Parameters ---------- - fp : filelike object - If this is not a real file object, then this may take extra memory and - time. + fp : file_like object + If this is not a real file object, then this may take extra memory + and time. Returns ------- - array : numpy.ndarray + array : ndarray The array from the data on disk. Raises @@ -477,27 +477,31 @@ Parameters ---------- filename : str - The name of the file on disk. This may not be a file-like object. + The name of the file on disk. This may *not* be a file-like + object. mode : str, optional - The mode to open the file with. In addition to the standard file modes, - 'c' is also accepted to mean "copy on write". See `numpy.memmap` for - the available mode strings. - dtype : dtype, optional + The mode in which to open the file; the default is 'r+'. In + addition to the standard file modes, 'c' is also accepted to + mean "copy on write." See `memmap` for the available mode strings. + dtype : data-type, optional The data type of the array if we are creating a new file in "write" - mode. - shape : tuple of int, optional + mode, if not, `dtype` is ignored. The default value is None, + which results in a data-type of `float64`. + shape : tuple of int The shape of the array if we are creating a new file in "write" - mode. + mode, in which case this parameter is required. Otherwise, this + parameter is ignored and is thus optional. fortran_order : bool, optional Whether the array should be Fortran-contiguous (True) or - C-contiguous (False) if we are creating a new file in "write" mode. + C-contiguous (False, the default) if we are creating a new file + in "write" mode. version : tuple of int (major, minor) If the mode is a "write" mode, then this is the version of the file - format used to create the file. + format used to create the file. Default: (1,0) Returns ------- - marray : numpy.memmap + marray : memmap The memory-mapped array. Raises @@ -509,7 +513,7 @@ See Also -------- - numpy.memmap + memmap """ if not isinstance(filename, basestring): Modified: trunk/numpy/lib/function_base.py =================================================================== --- trunk/numpy/lib/function_base.py 2010-07-31 10:04:03 UTC (rev 8560) +++ trunk/numpy/lib/function_base.py 2010-07-31 10:04:19 UTC (rev 8561) @@ -29,9 +29,31 @@ from utils import deprecate import numpy as np -#end Fernando's utilities def iterable(y): + """ + Check whether or not an object can be iterated over. + + Parameters + ---------- + y : object + Input object. + + Returns + ------- + b : {0, 1} + Return 1 if the object has an iterator method or is a sequence, + and 0 otherwise. + + + Examples + -------- + >>> np.iterable([1, 2, 3]) + 1 + >>> np.iterable(2) + 0 + + """ try: iter(y) except: return 0 return 1 @@ -1237,7 +1259,7 @@ """ Change elements of an array based on conditional and input values. - Similar to ``np.putmask(a, mask, vals)``, the difference is that `place` + Similar to ``np.putmask(arr, mask, vals)``, the difference is that `place` uses the first N elements of `vals`, where N is the number of True values in `mask`, while `putmask` uses the elements where `mask` is True. @@ -1245,7 +1267,7 @@ Parameters ---------- - a : array_like + arr : array_like Array to put data into. mask : array_like Boolean mask array. Must have the same size as `a`. @@ -1260,9 +1282,9 @@ Examples -------- - >>> x = np.arange(6).reshape(2, 3) - >>> np.place(x, x>2, [44, 55]) - >>> x + >>> arr = np.arange(6).reshape(2, 3) + >>> np.place(arr, arr>2, [44, 55]) + >>> arr array([[ 0, 1, 2], [44, 55, 44]]) @@ -1936,12 +1958,12 @@ Return correlation coefficients. Please refer to the documentation for `cov` for more detail. The - relationship between the correlation coefficient matrix, P, and the - covariance matrix, C, is + relationship between the correlation coefficient matrix, `P`, and the + covariance matrix, `C`, is .. math:: P_{ij} = \\frac{ C_{ij} } { \\sqrt{ C_{ii} * C_{jj} } } - The values of P are between -1 and 1. + The values of `P` are between -1 and 1, inclusive. Parameters ---------- @@ -1989,22 +2011,22 @@ """ Return the Blackman window. - The Blackman window is a taper formed by using the the first - three terms of a summation of cosines. It was designed to have close - to the minimal leakage possible. - It is close to optimal, only slightly worse than a Kaiser window. + The Blackman window is a taper formed by using the the first three + terms of a summation of cosines. It was designed to have close to the + minimal leakage possible. It is close to optimal, only slightly worse + than a Kaiser window. Parameters ---------- M : int - Number of points in the output window. If zero or less, an - empty array is returned. + Number of points in the output window. If zero or less, an empty + array is returned. Returns ------- - out : array - The window, normalized to one (the value one - appears only if the number of samples is odd). + out : ndarray + The window, normalized to one (the value one appears only if the + number of samples is odd). See Also -------- @@ -2016,7 +2038,6 @@ .. math:: w(n) = 0.42 - 0.5 \\cos(2\\pi n/M) + 0.08 \\cos(4\\pi n/M) - Most references to the Blackman window come from the signal processing literature, where it is used as one of many windowing functions for smoothing values. It is also known as an apodization (which means @@ -2027,13 +2048,12 @@ References ---------- - .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power - spectra, Dover Publications, New York. - .. [2] Wikipedia, "Window function", - http://en.wikipedia.org/wiki/Window_function - .. [3] Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. - Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. + Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, + Dover Publications, New York. + Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. + Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. + Examples -------- >>> from numpy import blackman Modified: trunk/numpy/lib/npyio.py =================================================================== --- trunk/numpy/lib/npyio.py 2010-07-31 10:04:03 UTC (rev 8560) +++ trunk/numpy/lib/npyio.py 2010-07-31 10:04:19 UTC (rev 8561) @@ -367,7 +367,7 @@ def savez(file, *args, **kwds): """ - Save several arrays into a single, compressed file in ``.npz`` format. + Save several arrays into a single, archive file in ``.npz`` format. If arguments are passed in with no keywords, the corresponding variable names, in the .npz file, are 'arr_0', 'arr_1', etc. If keyword arguments @@ -401,8 +401,9 @@ Notes ----- The ``.npz`` file format is a zipped archive of files named after the - variables they contain. Each file contains one variable in ``.npy`` - format. For a description of the ``.npy`` format, see `format`. + variables they contain. The archive is not compressed and each file + in the archive contains one variable in ``.npy`` format. For a + description of the ``.npy`` format, see `format`. When opening the saved ``.npz`` file with `load` a `NpzFile` object is returned. This is a dictionary-like object which can be queried for @@ -509,30 +510,32 @@ fname : file or str File or filename to read. If the filename extension is ``.gz`` or ``.bz2``, the file is first decompressed. - dtype : dtype, optional - Data type of the resulting array. If this is a record data-type, - the resulting array will be 1-dimensional, and each row will be - interpreted as an element of the array. In this case, the number - of columns used must match the number of fields in the data-type. + dtype : data-type, optional + Data-type of the resulting array; default: float. If this is a record + data-type, the resulting array will be 1-dimensional, and each row + will be interpreted as an element of the array. In this case, the + number of columns used must match the number of fields in the + data-type. comments : str, optional - The character used to indicate the start of a comment. + The character used to indicate the start of a comment; default: '#'. delimiter : str, optional The string used to separate values. By default, this is any whitespace. converters : dict, optional A dictionary mapping column number to a function that will convert that column to a float. E.g., if column 0 is a date string: - ``converters = {0: datestr2num}``. Converters can also be used to + ``converters = {0: datestr2num}``. Converters can also be used to provide a default value for missing data: - ``converters = {3: lambda s: float(s or 0)}``. + ``converters = {3: lambda s: float(s or 0)}``. Default: None. skiprows : int, optional - Skip the first `skiprows` lines. + Skip the first `skiprows` lines; default: 0. usecols : sequence, optional Which columns to read, with 0 being the first. For example, ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. + The default, None, results in all columns being read. unpack : bool, optional If True, the returned array is transposed, so that arguments may be - unpacked using ``x, y, z = loadtxt(...)``. Default is False. + unpacked using ``x, y, z = loadtxt(...)``. The default is False. Returns ------- @@ -543,11 +546,11 @@ -------- load, fromstring, fromregex genfromtxt : Load data with missing values handled as specified. - scipy.io.loadmat : reads Matlab(R) data files + scipy.io.loadmat : reads MATLAB data files Notes ----- - This function aims to be a fast reader for simply formatted files. The + This function aims to be a fast reader for simply formatted files. The `genfromtxt` function provides more sophisticated handling of, e.g., lines with missing values. From numpy-svn at scipy.org Sat Jul 31 06:04:38 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 31 Jul 2010 05:04:38 -0500 (CDT) Subject: [Numpy-svn] r8562 - trunk/numpy/lib Message-ID: <20100731100438.CBF9039CDE3@scipy.org> Author: rgommers Date: 2010-07-31 05:04:38 -0500 (Sat, 31 Jul 2010) New Revision: 8562 Modified: trunk/numpy/lib/scimath.py trunk/numpy/lib/shape_base.py trunk/numpy/lib/stride_tricks.py trunk/numpy/lib/twodim_base.py Log: DOC: wiki merge, twodim_base and a few loose ones. Modified: trunk/numpy/lib/scimath.py =================================================================== --- trunk/numpy/lib/scimath.py 2010-07-31 10:04:19 UTC (rev 8561) +++ trunk/numpy/lib/scimath.py 2010-07-31 10:04:38 UTC (rev 8562) @@ -3,16 +3,17 @@ whose output data-type is different than the input data-type in certain domains of the input. -For example, for functions like log() with branch cuts, the versions in this -module provide the mathematically valid answers in the complex plane: +For example, for functions like `log` with branch cuts, the versions in this +module provide the mathematically valid answers in the complex plane:: ->>> import math ->>> from numpy.lib import scimath ->>> scimath.log(-math.exp(1)) == (1+1j*math.pi) -True + >>> import math + >>> from numpy.lib import scimath + >>> scimath.log(-math.exp(1)) == (1+1j*math.pi) + True -Similarly, sqrt(), other base logarithms, power() and trig functions are +Similarly, `sqrt`, other base logarithms, `power` and trig functions are correctly handled. See their respective docstrings for specific examples. + """ __all__ = ['sqrt', 'log', 'log2', 'logn','log10', 'power', 'arccos', Modified: trunk/numpy/lib/shape_base.py =================================================================== --- trunk/numpy/lib/shape_base.py 2010-07-31 10:04:19 UTC (rev 8561) +++ trunk/numpy/lib/shape_base.py 2010-07-31 10:04:38 UTC (rev 8562) @@ -126,27 +126,26 @@ `func` is called as `res = func(a, axis)`, where `axis` is the first element of `axes`. The result `res` of the function call must have - either the same dimensions as `a` or one less dimension. If `res` has one - less dimension than `a`, a dimension is inserted before `axis`. - The call to `func` is then repeated for each axis in `axes`, + either the same dimensions as `a` or one less dimension. If `res` + has one less dimension than `a`, a dimension is inserted before + `axis`. The call to `func` is then repeated for each axis in `axes`, with `res` as the first argument. Parameters ---------- func : function This function must take two arguments, `func(a, axis)`. - a : ndarray + a : array_like Input array. axes : array_like - Axes over which `func` is applied, the elements must be - integers. + Axes over which `func` is applied; the elements must be integers. Returns ------- val : ndarray - The output array. The number of dimensions is the same as `a`, but - the shape can be different. This depends on whether `func` changes - the shape of its output with respect to its input. + The output array. The number of dimensions is the same as `a`, + but the shape can be different. This depends on whether `func` + changes the shape of its output with respect to its input. See Also -------- Modified: trunk/numpy/lib/stride_tricks.py =================================================================== --- trunk/numpy/lib/stride_tricks.py 2010-07-31 10:04:19 UTC (rev 8561) +++ trunk/numpy/lib/stride_tricks.py 2010-07-31 10:04:38 UTC (rev 8562) @@ -33,16 +33,16 @@ Parameters ---------- - `*args` : arrays + `*args` : array_likes The arrays to broadcast. Returns ------- broadcasted : list of arrays - These arrays are views on the original arrays. They are typically not - contiguous. Furthermore, more than one element of a broadcasted array - may refer to a single memory location. If you need to write to the - arrays, make copies first. + These arrays are views on the original arrays. They are typically + not contiguous. Furthermore, more than one element of a + broadcasted array may refer to a single memory location. If you + need to write to the arrays, make copies first. Examples -------- Modified: trunk/numpy/lib/twodim_base.py =================================================================== --- trunk/numpy/lib/twodim_base.py 2010-07-31 10:04:19 UTC (rev 8561) +++ trunk/numpy/lib/twodim_base.py 2010-07-31 10:04:38 UTC (rev 8562) @@ -172,20 +172,22 @@ M : int, optional Number of columns in the output. If None, defaults to `N`. k : int, optional - Index of the diagonal: 0 refers to the main diagonal, a positive value - refers to an upper diagonal, and a negative value to a lower diagonal. - dtype : dtype, optional + Index of the diagonal: 0 (the default) refers to the main diagonal, + a positive value refers to an upper diagonal, and a negative value + to a lower diagonal. + dtype : data-type, optional Data-type of the returned array. Returns ------- - I : ndarray (N,M) + I : ndarray of shape (N,M) An array where all elements are equal to zero, except for the `k`-th diagonal, whose values are equal to one. See Also -------- - diag : Return a diagonal 2-D array using a 1-D array specified by the user. + identity : (almost) equivalent function + diag : diagonal 2-D array from a 1-D array specified by the user. Examples -------- @@ -294,7 +296,9 @@ Input data, which is flattened and set as the `k`-th diagonal of the output. k : int, optional - Diagonal to set. The default is 0. + Diagonal to set; 0, the default, corresponds to the "main" diagonal, + a positive (negative) `k` giving the number of the diagonal above + (below) the main. Returns ------- @@ -303,7 +307,7 @@ See Also -------- - diag : Matlab workalike for 1-D and 2-D arrays. + diag : MATLAB work-alike for 1-D and 2-D arrays. diagonal : Return specified diagonals. trace : Sum along diagonals. @@ -342,7 +346,7 @@ def tri(N, M=None, k=0, dtype=float): """ - Construct an array filled with ones at and below the given diagonal. + An array with ones at and below the given diagonal and zeros elsewhere. Parameters ---------- @@ -352,7 +356,7 @@ Number of columns in the array. By default, `M` is taken equal to `N`. k : int, optional - The sub-diagonal below which the array is filled. + The sub-diagonal at and below which the array is filled. `k` = 0 is the main diagonal, while `k` < 0 is below it, and `k` > 0 is above. The default is 0. dtype : dtype, optional @@ -360,9 +364,9 @@ Returns ------- - T : (N,M) ndarray - Array with a lower triangle filled with ones, in other words - ``T[i,j] == 1`` for ``i <= j + k``. + T : ndarray of shape (N, M) + Array with its lower triangle filled with ones and zero elsewhere; + in other words ``T[i,j] == 1`` for ``i <= j + k``, 0 otherwise. Examples -------- @@ -391,9 +395,9 @@ ---------- m : array_like, shape (M, N) Input array. - k : int - Diagonal above which to zero elements. - `k = 0` is the main diagonal, `k < 0` is below it and `k > 0` is above. + k : int, optional + Diagonal above which to zero elements. `k = 0` (the default) is the + main diagonal, `k < 0` is below it and `k > 0` is above. Returns ------- @@ -402,7 +406,7 @@ See Also -------- - triu + triu : same thing, only for the upper triangle Examples -------- @@ -421,13 +425,14 @@ """ Upper triangle of an array. - Construct a copy of a matrix with elements below the k-th diagonal zeroed. + Return a copy of a matrix with the elements below the `k`-th diagonal + zeroed. - Please refer to the documentation for `tril`. + Please refer to the documentation for `tril` for further details. See Also -------- - tril + tril : lower triangle of an array Examples -------- @@ -448,17 +453,17 @@ Generate a Van der Monde matrix. The columns of the output matrix are decreasing powers of the input - vector. Specifically, the i-th output column is the input vector to - the power of ``N - i - 1``. Such a matrix with a geometric progression - in each row is named Van Der Monde, or Vandermonde matrix, from - Alexandre-Theophile Vandermonde. + vector. Specifically, the `i`-th output column is the input vector + raised element-wise to the power of ``N - i - 1``. Such a matrix with + a geometric progression in each row is named for Alexandre-Theophile + Vandermonde. Parameters ---------- x : array_like 1-D input array. N : int, optional - Order of (number of columns in) the output. If `N` is not specified, + Order of (number of columns in) the output. If `N` is not specified, a square array is returned (``N = len(x)``). Returns @@ -467,11 +472,6 @@ Van der Monde matrix of order `N`. The first column is ``x^(N-1)``, the second ``x^(N-2)`` and so forth. - References - ---------- - .. [1] Wikipedia, "Vandermonde matrix", - http://en.wikipedia.org/wiki/Vandermonde_matrix - Examples -------- >>> x = np.array([1, 2, 3, 5]) @@ -586,10 +586,12 @@ We can now use the Matplotlib to visualize this 2-dimensional histogram: - >>> extent = [xedges[0], xedges[-1], yedges[0], yedges[-1]] + >>> extent = [yedges[0], yedges[-1], xedges[-1], xedges[0]] >>> import matplotlib.pyplot as plt - >>> plt.imshow(H, extent=extent) + >>> plt.imshow(H, extent=extent, interpolation='nearest') + >>> plt.colorbar() + >>> plt.show() """ From numpy-svn at scipy.org Sat Jul 31 06:04:55 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 31 Jul 2010 05:04:55 -0500 (CDT) Subject: [Numpy-svn] r8563 - in trunk/numpy: . matrixlib Message-ID: <20100731100455.101DB39CDE7@scipy.org> Author: rgommers Date: 2010-07-31 05:04:54 -0500 (Sat, 31 Jul 2010) New Revision: 8563 Modified: trunk/numpy/add_newdocs.py trunk/numpy/matrixlib/__init__.py trunk/numpy/matrixlib/defmatrix.py Log: DOC: wiki merge, matrlixlib and some ndarray methods. Modified: trunk/numpy/add_newdocs.py =================================================================== --- trunk/numpy/add_newdocs.py 2010-07-31 10:04:38 UTC (rev 8562) +++ trunk/numpy/add_newdocs.py 2010-07-31 10:04:54 UTC (rev 8563) @@ -2748,7 +2748,7 @@ """ a.put(indices, values, mode='raise') - Set a.flat[n] = values[n] for all n in indices. + Set ``a.flat[n] = values[n]`` for all `n` in indices. Refer to `numpy.put` for full documentation. @@ -2942,7 +2942,7 @@ """ a.round(decimals=0, out=None) - Return an array rounded a to the given number of decimals. + Return `a` with each element rounded to the given number of decimals. Refer to `numpy.around` for full documentation. @@ -3208,7 +3208,7 @@ """ a.take(indices, axis=None, out=None, mode='raise') - Return an array formed from the elements of a at the given indices. + Return an array formed from the elements of `a` at the given indices. Refer to `numpy.take` for full documentation. @@ -3418,24 +3418,26 @@ Parameters ---------- - dtype : data-type - Data-type descriptor of the returned view, e.g. float32 or int16. - type : python type - Type of the returned view, e.g. ndarray or matrix. + dtype : data-type, optional + Data-type descriptor of the returned view, e.g., float32 or int16. + The default, None, results in the view having the same data-type + as `a`. + type : Python type, optional + Type of the returned view, e.g., ndarray or matrix. Again, the + default None results in type preservation. - Notes ----- + ``a.view()`` is used two different ways: - `a.view()` is used two different ways. - - `a.view(some_dtype)` or `a.view(dtype=some_dtype)` constructs a view of - the array's memory with a different dtype. This can cause a + ``a.view(some_dtype)`` or ``a.view(dtype=some_dtype)`` constructs a view + of the array's memory with a different data-type. This can cause a reinterpretation of the bytes of memory. - `a.view(ndarray_subclass)`, or `a.view(type=ndarray_subclass)`, just - returns an instance of ndarray_subclass that looks at the same array (same - shape, dtype, etc.). This does not cause a reinterpretation of the memory. + ``a.view(ndarray_subclass)`` or ``a.view(type=ndarray_subclass)`` just + returns an instance of `ndarray_subclass` that looks at the same array + (same shape, dtype, etc.) This does not cause a reinterpretation of the + memory. Examples Modified: trunk/numpy/matrixlib/__init__.py =================================================================== --- trunk/numpy/matrixlib/__init__.py 2010-07-31 10:04:38 UTC (rev 8562) +++ trunk/numpy/matrixlib/__init__.py 2010-07-31 10:04:54 UTC (rev 8563) @@ -1,3 +1,4 @@ +"""Sub-package containing the matrix class and related functions.""" from defmatrix import * __all__ = defmatrix.__all__ Modified: trunk/numpy/matrixlib/defmatrix.py =================================================================== --- trunk/numpy/matrixlib/defmatrix.py 2010-07-31 10:04:38 UTC (rev 8562) +++ trunk/numpy/matrixlib/defmatrix.py 2010-07-31 10:04:54 UTC (rev 8563) @@ -196,23 +196,22 @@ """ matrix(data, dtype=None, copy=True) - Returns a matrix from an array-like object, or from a string - of data. A matrix is a specialized 2-d array that retains - its 2-d nature through operations. It has certain special - operators, such as ``*`` (matrix multiplication) and - ``**`` (matrix power). + Returns a matrix from an array-like object, or from a string of data. + A matrix is a specialized 2-D array that retains its 2-D nature + through operations. It has certain special operators, such as ``*`` + (matrix multiplication) and ``**`` (matrix power). Parameters ---------- data : array_like or string - If data is a string, the string is interpreted as a matrix - with commas or spaces separating columns, and semicolons - separating rows. + If `data` is a string, it is interpreted as a matrix with commas + or spaces separating columns, and semicolons separating rows. dtype : data-type Data-type of the output matrix. copy : bool - If data is already an ndarray, then this flag determines whether - the data is copied, or whether a view is constructed. + If `data` is already an `ndarray`, then this flag determines + whether the data is copied (the default), or whether a view is + constructed. See Also -------- @@ -1009,9 +1008,9 @@ Parameters ---------- - obj : string, sequence or array - Input data. Variables names in the current scope may - be referenced, even if `obj` is a string. + obj : str or array_like + Input data. Names of variables in the current scope may be + referenced, even if `obj` is a string. Returns ------- From numpy-svn at scipy.org Sat Jul 31 06:13:56 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 31 Jul 2010 05:13:56 -0500 (CDT) Subject: [Numpy-svn] r8564 - trunk/numpy/core Message-ID: <20100731101356.B84AF39CDEE@scipy.org> Author: rgommers Date: 2010-07-31 05:13:56 -0500 (Sat, 31 Jul 2010) New Revision: 8564 Modified: trunk/numpy/core/SConscript Log: BUG: fix numscons build issue introduced in r8541. The problem was that if endian.h was not detected, @DEFINE_NPY_HAVE_ENDIAN_H@ was still present in _numpyconfig.h, causing compilation to fail. Modified: trunk/numpy/core/SConscript =================================================================== --- trunk/numpy/core/SConscript 2010-07-31 10:04:54 UTC (rev 8563) +++ trunk/numpy/core/SConscript 2010-07-31 10:13:56 UTC (rev 8564) @@ -81,6 +81,8 @@ st = config.CheckHeader("endian.h") if st: numpyconfig_sym.append(('DEFINE_NPY_HAVE_ENDIAN_H', '#define NPY_HAVE_ENDIAN_H 1')) +else: + numpyconfig_sym.append(('DEFINE_NPY_HAVE_ENDIAN_H', '')) def check_type(type, include = None): st = config.CheckTypeSize(type, includes = include) From numpy-svn at scipy.org Sat Jul 31 06:15:13 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 31 Jul 2010 05:15:13 -0500 (CDT) Subject: [Numpy-svn] r8565 - branches/1.5.x/numpy/core Message-ID: <20100731101513.2432839CDEF@scipy.org> Author: rgommers Date: 2010-07-31 05:15:12 -0500 (Sat, 31 Jul 2010) New Revision: 8565 Modified: branches/1.5.x/numpy/core/SConscript Log: BUG: fix numscons build issue introduced in r8541. The problem was that if endian.h was not detected, @DEFINE_NPY_HAVE_ENDIAN_H@ was still present in _numpyconfig.h, causing compilation to fail. Modified: branches/1.5.x/numpy/core/SConscript =================================================================== --- branches/1.5.x/numpy/core/SConscript 2010-07-31 10:13:56 UTC (rev 8564) +++ branches/1.5.x/numpy/core/SConscript 2010-07-31 10:15:12 UTC (rev 8565) @@ -81,6 +81,8 @@ st = config.CheckHeader("endian.h") if st: numpyconfig_sym.append(('DEFINE_NPY_HAVE_ENDIAN_H', '#define NPY_HAVE_ENDIAN_H 1')) +else: + numpyconfig_sym.append(('DEFINE_NPY_HAVE_ENDIAN_H', '')) def check_type(type, include = None): st = config.CheckTypeSize(type, includes = include) From numpy-svn at scipy.org Sat Jul 31 06:16:46 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 31 Jul 2010 05:16:46 -0500 (CDT) Subject: [Numpy-svn] r8566 - branches/1.4.x/numpy/core Message-ID: <20100731101646.C4D6339CDF0@scipy.org> Author: rgommers Date: 2010-07-31 05:16:46 -0500 (Sat, 31 Jul 2010) New Revision: 8566 Modified: branches/1.4.x/numpy/core/SConscript Log: BUG: fix numscons build issue introduced in r8541. backport of r8564 The problem was that if endian.h was not detected, @DEFINE_NPY_HAVE_ENDIAN_H@ was still present in _numpyconfig.h, causing compilation to fail. Modified: branches/1.4.x/numpy/core/SConscript =================================================================== --- branches/1.4.x/numpy/core/SConscript 2010-07-31 10:15:12 UTC (rev 8565) +++ branches/1.4.x/numpy/core/SConscript 2010-07-31 10:16:46 UTC (rev 8566) @@ -81,6 +81,8 @@ st = config.CheckHeader("endian.h") if st: numpyconfig_sym.append(('DEFINE_NPY_HAVE_ENDIAN_H', '#define NPY_HAVE_ENDIAN_H 1')) +else: + numpyconfig_sym.append(('DEFINE_NPY_HAVE_ENDIAN_H', '')) def check_type(type, include = None): st = config.CheckTypeSize(type, includes = include) From numpy-svn at scipy.org Sat Jul 31 07:49:25 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 31 Jul 2010 06:49:25 -0500 (CDT) Subject: [Numpy-svn] r8567 - in trunk/numpy: . tests Message-ID: <20100731114925.8EEBA39CDF4@scipy.org> Author: ptvirtan Date: 2010-07-31 06:49:25 -0500 (Sat, 31 Jul 2010) New Revision: 8567 Added: trunk/numpy/tests/test_matlib.py Modified: trunk/numpy/matlib.py Log: TST: Add tests for matlib. Closes #1242. (From Ralf Gommers.) Modified: trunk/numpy/matlib.py =================================================================== --- trunk/numpy/matlib.py 2010-07-31 10:16:46 UTC (rev 8566) +++ trunk/numpy/matlib.py 2010-07-31 11:49:25 UTC (rev 8567) @@ -160,10 +160,10 @@ Examples -------- >>> import numpy.matlib - >>> np.identity(3, dtype=int) - array([[1, 0, 0], - [0, 1, 0], - [0, 0, 1]]) + >>> np.matlib.identity(3, dtype=int) + matrix([[1, 0, 0], + [0, 1, 0], + [0, 0, 1]]) """ a = array([1]+n*[0],dtype=dtype) Added: trunk/numpy/tests/test_matlib.py =================================================================== --- trunk/numpy/tests/test_matlib.py (rev 0) +++ trunk/numpy/tests/test_matlib.py 2010-07-31 11:49:25 UTC (rev 8567) @@ -0,0 +1,53 @@ +import numpy as np +import numpy.matlib +from numpy.testing import assert_array_equal, assert_ + +def test_empty(): + x = np.matlib.empty((2,)) + assert_(isinstance(x, np.matrix)) + assert_(x.shape, (1,2)) + +def test_ones(): + assert_array_equal(np.matlib.ones((2, 3)), + np.matrix([[ 1., 1., 1.], + [ 1., 1., 1.]])) + + assert_array_equal(np.matlib.ones(2), np.matrix([[ 1., 1.]])) + +def test_zeros(): + assert_array_equal(np.matlib.zeros((2, 3)), + np.matrix([[ 0., 0., 0.], + [ 0., 0., 0.]])) + + assert_array_equal(np.matlib.zeros(2), np.matrix([[ 0., 0.]])) + +def test_identity(): + x = np.matlib.identity(2, dtype=np.int) + assert_array_equal(x, np.matrix([[1, 0], [0, 1]])) + +def test_eye(): + x = np.matlib.eye(3, k=1, dtype=int) + assert_array_equal(x, np.matrix([[ 0, 1, 0], + [ 0, 0, 1], + [ 0, 0, 0]])) + +def test_rand(): + x = np.matlib.rand(3) + # check matrix type, array would have shape (3,) + assert_(x.ndim == 2) + +def test_randn(): + x = np.matlib.randn(3) + # check matrix type, array would have shape (3,) + assert_(x.ndim == 2) + +def test_repmat(): + a1 = np.arange(4) + x = np.matlib.repmat(a1, 2, 2) + y = np.array([[0, 1, 2, 3, 0, 1, 2, 3], + [0, 1, 2, 3, 0, 1, 2, 3]]) + assert_array_equal(x, y) + + +if __name__ == "__main__": + run_module_suite() From numpy-svn at scipy.org Sat Jul 31 08:27:09 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 31 Jul 2010 07:27:09 -0500 (CDT) Subject: [Numpy-svn] r8568 - trunk/numpy/core/tests Message-ID: <20100731122709.7464039CDF5@scipy.org> Author: darren.dale Date: 2010-07-31 07:27:09 -0500 (Sat, 31 Jul 2010) New Revision: 8568 Modified: trunk/numpy/core/tests/test_getlimits.py Log: remove unnecessary import and reload in test_getlimits, which was causing errors when running the test suite. Modified: trunk/numpy/core/tests/test_getlimits.py =================================================================== --- trunk/numpy/core/tests/test_getlimits.py 2010-07-31 11:49:25 UTC (rev 8567) +++ trunk/numpy/core/tests/test_getlimits.py 2010-07-31 12:27:09 UTC (rev 8568) @@ -3,14 +3,6 @@ from numpy.testing import * -import numpy.lib -try: - reload(numpy.lib) -except NameError: - # Py3K - import imp - imp.reload(numpy.lib) - from numpy.core import finfo, iinfo from numpy import single,double,longdouble import numpy as np From numpy-svn at scipy.org Sat Jul 31 09:07:42 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 31 Jul 2010 08:07:42 -0500 (CDT) Subject: [Numpy-svn] r8569 - in trunk/numpy/core: src/umath tests Message-ID: <20100731130742.C76FA39CDF8@scipy.org> Author: ptvirtan Date: 2010-07-31 08:07:42 -0500 (Sat, 31 Jul 2010) New Revision: 8569 Modified: trunk/numpy/core/src/umath/funcs.inc.src trunk/numpy/core/tests/test_umath.py Log: BUG: core/umath: fix powers of complex 0 (#1271) Modified: trunk/numpy/core/src/umath/funcs.inc.src =================================================================== --- trunk/numpy/core/src/umath/funcs.inc.src 2010-07-31 12:27:09 UTC (rev 8568) +++ trunk/numpy/core/src/umath/funcs.inc.src 2010-07-31 13:07:42 UTC (rev 8569) @@ -238,7 +238,22 @@ return; } if (ar == 0. && ai == 0.) { - *r = npy_cpack at c@(0., 0.); + if (br > 0 && bi == 0) { + *r = npy_cpack at c@(0., 0.); + } + else { + /* NB: there are four complex zeros; c0 = (+-0, +-0), so that unlike + * for reals, c0**p, with `p` negative is in general + * ill-defined. + * + * c0**z with z complex is also ill-defined. + */ + *r = npy_cpack at c@(NPY_NAN, NPY_NAN); + + /* Raise invalid */ + ar = NPY_INFINITY; + ar = ar - ar; + } return; } if (bi == 0 && (n=(intp)br) == br) { Modified: trunk/numpy/core/tests/test_umath.py =================================================================== --- trunk/numpy/core/tests/test_umath.py 2010-07-31 12:27:09 UTC (rev 8568) +++ trunk/numpy/core/tests/test_umath.py 2010-07-31 13:07:42 UTC (rev 8569) @@ -86,7 +86,32 @@ finally: np.seterr(**err) + def test_power_zero(self): + # ticket #1271 + zero = np.array([0j]) + one = np.array([1+0j]) + cinf = np.array([complex(np.inf, 0)]) + cnan = np.array([complex(np.nan, np.nan)]) + def assert_complex_equal(x, y): + x, y = np.asarray(x), np.asarray(y) + assert_array_equal(x.real, y.real) + assert_array_equal(x.imag, y.imag) + + # positive powers + for p in [0.33, 0.5, 1, 1.5, 2, 3, 4, 5, 6.6]: + assert_complex_equal(np.power(zero, p), zero) + + # zero power + assert_complex_equal(np.power(zero, 0), one) + assert_complex_equal(np.power(zero, 0+1j), cnan) + + # negative power + for p in [0.33, 0.5, 1, 1.5, 2, 3, 4, 5, 6.6]: + assert_complex_equal(np.power(zero, -p), cnan) + assert_complex_equal(np.power(zero, -1+0.2j), cnan) + + class TestLog2(TestCase): def test_log2_values(self) : x = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024] From numpy-svn at scipy.org Sat Jul 31 09:16:55 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 31 Jul 2010 08:16:55 -0500 (CDT) Subject: [Numpy-svn] r8570 - in branches/1.5.x/numpy: . tests Message-ID: <20100731131655.6B1B939CDFB@scipy.org> Author: ptvirtan Date: 2010-07-31 08:16:55 -0500 (Sat, 31 Jul 2010) New Revision: 8570 Added: branches/1.5.x/numpy/tests/test_matlib.py Modified: branches/1.5.x/numpy/matlib.py Log: TST: (backport r8567) Add tests for matlib. Closes #1242. (From Ralf Gommers.) Modified: branches/1.5.x/numpy/matlib.py =================================================================== --- branches/1.5.x/numpy/matlib.py 2010-07-31 13:07:42 UTC (rev 8569) +++ branches/1.5.x/numpy/matlib.py 2010-07-31 13:16:55 UTC (rev 8570) @@ -160,10 +160,10 @@ Examples -------- >>> import numpy.matlib - >>> np.identity(3, dtype=int) - array([[1, 0, 0], - [0, 1, 0], - [0, 0, 1]]) + >>> np.matlib.identity(3, dtype=int) + matrix([[1, 0, 0], + [0, 1, 0], + [0, 0, 1]]) """ a = array([1]+n*[0],dtype=dtype) Added: branches/1.5.x/numpy/tests/test_matlib.py =================================================================== --- branches/1.5.x/numpy/tests/test_matlib.py (rev 0) +++ branches/1.5.x/numpy/tests/test_matlib.py 2010-07-31 13:16:55 UTC (rev 8570) @@ -0,0 +1,53 @@ +import numpy as np +import numpy.matlib +from numpy.testing import assert_array_equal, assert_ + +def test_empty(): + x = np.matlib.empty((2,)) + assert_(isinstance(x, np.matrix)) + assert_(x.shape, (1,2)) + +def test_ones(): + assert_array_equal(np.matlib.ones((2, 3)), + np.matrix([[ 1., 1., 1.], + [ 1., 1., 1.]])) + + assert_array_equal(np.matlib.ones(2), np.matrix([[ 1., 1.]])) + +def test_zeros(): + assert_array_equal(np.matlib.zeros((2, 3)), + np.matrix([[ 0., 0., 0.], + [ 0., 0., 0.]])) + + assert_array_equal(np.matlib.zeros(2), np.matrix([[ 0., 0.]])) + +def test_identity(): + x = np.matlib.identity(2, dtype=np.int) + assert_array_equal(x, np.matrix([[1, 0], [0, 1]])) + +def test_eye(): + x = np.matlib.eye(3, k=1, dtype=int) + assert_array_equal(x, np.matrix([[ 0, 1, 0], + [ 0, 0, 1], + [ 0, 0, 0]])) + +def test_rand(): + x = np.matlib.rand(3) + # check matrix type, array would have shape (3,) + assert_(x.ndim == 2) + +def test_randn(): + x = np.matlib.randn(3) + # check matrix type, array would have shape (3,) + assert_(x.ndim == 2) + +def test_repmat(): + a1 = np.arange(4) + x = np.matlib.repmat(a1, 2, 2) + y = np.array([[0, 1, 2, 3, 0, 1, 2, 3], + [0, 1, 2, 3, 0, 1, 2, 3]]) + assert_array_equal(x, y) + + +if __name__ == "__main__": + run_module_suite() From numpy-svn at scipy.org Sat Jul 31 09:17:12 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 31 Jul 2010 08:17:12 -0500 (CDT) Subject: [Numpy-svn] r8571 - in branches/1.5.x/numpy/core: src/umath tests Message-ID: <20100731131712.0DD2239CDFD@scipy.org> Author: ptvirtan Date: 2010-07-31 08:17:11 -0500 (Sat, 31 Jul 2010) New Revision: 8571 Modified: branches/1.5.x/numpy/core/src/umath/funcs.inc.src branches/1.5.x/numpy/core/tests/test_umath.py Log: BUG: (backport r8569) core/umath: fix powers of complex 0 (#1271) Modified: branches/1.5.x/numpy/core/src/umath/funcs.inc.src =================================================================== --- branches/1.5.x/numpy/core/src/umath/funcs.inc.src 2010-07-31 13:16:55 UTC (rev 8570) +++ branches/1.5.x/numpy/core/src/umath/funcs.inc.src 2010-07-31 13:17:11 UTC (rev 8571) @@ -238,7 +238,22 @@ return; } if (ar == 0. && ai == 0.) { - *r = npy_cpack at c@(0., 0.); + if (br > 0 && bi == 0) { + *r = npy_cpack at c@(0., 0.); + } + else { + /* NB: there are four complex zeros; c0 = (+-0, +-0), so that unlike + * for reals, c0**p, with `p` negative is in general + * ill-defined. + * + * c0**z with z complex is also ill-defined. + */ + *r = npy_cpack at c@(NPY_NAN, NPY_NAN); + + /* Raise invalid */ + ar = NPY_INFINITY; + ar = ar - ar; + } return; } if (bi == 0 && (n=(intp)br) == br) { Modified: branches/1.5.x/numpy/core/tests/test_umath.py =================================================================== --- branches/1.5.x/numpy/core/tests/test_umath.py 2010-07-31 13:16:55 UTC (rev 8570) +++ branches/1.5.x/numpy/core/tests/test_umath.py 2010-07-31 13:17:11 UTC (rev 8571) @@ -86,7 +86,32 @@ finally: np.seterr(**err) + def test_power_zero(self): + # ticket #1271 + zero = np.array([0j]) + one = np.array([1+0j]) + cinf = np.array([complex(np.inf, 0)]) + cnan = np.array([complex(np.nan, np.nan)]) + def assert_complex_equal(x, y): + x, y = np.asarray(x), np.asarray(y) + assert_array_equal(x.real, y.real) + assert_array_equal(x.imag, y.imag) + + # positive powers + for p in [0.33, 0.5, 1, 1.5, 2, 3, 4, 5, 6.6]: + assert_complex_equal(np.power(zero, p), zero) + + # zero power + assert_complex_equal(np.power(zero, 0), one) + assert_complex_equal(np.power(zero, 0+1j), cnan) + + # negative power + for p in [0.33, 0.5, 1, 1.5, 2, 3, 4, 5, 6.6]: + assert_complex_equal(np.power(zero, -p), cnan) + assert_complex_equal(np.power(zero, -1+0.2j), cnan) + + class TestLog2(TestCase): def test_log2_values(self) : x = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024] From numpy-svn at scipy.org Sat Jul 31 09:48:52 2010 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 31 Jul 2010 08:48:52 -0500 (CDT) Subject: [Numpy-svn] r8572 - in trunk/numpy/core: src/multiarray tests Message-ID: <20100731134852.9DACA39CD47@scipy.org> Author: ptvirtan Date: 2010-07-31 08:48:52 -0500 (Sat, 31 Jul 2010) New Revision: 8572 Modified: trunk/numpy/core/src/multiarray/item_selection.c trunk/numpy/core/tests/test_regression.py Log: BUG: core: fix refcount error in PyArray_Take (#939) Modified: trunk/numpy/core/src/multiarray/item_selection.c =================================================================== --- trunk/numpy/core/src/multiarray/item_selection.c 2010-07-31 13:17:11 UTC (rev 8571) +++ trunk/numpy/core/src/multiarray/item_selection.c 2010-07-31 13:48:52 UTC (rev 8572) @@ -43,6 +43,7 @@ PyArray_INTP, 1, 0); if (indices == NULL) { + Py_XINCREF(ret); goto fail; } n = m = chunk = 1; Modified: trunk/numpy/core/tests/test_regression.py =================================================================== --- trunk/numpy/core/tests/test_regression.py 2010-07-31 13:17:11 UTC (rev 8571) +++ trunk/numpy/core/tests/test_regression.py 2010-07-31 13:48:52 UTC (rev 8572) @@ -1359,5 +1359,19 @@ y = np.add(x, x, x) assert_equal(id(x), id(y)) + def test_take_refcount(self): + # ticket #939 + a = np.arange(16, dtype=np.float) + a.shape = (4,4) + lut = np.ones((5 + 3, 4), np.float) + rgba = np.empty(shape=a.shape + (4,), dtype=lut.dtype) + c1 = sys.getrefcount(rgba) + try: + lut.take(a, axis=0, mode='clip', out=rgba) + except TypeError: + pass + c2 = sys.getrefcount(rgba) + assert_equal(c1, c2) + if __name__ == "__main__": run_module_suite()