diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-06-12 20:24:52 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-06-12 20:24:52 +0000 |
commit | c0d32936d1991a2cd8a75b21b805777c18be66e9 (patch) | |
tree | ecc4dd875730f526c8c4eddd22d7bb71eadabd3a | |
parent | 844fd39844d3930ffa9c98c7d569b1f9829671ff (diff) | |
download | numpy-c0d32936d1991a2cd8a75b21b805777c18be66e9.tar.gz |
Apply patch #137
-rw-r--r-- | numpy/core/defmatrix.py | 6 | ||||
-rw-r--r-- | numpy/dft/fftpack.py | 12 | ||||
-rw-r--r-- | numpy/lib/function_base.py | 6 | ||||
-rw-r--r-- | numpy/lib/index_tricks.py | 29 | ||||
-rw-r--r-- | numpy/random/mtrand/mtrand.c | 434 | ||||
-rw-r--r-- | numpy/random/mtrand/mtrand.pyx | 22 | ||||
-rw-r--r-- | numpy/testing/utils.py | 12 |
7 files changed, 275 insertions, 246 deletions
diff --git a/numpy/core/defmatrix.py b/numpy/core/defmatrix.py index 24556da43..31572f1b4 100644 --- a/numpy/core/defmatrix.py +++ b/numpy/core/defmatrix.py @@ -2,7 +2,7 @@ __all__ = ['matrix', 'bmat', 'mat', 'asmatrix'] import numeric as N -from numeric import ArrayType, concatenate, isscalar, binary_repr +from numeric import concatenate, isscalar, binary_repr import types import string as str_ import sys @@ -338,12 +338,12 @@ def bmat(obj, ldict=None, gdict=None): # [[A,B],[C,D]] arr_rows = [] for row in obj: - if isinstance(row, ArrayType): # not 2-d + if isinstance(row, N.ndarray): # not 2-d return matrix(concatenate(obj,axis=-1)) else: arr_rows.append(concatenate(row,axis=-1)) return matrix(concatenate(arr_rows,axis=0)) - if isinstance(obj, ArrayType): + if isinstance(obj, N.ndarray): return matrix(obj) mat = matrix diff --git a/numpy/dft/fftpack.py b/numpy/dft/fftpack.py index 70e76085c..22e236370 100644 --- a/numpy/dft/fftpack.py +++ b/numpy/dft/fftpack.py @@ -22,8 +22,8 @@ irefft2(a, s=None, axes=(-2, -1)) __all__ = ['fft','ifft', 'refft', 'irefft', 'hfft', 'ihfft', 'refftn', 'irefftn', 'refft2', 'irefft2', 'fft2', 'ifft2', 'fftn', 'ifftn'] -from numpy.core import asarray, zeros, swapaxes, shape, Complex, conjugate, \ - Float, take +from numpy.core import asarray, zeros, swapaxes, shape, conjugate, \ + take import fftpack_lite as fftpack from helper import * @@ -169,7 +169,7 @@ def hfft(a, n=None, axis=-1): ihfft(hfft(a), len(a)) == a within numerical accuracy.""" - a = asarray(a).astype(Complex) + a = asarray(a).astype(complex) if n == None: n = (shape(a)[axis] - 1) * 2 return irefft(conjugate(a), n, axis) * n @@ -187,7 +187,7 @@ def ihfft(a, n=None, axis=-1): ihfft(hfft(a), len(a)) == a within numerical accuracy.""" - a = asarray(a).astype(Float) + a = asarray(a).astype(float) if n == None: n = shape(a)[axis] return conjugate(refft(a, n, axis))/n @@ -273,7 +273,7 @@ def refftn(a, s=None, axes=None): element of axes, then complex transforms as fft are performed along the other axes.""" - a = asarray(a).astype(Float) + a = asarray(a).astype(float) s, axes = _cook_nd_args(a, s, axes) a = refft(a, s[-1], axes[-1]) for ii in range(len(axes)-1): @@ -298,7 +298,7 @@ def irefftn(a, s=None, axes=None): inverse_real_fft, the length of the result along that axis must be specified if it is to be odd.""" - a = asarray(a).astype(Complex) + a = asarray(a).astype(complex) s, axes = _cook_nd_args(a, s, axes, invreal=1) for ii in range(len(axes)-1): a = ifft(a, s[ii], axes[ii]) diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 5e36f2d07..934f7da33 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -13,12 +13,12 @@ __all__ = ['logspace', 'linspace', import types import numpy.core.numeric as _nx from numpy.core.numeric import ones, zeros, arange, concatenate, array, \ - asarray, empty, empty_like, asanyarray + asarray, empty, empty_like, asanyarray, ndarray from numpy.core.numeric import ScalarType, dot, where, newaxis from numpy.core.umath import pi, multiply, add, arctan2, \ frompyfunc, isnan, cos, less_equal, sqrt, sin, mod, exp from numpy.core.oldnumeric import ravel, nonzero, choose, \ - typecodes, ArrayType, sort + typecodes, sort from numpy.lib.shape_base import atleast_1d from numpy.lib.twodim_base import diag from _compiled_base import digitize, bincount, _insert, add_docstring @@ -148,7 +148,7 @@ def average(a, axis=0, weights=None, returned=False): else: raise ValueError, 'averaging weights have wrong shape' - if not isinstance(d, ArrayType): + if not isinstance(d, ndarray): if d == 0.0: raise ZeroDivisionError, 'zero denominator in average()' if returned: diff --git a/numpy/lib/index_tricks.py b/numpy/lib/index_tricks.py index 13a45498a..c659c7584 100644 --- a/numpy/lib/index_tricks.py +++ b/numpy/lib/index_tricks.py @@ -124,7 +124,7 @@ class nd_grid(object): def __getitem__(self,key): try: size = [] - typecode = _nx.Int + typ = int for k in range(len(key)): step = key[k].step start = key[k].start @@ -132,17 +132,18 @@ class nd_grid(object): if step is None: step=1 if type(step) is type(1j): size.append(int(abs(step))) - typecode = _nx.Float + typ = float else: size.append(int((key[k].stop - start)/(step*1.0))) - if isinstance(step,types.FloatType) or \ - isinstance(start, types.FloatType) or \ - isinstance(key[k].stop, types.FloatType): - typecode = _nx.Float + if isinstance(step, float) or \ + isinstance(start, float) or \ + isinstance(key[k].stop, float): + typ = float if self.sparse: - nn = map(lambda x,t: _nx.arange(x,dtype=t),size,(typecode,)*len(size)) + nn = map(lambda x,t: _nx.arange(x, dtype=t), size, \ + (typ,)*len(size)) else: - nn = _nx.indices(size,typecode) + nn = _nx.indices(size, typ) for k in range(len(size)): step = key[k].step start = key[k].start @@ -169,7 +170,7 @@ class nd_grid(object): length = int(step) step = (key.stop-start)/float(step-1) stop = key.stop+step - return _nx.arange(0,length,1,_nx.Float)*step + start + return _nx.arange(0, length,1, float)*step + start else: return _nx.arange(start, stop, step) @@ -204,18 +205,18 @@ class concatenator(object): self.col = 0 def __getitem__(self,key): - if isinstance(key,types.StringType): + if isinstance(key, str): frame = sys._getframe().f_back mymat = matrix.bmat(key,frame.f_globals,frame.f_locals) return mymat - if type(key) is not types.TupleType: + if type(key) is not tuple: key = (key,) objs = [] scalars = [] final_dtypedescr = None for k in range(len(key)): scalar = False - if type(key[k]) is types.SliceType: + if type(key[k]) is slice: step = key[k].step start = key[k].start stop = key[k].stop @@ -227,7 +228,7 @@ class concatenator(object): newobj = function_base.linspace(start, stop, num=size) else: newobj = _nx.arange(start, stop, step) - elif type(key[k]) is types.StringType: + elif type(key[k]) is str: if (key[k] in 'rc'): self.matrix = True self.col = (key[k] == 'c') @@ -236,7 +237,7 @@ class concatenator(object): self.axis = int(key[k]) continue except: - raise ValueError, "Unknown special directive." + raise ValueError, "unknown special directive" elif type(key[k]) in ScalarType: newobj = asarray([key[k]]) scalars.append(k) diff --git a/numpy/random/mtrand/mtrand.c b/numpy/random/mtrand/mtrand.c index 00b591d1d..d0507ec23 100644 --- a/numpy/random/mtrand/mtrand.c +++ b/numpy/random/mtrand/mtrand.c @@ -1,10 +1,16 @@ -/* Generated by Pyrex 0.9.3.1 on Fri Jun 9 13:55:06 2006 */ +/* Generated by Pyrex 0.9.4.1 on Mon Jun 12 14:22:41 2006 */ #include "Python.h" #include "structmember.h" #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif +#ifdef __cplusplus +#define __PYX_EXTERN_C extern "C" +#else +#define __PYX_EXTERN_C extern +#endif +__PYX_EXTERN_C double pow(double, double); #include "string.h" #include "math.h" #include "numpy/arrayobject.h" @@ -31,11 +37,10 @@ static PyObject *__pyx_m; static PyObject *__pyx_b; static int __pyx_lineno; static char *__pyx_filename; -staticforward char **__pyx_f; +static char **__pyx_f; /* Declarations from mtrand */ -staticforward PyTypeObject __pyx_type_6mtrand_RandomState; struct __pyx_obj_6mtrand_RandomState { PyObject_HEAD @@ -166,7 +171,7 @@ static PyObject *__pyx_n_permutation; static PyObject *__pyx_n_numpy; static PyObject *__pyx_n_empty; -static PyObject *__pyx_n_Float64; +static PyObject *__pyx_n_float64; static PyObject *__pyx_f_6mtrand_cont0_array(rk_state (*__pyx_v_state),double ((*__pyx_v_func)(rk_state (*))),PyObject *__pyx_v_size) { double (*__pyx_v_array_data); @@ -179,7 +184,7 @@ static PyObject *__pyx_f_6mtrand_cont0_array(rk_state (*__pyx_v_state),double (( PyObject *__pyx_3 = 0; PyObject *__pyx_4 = 0; Py_INCREF(__pyx_v_size); - arrayObject = (void *)Py_None; Py_INCREF((PyObject *) arrayObject); + arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":128 */ __pyx_1 = __pyx_v_size == Py_None; @@ -199,7 +204,7 @@ static PyObject *__pyx_f_6mtrand_cont0_array(rk_state (*__pyx_v_state),double (( __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; goto __pyx_L1;} + __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; goto __pyx_L1;} Py_INCREF(__pyx_v_size); @@ -209,7 +214,7 @@ static PyObject *__pyx_f_6mtrand_cont0_array(rk_state (*__pyx_v_state),double (( __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_INCREF(((PyObject *)__pyx_4)); + Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); Py_DECREF(((PyObject *)arrayObject)); arrayObject = ((PyArrayObject *)__pyx_4); Py_DECREF(__pyx_4); __pyx_4 = 0; @@ -225,7 +230,9 @@ static PyObject *__pyx_f_6mtrand_cont0_array(rk_state (*__pyx_v_state),double (( /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":135 */ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state); + __pyx_L3:; } + __pyx_L4:; /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":136 */ Py_INCREF(((PyObject *)arrayObject)); @@ -234,7 +241,7 @@ static PyObject *__pyx_f_6mtrand_cont0_array(rk_state (*__pyx_v_state),double (( } __pyx_L2:; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -259,7 +266,7 @@ static PyObject *__pyx_f_6mtrand_cont1_array(rk_state (*__pyx_v_state),double (( PyObject *__pyx_3 = 0; PyObject *__pyx_4 = 0; Py_INCREF(__pyx_v_size); - arrayObject = (void *)Py_None; Py_INCREF((PyObject *) arrayObject); + arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":144 */ __pyx_1 = __pyx_v_size == Py_None; @@ -279,7 +286,7 @@ static PyObject *__pyx_f_6mtrand_cont1_array(rk_state (*__pyx_v_state),double (( __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; goto __pyx_L1;} + __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; goto __pyx_L1;} Py_INCREF(__pyx_v_size); @@ -289,7 +296,7 @@ static PyObject *__pyx_f_6mtrand_cont1_array(rk_state (*__pyx_v_state),double (( __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_INCREF(((PyObject *)__pyx_4)); + Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); Py_DECREF(((PyObject *)arrayObject)); arrayObject = ((PyArrayObject *)__pyx_4); Py_DECREF(__pyx_4); __pyx_4 = 0; @@ -305,7 +312,9 @@ static PyObject *__pyx_f_6mtrand_cont1_array(rk_state (*__pyx_v_state),double (( /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":151 */ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a); + __pyx_L3:; } + __pyx_L4:; /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":152 */ Py_INCREF(((PyObject *)arrayObject)); @@ -314,7 +323,7 @@ static PyObject *__pyx_f_6mtrand_cont1_array(rk_state (*__pyx_v_state),double (( } __pyx_L2:; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -339,7 +348,7 @@ static PyObject *__pyx_f_6mtrand_cont2_array(rk_state (*__pyx_v_state),double (( PyObject *__pyx_3 = 0; PyObject *__pyx_4 = 0; Py_INCREF(__pyx_v_size); - arrayObject = (void *)Py_None; Py_INCREF((PyObject *) arrayObject); + arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":161 */ __pyx_1 = __pyx_v_size == Py_None; @@ -359,7 +368,7 @@ static PyObject *__pyx_f_6mtrand_cont2_array(rk_state (*__pyx_v_state),double (( __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;} + __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;} Py_INCREF(__pyx_v_size); @@ -369,7 +378,7 @@ static PyObject *__pyx_f_6mtrand_cont2_array(rk_state (*__pyx_v_state),double (( __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_INCREF(((PyObject *)__pyx_4)); + Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); Py_DECREF(((PyObject *)arrayObject)); arrayObject = ((PyArrayObject *)__pyx_4); Py_DECREF(__pyx_4); __pyx_4 = 0; @@ -385,7 +394,9 @@ static PyObject *__pyx_f_6mtrand_cont2_array(rk_state (*__pyx_v_state),double (( /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":168 */ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b); + __pyx_L3:; } + __pyx_L4:; /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":169 */ Py_INCREF(((PyObject *)arrayObject)); @@ -394,7 +405,7 @@ static PyObject *__pyx_f_6mtrand_cont2_array(rk_state (*__pyx_v_state),double (( } __pyx_L2:; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -419,7 +430,7 @@ static PyObject *__pyx_f_6mtrand_cont3_array(rk_state (*__pyx_v_state),double (( PyObject *__pyx_3 = 0; PyObject *__pyx_4 = 0; Py_INCREF(__pyx_v_size); - arrayObject = (void *)Py_None; Py_INCREF((PyObject *) arrayObject); + arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":179 */ __pyx_1 = __pyx_v_size == Py_None; @@ -439,7 +450,7 @@ static PyObject *__pyx_f_6mtrand_cont3_array(rk_state (*__pyx_v_state),double (( __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; goto __pyx_L1;} + __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; goto __pyx_L1;} Py_INCREF(__pyx_v_size); @@ -449,7 +460,7 @@ static PyObject *__pyx_f_6mtrand_cont3_array(rk_state (*__pyx_v_state),double (( __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_INCREF(((PyObject *)__pyx_4)); + Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); Py_DECREF(((PyObject *)arrayObject)); arrayObject = ((PyArrayObject *)__pyx_4); Py_DECREF(__pyx_4); __pyx_4 = 0; @@ -465,7 +476,9 @@ static PyObject *__pyx_f_6mtrand_cont3_array(rk_state (*__pyx_v_state),double (( /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":186 */ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b,__pyx_v_c); + __pyx_L3:; } + __pyx_L4:; /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":187 */ Py_INCREF(((PyObject *)arrayObject)); @@ -474,7 +487,7 @@ static PyObject *__pyx_f_6mtrand_cont3_array(rk_state (*__pyx_v_state),double (( } __pyx_L2:; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -488,7 +501,7 @@ static PyObject *__pyx_f_6mtrand_cont3_array(rk_state (*__pyx_v_state),double (( return __pyx_r; } -static PyObject *__pyx_n_Int; +static PyObject *__pyx_n_int; static PyObject *__pyx_f_6mtrand_disc0_array(rk_state (*__pyx_v_state),long ((*__pyx_v_func)(rk_state (*))),PyObject *__pyx_v_size) { long (*__pyx_v_array_data); @@ -501,7 +514,7 @@ static PyObject *__pyx_f_6mtrand_disc0_array(rk_state (*__pyx_v_state),long ((*_ PyObject *__pyx_3 = 0; PyObject *__pyx_4 = 0; Py_INCREF(__pyx_v_size); - arrayObject = (void *)Py_None; Py_INCREF((PyObject *) arrayObject); + arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":195 */ __pyx_1 = __pyx_v_size == Py_None; @@ -520,21 +533,19 @@ static PyObject *__pyx_f_6mtrand_disc0_array(rk_state (*__pyx_v_state),long ((*_ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; goto __pyx_L1;} __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; goto __pyx_L1;} + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; goto __pyx_L1;} + __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; goto __pyx_L1;} Py_INCREF(__pyx_v_size); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size); - PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; goto __pyx_L1;} + PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_size); + PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2); + __pyx_2 = 0; + __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_INCREF(((PyObject *)__pyx_4)); - Py_DECREF(((PyObject *)arrayObject)); - arrayObject = ((PyArrayObject *)__pyx_4); Py_DECREF(__pyx_4); __pyx_4 = 0; + Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2))); + Py_DECREF(((PyObject *)arrayObject)); + arrayObject = ((PyArrayObject *)__pyx_2); + Py_DECREF(__pyx_2); __pyx_2 = 0; /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":199 */ __pyx_v_length = PyArray_SIZE(arrayObject); @@ -547,7 +558,9 @@ static PyObject *__pyx_f_6mtrand_disc0_array(rk_state (*__pyx_v_state),long ((*_ /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":202 */ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state); + __pyx_L3:; } + __pyx_L4:; /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":203 */ Py_INCREF(((PyObject *)arrayObject)); @@ -556,7 +569,7 @@ static PyObject *__pyx_f_6mtrand_disc0_array(rk_state (*__pyx_v_state),long ((*_ } __pyx_L2:; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -581,7 +594,7 @@ static PyObject *__pyx_f_6mtrand_discnp_array(rk_state (*__pyx_v_state),long ((* PyObject *__pyx_3 = 0; PyObject *__pyx_4 = 0; Py_INCREF(__pyx_v_size); - arrayObject = (void *)Py_None; Py_INCREF((PyObject *) arrayObject); + arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":211 */ __pyx_1 = __pyx_v_size == Py_None; @@ -600,21 +613,19 @@ static PyObject *__pyx_f_6mtrand_discnp_array(rk_state (*__pyx_v_state),long ((* __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;} __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;} + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;} + __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;} Py_INCREF(__pyx_v_size); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size); - PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;} + PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_size); + PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2); + __pyx_2 = 0; + __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_INCREF(((PyObject *)__pyx_4)); - Py_DECREF(((PyObject *)arrayObject)); - arrayObject = ((PyArrayObject *)__pyx_4); Py_DECREF(__pyx_4); __pyx_4 = 0; + Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2))); + Py_DECREF(((PyObject *)arrayObject)); + arrayObject = ((PyArrayObject *)__pyx_2); + Py_DECREF(__pyx_2); __pyx_2 = 0; /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":215 */ __pyx_v_length = PyArray_SIZE(arrayObject); @@ -627,7 +638,9 @@ static PyObject *__pyx_f_6mtrand_discnp_array(rk_state (*__pyx_v_state),long ((* /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":218 */ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_p); + __pyx_L3:; } + __pyx_L4:; /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":219 */ Py_INCREF(((PyObject *)arrayObject)); @@ -636,7 +649,7 @@ static PyObject *__pyx_f_6mtrand_discnp_array(rk_state (*__pyx_v_state),long ((* } __pyx_L2:; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -661,7 +674,7 @@ static PyObject *__pyx_f_6mtrand_discnmN_array(rk_state (*__pyx_v_state),long (( PyObject *__pyx_3 = 0; PyObject *__pyx_4 = 0; Py_INCREF(__pyx_v_size); - arrayObject = (void *)Py_None; Py_INCREF((PyObject *) arrayObject); + arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":228 */ __pyx_1 = __pyx_v_size == Py_None; @@ -680,21 +693,19 @@ static PyObject *__pyx_f_6mtrand_discnmN_array(rk_state (*__pyx_v_state),long (( __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} + __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} Py_INCREF(__pyx_v_size); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size); - PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} + PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_size); + PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2); + __pyx_2 = 0; + __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_INCREF(((PyObject *)__pyx_4)); - Py_DECREF(((PyObject *)arrayObject)); - arrayObject = ((PyArrayObject *)__pyx_4); Py_DECREF(__pyx_4); __pyx_4 = 0; + Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2))); + Py_DECREF(((PyObject *)arrayObject)); + arrayObject = ((PyArrayObject *)__pyx_2); + Py_DECREF(__pyx_2); __pyx_2 = 0; /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":232 */ __pyx_v_length = PyArray_SIZE(arrayObject); @@ -707,7 +718,9 @@ static PyObject *__pyx_f_6mtrand_discnmN_array(rk_state (*__pyx_v_state),long (( /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":235 */ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_m,__pyx_v_N); + __pyx_L3:; } + __pyx_L4:; /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":236 */ Py_INCREF(((PyObject *)arrayObject)); @@ -716,7 +729,7 @@ static PyObject *__pyx_f_6mtrand_discnmN_array(rk_state (*__pyx_v_state),long (( } __pyx_L2:; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -741,7 +754,7 @@ static PyObject *__pyx_f_6mtrand_discd_array(rk_state (*__pyx_v_state),long ((*_ PyObject *__pyx_3 = 0; PyObject *__pyx_4 = 0; Py_INCREF(__pyx_v_size); - arrayObject = (void *)Py_None; Py_INCREF((PyObject *) arrayObject); + arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":244 */ __pyx_1 = __pyx_v_size == Py_None; @@ -760,21 +773,19 @@ static PyObject *__pyx_f_6mtrand_discd_array(rk_state (*__pyx_v_state),long ((*_ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; goto __pyx_L1;} __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; goto __pyx_L1;} + __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; goto __pyx_L1;} + __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; goto __pyx_L1;} Py_INCREF(__pyx_v_size); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size); - PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; goto __pyx_L1;} + PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_size); + PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2); + __pyx_2 = 0; + __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_INCREF(((PyObject *)__pyx_4)); - Py_DECREF(((PyObject *)arrayObject)); - arrayObject = ((PyArrayObject *)__pyx_4); Py_DECREF(__pyx_4); __pyx_4 = 0; + Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2))); + Py_DECREF(((PyObject *)arrayObject)); + arrayObject = ((PyArrayObject *)__pyx_2); + Py_DECREF(__pyx_2); __pyx_2 = 0; /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":248 */ __pyx_v_length = PyArray_SIZE(arrayObject); @@ -787,7 +798,9 @@ static PyObject *__pyx_f_6mtrand_discd_array(rk_state (*__pyx_v_state),long ((*_ /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":251 */ (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a); + __pyx_L3:; } + __pyx_L4:; /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":252 */ Py_INCREF(((PyObject *)arrayObject)); @@ -796,7 +809,7 @@ static PyObject *__pyx_f_6mtrand_discd_array(rk_state (*__pyx_v_state),long ((*_ } __pyx_L2:; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -838,7 +851,9 @@ static double __pyx_f_6mtrand_kahan_sum(double (*__pyx_v_darr),long __pyx_v_n) { /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":263 */ __pyx_v_sum = __pyx_v_t; + __pyx_L2:; } + __pyx_L3:; /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":264 */ __pyx_r = __pyx_v_sum; @@ -846,6 +861,7 @@ static double __pyx_f_6mtrand_kahan_sum(double (*__pyx_v_darr),long __pyx_v_n) { __pyx_r = 0; goto __pyx_L0; + __pyx_L1:; __Pyx_WriteUnraisable("mtrand.kahan_sum"); __pyx_L0:; return __pyx_r; @@ -910,13 +926,13 @@ static void __pyx_f_6mtrand_11RandomState___dealloc__(PyObject *__pyx_v_self) { __pyx_L2:; goto __pyx_L0; + __pyx_L1:; __Pyx_AddTraceback("mtrand.RandomState.__dealloc__"); __pyx_L0:; Py_DECREF(__pyx_v_self); } static PyObject *__pyx_n_type; -static PyObject *__pyx_n_int; static PyObject *__pyx_f_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6mtrand_11RandomState_seed[] = "Seed the generator.\n\n seed(seed=None)\n\n seed can be an integer, an array (or other sequence) of integers of any\n length, or None. If seed is None, then RandomState will try to read data\n from /dev/urandom (or the Windows analogue) if available or seed from\n the clock otherwise.\n "; @@ -935,7 +951,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyOb if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|O", __pyx_argnames, &__pyx_v_seed)) return 0; Py_INCREF(__pyx_v_self); Py_INCREF(__pyx_v_seed); - arrayObject_obj = (void *)Py_None; Py_INCREF((PyObject *) arrayObject_obj); + arrayObject_obj = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":308 */ __pyx_1 = __pyx_v_seed == Py_None; @@ -959,7 +975,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyOb if (__pyx_1) { /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":311 */ - __pyx_5 = PyLong_AsUnsignedLong(__pyx_v_seed); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; goto __pyx_L1;} + __pyx_5 = PyInt_AsUnsignedLongMask(__pyx_v_seed); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; goto __pyx_L1;} rk_seed(__pyx_5,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); goto __pyx_L2; } @@ -967,7 +983,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyOb /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":313 */ __pyx_3 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_seed,PyArray_LONG,1,1)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; goto __pyx_L1;} - Py_INCREF(((PyObject *)__pyx_3)); + Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3))); Py_DECREF(((PyObject *)arrayObject_obj)); arrayObject_obj = ((PyArrayObject *)__pyx_3); Py_DECREF(__pyx_3); __pyx_3 = 0; @@ -977,7 +993,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyOb } __pyx_L2:; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -1007,25 +1023,23 @@ static PyObject *__pyx_f_6mtrand_11RandomState_get_state(PyObject *__pyx_v_self, static char *__pyx_argnames[] = {0}; if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0; Py_INCREF(__pyx_v_self); - arrayObject_state = (void *)Py_None; Py_INCREF((PyObject *) arrayObject_state); + arrayObject_state = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":323 */ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;} __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_empty); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; __pyx_1 = PyInt_FromLong(624); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;} - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4); + __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;} + __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;} + PyTuple_SET_ITEM(__pyx_4, 0, __pyx_1); + PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3); __pyx_1 = 0; - __pyx_4 = 0; - __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;} + __pyx_3 = 0; + __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_INCREF(((PyObject *)__pyx_1)); + Py_DECREF(__pyx_4); __pyx_4 = 0; + Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1))); Py_DECREF(((PyObject *)arrayObject_state)); arrayObject_state = ((PyArrayObject *)__pyx_1); Py_DECREF(__pyx_1); __pyx_1 = 0; @@ -1034,19 +1048,19 @@ static PyObject *__pyx_f_6mtrand_11RandomState_get_state(PyObject *__pyx_v_self, memcpy(((void (*))arrayObject_state->data),((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->key,(624 * (sizeof(long )))); /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":325 */ - __pyx_4 = PyInt_FromLong(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; goto __pyx_L1;} + __pyx_3 = PyInt_FromLong(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; goto __pyx_L1;} __pyx_2 = PyTuple_New(3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; goto __pyx_L1;} Py_INCREF(__pyx_n_MT19937); PyTuple_SET_ITEM(__pyx_2, 0, __pyx_n_MT19937); Py_INCREF(((PyObject *)arrayObject_state)); PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)arrayObject_state)); - PyTuple_SET_ITEM(__pyx_2, 2, __pyx_4); - __pyx_4 = 0; + PyTuple_SET_ITEM(__pyx_2, 2, __pyx_3); + __pyx_3 = 0; __pyx_r = __pyx_2; __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); @@ -1086,9 +1100,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self, if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_state)) return 0; Py_INCREF(__pyx_v_self); Py_INCREF(__pyx_v_state); - arrayObject_obj = (void *)Py_None; Py_INCREF((PyObject *) arrayObject_obj); - __pyx_v_algorithm_name = Py_None; Py_INCREF(__pyx_v_algorithm_name); - __pyx_v_key = Py_None; Py_INCREF(__pyx_v_key); + arrayObject_obj = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + __pyx_v_algorithm_name = Py_None; Py_INCREF(Py_None); + __pyx_v_key = Py_None; Py_INCREF(Py_None); /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":336 */ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; goto __pyx_L1;} @@ -1133,7 +1147,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self, /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":340 */ __pyx_4 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_key,PyArray_LONG,1,1)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; goto __pyx_L1;} - Py_INCREF(((PyObject *)__pyx_4)); + Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); Py_DECREF(((PyObject *)arrayObject_obj)); arrayObject_obj = ((PyArrayObject *)__pyx_4); Py_DECREF(__pyx_4); __pyx_4 = 0; @@ -1163,7 +1177,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self, /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":344 */ ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos = __pyx_v_pos; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); @@ -1200,7 +1214,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState___getstate__(PyObject *__pyx_v_se __pyx_3 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); @@ -1235,7 +1249,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState___setstate__(PyObject *__pyx_v_se Py_DECREF(__pyx_2); __pyx_2 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); @@ -1287,7 +1301,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState___reduce__(PyObject *__pyx_v_self __pyx_3 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); @@ -1320,7 +1334,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_random_sample(PyObject *__pyx_v_s __pyx_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); @@ -1350,7 +1364,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_tomaxint(PyObject *__pyx_v_self, __pyx_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); @@ -1393,7 +1407,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_randint(PyObject *__pyx_v_self, P Py_INCREF(__pyx_v_low); Py_INCREF(__pyx_v_high); Py_INCREF(__pyx_v_size); - arrayObject = (void *)Py_None; Py_INCREF((PyObject *) arrayObject); + arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":384 */ __pyx_1 = __pyx_v_high == Py_None; @@ -1458,21 +1472,19 @@ static PyObject *__pyx_f_6mtrand_11RandomState_randint(PyObject *__pyx_v_self, P __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; goto __pyx_L1;} __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_empty); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; goto __pyx_L1;} Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; goto __pyx_L1;} + __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; goto __pyx_L1;} + __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; goto __pyx_L1;} Py_INCREF(__pyx_v_size); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_size); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; goto __pyx_L1;} + PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_size); + PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3); + __pyx_3 = 0; + __pyx_3 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; goto __pyx_L1;} Py_DECREF(__pyx_5); __pyx_5 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_INCREF(((PyObject *)__pyx_4)); - Py_DECREF(((PyObject *)arrayObject)); - arrayObject = ((PyArrayObject *)__pyx_4); Py_DECREF(__pyx_4); __pyx_4 = 0; + Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3))); + Py_DECREF(((PyObject *)arrayObject)); + arrayObject = ((PyArrayObject *)__pyx_3); + Py_DECREF(__pyx_3); __pyx_3 = 0; /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":399 */ __pyx_v_length = PyArray_SIZE(arrayObject); @@ -1485,7 +1497,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_randint(PyObject *__pyx_v_self, P /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":402 */ (__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))); + __pyx_L5:; } + __pyx_L6:; /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":403 */ Py_INCREF(((PyObject *)arrayObject)); @@ -1494,7 +1508,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_randint(PyObject *__pyx_v_self, P } __pyx_L4:; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_3); @@ -1520,9 +1534,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_bytes(PyObject *__pyx_v_self, PyO PyObject *__pyx_r; PyObject *__pyx_1 = 0; static char *__pyx_argnames[] = {"length",0}; - if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "i", __pyx_argnames, &__pyx_v_length)) return 0; + if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "I", __pyx_argnames, &__pyx_v_length)) return 0; Py_INCREF(__pyx_v_self); - __pyx_v_bytestring = Py_None; Py_INCREF(__pyx_v_bytestring); + __pyx_v_bytestring = Py_None; Py_INCREF(Py_None); /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":411 */ __pyx_v_bytes = PyMem_Malloc(__pyx_v_length); @@ -1544,7 +1558,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_bytes(PyObject *__pyx_v_self, PyO __pyx_r = __pyx_v_bytestring; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); @@ -1578,7 +1592,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self, P __pyx_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); @@ -1657,7 +1671,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_rand(PyObject *__pyx_v_self, PyOb } __pyx_L2:; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); @@ -1735,7 +1749,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_randn(PyObject *__pyx_v_self, PyO } __pyx_L2:; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); @@ -1808,7 +1822,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_random_integers(PyObject *__pyx_v __pyx_4 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -1842,7 +1856,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_normal(PyObject *__pyx_v __pyx_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); @@ -1902,7 +1916,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, Py __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -1980,7 +1994,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyOb __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -2040,7 +2054,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_exponential(PyObject *__pyx_v_sel __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -2072,7 +2086,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_exponential(PyObject *__ __pyx_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); @@ -2129,7 +2143,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v_ __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -2208,7 +2222,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, PyO __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -2286,7 +2300,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObjec __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -2383,7 +2397,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_se __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -2442,7 +2456,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self, __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -2520,7 +2534,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_noncentral_chisquare(PyObject *__ __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -2552,7 +2566,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_cauchy(PyObject *__pyx_v __pyx_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); @@ -2609,7 +2623,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_self __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -2669,7 +2683,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self, __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -2728,7 +2742,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, Py __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -2787,7 +2801,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self, P __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -2846,7 +2860,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_power(PyObject *__pyx_v_self, PyO __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -2908,7 +2922,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self, P __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -2970,7 +2984,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, Py __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -3032,7 +3046,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self, __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -3094,7 +3108,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self, __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -3154,7 +3168,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self, __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -3232,7 +3246,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyOb __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -3329,7 +3343,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_triangular(PyObject *__pyx_v_self __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -3425,7 +3439,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self, __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -3521,7 +3535,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_negative_binomial(PyObject *__pyx __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -3581,7 +3595,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self, P __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -3640,7 +3654,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyOb __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -3717,7 +3731,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self, __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -3832,7 +3846,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v_ __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -3909,7 +3923,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self, __pyx_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_2); @@ -3972,13 +3986,13 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p Py_INCREF(__pyx_v_mean); Py_INCREF(__pyx_v_cov); Py_INCREF(__pyx_v_size); - __pyx_v_shape = Py_None; Py_INCREF(__pyx_v_shape); - __pyx_v_final_shape = Py_None; Py_INCREF(__pyx_v_final_shape); - __pyx_v_x = Py_None; Py_INCREF(__pyx_v_x); - __pyx_v_svd = Py_None; Py_INCREF(__pyx_v_svd); - __pyx_v_u = Py_None; Py_INCREF(__pyx_v_u); - __pyx_v_s = Py_None; Py_INCREF(__pyx_v_s); - __pyx_v_v = Py_None; Py_INCREF(__pyx_v_v); + __pyx_v_shape = Py_None; Py_INCREF(Py_None); + __pyx_v_final_shape = Py_None; Py_INCREF(Py_None); + __pyx_v_x = Py_None; Py_INCREF(Py_None); + __pyx_v_svd = Py_None; Py_INCREF(Py_None); + __pyx_v_u = Py_None; Py_INCREF(Py_None); + __pyx_v_s = Py_None; Py_INCREF(Py_None); + __pyx_v_v = Py_None; Py_INCREF(Py_None); /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":816 */ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; goto __pyx_L1;} @@ -4346,7 +4360,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p __pyx_r = __pyx_v_x; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); @@ -4405,10 +4419,10 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_sel Py_INCREF(__pyx_v_self); Py_INCREF(__pyx_v_pvals); Py_INCREF(__pyx_v_size); - arrayObject_parr = (void *)Py_None; Py_INCREF((PyObject *) arrayObject_parr); - arrayObject_mnarr = (void *)Py_None; Py_INCREF((PyObject *) arrayObject_mnarr); - __pyx_v_shape = Py_None; Py_INCREF(__pyx_v_shape); - __pyx_v_multin = Py_None; Py_INCREF(__pyx_v_multin); + arrayObject_parr = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + arrayObject_mnarr = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + __pyx_v_shape = Py_None; Py_INCREF(Py_None); + __pyx_v_multin = Py_None; Py_INCREF(Py_None); /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":872 */ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; goto __pyx_L1;} @@ -4424,7 +4438,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_sel /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":873 */ __pyx_1 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_pvals,PyArray_DOUBLE,1,1)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; goto __pyx_L1;} - Py_INCREF(((PyObject *)__pyx_1)); + Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1))); Py_DECREF(((PyObject *)arrayObject_parr)); arrayObject_parr = ((PyArrayObject *)__pyx_1); Py_DECREF(__pyx_1); __pyx_1 = 0; @@ -4509,23 +4523,21 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_sel __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; goto __pyx_L1;} __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_zeros); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; goto __pyx_L1;} - __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; goto __pyx_L1;} + __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; goto __pyx_L1;} + __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; goto __pyx_L1;} Py_INCREF(__pyx_v_shape); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_shape); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_1); - __pyx_1 = 0; - __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; goto __pyx_L1;} + PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_shape); + PyTuple_SET_ITEM(__pyx_1, 1, __pyx_3); + __pyx_3 = 0; + __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_v_multin); - __pyx_v_multin = __pyx_1; - __pyx_1 = 0; + __pyx_v_multin = __pyx_3; + __pyx_3 = 0; /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":887 */ - Py_INCREF(((PyObject *)__pyx_v_multin)); + Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_multin))); Py_DECREF(((PyObject *)arrayObject_mnarr)); arrayObject_mnarr = ((PyArrayObject *)__pyx_v_multin); @@ -4537,6 +4549,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_sel /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":890 */ while (1) { + __pyx_L4:; __pyx_5 = (__pyx_v_i < PyArray_SIZE(arrayObject_mnarr)); if (!__pyx_5) break; @@ -4568,6 +4581,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_sel /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":898 */ __pyx_v_Sum = (__pyx_v_Sum - (__pyx_v_pix[__pyx_v_j])); + __pyx_L6:; } __pyx_L7:; @@ -4584,13 +4598,14 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_sel /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":902 */ __pyx_v_i = (__pyx_v_i + __pyx_v_d); } + __pyx_L5:; /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":904 */ Py_INCREF(__pyx_v_multin); __pyx_r = __pyx_v_multin; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); @@ -4644,6 +4659,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self, P /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":916 */ while (1) { + __pyx_L2:; __pyx_5 = (__pyx_v_i > 0); if (!__pyx_5) break; @@ -4669,8 +4685,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self, P /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":919 */ __pyx_v_i = (__pyx_v_i - 1); } + __pyx_L3:; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); @@ -4700,7 +4717,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_permutation(PyObject *__pyx_v_sel if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_x)) return 0; Py_INCREF(__pyx_v_self); Py_INCREF(__pyx_v_x); - __pyx_v_arr = Py_None; Py_INCREF(__pyx_v_arr); + __pyx_v_arr = Py_None; Py_INCREF(Py_None); /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":927 */ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;} @@ -4764,7 +4781,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_permutation(PyObject *__pyx_v_sel __pyx_r = __pyx_v_arr; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(__pyx_r); + __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); @@ -4780,8 +4797,6 @@ static PyObject *__pyx_f_6mtrand_11RandomState_permutation(PyObject *__pyx_v_sel } static __Pyx_InternTabEntry __pyx_intern_tab[] = { - {&__pyx_n_Float64, "Float64"}, - {&__pyx_n_Int, "Int"}, {&__pyx_n_MT19937, "MT19937"}, {&__pyx_n_ValueError, "ValueError"}, {&__pyx_n___RandomState_ctor, "__RandomState_ctor"}, @@ -4799,6 +4814,7 @@ static __Pyx_InternTabEntry __pyx_intern_tab[] = { {&__pyx_n_empty, "empty"}, {&__pyx_n_exponential, "exponential"}, {&__pyx_n_f, "f"}, + {&__pyx_n_float64, "float64"}, {&__pyx_n_gamma, "gamma"}, {&__pyx_n_geometric, "geometric"}, {&__pyx_n_get_state, "get_state"}, @@ -4921,6 +4937,7 @@ static PyObject *__pyx_tp_new_6mtrand_RandomState(PyTypeObject *t, PyObject *a, } static void __pyx_tp_dealloc_6mtrand_RandomState(PyObject *o) { + struct __pyx_obj_6mtrand_RandomState *p = (struct __pyx_obj_6mtrand_RandomState *)o; { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); @@ -4934,10 +4951,13 @@ static void __pyx_tp_dealloc_6mtrand_RandomState(PyObject *o) { } static int __pyx_tp_traverse_6mtrand_RandomState(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_6mtrand_RandomState *p = (struct __pyx_obj_6mtrand_RandomState *)o; return 0; } static int __pyx_tp_clear_6mtrand_RandomState(PyObject *o) { + struct __pyx_obj_6mtrand_RandomState *p = (struct __pyx_obj_6mtrand_RandomState *)o; return 0; } @@ -5061,7 +5081,7 @@ static PyBufferProcs __pyx_tp_as_buffer_RandomState = { 0, /*bf_getcharbuffer*/ }; -statichere PyTypeObject __pyx_type_6mtrand_RandomState = { +PyTypeObject __pyx_type_6mtrand_RandomState = { PyObject_HEAD_INIT(0) 0, /*ob_size*/ "mtrand.RandomState", /*tp_name*/ @@ -5082,7 +5102,7 @@ statichere PyTypeObject __pyx_type_6mtrand_RandomState = { 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_RandomState, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ "Container for the Mersenne Twister PRNG.\n\n Constructor\n -----------\n RandomState(seed=None): initializes the PRNG with the given seed. See the\n seed() method for details.\n\n Distribution Methods\n -----------------\n RandomState exposes a number of methods for generating random numbers drawn\n from a variety of probability distributions. In addition to the\n distribution-specific arguments, each method takes a keyword argument\n size=None. If size is None, then a single value is generated and returned.\n If size is an integer, then a 1-D numpy array filled with generated values\n is returned. If size is a tuple, then a numpy array with that shape is\n filled and returned.\n ", /*tp_doc*/ __pyx_tp_traverse_6mtrand_RandomState, /*tp_traverse*/ __pyx_tp_clear_6mtrand_RandomState, /*tp_clear*/ @@ -5114,10 +5134,13 @@ static struct PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; -DL_EXPORT(void) initmtrand(void); /*proto*/ -DL_EXPORT(void) initmtrand(void) { +static void __pyx_init_filenames(void); /*proto*/ + +PyMODINIT_FUNC initmtrand(void); /*proto*/ +PyMODINIT_FUNC initmtrand(void) { PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; + __pyx_init_filenames(); __pyx_m = Py_InitModule4("mtrand", __pyx_methods, 0, 0, PYTHON_API_VERSION); if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;}; __pyx_b = PyImport_AddModule("__builtin__"); @@ -5651,10 +5674,13 @@ static char *__pyx_filenames[] = { "mtrand.pyx", "numpy.pxi", }; -statichere char **__pyx_f = __pyx_filenames; /* Runtime support code */ +static void __pyx_init_filenames(void) { + __pyx_f = __pyx_filenames; +} + static int __Pyx_GetStarArgs( PyObject **args, PyObject **kwds, @@ -5719,8 +5745,10 @@ static int __Pyx_GetStarArgs( bad: Py_XDECREF(args1); Py_XDECREF(kwds1); - Py_XDECREF(*args2); - Py_XDECREF(*kwds2); + if (*args2) + Py_XDECREF(*args2); + if (*kwds2) + Py_XDECREF(*kwds2); return -1; } @@ -5843,23 +5871,23 @@ static void __Pyx_UnpackError(void) { } static PyObject *__Pyx_UnpackItem(PyObject *seq, int i) { - PyObject *item = PySequence_GetItem(seq, i); - if (!item) { + PyObject *item; + if (!(item = PySequence_GetItem(seq, i))) { if (PyErr_ExceptionMatches(PyExc_IndexError)) - __Pyx_UnpackError(); + __Pyx_UnpackError(); } return item; } static int __Pyx_EndUnpack(PyObject *seq, int i) { - PyObject *item = PySequence_GetItem(seq, i); - if (item) { + PyObject *item; + if (item = PySequence_GetItem(seq, i)) { Py_DECREF(item); __Pyx_UnpackError(); return -1; } PyErr_Clear(); - return 0; + return 0; } static int __Pyx_InternStrings(__Pyx_InternTabEntry *t) { diff --git a/numpy/random/mtrand/mtrand.pyx b/numpy/random/mtrand/mtrand.pyx index 600cd9321..623c87d14 100644 --- a/numpy/random/mtrand/mtrand.pyx +++ b/numpy/random/mtrand/mtrand.pyx @@ -128,7 +128,7 @@ cdef object cont0_array(rk_state *state, rk_cont0 func, object size): if size is None: return func(state) else: - array = <ndarray>_sp.empty(size, _sp.Float64) + array = <ndarray>_sp.empty(size, _sp.float64) length = PyArray_SIZE(array) array_data = <double *>array.data for i from 0 <= i < length: @@ -144,7 +144,7 @@ cdef object cont1_array(rk_state *state, rk_cont1 func, object size, double a): if size is None: return func(state, a) else: - array = <ndarray>_sp.empty(size, _sp.Float64) + array = <ndarray>_sp.empty(size, _sp.float64) length = PyArray_SIZE(array) array_data = <double *>array.data for i from 0 <= i < length: @@ -161,7 +161,7 @@ cdef object cont2_array(rk_state *state, rk_cont2 func, object size, double a, if size is None: return func(state, a, b) else: - array = <ndarray>_sp.empty(size, _sp.Float64) + array = <ndarray>_sp.empty(size, _sp.float64) length = PyArray_SIZE(array) array_data = <double *>array.data for i from 0 <= i < length: @@ -179,7 +179,7 @@ cdef object cont3_array(rk_state *state, rk_cont3 func, object size, double a, if size is None: return func(state, a, b, c) else: - array = <ndarray>_sp.empty(size, _sp.Float64) + array = <ndarray>_sp.empty(size, _sp.float64) length = PyArray_SIZE(array) array_data = <double *>array.data for i from 0 <= i < length: @@ -195,7 +195,7 @@ cdef object disc0_array(rk_state *state, rk_disc0 func, object size): if size is None: return func(state) else: - array = <ndarray>_sp.empty(size, _sp.Int) + array = <ndarray>_sp.empty(size, int) length = PyArray_SIZE(array) array_data = <long *>array.data for i from 0 <= i < length: @@ -211,7 +211,7 @@ cdef object discnp_array(rk_state *state, rk_discnp func, object size, long n, d if size is None: return func(state, n, p) else: - array = <ndarray>_sp.empty(size, _sp.Int) + array = <ndarray>_sp.empty(size, int) length = PyArray_SIZE(array) array_data = <long *>array.data for i from 0 <= i < length: @@ -228,7 +228,7 @@ cdef object discnmN_array(rk_state *state, rk_discnmN func, object size, if size is None: return func(state, n, m, N) else: - array = <ndarray>_sp.empty(size, _sp.Int) + array = <ndarray>_sp.empty(size, int) length = PyArray_SIZE(array) array_data = <long *>array.data for i from 0 <= i < length: @@ -244,7 +244,7 @@ cdef object discd_array(rk_state *state, rk_discd func, object size, double a): if size is None: return func(state, a) else: - array = <ndarray>_sp.empty(size, _sp.Int) + array = <ndarray>_sp.empty(size, int) length = PyArray_SIZE(array) array_data = <long *>array.data for i from 0 <= i < length: @@ -320,7 +320,7 @@ cdef class RandomState: get_state() -> ('MT19937', int key[624], int pos) """ cdef ndarray state "arrayObject_state" - state = <ndarray>_sp.empty(624, _sp.Int) + state = <ndarray>_sp.empty(624, int) memcpy(<void*>(state.data), self.internal_state.key, 624*sizeof(long)) return ('MT19937', state, self.internal_state.pos) @@ -395,7 +395,7 @@ cdef class RandomState: if size is None: return rk_interval(diff, self.internal_state) + lo else: - array = <ndarray>_sp.empty(size, _sp.Int) + array = <ndarray>_sp.empty(size, int) length = PyArray_SIZE(array) array_data = <long *>array.data for i from 0 <= i < length: @@ -883,7 +883,7 @@ cdef class RandomState: else: shape = size + (d,) - multin = _sp.zeros(shape, _sp.Int) + multin = _sp.zeros(shape, int) mnarr = <ndarray>multin mnix = <long*>mnarr.data i = 0 diff --git a/numpy/testing/utils.py b/numpy/testing/utils.py index 60fce8514..fcffc9002 100644 --- a/numpy/testing/utils.py +++ b/numpy/testing/utils.py @@ -16,8 +16,8 @@ def rand(*args): This only uses the standard library, so it is useful for testing purposes. """ import random - from numpy.core import zeros, Float64 - results = zeros(args,Float64) + from numpy.core import zeros, float64 + results = zeros(args, float64) f = results.flat for i in range(len(f)): f[i] = random.random() @@ -137,8 +137,8 @@ def assert_equal(actual,desired,err_msg='',verbose=True): for k in range(len(desired)): assert_equal(actual[k], desired[k], 'item=%r\n%s' % (k,err_msg), verbose) return - from numpy.core import ArrayType - if isinstance(actual, ArrayType) or isinstance(desired, ArrayType): + from numpy.core import ndarray + if isinstance(actual, ndarray) or isinstance(desired, ndarray): return assert_array_equal(actual, desired, err_msg) msg = build_err_msg(actual, desired, err_msg, verbose=verbose) assert desired == actual, msg @@ -150,8 +150,8 @@ def assert_almost_equal(actual,desired,decimal=7,err_msg='',verbose=True): The test is equivalent to abs(desired-actual) < 0.5 * 10**(-decimal) """ - from numpy.core import ArrayType - if isinstance(actual, ArrayType) or isinstance(desired, ArrayType): + from numpy.core import ndarray + if isinstance(actual, ndarray) or isinstance(desired, ndarray): return assert_array_almost_equal(actual, desired, decimal, err_msg) msg = build_err_msg(actual, desired, err_msg, verbose=verbose) assert round(abs(desired - actual),decimal) == 0, msg |