summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
Diffstat (limited to 'numpy')
-rw-r--r--numpy/add_newdocs.py4
-rw-r--r--numpy/core/SConscript8
-rw-r--r--numpy/core/code_generators/cversions.txt3
-rw-r--r--numpy/core/code_generators/genapi.py4
-rw-r--r--numpy/core/code_generators/numpy_api.py103
-rw-r--r--numpy/core/fromnumeric.py6
-rw-r--r--numpy/core/include/numpy/ndarraytypes.h8
-rw-r--r--numpy/core/memmap.py10
-rw-r--r--numpy/core/numeric.py4
-rw-r--r--numpy/core/setup.py6
-rw-r--r--numpy/core/setup_common.py2
-rw-r--r--numpy/core/src/multiarray/arraytypes.c.src9
-rw-r--r--numpy/core/src/multiarray/convert.c9
-rw-r--r--numpy/core/src/multiarray/convert.h3
-rw-r--r--numpy/core/src/multiarray/convert_datatype.c54
-rw-r--r--numpy/core/src/multiarray/ctors.c79
-rw-r--r--numpy/core/src/multiarray/dtype_transfer.c41
-rw-r--r--numpy/core/src/multiarray/einsum.c.src60
-rw-r--r--numpy/core/src/multiarray/item_selection.c14
-rw-r--r--numpy/core/src/multiarray/iterators.c4
-rw-r--r--numpy/core/src/multiarray/lowlevel_strided_loops.c.src42
-rw-r--r--numpy/core/src/multiarray/methods.c3
-rw-r--r--numpy/core/src/multiarray/multiarraymodule.c13
-rw-r--r--numpy/core/src/multiarray/multiarraymodule_onefile.c4
-rw-r--r--numpy/core/src/multiarray/nditer.c.src (renamed from numpy/core/src/multiarray/new_iterator.c.src)651
-rw-r--r--numpy/core/src/multiarray/nditer_pywrap.c (renamed from numpy/core/src/multiarray/new_iterator_pywrap.c)145
-rw-r--r--numpy/core/src/multiarray/nditer_pywrap.h (renamed from numpy/core/src/multiarray/new_iterator_pywrap.h)0
-rw-r--r--numpy/core/src/umath/loops.c.src60
-rw-r--r--numpy/core/src/umath/ufunc_object.c200
-rw-r--r--numpy/core/tests/test_iterator.py (renamed from numpy/core/tests/test_new_iterator.py)645
-rw-r--r--numpy/core/tests/test_memmap.py8
-rw-r--r--numpy/core/tests/test_multiarray.py53
-rw-r--r--numpy/core/tests/test_regression.py27
-rw-r--r--numpy/core/tests/test_umath.py84
-rw-r--r--numpy/core/tests/test_umath_complex.py20
-rw-r--r--numpy/distutils/ccompiler.py3
-rw-r--r--numpy/distutils/fcompiler/intel.py8
-rw-r--r--numpy/distutils/intelccompiler.py20
-rw-r--r--numpy/distutils/tests/test_fcompiler_intel.py34
-rw-r--r--numpy/doc/structured_arrays.py28
-rw-r--r--numpy/f2py/auxfuncs.py15
-rw-r--r--numpy/f2py/capi_maps.py11
-rwxr-xr-xnumpy/f2py/crackfortran.py46
-rw-r--r--numpy/f2py/func2subr.py176
-rw-r--r--numpy/f2py/rules.py37
-rw-r--r--numpy/f2py/tests/src/assumed_shape/.f2py_f2cmap1
-rw-r--r--numpy/f2py/tests/src/assumed_shape/foo_free.f9034
-rw-r--r--numpy/f2py/tests/src/assumed_shape/foo_use.f9019
-rw-r--r--numpy/f2py/tests/src/assumed_shape/precision.f904
-rw-r--r--numpy/f2py/tests/src/kind/foo.f9020
-rw-r--r--numpy/f2py/tests/src/size/foo.f9014
-rw-r--r--numpy/f2py/tests/test_array_from_pyobj.py195
-rw-r--r--numpy/f2py/tests/test_assumed_shape.py30
-rw-r--r--numpy/f2py/tests/test_callback.py22
-rw-r--r--numpy/f2py/tests/test_kind.py34
-rw-r--r--numpy/f2py/tests/test_mixed.py6
-rw-r--r--numpy/f2py/tests/test_return_character.py22
-rw-r--r--numpy/f2py/tests/test_return_complex.py46
-rw-r--r--numpy/f2py/tests/test_return_integer.py34
-rw-r--r--numpy/f2py/tests/test_return_logical.py76
-rw-r--r--numpy/f2py/tests/test_return_real.py40
-rw-r--r--numpy/f2py/tests/test_size.py29
-rw-r--r--numpy/f2py/tests/util.py6
-rw-r--r--numpy/fft/fftpack.py12
-rw-r--r--numpy/lib/arraysetops.py78
-rw-r--r--numpy/lib/benchmarks/bench_arraysetops.py65
-rw-r--r--numpy/lib/function_base.py18
-rw-r--r--numpy/lib/npyio.py26
-rw-r--r--numpy/lib/src/_compiled_base.c20
-rw-r--r--numpy/lib/tests/test_arraysetops.py45
-rw-r--r--numpy/lib/tests/test_function_base.py81
-rw-r--r--numpy/lib/tests/test_regression.py5
-rw-r--r--numpy/lib/tests/test_ufunclike.py13
-rw-r--r--numpy/lib/ufunclike.py42
-rw-r--r--numpy/lib/utils.py3
-rw-r--r--numpy/ma/core.py49
-rw-r--r--numpy/ma/extras.py10
-rw-r--r--numpy/ma/tests/test_core.py132
-rw-r--r--numpy/ma/tests/test_subclassing.py8
-rw-r--r--numpy/random/mtrand/mtrand.c12416
-rw-r--r--numpy/random/mtrand/mtrand.pyx9
-rw-r--r--numpy/random/tests/test_random.py368
-rw-r--r--numpy/testing/tests/test_utils.py9
-rw-r--r--numpy/testing/utils.py225
84 files changed, 9349 insertions, 7681 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py
index 187180c5a..c62fcd186 100644
--- a/numpy/add_newdocs.py
+++ b/numpy/add_newdocs.py
@@ -1238,8 +1238,8 @@ add_newdoc('numpy.core.multiarray', 'can_cast',
Parameters
----------
- fromtype : dtype or dtype specifier
- Data type to cast from.
+ from : dtype, dtype specifier, scalar, or array
+ Data type, scalar, or array to cast from.
totype : dtype or dtype specifier
Data type to cast to.
casting : casting rule
diff --git a/numpy/core/SConscript b/numpy/core/SConscript
index 5bf6bc5a4..bb19b9828 100644
--- a/numpy/core/SConscript
+++ b/numpy/core/SConscript
@@ -379,8 +379,8 @@ umath_funcs_src = env.GenerateFromTemplate(pjoin('src', 'umath', 'funcs.inc.src'
umath_loops_src = env.GenerateFromTemplate(pjoin('src', 'umath', 'loops.c.src'))
arraytypes_src = env.GenerateFromTemplate(
pjoin('src', 'multiarray', 'arraytypes.c.src'))
-new_iterator_src = env.GenerateFromTemplate(
- pjoin('src', 'multiarray', 'new_iterator.c.src'))
+nditer_src = env.GenerateFromTemplate(
+ pjoin('src', 'multiarray', 'nditer.c.src'))
lowlevel_strided_loops_src = env.GenerateFromTemplate(
pjoin('src', 'multiarray', 'lowlevel_strided_loops.c.src'))
einsum_src = env.GenerateFromTemplate(pjoin('src', 'multiarray', 'einsum.c.src'))
@@ -461,12 +461,12 @@ if ENABLE_SEPARATE_COMPILATION:
pjoin('src', 'multiarray', 'buffer.c'),
pjoin('src', 'multiarray', 'numpymemoryview.c'),
pjoin('src', 'multiarray', 'scalarapi.c'),
- pjoin('src', 'multiarray', 'new_iterator_pywrap.c'),
+ pjoin('src', 'multiarray', 'nditer_pywrap.c'),
pjoin('src', 'multiarray', 'dtype_transfer.c')]
multiarray_src.extend(arraytypes_src)
multiarray_src.extend(scalartypes_src)
multiarray_src.extend(lowlevel_strided_loops_src)
- multiarray_src.extend(new_iterator_src)
+ multiarray_src.extend(nditer_src)
multiarray_src.extend(einsum_src)
if PYTHON_HAS_UNICODE_WIDE:
multiarray_src.extend([pjoin("src", "multiarray", "ucsnarrow.c")])
diff --git a/numpy/core/code_generators/cversions.txt b/numpy/core/code_generators/cversions.txt
index 693ff506c..633c1be96 100644
--- a/numpy/core/code_generators/cversions.txt
+++ b/numpy/core/code_generators/cversions.txt
@@ -6,3 +6,6 @@
# version 4 added neighborhood iterators and PyArray_Correlate2
0x00000004 = 3d8940bf7b0d2a4e25be4338c14c3c85
0x00000005 = 77e2e846db87f25d7cf99f9d812076f0
+# Version 6 added new iterator, half float and casting functions,
+# PyArray_CountNonzero, PyArray_NewLikeArray and PyArray_MatrixProduct2.
+0x00000006 = a413221a7ff73fcf251aeb5ee8fa73ff
diff --git a/numpy/core/code_generators/genapi.py b/numpy/core/code_generators/genapi.py
index 7c6b29e73..2f6d0039a 100644
--- a/numpy/core/code_generators/genapi.py
+++ b/numpy/core/code_generators/genapi.py
@@ -44,8 +44,8 @@ API_FILES = [join('multiarray', 'methods.c'),
join('multiarray', 'conversion_utils.c'),
join('multiarray', 'buffer.c'),
join('multiarray', 'datetime.c'),
- join('multiarray', 'new_iterator.c.src'),
- join('multiarray', 'new_iterator_pywrap.c'),
+ join('multiarray', 'nditer.c.src'),
+ join('multiarray', 'nditer_pywrap.c'),
join('multiarray', 'einsum.c.src'),
join('umath', 'ufunc_object.c'),
join('umath', 'loops.c.src'),
diff --git a/numpy/core/code_generators/numpy_api.py b/numpy/core/code_generators/numpy_api.py
index 6a1d16904..4aef212bf 100644
--- a/numpy/core/code_generators/numpy_api.py
+++ b/numpy/core/code_generators/numpy_api.py
@@ -259,62 +259,61 @@ multiarray_funcs_api = {
# New Iterator API
'NpyIter_New': 224,
'NpyIter_MultiNew': 225,
- 'NpyIter_Copy': 226,
- 'NpyIter_Deallocate': 227,
- 'NpyIter_HasDelayedBufAlloc': 228,
- 'NpyIter_HasInnerLoop': 229,
- 'NpyIter_RemoveInnerLoop': 230,
- 'NpyIter_GetInnerStrideArray': 231,
- 'NpyIter_GetInnerLoopSizePtr': 232,
- 'NpyIter_Reset': 233,
- 'NpyIter_ResetBasePointers': 234,
- 'NpyIter_ResetToIterIndexRange': 235,
- 'NpyIter_GetNDim': 236,
- 'NpyIter_GetNIter': 237,
- 'NpyIter_GetIterNext': 238,
- 'NpyIter_GetIterSize': 239,
- 'NpyIter_GetIterIndexRange': 240,
- 'NpyIter_GetIterIndex': 241,
- 'NpyIter_GotoIterIndex': 242,
- 'NpyIter_HasCoords': 243,
- 'NpyIter_GetShape': 244,
- 'NpyIter_GetGetCoords': 245,
- 'NpyIter_GotoCoords': 246,
- 'NpyIter_RemoveCoords': 247,
- 'NpyIter_HasIndex': 248,
- 'NpyIter_IsBuffered': 249,
- 'NpyIter_IsGrowInner': 250,
- 'NpyIter_GetBufferSize': 251,
- 'NpyIter_GetIndexPtr': 252,
- 'NpyIter_GotoIndex': 253,
- 'NpyIter_GetDataPtrArray': 254,
- 'NpyIter_GetDescrArray': 255,
- 'NpyIter_GetOperandArray': 256,
- 'NpyIter_GetIterView': 257,
- 'NpyIter_GetReadFlags': 258,
- 'NpyIter_GetWriteFlags': 259,
- 'NpyIter_DebugPrint': 260,
- 'NpyIter_IterationNeedsAPI': 261,
- 'NpyIter_GetInnerFixedStrideArray': 262,
- 'NpyIter_RemoveAxis': 263,
- 'NpyIter_GetAxisStrideArray': 264,
- 'NpyIter_RequiresBuffering': 265,
- 'NpyIter_GetInitialDataPtrArray': 266,
- 'NpyIter_CreateCompatibleStrides': 267,
+ 'NpyIter_AdvancedNew': 226,
+ 'NpyIter_Copy': 227,
+ 'NpyIter_Deallocate': 228,
+ 'NpyIter_HasDelayedBufAlloc': 229,
+ 'NpyIter_HasExternalLoop': 230,
+ 'NpyIter_EnableExternalLoop': 231,
+ 'NpyIter_GetInnerStrideArray': 232,
+ 'NpyIter_GetInnerLoopSizePtr': 233,
+ 'NpyIter_Reset': 234,
+ 'NpyIter_ResetBasePointers': 235,
+ 'NpyIter_ResetToIterIndexRange': 236,
+ 'NpyIter_GetNDim': 237,
+ 'NpyIter_GetNIter': 238,
+ 'NpyIter_GetIterNext': 239,
+ 'NpyIter_GetIterSize': 240,
+ 'NpyIter_GetIterIndexRange': 241,
+ 'NpyIter_GetIterIndex': 242,
+ 'NpyIter_GotoIterIndex': 243,
+ 'NpyIter_HasCoords': 244,
+ 'NpyIter_GetShape': 245,
+ 'NpyIter_GetGetCoords': 246,
+ 'NpyIter_GotoCoords': 247,
+ 'NpyIter_RemoveCoords': 248,
+ 'NpyIter_HasIndex': 249,
+ 'NpyIter_IsBuffered': 250,
+ 'NpyIter_IsGrowInner': 251,
+ 'NpyIter_GetBufferSize': 252,
+ 'NpyIter_GetIndexPtr': 253,
+ 'NpyIter_GotoIndex': 254,
+ 'NpyIter_GetDataPtrArray': 255,
+ 'NpyIter_GetDescrArray': 256,
+ 'NpyIter_GetOperandArray': 257,
+ 'NpyIter_GetIterView': 258,
+ 'NpyIter_GetReadFlags': 259,
+ 'NpyIter_GetWriteFlags': 260,
+ 'NpyIter_DebugPrint': 261,
+ 'NpyIter_IterationNeedsAPI': 262,
+ 'NpyIter_GetInnerFixedStrideArray': 263,
+ 'NpyIter_RemoveAxis': 264,
+ 'NpyIter_GetAxisStrideArray': 265,
+ 'NpyIter_RequiresBuffering': 266,
+ 'NpyIter_GetInitialDataPtrArray': 267,
+ 'NpyIter_CreateCompatibleStrides': 268,
#
- 'PyArray_CastingConverter': 268,
- 'PyArray_CountNonzero': 269,
- 'PyArray_PromoteTypes': 270,
- 'PyArray_MinScalarType': 271,
- 'PyArray_ResultType': 272,
- 'PyArray_CanCastArrayTo': 273,
- 'PyArray_CanCastTypeTo': 274,
- 'PyArray_EinsteinSum': 275,
- 'PyArray_FillWithZero': 276,
+ 'PyArray_CastingConverter': 269,
+ 'PyArray_CountNonzero': 270,
+ 'PyArray_PromoteTypes': 271,
+ 'PyArray_MinScalarType': 272,
+ 'PyArray_ResultType': 273,
+ 'PyArray_CanCastArrayTo': 274,
+ 'PyArray_CanCastTypeTo': 275,
+ 'PyArray_EinsteinSum': 276,
'PyArray_NewLikeArray': 277,
'PyArray_GetArrayParamsFromObject': 278,
'PyArray_ConvertClipmodeSequence': 279,
- #
'PyArray_MatrixProduct2': 280,
}
diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py
index d66e5cb68..602c0ebc5 100644
--- a/numpy/core/fromnumeric.py
+++ b/numpy/core/fromnumeric.py
@@ -1788,8 +1788,10 @@ def amax(a, axis=None, out=None):
Returns
-------
- amax : ndarray
- A new array or scalar array with the result.
+ amax : ndarray or scalar
+ Maximum of `a`. If `axis` is None, the result is a scalar value.
+ If `axis` is given, the result is an array of dimension
+ ``a.ndim - 1``.
See Also
--------
diff --git a/numpy/core/include/numpy/ndarraytypes.h b/numpy/core/include/numpy/ndarraytypes.h
index 0fa146d79..26077ba59 100644
--- a/numpy/core/include/numpy/ndarraytypes.h
+++ b/numpy/core/include/numpy/ndarraytypes.h
@@ -867,8 +867,8 @@ typedef int (PyArray_FinalizeFunc)(PyArrayObject *, PyObject *);
typedef struct NpyIter_InternalOnly NpyIter;
/* Iterator function pointers that may be specialized */
-typedef int (*NpyIter_IterNext_Fn )(NpyIter *iter);
-typedef void (*NpyIter_GetCoords_Fn )(NpyIter *iter,
+typedef int (NpyIter_IterNextFunc)(NpyIter *iter);
+typedef void (NpyIter_GetCoordsFunc)(NpyIter *iter,
npy_intp *outcoords);
/*** Global flags that may be passed to the iterator constructors ***/
@@ -879,8 +879,8 @@ typedef void (*NpyIter_GetCoords_Fn )(NpyIter *iter,
#define NPY_ITER_F_INDEX 0x00000002
/* Track coordinates */
#define NPY_ITER_COORDS 0x00000004
-/* Let the caller handle the inner loop of iteration */
-#define NPY_ITER_NO_INNER_ITERATION 0x00000008
+/* User code external to the iterator does the 1-dimensional innermost loop */
+#define NPY_ITER_EXTERNAL_LOOP 0x00000008
/* Convert all the operands to a common data type */
#define NPY_ITER_COMMON_DTYPE 0x00000010
/* Operands may hold references, requiring API access during iteration */
diff --git a/numpy/core/memmap.py b/numpy/core/memmap.py
index 71f5de93c..844e13c4e 100644
--- a/numpy/core/memmap.py
+++ b/numpy/core/memmap.py
@@ -278,11 +278,6 @@ class memmap(ndarray):
if self._mmap is not None:
self._mmap.flush()
- def sync(self):
- """This method is deprecated, use `flush`."""
- warnings.warn("Use ``flush``.", DeprecationWarning)
- self.flush()
-
def _close(self):
"""Close the memmap file. Only do this when deleting the object."""
if self.base is self._mmap:
@@ -292,11 +287,6 @@ class memmap(ndarray):
self._mmap.close()
self._mmap = None
- def close(self):
- """Close the memmap file. Does nothing."""
- warnings.warn("``close`` is deprecated on memmap arrays. Use del",
- DeprecationWarning)
-
def __del__(self):
# We first check if we are the owner of the mmap, rather than
# a view, so deleting a view does not call _close
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py
index fa9f19165..187296efe 100644
--- a/numpy/core/numeric.py
+++ b/numpy/core/numeric.py
@@ -1,4 +1,4 @@
-__all__ = ['newaxis', 'ndarray', 'flatiter', 'newiter', 'nested_iters', 'ufunc',
+__all__ = ['newaxis', 'ndarray', 'flatiter', 'nditer', 'nested_iters', 'ufunc',
'arange', 'array', 'zeros', 'count_nonzero', 'empty', 'broadcast',
'dtype', 'fromstring', 'fromfile', 'frombuffer',
'int_asbuffer', 'where', 'argwhere',
@@ -54,7 +54,7 @@ BUFSIZE = multiarray.BUFSIZE
ndarray = multiarray.ndarray
flatiter = multiarray.flatiter
-newiter = multiarray.newiter
+nditer = multiarray.nditer
nested_iters = multiarray.nested_iters
broadcast = multiarray.broadcast
dtype = multiarray.dtype
diff --git a/numpy/core/setup.py b/numpy/core/setup.py
index b03150309..78bf14f50 100644
--- a/numpy/core/setup.py
+++ b/numpy/core/setup.py
@@ -601,7 +601,7 @@ def configuration(parent_package='',top_path=None):
subpath = join('src', 'multiarray')
sources = [join(local_dir, subpath, 'scalartypes.c.src'),
join(local_dir, subpath, 'arraytypes.c.src'),
- join(local_dir, subpath, 'new_iterator.c.src'),
+ join(local_dir, subpath, 'nditer.c.src'),
join(local_dir, subpath, 'lowlevel_strided_loops.c.src'),
join(local_dir, subpath, 'einsum.c.src')]
@@ -769,10 +769,10 @@ def configuration(parent_package='',top_path=None):
join('src', 'multiarray', 'refcount.c'),
join('src', 'multiarray', 'arraytypes.c.src'),
join('src', 'multiarray', 'scalartypes.c.src'),
- join('src', 'multiarray', 'new_iterator.c.src'),
+ join('src', 'multiarray', 'nditer.c.src'),
join('src', 'multiarray', 'lowlevel_strided_loops.c.src'),
join('src', 'multiarray', 'dtype_transfer.c'),
- join('src', 'multiarray', 'new_iterator_pywrap.c'),
+ join('src', 'multiarray', 'nditer_pywrap.c'),
join('src', 'multiarray', 'einsum.c.src')]
if PYTHON_HAS_UNICODE_WIDE:
diff --git a/numpy/core/setup_common.py b/numpy/core/setup_common.py
index 0a4f070f3..e88be40b0 100644
--- a/numpy/core/setup_common.py
+++ b/numpy/core/setup_common.py
@@ -29,7 +29,7 @@ C_ABI_VERSION = 0x01000009
# 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 = 0x00000006
class MismatchCAPIWarning(Warning):
pass
diff --git a/numpy/core/src/multiarray/arraytypes.c.src b/numpy/core/src/multiarray/arraytypes.c.src
index a5e47139e..3f2a9ac71 100644
--- a/numpy/core/src/multiarray/arraytypes.c.src
+++ b/numpy/core/src/multiarray/arraytypes.c.src
@@ -548,7 +548,7 @@ VOID_getitem(char *ip, PyArrayObject *ap)
int itemsize;
descr = ap->descr;
- if (descr->names) {
+ if (descr->names != NULL) {
PyObject *key;
PyObject *names;
int i, n;
@@ -560,9 +560,6 @@ VOID_getitem(char *ip, PyArrayObject *ap)
/* get the names from the fields dictionary*/
names = descr->names;
- if (!names) {
- goto finish;
- }
n = PyTuple_GET_SIZE(names);
ret = PyTuple_New(n);
savedflags = ap->flags;
@@ -604,7 +601,7 @@ VOID_getitem(char *ip, PyArrayObject *ap)
Py_INCREF(descr->subarray->base);
ret = PyArray_NewFromDescr(&PyArray_Type,
descr->subarray->base, shape.len, shape.ptr,
- NULL, ip, ap->flags, NULL);
+ NULL, ip, ap->flags&(~NPY_F_CONTIGUOUS), NULL);
PyDimMem_FREE(shape.ptr);
if (!ret) {
return NULL;
@@ -1596,6 +1593,7 @@ static void
}
/* convert from Python object to needed one */
#if @convert@
+ {
PyObject *new, *args;
/* call out to the Python builtin given by convstr */
args = Py_BuildValue("(N)", temp);
@@ -1611,6 +1609,7 @@ static void
if (temp == NULL) {
return;
}
+ }
#endif /* @convert@ */
if (@to@_setitem(temp,(char *)op, aop)) {
Py_DECREF(temp);
diff --git a/numpy/core/src/multiarray/convert.c b/numpy/core/src/multiarray/convert.c
index b57f3314c..134350222 100644
--- a/numpy/core/src/multiarray/convert.c
+++ b/numpy/core/src/multiarray/convert.c
@@ -353,7 +353,7 @@ PyArray_FillWithScalar(PyArrayObject *arr, PyObject *obj)
return 0;
}
-/*NUMPY_API
+/*
* Fills an array with zeros.
*
* Returns 0 on success, -1 on failure.
@@ -366,7 +366,7 @@ PyArray_FillWithZero(PyArrayObject *a)
PyArray_Descr *dtype = PyArray_DESCR(a);
NpyIter *iter;
- NpyIter_IterNext_Fn iternext;
+ NpyIter_IterNextFunc *iternext;
char **dataptr;
npy_intp stride, *countptr;
int needs_api;
@@ -391,9 +391,8 @@ PyArray_FillWithZero(PyArrayObject *a)
}
/* Use an iterator to go through all the data */
- iter = NpyIter_New(a, NPY_ITER_WRITEONLY|NPY_ITER_NO_INNER_ITERATION,
- NPY_KEEPORDER, NPY_NO_CASTING,
- NULL, 0, NULL, 0);
+ iter = NpyIter_New(a, NPY_ITER_WRITEONLY|NPY_ITER_EXTERNAL_LOOP,
+ NPY_KEEPORDER, NPY_NO_CASTING, NULL);
if (iter == NULL) {
return -1;
diff --git a/numpy/core/src/multiarray/convert.h b/numpy/core/src/multiarray/convert.h
index de24e27cf..1a34cfc52 100644
--- a/numpy/core/src/multiarray/convert.h
+++ b/numpy/core/src/multiarray/convert.h
@@ -1,4 +1,7 @@
#ifndef _NPY_ARRAYOBJECT_CONVERT_H_
#define _NPY_ARRAYOBJECT_CONVERT_H_
+NPY_NO_EXPORT int
+PyArray_FillWithZero(PyArrayObject *a);
+
#endif
diff --git a/numpy/core/src/multiarray/convert_datatype.c b/numpy/core/src/multiarray/convert_datatype.c
index b24869f89..3359a5573 100644
--- a/numpy/core/src/multiarray/convert_datatype.c
+++ b/numpy/core/src/multiarray/convert_datatype.c
@@ -23,54 +23,56 @@
* Cast an array using typecode structure.
* steals reference to at --- cannot be NULL
*
- * This function always makes a copy of mp, even if the dtype
+ * This function always makes a copy of arr, even if the dtype
* doesn't change.
*/
NPY_NO_EXPORT PyObject *
-PyArray_CastToType(PyArrayObject *mp, PyArray_Descr *at, int fortran)
+PyArray_CastToType(PyArrayObject *arr, PyArray_Descr *dtype, int fortran)
{
PyObject *out;
- int ret;
- PyArray_Descr *mpd;
+ PyArray_Descr *arr_dtype;
- mpd = mp->descr;
+ arr_dtype = PyArray_DESCR(arr);
- if (at->elsize == 0) {
- PyArray_DESCR_REPLACE(at);
- if (at == NULL) {
+ if (dtype->elsize == 0) {
+ PyArray_DESCR_REPLACE(dtype);
+ if (dtype == NULL) {
return NULL;
}
- if (mpd->type_num == PyArray_STRING &&
- at->type_num == PyArray_UNICODE) {
- at->elsize = mpd->elsize << 2;
+
+ if (arr_dtype->type_num == dtype->type_num) {
+ dtype->elsize = arr_dtype->elsize;
+ }
+ else if (arr_dtype->type_num == NPY_STRING &&
+ dtype->type_num == NPY_UNICODE) {
+ dtype->elsize = arr_dtype->elsize * 4;
}
- if (mpd->type_num == PyArray_UNICODE &&
- at->type_num == PyArray_STRING) {
- at->elsize = mpd->elsize >> 2;
+ else if (arr_dtype->type_num == NPY_UNICODE &&
+ dtype->type_num == NPY_STRING) {
+ dtype->elsize = arr_dtype->elsize / 4;
}
- if (at->type_num == PyArray_VOID) {
- at->elsize = mpd->elsize;
+ else if (dtype->type_num == NPY_VOID) {
+ dtype->elsize = arr_dtype->elsize;
}
}
- out = PyArray_NewFromDescr(Py_TYPE(mp), at,
- mp->nd,
- mp->dimensions,
+ out = PyArray_NewFromDescr(Py_TYPE(arr), dtype,
+ arr->nd,
+ arr->dimensions,
NULL, NULL,
fortran,
- (PyObject *)mp);
+ (PyObject *)arr);
if (out == NULL) {
return NULL;
}
- ret = PyArray_CopyInto((PyArrayObject *)out, mp);
- if (ret != -1) {
- return out;
- }
- Py_DECREF(out);
- return NULL;
+ if (PyArray_CopyInto((PyArrayObject *)out, arr) < 0) {
+ Py_DECREF(out);
+ return NULL;
+ }
+ return out;
}
/*NUMPY_API
diff --git a/numpy/core/src/multiarray/ctors.c b/numpy/core/src/multiarray/ctors.c
index 4fb6bc781..b137b34f4 100644
--- a/numpy/core/src/multiarray/ctors.c
+++ b/numpy/core/src/multiarray/ctors.c
@@ -688,8 +688,8 @@ discover_dimensions(PyObject *s, int *maxndim, npy_intp *d, int check_it,
PyInstance_Check(s) ||
#endif
PySequence_Length(s) < 0) {
- PyErr_Clear();
*maxndim = 0;
+ PyErr_Clear();
return 0;
}
@@ -822,22 +822,60 @@ discover_dimensions(PyObject *s, int *maxndim, npy_intp *d, int check_it,
npy_intp dtmp[NPY_MAXDIMS];
int j, maxndim_m1 = *maxndim - 1;
- e = PySequence_GetItem(s, 0);
+ if ((e = PySequence_GetItem(s, 0)) == NULL) {
+ /*
+ * PySequence_Check detects whether an old type object is a
+ * sequence by the presence of the __getitem__ attribute, and
+ * for new type objects that aren't dictionaries by the
+ * presence of the __len__ attribute as well. In either case it
+ * is possible to have an object that tests as a sequence but
+ * doesn't behave as a sequence and consequently, the
+ * PySequence_GetItem call can fail. When that happens and the
+ * object looks like a dictionary, we truncate the dimensions
+ * and set the object creation flag, otherwise we pass the
+ * error back up the call chain.
+ */
+ if (PyErr_ExceptionMatches(PyExc_KeyError)) {
+ PyErr_Clear();
+ *maxndim = 0;
+ *out_is_object = 1;
+ return 0;
+ }
+ else {
+ return -1;
+ }
+ }
r = discover_dimensions(e, &maxndim_m1, d + 1, check_it,
stop_at_string, stop_at_tuple,
out_is_object);
Py_DECREF(e);
+ if (r < 0) {
+ return r;
+ }
/* For the dimension truncation check below */
*maxndim = maxndim_m1 + 1;
-
for (i = 1; i < n; ++i) {
/* Get the dimensions of the first item */
- e = PySequence_GetItem(s, i);
+ if ((e = PySequence_GetItem(s, i)) == NULL) {
+ /* see comment above */
+ if (PyErr_ExceptionMatches(PyExc_KeyError)) {
+ PyErr_Clear();
+ *maxndim = 0;
+ *out_is_object = 1;
+ return 0;
+ }
+ else {
+ return -1;
+ }
+ }
r = discover_dimensions(e, &maxndim_m1, dtmp, check_it,
stop_at_string, stop_at_tuple,
out_is_object);
Py_DECREF(e);
+ if (r < 0) {
+ return r;
+ }
/* Reduce max_ndim_m1 to just items which match */
for (j = 0; j < maxndim_m1; ++j) {
@@ -1511,13 +1549,9 @@ PyArray_GetArrayParamsFromObject(PyObject *op,
stop_at_string, stop_at_tuple,
&is_object) < 0) {
Py_DECREF(*out_dtype);
- if (PyErr_Occurred() &&
- PyErr_GivenExceptionMatches(PyErr_Occurred(),
- PyExc_MemoryError)) {
+ if (PyErr_Occurred()) {
return -1;
}
- /* Say it's an OBJECT scalar if there's an error */
- PyErr_Clear();
*out_dtype = PyArray_DescrFromType(NPY_OBJECT);
if (*out_dtype == NULL) {
return -1;
@@ -2395,9 +2429,8 @@ PyArray_CopyAnyIntoOrdered(PyArrayObject *dst, PyArrayObject *src,
PyArray_StridedTransferFn *stransfer = NULL;
void *transferdata = NULL;
NpyIter *dst_iter, *src_iter;
- NPY_BEGIN_THREADS_DEF;
- NpyIter_IterNext_Fn dst_iternext, src_iternext;
+ NpyIter_IterNextFunc *dst_iternext, *src_iternext;
char **dst_dataptr, **src_dataptr;
npy_intp dst_stride, src_stride;
npy_intp *dst_countptr, *src_countptr;
@@ -2408,6 +2441,8 @@ PyArray_CopyAnyIntoOrdered(PyArrayObject *dst, PyArrayObject *src,
npy_intp dst_size, src_size;
int needs_api;
+ NPY_BEGIN_THREADS_DEF;
+
if (!PyArray_ISWRITEABLE(dst)) {
PyErr_SetString(PyExc_RuntimeError,
"cannot write to array");
@@ -2446,22 +2481,22 @@ PyArray_CopyAnyIntoOrdered(PyArrayObject *dst, PyArrayObject *src,
* can be processed at once.
*/
dst_iter = NpyIter_New(dst, NPY_ITER_WRITEONLY|
- NPY_ITER_NO_INNER_ITERATION|
+ NPY_ITER_EXTERNAL_LOOP|
NPY_ITER_DONT_NEGATE_STRIDES|
NPY_ITER_REFS_OK,
order,
NPY_NO_CASTING,
- NULL, 0, NULL, 0);
+ NULL);
if (dst_iter == NULL) {
return -1;
}
src_iter = NpyIter_New(src, NPY_ITER_READONLY|
- NPY_ITER_NO_INNER_ITERATION|
+ NPY_ITER_EXTERNAL_LOOP|
NPY_ITER_DONT_NEGATE_STRIDES|
NPY_ITER_REFS_OK,
order,
NPY_NO_CASTING,
- NULL, 0, NULL, 0);
+ NULL);
if (src_iter == NULL) {
NpyIter_Deallocate(dst_iter);
return -1;
@@ -2658,7 +2693,7 @@ PyArray_CopyInto(PyArrayObject *dst, PyArrayObject *src)
npy_uint32 op_flags[2];
NpyIter *iter;
- NpyIter_IterNext_Fn iternext;
+ NpyIter_IterNextFunc *iternext;
char **dataptr;
npy_intp *stride;
npy_intp *countptr;
@@ -2667,17 +2702,23 @@ PyArray_CopyInto(PyArrayObject *dst, PyArrayObject *src)
op[0] = dst;
op[1] = src;
- op_flags[0] = NPY_ITER_WRITEONLY|NPY_ITER_NO_BROADCAST;
+ /*
+ * TODO: In NumPy 2.0, renable NPY_ITER_NO_BROADCAST. This
+ * was removed during NumPy 1.6 testing for compatibility
+ * with NumPy 1.5, as per Travis's -10 veto power.
+ */
+ /*op_flags[0] = NPY_ITER_WRITEONLY|NPY_ITER_NO_BROADCAST;*/
+ op_flags[0] = NPY_ITER_WRITEONLY;
op_flags[1] = NPY_ITER_READONLY;
iter = NpyIter_MultiNew(2, op,
- NPY_ITER_NO_INNER_ITERATION|
+ NPY_ITER_EXTERNAL_LOOP|
NPY_ITER_REFS_OK|
NPY_ITER_ZEROSIZE_OK,
NPY_KEEPORDER,
NPY_NO_CASTING,
op_flags,
- NULL, 0, NULL, 0);
+ NULL);
if (iter == NULL) {
return -1;
}
diff --git a/numpy/core/src/multiarray/dtype_transfer.c b/numpy/core/src/multiarray/dtype_transfer.c
index 80b5b2a64..b64e1684a 100644
--- a/numpy/core/src/multiarray/dtype_transfer.c
+++ b/numpy/core/src/multiarray/dtype_transfer.c
@@ -185,6 +185,27 @@ _strided_to_strided_zero_pad_copy(char *dst, npy_intp dst_stride,
}
}
+/*
+ * Does a strided to strided zero-padded copy for the case where
+ * dst_itemsize < src_itemsize
+ */
+static void
+_strided_to_strided_truncate_copy(char *dst, npy_intp dst_stride,
+ char *src, npy_intp src_stride,
+ npy_intp N, npy_intp src_itemsize,
+ void *data)
+{
+ _strided_zero_pad_data *d = (_strided_zero_pad_data *)data;
+ npy_intp dst_itemsize = d->dst_itemsize;
+
+ while (N > 0) {
+ memcpy(dst, src, dst_itemsize);
+ src += src_stride;
+ dst += dst_stride;
+ --N;
+ }
+}
+
NPY_NO_EXPORT int
PyArray_GetStridedZeroPadCopyFn(int aligned,
npy_intp src_stride, npy_intp dst_stride,
@@ -192,13 +213,9 @@ PyArray_GetStridedZeroPadCopyFn(int aligned,
PyArray_StridedTransferFn **out_stransfer,
void **out_transferdata)
{
- if (src_itemsize >= dst_itemsize) {
- /* If the sizes are different, the alignment flag isn't trustworthy */
- if (src_itemsize != dst_itemsize) {
- aligned = 0;
- }
+ if (src_itemsize == dst_itemsize) {
*out_stransfer = PyArray_GetStridedCopyFn(aligned, src_stride,
- dst_stride, dst_itemsize);
+ dst_stride, src_itemsize);
*out_transferdata = NULL;
return (*out_stransfer == NULL) ? NPY_FAIL : NPY_SUCCEED;
}
@@ -213,7 +230,13 @@ PyArray_GetStridedZeroPadCopyFn(int aligned,
d->freefunc = &PyArray_free;
d->copyfunc = &_strided_zero_pad_data_copy;
- *out_stransfer = &_strided_to_strided_zero_pad_copy;
+ if (src_itemsize < dst_itemsize) {
+ *out_stransfer = &_strided_to_strided_zero_pad_copy;
+ }
+ else {
+ *out_stransfer = &_strided_to_strided_truncate_copy;
+ }
+
*out_transferdata = d;
return NPY_SUCCEED;
}
@@ -2950,7 +2973,8 @@ PyArray_GetDTypeTransferFunction(int aligned,
}
/* Check for different-sized strings, unicodes, or voids */
- if (src_type_num == dst_type_num) switch (src_type_num) {
+ if (src_type_num == dst_type_num) {
+ switch (src_type_num) {
case NPY_STRING:
case NPY_UNICODE:
case NPY_VOID:
@@ -2958,6 +2982,7 @@ PyArray_GetDTypeTransferFunction(int aligned,
src_stride, dst_stride,
src_dtype->elsize, dst_dtype->elsize,
out_stransfer, out_transferdata);
+ }
}
/* Otherwise a cast is necessary */
diff --git a/numpy/core/src/multiarray/einsum.c.src b/numpy/core/src/multiarray/einsum.c.src
index 9200c7cdf..98a26c322 100644
--- a/numpy/core/src/multiarray/einsum.c.src
+++ b/numpy/core/src/multiarray/einsum.c.src
@@ -19,6 +19,8 @@
#include <ctype.h>
+#include "convert.h"
+
#ifdef __SSE__
#define EINSUM_USE_SSE1 1
#else
@@ -48,9 +50,15 @@
#define NPY_EINSUM_DBG_TRACING 0
#if NPY_EINSUM_DBG_TRACING
-#define NPY_EINSUM_DBG_PRINTF(...) printf(__VA_ARGS__)
+#define NPY_EINSUM_DBG_PRINT(s) printf("%s", s);
+#define NPY_EINSUM_DBG_PRINT1(s, p1) printf(s, p1);
+#define NPY_EINSUM_DBG_PRINT2(s, p1, p2) printf(s, p1, p2);
+#define NPY_EINSUM_DBG_PRINT3(s, p1, p2, p3) printf(s);
#else
-#define NPY_EINSUM_DBG_PRINTF(...)
+#define NPY_EINSUM_DBG_PRINT(s)
+#define NPY_EINSUM_DBG_PRINT1(s, p1)
+#define NPY_EINSUM_DBG_PRINT2(s, p1, p2)
+#define NPY_EINSUM_DBG_PRINT3(s, p1, p2, p3)
#endif
/**********************************************/
@@ -117,7 +125,7 @@ static void
npy_intp stride_out = strides[@nop@];
#endif
- NPY_EINSUM_DBG_PRINTF("@name@_sum_of_products_@noplabel@ (%d)\n", (int)count);
+ NPY_EINSUM_DBG_PRINT1("@name@_sum_of_products_@noplabel@ (%d)\n", (int)count);
while (count--) {
#if !@complex@
@@ -202,7 +210,7 @@ static void
npy_@name@ *data0 = (npy_@name@ *)dataptr[0];
npy_@name@ *data_out = (npy_@name@ *)dataptr[1];
- NPY_EINSUM_DBG_PRINTF("@name@_sum_of_products_contig_one (%d)\n",
+ NPY_EINSUM_DBG_PRINT1("@name@_sum_of_products_contig_one (%d)\n",
(int)count);
/* This is placed before the main loop to make small counts faster */
@@ -269,7 +277,7 @@ static void
__m128 a, b;
#endif
- NPY_EINSUM_DBG_PRINTF("@name@_sum_of_products_contig_two (%d)\n",
+ NPY_EINSUM_DBG_PRINT1("@name@_sum_of_products_contig_two (%d)\n",
(int)count);
/* This is placed before the main loop to make small counts faster */
@@ -357,7 +365,7 @@ static void
__m128d a, b, value0_sse;
#endif
- NPY_EINSUM_DBG_PRINTF("@name@_sum_of_products_stride0_contig_outcontig_two (%d)\n",
+ NPY_EINSUM_DBG_PRINT1("@name@_sum_of_products_stride0_contig_outcontig_two (%d)\n",
(int)count);
/* This is placed before the main loop to make small counts faster */
@@ -484,7 +492,7 @@ static void
__m128 a, b, value1_sse;
#endif
- NPY_EINSUM_DBG_PRINTF("@name@_sum_of_products_contig_stride0_outcontig_two (%d)\n",
+ NPY_EINSUM_DBG_PRINT1("@name@_sum_of_products_contig_stride0_outcontig_two (%d)\n",
(int)count);
/* This is placed before the main loop to make small counts faster */
@@ -570,7 +578,7 @@ static void
__m128d a, accum_sse = _mm_setzero_pd();
#endif
- NPY_EINSUM_DBG_PRINTF("@name@_sum_of_products_contig_contig_outstride0_two (%d)\n",
+ NPY_EINSUM_DBG_PRINT1("@name@_sum_of_products_contig_contig_outstride0_two (%d)\n",
(int)count);
/* This is placed before the main loop to make small counts faster */
@@ -728,7 +736,7 @@ static void
__m128 a, accum_sse = _mm_setzero_ps();
#endif
- NPY_EINSUM_DBG_PRINTF("@name@_sum_of_products_stride0_contig_outstride0_two (%d)\n",
+ NPY_EINSUM_DBG_PRINT1("@name@_sum_of_products_stride0_contig_outstride0_two (%d)\n",
(int)count);
/* This is placed before the main loop to make small counts faster */
@@ -827,7 +835,7 @@ static void
__m128 a, accum_sse = _mm_setzero_ps();
#endif
- NPY_EINSUM_DBG_PRINTF("@name@_sum_of_products_contig_stride0_outstride0_two (%d)\n",
+ NPY_EINSUM_DBG_PRINT1("@name@_sum_of_products_contig_stride0_outstride0_two (%d)\n",
(int)count);
/* This is placed before the main loop to make small counts faster */
@@ -963,7 +971,7 @@ static void
@name@_sum_of_products_contig_@noplabel@(int nop, char **dataptr,
npy_intp *NPY_UNUSED(strides), npy_intp count)
{
- NPY_EINSUM_DBG_PRINTF("@name@_sum_of_products_contig_@noplabel@ (%d)\n",
+ NPY_EINSUM_DBG_PRINT1("@name@_sum_of_products_contig_@noplabel@ (%d)\n",
(int)count);
while (count--) {
@@ -1031,7 +1039,7 @@ static void
#endif
- NPY_EINSUM_DBG_PRINTF("@name@_sum_of_products_contig_outstride0_one (%d)\n",
+ NPY_EINSUM_DBG_PRINT1("@name@_sum_of_products_contig_outstride0_one (%d)\n",
(int)count);
/* This is placed before the main loop to make small counts faster */
@@ -1212,7 +1220,7 @@ static void
npy_intp stride2 = strides[2];
#endif
- NPY_EINSUM_DBG_PRINTF("@name@_sum_of_products_outstride0_@noplabel@ (%d)\n",
+ NPY_EINSUM_DBG_PRINT1("@name@_sum_of_products_outstride0_@noplabel@ (%d)\n",
(int)count);
while (count--) {
@@ -2289,8 +2297,8 @@ get_combined_dims_view(PyArrayObject *op, int iop, char *labels)
}
static int
-prepare_op_axes(int ndim, int iop, char *labels, npy_intp *axes,
- npy_intp ndim_iter, char *iter_labels, EINSUM_BROADCAST broadcast)
+prepare_op_axes(int ndim, int iop, char *labels, int *axes,
+ int ndim_iter, char *iter_labels, EINSUM_BROADCAST broadcast)
{
int i, label, ibroadcast;
@@ -2437,7 +2445,7 @@ unbuffered_loop_nop1_ndim2(NpyIter *iter)
#if NPY_EINSUM_DBG_TRACING
NpyIter_DebugPrint(iter);
#endif
- NPY_EINSUM_DBG_PRINTF("running hand-coded 1-op 2-dim loop\n");
+ NPY_EINSUM_DBG_PRINT("running hand-coded 1-op 2-dim loop\n");
NpyIter_GetShape(iter, shape);
memcpy(strides[0], NpyIter_GetAxisStrideArray(iter, 0),
@@ -2485,7 +2493,7 @@ unbuffered_loop_nop1_ndim3(NpyIter *iter)
#if NPY_EINSUM_DBG_TRACING
NpyIter_DebugPrint(iter);
#endif
- NPY_EINSUM_DBG_PRINTF("running hand-coded 1-op 3-dim loop\n");
+ NPY_EINSUM_DBG_PRINT("running hand-coded 1-op 3-dim loop\n");
NpyIter_GetShape(iter, shape);
memcpy(strides[0], NpyIter_GetAxisStrideArray(iter, 0),
@@ -2542,7 +2550,7 @@ unbuffered_loop_nop2_ndim2(NpyIter *iter)
#if NPY_EINSUM_DBG_TRACING
NpyIter_DebugPrint(iter);
#endif
- NPY_EINSUM_DBG_PRINTF("running hand-coded 2-op 2-dim loop\n");
+ NPY_EINSUM_DBG_PRINT("running hand-coded 2-op 2-dim loop\n");
NpyIter_GetShape(iter, shape);
memcpy(strides[0], NpyIter_GetAxisStrideArray(iter, 0),
@@ -2592,7 +2600,7 @@ unbuffered_loop_nop2_ndim3(NpyIter *iter)
#if NPY_EINSUM_DBG_TRACING
NpyIter_DebugPrint(iter);
#endif
- NPY_EINSUM_DBG_PRINTF("running hand-coded 2-op 3-dim loop\n");
+ NPY_EINSUM_DBG_PRINT("running hand-coded 2-op 3-dim loop\n");
NpyIter_GetShape(iter, shape);
memcpy(strides[0], NpyIter_GetAxisStrideArray(iter, 0),
@@ -2703,8 +2711,8 @@ PyArray_EinsteinSum(char *subscripts, npy_intp nop,
PyArrayObject *op[NPY_MAXARGS], *ret = NULL;
PyArray_Descr *op_dtypes_array[NPY_MAXARGS], **op_dtypes;
- npy_intp op_axes_arrays[NPY_MAXARGS][NPY_MAXDIMS];
- npy_intp *op_axes[NPY_MAXARGS];
+ int op_axes_arrays[NPY_MAXARGS][NPY_MAXDIMS];
+ int *op_axes[NPY_MAXARGS];
npy_uint32 op_flags[NPY_MAXARGS];
NpyIter *iter;
@@ -2957,7 +2965,7 @@ PyArray_EinsteinSum(char *subscripts, npy_intp nop,
NPY_ITER_NO_BROADCAST;
/* Allocate the iterator */
- iter = NpyIter_MultiNew(nop+1, op, NPY_ITER_NO_INNER_ITERATION|
+ iter = NpyIter_AdvancedNew(nop+1, op, NPY_ITER_EXTERNAL_LOOP|
((dtype != NULL) ? 0 : NPY_ITER_COMMON_DTYPE)|
NPY_ITER_BUFFERED|
NPY_ITER_DELAY_BUFALLOC|
@@ -2967,7 +2975,7 @@ PyArray_EinsteinSum(char *subscripts, npy_intp nop,
NPY_ITER_ZEROSIZE_OK,
order, casting,
op_flags, op_dtypes,
- ndim_iter, op_axes, 0);
+ ndim_iter, op_axes, NULL, 0);
if (iter == NULL) {
goto fail;
@@ -2986,7 +2994,7 @@ PyArray_EinsteinSum(char *subscripts, npy_intp nop,
* be reduced to fit into these patterns.
*/
if (!NpyIter_RequiresBuffering(iter)) {
- npy_intp ndim = NpyIter_GetNDim(iter);
+ int ndim = NpyIter_GetNDim(iter);
switch (nop) {
case 1:
if (ndim == 2) {
@@ -3055,7 +3063,7 @@ PyArray_EinsteinSum(char *subscripts, npy_intp nop,
ret = NULL;
}
else if (NpyIter_GetIterSize(iter) != 0) {
- NpyIter_IterNext_Fn iternext;
+ NpyIter_IterNextFunc *iternext;
char **dataptr;
npy_intp *stride;
npy_intp *countptr;
@@ -3075,7 +3083,7 @@ PyArray_EinsteinSum(char *subscripts, npy_intp nop,
if (!needs_api) {
NPY_BEGIN_THREADS;
}
- NPY_EINSUM_DBG_PRINTF("Einsum loop\n");
+ NPY_EINSUM_DBG_PRINT("Einsum loop\n");
do {
sop(nop, dataptr, stride, *countptr);
} while(iternext(iter));
diff --git a/numpy/core/src/multiarray/item_selection.c b/numpy/core/src/multiarray/item_selection.c
index db379e566..91d5f1f4e 100644
--- a/numpy/core/src/multiarray/item_selection.c
+++ b/numpy/core/src/multiarray/item_selection.c
@@ -1698,7 +1698,7 @@ PyArray_CountNonzero(PyArrayObject *self)
npy_intp nonzero_count = 0;
NpyIter *iter;
- NpyIter_IterNext_Fn iternext;
+ NpyIter_IterNextFunc *iternext;
char **dataptr;
npy_intp *strideptr, *innersizeptr;
@@ -1726,10 +1726,10 @@ PyArray_CountNonzero(PyArrayObject *self)
/* Otherwise create and use an iterator to count the nonzeros */
iter = NpyIter_New(self, NPY_ITER_READONLY|
- NPY_ITER_NO_INNER_ITERATION|
+ NPY_ITER_EXTERNAL_LOOP|
NPY_ITER_REFS_OK,
NPY_KEEPORDER, NPY_NO_CASTING,
- NULL, 0, NULL, 0);
+ NULL);
if (iter == NULL) {
return -1;
}
@@ -1783,8 +1783,8 @@ PyArray_Nonzero(PyArrayObject *self)
npy_intp *coords;
NpyIter *iter;
- NpyIter_IterNext_Fn iternext;
- NpyIter_GetCoords_Fn getcoords;
+ NpyIter_IterNextFunc *iternext;
+ NpyIter_GetCoordsFunc *getcoords;
char **dataptr;
npy_intp *innersizeptr;
@@ -1823,7 +1823,7 @@ PyArray_Nonzero(PyArrayObject *self)
NPY_ITER_ZEROSIZE_OK|
NPY_ITER_REFS_OK,
NPY_CORDER, NPY_NO_CASTING,
- NULL, 0, NULL, 0);
+ NULL);
if (iter == NULL) {
Py_DECREF(ret);
@@ -1880,8 +1880,8 @@ finish:
}
else {
for (i = 0; i < ndim; ++i) {
- stride = ndim*NPY_SIZEOF_INTP;
PyArrayObject *view;
+ stride = ndim*NPY_SIZEOF_INTP;
view = (PyArrayObject *)PyArray_New(Py_TYPE(self), 1,
&nonzero_count,
diff --git a/numpy/core/src/multiarray/iterators.c b/numpy/core/src/multiarray/iterators.c
index 6c1d97e8e..cc2a0b6cd 100644
--- a/numpy/core/src/multiarray/iterators.c
+++ b/numpy/core/src/multiarray/iterators.c
@@ -1857,7 +1857,7 @@ get_ptr_constant(PyArrayIterObject* _iter, npy_intp *coordinates)
* value 2 3 3 2 1 1 2 3 3 2 1 1
*
* _npy_pos_index_mirror(4, 3) will return 1, because x[4] = x[1]*/
-static inline npy_intp
+NPY_INLINE static npy_intp
__npy_pos_remainder(npy_intp i, npy_intp n)
{
npy_intp k, l, j;
@@ -1903,7 +1903,7 @@ get_ptr_mirror(PyArrayIterObject* _iter, npy_intp *coordinates)
#undef _INF_SET_PTR_MIRROR
/* compute l such as i = k * n + l, 0 <= l < |k| */
-static inline npy_intp
+NPY_INLINE static npy_intp
__npy_euclidean_division(npy_intp i, npy_intp n)
{
npy_intp l;
diff --git a/numpy/core/src/multiarray/lowlevel_strided_loops.c.src b/numpy/core/src/multiarray/lowlevel_strided_loops.c.src
index d4e020113..fc8d71f46 100644
--- a/numpy/core/src/multiarray/lowlevel_strided_loops.c.src
+++ b/numpy/core/src/multiarray/lowlevel_strided_loops.c.src
@@ -302,34 +302,6 @@ _swap_pair_strided_to_strided(char *dst, npy_intp dst_stride,
}
static void
-_strided_to_contig(char *dst, npy_intp NPY_UNUSED(dst_stride),
- char *src, npy_intp src_stride,
- npy_intp N, npy_intp src_itemsize,
- void *NPY_UNUSED(data))
-{
- while (N > 0) {
- memcpy(dst, src, src_itemsize);
- dst += src_itemsize;
- src += src_stride;
- --N;
- }
-}
-
-static void
-_contig_to_strided(char *dst, npy_intp dst_stride,
- char *src, npy_intp NPY_UNUSED(src_stride),
- npy_intp N, npy_intp src_itemsize,
- void *NPY_UNUSED(data))
-{
- while (N > 0) {
- memcpy(dst, src, src_itemsize);
- dst += dst_stride;
- src += src_itemsize;
- --N;
- }
-}
-
-static void
_contig_to_contig(char *dst, npy_intp NPY_UNUSED(dst_stride),
char *src, npy_intp NPY_UNUSED(src_stride),
npy_intp N, npy_intp src_itemsize,
@@ -381,7 +353,7 @@ PyArray_GetStridedCopyFn(npy_intp aligned, npy_intp src_stride,
}
}
- return &_strided_to_contig;
+ return &_strided_to_strided;
}
/* general dst */
else {
@@ -408,7 +380,7 @@ PyArray_GetStridedCopyFn(npy_intp aligned, npy_intp src_stride,
/**end repeat**/
}
- return &_contig_to_strided;
+ return &_strided_to_strided;
}
else {
switch (itemsize) {
@@ -445,7 +417,7 @@ PyArray_GetStridedCopyFn(npy_intp aligned, npy_intp src_stride,
}
}
- return &_strided_to_contig;
+ return &_strided_to_strided;
}
/* general dst */
else {
@@ -462,7 +434,7 @@ PyArray_GetStridedCopyFn(npy_intp aligned, npy_intp src_stride,
/**end repeat**/
}
- return &_contig_to_strided;
+ return &_strided_to_strided;
}
/* general src */
else {
@@ -578,7 +550,7 @@ NPY_NO_EXPORT PyArray_StridedTransferFn *
/**end repeat1**/
}
- return &_contig_to_strided;
+ return &_strided_to_strided;
}
else {
switch (itemsize) {
@@ -626,7 +598,7 @@ NPY_NO_EXPORT PyArray_StridedTransferFn *
}
}
- return &_strided_to_contig;
+ return &_strided_to_strided;
}
/* general dst */
else {
@@ -643,7 +615,7 @@ NPY_NO_EXPORT PyArray_StridedTransferFn *
/**end repeat1**/
}
- return &_contig_to_strided;
+ return &_strided_to_strided;
}
/* general src */
else {
diff --git a/numpy/core/src/multiarray/methods.c b/numpy/core/src/multiarray/methods.c
index 4c568a959..ed86e208c 100644
--- a/numpy/core/src/multiarray/methods.c
+++ b/numpy/core/src/multiarray/methods.c
@@ -303,7 +303,8 @@ PyArray_GetField(PyArrayObject *self, PyArray_Descr *typed, int offset)
self->nd, self->dimensions,
self->strides,
self->data + offset,
- self->flags, (PyObject *)self);
+ self->flags&(~NPY_F_CONTIGUOUS),
+ (PyObject *)self);
if (ret == NULL) {
return NULL;
}
diff --git a/numpy/core/src/multiarray/multiarraymodule.c b/numpy/core/src/multiarray/multiarraymodule.c
index 833c969b0..db381cc84 100644
--- a/numpy/core/src/multiarray/multiarraymodule.c
+++ b/numpy/core/src/multiarray/multiarraymodule.c
@@ -43,7 +43,7 @@ NPY_NO_EXPORT int NPY_NUMUSERTYPES = 0;
#include "scalartypes.h"
#include "numpymemoryview.h"
#include "convert_datatype.h"
-#include "new_iterator_pywrap.h"
+#include "nditer_pywrap.h"
/* Only here for API compatibility */
NPY_NO_EXPORT PyTypeObject PyBigArray_Type;
@@ -745,7 +745,7 @@ PyArray_InnerProduct(PyObject *op1, PyObject *op2)
* just like inner product but does the swapaxes stuff on the fly
*/
NPY_NO_EXPORT PyObject *
-PyArray_MatrixProduct2(PyObject *op1, PyObject *op2, PyObject* out)
+PyArray_MatrixProduct2(PyObject *op1, PyObject *op2, PyArrayObject* out)
{
PyArrayObject *ap1, *ap2, *ret = NULL;
PyArrayIterObject *it1, *it2;
@@ -2032,7 +2032,12 @@ array_matrixproduct(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject* kwds)
if (o == Py_None) {
o = NULL;
}
- return _ARET(PyArray_MatrixProduct2(a, v, o));
+ if (o != NULL && !PyArray_Check(o)) {
+ PyErr_SetString(PyExc_TypeError,
+ "'out' must be an array");
+ return NULL;
+ }
+ return _ARET(PyArray_MatrixProduct2(a, v, (PyArrayObject *)o));
}
static int
@@ -3852,7 +3857,7 @@ PyMODINIT_FUNC initmultiarray(void) {
Py_INCREF(&PyArrayIter_Type);
PyDict_SetItemString(d, "flatiter", (PyObject *)&PyArrayIter_Type);
Py_INCREF(&PyArrayMultiIter_Type);
- PyDict_SetItemString(d, "newiter", (PyObject *)&NpyIter_Type);
+ PyDict_SetItemString(d, "nditer", (PyObject *)&NpyIter_Type);
Py_INCREF(&NpyIter_Type);
PyDict_SetItemString(d, "broadcast",
(PyObject *)&PyArrayMultiIter_Type);
diff --git a/numpy/core/src/multiarray/multiarraymodule_onefile.c b/numpy/core/src/multiarray/multiarraymodule_onefile.c
index ceef0a56e..8cf50d9be 100644
--- a/numpy/core/src/multiarray/multiarraymodule_onefile.c
+++ b/numpy/core/src/multiarray/multiarraymodule_onefile.c
@@ -35,8 +35,8 @@
#include "conversion_utils.c"
#include "buffer.c"
-#include "new_iterator.c"
-#include "new_iterator_pywrap.c"
+#include "nditer.c"
+#include "nditer_pywrap.c"
#include "lowlevel_strided_loops.c"
#include "dtype_transfer.c"
#include "einsum.c"
diff --git a/numpy/core/src/multiarray/new_iterator.c.src b/numpy/core/src/multiarray/nditer.c.src
index 1208e5d3c..648d32a33 100644
--- a/numpy/core/src/multiarray/new_iterator.c.src
+++ b/numpy/core/src/multiarray/nditer.c.src
@@ -48,9 +48,15 @@
#define NPY_IT_DBG_TRACING 0
#if NPY_IT_DBG_TRACING
-#define NPY_IT_DBG_PRINTF(...) printf(__VA_ARGS__)
+#define NPY_IT_DBG_PRINT(s) printf("%s", s)
+#define NPY_IT_DBG_PRINT1(s, p1) printf(s, p1)
+#define NPY_IT_DBG_PRINT2(s, p1, p2) printf(s, p1, p2)
+#define NPY_IT_DBG_PRINT3(s, p1, p2, p3) printf(s, p1, p2, p3)
#else
-#define NPY_IT_DBG_PRINTF(...)
+#define NPY_IT_DBG_PRINT(s)
+#define NPY_IT_DBG_PRINT1(s, p1)
+#define NPY_IT_DBG_PRINT2(s, p1, p2)
+#define NPY_IT_DBG_PRINT3(s, p1, p2, p3)
#endif
/**********************************************/
@@ -74,7 +80,7 @@
/* The iteration order was forced on construction */
#define NPY_ITFLAG_FORCEDORDER 0x0010
/* The inner loop is handled outside the iterator */
-#define NPY_ITFLAG_NOINNER 0x0020
+#define NPY_ITFLAG_EXLOOP 0x0020
/* The iterator is ranged */
#define NPY_ITFLAG_RANGE 0x0040
/* The iterator is buffered */
@@ -279,10 +285,11 @@ struct NpyIter_AD {
static int
npyiter_check_global_flags(npy_uint32 flags, npy_uint32* itflags);
static int
-npyiter_check_op_axes(npy_intp niter, npy_intp oa_ndim, npy_intp **op_axes);
-static npy_intp
-npyiter_calculate_ndim(npy_intp niter, PyArrayObject **op_in,
- npy_intp oa_ndim);
+npyiter_check_op_axes(int niter, int oa_ndim, int **op_axes,
+ npy_intp *itershape);
+static int
+npyiter_calculate_ndim(int niter, PyArrayObject **op_in,
+ int oa_ndim);
static int
npyiter_check_per_op_flags(npy_uint32 flags, char *op_itflags);
static int
@@ -293,7 +300,7 @@ npyiter_prepare_one_operand(PyArrayObject **op,
npy_uint32 flags,
npy_uint32 op_flags, char *op_itflags);
static int
-npyiter_prepare_operands(npy_intp niter, PyArrayObject **op_in,
+npyiter_prepare_operands(int niter, PyArrayObject **op_in,
PyArrayObject **op,
char **op_dataptr,
PyArray_Descr **op_request_dtypes,
@@ -301,20 +308,21 @@ npyiter_prepare_operands(npy_intp niter, PyArrayObject **op_in,
npy_uint32 flags,
npy_uint32 *op_flags, char *op_itflags);
static int
-npyiter_check_casting(npy_intp niter, PyArrayObject **op,
+npyiter_check_casting(int niter, PyArrayObject **op,
PyArray_Descr **op_dtype,
NPY_CASTING casting,
char *op_itflags);
static int
npyiter_fill_axisdata(NpyIter *iter, npy_uint32 flags, char *op_itflags,
char **op_dataptr,
- npy_uint32 *op_flags, npy_intp **op_axes,
+ npy_uint32 *op_flags, int **op_axes,
+ npy_intp *itershape,
int output_scalars);
static void
-npyiter_replace_axisdata(NpyIter *iter, npy_intp iiter,
+npyiter_replace_axisdata(NpyIter *iter, int iiter,
PyArrayObject *op,
- npy_intp op_ndim, char *op_dataptr,
- npy_intp *op_axes);
+ int op_ndim, char *op_dataptr,
+ int *op_axes);
static void
npyiter_compute_index_strides(NpyIter *iter, npy_uint32 flags);
static void
@@ -330,7 +338,7 @@ static void
npyiter_coalesce_axes(NpyIter *iter);
static PyArray_Descr *
-npyiter_get_common_dtype(npy_intp niter, PyArrayObject **op,
+npyiter_get_common_dtype(int niter, PyArrayObject **op,
char *op_itflags, PyArray_Descr **op_dtype,
PyArray_Descr **op_request_dtypes,
int only_inputs, int output_scalars);
@@ -338,16 +346,16 @@ npyiter_get_common_dtype(npy_intp niter, PyArrayObject **op,
static PyArrayObject *
npyiter_new_temp_array(NpyIter *iter, PyTypeObject *subtype,
npy_uint32 flags, char *op_itflags,
- npy_intp op_ndim, npy_intp *shape,
- PyArray_Descr *op_dtype, npy_intp *op_axes);
+ int op_ndim, npy_intp *shape,
+ PyArray_Descr *op_dtype, int *op_axes);
static int
npyiter_allocate_arrays(NpyIter *iter,
npy_uint32 flags,
PyArray_Descr **op_dtype, PyTypeObject *subtype,
npy_uint32 *op_flags, char *op_itflags,
- npy_intp **op_axes, int output_scalars);
+ int **op_axes, int output_scalars);
static void
-npyiter_get_priority_subtype(npy_intp niter, PyArrayObject **op,
+npyiter_get_priority_subtype(int niter, PyArrayObject **op,
char *op_itflags,
double *subtype_priority, PyTypeObject **subtype);
@@ -366,18 +374,20 @@ npyiter_checkreducesize(NpyIter *iter, npy_intp count,
npy_intp *reduce_outerdim);
/*NUMPY_API
- * Allocate a new iterator for multiple array objects
+ * Allocate a new iterator for multiple array objects, and advanced
+ * options for controlling the broadcasting, shape, and buffer size.
*/
NPY_NO_EXPORT NpyIter *
-NpyIter_MultiNew(npy_intp niter, PyArrayObject **op_in, npy_uint32 flags,
+NpyIter_AdvancedNew(int niter, PyArrayObject **op_in, npy_uint32 flags,
NPY_ORDER order, NPY_CASTING casting,
npy_uint32 *op_flags,
PyArray_Descr **op_request_dtypes,
- npy_intp oa_ndim, npy_intp **op_axes, npy_intp buffersize)
+ int oa_ndim, int **op_axes, npy_intp *itershape,
+ npy_intp buffersize)
{
npy_uint32 itflags = NPY_ITFLAG_IDENTPERM;
- npy_intp idim, ndim;
- npy_intp iiter;
+ int idim, ndim;
+ int iiter;
/* The iterator being constructed */
NpyIter *iter;
@@ -427,7 +437,7 @@ NpyIter_MultiNew(npy_intp niter, PyArrayObject **op_in, npy_uint32 flags,
}
/* Error check 'oa_ndim' and 'op_axes', which must be used together */
- if (!npyiter_check_op_axes(niter, oa_ndim, op_axes)) {
+ if (!npyiter_check_op_axes(niter, oa_ndim, op_axes, itershape)) {
return NULL;
}
@@ -496,7 +506,8 @@ NpyIter_MultiNew(npy_intp niter, PyArrayObject **op_in, npy_uint32 flags,
/* Fill in the AXISDATA arrays and set the ITERSIZE field */
if (!npyiter_fill_axisdata(iter, flags, op_itflags, op_dataptr,
- op_flags, op_axes, output_scalars)) {
+ op_flags, op_axes, itershape,
+ output_scalars)) {
NpyIter_Deallocate(iter);
return NULL;
}
@@ -510,7 +521,7 @@ NpyIter_MultiNew(npy_intp niter, PyArrayObject **op_in, npy_uint32 flags,
* small enough to be cache-friendly.
*/
if (buffersize <= 0) {
- buffersize = 1 << 12;
+ buffersize = NPY_BUFSIZE;
}
/* No point in a buffer bigger than the iteration size */
if (buffersize > NIT_ITERSIZE(iter)) {
@@ -609,7 +620,7 @@ NpyIter_MultiNew(npy_intp niter, PyArrayObject **op_in, npy_uint32 flags,
return NULL;
}
if (flags&NPY_ITER_COMMON_DTYPE) {
- NPY_IT_DBG_PRINTF("Iterator: Replacing all data types\n");
+ NPY_IT_DBG_PRINT("Iterator: Replacing all data types\n");
/* Replace all the data types */
for (iiter = 0; iiter < niter; ++iiter) {
if (op_dtype[iiter] != dtype) {
@@ -620,7 +631,7 @@ NpyIter_MultiNew(npy_intp niter, PyArrayObject **op_in, npy_uint32 flags,
}
}
else {
- NPY_IT_DBG_PRINTF("Iterator: Setting unset output data types\n");
+ NPY_IT_DBG_PRINT("Iterator: Setting unset output data types\n");
/* Replace the NULL data types */
for (iiter = 0; iiter < niter; ++iiter) {
if (op_dtype[iiter] == NULL) {
@@ -686,7 +697,7 @@ NpyIter_MultiNew(npy_intp niter, PyArrayObject **op_in, npy_uint32 flags,
*/
if (!(itflags&NPY_ITFLAG_BUFFER)) {
NpyIter_AxisData *axisdata = NIT_AXISDATA(iter);
- if (itflags&NPY_ITFLAG_NOINNER) {
+ if (itflags&NPY_ITFLAG_EXLOOP) {
if (NIT_ITERSIZE(iter) == NAD_SHAPE(axisdata)) {
NIT_ITFLAGS(iter) |= NPY_ITFLAG_ONEITERATION;
}
@@ -762,28 +773,35 @@ NpyIter_MultiNew(npy_intp niter, PyArrayObject **op_in, npy_uint32 flags,
}
/*NUMPY_API
- * Allocate a new iterator for one array object
+ * Allocate a new iterator for more than one array object, using
+ * standard NumPy broadcasting rules and the default buffer size.
+ */
+NPY_NO_EXPORT NpyIter *
+NpyIter_MultiNew(int niter, PyArrayObject **op_in, npy_uint32 flags,
+ NPY_ORDER order, NPY_CASTING casting,
+ npy_uint32 *op_flags,
+ PyArray_Descr **op_request_dtypes)
+{
+ return NpyIter_AdvancedNew(niter, op_in, flags, order, casting,
+ op_flags, op_request_dtypes,
+ 0, NULL, NULL, 0);
+}
+
+/*NUMPY_API
+ * Allocate a new iterator for one array object.
*/
NPY_NO_EXPORT NpyIter *
NpyIter_New(PyArrayObject *op, npy_uint32 flags,
NPY_ORDER order, NPY_CASTING casting,
- PyArray_Descr* dtype,
- npy_intp a_ndim, npy_intp *axes, npy_intp buffersize)
+ PyArray_Descr* dtype)
{
/* Split the flags into separate global and op flags */
npy_uint32 op_flags = flags&NPY_ITER_PER_OP_FLAGS;
flags &= NPY_ITER_GLOBAL_FLAGS;
- if (a_ndim > 0) {
- return NpyIter_MultiNew(1, &op, flags, order, casting,
- &op_flags, &dtype,
- a_ndim, &axes, buffersize);
- }
- else {
- return NpyIter_MultiNew(1, &op, flags, order, casting,
- &op_flags, &dtype,
- 0, NULL, buffersize);
- }
+ return NpyIter_AdvancedNew(1, &op, flags, order, casting,
+ &op_flags, &dtype,
+ 0, NULL, NULL, 0);
}
/*NUMPY_API
@@ -793,8 +811,8 @@ NPY_NO_EXPORT NpyIter *
NpyIter_Copy(NpyIter *iter)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- npy_intp ndim = NIT_NDIM(iter);
- npy_intp iiter, niter = NIT_NITER(iter);
+ int ndim = NIT_NDIM(iter);
+ int iiter, niter = NIT_NITER(iter);
int out_of_memory = 0;
npy_intp size;
@@ -896,8 +914,8 @@ NPY_NO_EXPORT int
NpyIter_Deallocate(NpyIter *iter)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- /*npy_intp ndim = NIT_NDIM(iter);*/
- npy_intp iiter, niter = NIT_NITER(iter);
+ /*int ndim = NIT_NDIM(iter);*/
+ int iiter, niter = NIT_NITER(iter);
PyArray_Descr **dtype = NIT_DTYPES(iter);
PyArrayObject **object = NIT_OPERANDS(iter);
@@ -951,13 +969,13 @@ NpyIter_Deallocate(NpyIter *iter)
* Returns NPY_SUCCEED or NPY_FAIL.
*/
NPY_NO_EXPORT int
-NpyIter_RemoveAxis(NpyIter *iter, npy_intp axis)
+NpyIter_RemoveAxis(NpyIter *iter, int axis)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- npy_intp idim, ndim = NIT_NDIM(iter);
- npy_intp iiter, niter = NIT_NITER(iter);
+ int idim, ndim = NIT_NDIM(iter);
+ int iiter, niter = NIT_NITER(iter);
- npy_intp xdim = 0;
+ int xdim = 0;
char *perm = NIT_PERM(iter);
NpyIter_AxisData *axisdata_del = NIT_AXISDATA(iter), *axisdata;
npy_intp sizeof_axisdata = NIT_AXISDATA_SIZEOF(itflags, ndim, niter);
@@ -1098,32 +1116,32 @@ NpyIter_RemoveCoords(NpyIter *iter)
}
/*NUMPY_API
- * Removes the inner loop handling (so HasInnerLoop returns false)
+ * Removes the inner loop handling (so HasExternalLoop returns true)
*/
NPY_NO_EXPORT int
-NpyIter_RemoveInnerLoop(NpyIter *iter)
+NpyIter_EnableExternalLoop(NpyIter *iter)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- /*npy_intp ndim = NIT_NDIM(iter);*/
- npy_intp niter = NIT_NITER(iter);
+ /*int ndim = NIT_NDIM(iter);*/
+ int niter = NIT_NITER(iter);
/* Check conditions under which this can be done */
if (itflags&(NPY_ITFLAG_HASINDEX|NPY_ITFLAG_HASCOORDS)) {
PyErr_SetString(PyExc_ValueError,
- "Iterator flag NO_INNER_ITERATION cannot be used "
+ "Iterator flag EXTERNAL_LOOP cannot be used "
"if coords or an index is being tracked");
return NPY_FAIL;
}
- if ((itflags&(NPY_ITFLAG_BUFFER|NPY_ITFLAG_RANGE|NPY_ITFLAG_NOINNER))
- == (NPY_ITFLAG_RANGE|NPY_ITFLAG_NOINNER)) {
+ if ((itflags&(NPY_ITFLAG_BUFFER|NPY_ITFLAG_RANGE|NPY_ITFLAG_EXLOOP))
+ == (NPY_ITFLAG_RANGE|NPY_ITFLAG_EXLOOP)) {
PyErr_SetString(PyExc_ValueError,
- "Iterator flag NO_INNER_ITERATION cannot be used "
+ "Iterator flag EXTERNAL_LOOP cannot be used "
"with ranged iteration unless buffering is also enabled");
return NPY_FAIL;
}
/* Set the flag */
- if (!(itflags&NPY_ITFLAG_NOINNER)) {
- itflags |= NPY_ITFLAG_NOINNER;
+ if (!(itflags&NPY_ITFLAG_EXLOOP)) {
+ itflags |= NPY_ITFLAG_EXLOOP;
NIT_ITFLAGS(iter) = itflags;
/*
@@ -1154,8 +1172,8 @@ NPY_NO_EXPORT int
NpyIter_Reset(NpyIter *iter, char **errmsg)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- /*npy_intp ndim = NIT_NDIM(iter);*/
- npy_intp niter = NIT_NITER(iter);
+ /*int ndim = NIT_NDIM(iter);*/
+ int niter = NIT_NITER(iter);
if (itflags&NPY_ITFLAG_BUFFER) {
NpyIter_BufferData *bufferdata;
@@ -1206,8 +1224,8 @@ NPY_NO_EXPORT int
NpyIter_ResetBasePointers(NpyIter *iter, char **baseptrs, char **errmsg)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- /*npy_intp ndim = NIT_NDIM(iter);*/
- npy_intp iiter, niter = NIT_NITER(iter);
+ /*int ndim = NIT_NDIM(iter);*/
+ int iiter, niter = NIT_NITER(iter);
char **resetdataptr = NIT_RESETDATAPTR(iter);
npy_intp *baseoffsets = NIT_BASEOFFSETS(iter);
@@ -1254,8 +1272,8 @@ NpyIter_ResetToIterIndexRange(NpyIter *iter,
npy_intp istart, npy_intp iend, char **errmsg)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- /*npy_intp ndim = NIT_NDIM(iter);*/
- /*npy_intp niter = NIT_NITER(iter);*/
+ /*int ndim = NIT_NDIM(iter);*/
+ /*int niter = NIT_NITER(iter);*/
if (!(itflags&NPY_ITFLAG_RANGE)) {
if (errmsg == NULL) {
@@ -1312,8 +1330,8 @@ NPY_NO_EXPORT int
NpyIter_GotoCoords(NpyIter *iter, npy_intp *coords)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- npy_intp idim, ndim = NIT_NDIM(iter);
- npy_intp niter = NIT_NITER(iter);
+ int idim, ndim = NIT_NDIM(iter);
+ int niter = NIT_NITER(iter);
npy_intp iterindex, factor;
NpyIter_AxisData *axisdata;
@@ -1334,10 +1352,10 @@ NpyIter_GotoCoords(NpyIter *iter, npy_intp *coords)
return NPY_FAIL;
}
- if (itflags&NPY_ITFLAG_NOINNER) {
+ if (itflags&NPY_ITFLAG_EXLOOP) {
PyErr_SetString(PyExc_ValueError,
"Cannot call GotoCoords on an iterator which "
- "has the flag NO_INNER_ITERATION");
+ "has the flag EXTERNAL_LOOP");
return NPY_FAIL;
}
@@ -1398,8 +1416,8 @@ NPY_NO_EXPORT int
NpyIter_GotoIndex(NpyIter *iter, npy_intp index)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- npy_intp idim, ndim = NIT_NDIM(iter);
- npy_intp niter = NIT_NITER(iter);
+ int idim, ndim = NIT_NDIM(iter);
+ int niter = NIT_NITER(iter);
npy_intp iterindex, factor;
NpyIter_AxisData *axisdata;
@@ -1419,10 +1437,10 @@ NpyIter_GotoIndex(NpyIter *iter, npy_intp index)
return NPY_FAIL;
}
- if (itflags&NPY_ITFLAG_NOINNER) {
+ if (itflags&NPY_ITFLAG_EXLOOP) {
PyErr_SetString(PyExc_ValueError,
"Cannot call GotoIndex on an iterator which "
- "has the flag NO_INNER_ITERATION");
+ "has the flag EXTERNAL_LOOP");
return NPY_FAIL;
}
@@ -1486,13 +1504,13 @@ NPY_NO_EXPORT int
NpyIter_GotoIterIndex(NpyIter *iter, npy_intp iterindex)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- /*npy_intp ndim = NIT_NDIM(iter);*/
- npy_intp iiter, niter = NIT_NITER(iter);
+ /*int ndim = NIT_NDIM(iter);*/
+ int iiter, niter = NIT_NITER(iter);
- if (itflags&NPY_ITFLAG_NOINNER) {
+ if (itflags&NPY_ITFLAG_EXLOOP) {
PyErr_SetString(PyExc_ValueError,
"Cannot call GotoIterIndex on an iterator which "
- "has the flag NO_INNER_ITERATION");
+ "has the flag EXTERNAL_LOOP");
return NPY_FAIL;
}
@@ -1550,8 +1568,8 @@ NPY_NO_EXPORT npy_intp
NpyIter_GetIterIndex(NpyIter *iter)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- npy_intp idim, ndim = NIT_NDIM(iter);
- npy_intp niter = NIT_NITER(iter);
+ int idim, ndim = NIT_NDIM(iter);
+ int niter = NIT_NITER(iter);
/* iterindex is only used if NPY_ITER_RANGED or NPY_ITER_BUFFERED was set */
if (itflags&(NPY_ITFLAG_RANGE|NPY_ITFLAG_BUFFER)) {
@@ -1582,7 +1600,7 @@ NpyIter_GetIterIndex(NpyIter *iter)
/**begin repeat
* #const_itflags = 0,
* NPY_ITFLAG_HASINDEX,
- * NPY_ITFLAG_NOINNER,
+ * NPY_ITFLAG_EXLOOP,
* NPY_ITFLAG_RANGE,
* NPY_ITFLAG_RANGE|NPY_ITFLAG_HASINDEX#
* #tag_itflags = 0, IND, NOINN, RNG, RNGuIND#
@@ -1603,12 +1621,12 @@ npyiter_iternext_itflags@tag_itflags@_dims@tag_ndim@_iters@tag_niter@(
{
const npy_uint32 itflags = @const_itflags@;
#if @const_ndim@ >= NPY_MAXDIMS
- npy_intp idim, ndim = NIT_NDIM(iter);
+ int idim, ndim = NIT_NDIM(iter);
#endif
#if @const_niter@ < NPY_MAXDIMS
- const npy_intp niter = @const_niter@;
+ const int niter = @const_niter@;
#else
- npy_intp niter = NIT_NITER(iter);
+ int niter = NIT_NITER(iter);
#endif
npy_intp istrides, nstrides, sizeof_axisdata;
@@ -1633,7 +1651,7 @@ npyiter_iternext_itflags@tag_itflags@_dims@tag_ndim@_iters@tag_niter@(
sizeof_axisdata = NIT_AXISDATA_SIZEOF(itflags, ndim, niter);
axisdata0 = NIT_AXISDATA(iter);
-# if !(@const_itflags@&NPY_ITFLAG_NOINNER)
+# if !(@const_itflags@&NPY_ITFLAG_EXLOOP)
/* Increment coordinate 0 */
NAD_COORD(axisdata0)++;
/* Increment pointer 0 */
@@ -1644,7 +1662,7 @@ npyiter_iternext_itflags@tag_itflags@_dims@tag_ndim@_iters@tag_niter@(
#if @const_ndim@ == 1
-# if !(@const_itflags@&NPY_ITFLAG_NOINNER)
+# if !(@const_itflags@&NPY_ITFLAG_EXLOOP)
/* Finished when the coordinate equals the shape */
return NAD_COORD(axisdata0) < NAD_SHAPE(axisdata0);
# else
@@ -1656,7 +1674,7 @@ npyiter_iternext_itflags@tag_itflags@_dims@tag_ndim@_iters@tag_niter@(
#else
-# if !(@const_itflags@&NPY_ITFLAG_NOINNER)
+# if !(@const_itflags@&NPY_ITFLAG_EXLOOP)
if (NAD_COORD(axisdata0) < NAD_SHAPE(axisdata0)) {
return 1;
}
@@ -1757,14 +1775,14 @@ static int
npyiter_buffered_reduce_iternext_iters@tag_niter@(NpyIter *iter)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- /*npy_intp ndim = NIT_NDIM(iter);*/
+ /*int ndim = NIT_NDIM(iter);*/
#if @const_niter@ >= NPY_MAXDIMS
- npy_intp niter = NIT_NITER(iter);
+ int niter = NIT_NITER(iter);
#else
- const npy_intp niter = @const_niter@;
+ const int niter = @const_niter@;
#endif
- npy_intp iiter;
+ int iiter;
NpyIter_AxisData *axisdata;
NpyIter_BufferData *bufferdata = NIT_BUFFERDATA(iter);
@@ -1777,7 +1795,7 @@ npyiter_buffered_reduce_iternext_iters@tag_niter@(NpyIter *iter)
* If the iterator handles the inner loop, need to increment all
* the coordinates and pointers
*/
- if (!(itflags&NPY_ITFLAG_NOINNER)) {
+ if (!(itflags&NPY_ITFLAG_EXLOOP)) {
/* Increment within the buffer */
if (++NIT_ITERINDEX(iter) < NBF_BUFITEREND(bufferdata)) {
npy_intp *strides;
@@ -1793,7 +1811,7 @@ npyiter_buffered_reduce_iternext_iters@tag_niter@(NpyIter *iter)
NIT_ITERINDEX(iter) += NBF_SIZE(bufferdata);
}
- NPY_IT_DBG_PRINTF("Iterator: Finished iteration %d of outer reduce loop\n",
+ NPY_IT_DBG_PRINT1("Iterator: Finished iteration %d of outer reduce loop\n",
(int)NBF_REDUCE_POS(bufferdata));
/* The outer increment for the reduce double loop */
if (++NBF_REDUCE_POS(bufferdata) < NBF_REDUCE_OUTERSIZE(bufferdata)) {
@@ -1838,8 +1856,8 @@ static int
npyiter_buffered_iternext(NpyIter *iter)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- /*npy_intp ndim = NIT_NDIM(iter);*/
- npy_intp niter = NIT_NITER(iter);
+ /*int ndim = NIT_NDIM(iter);*/
+ int niter = NIT_NITER(iter);
NpyIter_BufferData *bufferdata = NIT_BUFFERDATA(iter);
@@ -1847,10 +1865,11 @@ npyiter_buffered_iternext(NpyIter *iter)
* If the iterator handles the inner loop, need to increment all
* the coordinates and pointers
*/
- if (!(itflags&NPY_ITFLAG_NOINNER)) {
+ if (!(itflags&NPY_ITFLAG_EXLOOP)) {
/* Increment within the buffer */
if (++NIT_ITERINDEX(iter) < NBF_BUFITEREND(bufferdata)) {
- npy_intp iiter, *strides;
+ int iiter;
+ npy_intp *strides;
char **ptrs;
strides = NBF_STRIDES(bufferdata);
@@ -1903,12 +1922,12 @@ npyiter_iternext_sizeone(NpyIter *iter)
* This is so that the function can be called from code not holding
* the GIL.
*/
-NPY_NO_EXPORT NpyIter_IterNext_Fn
+NPY_NO_EXPORT NpyIter_IterNextFunc *
NpyIter_GetIterNext(NpyIter *iter, char **errmsg)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- npy_intp ndim = NIT_NDIM(iter);
- npy_intp niter = NIT_NITER(iter);
+ int ndim = NIT_NDIM(iter);
+ int niter = NIT_NITER(iter);
/*
* When there is just one iteration and buffering is disabled
@@ -1944,20 +1963,20 @@ NpyIter_GetIterNext(NpyIter *iter, char **errmsg)
/*
* Ignore all the flags that don't affect the iterator memory
* layout or the iternext function. Currently only HASINDEX,
- * NOINNER, and RANGE affect them here.
+ * EXLOOP, and RANGE affect them here.
*/
- itflags &= (NPY_ITFLAG_HASINDEX|NPY_ITFLAG_NOINNER|NPY_ITFLAG_RANGE);
+ itflags &= (NPY_ITFLAG_HASINDEX|NPY_ITFLAG_EXLOOP|NPY_ITFLAG_RANGE);
/* Switch statements let the compiler optimize this most effectively */
switch (itflags) {
/*
- * The combinations HASINDEX|NOINNER and RANGE|NOINNER are excluded
+ * The combinations HASINDEX|EXLOOP and RANGE|EXLOOP are excluded
* by the New functions
*/
/**begin repeat
* #const_itflags = 0,
* NPY_ITFLAG_HASINDEX,
- * NPY_ITFLAG_NOINNER,
+ * NPY_ITFLAG_EXLOOP,
* NPY_ITFLAG_RANGE,
* NPY_ITFLAG_RANGE|NPY_ITFLAG_HASINDEX#
* #tag_itflags = 0, IND, NOINN, RNG, RNGuIND#
@@ -2036,10 +2055,10 @@ static void
npyiter_getcoord_itflags@tag_itflags@(NpyIter *iter, npy_intp *outcoord)
{
const npy_uint32 itflags = @const_itflags@;
- npy_intp ndim = NIT_NDIM(iter);
- npy_intp niter = NIT_NITER(iter);
+ int idim, ndim = NIT_NDIM(iter);
+ int niter = NIT_NITER(iter);
- npy_intp idim, sizeof_axisdata;
+ npy_intp sizeof_axisdata;
NpyIter_AxisData *axisdata;
#if !((@const_itflags@)&NPY_ITFLAG_IDENTPERM)
char* perm = NIT_PERM(iter);
@@ -2081,12 +2100,12 @@ npyiter_getcoord_itflags@tag_itflags@(NpyIter *iter, npy_intp *outcoord)
* This is so that the function can be called from code not holding
* the GIL.
*/
-NPY_NO_EXPORT NpyIter_GetCoords_Fn
+NPY_NO_EXPORT NpyIter_GetCoordsFunc *
NpyIter_GetGetCoords(NpyIter *iter, char **errmsg)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- npy_intp ndim = NIT_NDIM(iter);
- npy_intp niter = NIT_NITER(iter);
+ int ndim = NIT_NDIM(iter);
+ int niter = NIT_NITER(iter);
/* These flags must be correct */
if ((itflags&(NPY_ITFLAG_HASCOORDS|NPY_ITFLAG_DELAYBUF)) !=
@@ -2177,9 +2196,9 @@ NpyIter_HasDelayedBufAlloc(NpyIter *iter)
* Whether the iterator handles the inner loop
*/
NPY_NO_EXPORT npy_bool
-NpyIter_HasInnerLoop(NpyIter *iter)
+NpyIter_HasExternalLoop(NpyIter *iter)
{
- return (NIT_ITFLAGS(iter)&NPY_ITFLAG_NOINNER) == 0;
+ return (NIT_ITFLAGS(iter)&NPY_ITFLAG_EXLOOP) != 0;
}
/*NUMPY_API
@@ -2207,8 +2226,8 @@ NPY_NO_EXPORT npy_bool
NpyIter_RequiresBuffering(NpyIter *iter)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- /*npy_intp ndim = NIT_NDIM(iter);*/
- npy_intp iiter, niter = NIT_NITER(iter);
+ /*int ndim = NIT_NDIM(iter);*/
+ int iiter, niter = NIT_NITER(iter);
char *op_itflags;
@@ -2242,7 +2261,7 @@ NpyIter_IterationNeedsAPI(NpyIter *iter)
/*NUMPY_API
* Gets the number of dimensions being iterated
*/
-NPY_NO_EXPORT npy_intp
+NPY_NO_EXPORT int
NpyIter_GetNDim(NpyIter *iter)
{
return NIT_NDIM(iter);
@@ -2251,7 +2270,7 @@ NpyIter_GetNDim(NpyIter *iter)
/*NUMPY_API
* Gets the number of operands being iterated
*/
-NPY_NO_EXPORT npy_intp
+NPY_NO_EXPORT int
NpyIter_GetNIter(NpyIter *iter)
{
return NIT_NITER(iter);
@@ -2269,7 +2288,7 @@ NpyIter_GetIterSize(NpyIter *iter)
/*NUMPY_API
* Whether the iterator is buffered
*/
-NPY_NO_EXPORT int
+NPY_NO_EXPORT npy_bool
NpyIter_IsBuffered(NpyIter *iter)
{
return (NIT_ITFLAGS(iter)&NPY_ITFLAG_BUFFER) != 0;
@@ -2278,7 +2297,7 @@ NpyIter_IsBuffered(NpyIter *iter)
/*NUMPY_API
* Whether the inner loop can grow if buffering is unneeded
*/
-NPY_NO_EXPORT int
+NPY_NO_EXPORT npy_bool
NpyIter_IsGrowInner(NpyIter *iter)
{
return (NIT_ITFLAGS(iter)&NPY_ITFLAG_GROWINNER) != 0;
@@ -2291,8 +2310,8 @@ NPY_NO_EXPORT npy_intp
NpyIter_GetBufferSize(NpyIter *iter)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- /*npy_intp ndim = NIT_NDIM(iter);*/
- npy_intp niter = NIT_NITER(iter);
+ /*int ndim = NIT_NDIM(iter);*/
+ int niter = NIT_NITER(iter);
if (itflags&NPY_ITFLAG_BUFFER) {
NpyIter_BufferData *bufferdata = NIT_BUFFERDATA(iter);
@@ -2333,10 +2352,10 @@ NPY_NO_EXPORT int
NpyIter_GetShape(NpyIter *iter, npy_intp *outshape)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- npy_intp ndim = NIT_NDIM(iter);
- npy_intp niter = NIT_NITER(iter);
+ int ndim = NIT_NDIM(iter);
+ int niter = NIT_NITER(iter);
- npy_intp idim, sizeof_axisdata;
+ int idim, sizeof_axisdata;
NpyIter_AxisData *axisdata;
char *perm;
@@ -2397,8 +2416,8 @@ NpyIter_CreateCompatibleStrides(NpyIter *iter,
npy_intp itemsize, npy_intp *outstrides)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- npy_intp idim, ndim = NIT_NDIM(iter);
- npy_intp niter = NIT_NITER(iter);
+ int idim, ndim = NIT_NDIM(iter);
+ int niter = NIT_NITER(iter);
npy_intp sizeof_axisdata;
NpyIter_AxisData *axisdata;
@@ -2444,8 +2463,8 @@ NPY_NO_EXPORT char **
NpyIter_GetDataPtrArray(NpyIter *iter)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- /*npy_intp ndim = NIT_NDIM(iter);*/
- npy_intp niter = NIT_NITER(iter);
+ /*int ndim = NIT_NDIM(iter);*/
+ int niter = NIT_NITER(iter);
if (itflags&NPY_ITFLAG_BUFFER) {
NpyIter_BufferData *bufferdata = NIT_BUFFERDATA(iter);
@@ -2473,8 +2492,8 @@ NPY_NO_EXPORT char **
NpyIter_GetInitialDataPtrArray(NpyIter *iter)
{
/*npy_uint32 itflags = NIT_ITFLAGS(iter);*/
- /*npy_intp ndim = NIT_NDIM(iter);*/
- npy_intp niter = NIT_NITER(iter);
+ /*int ndim = NIT_NDIM(iter);*/
+ int niter = NIT_NITER(iter);
return NIT_RESETDATAPTR(iter);
}
@@ -2486,8 +2505,8 @@ NPY_NO_EXPORT PyArray_Descr **
NpyIter_GetDescrArray(NpyIter *iter)
{
/*npy_uint32 itflags = NIT_ITFLAGS(iter);*/
- /*npy_intp ndim = NIT_NDIM(iter);*/
- /*npy_intp niter = NIT_NITER(iter);*/
+ /*int ndim = NIT_NDIM(iter);*/
+ /*int niter = NIT_NITER(iter);*/
return NIT_DTYPES(iter);
}
@@ -2499,8 +2518,8 @@ NPY_NO_EXPORT PyArrayObject **
NpyIter_GetOperandArray(NpyIter *iter)
{
/*npy_uint32 itflags = NIT_ITFLAGS(iter);*/
- /*npy_intp ndim = NIT_NDIM(iter);*/
- npy_intp niter = NIT_NITER(iter);
+ /*int ndim = NIT_NDIM(iter);*/
+ int niter = NIT_NITER(iter);
return NIT_OPERANDS(iter);
}
@@ -2512,8 +2531,8 @@ NPY_NO_EXPORT PyArrayObject *
NpyIter_GetIterView(NpyIter *iter, npy_intp i)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- npy_intp idim, ndim = NIT_NDIM(iter);
- npy_intp niter = NIT_NITER(iter);
+ int idim, ndim = NIT_NDIM(iter);
+ int niter = NIT_NITER(iter);
npy_intp shape[NPY_MAXDIMS], strides[NPY_MAXDIMS];
PyArrayObject *obj, *view;
@@ -2573,8 +2592,8 @@ NPY_NO_EXPORT npy_intp *
NpyIter_GetIndexPtr(NpyIter *iter)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- /*npy_intp ndim = NIT_NDIM(iter);*/
- npy_intp niter = NIT_NITER(iter);
+ /*int ndim = NIT_NDIM(iter);*/
+ int niter = NIT_NITER(iter);
NpyIter_AxisData *axisdata = NIT_AXISDATA(iter);
@@ -2594,8 +2613,8 @@ NPY_NO_EXPORT void
NpyIter_GetReadFlags(NpyIter *iter, char *outreadflags)
{
/*npy_uint32 itflags = NIT_ITFLAGS(iter);*/
- /*npy_intp ndim = NIT_NDIM(iter);*/
- npy_intp iiter, niter = NIT_NITER(iter);
+ /*int ndim = NIT_NDIM(iter);*/
+ int iiter, niter = NIT_NITER(iter);
char *op_itflags = NIT_OPITFLAGS(iter);
@@ -2611,8 +2630,8 @@ NPY_NO_EXPORT void
NpyIter_GetWriteFlags(NpyIter *iter, char *outwriteflags)
{
/*npy_uint32 itflags = NIT_ITFLAGS(iter);*/
- /*npy_intp ndim = NIT_NDIM(iter);*/
- npy_intp iiter, niter = NIT_NITER(iter);
+ /*int ndim = NIT_NDIM(iter);*/
+ int iiter, niter = NIT_NITER(iter);
char *op_itflags = NIT_OPITFLAGS(iter);
@@ -2623,7 +2642,7 @@ NpyIter_GetWriteFlags(NpyIter *iter, char *outwriteflags)
/*NUMPY_API
- * Get the array of strides for the inner loop (when HasInnerLoop is false)
+ * Get the array of strides for the inner loop (when HasExternalLoop is true)
*
* This function may be safely called without holding the Python GIL.
*/
@@ -2631,8 +2650,8 @@ NPY_NO_EXPORT npy_intp *
NpyIter_GetInnerStrideArray(NpyIter *iter)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- /*npy_intp ndim = NIT_NDIM(iter);*/
- npy_intp niter = NIT_NITER(iter);
+ /*int ndim = NIT_NDIM(iter);*/
+ int niter = NIT_NITER(iter);
if (itflags&NPY_ITFLAG_BUFFER) {
NpyIter_BufferData *data = NIT_BUFFERDATA(iter);
@@ -2653,11 +2672,11 @@ NpyIter_GetInnerStrideArray(NpyIter *iter)
* Returns NULL if an error occurs.
*/
NPY_NO_EXPORT npy_intp *
-NpyIter_GetAxisStrideArray(NpyIter *iter, npy_intp axis)
+NpyIter_GetAxisStrideArray(NpyIter *iter, int axis)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- npy_intp idim, ndim = NIT_NDIM(iter);
- npy_intp niter = NIT_NITER(iter);
+ int idim, ndim = NIT_NDIM(iter);
+ int niter = NIT_NITER(iter);
char *perm = NIT_PERM(iter);
NpyIter_AxisData *axisdata = NIT_AXISDATA(iter);
@@ -2702,8 +2721,8 @@ NPY_NO_EXPORT void
NpyIter_GetInnerFixedStrideArray(NpyIter *iter, npy_intp *out_strides)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- npy_intp ndim = NIT_NDIM(iter);
- npy_intp iiter, niter = NIT_NITER(iter);
+ int ndim = NIT_NDIM(iter);
+ int iiter, niter = NIT_NITER(iter);
NpyIter_AxisData *axisdata0 = NIT_AXISDATA(iter);
npy_intp sizeof_axisdata = NIT_AXISDATA_SIZEOF(itflags, ndim, niter);
@@ -2737,7 +2756,7 @@ NpyIter_GetInnerFixedStrideArray(NpyIter *iter, npy_intp *out_strides)
*/
else {
NpyIter_AxisData *axisdata = axisdata0;
- npy_intp idim,
+ int idim,
reduce_outerdim = NBF_REDUCE_OUTERDIM(data);
for (idim = 0; idim < reduce_outerdim; ++idim) {
if (NAD_STRIDES(axisdata)[iiter] != 0) {
@@ -2778,7 +2797,7 @@ NpyIter_GetInnerFixedStrideArray(NpyIter *iter, npy_intp *out_strides)
/*NUMPY_API
- * Get a pointer to the size of the inner loop (when HasInnerLoop is false)
+ * Get a pointer to the size of the inner loop (when HasExternalLoop is true)
*
* This function may be safely called without holding the Python GIL.
*/
@@ -2786,8 +2805,8 @@ NPY_NO_EXPORT npy_intp *
NpyIter_GetInnerLoopSizePtr(NpyIter *iter)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- /*npy_intp ndim = NIT_NDIM(iter);*/
- npy_intp niter = NIT_NITER(iter);
+ /*int ndim = NIT_NDIM(iter);*/
+ int niter = NIT_NITER(iter);
if (itflags&NPY_ITFLAG_BUFFER) {
NpyIter_BufferData *data = NIT_BUFFERDATA(iter);
@@ -2799,7 +2818,7 @@ NpyIter_GetInnerLoopSizePtr(NpyIter *iter)
}
}
-/* Checks 'flags' for (C|F)_ORDER_INDEX, COORDS, and NO_INNER_ITERATION,
+/* Checks 'flags' for (C|F)_ORDER_INDEX, COORDS, and EXTERNAL_LOOP,
* setting the appropriate internal flags in 'itflags'.
*
* Returns 1 on success, 0 on error.
@@ -2834,23 +2853,23 @@ npyiter_check_global_flags(npy_uint32 flags, npy_uint32* itflags)
(*itflags) |= NPY_ITFLAG_HASCOORDS;
}
/* Check if the caller wants to handle inner iteration */
- if (flags&NPY_ITER_NO_INNER_ITERATION) {
+ if (flags&NPY_ITER_EXTERNAL_LOOP) {
if ((*itflags)&(NPY_ITFLAG_HASINDEX|NPY_ITFLAG_HASCOORDS)) {
PyErr_SetString(PyExc_ValueError,
- "Iterator flag NO_INNER_ITERATION cannot be used "
+ "Iterator flag EXTERNAL_LOOP cannot be used "
"if coords or an index is being tracked");
return 0;
}
- (*itflags) |= NPY_ITFLAG_NOINNER;
+ (*itflags) |= NPY_ITFLAG_EXLOOP;
}
/* Ranged */
if (flags&NPY_ITER_RANGED) {
(*itflags) |= NPY_ITFLAG_RANGE;
- if ((flags&NPY_ITER_NO_INNER_ITERATION) &&
+ if ((flags&NPY_ITER_EXTERNAL_LOOP) &&
!(flags&NPY_ITER_BUFFERED)) {
PyErr_SetString(PyExc_ValueError,
"Iterator flag RANGED cannot be used with "
- "the flag NO_INNER_ITERATION unless "
+ "the flag EXTERNAL_LOOP unless "
"BUFFERED is also enabled");
return 0;
}
@@ -2869,9 +2888,9 @@ npyiter_check_global_flags(npy_uint32 flags, npy_uint32* itflags)
return 1;
}
-static npy_intp
-npyiter_calculate_ndim(npy_intp niter, PyArrayObject **op_in,
- npy_intp oa_ndim)
+static int
+npyiter_calculate_ndim(int niter, PyArrayObject **op_in,
+ int oa_ndim)
{
/* If 'op_axes' is being used, force 'ndim' */
if (oa_ndim > 0 ) {
@@ -2879,11 +2898,11 @@ npyiter_calculate_ndim(npy_intp niter, PyArrayObject **op_in,
}
/* Otherwise it's the maximum 'ndim' from the operands */
else {
- npy_intp ndim = 0, iiter;
+ int ndim = 0, iiter;
for (iiter = 0; iiter < niter; ++iiter) {
if (op_in[iiter] != NULL) {
- npy_intp ondim = PyArray_NDIM(op_in[iiter]);
+ int ondim = PyArray_NDIM(op_in[iiter]);
if (ondim > ndim) {
ndim = ondim;
}
@@ -2896,15 +2915,16 @@ npyiter_calculate_ndim(npy_intp niter, PyArrayObject **op_in,
}
static int
-npyiter_check_op_axes(npy_intp niter, npy_intp oa_ndim, npy_intp **op_axes)
+npyiter_check_op_axes(int niter, int oa_ndim, int **op_axes,
+ npy_intp *itershape)
{
char axes_dupcheck[NPY_MAXDIMS];
- npy_intp iiter, idim;
+ int iiter, idim;
- if (oa_ndim == 0 && op_axes != NULL) {
+ if (oa_ndim == 0 && (op_axes != NULL || itershape != NULL)) {
PyErr_Format(PyExc_ValueError,
- "If 'op_axes' is not NULL in the iterator constructor, "
- "'oa_ndim' must be greater than zero");
+ "If 'op_axes' or 'itershape' is not NULL in the"
+ "iterator constructor, 'oa_ndim' must be greater than zero");
return 0;
}
else if (oa_ndim > 0) {
@@ -2912,7 +2932,7 @@ npyiter_check_op_axes(npy_intp niter, npy_intp oa_ndim, npy_intp **op_axes)
PyErr_Format(PyExc_ValueError,
"Cannot construct an iterator with more than %d dimensions "
"(%d were requested for op_axes)",
- (int)NPY_MAXDIMS, (int)oa_ndim);
+ (int)NPY_MAXDIMS, oa_ndim);
return 0;
}
else if (op_axes == NULL) {
@@ -2924,7 +2944,7 @@ npyiter_check_op_axes(npy_intp niter, npy_intp oa_ndim, npy_intp **op_axes)
/* Check that there are no duplicates in op_axes */
for (iiter = 0; iiter < niter; ++iiter) {
- npy_intp *axes = op_axes[iiter];
+ int *axes = op_axes[iiter];
if (axes != NULL) {
memset(axes_dupcheck, 0, NPY_MAXDIMS);
for (idim = 0; idim < oa_ndim; ++idim) {
@@ -3170,7 +3190,7 @@ npyiter_prepare_one_operand(PyArrayObject **op,
Py_DECREF(*op_dtype);
*op_dtype = nbo_dtype;
- NPY_IT_DBG_PRINTF("Iterator: Setting NPY_OP_ITFLAG_CAST "
+ NPY_IT_DBG_PRINT("Iterator: Setting NPY_OP_ITFLAG_CAST "
"because of NPY_ITER_NBO\n");
/* Indicate that byte order or alignment needs fixing */
*op_itflags |= NPY_OP_ITFLAG_CAST;
@@ -3180,7 +3200,7 @@ npyiter_prepare_one_operand(PyArrayObject **op,
if (op_flags&NPY_ITER_ALIGNED) {
/* Check alignment */
if (!PyArray_ISALIGNED(*op)) {
- NPY_IT_DBG_PRINTF("Iterator: Setting NPY_OP_ITFLAG_CAST "
+ NPY_IT_DBG_PRINT("Iterator: Setting NPY_OP_ITFLAG_CAST "
"because of NPY_ITER_ALIGNED\n");
*op_itflags |= NPY_OP_ITFLAG_CAST;
}
@@ -3204,7 +3224,7 @@ npyiter_prepare_one_operand(PyArrayObject **op,
* can replace the arrays if copying is necessary.
*/
static int
-npyiter_prepare_operands(npy_intp niter, PyArrayObject **op_in,
+npyiter_prepare_operands(int niter, PyArrayObject **op_in,
PyArrayObject **op,
char **op_dataptr,
PyArray_Descr **op_request_dtypes,
@@ -3212,7 +3232,7 @@ npyiter_prepare_operands(npy_intp niter, PyArrayObject **op_in,
npy_uint32 flags,
npy_uint32 *op_flags, char *op_itflags)
{
- npy_intp iiter, i;
+ int iiter, i;
for (iiter = 0; iiter < niter; ++iiter) {
op[iiter] = op_in[iiter];
@@ -3290,15 +3310,15 @@ npyiter_casting_to_string(NPY_CASTING casting)
}
static int
-npyiter_check_casting(npy_intp niter, PyArrayObject **op,
+npyiter_check_casting(int niter, PyArrayObject **op,
PyArray_Descr **op_dtype,
NPY_CASTING casting,
char *op_itflags)
{
- npy_intp iiter;
+ int iiter;
for(iiter = 0; iiter < niter; ++iiter) {
- NPY_IT_DBG_PRINTF("Iterator: Checking casting for operand %d\n",
+ NPY_IT_DBG_PRINT1("Iterator: Checking casting for operand %d\n",
(int)iiter);
#if NPY_IT_DBG_TRACING
printf("op: ");
@@ -3340,7 +3360,7 @@ npyiter_check_casting(npy_intp niter, PyArrayObject **op,
return 0;
}
- NPY_IT_DBG_PRINTF("Iterator: Setting NPY_OP_ITFLAG_CAST "
+ NPY_IT_DBG_PRINT("Iterator: Setting NPY_OP_ITFLAG_CAST "
"because the types aren't equivalent\n");
/* Indicate that this operand needs casting */
op_itflags[iiter] |= NPY_OP_ITFLAG_CAST;
@@ -3412,22 +3432,34 @@ npyiter_shape_string(npy_intp n, npy_intp *vals, char *ending)
static int
npyiter_fill_axisdata(NpyIter *iter, npy_uint32 flags, char *op_itflags,
char **op_dataptr,
- npy_uint32 *op_flags, npy_intp **op_axes,
+ npy_uint32 *op_flags, int **op_axes,
+ npy_intp *itershape,
int output_scalars)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- npy_intp idim, ndim = NIT_NDIM(iter);
- npy_intp iiter, niter = NIT_NITER(iter);
+ int idim, ndim = NIT_NDIM(iter);
+ int iiter, niter = NIT_NITER(iter);
- npy_intp ondim;
+ int ondim;
NpyIter_AxisData *axisdata;
npy_intp sizeof_axisdata;
PyArrayObject **op = NIT_OPERANDS(iter), *op_cur;
npy_intp broadcast_shape[NPY_MAXDIMS];
/* First broadcast the shapes together */
- for (idim = 0; idim < ndim; ++idim) {
- broadcast_shape[idim] = 1;
+ if (itershape == NULL) {
+ for (idim = 0; idim < ndim; ++idim) {
+ broadcast_shape[idim] = 1;
+ }
+ }
+ else {
+ for (idim = 0; idim < ndim; ++idim) {
+ broadcast_shape[idim] = itershape[idim];
+ /* Negative shape entries are deduced from the operands */
+ if (broadcast_shape[idim] < 0) {
+ broadcast_shape[idim] = 1;
+ }
+ }
}
for (iiter = 0; iiter < niter; ++iiter) {
op_cur = op[iiter];
@@ -3458,9 +3490,9 @@ npyiter_fill_axisdata(NpyIter *iter, npy_uint32 flags, char *op_itflags,
}
}
else {
- npy_intp *axes = op_axes[iiter];
+ int *axes = op_axes[iiter];
for (idim = 0; idim < ndim; ++idim) {
- npy_intp i = axes[idim];
+ int i = axes[idim];
if (i >= 0) {
if (i < ondim) {
npy_intp bshape = broadcast_shape[idim],
@@ -3486,6 +3518,17 @@ npyiter_fill_axisdata(NpyIter *iter, npy_uint32 flags, char *op_itflags,
}
}
}
+ /*
+ * If a shape was provided with a 1 entry, make sure that entry didn't
+ * get expanded by broadcasting.
+ */
+ if (itershape != NULL) {
+ for (idim = 0; idim < ndim; ++idim) {
+ if (itershape[idim] == 1 && broadcast_shape[idim] != 1) {
+ goto broadcast_error;
+ }
+ }
+ }
axisdata = NIT_AXISDATA(iter);
sizeof_axisdata = NIT_AXISDATA_SIZEOF(itflags, ndim, niter);
@@ -3546,8 +3589,8 @@ npyiter_fill_axisdata(NpyIter *iter, npy_uint32 flags, char *op_itflags,
}
}
else {
- npy_intp *axes = op_axes[iiter];
- npy_intp i = axes[ndim-idim-1];
+ int *axes = op_axes[iiter];
+ int i = axes[ndim-idim-1];
if (i >= 0) {
if (bshape == 1 || op_cur == NULL) {
strides[iiter] = 0;
@@ -3629,12 +3672,16 @@ broadcast_error: {
if (op_axes == NULL) {
errmsg = PyUString_FromString("operands could not be broadcast "
"together with shapes ");
+ if (errmsg == NULL) {
+ return 0;
+ }
for (iiter = 0; iiter < niter; ++iiter) {
if (op[iiter] != NULL) {
tmp = npyiter_shape_string(PyArray_NDIM(op[iiter]),
PyArray_DIMS(op[iiter]),
" ");
if (tmp == NULL) {
+ Py_DECREF(errmsg);
return 0;
}
PyUString_ConcatAndDel(&errmsg, tmp);
@@ -3643,6 +3690,28 @@ broadcast_error: {
}
}
}
+ if (itershape != NULL) {
+ tmp = PyUString_FromString("and requested shape ");
+ if (tmp == NULL) {
+ Py_DECREF(errmsg);
+ return 0;
+ }
+ PyUString_ConcatAndDel(&errmsg, tmp);
+ if (errmsg == NULL) {
+ return 0;
+ }
+
+ tmp = npyiter_shape_string(ndim, itershape, "");
+ if (tmp == NULL) {
+ Py_DECREF(errmsg);
+ return 0;
+ }
+ PyUString_ConcatAndDel(&errmsg, tmp);
+ if (errmsg == NULL) {
+ return 0;
+ }
+
+ }
PyErr_SetObject(PyExc_ValueError, errmsg);
}
else {
@@ -3651,7 +3720,7 @@ broadcast_error: {
"[original->remapped]: ");
for (iiter = 0; iiter < niter; ++iiter) {
if (op[iiter] != NULL) {
- npy_intp *axes = op_axes[iiter];
+ int *axes = op_axes[iiter];
tmpstr = (axes == NULL) ? " " : "->";
tmp = npyiter_shape_string(PyArray_NDIM(op[iiter]),
@@ -3667,7 +3736,7 @@ broadcast_error: {
if (axes != NULL) {
for (idim = 0; idim < ndim; ++idim) {
- npy_intp i = axes[ndim-idim-1];
+ npy_intp i = axes[idim];
if (i >= 0 && i < PyArray_NDIM(op[iiter])) {
remdims[idim] = PyArray_DIM(op[iiter], i);
@@ -3687,6 +3756,28 @@ broadcast_error: {
}
}
}
+ if (itershape != NULL) {
+ tmp = PyUString_FromString("and requested shape ");
+ if (tmp == NULL) {
+ Py_DECREF(errmsg);
+ return 0;
+ }
+ PyUString_ConcatAndDel(&errmsg, tmp);
+ if (errmsg == NULL) {
+ return 0;
+ }
+
+ tmp = npyiter_shape_string(ndim, itershape, "");
+ if (tmp == NULL) {
+ Py_DECREF(errmsg);
+ return 0;
+ }
+ PyUString_ConcatAndDel(&errmsg, tmp);
+ if (errmsg == NULL) {
+ return 0;
+ }
+
+ }
PyErr_SetObject(PyExc_ValueError, errmsg);
}
@@ -3722,7 +3813,7 @@ operand_different_than_broadcast: {
}
/* Remapped operand shape */
if (op_axes != NULL && op_axes[iiter] != NULL) {
- npy_intp *axes = op_axes[iiter];
+ int *axes = op_axes[iiter];
for (idim = 0; idim < ndim; ++idim) {
npy_intp i = axes[ndim-idim-1];
@@ -3766,7 +3857,7 @@ operand_different_than_broadcast: {
/* Fill in the broadcast shape */
axisdata = NIT_AXISDATA(iter);
for (idim = 0; idim < ndim; ++idim) {
- remdims[idim] = NAD_SHAPE(axisdata);
+ remdims[ndim-idim-1] = NAD_SHAPE(axisdata);
NIT_ADVANCE_AXISDATA(axisdata, 1);
}
@@ -3797,14 +3888,14 @@ operand_different_than_broadcast: {
* array.
*/
static void
-npyiter_replace_axisdata(NpyIter *iter, npy_intp iiter,
+npyiter_replace_axisdata(NpyIter *iter, int iiter,
PyArrayObject *op,
- npy_intp op_ndim, char *op_dataptr,
- npy_intp *op_axes)
+ int op_ndim, char *op_dataptr,
+ int *op_axes)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- npy_intp idim, ndim = NIT_NDIM(iter);
- npy_intp niter = NIT_NITER(iter);
+ int idim, ndim = NIT_NDIM(iter);
+ int niter = NIT_NITER(iter);
NpyIter_AxisData *axisdata0, *axisdata;
npy_intp sizeof_axisdata;
@@ -3824,7 +3915,8 @@ npyiter_replace_axisdata(NpyIter *iter, npy_intp iiter,
if (op_axes != NULL) {
for (idim = 0; idim < ndim; ++idim, NIT_ADVANCE_AXISDATA(axisdata, 1)) {
char p;
- npy_intp i, shape;
+ int i;
+ npy_intp shape;
/* Apply the perm to get the original axis */
p = perm[idim];
@@ -3835,7 +3927,7 @@ npyiter_replace_axisdata(NpyIter *iter, npy_intp iiter,
i = op_axes[ndim-p-1];
}
- if ((npy_uintp)i < (npy_uintp)op_ndim) {
+ if (0 <= i && i < op_ndim) {
shape = PyArray_DIM(op, i);
if (shape != 1) {
npy_intp stride = PyArray_STRIDE(op, i);
@@ -3854,7 +3946,8 @@ npyiter_replace_axisdata(NpyIter *iter, npy_intp iiter,
else {
for (idim = 0; idim < ndim; ++idim, NIT_ADVANCE_AXISDATA(axisdata, 1)) {
char p;
- npy_intp i, shape;
+ int i;
+ npy_intp shape;
/* Apply the perm to get the original axis */
p = perm[idim];
@@ -3904,8 +3997,8 @@ static void
npyiter_compute_index_strides(NpyIter *iter, npy_uint32 flags)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- npy_intp idim, ndim = NIT_NDIM(iter);
- npy_intp niter = NIT_NITER(iter);
+ int idim, ndim = NIT_NDIM(iter);
+ int niter = NIT_NITER(iter);
npy_intp indexstride;
NpyIter_AxisData *axisdata;
@@ -3969,8 +4062,8 @@ static void
npyiter_apply_forced_iteration_order(NpyIter *iter, NPY_ORDER order)
{
/*npy_uint32 itflags = NIT_ITFLAGS(iter);*/
- npy_intp ndim = NIT_NDIM(iter);
- npy_intp iiter, niter = NIT_NITER(iter);
+ int ndim = NIT_NDIM(iter);
+ int iiter, niter = NIT_NITER(iter);
switch (order) {
case NPY_CORDER:
@@ -4020,8 +4113,8 @@ static void
npyiter_flip_negative_strides(NpyIter *iter)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- npy_intp idim, ndim = NIT_NDIM(iter);
- npy_intp iiter, niter = NIT_NITER(iter);
+ int idim, ndim = NIT_NDIM(iter);
+ int iiter, niter = NIT_NITER(iter);
npy_intp istrides, nstrides = NAD_NSTRIDES();
NpyIter_AxisData *axisdata, *axisdata0;
@@ -4099,8 +4192,8 @@ static void
npyiter_reverse_axis_ordering(NpyIter *iter)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- npy_intp ndim = NIT_NDIM(iter);
- npy_intp niter = NIT_NITER(iter);
+ int ndim = NIT_NDIM(iter);
+ int niter = NIT_NITER(iter);
npy_intp i, temp, size;
npy_intp *first, *last;
@@ -4139,8 +4232,8 @@ static void
npyiter_find_best_axis_ordering(NpyIter *iter)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- npy_intp idim, ndim = NIT_NDIM(iter);
- npy_intp iiter, niter = NIT_NITER(iter);
+ int idim, ndim = NIT_NDIM(iter);
+ int iiter, niter = NIT_NITER(iter);
npy_intp ax_i0, ax_i1, ax_ipos;
char ax_j0, ax_j1;
@@ -4279,8 +4372,8 @@ static void
npyiter_coalesce_axes(NpyIter *iter)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- npy_intp idim, ndim = NIT_NDIM(iter);
- npy_intp niter = NIT_NITER(iter);
+ int idim, ndim = NIT_NDIM(iter);
+ int niter = NIT_NITER(iter);
npy_intp istrides, nstrides = NAD_NSTRIDES();
NpyIter_AxisData *axisdata = NIT_AXISDATA(iter);
@@ -4360,12 +4453,12 @@ npyiter_coalesce_axes(NpyIter *iter)
static PyArrayObject *
npyiter_new_temp_array(NpyIter *iter, PyTypeObject *subtype,
npy_uint32 flags, char *op_itflags,
- npy_intp op_ndim, npy_intp *shape,
- PyArray_Descr *op_dtype, npy_intp *op_axes)
+ int op_ndim, npy_intp *shape,
+ PyArray_Descr *op_dtype, int *op_axes)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- npy_intp idim, ndim = NIT_NDIM(iter);
- npy_intp niter = NIT_NITER(iter);
+ int idim, ndim = NIT_NDIM(iter);
+ int niter = NIT_NITER(iter);
char *perm = NIT_PERM(iter);
npy_intp new_shape[NPY_MAXDIMS], strides[NPY_MAXDIMS],
@@ -4418,7 +4511,7 @@ npyiter_new_temp_array(NpyIter *iter, PyTypeObject *subtype,
}
if (i >= 0) {
- NPY_IT_DBG_PRINTF("Iterator: Setting allocated stride %d "
+ NPY_IT_DBG_PRINT3("Iterator: Setting allocated stride %d "
"for iterator dimension %d to %d\n", (int)i,
(int)idim, (int)stride);
strides[i] = stride;
@@ -4463,7 +4556,7 @@ npyiter_new_temp_array(NpyIter *iter, PyTypeObject *subtype,
return NULL;
}
- NPY_IT_DBG_PRINTF("Iterator: Indicating that a reduction "
+ NPY_IT_DBG_PRINT("Iterator: Indicating that a reduction "
"is occurring\n");
/* Indicate that a reduction is occurring */
NIT_ITFLAGS(iter) |= NPY_ITFLAG_REDUCE;
@@ -4487,7 +4580,7 @@ npyiter_new_temp_array(NpyIter *iter, PyTypeObject *subtype,
}
if (i >= 0) {
- NPY_IT_DBG_PRINTF("Iterator: Setting allocated stride %d "
+ NPY_IT_DBG_PRINT3("Iterator: Setting allocated stride %d "
"for iterator dimension %d to %d\n", (int)i,
(int)idim, (int)stride);
strides[i] = stride;
@@ -4633,11 +4726,11 @@ npyiter_allocate_arrays(NpyIter *iter,
npy_uint32 flags,
PyArray_Descr **op_dtype, PyTypeObject *subtype,
npy_uint32 *op_flags, char *op_itflags,
- npy_intp **op_axes, int output_scalars)
+ int **op_axes, int output_scalars)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- npy_intp idim, ndim = NIT_NDIM(iter);
- npy_intp iiter, niter = NIT_NITER(iter);
+ int idim, ndim = NIT_NDIM(iter);
+ int iiter, niter = NIT_NITER(iter);
NpyIter_BufferData *bufferdata = NULL;
PyArrayObject **op = NIT_OPERANDS(iter);
@@ -4652,7 +4745,7 @@ npyiter_allocate_arrays(NpyIter *iter,
if (op[iiter] == NULL) {
PyArrayObject *out;
PyTypeObject *op_subtype;
- npy_intp ondim = output_scalars ? 0 : ndim;
+ int ondim = output_scalars ? 0 : ndim;
/* Check whether the subtype was disabled */
op_subtype = (op_flags[iiter]&NPY_ITER_NO_SUBTYPE) ?
@@ -4729,7 +4822,7 @@ npyiter_allocate_arrays(NpyIter *iter,
else if ((op_itflags[iiter]&NPY_OP_ITFLAG_CAST) &&
(op_flags[iiter]&(NPY_ITER_COPY|NPY_ITER_UPDATEIFCOPY))) {
PyArrayObject *temp;
- npy_intp ondim = PyArray_NDIM(op[iiter]);
+ int ondim = PyArray_NDIM(op[iiter]);
/* Allocate the temporary array, if possible */
temp = npyiter_new_temp_array(iter, &PyArray_Type,
@@ -4799,7 +4892,7 @@ npyiter_allocate_arrays(NpyIter *iter,
npy_intp stride = NAD_STRIDES(axisdata)[iiter];
if (stride != op_dtype[iiter]->elsize) {
- NPY_IT_DBG_PRINTF("Iterator: Setting NPY_OP_ITFLAG_CAST "
+ NPY_IT_DBG_PRINT("Iterator: Setting NPY_OP_ITFLAG_CAST "
"because of NPY_ITER_CONTIG\n");
op_itflags[iiter] |= NPY_OP_ITFLAG_CAST;
if (!(itflags&NPY_ITFLAG_BUFFER)) {
@@ -4878,12 +4971,12 @@ npyiter_allocate_arrays(NpyIter *iter,
* subtype of the input array with highest priority.
*/
static void
-npyiter_get_priority_subtype(npy_intp niter, PyArrayObject **op,
+npyiter_get_priority_subtype(int niter, PyArrayObject **op,
char *op_itflags,
double *subtype_priority,
PyTypeObject **subtype)
{
- npy_intp iiter;
+ int iiter;
for (iiter = 0; iiter < niter; ++iiter) {
if (op[iiter] != NULL && op_itflags[iiter]&NPY_OP_ITFLAG_READ) {
@@ -4902,18 +4995,18 @@ npyiter_get_priority_subtype(npy_intp niter, PyArrayObject **op,
* are not read from out of the calculation.
*/
static PyArray_Descr *
-npyiter_get_common_dtype(npy_intp niter, PyArrayObject **op,
+npyiter_get_common_dtype(int niter, PyArrayObject **op,
char *op_itflags, PyArray_Descr **op_dtype,
PyArray_Descr **op_request_dtypes,
int only_inputs, int output_scalars)
{
- npy_intp iiter;
+ int iiter;
npy_intp narrs = 0, ndtypes = 0;
PyArrayObject *arrs[NPY_MAXARGS];
PyArray_Descr *dtypes[NPY_MAXARGS];
PyArray_Descr *ret;
- NPY_IT_DBG_PRINTF("Iterator: Getting a common data type from operands\n");
+ NPY_IT_DBG_PRINT("Iterator: Getting a common data type from operands\n");
for (iiter = 0; iiter < niter; ++iiter) {
if (op_dtype[iiter] != NULL &&
@@ -4961,8 +5054,8 @@ static int
npyiter_allocate_transfer_functions(NpyIter *iter)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- /*npy_intp ndim = NIT_NDIM(iter);*/
- npy_intp iiter = 0, niter = NIT_NITER(iter);
+ /*int ndim = NIT_NDIM(iter);*/
+ int iiter = 0, niter = NIT_NITER(iter);
npy_intp i;
char *op_itflags = NIT_OPITFLAGS(iter);
@@ -5093,8 +5186,8 @@ static int
npyiter_allocate_buffers(NpyIter *iter, char **errmsg)
{
/*npy_uint32 itflags = NIT_ITFLAGS(iter);*/
- /*npy_intp ndim = NIT_NDIM(iter);*/
- npy_intp iiter = 0, niter = NIT_NITER(iter);
+ /*int ndim = NIT_NDIM(iter);*/
+ int iiter = 0, niter = NIT_NITER(iter);
npy_intp i;
char *op_itflags = NIT_OPITFLAGS(iter);
@@ -5147,8 +5240,8 @@ static void
npyiter_goto_iterindex(NpyIter *iter, npy_intp iterindex)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- npy_intp idim, ndim = NIT_NDIM(iter);
- npy_intp niter = NIT_NITER(iter);
+ int idim, ndim = NIT_NDIM(iter);
+ int niter = NIT_NITER(iter);
char **dataptr;
NpyIter_AxisData *axisdata;
@@ -5230,8 +5323,8 @@ static void
npyiter_copy_from_buffers(NpyIter *iter)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- npy_intp ndim = NIT_NDIM(iter);
- npy_intp iiter, niter = NIT_NITER(iter);
+ int ndim = NIT_NDIM(iter);
+ int iiter, niter = NIT_NITER(iter);
char *op_itflags = NIT_OPITFLAGS(iter);
NpyIter_BufferData *bufferdata = NIT_BUFFERDATA(iter);
@@ -5263,7 +5356,7 @@ npyiter_copy_from_buffers(NpyIter *iter)
return;
}
- NPY_IT_DBG_PRINTF("Iterator: Copying buffers to outputs\n");
+ NPY_IT_DBG_PRINT("Iterator: Copying buffers to outputs\n");
if (itflags&NPY_ITFLAG_REDUCE) {
reduce_outerdim = NBF_REDUCE_OUTERDIM(bufferdata);
@@ -5288,9 +5381,9 @@ npyiter_copy_from_buffers(NpyIter *iter)
npy_intp op_transfersize;
npy_intp src_stride, *dst_strides, *dst_coords, *dst_shape;
- npy_intp ndim_transfer;
+ int ndim_transfer;
- NPY_IT_DBG_PRINTF("Iterator: Operand %d was buffered\n",
+ NPY_IT_DBG_PRINT1("Iterator: Operand %d was buffered\n",
(int)iiter);
/*
@@ -5347,7 +5440,7 @@ npyiter_copy_from_buffers(NpyIter *iter)
ndim_transfer = ndim;
}
- NPY_IT_DBG_PRINTF("Iterator: Copying buffer to "
+ NPY_IT_DBG_PRINT2("Iterator: Copying buffer to "
"operand %d (%d items)\n",
(int)iiter, (int)op_transfersize);
@@ -5369,7 +5462,7 @@ npyiter_copy_from_buffers(NpyIter *iter)
/* Decrement refs only if the pointer was pointing to the buffer */
npy_intp delta = (ptrs[iiter] - buffer);
if (0 <= delta && delta <= transfersize*dtypes[iiter]->elsize) {
- NPY_IT_DBG_PRINTF("Iterator: Freeing refs and zeroing buffer "
+ NPY_IT_DBG_PRINT1("Iterator: Freeing refs and zeroing buffer "
"of operand %d\n", (int)iiter);
/* Decrement refs */
stransfer(NULL, 0, buffer, dtypes[iiter]->elsize,
@@ -5386,7 +5479,7 @@ npyiter_copy_from_buffers(NpyIter *iter)
}
}
- NPY_IT_DBG_PRINTF("Iterator: Finished copying buffers to outputs\n");
+ NPY_IT_DBG_PRINT("Iterator: Finished copying buffers to outputs\n");
}
/*
@@ -5398,8 +5491,8 @@ static void
npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- npy_intp ndim = NIT_NDIM(iter);
- npy_intp iiter, niter = NIT_NITER(iter);
+ int ndim = NIT_NDIM(iter);
+ int iiter, niter = NIT_NITER(iter);
char *op_itflags = NIT_OPITFLAGS(iter);
NpyIter_BufferData *bufferdata = NIT_BUFFERDATA(iter);
@@ -5433,7 +5526,7 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
npy_intp axisdata_incr = NIT_AXISDATA_SIZEOF(itflags, ndim, niter) /
NPY_SIZEOF_INTP;
- NPY_IT_DBG_PRINTF("Iterator: Copying inputs to buffers\n");
+ NPY_IT_DBG_PRINT("Iterator: Copying inputs to buffers\n");
/* Calculate the size if using any buffers */
iterindex = NIT_ITERINDEX(iter);
@@ -5454,7 +5547,7 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
transfersize = NBF_REDUCE_OUTERSIZE(bufferdata)*reduce_innersize;
NBF_BUFITEREND(bufferdata) = iterindex + reduce_innersize;
- NPY_IT_DBG_PRINTF("Reused reduce transfersize: %d innersize: %d "
+ NPY_IT_DBG_PRINT3("Reused reduce transfersize: %d innersize: %d "
"itersize: %d\n",
(int)transfersize,
(int)reduce_innersize,
@@ -5467,11 +5560,11 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
* to combine values itself.
*/
else if (itflags&NPY_ITFLAG_REDUCE) {
- NPY_IT_DBG_PRINTF("Iterator: Calculating reduce loops\n");
+ NPY_IT_DBG_PRINT("Iterator: Calculating reduce loops\n");
transfersize = npyiter_checkreducesize(iter, transfersize,
&reduce_innersize,
&reduce_outerdim);
- NPY_IT_DBG_PRINTF("Reduce transfersize: %d innersize: %d "
+ NPY_IT_DBG_PRINT3("Reduce transfersize: %d innersize: %d "
"itersize: %d\n",
(int)transfersize,
(int)reduce_innersize,
@@ -5587,7 +5680,7 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
strides[iiter] = 0;
/* It's all in one stride in the inner loop dimension */
if (is_onestride) {
- NPY_IT_DBG_PRINTF("reduce op %d all one stride\n", (int)iiter);
+ NPY_IT_DBG_PRINT1("reduce op %d all one stride\n", (int)iiter);
ptrs[iiter] = ad_ptrs[iiter];
reduce_outerstrides[iiter] = 0;
stransfer = NULL;
@@ -5597,7 +5690,7 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
(transfersize/reduce_innersize <=
NAD_SHAPE(reduce_outeraxisdata) -
NAD_COORD(reduce_outeraxisdata))) {
- NPY_IT_DBG_PRINTF("reduce op %d all one outer stride\n",
+ NPY_IT_DBG_PRINT1("reduce op %d all one outer stride\n",
(int)iiter);
ptrs[iiter] = ad_ptrs[iiter];
/* Outer reduce loop advances by one item */
@@ -5607,7 +5700,7 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
}
/* In this case, the buffer is being used */
else {
- NPY_IT_DBG_PRINTF("reduce op %d must buffer\n", (int)iiter);
+ NPY_IT_DBG_PRINT1("reduce op %d must buffer\n", (int)iiter);
ptrs[iiter] = buffers[iiter];
/* Both outer and inner reduce loops have stride 0 */
if (NAD_STRIDES(reduce_outeraxisdata)[iiter] == 0) {
@@ -5621,7 +5714,7 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
}
else if (is_onestride) {
- NPY_IT_DBG_PRINTF("reduce op %d all one stride in dim 0\n", (int)iiter);
+ NPY_IT_DBG_PRINT1("reduce op %d all one stride in dim 0\n", (int)iiter);
ptrs[iiter] = ad_ptrs[iiter];
strides[iiter] = ad_strides[iiter];
reduce_outerstrides[iiter] = 0;
@@ -5673,30 +5766,30 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
else {
ptrs[iiter] = buffers[iiter];
if (ad_strides[iiter] == 0) {
- NPY_IT_DBG_PRINTF("cast op %d has innermost stride 0\n", (int)iiter);
+ NPY_IT_DBG_PRINT1("cast op %d has innermost stride 0\n", (int)iiter);
strides[iiter] = 0;
/* Both outer and inner reduce loops have stride 0 */
if (NAD_STRIDES(reduce_outeraxisdata)[iiter] == 0) {
- NPY_IT_DBG_PRINTF("cast op %d has outermost stride 0\n", (int)iiter);
+ NPY_IT_DBG_PRINT1("cast op %d has outermost stride 0\n", (int)iiter);
reduce_outerstrides[iiter] = 0;
}
/* Outer reduce loop advances by one item */
else {
- NPY_IT_DBG_PRINTF("cast op %d has outermost stride !=0\n", (int)iiter);
+ NPY_IT_DBG_PRINT1("cast op %d has outermost stride !=0\n", (int)iiter);
reduce_outerstrides[iiter] = dtypes[iiter]->elsize;
}
}
else {
- NPY_IT_DBG_PRINTF("cast op %d has innermost stride !=0\n", (int)iiter);
+ NPY_IT_DBG_PRINT1("cast op %d has innermost stride !=0\n", (int)iiter);
strides[iiter] = dtypes[iiter]->elsize;
if (NAD_STRIDES(reduce_outeraxisdata)[iiter] == 0) {
- NPY_IT_DBG_PRINTF("cast op %d has outermost stride 0\n", (int)iiter);
+ NPY_IT_DBG_PRINT1("cast op %d has outermost stride 0\n", (int)iiter);
/* Reduction in outer reduce loop */
reduce_outerstrides[iiter] = 0;
}
else {
- NPY_IT_DBG_PRINTF("cast op %d has outermost stride !=0\n", (int)iiter);
+ NPY_IT_DBG_PRINT1("cast op %d has outermost stride !=0\n", (int)iiter);
/* Advance to next items in outer reduce loop */
reduce_outerstrides[iiter] = reduce_innersize *
dtypes[iiter]->elsize;
@@ -5712,7 +5805,7 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
npy_intp op_transfersize;
npy_intp dst_stride, *src_strides, *src_coords, *src_shape;
- npy_intp ndim_transfer;
+ int ndim_transfer;
npy_bool skip_transfer = 0;
@@ -5743,7 +5836,7 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
*/
if (prev_dataptrs &&
prev_dataptrs[iiter] == ad_ptrs[iiter]) {
- NPY_IT_DBG_PRINTF("Iterator: skipping operand %d"
+ NPY_IT_DBG_PRINT1("Iterator: skipping operand %d"
" copy because it's a 1-element reduce\n",
(int)iiter);
@@ -5793,7 +5886,7 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
* we don't have to copy the data again.
*/
if (reuse_reduce_loops && prev_dataptrs[iiter] == ad_ptrs[iiter]) {
- NPY_IT_DBG_PRINTF("Iterator: skipping operands %d "
+ NPY_IT_DBG_PRINT2("Iterator: skipping operands %d "
"copy (%d items) because loops are reused and the data "
"pointer didn't change\n",
(int)iiter, (int)op_transfersize);
@@ -5802,7 +5895,7 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
/* If the data type requires zero-inititialization */
if (PyDataType_FLAGCHK(dtypes[iiter], NPY_NEEDS_INIT)) {
- NPY_IT_DBG_PRINTF("Iterator: Buffer requires init, "
+ NPY_IT_DBG_PRINT("Iterator: Buffer requires init, "
"memsetting to 0\n");
memset(ptrs[iiter], 0, dtypes[iiter]->elsize*op_transfersize);
/* Can't skip the transfer in this case */
@@ -5810,7 +5903,7 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
}
if (!skip_transfer) {
- NPY_IT_DBG_PRINTF("Iterator: Copying operand %d to "
+ NPY_IT_DBG_PRINT2("Iterator: Copying operand %d to "
"buffer (%d items)\n",
(int)iiter, (int)op_transfersize);
@@ -5827,7 +5920,7 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
else if (ptrs[iiter] == buffers[iiter]) {
/* If the data type requires zero-inititialization */
if (PyDataType_FLAGCHK(dtypes[iiter], NPY_NEEDS_INIT)) {
- NPY_IT_DBG_PRINTF("Iterator: Write-only buffer for "
+ NPY_IT_DBG_PRINT1("Iterator: Write-only buffer for "
"operand %d requires init, "
"memsetting to 0\n", (int)iiter);
memset(ptrs[iiter], 0, dtypes[iiter]->elsize*transfersize);
@@ -5845,7 +5938,7 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
if (!any_buffered && (itflags&NPY_ITFLAG_GROWINNER) &&
!(itflags&NPY_ITFLAG_REDUCE)) {
if (singlestridesize > transfersize) {
- NPY_IT_DBG_PRINTF("Iterator: Expanding inner loop size "
+ NPY_IT_DBG_PRINT2("Iterator: Expanding inner loop size "
"from %d to %d since buffering wasn't needed\n",
(int)NBF_SIZE(bufferdata), (int)singlestridesize);
NBF_SIZE(bufferdata) = singlestridesize;
@@ -5853,9 +5946,9 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs)
}
}
- NPY_IT_DBG_PRINTF("Any buffering needed: %d\n", any_buffered);
+ NPY_IT_DBG_PRINT1("Any buffering needed: %d\n", any_buffered);
- NPY_IT_DBG_PRINTF("Iterator: Finished copying inputs to buffers "
+ NPY_IT_DBG_PRINT1("Iterator: Finished copying inputs to buffers "
"(buffered size is %d)\n", (int)NBF_SIZE(bufferdata));
}
@@ -5882,8 +5975,8 @@ npyiter_checkreducesize(NpyIter *iter, npy_intp count,
npy_intp *reduce_outerdim)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- npy_intp idim, ndim = NIT_NDIM(iter);
- npy_intp iiter, niter = NIT_NITER(iter);
+ int idim, ndim = NIT_NDIM(iter);
+ int iiter, niter = NIT_NITER(iter);
NpyIter_AxisData *axisdata;
npy_intp sizeof_axisdata;
@@ -5934,7 +6027,7 @@ npyiter_checkreducesize(NpyIter *iter, npy_intp count,
(!stride0op[iiter] &&
(strides[iiter] == 0) &&
(op_itflags[iiter]&NPY_OP_ITFLAG_REDUCE))) {
- NPY_IT_DBG_PRINTF("Iterator: Reduce operation limits "
+ NPY_IT_DBG_PRINT1("Iterator: Reduce operation limits "
"buffer to %d\n", (int)reducespace);
/*
* If we already found more elements than count, or
@@ -6025,7 +6118,7 @@ npyiter_checkreducesize(NpyIter *iter, npy_intp count,
(!stride0op[iiter] &&
(strides[iiter] == 0) &&
(op_itflags[iiter]&NPY_OP_ITFLAG_REDUCE))) {
- NPY_IT_DBG_PRINTF("Iterator: Reduce operation limits "
+ NPY_IT_DBG_PRINT1("Iterator: Reduce operation limits "
"buffer to %d\n", (int)reducespace);
/*
* This terminates the outer level of our double loop.
@@ -6063,8 +6156,8 @@ NPY_NO_EXPORT void
NpyIter_DebugPrint(NpyIter *iter)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
- npy_intp idim, ndim = NIT_NDIM(iter);
- npy_intp iiter, niter = NIT_NITER(iter);
+ int idim, ndim = NIT_NDIM(iter);
+ int iiter, niter = NIT_NITER(iter);
NpyIter_AxisData *axisdata;
npy_intp sizeof_axisdata;
@@ -6084,8 +6177,8 @@ NpyIter_DebugPrint(NpyIter *iter)
printf("HASCOORDS ");
if (itflags&NPY_ITFLAG_FORCEDORDER)
printf("FORCEDORDER ");
- if (itflags&NPY_ITFLAG_NOINNER)
- printf("NOINNER ");
+ if (itflags&NPY_ITFLAG_EXLOOP)
+ printf("EXLOOP ");
if (itflags&NPY_ITFLAG_RANGE)
printf("RANGE ");
if (itflags&NPY_ITFLAG_BUFFER)
@@ -6209,7 +6302,7 @@ NpyIter_DebugPrint(NpyIter *iter)
printf("%d ", (int)NBF_STRIDES(bufferdata)[iiter]);
printf("\n");
/* Print the fixed strides when there's no inner loop */
- if (itflags&NPY_ITFLAG_NOINNER) {
+ if (itflags&NPY_ITFLAG_EXLOOP) {
npy_intp fixedstrides[NPY_MAXDIMS];
printf("| Fixed Strides: ");
NpyIter_GetInnerFixedStrideArray(iter, fixedstrides);
diff --git a/numpy/core/src/multiarray/new_iterator_pywrap.c b/numpy/core/src/multiarray/nditer_pywrap.c
index eff0263eb..d604d7889 100644
--- a/numpy/core/src/multiarray/new_iterator_pywrap.c
+++ b/numpy/core/src/multiarray/nditer_pywrap.c
@@ -29,8 +29,8 @@ struct NewNpyArrayIterObject_tag {
/* Child to update for nested iteration */
NewNpyArrayIterObject *nested_child;
/* Cached values from the iterator */
- NpyIter_IterNext_Fn iternext;
- NpyIter_GetCoords_Fn getcoords;
+ NpyIter_IterNextFunc *iternext;
+ NpyIter_GetCoordsFunc *getcoords;
char **dataptrs;
PyArray_Descr **dtypes;
PyArrayObject **operands;
@@ -57,14 +57,14 @@ void npyiter_cache_values(NewNpyArrayIterObject *self)
self->dtypes = NpyIter_GetDescrArray(iter);
self->operands = NpyIter_GetOperandArray(iter);
- if (NpyIter_HasInnerLoop(iter)) {
- self->innerstrides = NULL;
- self->innerloopsizeptr = NULL;
- }
- else {
+ if (NpyIter_HasExternalLoop(iter)) {
self->innerstrides = NpyIter_GetInnerStrideArray(iter);
self->innerloopsizeptr = NpyIter_GetInnerLoopSizePtr(iter);
}
+ else {
+ self->innerstrides = NULL;
+ self->innerloopsizeptr = NULL;
+ }
/* The read/write settings */
NpyIter_GetReadFlags(iter, self->readflags);
@@ -163,6 +163,11 @@ NpyIter_GlobalFlagsConverter(PyObject *flags_in, npy_uint32 *flags)
flag = NPY_ITER_DELAY_BUFALLOC;
}
break;
+ case 'e':
+ if (strcmp(str, "external_loop") == 0) {
+ flag = NPY_ITER_EXTERNAL_LOOP;
+ }
+ break;
case 'f':
if (strcmp(str, "f_index") == 0) {
flag = NPY_ITER_F_INDEX;
@@ -173,11 +178,6 @@ NpyIter_GlobalFlagsConverter(PyObject *flags_in, npy_uint32 *flags)
flag = NPY_ITER_GROWINNER;
}
break;
- case 'n':
- if (strcmp(str, "no_inner_iteration") == 0) {
- flag = NPY_ITER_NO_INNER_ITERATION;
- }
- break;
case 'r':
if (strcmp(str, "ranged") == 0) {
flag = NPY_ITER_RANGED;
@@ -547,10 +547,10 @@ try_single_dtype:
static int
npyiter_convert_op_axes(PyObject *op_axes_in, npy_intp niter,
- npy_intp **op_axes, npy_intp *oa_ndim)
+ int **op_axes, int *oa_ndim)
{
PyObject *a;
- npy_intp iiter;
+ int iiter;
if ((!PyTuple_Check(op_axes_in) && !PyList_Check(op_axes_in)) ||
PySequence_Size(op_axes_in) != niter) {
@@ -563,7 +563,7 @@ npyiter_convert_op_axes(PyObject *op_axes_in, npy_intp niter,
/* Copy the tuples into op_axes */
for (iiter = 0; iiter < niter; ++iiter) {
- npy_intp idim;
+ int idim;
a = PySequence_GetItem(op_axes_in, iiter);
if (a == NULL) {
return 0;
@@ -633,16 +633,16 @@ npyiter_convert_op_axes(PyObject *op_axes_in, npy_intp niter,
}
/*
- * Converts the operand array and op_flags array into the form NpyIter_MultiNew
+ * Converts the operand array and op_flags array into the form NpyIter_AdvancedNew
* needs. Sets niter, and on success, each op[i] owns a reference
* to an array object.
*/
static int
npyiter_convert_ops(PyObject *op_in, PyObject *op_flags_in,
PyArrayObject **op, npy_uint32 *op_flags,
- npy_intp *niter_out)
+ int *niter_out)
{
- npy_intp iiter, niter;
+ int iiter, niter;
/* niter and op */
if (PyTuple_Check(op_in) || PyList_Check(op_in)) {
@@ -704,6 +704,7 @@ npyiter_convert_ops(PyObject *op_in, PyObject *op_flags_in,
for (iiter = 0; iiter < niter; ++iiter) {
Py_XDECREF(op[iiter]);
}
+ *niter_out = 0;
return 0;
}
@@ -729,6 +730,7 @@ npyiter_convert_ops(PyObject *op_in, PyObject *op_flags_in,
for (iiter = 0; iiter < niter; ++iiter) {
Py_DECREF(op[iiter]);
}
+ *niter_out = 0;
return 0;
}
Py_DECREF(op[iiter]);
@@ -743,22 +745,24 @@ static int
npyiter_init(NewNpyArrayIterObject *self, PyObject *args, PyObject *kwds)
{
static char *kwlist[] = {"op", "flags", "op_flags", "op_dtypes",
- "order", "casting", "op_axes", "buffersize",
+ "order", "casting", "op_axes", "itershape",
+ "buffersize",
NULL};
PyObject *op_in = NULL, *op_flags_in = NULL,
*op_dtypes_in = NULL, *op_axes_in = NULL;
- npy_intp iiter, niter = 0;
+ int iiter, niter = 0;
PyArrayObject *op[NPY_MAXARGS];
npy_uint32 flags = 0;
NPY_ORDER order = NPY_KEEPORDER;
NPY_CASTING casting = NPY_SAFE_CASTING;
npy_uint32 op_flags[NPY_MAXARGS];
PyArray_Descr *op_request_dtypes[NPY_MAXARGS];
- npy_intp oa_ndim = 0;
- npy_intp op_axes_arrays[NPY_MAXARGS][NPY_MAXDIMS];
- npy_intp *op_axes[NPY_MAXARGS];
+ int oa_ndim = 0;
+ int op_axes_arrays[NPY_MAXARGS][NPY_MAXDIMS];
+ int *op_axes[NPY_MAXARGS];
+ PyArray_Dims itershape = {NULL, 0};
int buffersize = 0;
if (self->iter != NULL) {
@@ -767,7 +771,7 @@ npyiter_init(NewNpyArrayIterObject *self, PyObject *args, PyObject *kwds)
return -1;
}
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O&OOO&O&Oi", kwlist,
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O&OOO&O&OO&i", kwlist,
&op_in,
NpyIter_GlobalFlagsConverter, &flags,
&op_flags_in,
@@ -775,19 +779,23 @@ npyiter_init(NewNpyArrayIterObject *self, PyObject *args, PyObject *kwds)
npyiter_order_converter, &order,
PyArray_CastingConverter, &casting,
&op_axes_in,
+ PyArray_IntpConverter, &itershape,
&buffersize)) {
+ if (itershape.ptr != NULL) {
+ PyDimMem_FREE(itershape.ptr);
+ }
return -1;
}
+ /* Set the dtypes and ops to all NULL to start */
+ memset(op_request_dtypes, 0, sizeof(op_request_dtypes));
+
/* op and op_flags */
if (npyiter_convert_ops(op_in, op_flags_in, op, op_flags, &niter)
!= 1) {
- return -1;
+ goto fail;
}
- /* Set the dtypes to all NULL to start as well */
- memset(op_request_dtypes, 0, sizeof(op_request_dtypes[0])*niter);
-
/* op_request_dtypes */
if (op_dtypes_in != NULL && op_dtypes_in != Py_None &&
npyiter_convert_dtypes(op_dtypes_in,
@@ -808,9 +816,27 @@ npyiter_init(NewNpyArrayIterObject *self, PyObject *args, PyObject *kwds)
}
}
- self->iter = NpyIter_MultiNew(niter, op, flags, order, casting, op_flags,
+ if (itershape.len > 0) {
+ if (oa_ndim == 0) {
+ oa_ndim = itershape.len;
+ memset(op_axes, 0, sizeof(op_axes[0])*oa_ndim);
+ }
+ else if (oa_ndim != itershape.len) {
+ PyErr_SetString(PyExc_ValueError,
+ "'op_axes' and 'itershape' must have the same number "
+ "of entries equal to the iterator ndim");
+ goto fail;
+ }
+ }
+ else if (itershape.ptr != NULL) {
+ PyDimMem_FREE(itershape.ptr);
+ itershape.ptr = NULL;
+ }
+
+ self->iter = NpyIter_AdvancedNew(niter, op, flags, order, casting, op_flags,
op_request_dtypes,
oa_ndim, oa_ndim > 0 ? op_axes : NULL,
+ itershape.ptr,
buffersize);
if (self->iter == NULL) {
@@ -829,6 +855,10 @@ npyiter_init(NewNpyArrayIterObject *self, PyObject *args, PyObject *kwds)
self->finished = 0;
}
+ if (itershape.ptr != NULL) {
+ PyDimMem_FREE(itershape.ptr);
+ }
+
/* Release the references we got to the ops and dtypes */
for (iiter = 0; iiter < niter; ++iiter) {
Py_XDECREF(op[iiter]);
@@ -838,6 +868,9 @@ npyiter_init(NewNpyArrayIterObject *self, PyObject *args, PyObject *kwds)
return 0;
fail:
+ if (itershape.ptr != NULL) {
+ PyDimMem_FREE(itershape.ptr);
+ }
for (iiter = 0; iiter < niter; ++iiter) {
Py_XDECREF(op[iiter]);
Py_XDECREF(op_request_dtypes[iiter]);
@@ -857,7 +890,7 @@ NpyIter_NestedIters(PyObject *NPY_UNUSED(self),
PyObject *op_in = NULL, *axes_in = NULL,
*op_flags_in = NULL, *op_dtypes_in = NULL;
- npy_intp iiter, niter = 0, inest, nnest = 0;
+ int iiter, niter = 0, inest, nnest = 0;
PyArrayObject *op[NPY_MAXARGS];
npy_uint32 flags = 0, flags_inner = 0;
NPY_ORDER order = NPY_KEEPORDER;
@@ -865,10 +898,10 @@ NpyIter_NestedIters(PyObject *NPY_UNUSED(self),
npy_uint32 op_flags[NPY_MAXARGS], op_flags_inner[NPY_MAXARGS];
PyArray_Descr *op_request_dtypes[NPY_MAXARGS],
*op_request_dtypes_inner[NPY_MAXARGS];
- npy_intp op_axes_data[NPY_MAXDIMS];
- npy_intp *nested_op_axes[NPY_MAXDIMS];
- npy_intp nested_naxes[NPY_MAXDIMS], iaxes, naxes;
- npy_intp negones[NPY_MAXDIMS];
+ int op_axes_data[NPY_MAXDIMS];
+ int *nested_op_axes[NPY_MAXDIMS];
+ int nested_naxes[NPY_MAXDIMS], iaxes, naxes;
+ int negones[NPY_MAXDIMS];
char used_axes[NPY_MAXDIMS];
int buffersize = 0;
@@ -1014,12 +1047,12 @@ NpyIter_NestedIters(PyObject *NPY_UNUSED(self),
/* Only the inner loop gets the buffering and no inner flags */
flags_inner = flags&~NPY_ITER_COMMON_DTYPE;
- flags &= ~(NPY_ITER_NO_INNER_ITERATION|
+ flags &= ~(NPY_ITER_EXTERNAL_LOOP|
NPY_ITER_BUFFERED);
for (inest = 0; inest < nnest; ++inest) {
NewNpyArrayIterObject *iter;
- npy_intp *op_axes_niter[NPY_MAXARGS];
+ int *op_axes_niter[NPY_MAXARGS];
/*
* All the operands' op_axes are the same, except for
@@ -1059,16 +1092,18 @@ NpyIter_NestedIters(PyObject *NPY_UNUSED(self),
}
if (inest < nnest-1) {
- iter->iter = NpyIter_MultiNew(niter, op, flags, order,
+ iter->iter = NpyIter_AdvancedNew(niter, op, flags, order,
casting, op_flags, op_request_dtypes,
nested_naxes[inest], op_axes_niter,
+ NULL,
0);
}
else {
- iter->iter = NpyIter_MultiNew(niter, op, flags_inner, order,
+ iter->iter = NpyIter_AdvancedNew(niter, op, flags_inner, order,
casting, op_flags_inner,
op_request_dtypes_inner,
nested_naxes[inest], op_axes_niter,
+ NULL,
buffersize);
}
@@ -1337,7 +1372,7 @@ npyiter_remove_coords(NewNpyArrayIterObject *self)
}
static PyObject *
-npyiter_remove_inner_loop(NewNpyArrayIterObject *self)
+npyiter_enable_external_loop(NewNpyArrayIterObject *self)
{
if (self->iter == NULL) {
PyErr_SetString(PyExc_ValueError,
@@ -1345,10 +1380,10 @@ npyiter_remove_inner_loop(NewNpyArrayIterObject *self)
return NULL;
}
- NpyIter_RemoveInnerLoop(self->iter);
- /* RemoveInnerLoop invalidates cached values */
+ NpyIter_EnableExternalLoop(self->iter);
+ /* EnableExternalLoop invalidates cached values */
npyiter_cache_values(self);
- /* RemoveInnerLoop also resets the iterator */
+ /* EnableExternalLoop also resets the iterator */
if (NpyIter_GetIterSize(self->iter) == 0) {
self->started = 1;
self->finished = 1;
@@ -2002,17 +2037,17 @@ npyiter_seq_item(NewNpyArrayIterObject *self, Py_ssize_t i)
dataptr = self->dataptrs[i];
dtype = self->dtypes[i];
- if (NpyIter_HasInnerLoop(self->iter)) {
+ if (NpyIter_HasExternalLoop(self->iter)) {
+ innerloopsize = *self->innerloopsizeptr;
+ innerstride = self->innerstrides[i];
+ ret_ndim = 1;
+ }
+ else {
innerloopsize = 1;
innerstride = 0;
/* If the iterator is going over every element, return array scalars */
ret_ndim = 0;
}
- else {
- innerloopsize = *self->innerloopsizeptr;
- innerstride = self->innerstrides[i];
- ret_ndim = 1;
- }
Py_INCREF(dtype);
ret = (PyObject *)PyArray_NewFromDescr(&PyArray_Type, dtype,
@@ -2121,14 +2156,14 @@ npyiter_seq_ass_item(NewNpyArrayIterObject *self, Py_ssize_t i, PyObject *v)
dataptr = self->dataptrs[i];
dtype = self->dtypes[i];
- if (NpyIter_HasInnerLoop(self->iter)) {
- innerloopsize = 1;
- innerstride = 0;
- }
- else {
+ if (NpyIter_HasExternalLoop(self->iter)) {
innerloopsize = *self->innerloopsizeptr;
innerstride = self->innerstrides[i];
}
+ else {
+ innerloopsize = 1;
+ innerstride = 0;
+ }
/* TODO - there should be a better way than this... */
Py_INCREF(dtype);
@@ -2302,7 +2337,7 @@ static PyMethodDef npyiter_methods[] = {
{"iternext", (PyCFunction)npyiter_iternext, METH_NOARGS, NULL},
{"remove_axis", (PyCFunction)npyiter_remove_axis, METH_VARARGS, NULL},
{"remove_coords", (PyCFunction)npyiter_remove_coords, METH_NOARGS, NULL},
- {"remove_inner_loop", (PyCFunction)npyiter_remove_inner_loop,
+ {"enable_external_loop", (PyCFunction)npyiter_enable_external_loop,
METH_NOARGS, NULL},
{"debug_print", (PyCFunction)npyiter_debug_print, METH_NOARGS, NULL},
{NULL, NULL, 0, NULL},
@@ -2415,7 +2450,7 @@ NPY_NO_EXPORT PyTypeObject NpyIter_Type = {
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
#endif
- "numpy.newiter", /* tp_name */
+ "numpy.nditer", /* tp_name */
sizeof(NewNpyArrayIterObject), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
diff --git a/numpy/core/src/multiarray/new_iterator_pywrap.h b/numpy/core/src/multiarray/nditer_pywrap.h
index 35e322541..35e322541 100644
--- a/numpy/core/src/multiarray/new_iterator_pywrap.h
+++ b/numpy/core/src/multiarray/nditer_pywrap.h
diff --git a/numpy/core/src/umath/loops.c.src b/numpy/core/src/umath/loops.c.src
index 79d9da077..5212207da 100644
--- a/numpy/core/src/umath/loops.c.src
+++ b/numpy/core/src/umath/loops.c.src
@@ -760,10 +760,19 @@ NPY_NO_EXPORT void
NPY_NO_EXPORT void
@S@@TYPE@_@kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func))
{
- BINARY_LOOP {
- const @s@@type@ in1 = *(@s@@type@ *)ip1;
- const @s@@type@ in2 = *(@s@@type@ *)ip2;
- *((@s@@type@ *)op1) = (in1 @OP@ in2) ? in1 : in2;
+ if (IS_BINARY_REDUCE) {
+ BINARY_REDUCE_LOOP(@s@@type@) {
+ const @s@@type@ in2 = *(@type@ *)ip2;
+ io1 = (io1 @OP@ in2) ? io1 : in2;
+ }
+ *((@s@@type@ *)iop1) = io1;
+ }
+ else {
+ BINARY_LOOP {
+ const @s@@type@ in1 = *(@s@@type@ *)ip1;
+ const @s@@type@ in2 = *(@s@@type@ *)ip2;
+ *((@s@@type@ *)op1) = (in1 @OP@ in2) ? in1 : in2;
+ }
}
}
/**end repeat2**/
@@ -998,11 +1007,20 @@ NPY_NO_EXPORT void
NPY_NO_EXPORT void
@TYPE@_@kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func))
{
+ if (IS_BINARY_REDUCE) {
+ BINARY_REDUCE_LOOP(@type@) {
+ const @type@ in2 = *(@type@ *)ip2;
+ io1 = (io1 @OP@ in2) ? io1 : in2;
+ }
+ *((@type@ *)iop1) = io1;
+ }
+ else {
BINARY_LOOP {
const @type@ in1 = *(@type@ *)ip1;
const @type@ in2 = *(@type@ *)ip2;
*((@type@ *)op1) = (in1 @OP@ in2) ? in1 : in2;
}
+ }
}
/**end repeat1**/
@@ -1216,10 +1234,19 @@ NPY_NO_EXPORT void
@TYPE@_@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 || npy_isnan(in1)) ? in1 : in2;
+ if (IS_BINARY_REDUCE) {
+ BINARY_REDUCE_LOOP(@type@) {
+ const @type@ in2 = *(@type@ *)ip2;
+ io1 = (io1 @OP@ in2 || npy_isnan(io1)) ? io1 : in2;
+ }
+ *((@type@ *)iop1) = io1;
+ }
+ else {
+ BINARY_LOOP {
+ const @type@ in1 = *(@type@ *)ip1;
+ const @type@ in2 = *(@type@ *)ip2;
+ *((@type@ *)op1) = (in1 @OP@ in2 || npy_isnan(in1)) ? in1 : in2;
+ }
}
}
/**end repeat1**/
@@ -1232,10 +1259,19 @@ NPY_NO_EXPORT void
@TYPE@_@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 || npy_isnan(in2)) ? in1 : in2;
+ if (IS_BINARY_REDUCE) {
+ BINARY_REDUCE_LOOP(@type@) {
+ const @type@ in2 = *(@type@ *)ip2;
+ io1 = (io1 @OP@ in2 || npy_isnan(in2)) ? io1 : in2;
+ }
+ *((@type@ *)iop1) = io1;
+ }
+ else {
+ BINARY_LOOP {
+ const @type@ in1 = *(@type@ *)ip1;
+ const @type@ in2 = *(@type@ *)ip2;
+ *((@type@ *)op1) = (in1 @OP@ in2 || npy_isnan(in2)) ? in1 : in2;
+ }
}
}
/**end repeat1**/
diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c
index e2e999b5b..e619da81d 100644
--- a/numpy/core/src/umath/ufunc_object.c
+++ b/numpy/core/src/umath/ufunc_object.c
@@ -45,9 +45,15 @@
#define NPY_UF_DBG_TRACING 0
#if NPY_UF_DBG_TRACING
-#define NPY_UF_DBG_PRINTF(...) printf(__VA_ARGS__)
+#define NPY_UF_DBG_PRINT(s) printf("%s", s)
+#define NPY_UF_DBG_PRINT1(s, p1) printf(s, p1)
+#define NPY_UF_DBG_PRINT2(s, p1, p2) printf(s, p1, p2)
+#define NPY_UF_DBG_PRINT3(s, p1, p2, p3) printf(s, p1, p2, p3)
#else
-#define NPY_UF_DBG_PRINTF(...)
+#define NPY_UF_DBG_PRINT(s)
+#define NPY_UF_DBG_PRINT1(s, p1)
+#define NPY_UF_DBG_PRINT2(s, p1, p2)
+#define NPY_UF_DBG_PRINT3(s, p1, p2, p3)
#endif
/**********************************************/
@@ -1003,7 +1009,7 @@ ufunc_loop_matches(PyUFuncObject *self,
}
Py_DECREF(tmp);
}
- NPY_UF_DBG_PRINTF("The inputs all worked\n");
+ NPY_UF_DBG_PRINT("The inputs all worked\n");
/*
* If all the inputs were ok, then check casting back to the
@@ -1028,7 +1034,7 @@ ufunc_loop_matches(PyUFuncObject *self,
Py_DECREF(tmp);
}
}
- NPY_UF_DBG_PRINTF("The outputs all worked\n");
+ NPY_UF_DBG_PRINT("The outputs all worked\n");
return 1;
}
@@ -1145,7 +1151,7 @@ find_ufunc_matching_userloop(PyUFuncObject *self,
*out_innerloop = funcdata->func;
*out_innerloopdata = funcdata->data;
- NPY_UF_DBG_PRINTF("Returning userdef inner "
+ NPY_UF_DBG_PRINT("Returning userdef inner "
"loop successfully\n");
return 0;
@@ -1238,7 +1244,7 @@ find_ufunc_specified_userloop(PyUFuncObject *self,
*out_innerloop = funcdata->func;
*out_innerloopdata = funcdata->data;
- NPY_UF_DBG_PRINTF("Returning userdef inner "
+ NPY_UF_DBG_PRINT("Returning userdef inner "
"loop successfully\n");
return 0;
@@ -1348,7 +1354,7 @@ find_best_ufunc_inner_loop(PyUFuncObject *self,
types[j] = orig_types[j];
}
- NPY_UF_DBG_PRINTF("Trying function loop %d\n", (int)i);
+ NPY_UF_DBG_PRINT1("Trying function loop %d\n", (int)i);
switch (ufunc_loop_matches(self, op,
input_casting, output_casting,
any_object, all_inputs_scalar,
@@ -1367,7 +1373,7 @@ find_best_ufunc_inner_loop(PyUFuncObject *self,
*out_innerloop = self->functions[i];
*out_innerloopdata = self->data[i];
- NPY_UF_DBG_PRINTF("Returning inner loop successfully\n");
+ NPY_UF_DBG_PRINT("Returning inner loop successfully\n");
return 0;
}
@@ -1375,7 +1381,7 @@ find_best_ufunc_inner_loop(PyUFuncObject *self,
}
/* If no function was found, throw an error */
- NPY_UF_DBG_PRINTF("No loop was found\n");
+ NPY_UF_DBG_PRINT("No loop was found\n");
if (no_castable_output) {
PyErr_Format(PyExc_TypeError,
"ufunc '%s' output (typecode '%c') could not be coerced to "
@@ -1501,7 +1507,7 @@ find_specified_ufunc_inner_loop(PyUFuncObject *self,
Py_XDECREF(str_obj);
return -1;
}
- NPY_UF_DBG_PRINTF("signature character '%c', type num %d\n",
+ NPY_UF_DBG_PRINT2("signature character '%c', type num %d\n",
str[0], dtype->type_num);
specified_types[0] = dtype->type_num;
Py_DECREF(dtype);
@@ -1518,7 +1524,7 @@ find_specified_ufunc_inner_loop(PyUFuncObject *self,
Py_XDECREF(str_obj);
return -1;
}
- NPY_UF_DBG_PRINTF("signature character '%c', type num %d\n",
+ NPY_UF_DBG_PRINT2("signature character '%c', type num %d\n",
str[istr], dtype->type_num);
specified_types[i] = dtype->type_num;
Py_DECREF(dtype);
@@ -1529,7 +1535,7 @@ find_specified_ufunc_inner_loop(PyUFuncObject *self,
/* If the ufunc has userloops, search for them. */
if (self->userloops) {
- NPY_UF_DBG_PRINTF("Searching user loops for specified sig\n");
+ NPY_UF_DBG_PRINT("Searching user loops for specified sig\n");
switch (find_ufunc_specified_userloop(self,
n_specified, specified_types,
op, casting,
@@ -1545,12 +1551,12 @@ find_specified_ufunc_inner_loop(PyUFuncObject *self,
}
}
- NPY_UF_DBG_PRINTF("Searching loops for specified sig\n");
+ NPY_UF_DBG_PRINT("Searching loops for specified sig\n");
for (i = 0; i < self->ntypes; ++i) {
char *orig_types = self->types + i*self->nargs;
int matched = 1;
- NPY_UF_DBG_PRINTF("Trying function loop %d\n", (int)i);
+ NPY_UF_DBG_PRINT1("Trying function loop %d\n", (int)i);
/* Copy the types into an int array for matching */
for (j = 0; j < niter; ++j) {
@@ -1565,7 +1571,7 @@ find_specified_ufunc_inner_loop(PyUFuncObject *self,
}
}
} else {
- NPY_UF_DBG_PRINTF("Specified type: %d, first output type: %d\n",
+ NPY_UF_DBG_PRINT2("Specified type: %d, first output type: %d\n",
specified_types[0], types[nin]);
if (types[nin] != specified_types[0]) {
matched = 0;
@@ -1575,7 +1581,7 @@ find_specified_ufunc_inner_loop(PyUFuncObject *self,
continue;
}
- NPY_UF_DBG_PRINTF("It matches, confirming type casting\n");
+ NPY_UF_DBG_PRINT("It matches, confirming type casting\n");
switch (ufunc_loop_matches(self, op,
casting, casting,
any_object, all_inputs_scalar,
@@ -1594,7 +1600,7 @@ find_specified_ufunc_inner_loop(PyUFuncObject *self,
*out_innerloop = self->functions[i];
*out_innerloopdata = self->data[i];
- NPY_UF_DBG_PRINTF("Returning specified inner loop successfully\n");
+ NPY_UF_DBG_PRINT("Returning specified inner loop successfully\n");
return 0;
/* Didn't work */
@@ -1611,7 +1617,7 @@ find_specified_ufunc_inner_loop(PyUFuncObject *self,
}
/* If no function was found, throw an error */
- NPY_UF_DBG_PRINTF("No specified loop was found\n");
+ NPY_UF_DBG_PRINT("No specified loop was found\n");
PyErr_Format(PyExc_TypeError,
"No loop matching the specified signature was found "
@@ -1638,7 +1644,7 @@ trivial_two_operand_loop(PyArrayObject **op,
data[0], data[1],
stride[0], stride[1]);
count[1] = count[0];
- NPY_UF_DBG_PRINTF("two operand loop count %d\n", (int)count[0]);
+ NPY_UF_DBG_PRINT1("two operand loop count %d\n", (int)count[0]);
if (!needs_api) {
NPY_BEGIN_THREADS;
@@ -1671,7 +1677,7 @@ trivial_three_operand_loop(PyArrayObject **op,
stride[0], stride[1], stride[2]);
count[1] = count[0];
count[2] = count[0];
- NPY_UF_DBG_PRINTF("three operand loop count %d\n", (int)count[0]);
+ NPY_UF_DBG_PRINT1("three operand loop count %d\n", (int)count[0]);
if (!needs_api) {
NPY_BEGIN_THREADS;
@@ -1762,15 +1768,16 @@ iterator_loop(PyUFuncObject *self,
NpyIter *iter;
char *baseptrs[NPY_MAXARGS];
int needs_api;
- NPY_BEGIN_THREADS_DEF;
- NpyIter_IterNext_Fn iternext;
+ NpyIter_IterNextFunc *iternext;
char **dataptr;
npy_intp *stride;
npy_intp *count_ptr;
PyArrayObject **op_it;
+ NPY_BEGIN_THREADS_DEF;
+
/* Set up the flags */
for (i = 0; i < nin; ++i) {
op_flags[i] = NPY_ITER_READONLY|
@@ -1789,8 +1796,8 @@ iterator_loop(PyUFuncObject *self,
* were already checked, we use the casting rule 'unsafe' which
* is faster to calculate.
*/
- iter = NpyIter_MultiNew(niter, op,
- NPY_ITER_NO_INNER_ITERATION|
+ iter = NpyIter_AdvancedNew(niter, op,
+ NPY_ITER_EXTERNAL_LOOP|
NPY_ITER_REFS_OK|
NPY_ITER_ZEROSIZE_OK|
NPY_ITER_BUFFERED|
@@ -1798,7 +1805,7 @@ iterator_loop(PyUFuncObject *self,
NPY_ITER_DELAY_BUFALLOC,
order, NPY_UNSAFE_CASTING,
op_flags, dtype,
- 0, NULL, buffersize);
+ 0, NULL, NULL, buffersize);
if (iter == NULL) {
return -1;
}
@@ -1854,7 +1861,7 @@ iterator_loop(PyUFuncObject *self,
/* Execute the loop */
do {
- NPY_UF_DBG_PRINTF("iterator loop count %d\n", (int)*count_ptr);
+ NPY_UF_DBG_PRINT1("iterator loop count %d\n", (int)*count_ptr);
innerloop(dataptr, count_ptr, stride, innerloopdata);
} while (iternext(iter));
@@ -1913,7 +1920,7 @@ execute_ufunc_loop(PyUFuncObject *self,
return -1;
}
- NPY_UF_DBG_PRINTF("trivial 1 input with allocated output\n");
+ NPY_UF_DBG_PRINT("trivial 1 input with allocated output\n");
trivial_two_operand_loop(op, innerloop, innerloopdata);
return 0;
@@ -1928,7 +1935,7 @@ execute_ufunc_loop(PyUFuncObject *self,
return -1;
}
- NPY_UF_DBG_PRINTF("trivial 1 input\n");
+ NPY_UF_DBG_PRINT("trivial 1 input\n");
trivial_two_operand_loop(op, innerloop, innerloopdata);
return 0;
@@ -1964,7 +1971,7 @@ execute_ufunc_loop(PyUFuncObject *self,
return -1;
}
- NPY_UF_DBG_PRINTF("trivial 2 input with allocated output\n");
+ NPY_UF_DBG_PRINT("trivial 2 input with allocated output\n");
trivial_three_operand_loop(op, innerloop, innerloopdata);
return 0;
@@ -1980,7 +1987,7 @@ execute_ufunc_loop(PyUFuncObject *self,
return -1;
}
- NPY_UF_DBG_PRINTF("trivial 2 input\n");
+ NPY_UF_DBG_PRINT("trivial 2 input\n");
trivial_three_operand_loop(op, innerloop, innerloopdata);
return 0;
@@ -1993,7 +2000,7 @@ execute_ufunc_loop(PyUFuncObject *self,
* resolve broadcasting, etc
*/
- NPY_UF_DBG_PRINTF("iterator loop\n");
+ NPY_UF_DBG_PRINT("iterator loop\n");
if (iterator_loop(self, op, dtype, order,
buffersize, arr_prep, arr_prep_args,
innerloop, innerloopdata) < 0) {
@@ -2046,8 +2053,8 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *self,
PyObject *args, PyObject *kwds,
PyArrayObject **op)
{
- npy_intp nin, nout;
- npy_intp i, idim, niter;
+ int nin, nout;
+ int i, idim, niter;
char *ufunc_name;
int retval = -1, any_object = 0;
NPY_CASTING input_casting;
@@ -2055,9 +2062,9 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *self,
PyArray_Descr *dtype[NPY_MAXARGS];
/* Use remapped axes for generalized ufunc */
- npy_intp broadcast_ndim, op_ndim;
- npy_intp op_axes_arrays[NPY_MAXARGS][NPY_MAXDIMS];
- npy_intp *op_axes[NPY_MAXARGS];
+ int broadcast_ndim, op_ndim;
+ int op_axes_arrays[NPY_MAXARGS][NPY_MAXDIMS];
+ int *op_axes[NPY_MAXARGS];
npy_uint32 op_flags[NPY_MAXARGS];
@@ -2111,7 +2118,7 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *self,
ufunc_name = self->name ? self->name : "<unnamed ufunc>";
- NPY_UF_DBG_PRINTF("\nEvaluating ufunc %s\n", ufunc_name);
+ NPY_UF_DBG_PRINT1("\nEvaluating ufunc %s\n", ufunc_name);
/* Initialize all the operands and dtypes to NULL */
for (i = 0; i < niter; ++i) {
@@ -2120,7 +2127,7 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *self,
arr_prep[i] = NULL;
}
- NPY_UF_DBG_PRINTF("Getting arguments\n");
+ NPY_UF_DBG_PRINT("Getting arguments\n");
/* Get all the arguments */
retval = get_ufunc_arguments(self, args, kwds,
@@ -2132,7 +2139,7 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *self,
/* Figure out the number of dimensions needed by the iterator */
broadcast_ndim = 0;
for (i = 0; i < nin; ++i) {
- npy_intp n = PyArray_NDIM(op[i]) - self->core_num_dims[i];
+ int n = PyArray_NDIM(op[i]) - self->core_num_dims[i];
if (n > broadcast_ndim) {
broadcast_ndim = n;
}
@@ -2150,7 +2157,7 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *self,
core_dim_ixs_size = 0;
core_dim_ixs = self->core_dim_ixs;
for (i = 0; i < niter; ++i) {
- npy_intp n;
+ int n;
if (op[i]) {
/*
* Note that n may be negative if broadcasting
@@ -2204,7 +2211,7 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *self,
}
}
- NPY_UF_DBG_PRINTF("Finding inner loop\n");
+ NPY_UF_DBG_PRINT("Finding inner loop\n");
/*
* Decide the casting rules for inputs and outputs. We want
@@ -2298,11 +2305,11 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *self,
}
/* Create the iterator */
- iter = NpyIter_MultiNew(niter, op, NPY_ITER_COORDS|
+ iter = NpyIter_AdvancedNew(niter, op, NPY_ITER_COORDS|
NPY_ITER_REFS_OK|
NPY_ITER_REDUCE_OK,
order, NPY_UNSAFE_CASTING, op_flags,
- dtype, op_ndim, op_axes, 0);
+ dtype, op_ndim, op_axes, NULL, 0);
if (iter == NULL) {
retval = -1;
goto fail;
@@ -2362,7 +2369,7 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *self,
retval = -1;
goto fail;
}
- if (NpyIter_RemoveInnerLoop(iter) != NPY_SUCCEED) {
+ if (NpyIter_EnableExternalLoop(iter) != NPY_SUCCEED) {
retval = -1;
goto fail;
}
@@ -2385,11 +2392,11 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *self,
/* Start with the floating-point exception flags cleared */
PyUFunc_clearfperr();
- NPY_UF_DBG_PRINTF("Executing inner loop\n");
+ NPY_UF_DBG_PRINT("Executing inner loop\n");
/* Do the ufunc loop */
if (NpyIter_GetIterSize(iter) != 0) {
- NpyIter_IterNext_Fn iternext;
+ NpyIter_IterNextFunc *iternext;
char **dataptr;
npy_intp *count_ptr;
@@ -2427,12 +2434,12 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *self,
Py_XDECREF(type_tup);
Py_XDECREF(arr_prep_args);
- NPY_UF_DBG_PRINTF("Returning Success\n");
+ NPY_UF_DBG_PRINT("Returning Success\n");
return 0;
fail:
- NPY_UF_DBG_PRINTF("Returning failure code %d\n", retval);
+ NPY_UF_DBG_PRINT1("Returning failure code %d\n", retval);
if (inner_strides) {
_pya_free(inner_strides);
}
@@ -2462,8 +2469,8 @@ PyUFunc_GenericFunction(PyUFuncObject *self,
PyObject *args, PyObject *kwds,
PyArrayObject **op)
{
- npy_intp nin, nout;
- npy_intp i, niter;
+ int nin, nout;
+ int i, niter;
char *ufunc_name;
int retval = -1, any_object = 0;
NPY_CASTING input_casting;
@@ -2516,7 +2523,7 @@ PyUFunc_GenericFunction(PyUFuncObject *self,
ufunc_name = self->name ? self->name : "<unnamed ufunc>";
- NPY_UF_DBG_PRINTF("\nEvaluating ufunc %s\n", ufunc_name);
+ NPY_UF_DBG_PRINT1("\nEvaluating ufunc %s\n", ufunc_name);
/* Initialize all the operands and dtypes to NULL */
for (i = 0; i < niter; ++i) {
@@ -2525,7 +2532,7 @@ PyUFunc_GenericFunction(PyUFuncObject *self,
arr_prep[i] = NULL;
}
- NPY_UF_DBG_PRINTF("Getting arguments\n");
+ NPY_UF_DBG_PRINT("Getting arguments\n");
/* Get all the arguments */
retval = get_ufunc_arguments(self, args, kwds,
@@ -2550,7 +2557,7 @@ PyUFunc_GenericFunction(PyUFuncObject *self,
}
}
- NPY_UF_DBG_PRINTF("Finding inner loop\n");
+ NPY_UF_DBG_PRINT("Finding inner loop\n");
/*
* Decide the casting rules for inputs and outputs. We want
@@ -2629,7 +2636,7 @@ PyUFunc_GenericFunction(PyUFuncObject *self,
/* Start with the floating-point exception flags cleared */
PyUFunc_clearfperr();
- NPY_UF_DBG_PRINTF("Executing inner loop\n");
+ NPY_UF_DBG_PRINT("Executing inner loop\n");
/* Do the ufunc loop */
retval = execute_ufunc_loop(self, trivial_loop_ok, op, dtype, order,
@@ -2655,12 +2662,12 @@ PyUFunc_GenericFunction(PyUFuncObject *self,
Py_XDECREF(type_tup);
Py_XDECREF(arr_prep_args);
- NPY_UF_DBG_PRINTF("Returning Success\n");
+ NPY_UF_DBG_PRINT("Returning Success\n");
return 0;
fail:
- NPY_UF_DBG_PRINTF("Returning failure code %d\n", retval);
+ NPY_UF_DBG_PRINT1("Returning failure code %d\n", retval);
for (i = 0; i < niter; ++i) {
Py_XDECREF(op[i]);
op[i] = NULL;
@@ -2689,7 +2696,7 @@ get_binary_op_function(PyUFuncObject *self, int *otype,
int i;
PyUFunc_Loop1d *funcdata;
- NPY_UF_DBG_PRINTF("Getting binary op function for type number %d\n",
+ NPY_UF_DBG_PRINT1("Getting binary op function for type number %d\n",
*otype);
/* If the type is custom and there are userloops, search for it here */
@@ -2722,7 +2729,7 @@ get_binary_op_function(PyUFuncObject *self, int *otype,
for (i = 0; i < self->ntypes; ++i) {
char *types = self->types + i*self->nargs;
- NPY_UF_DBG_PRINTF("Trying loop with signature %d %d -> %d\n",
+ NPY_UF_DBG_PRINT3("Trying loop with signature %d %d -> %d\n",
types[0], types[1], types[2]);
if (PyArray_CanCastSafely(*otype, types[0]) &&
@@ -2787,12 +2794,11 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
{
PyArrayObject *op[2];
PyArray_Descr *op_dtypes[2] = {NULL, NULL};
- npy_intp op_axes_arrays[2][NPY_MAXDIMS];
- npy_intp *op_axes[2] = {op_axes_arrays[0], op_axes_arrays[1]};
+ int op_axes_arrays[2][NPY_MAXDIMS];
+ int *op_axes[2] = {op_axes_arrays[0], op_axes_arrays[1]};
npy_uint32 op_flags[2];
int i, idim, ndim, otype_final;
int needs_api, need_outer_iterator;
- NPY_BEGIN_THREADS_DEF;
NpyIter *iter = NULL, *iter_inner = NULL;
@@ -2806,7 +2812,9 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
int buffersize = 0, errormask = 0;
PyObject *errobj = NULL;
- NPY_UF_DBG_PRINTF("\nEvaluating ufunc %s.%s\n", ufunc_name, opname);
+ NPY_BEGIN_THREADS_DEF;
+
+ NPY_UF_DBG_PRINT2("\nEvaluating ufunc %s.%s\n", ufunc_name, opname);
#if 0
printf("Doing %s.%s on array with dtype : ", ufunc_name, opname);
@@ -2891,7 +2899,7 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
}
if (need_outer_iterator) {
- npy_intp ndim_iter = 0;
+ int ndim_iter = 0;
npy_uint32 flags = NPY_ITER_ZEROSIZE_OK|
NPY_ITER_REFS_OK;
PyArray_Descr **op_dtypes_param = NULL;
@@ -2915,12 +2923,12 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
op_dtypes_param = op_dtypes;
op_dtypes[1] = op_dtypes[0];
}
- NPY_UF_DBG_PRINTF("Allocating outer iterator\n");
- iter = NpyIter_MultiNew(2, op, flags,
+ NPY_UF_DBG_PRINT("Allocating outer iterator\n");
+ iter = NpyIter_AdvancedNew(2, op, flags,
NPY_KEEPORDER, NPY_UNSAFE_CASTING,
op_flags,
op_dtypes_param,
- ndim_iter, op_axes, 0);
+ ndim_iter, op_axes, NULL, 0);
if (iter == NULL) {
goto fail;
}
@@ -3017,7 +3025,7 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
/* Also set the dtype for buffering arr */
op_dtypes[1] = op_dtypes[0];
- NPY_UF_DBG_PRINTF("Allocating inner iterator\n");
+ NPY_UF_DBG_PRINT("Allocating inner iterator\n");
if (operation == UFUNC_REDUCE) {
/* The per-operand flags for the inner loop */
op_flags[0] = NPY_ITER_READWRITE|
@@ -3028,7 +3036,7 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
op_axes[0][0] = -1;
op_axes[1][0] = axis;
- iter_inner = NpyIter_MultiNew(2, op, NPY_ITER_NO_INNER_ITERATION|
+ iter_inner = NpyIter_AdvancedNew(2, op, NPY_ITER_EXTERNAL_LOOP|
NPY_ITER_BUFFERED|
NPY_ITER_DELAY_BUFALLOC|
NPY_ITER_GROWINNER|
@@ -3036,7 +3044,7 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
NPY_ITER_REFS_OK,
NPY_CORDER, NPY_UNSAFE_CASTING,
op_flags, op_dtypes,
- 1, op_axes, buffersize);
+ 1, op_axes, NULL, buffersize);
}
/* Should never get an inner iterator for ACCUMULATE */
else {
@@ -3053,7 +3061,7 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
char *dataptr_copy[3];
npy_intp stride_copy[3];
- NpyIter_IterNext_Fn iternext;
+ NpyIter_IterNextFunc *iternext;
char **dataptr;
npy_intp *stride;
npy_intp *count_ptr;
@@ -3073,12 +3081,12 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
/* Execute the loop with two nested iterators */
if (iter_inner) {
/* Only UFUNC_REDUCE uses iter_inner */
- NpyIter_IterNext_Fn iternext_inner;
+ NpyIter_IterNextFunc *iternext_inner;
char **dataptr_inner;
npy_intp *stride_inner;
npy_intp count, *count_ptr_inner;
- NPY_UF_DBG_PRINTF("UFunc: Reduce loop with two nested iterators\n");
+ NPY_UF_DBG_PRINT("UFunc: Reduce loop with two nested iterators\n");
iternext_inner = NpyIter_GetIterNext(iter_inner, NULL);
if (iternext_inner == NULL) {
goto fail;
@@ -3128,7 +3136,7 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
first = 0;
}
stride_copy[1] = stride_inner[1];
- NPY_UF_DBG_PRINTF("iterator loop count %d\n", (int)count);
+ NPY_UF_DBG_PRINT1("iterator loop count %d\n", (int)count);
innerloop(dataptr_copy, &count,
stride_copy, innerloopdata);
} while(iternext_inner(iter_inner));
@@ -3143,7 +3151,7 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
npy_intp count_m1 = PyArray_DIM(op[1], axis)-1;
npy_intp stride0 = 0, stride1 = PyArray_STRIDE(op[1], axis);
- NPY_UF_DBG_PRINTF("UFunc: Reduce loop with just outer iterator\n");
+ NPY_UF_DBG_PRINT("UFunc: Reduce loop with just outer iterator\n");
if (operation == UFUNC_ACCUMULATE) {
stride0 = PyArray_STRIDE(op[0], axis);
@@ -3185,7 +3193,7 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
dataptr_copy[1] += stride1;
dataptr_copy[2] += stride0;
}
- NPY_UF_DBG_PRINTF("iterator loop count %d\n",
+ NPY_UF_DBG_PRINT1("iterator loop count %d\n",
(int)count_m1);
innerloop(dataptr_copy, &count_m1,
stride_copy, innerloopdata);
@@ -3206,13 +3214,13 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
/* Execute the loop with just the inner iterator */
if (iter_inner) {
/* Only UFUNC_REDUCE uses iter_inner */
- NpyIter_IterNext_Fn iternext_inner;
+ NpyIter_IterNextFunc *iternext_inner;
char **dataptr_inner;
npy_intp *stride_inner;
npy_intp count, *count_ptr_inner;
int first = 1;
- NPY_UF_DBG_PRINTF("UFunc: Reduce loop with just inner iterator\n");
+ NPY_UF_DBG_PRINT("UFunc: Reduce loop with just inner iterator\n");
iternext_inner = NpyIter_GetIterNext(iter_inner, NULL);
if (iternext_inner == NULL) {
@@ -3258,7 +3266,7 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
first = 0;
}
stride_copy[1] = stride_inner[1];
- NPY_UF_DBG_PRINTF("iterator loop count %d\n", (int)count);
+ NPY_UF_DBG_PRINT1("iterator loop count %d\n", (int)count);
innerloop(dataptr_copy, &count,
stride_copy, innerloopdata);
} while(iternext_inner(iter_inner));
@@ -3272,7 +3280,7 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
npy_intp count = PyArray_DIM(op[1], axis);
npy_intp stride0 = 0, stride1 = PyArray_STRIDE(op[1], axis);
- NPY_UF_DBG_PRINTF("UFunc: Reduce loop with no iterators\n");
+ NPY_UF_DBG_PRINT("UFunc: Reduce loop with no iterators\n");
if (operation == UFUNC_REDUCE) {
if (PyArray_NDIM(op[0]) != 0) {
@@ -3325,7 +3333,7 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
dataptr_copy[2] += stride0;
}
- NPY_UF_DBG_PRINTF("iterator loop count %d\n", (int)count);
+ NPY_UF_DBG_PRINT1("iterator loop count %d\n", (int)count);
needs_api = PyDataType_REFCHK(op_dtypes[0]);
@@ -3418,13 +3426,12 @@ PyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind,
{
PyArrayObject *op[3];
PyArray_Descr *op_dtypes[3] = {NULL, NULL, NULL};
- npy_intp op_axes_arrays[3][NPY_MAXDIMS];
- npy_intp *op_axes[3] = {op_axes_arrays[0], op_axes_arrays[1],
+ int op_axes_arrays[3][NPY_MAXDIMS];
+ int *op_axes[3] = {op_axes_arrays[0], op_axes_arrays[1],
op_axes_arrays[2]};
npy_uint32 op_flags[3];
int i, idim, ndim, otype_final;
int needs_api, need_outer_iterator;
- NPY_BEGIN_THREADS_DEF;
NpyIter *iter = NULL;
@@ -3442,6 +3449,8 @@ PyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind,
int buffersize = 0, errormask = 0;
PyObject *errobj = NULL;
+ NPY_BEGIN_THREADS_DEF;
+
reduceat_ind = (npy_intp *)PyArray_DATA(ind);
ind_size = PyArray_DIM(ind, 0);
red_axis_size = PyArray_DIM(arr, axis);
@@ -3456,7 +3465,7 @@ PyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind,
}
}
- NPY_UF_DBG_PRINTF("\nEvaluating ufunc %s.%s\n", ufunc_name, opname);
+ NPY_UF_DBG_PRINT2("\nEvaluating ufunc %s.%s\n", ufunc_name, opname);
#if 0
printf("Doing %s.%s on array with dtype : ", ufunc_name, opname);
@@ -3547,12 +3556,12 @@ PyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind,
op_dtypes[1] = op_dtypes[0];
- NPY_UF_DBG_PRINTF("Allocating outer iterator\n");
- iter = NpyIter_MultiNew(3, op, flags,
+ NPY_UF_DBG_PRINT("Allocating outer iterator\n");
+ iter = NpyIter_AdvancedNew(3, op, flags,
NPY_KEEPORDER, NPY_UNSAFE_CASTING,
op_flags,
op_dtypes,
- ndim, op_axes, 0);
+ ndim, op_axes, NULL, 0);
if (iter == NULL) {
goto fail;
}
@@ -3597,8 +3606,10 @@ PyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind,
char *dataptr_copy[3];
npy_intp stride_copy[3];
- NpyIter_IterNext_Fn iternext;
+ NpyIter_IterNextFunc *iternext;
char **dataptr;
+ npy_intp count_m1;
+ npy_intp stride0, stride1;
npy_intp *stride;
npy_intp *count_ptr;
npy_intp stride0_ind = PyArray_STRIDE(op[0], axis);
@@ -3616,10 +3627,11 @@ PyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind,
/* Execute the loop with just the outer iterator */
- npy_intp count_m1 = PyArray_DIM(op[1], axis)-1;
- npy_intp stride0 = 0, stride1 = PyArray_STRIDE(op[1], axis);
+ count_m1 = PyArray_DIM(op[1], axis)-1;
+ stride0 = 0;
+ stride1 = PyArray_STRIDE(op[1], axis);
- NPY_UF_DBG_PRINTF("UFunc: Reduce loop with just outer iterator\n");
+ NPY_UF_DBG_PRINT("UFunc: Reduce loop with just outer iterator\n");
stride_copy[0] = stride0;
stride_copy[1] = stride1;
@@ -3658,7 +3670,7 @@ PyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind,
/* Inner loop like REDUCE */
--count;
dataptr_copy[1] += stride1;
- NPY_UF_DBG_PRINTF("iterator loop count %d\n",
+ NPY_UF_DBG_PRINT1("iterator loop count %d\n",
(int)count);
innerloop(dataptr_copy, &count,
stride_copy, innerloopdata);
@@ -3683,7 +3695,7 @@ PyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind,
needs_api = PyDataType_REFCHK(op_dtypes[0]);
- NPY_UF_DBG_PRINTF("UFunc: Reduce loop with no iterators\n");
+ NPY_UF_DBG_PRINT("UFunc: Reduce loop with no iterators\n");
stride_copy[0] = stride0;
stride_copy[1] = stride1;
@@ -3718,7 +3730,7 @@ PyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind,
/* Inner loop like REDUCE */
--count;
dataptr_copy[1] += stride1;
- NPY_UF_DBG_PRINTF("iterator loop count %d\n",
+ NPY_UF_DBG_PRINT1("iterator loop count %d\n",
(int)count);
innerloop(dataptr_copy, &count,
stride_copy, innerloopdata);
diff --git a/numpy/core/tests/test_new_iterator.py b/numpy/core/tests/test_iterator.py
index d796b3cf2..4b4aaecd9 100644
--- a/numpy/core/tests/test_new_iterator.py
+++ b/numpy/core/tests/test_iterator.py
@@ -1,5 +1,5 @@
import numpy as np
-from numpy import array, arange, newiter, all
+from numpy import array, arange, nditer, all
from numpy.compat import asbytes
from numpy.testing import *
import sys, warnings
@@ -35,7 +35,7 @@ def test_iter_refcount():
dt = np.dtype('f4').newbyteorder()
rc_a = sys.getrefcount(a)
rc_dt = sys.getrefcount(dt)
- it = newiter(a, [],
+ it = nditer(a, [],
[['readwrite','updateifcopy']],
casting='unsafe',
op_dtypes=[dt])
@@ -51,7 +51,7 @@ def test_iter_refcount():
dt = np.dtype('f4')
rc_a = sys.getrefcount(a)
rc_dt = sys.getrefcount(dt)
- it = newiter(a, [],
+ it = nditer(a, [],
[['readwrite']],
op_dtypes=[dt])
rc2_a = sys.getrefcount(a)
@@ -83,14 +83,14 @@ def test_iter_best_order():
aview = a.reshape(shape)[dirs_index]
# C-order
- i = newiter(aview, [], [['readonly']])
+ i = nditer(aview, [], [['readonly']])
assert_equal([x for x in i], a)
# Fortran-order
- i = newiter(aview.T, [], [['readonly']])
+ i = nditer(aview.T, [], [['readonly']])
assert_equal([x for x in i], a)
# Other order
if len(shape) > 2:
- i = newiter(aview.swapaxes(0,1), [], [['readonly']])
+ i = nditer(aview.swapaxes(0,1), [], [['readonly']])
assert_equal([x for x in i], a)
def test_iter_c_order():
@@ -109,14 +109,14 @@ def test_iter_c_order():
aview = a.reshape(shape)[dirs_index]
# C-order
- i = newiter(aview, order='C')
+ i = nditer(aview, order='C')
assert_equal([x for x in i], aview.ravel(order='C'))
# Fortran-order
- i = newiter(aview.T, order='C')
+ i = nditer(aview.T, order='C')
assert_equal([x for x in i], aview.T.ravel(order='C'))
# Other order
if len(shape) > 2:
- i = newiter(aview.swapaxes(0,1), order='C')
+ i = nditer(aview.swapaxes(0,1), order='C')
assert_equal([x for x in i],
aview.swapaxes(0,1).ravel(order='C'))
@@ -136,14 +136,14 @@ def test_iter_f_order():
aview = a.reshape(shape)[dirs_index]
# C-order
- i = newiter(aview, order='F')
+ i = nditer(aview, order='F')
assert_equal([x for x in i], aview.ravel(order='F'))
# Fortran-order
- i = newiter(aview.T, order='F')
+ i = nditer(aview.T, order='F')
assert_equal([x for x in i], aview.T.ravel(order='F'))
# Other order
if len(shape) > 2:
- i = newiter(aview.swapaxes(0,1), order='F')
+ i = nditer(aview.swapaxes(0,1), order='F')
assert_equal([x for x in i],
aview.swapaxes(0,1).ravel(order='F'))
@@ -163,14 +163,14 @@ def test_iter_c_or_f_order():
aview = a.reshape(shape)[dirs_index]
# C-order
- i = newiter(aview, order='A')
+ i = nditer(aview, order='A')
assert_equal([x for x in i], aview.ravel(order='A'))
# Fortran-order
- i = newiter(aview.T, order='A')
+ i = nditer(aview.T, order='A')
assert_equal([x for x in i], aview.T.ravel(order='A'))
# Other order
if len(shape) > 2:
- i = newiter(aview.swapaxes(0,1), order='A')
+ i = nditer(aview.swapaxes(0,1), order='A')
assert_equal([x for x in i],
aview.swapaxes(0,1).ravel(order='A'))
@@ -179,10 +179,10 @@ def test_iter_best_order_coords_1d():
a = arange(4)
# 1D order
- i = newiter(a,['coords'],[['readonly']])
+ i = nditer(a,['coords'],[['readonly']])
assert_equal(iter_coords(i), [(0,),(1,),(2,),(3,)])
# 1D reversed order
- i = newiter(a[::-1],['coords'],[['readonly']])
+ i = nditer(a[::-1],['coords'],[['readonly']])
assert_equal(iter_coords(i), [(3,),(2,),(1,),(0,)])
def test_iter_best_order_coords_2d():
@@ -190,25 +190,25 @@ def test_iter_best_order_coords_2d():
a = arange(6)
# 2D C-order
- i = newiter(a.reshape(2,3),['coords'],[['readonly']])
+ i = nditer(a.reshape(2,3),['coords'],[['readonly']])
assert_equal(iter_coords(i), [(0,0),(0,1),(0,2),(1,0),(1,1),(1,2)])
# 2D Fortran-order
- i = newiter(a.reshape(2,3).copy(order='F'),['coords'],[['readonly']])
+ i = nditer(a.reshape(2,3).copy(order='F'),['coords'],[['readonly']])
assert_equal(iter_coords(i), [(0,0),(1,0),(0,1),(1,1),(0,2),(1,2)])
# 2D reversed C-order
- i = newiter(a.reshape(2,3)[::-1],['coords'],[['readonly']])
+ i = nditer(a.reshape(2,3)[::-1],['coords'],[['readonly']])
assert_equal(iter_coords(i), [(1,0),(1,1),(1,2),(0,0),(0,1),(0,2)])
- i = newiter(a.reshape(2,3)[:,::-1],['coords'],[['readonly']])
+ i = nditer(a.reshape(2,3)[:,::-1],['coords'],[['readonly']])
assert_equal(iter_coords(i), [(0,2),(0,1),(0,0),(1,2),(1,1),(1,0)])
- i = newiter(a.reshape(2,3)[::-1,::-1],['coords'],[['readonly']])
+ i = nditer(a.reshape(2,3)[::-1,::-1],['coords'],[['readonly']])
assert_equal(iter_coords(i), [(1,2),(1,1),(1,0),(0,2),(0,1),(0,0)])
# 2D reversed Fortran-order
- i = newiter(a.reshape(2,3).copy(order='F')[::-1],['coords'],[['readonly']])
+ i = nditer(a.reshape(2,3).copy(order='F')[::-1],['coords'],[['readonly']])
assert_equal(iter_coords(i), [(1,0),(0,0),(1,1),(0,1),(1,2),(0,2)])
- i = newiter(a.reshape(2,3).copy(order='F')[:,::-1],
+ i = nditer(a.reshape(2,3).copy(order='F')[:,::-1],
['coords'],[['readonly']])
assert_equal(iter_coords(i), [(0,2),(1,2),(0,1),(1,1),(0,0),(1,0)])
- i = newiter(a.reshape(2,3).copy(order='F')[::-1,::-1],
+ i = nditer(a.reshape(2,3).copy(order='F')[::-1,::-1],
['coords'],[['readonly']])
assert_equal(iter_coords(i), [(1,2),(0,2),(1,1),(0,1),(1,0),(0,0)])
@@ -217,40 +217,40 @@ def test_iter_best_order_coords_3d():
a = arange(12)
# 3D C-order
- i = newiter(a.reshape(2,3,2),['coords'],[['readonly']])
+ i = nditer(a.reshape(2,3,2),['coords'],[['readonly']])
assert_equal(iter_coords(i),
[(0,0,0),(0,0,1),(0,1,0),(0,1,1),(0,2,0),(0,2,1),
(1,0,0),(1,0,1),(1,1,0),(1,1,1),(1,2,0),(1,2,1)])
# 3D Fortran-order
- i = newiter(a.reshape(2,3,2).copy(order='F'),['coords'],[['readonly']])
+ i = nditer(a.reshape(2,3,2).copy(order='F'),['coords'],[['readonly']])
assert_equal(iter_coords(i),
[(0,0,0),(1,0,0),(0,1,0),(1,1,0),(0,2,0),(1,2,0),
(0,0,1),(1,0,1),(0,1,1),(1,1,1),(0,2,1),(1,2,1)])
# 3D reversed C-order
- i = newiter(a.reshape(2,3,2)[::-1],['coords'],[['readonly']])
+ i = nditer(a.reshape(2,3,2)[::-1],['coords'],[['readonly']])
assert_equal(iter_coords(i),
[(1,0,0),(1,0,1),(1,1,0),(1,1,1),(1,2,0),(1,2,1),
(0,0,0),(0,0,1),(0,1,0),(0,1,1),(0,2,0),(0,2,1)])
- i = newiter(a.reshape(2,3,2)[:,::-1],['coords'],[['readonly']])
+ i = nditer(a.reshape(2,3,2)[:,::-1],['coords'],[['readonly']])
assert_equal(iter_coords(i),
[(0,2,0),(0,2,1),(0,1,0),(0,1,1),(0,0,0),(0,0,1),
(1,2,0),(1,2,1),(1,1,0),(1,1,1),(1,0,0),(1,0,1)])
- i = newiter(a.reshape(2,3,2)[:,:,::-1],['coords'],[['readonly']])
+ i = nditer(a.reshape(2,3,2)[:,:,::-1],['coords'],[['readonly']])
assert_equal(iter_coords(i),
[(0,0,1),(0,0,0),(0,1,1),(0,1,0),(0,2,1),(0,2,0),
(1,0,1),(1,0,0),(1,1,1),(1,1,0),(1,2,1),(1,2,0)])
# 3D reversed Fortran-order
- i = newiter(a.reshape(2,3,2).copy(order='F')[::-1],
+ i = nditer(a.reshape(2,3,2).copy(order='F')[::-1],
['coords'],[['readonly']])
assert_equal(iter_coords(i),
[(1,0,0),(0,0,0),(1,1,0),(0,1,0),(1,2,0),(0,2,0),
(1,0,1),(0,0,1),(1,1,1),(0,1,1),(1,2,1),(0,2,1)])
- i = newiter(a.reshape(2,3,2).copy(order='F')[:,::-1],
+ i = nditer(a.reshape(2,3,2).copy(order='F')[:,::-1],
['coords'],[['readonly']])
assert_equal(iter_coords(i),
[(0,2,0),(1,2,0),(0,1,0),(1,1,0),(0,0,0),(1,0,0),
(0,2,1),(1,2,1),(0,1,1),(1,1,1),(0,0,1),(1,0,1)])
- i = newiter(a.reshape(2,3,2).copy(order='F')[:,:,::-1],
+ i = nditer(a.reshape(2,3,2).copy(order='F')[:,:,::-1],
['coords'],[['readonly']])
assert_equal(iter_coords(i),
[(0,0,1),(1,0,1),(0,1,1),(1,1,1),(0,2,1),(1,2,1),
@@ -261,10 +261,10 @@ def test_iter_best_order_c_index_1d():
a = arange(4)
# 1D order
- i = newiter(a,['c_index'],[['readonly']])
+ i = nditer(a,['c_index'],[['readonly']])
assert_equal(iter_indices(i), [0,1,2,3])
# 1D reversed order
- i = newiter(a[::-1],['c_index'],[['readonly']])
+ i = nditer(a[::-1],['c_index'],[['readonly']])
assert_equal(iter_indices(i), [3,2,1,0])
def test_iter_best_order_c_index_2d():
@@ -272,27 +272,27 @@ def test_iter_best_order_c_index_2d():
a = arange(6)
# 2D C-order
- i = newiter(a.reshape(2,3),['c_index'],[['readonly']])
+ i = nditer(a.reshape(2,3),['c_index'],[['readonly']])
assert_equal(iter_indices(i), [0,1,2,3,4,5])
# 2D Fortran-order
- i = newiter(a.reshape(2,3).copy(order='F'),
+ i = nditer(a.reshape(2,3).copy(order='F'),
['c_index'],[['readonly']])
assert_equal(iter_indices(i), [0,3,1,4,2,5])
# 2D reversed C-order
- i = newiter(a.reshape(2,3)[::-1],['c_index'],[['readonly']])
+ i = nditer(a.reshape(2,3)[::-1],['c_index'],[['readonly']])
assert_equal(iter_indices(i), [3,4,5,0,1,2])
- i = newiter(a.reshape(2,3)[:,::-1],['c_index'],[['readonly']])
+ i = nditer(a.reshape(2,3)[:,::-1],['c_index'],[['readonly']])
assert_equal(iter_indices(i), [2,1,0,5,4,3])
- i = newiter(a.reshape(2,3)[::-1,::-1],['c_index'],[['readonly']])
+ i = nditer(a.reshape(2,3)[::-1,::-1],['c_index'],[['readonly']])
assert_equal(iter_indices(i), [5,4,3,2,1,0])
# 2D reversed Fortran-order
- i = newiter(a.reshape(2,3).copy(order='F')[::-1],
+ i = nditer(a.reshape(2,3).copy(order='F')[::-1],
['c_index'],[['readonly']])
assert_equal(iter_indices(i), [3,0,4,1,5,2])
- i = newiter(a.reshape(2,3).copy(order='F')[:,::-1],
+ i = nditer(a.reshape(2,3).copy(order='F')[:,::-1],
['c_index'],[['readonly']])
assert_equal(iter_indices(i), [2,5,1,4,0,3])
- i = newiter(a.reshape(2,3).copy(order='F')[::-1,::-1],
+ i = nditer(a.reshape(2,3).copy(order='F')[::-1,::-1],
['c_index'],[['readonly']])
assert_equal(iter_indices(i), [5,2,4,1,3,0])
@@ -301,34 +301,34 @@ def test_iter_best_order_c_index_3d():
a = arange(12)
# 3D C-order
- i = newiter(a.reshape(2,3,2),['c_index'],[['readonly']])
+ i = nditer(a.reshape(2,3,2),['c_index'],[['readonly']])
assert_equal(iter_indices(i),
[0,1,2,3,4,5,6,7,8,9,10,11])
# 3D Fortran-order
- i = newiter(a.reshape(2,3,2).copy(order='F'),
+ i = nditer(a.reshape(2,3,2).copy(order='F'),
['c_index'],[['readonly']])
assert_equal(iter_indices(i),
[0,6,2,8,4,10,1,7,3,9,5,11])
# 3D reversed C-order
- i = newiter(a.reshape(2,3,2)[::-1],['c_index'],[['readonly']])
+ i = nditer(a.reshape(2,3,2)[::-1],['c_index'],[['readonly']])
assert_equal(iter_indices(i),
[6,7,8,9,10,11,0,1,2,3,4,5])
- i = newiter(a.reshape(2,3,2)[:,::-1],['c_index'],[['readonly']])
+ i = nditer(a.reshape(2,3,2)[:,::-1],['c_index'],[['readonly']])
assert_equal(iter_indices(i),
[4,5,2,3,0,1,10,11,8,9,6,7])
- i = newiter(a.reshape(2,3,2)[:,:,::-1],['c_index'],[['readonly']])
+ i = nditer(a.reshape(2,3,2)[:,:,::-1],['c_index'],[['readonly']])
assert_equal(iter_indices(i),
[1,0,3,2,5,4,7,6,9,8,11,10])
# 3D reversed Fortran-order
- i = newiter(a.reshape(2,3,2).copy(order='F')[::-1],
+ i = nditer(a.reshape(2,3,2).copy(order='F')[::-1],
['c_index'],[['readonly']])
assert_equal(iter_indices(i),
[6,0,8,2,10,4,7,1,9,3,11,5])
- i = newiter(a.reshape(2,3,2).copy(order='F')[:,::-1],
+ i = nditer(a.reshape(2,3,2).copy(order='F')[:,::-1],
['c_index'],[['readonly']])
assert_equal(iter_indices(i),
[4,10,2,8,0,6,5,11,3,9,1,7])
- i = newiter(a.reshape(2,3,2).copy(order='F')[:,:,::-1],
+ i = nditer(a.reshape(2,3,2).copy(order='F')[:,:,::-1],
['c_index'],[['readonly']])
assert_equal(iter_indices(i),
[1,7,3,9,5,11,0,6,2,8,4,10])
@@ -338,10 +338,10 @@ def test_iter_best_order_f_index_1d():
a = arange(4)
# 1D order
- i = newiter(a,['f_index'],[['readonly']])
+ i = nditer(a,['f_index'],[['readonly']])
assert_equal(iter_indices(i), [0,1,2,3])
# 1D reversed order
- i = newiter(a[::-1],['f_index'],[['readonly']])
+ i = nditer(a[::-1],['f_index'],[['readonly']])
assert_equal(iter_indices(i), [3,2,1,0])
def test_iter_best_order_f_index_2d():
@@ -349,27 +349,27 @@ def test_iter_best_order_f_index_2d():
a = arange(6)
# 2D C-order
- i = newiter(a.reshape(2,3),['f_index'],[['readonly']])
+ i = nditer(a.reshape(2,3),['f_index'],[['readonly']])
assert_equal(iter_indices(i), [0,2,4,1,3,5])
# 2D Fortran-order
- i = newiter(a.reshape(2,3).copy(order='F'),
+ i = nditer(a.reshape(2,3).copy(order='F'),
['f_index'],[['readonly']])
assert_equal(iter_indices(i), [0,1,2,3,4,5])
# 2D reversed C-order
- i = newiter(a.reshape(2,3)[::-1],['f_index'],[['readonly']])
+ i = nditer(a.reshape(2,3)[::-1],['f_index'],[['readonly']])
assert_equal(iter_indices(i), [1,3,5,0,2,4])
- i = newiter(a.reshape(2,3)[:,::-1],['f_index'],[['readonly']])
+ i = nditer(a.reshape(2,3)[:,::-1],['f_index'],[['readonly']])
assert_equal(iter_indices(i), [4,2,0,5,3,1])
- i = newiter(a.reshape(2,3)[::-1,::-1],['f_index'],[['readonly']])
+ i = nditer(a.reshape(2,3)[::-1,::-1],['f_index'],[['readonly']])
assert_equal(iter_indices(i), [5,3,1,4,2,0])
# 2D reversed Fortran-order
- i = newiter(a.reshape(2,3).copy(order='F')[::-1],
+ i = nditer(a.reshape(2,3).copy(order='F')[::-1],
['f_index'],[['readonly']])
assert_equal(iter_indices(i), [1,0,3,2,5,4])
- i = newiter(a.reshape(2,3).copy(order='F')[:,::-1],
+ i = nditer(a.reshape(2,3).copy(order='F')[:,::-1],
['f_index'],[['readonly']])
assert_equal(iter_indices(i), [4,5,2,3,0,1])
- i = newiter(a.reshape(2,3).copy(order='F')[::-1,::-1],
+ i = nditer(a.reshape(2,3).copy(order='F')[::-1,::-1],
['f_index'],[['readonly']])
assert_equal(iter_indices(i), [5,4,3,2,1,0])
@@ -378,34 +378,34 @@ def test_iter_best_order_f_index_3d():
a = arange(12)
# 3D C-order
- i = newiter(a.reshape(2,3,2),['f_index'],[['readonly']])
+ i = nditer(a.reshape(2,3,2),['f_index'],[['readonly']])
assert_equal(iter_indices(i),
[0,6,2,8,4,10,1,7,3,9,5,11])
# 3D Fortran-order
- i = newiter(a.reshape(2,3,2).copy(order='F'),
+ i = nditer(a.reshape(2,3,2).copy(order='F'),
['f_index'],[['readonly']])
assert_equal(iter_indices(i),
[0,1,2,3,4,5,6,7,8,9,10,11])
# 3D reversed C-order
- i = newiter(a.reshape(2,3,2)[::-1],['f_index'],[['readonly']])
+ i = nditer(a.reshape(2,3,2)[::-1],['f_index'],[['readonly']])
assert_equal(iter_indices(i),
[1,7,3,9,5,11,0,6,2,8,4,10])
- i = newiter(a.reshape(2,3,2)[:,::-1],['f_index'],[['readonly']])
+ i = nditer(a.reshape(2,3,2)[:,::-1],['f_index'],[['readonly']])
assert_equal(iter_indices(i),
[4,10,2,8,0,6,5,11,3,9,1,7])
- i = newiter(a.reshape(2,3,2)[:,:,::-1],['f_index'],[['readonly']])
+ i = nditer(a.reshape(2,3,2)[:,:,::-1],['f_index'],[['readonly']])
assert_equal(iter_indices(i),
[6,0,8,2,10,4,7,1,9,3,11,5])
# 3D reversed Fortran-order
- i = newiter(a.reshape(2,3,2).copy(order='F')[::-1],
+ i = nditer(a.reshape(2,3,2).copy(order='F')[::-1],
['f_index'],[['readonly']])
assert_equal(iter_indices(i),
[1,0,3,2,5,4,7,6,9,8,11,10])
- i = newiter(a.reshape(2,3,2).copy(order='F')[:,::-1],
+ i = nditer(a.reshape(2,3,2).copy(order='F')[:,::-1],
['f_index'],[['readonly']])
assert_equal(iter_indices(i),
[4,5,2,3,0,1,10,11,8,9,6,7])
- i = newiter(a.reshape(2,3,2).copy(order='F')[:,:,::-1],
+ i = nditer(a.reshape(2,3,2).copy(order='F')[:,:,::-1],
['f_index'],[['readonly']])
assert_equal(iter_indices(i),
[6,7,8,9,10,11,0,1,2,3,4,5])
@@ -426,17 +426,17 @@ def test_iter_no_inner_full_coalesce():
aview = a.reshape(shape)[dirs_index]
# C-order
- i = newiter(aview, ['no_inner_iteration'], [['readonly']])
+ i = nditer(aview, ['external_loop'], [['readonly']])
assert_equal(i.ndim, 1)
assert_equal(i[0].shape, (size,))
# Fortran-order
- i = newiter(aview.T, ['no_inner_iteration'], [['readonly']])
+ i = nditer(aview.T, ['external_loop'], [['readonly']])
assert_equal(i.ndim, 1)
assert_equal(i[0].shape, (size,))
# Other order
if len(shape) > 2:
- i = newiter(aview.swapaxes(0,1),
- ['no_inner_iteration'], [['readonly']])
+ i = nditer(aview.swapaxes(0,1),
+ ['external_loop'], [['readonly']])
assert_equal(i.ndim, 1)
assert_equal(i[0].shape, (size,))
@@ -446,21 +446,21 @@ def test_iter_no_inner_dim_coalescing():
# Skipping the last element in a dimension prevents coalescing
# with the next-bigger dimension
a = arange(24).reshape(2,3,4)[:,:,:-1]
- i = newiter(a, ['no_inner_iteration'], [['readonly']])
+ i = nditer(a, ['external_loop'], [['readonly']])
assert_equal(i.ndim, 2)
assert_equal(i[0].shape, (3,))
a = arange(24).reshape(2,3,4)[:,:-1,:]
- i = newiter(a, ['no_inner_iteration'], [['readonly']])
+ i = nditer(a, ['external_loop'], [['readonly']])
assert_equal(i.ndim, 2)
assert_equal(i[0].shape, (8,))
a = arange(24).reshape(2,3,4)[:-1,:,:]
- i = newiter(a, ['no_inner_iteration'], [['readonly']])
+ i = nditer(a, ['external_loop'], [['readonly']])
assert_equal(i.ndim, 1)
assert_equal(i[0].shape, (12,))
# Even with lots of 1-sized dimensions, should still coalesce
a = arange(24).reshape(1,1,2,1,1,3,1,1,4,1,1)
- i = newiter(a, ['no_inner_iteration'], [['readonly']])
+ i = nditer(a, ['external_loop'], [['readonly']])
assert_equal(i.ndim, 1)
assert_equal(i[0].shape, (24,))
@@ -469,132 +469,195 @@ def test_iter_dim_coalescing():
# Tracking coordinates disables coalescing
a = arange(24).reshape(2,3,4)
- i = newiter(a, ['coords'], [['readonly']])
+ i = nditer(a, ['coords'], [['readonly']])
assert_equal(i.ndim, 3)
# A tracked index can allow coalescing if it's compatible with the array
a3d = arange(24).reshape(2,3,4)
- i = newiter(a3d, ['c_index'], [['readonly']])
+ i = nditer(a3d, ['c_index'], [['readonly']])
assert_equal(i.ndim, 1)
- i = newiter(a3d.swapaxes(0,1), ['c_index'], [['readonly']])
+ i = nditer(a3d.swapaxes(0,1), ['c_index'], [['readonly']])
assert_equal(i.ndim, 3)
- i = newiter(a3d.T, ['c_index'], [['readonly']])
+ i = nditer(a3d.T, ['c_index'], [['readonly']])
assert_equal(i.ndim, 3)
- i = newiter(a3d.T, ['f_index'], [['readonly']])
+ i = nditer(a3d.T, ['f_index'], [['readonly']])
assert_equal(i.ndim, 1)
- i = newiter(a3d.T.swapaxes(0,1), ['f_index'], [['readonly']])
+ i = nditer(a3d.T.swapaxes(0,1), ['f_index'], [['readonly']])
assert_equal(i.ndim, 3)
# When C or F order is forced, coalescing may still occur
a3d = arange(24).reshape(2,3,4)
- i = newiter(a3d, order='C')
+ i = nditer(a3d, order='C')
assert_equal(i.ndim, 1)
- i = newiter(a3d.T, order='C')
+ i = nditer(a3d.T, order='C')
assert_equal(i.ndim, 3)
- i = newiter(a3d, order='F')
+ i = nditer(a3d, order='F')
assert_equal(i.ndim, 3)
- i = newiter(a3d.T, order='F')
+ i = nditer(a3d.T, order='F')
assert_equal(i.ndim, 1)
- i = newiter(a3d, order='A')
+ i = nditer(a3d, order='A')
assert_equal(i.ndim, 1)
- i = newiter(a3d.T, order='A')
+ i = nditer(a3d.T, order='A')
assert_equal(i.ndim, 1)
def test_iter_broadcasting():
# Standard NumPy broadcasting rules
# 1D with scalar
- i = newiter([arange(6), np.int32(2)], ['coords'], [['readonly']]*2)
+ i = nditer([arange(6), np.int32(2)], ['coords'], [['readonly']]*2)
assert_equal(i.itersize, 6)
assert_equal(i.shape, (6,))
# 2D with scalar
- i = newiter([arange(6).reshape(2,3), np.int32(2)],
+ i = nditer([arange(6).reshape(2,3), np.int32(2)],
['coords'], [['readonly']]*2)
assert_equal(i.itersize, 6)
assert_equal(i.shape, (2,3))
# 2D with 1D
- i = newiter([arange(6).reshape(2,3), arange(3)],
+ i = nditer([arange(6).reshape(2,3), arange(3)],
['coords'], [['readonly']]*2)
assert_equal(i.itersize, 6)
assert_equal(i.shape, (2,3))
- i = newiter([arange(2).reshape(2,1), arange(3)],
+ i = nditer([arange(2).reshape(2,1), arange(3)],
['coords'], [['readonly']]*2)
assert_equal(i.itersize, 6)
assert_equal(i.shape, (2,3))
# 2D with 2D
- i = newiter([arange(2).reshape(2,1), arange(3).reshape(1,3)],
+ i = nditer([arange(2).reshape(2,1), arange(3).reshape(1,3)],
['coords'], [['readonly']]*2)
assert_equal(i.itersize, 6)
assert_equal(i.shape, (2,3))
# 3D with scalar
- i = newiter([np.int32(2), arange(24).reshape(4,2,3)],
+ i = nditer([np.int32(2), arange(24).reshape(4,2,3)],
['coords'], [['readonly']]*2)
assert_equal(i.itersize, 24)
assert_equal(i.shape, (4,2,3))
# 3D with 1D
- i = newiter([arange(3), arange(24).reshape(4,2,3)],
+ i = nditer([arange(3), arange(24).reshape(4,2,3)],
['coords'], [['readonly']]*2)
assert_equal(i.itersize, 24)
assert_equal(i.shape, (4,2,3))
- i = newiter([arange(3), arange(8).reshape(4,2,1)],
+ i = nditer([arange(3), arange(8).reshape(4,2,1)],
['coords'], [['readonly']]*2)
assert_equal(i.itersize, 24)
assert_equal(i.shape, (4,2,3))
# 3D with 2D
- i = newiter([arange(6).reshape(2,3), arange(24).reshape(4,2,3)],
+ i = nditer([arange(6).reshape(2,3), arange(24).reshape(4,2,3)],
['coords'], [['readonly']]*2)
assert_equal(i.itersize, 24)
assert_equal(i.shape, (4,2,3))
- i = newiter([arange(2).reshape(2,1), arange(24).reshape(4,2,3)],
+ i = nditer([arange(2).reshape(2,1), arange(24).reshape(4,2,3)],
['coords'], [['readonly']]*2)
assert_equal(i.itersize, 24)
assert_equal(i.shape, (4,2,3))
- i = newiter([arange(3).reshape(1,3), arange(8).reshape(4,2,1)],
+ i = nditer([arange(3).reshape(1,3), arange(8).reshape(4,2,1)],
['coords'], [['readonly']]*2)
assert_equal(i.itersize, 24)
assert_equal(i.shape, (4,2,3))
# 3D with 3D
- i = newiter([arange(2).reshape(1,2,1), arange(3).reshape(1,1,3),
+ i = nditer([arange(2).reshape(1,2,1), arange(3).reshape(1,1,3),
arange(4).reshape(4,1,1)],
['coords'], [['readonly']]*3)
assert_equal(i.itersize, 24)
assert_equal(i.shape, (4,2,3))
- i = newiter([arange(6).reshape(1,2,3), arange(4).reshape(4,1,1)],
+ i = nditer([arange(6).reshape(1,2,3), arange(4).reshape(4,1,1)],
['coords'], [['readonly']]*2)
assert_equal(i.itersize, 24)
assert_equal(i.shape, (4,2,3))
- i = newiter([arange(24).reshape(4,2,3), arange(12).reshape(4,1,3)],
+ i = nditer([arange(24).reshape(4,2,3), arange(12).reshape(4,1,3)],
['coords'], [['readonly']]*2)
assert_equal(i.itersize, 24)
assert_equal(i.shape, (4,2,3))
+def test_iter_itershape():
+ # Check that allocated outputs work with a specified shape
+ a = np.arange(6, dtype='i2').reshape(2,3)
+ i = nditer([a, None], [], [['readonly'], ['writeonly','allocate']],
+ op_axes=[[0,1,None], None],
+ itershape=(-1,-1,4))
+ assert_equal(i.operands[1].shape, (2,3,4))
+ assert_equal(i.operands[1].strides, (24,8,2))
+
+ i = nditer([a.T, None], [], [['readonly'], ['writeonly','allocate']],
+ op_axes=[[0,1,None], None],
+ itershape=(-1,-1,4))
+ assert_equal(i.operands[1].shape, (3,2,4))
+ assert_equal(i.operands[1].strides, (8,24,2))
+
+ i = nditer([a.T, None], [], [['readonly'], ['writeonly','allocate']],
+ order='F',
+ op_axes=[[0,1,None], None],
+ itershape=(-1,-1,4))
+ assert_equal(i.operands[1].shape, (3,2,4))
+ assert_equal(i.operands[1].strides, (2,6,12))
+
+ # If we specify 1 in the itershape, it shouldn't allow broadcasting
+ # of that dimension to a bigger value
+ assert_raises(ValueError, nditer, [a, None], [],
+ [['readonly'], ['writeonly','allocate']],
+ op_axes=[[0,1,None], None],
+ itershape=(-1,1,4))
+
def test_iter_broadcasting_errors():
# Check that errors are thrown for bad broadcasting shapes
# 1D with 1D
- assert_raises(ValueError, newiter, [arange(2), arange(3)],
+ assert_raises(ValueError, nditer, [arange(2), arange(3)],
[], [['readonly']]*2)
# 2D with 1D
- assert_raises(ValueError, newiter,
+ assert_raises(ValueError, nditer,
[arange(6).reshape(2,3), arange(2)],
[], [['readonly']]*2)
# 2D with 2D
- assert_raises(ValueError, newiter,
+ assert_raises(ValueError, nditer,
[arange(6).reshape(2,3), arange(9).reshape(3,3)],
[], [['readonly']]*2)
- assert_raises(ValueError, newiter,
+ assert_raises(ValueError, nditer,
[arange(6).reshape(2,3), arange(4).reshape(2,2)],
[], [['readonly']]*2)
# 3D with 3D
- assert_raises(ValueError, newiter,
+ assert_raises(ValueError, nditer,
[arange(36).reshape(3,3,4), arange(24).reshape(2,3,4)],
[], [['readonly']]*2)
- assert_raises(ValueError, newiter,
+ assert_raises(ValueError, nditer,
[arange(8).reshape(2,4,1), arange(24).reshape(2,3,4)],
[], [['readonly']]*2)
+ # Verify that the error message mentions the right shapes
+ try:
+ i = nditer([arange(2).reshape(1,2,1),
+ arange(3).reshape(1,3),
+ arange(6).reshape(2,3)],
+ [],
+ [['readonly'], ['readonly'], ['writeonly','no_broadcast']])
+ assert_(False, 'Should have raised a broadcast error')
+ except ValueError, e:
+ msg = str(e)
+ # The message should contain the shape of the 3rd operand
+ assert_(msg.find('(2,3)') >= 0,
+ 'Message "%s" doesn\'t contain operand shape (2,3)' % msg)
+ # The message should contain the broadcast shape
+ assert_(msg.find('(1,2,3)') >= 0,
+ 'Message "%s" doesn\'t contain broadcast shape (1,2,3)' % msg)
+
+ try:
+ i = nditer([arange(6).reshape(2,3), arange(2)], [],
+ [['readonly'],['readonly']],
+ op_axes=[[0,1], [0,np.newaxis]],
+ itershape=(4,3))
+ assert_(False, 'Should have raised a broadcast error')
+ except ValueError, e:
+ msg = str(e)
+ # The message should contain "shape->remappedshape" for each operand
+ assert_(msg.find('(2,3)->(2,3)') >= 0,
+ 'Message "%s" doesn\'t contain operand shape (2,3)->(2,3)' % msg)
+ assert_(msg.find('(2)->(2,newaxis)') >= 0,
+ ('Message "%s" doesn\'t contain remapped operand shape' +
+ '(2)->(2,newaxis)') % msg)
+ # The message should contain the itershape parameter
+ assert_(msg.find('(4,3)') >= 0,
+ 'Message "%s" doesn\'t contain itershape parameter (4,3)' % msg)
def test_iter_flags_errors():
# Check that bad combinations of flags produce errors
@@ -602,49 +665,49 @@ def test_iter_flags_errors():
a = arange(6)
# Not enough operands
- assert_raises(ValueError, newiter, [], [], [])
+ assert_raises(ValueError, nditer, [], [], [])
# Too many operands
- assert_raises(ValueError, newiter, [a]*100, [], [['readonly']]*100)
+ assert_raises(ValueError, nditer, [a]*100, [], [['readonly']]*100)
# Bad global flag
- assert_raises(ValueError, newiter, [a], ['bad flag'], [['readonly']])
+ assert_raises(ValueError, nditer, [a], ['bad flag'], [['readonly']])
# Bad op flag
- assert_raises(ValueError, newiter, [a], [], [['readonly','bad flag']])
+ assert_raises(ValueError, nditer, [a], [], [['readonly','bad flag']])
# Bad order parameter
- assert_raises(ValueError, newiter, [a], [], [['readonly']], order='G')
+ assert_raises(ValueError, nditer, [a], [], [['readonly']], order='G')
# Bad casting parameter
- assert_raises(ValueError, newiter, [a], [], [['readonly']], casting='noon')
+ assert_raises(ValueError, nditer, [a], [], [['readonly']], casting='noon')
# op_flags must match ops
- assert_raises(ValueError, newiter, [a]*3, [], [['readonly']]*2)
+ assert_raises(ValueError, nditer, [a]*3, [], [['readonly']]*2)
# Cannot track both a C and an F index
- assert_raises(ValueError, newiter, a,
+ assert_raises(ValueError, nditer, a,
['c_index','f_index'], [['readonly']])
# Inner iteration and coords/indices are incompatible
- assert_raises(ValueError, newiter, a,
- ['no_inner_iteration','coords'], [['readonly']])
- assert_raises(ValueError, newiter, a,
- ['no_inner_iteration','c_index'], [['readonly']])
- assert_raises(ValueError, newiter, a,
- ['no_inner_iteration','f_index'], [['readonly']])
+ assert_raises(ValueError, nditer, a,
+ ['external_loop','coords'], [['readonly']])
+ assert_raises(ValueError, nditer, a,
+ ['external_loop','c_index'], [['readonly']])
+ assert_raises(ValueError, nditer, a,
+ ['external_loop','f_index'], [['readonly']])
# Must specify exactly one of readwrite/readonly/writeonly per operand
- assert_raises(ValueError, newiter, a, [], [[]])
- assert_raises(ValueError, newiter, a, [], [['readonly','writeonly']])
- assert_raises(ValueError, newiter, a, [], [['readonly','readwrite']])
- assert_raises(ValueError, newiter, a, [], [['writeonly','readwrite']])
- assert_raises(ValueError, newiter, a,
+ assert_raises(ValueError, nditer, a, [], [[]])
+ assert_raises(ValueError, nditer, a, [], [['readonly','writeonly']])
+ assert_raises(ValueError, nditer, a, [], [['readonly','readwrite']])
+ assert_raises(ValueError, nditer, a, [], [['writeonly','readwrite']])
+ assert_raises(ValueError, nditer, a,
[], [['readonly','writeonly','readwrite']])
# Python scalars are always readonly
- assert_raises(TypeError, newiter, 1.5, [], [['writeonly']])
- assert_raises(TypeError, newiter, 1.5, [], [['readwrite']])
+ assert_raises(TypeError, nditer, 1.5, [], [['writeonly']])
+ assert_raises(TypeError, nditer, 1.5, [], [['readwrite']])
# Array scalars are always readonly
- assert_raises(TypeError, newiter, np.int32(1), [], [['writeonly']])
- assert_raises(TypeError, newiter, np.int32(1), [], [['readwrite']])
+ assert_raises(TypeError, nditer, np.int32(1), [], [['writeonly']])
+ assert_raises(TypeError, nditer, np.int32(1), [], [['readwrite']])
# Check readonly array
a.flags.writeable = False
- assert_raises(ValueError, newiter, a, [], [['writeonly']])
- assert_raises(ValueError, newiter, a, [], [['readwrite']])
+ assert_raises(ValueError, nditer, a, [], [['writeonly']])
+ assert_raises(ValueError, nditer, a, [], [['readwrite']])
a.flags.writeable = True
# Coords available only with the coords flag
- i = newiter(arange(6), [], [['readonly']])
+ i = nditer(arange(6), [], [['readonly']])
assert_raises(ValueError, lambda i:i.coords, i)
# Index available only with an index flag
assert_raises(ValueError, lambda i:i.index, i)
@@ -657,21 +720,21 @@ def test_iter_flags_errors():
i.iterindex = 0;
def assign_iterrange(i):
i.iterrange = (0,1);
- i = newiter(arange(6), ['no_inner_iteration'])
+ i = nditer(arange(6), ['external_loop'])
assert_raises(ValueError, assign_coords, i)
assert_raises(ValueError, assign_index, i)
assert_raises(ValueError, assign_iterindex, i)
assert_raises(ValueError, assign_iterrange, i)
- i = newiter(arange(6), ['buffered'])
+ i = nditer(arange(6), ['buffered'])
assert_raises(ValueError, assign_coords, i)
assert_raises(ValueError, assign_index, i)
assert_raises(ValueError, assign_iterrange, i)
# Can't iterate if size is zero
- assert_raises(ValueError, newiter, np.array([]))
+ assert_raises(ValueError, nditer, np.array([]))
def test_iter_slice():
a, b, c = np.arange(3), np.arange(3), np.arange(3.)
- i = newiter([a,b,c], [], ['readwrite'])
+ i = nditer([a,b,c], [], ['readwrite'])
i[0:2] = (3,3)
assert_equal(a, [3,1,2])
assert_equal(b, [3,1,2])
@@ -686,7 +749,7 @@ def test_iter_nbo_align_contig():
a = np.arange(6, dtype='f4')
au = a.byteswap().newbyteorder()
assert_(a.dtype.byteorder != au.dtype.byteorder)
- i = newiter(au, [], [['readwrite','updateifcopy']],
+ i = nditer(au, [], [['readwrite','updateifcopy']],
casting='equiv',
op_dtypes=[np.dtype('f4')])
assert_equal(i.dtypes[0].byteorder, a.dtype.byteorder)
@@ -700,7 +763,7 @@ def test_iter_nbo_align_contig():
a = np.arange(6, dtype='f4')
au = a.byteswap().newbyteorder()
assert_(a.dtype.byteorder != au.dtype.byteorder)
- i = newiter(au, [], [['readwrite','updateifcopy','nbo']], casting='equiv')
+ i = nditer(au, [], [['readwrite','updateifcopy','nbo']], casting='equiv')
assert_equal(i.dtypes[0].byteorder, a.dtype.byteorder)
assert_equal(i.operands[0].dtype.byteorder, a.dtype.byteorder)
assert_equal(i.operands[0], a)
@@ -714,11 +777,11 @@ def test_iter_nbo_align_contig():
a[:] = np.arange(6, dtype='f4')
assert_(not a.flags.aligned)
# Without 'aligned', shouldn't copy
- i = newiter(a, [], [['readonly']])
+ i = nditer(a, [], [['readonly']])
assert_(not i.operands[0].flags.aligned)
assert_equal(i.operands[0], a);
# With 'aligned', should make a copy
- i = newiter(a, [], [['readwrite','updateifcopy','aligned']])
+ i = nditer(a, [], [['readwrite','updateifcopy','aligned']])
assert_(i.operands[0].flags.aligned)
assert_equal(i.operands[0], a);
i.operands[0][:] = 3
@@ -728,11 +791,11 @@ def test_iter_nbo_align_contig():
# Discontiguous input
a = arange(12)
# If it is contiguous, shouldn't copy
- i = newiter(a[:6], [], [['readonly']])
+ i = nditer(a[:6], [], [['readonly']])
assert_(i.operands[0].flags.contiguous)
assert_equal(i.operands[0], a[:6]);
# If it isn't contiguous, should buffer
- i = newiter(a[::2], ['buffered','no_inner_iteration'],
+ i = nditer(a[::2], ['buffered','external_loop'],
[['readonly','contig']],
buffersize=10)
assert_(i[0].flags.contiguous)
@@ -743,13 +806,13 @@ def test_iter_array_cast():
# No cast 'f4' -> 'f4'
a = np.arange(6, dtype='f4').reshape(2,3)
- i = newiter(a, [], [['readwrite']], op_dtypes=[np.dtype('f4')])
+ i = nditer(a, [], [['readwrite']], op_dtypes=[np.dtype('f4')])
assert_equal(i.operands[0], a)
assert_equal(i.operands[0].dtype, np.dtype('f4'))
# Byte-order cast '<f4' -> '>f4'
a = np.arange(6, dtype='<f4').reshape(2,3)
- i = newiter(a, [], [['readwrite','updateifcopy']],
+ i = nditer(a, [], [['readwrite','updateifcopy']],
casting='equiv',
op_dtypes=[np.dtype('>f4')])
assert_equal(i.operands[0], a)
@@ -757,7 +820,7 @@ def test_iter_array_cast():
# Safe case 'f4' -> 'f8'
a = np.arange(24, dtype='f4').reshape(2,3,4).swapaxes(1,2)
- i = newiter(a, [], [['readonly','copy']],
+ i = nditer(a, [], [['readonly','copy']],
casting='safe',
op_dtypes=[np.dtype('f8')])
assert_equal(i.operands[0], a)
@@ -765,7 +828,7 @@ def test_iter_array_cast():
# The memory layout of the temporary should match a (a is (48,4,16))
assert_equal(i.operands[0].strides, (96,8,32))
a = a[::-1,:,::-1]
- i = newiter(a, [], [['readonly','copy']],
+ i = nditer(a, [], [['readonly','copy']],
casting='safe',
op_dtypes=[np.dtype('f8')])
assert_equal(i.operands[0], a)
@@ -774,7 +837,7 @@ def test_iter_array_cast():
# Same-kind cast 'f8' -> 'f4' -> 'f8'
a = np.arange(24, dtype='f8').reshape(2,3,4).T
- i = newiter(a, [],
+ i = nditer(a, [],
[['readwrite','updateifcopy']],
casting='same_kind',
op_dtypes=[np.dtype('f4')])
@@ -789,7 +852,7 @@ def test_iter_array_cast():
# Unsafe cast 'f4' -> 'i4'
a = np.arange(6, dtype='i4')[::-2]
- i = newiter(a, [],
+ i = nditer(a, [],
[['writeonly','updateifcopy']],
casting='unsafe',
op_dtypes=[np.dtype('f4')])
@@ -803,42 +866,42 @@ def test_iter_array_cast_errors():
# Check that invalid casts are caught
# Need to enable copying for casts to occur
- assert_raises(TypeError, newiter, arange(2,dtype='f4'), [],
+ assert_raises(TypeError, nditer, arange(2,dtype='f4'), [],
[['readonly']], op_dtypes=[np.dtype('f8')])
# Also need to allow casting for casts to occur
- assert_raises(TypeError, newiter, arange(2,dtype='f4'), [],
+ assert_raises(TypeError, nditer, arange(2,dtype='f4'), [],
[['readonly','copy']], casting='no',
op_dtypes=[np.dtype('f8')])
- assert_raises(TypeError, newiter, arange(2,dtype='f4'), [],
+ assert_raises(TypeError, nditer, arange(2,dtype='f4'), [],
[['readonly','copy']], casting='equiv',
op_dtypes=[np.dtype('f8')])
- assert_raises(TypeError, newiter, arange(2,dtype='f8'), [],
+ assert_raises(TypeError, nditer, arange(2,dtype='f8'), [],
[['writeonly','updateifcopy']],
casting='no',
op_dtypes=[np.dtype('f4')])
- assert_raises(TypeError, newiter, arange(2,dtype='f8'), [],
+ assert_raises(TypeError, nditer, arange(2,dtype='f8'), [],
[['writeonly','updateifcopy']],
casting='equiv',
op_dtypes=[np.dtype('f4')])
# '<f4' -> '>f4' should not work with casting='no'
- assert_raises(TypeError, newiter, arange(2,dtype='<f4'), [],
+ assert_raises(TypeError, nditer, arange(2,dtype='<f4'), [],
[['readonly','copy']], casting='no',
op_dtypes=[np.dtype('>f4')])
# 'f4' -> 'f8' is a safe cast, but 'f8' -> 'f4' isn't
- assert_raises(TypeError, newiter, arange(2,dtype='f4'), [],
+ assert_raises(TypeError, nditer, arange(2,dtype='f4'), [],
[['readwrite','updateifcopy']],
casting='safe',
op_dtypes=[np.dtype('f8')])
- assert_raises(TypeError, newiter, arange(2,dtype='f8'), [],
+ assert_raises(TypeError, nditer, arange(2,dtype='f8'), [],
[['readwrite','updateifcopy']],
casting='safe',
op_dtypes=[np.dtype('f4')])
# 'f4' -> 'i4' is neither a safe nor a same-kind cast
- assert_raises(TypeError, newiter, arange(2,dtype='f4'), [],
+ assert_raises(TypeError, nditer, arange(2,dtype='f4'), [],
[['readonly','copy']],
casting='same_kind',
op_dtypes=[np.dtype('i4')])
- assert_raises(TypeError, newiter, arange(2,dtype='i4'), [],
+ assert_raises(TypeError, nditer, arange(2,dtype='i4'), [],
[['writeonly','updateifcopy']],
casting='same_kind',
op_dtypes=[np.dtype('f4')])
@@ -847,13 +910,13 @@ def test_iter_scalar_cast():
# Check that scalars are cast as requested
# No cast 'f4' -> 'f4'
- i = newiter(np.float32(2.5), [], [['readonly']],
+ i = nditer(np.float32(2.5), [], [['readonly']],
op_dtypes=[np.dtype('f4')])
assert_equal(i.dtypes[0], np.dtype('f4'))
assert_equal(i.value.dtype, np.dtype('f4'))
assert_equal(i.value, 2.5)
# Safe cast 'f4' -> 'f8'
- i = newiter(np.float32(2.5), [],
+ i = nditer(np.float32(2.5), [],
[['readonly','copy']],
casting='safe',
op_dtypes=[np.dtype('f8')])
@@ -861,7 +924,7 @@ def test_iter_scalar_cast():
assert_equal(i.value.dtype, np.dtype('f8'))
assert_equal(i.value, 2.5)
# Same-kind cast 'f8' -> 'f4'
- i = newiter(np.float64(2.5), [],
+ i = nditer(np.float64(2.5), [],
[['readonly','copy']],
casting='same_kind',
op_dtypes=[np.dtype('f4')])
@@ -869,7 +932,7 @@ def test_iter_scalar_cast():
assert_equal(i.value.dtype, np.dtype('f4'))
assert_equal(i.value, 2.5)
# Unsafe cast 'f8' -> 'i4'
- i = newiter(np.float64(3.0), [],
+ i = nditer(np.float64(3.0), [],
[['readonly','copy']],
casting='unsafe',
op_dtypes=[np.dtype('i4')])
@@ -877,7 +940,7 @@ def test_iter_scalar_cast():
assert_equal(i.value.dtype, np.dtype('i4'))
assert_equal(i.value, 3)
# Readonly scalars may be cast even without setting COPY or BUFFERED
- i = newiter(3, [], [['readonly']], op_dtypes=[np.dtype('f8')])
+ i = nditer(3, [], [['readonly']], op_dtypes=[np.dtype('f8')])
assert_equal(i[0].dtype, np.dtype('f8'))
assert_equal(i[0], 3.)
@@ -885,17 +948,17 @@ def test_iter_scalar_cast_errors():
# Check that invalid casts are caught
# Need to allow copying/buffering for write casts of scalars to occur
- assert_raises(TypeError, newiter, np.float32(2), [],
+ assert_raises(TypeError, nditer, np.float32(2), [],
[['readwrite']], op_dtypes=[np.dtype('f8')])
- assert_raises(TypeError, newiter, 2.5, [],
+ assert_raises(TypeError, nditer, 2.5, [],
[['readwrite']], op_dtypes=[np.dtype('f4')])
# 'f8' -> 'f4' isn't a safe cast if the value would overflow
- assert_raises(TypeError, newiter, np.float64(1e60), [],
+ assert_raises(TypeError, nditer, np.float64(1e60), [],
[['readonly']],
casting='safe',
op_dtypes=[np.dtype('f4')])
# 'f4' -> 'i4' is neither a safe nor a same-kind cast
- assert_raises(TypeError, newiter, np.float32(2), [],
+ assert_raises(TypeError, nditer, np.float32(2), [],
[['readonly']],
casting='same_kind',
op_dtypes=[np.dtype('i4')])
@@ -908,16 +971,16 @@ def test_iter_object_arrays_basic():
rc = sys.getrefcount(obj)
# Need to allow references for object arrays
- assert_raises(TypeError, newiter, a)
+ assert_raises(TypeError, nditer, a)
assert_equal(sys.getrefcount(obj), rc)
- i = newiter(a, ['refs_ok'], ['readonly'])
+ i = nditer(a, ['refs_ok'], ['readonly'])
vals = [x[()] for x in i]
assert_equal(np.array(vals, dtype='O'), a)
vals, i, x = [None]*3
assert_equal(sys.getrefcount(obj), rc)
- i = newiter(a.reshape(2,2).T, ['refs_ok','buffered'],
+ i = nditer(a.reshape(2,2).T, ['refs_ok','buffered'],
['readonly'], order='C')
assert_(i.iterationneedsapi)
vals = [x[()] for x in i]
@@ -925,7 +988,7 @@ def test_iter_object_arrays_basic():
vals, i, x = [None]*3
assert_equal(sys.getrefcount(obj), rc)
- i = newiter(a.reshape(2,2).T, ['refs_ok','buffered'],
+ i = nditer(a.reshape(2,2).T, ['refs_ok','buffered'],
['readwrite'], order='C')
for x in i:
x[...] = None
@@ -936,14 +999,14 @@ def test_iter_object_arrays_basic():
def test_iter_object_arrays_conversions():
# Conversions to/from objects
a = np.arange(6, dtype='O')
- i = newiter(a, ['refs_ok','buffered'], ['readwrite'],
+ i = nditer(a, ['refs_ok','buffered'], ['readwrite'],
casting='unsafe', op_dtypes='i4')
for x in i:
x[...] += 1
assert_equal(a, np.arange(6)+1)
a = np.arange(6, dtype='i4')
- i = newiter(a, ['refs_ok','buffered'], ['readwrite'],
+ i = nditer(a, ['refs_ok','buffered'], ['readwrite'],
casting='unsafe', op_dtypes='O')
for x in i:
x[...] += 1
@@ -953,7 +1016,7 @@ def test_iter_object_arrays_conversions():
a = np.zeros((6,), dtype=[('p','i1'),('a','O')])
a = a['a']
a[:] = np.arange(6)
- i = newiter(a, ['refs_ok','buffered'], ['readwrite'],
+ i = nditer(a, ['refs_ok','buffered'], ['readwrite'],
casting='unsafe', op_dtypes='i4')
for x in i:
x[...] += 1
@@ -963,7 +1026,7 @@ def test_iter_object_arrays_conversions():
a = np.zeros((6,), dtype=[('p','i1'),('a','i4')])
a = a['a']
a[:] = np.arange(6) + 98172488
- i = newiter(a, ['refs_ok','buffered'], ['readwrite'],
+ i = nditer(a, ['refs_ok','buffered'], ['readwrite'],
casting='unsafe', op_dtypes='O')
ob = i[0][()]
rc = sys.getrefcount(ob)
@@ -975,37 +1038,37 @@ def test_iter_object_arrays_conversions():
def test_iter_common_dtype():
# Check that the iterator finds a common data type correctly
- i = newiter([array([3],dtype='f4'),array([0],dtype='f8')],
+ i = nditer([array([3],dtype='f4'),array([0],dtype='f8')],
['common_dtype'],
[['readonly','copy']]*2,
casting='safe')
assert_equal(i.dtypes[0], np.dtype('f8'));
assert_equal(i.dtypes[1], np.dtype('f8'));
- i = newiter([array([3],dtype='i4'),array([0],dtype='f4')],
+ i = nditer([array([3],dtype='i4'),array([0],dtype='f4')],
['common_dtype'],
[['readonly','copy']]*2,
casting='safe')
assert_equal(i.dtypes[0], np.dtype('f8'));
assert_equal(i.dtypes[1], np.dtype('f8'));
- i = newiter([array([3],dtype='f4'),array(0,dtype='f8')],
+ i = nditer([array([3],dtype='f4'),array(0,dtype='f8')],
['common_dtype'],
[['readonly','copy']]*2,
casting='same_kind')
assert_equal(i.dtypes[0], np.dtype('f4'));
assert_equal(i.dtypes[1], np.dtype('f4'));
- i = newiter([array([3],dtype='u4'),array(0,dtype='i4')],
+ i = nditer([array([3],dtype='u4'),array(0,dtype='i4')],
['common_dtype'],
[['readonly','copy']]*2,
casting='safe')
assert_equal(i.dtypes[0], np.dtype('u4'));
assert_equal(i.dtypes[1], np.dtype('u4'));
- i = newiter([array([3],dtype='u4'),array(-12,dtype='i4')],
+ i = nditer([array([3],dtype='u4'),array(-12,dtype='i4')],
['common_dtype'],
[['readonly','copy']]*2,
casting='safe')
assert_equal(i.dtypes[0], np.dtype('i8'));
assert_equal(i.dtypes[1], np.dtype('i8'));
- i = newiter([array([3],dtype='u4'),array(-12,dtype='i4'),
+ i = nditer([array([3],dtype='u4'),array(-12,dtype='i4'),
array([2j],dtype='c8'),array([9],dtype='f8')],
['common_dtype'],
[['readonly','copy']]*4,
@@ -1017,7 +1080,7 @@ def test_iter_common_dtype():
assert_equal(i.value, (3,-12,2j,9))
# When allocating outputs, other outputs aren't factored in
- i = newiter([array([3],dtype='i4'),None,array([2j],dtype='c16')], [],
+ i = nditer([array([3],dtype='i4'),None,array([2j],dtype='c16')], [],
[['readonly','copy'],
['writeonly','allocate'],
['writeonly']],
@@ -1026,7 +1089,7 @@ def test_iter_common_dtype():
assert_equal(i.dtypes[1], np.dtype('i4'));
assert_equal(i.dtypes[2], np.dtype('c16'));
# But, if common data types are requested, they are
- i = newiter([array([3],dtype='i4'),None,array([2j],dtype='c16')],
+ i = nditer([array([3],dtype='i4'),None,array([2j],dtype='c16')],
['common_dtype'],
[['readonly','copy'],
['writeonly','allocate'],
@@ -1041,36 +1104,36 @@ def test_iter_op_axes():
# Reverse the axes
a = arange(6).reshape(2,3)
- i = newiter([a,a.T], [], [['readonly']]*2, op_axes=[[0,1],[1,0]])
+ i = nditer([a,a.T], [], [['readonly']]*2, op_axes=[[0,1],[1,0]])
assert_(all([x==y for (x,y) in i]))
a = arange(24).reshape(2,3,4)
- i = newiter([a.T,a], [], [['readonly']]*2, op_axes=[[2,1,0],None])
+ i = nditer([a.T,a], [], [['readonly']]*2, op_axes=[[2,1,0],None])
assert_(all([x==y for (x,y) in i]))
# Broadcast 1D to any dimension
a = arange(1,31).reshape(2,3,5)
b = arange(1,3)
- i = newiter([a,b], [], [['readonly']]*2, op_axes=[None,[0,-1,-1]])
+ i = nditer([a,b], [], [['readonly']]*2, op_axes=[None,[0,-1,-1]])
assert_equal([x*y for (x,y) in i], (a*b.reshape(2,1,1)).ravel())
b = arange(1,4)
- i = newiter([a,b], [], [['readonly']]*2, op_axes=[None,[-1,0,-1]])
+ i = nditer([a,b], [], [['readonly']]*2, op_axes=[None,[-1,0,-1]])
assert_equal([x*y for (x,y) in i], (a*b.reshape(1,3,1)).ravel())
b = arange(1,6)
- i = newiter([a,b], [], [['readonly']]*2,
+ i = nditer([a,b], [], [['readonly']]*2,
op_axes=[None,[np.newaxis,np.newaxis,0]])
assert_equal([x*y for (x,y) in i], (a*b.reshape(1,1,5)).ravel())
# Inner product-style broadcasting
a = arange(24).reshape(2,3,4)
b = arange(40).reshape(5,2,4)
- i = newiter([a,b], ['coords'], [['readonly']]*2,
+ i = nditer([a,b], ['coords'], [['readonly']]*2,
op_axes=[[0,1,-1,-1],[-1,-1,0,1]])
assert_equal(i.shape, (2,3,5,2))
# Matrix product-style broadcasting
a = arange(12).reshape(3,4)
b = arange(20).reshape(4,5)
- i = newiter([a,b], ['coords'], [['readonly']]*2,
+ i = nditer([a,b], ['coords'], [['readonly']]*2,
op_axes=[[0,-1],[-1,1]])
assert_equal(i.shape, (3,5))
@@ -1079,25 +1142,25 @@ def test_iter_op_axes_errors():
# Wrong number of items in op_axes
a = arange(6).reshape(2,3)
- assert_raises(ValueError, newiter, [a,a], [], [['readonly']]*2,
+ assert_raises(ValueError, nditer, [a,a], [], [['readonly']]*2,
op_axes=[[0],[1],[0]])
# Out of bounds items in op_axes
- assert_raises(ValueError, newiter, [a,a], [], [['readonly']]*2,
+ assert_raises(ValueError, nditer, [a,a], [], [['readonly']]*2,
op_axes=[[2,1],[0,1]])
- assert_raises(ValueError, newiter, [a,a], [], [['readonly']]*2,
+ assert_raises(ValueError, nditer, [a,a], [], [['readonly']]*2,
op_axes=[[0,1],[2,-1]])
# Duplicate items in op_axes
- assert_raises(ValueError, newiter, [a,a], [], [['readonly']]*2,
+ assert_raises(ValueError, nditer, [a,a], [], [['readonly']]*2,
op_axes=[[0,0],[0,1]])
- assert_raises(ValueError, newiter, [a,a], [], [['readonly']]*2,
+ assert_raises(ValueError, nditer, [a,a], [], [['readonly']]*2,
op_axes=[[0,1],[1,1]])
# Different sized arrays in op_axes
- assert_raises(ValueError, newiter, [a,a], [], [['readonly']]*2,
+ assert_raises(ValueError, nditer, [a,a], [], [['readonly']]*2,
op_axes=[[0,1],[0,1,0]])
# Non-broadcastable dimensions in the result
- assert_raises(ValueError, newiter, [a,a], [], [['readonly']]*2,
+ assert_raises(ValueError, nditer, [a,a], [], [['readonly']]*2,
op_axes=[[0,1],[1,0]])
def test_iter_copy():
@@ -1105,7 +1168,7 @@ def test_iter_copy():
a = arange(24).reshape(2,3,4)
# Simple iterator
- i = newiter(a)
+ i = nditer(a)
j = i.copy()
assert_equal([x[()] for x in i], [x[()] for x in j])
@@ -1114,7 +1177,7 @@ def test_iter_copy():
assert_equal([x[()] for x in i], [x[()] for x in j])
# Buffered iterator
- i = newiter(a, ['buffered','ranged'], order='F', buffersize=3)
+ i = nditer(a, ['buffered','ranged'], order='F', buffersize=3)
j = i.copy()
assert_equal([x[()] for x in i], [x[()] for x in j])
@@ -1132,14 +1195,14 @@ def test_iter_copy():
assert_equal([x[()] for x in i], [x[()] for x in j])
# Casting iterator
- i = newiter(a, ['buffered'], order='F', casting='unsafe',
+ i = nditer(a, ['buffered'], order='F', casting='unsafe',
op_dtypes='f8', buffersize=5)
j = i.copy()
i = None
assert_equal([x[()] for x in j], a.ravel(order='F'))
a = arange(24, dtype='<i4').reshape(2,3,4)
- i = newiter(a, ['buffered'], order='F', casting='unsafe',
+ i = nditer(a, ['buffered'], order='F', casting='unsafe',
op_dtypes='>f8', buffersize=5)
j = i.copy()
i = None
@@ -1150,7 +1213,7 @@ def test_iter_allocate_output_simple():
# Simple case
a = arange(6)
- i = newiter([a,None], [], [['readonly'],['writeonly','allocate']],
+ i = nditer([a,None], [], [['readonly'],['writeonly','allocate']],
op_dtypes=[None,np.dtype('f4')])
assert_equal(i.operands[1].shape, a.shape)
assert_equal(i.operands[1].dtype, np.dtype('f4'))
@@ -1159,7 +1222,7 @@ def test_iter_allocate_output_buffered_readwrite():
# Allocated output with buffering + delay_bufalloc
a = arange(6)
- i = newiter([a,None], ['buffered','delay_bufalloc'],
+ i = nditer([a,None], ['buffered','delay_bufalloc'],
[['readonly'],['allocate','readwrite']])
i.operands[1][:] = 1
i.reset()
@@ -1172,21 +1235,21 @@ def test_iter_allocate_output_itorder():
# C-order input, best iteration order
a = arange(6, dtype='i4').reshape(2,3)
- i = newiter([a,None], [], [['readonly'],['writeonly','allocate']],
+ i = nditer([a,None], [], [['readonly'],['writeonly','allocate']],
op_dtypes=[None,np.dtype('f4')])
assert_equal(i.operands[1].shape, a.shape)
assert_equal(i.operands[1].strides, a.strides)
assert_equal(i.operands[1].dtype, np.dtype('f4'))
# F-order input, best iteration order
a = arange(24, dtype='i4').reshape(2,3,4).T
- i = newiter([a,None], [], [['readonly'],['writeonly','allocate']],
+ i = nditer([a,None], [], [['readonly'],['writeonly','allocate']],
op_dtypes=[None,np.dtype('f4')])
assert_equal(i.operands[1].shape, a.shape)
assert_equal(i.operands[1].strides, a.strides)
assert_equal(i.operands[1].dtype, np.dtype('f4'))
# Non-contiguous input, C iteration order
a = arange(24, dtype='i4').reshape(2,3,4).swapaxes(0,1)
- i = newiter([a,None], [],
+ i = nditer([a,None], [],
[['readonly'],['writeonly','allocate']],
order='C',
op_dtypes=[None,np.dtype('f4')])
@@ -1198,7 +1261,7 @@ def test_iter_allocate_output_opaxes():
# Specifing op_axes should work
a = arange(24, dtype='i4').reshape(2,3,4)
- i = newiter([None,a], [], [['writeonly','allocate'],['readonly']],
+ i = nditer([None,a], [], [['writeonly','allocate'],['readonly']],
op_dtypes=[np.dtype('u4'),None],
op_axes=[[1,2,0],None]);
assert_equal(i.operands[0].shape, (4,2,3))
@@ -1208,19 +1271,19 @@ def test_iter_allocate_output_opaxes():
def test_iter_allocate_output_types_promotion():
# Check type promotion of automatic outputs
- i = newiter([array([3],dtype='f4'),array([0],dtype='f8'),None], [],
+ i = nditer([array([3],dtype='f4'),array([0],dtype='f8'),None], [],
[['readonly']]*2+[['writeonly','allocate']])
assert_equal(i.dtypes[2], np.dtype('f8'));
- i = newiter([array([3],dtype='i4'),array([0],dtype='f4'),None], [],
+ i = nditer([array([3],dtype='i4'),array([0],dtype='f4'),None], [],
[['readonly']]*2+[['writeonly','allocate']])
assert_equal(i.dtypes[2], np.dtype('f8'));
- i = newiter([array([3],dtype='f4'),array(0,dtype='f8'),None], [],
+ i = nditer([array([3],dtype='f4'),array(0,dtype='f8'),None], [],
[['readonly']]*2+[['writeonly','allocate']])
assert_equal(i.dtypes[2], np.dtype('f4'));
- i = newiter([array([3],dtype='u4'),array(0,dtype='i4'),None], [],
+ i = nditer([array([3],dtype='u4'),array(0,dtype='i4'),None], [],
[['readonly']]*2+[['writeonly','allocate']])
assert_equal(i.dtypes[2], np.dtype('u4'));
- i = newiter([array([3],dtype='u4'),array(-12,dtype='i4'),None], [],
+ i = nditer([array([3],dtype='u4'),array(-12,dtype='i4'),None], [],
[['readonly']]*2+[['writeonly','allocate']])
assert_equal(i.dtypes[2], np.dtype('i8'));
@@ -1229,11 +1292,11 @@ def test_iter_allocate_output_types_byte_order():
# When there's just one input, the output type exactly matches
a = array([3],dtype='u4').newbyteorder()
- i = newiter([a,None], [],
+ i = nditer([a,None], [],
[['readonly'],['writeonly','allocate']])
assert_equal(i.dtypes[0], i.dtypes[1]);
# With two or more inputs, the output type is in native byte order
- i = newiter([a,a,None], [],
+ i = nditer([a,a,None], [],
[['readonly'],['readonly'],['writeonly','allocate']])
assert_(i.dtypes[0] != i.dtypes[2]);
assert_equal(i.dtypes[0].newbyteorder('='), i.dtypes[2])
@@ -1241,7 +1304,7 @@ def test_iter_allocate_output_types_byte_order():
def test_iter_allocate_output_types_scalar():
# If the inputs are all scalars, the output should be a scalar
- i = newiter([None,1,2.3,np.float32(12),np.complex128(3)],[],
+ i = nditer([None,1,2.3,np.float32(12),np.complex128(3)],[],
[['writeonly','allocate']] + [['readonly']]*4)
assert_equal(i.operands[0].dtype, np.dtype('complex128'))
assert_equal(i.operands[0].ndim, 0)
@@ -1252,7 +1315,7 @@ def test_iter_allocate_output_subtype():
# matrix vs ndarray
a = np.matrix([[1,2], [3,4]])
b = np.arange(4).reshape(2,2).T
- i = newiter([a,b,None], [],
+ i = nditer([a,b,None], [],
[['readonly'],['readonly'],['writeonly','allocate']])
assert_equal(type(a), type(i.operands[2]))
assert_(type(b) != type(i.operands[2]))
@@ -1260,10 +1323,10 @@ def test_iter_allocate_output_subtype():
# matrix always wants things to be 2D
b = np.arange(4).reshape(1,2,2)
- assert_raises(RuntimeError, newiter, [a,b,None], [],
+ assert_raises(RuntimeError, nditer, [a,b,None], [],
[['readonly'],['readonly'],['writeonly','allocate']])
# but if subtypes are disabled, the result can still work
- i = newiter([a,b,None], [],
+ i = nditer([a,b,None], [],
[['readonly'],['readonly'],['writeonly','allocate','no_subtype']])
assert_equal(type(b), type(i.operands[2]))
assert_(type(a) != type(i.operands[2]))
@@ -1274,32 +1337,32 @@ def test_iter_allocate_output_errors():
# Need an input if no output data type is specified
a = arange(6)
- assert_raises(TypeError, newiter, [a,None], [],
+ assert_raises(TypeError, nditer, [a,None], [],
[['writeonly'],['writeonly','allocate']])
# Allocated output should be flagged for writing
- assert_raises(ValueError, newiter, [a,None], [],
+ assert_raises(ValueError, nditer, [a,None], [],
[['readonly'],['allocate','readonly']])
# Allocated output can't have buffering without delayed bufalloc
- assert_raises(ValueError, newiter, [a,None], ['buffered'],
+ assert_raises(ValueError, nditer, [a,None], ['buffered'],
['allocate','readwrite'])
# Must specify at least one input
- assert_raises(ValueError, newiter, [None,None], [],
+ assert_raises(ValueError, nditer, [None,None], [],
[['writeonly','allocate'],
['writeonly','allocate']],
op_dtypes=[np.dtype('f4'),np.dtype('f4')])
# If using op_axes, must specify all the axes
a = arange(24, dtype='i4').reshape(2,3,4)
- assert_raises(ValueError, newiter, [a,None], [],
+ assert_raises(ValueError, nditer, [a,None], [],
[['readonly'],['writeonly','allocate']],
op_dtypes=[None,np.dtype('f4')],
op_axes=[None,[0,np.newaxis,1]])
# If using op_axes, the axes must be within bounds
- assert_raises(ValueError, newiter, [a,None], [],
+ assert_raises(ValueError, nditer, [a,None], [],
[['readonly'],['writeonly','allocate']],
op_dtypes=[None,np.dtype('f4')],
op_axes=[None,[0,3,1]])
# If using op_axes, there can't be duplicates
- assert_raises(ValueError, newiter, [a,None], [],
+ assert_raises(ValueError, nditer, [a,None], [],
[['readonly'],['writeonly','allocate']],
op_dtypes=[None,np.dtype('f4')],
op_axes=[None,[0,2,1,0]])
@@ -1307,12 +1370,12 @@ def test_iter_allocate_output_errors():
def test_iter_remove_axis():
a = arange(24).reshape(2,3,4)
- i = newiter(a,['coords'])
+ i = nditer(a,['coords'])
i.remove_axis(1)
assert_equal([x for x in i], a[:,0,:].ravel())
a = a[::-1,:,:]
- i = newiter(a,['coords'])
+ i = nditer(a,['coords'])
i.remove_axis(0)
assert_equal([x for x in i], a[0,:,:].ravel())
@@ -1321,7 +1384,7 @@ def test_iter_remove_coords_inner_loop():
a = arange(24).reshape(2,3,4)
- i = newiter(a,['coords'])
+ i = nditer(a,['coords'])
assert_equal(i.ndim, 3)
assert_equal(i.shape, (2,3,4))
assert_equal(i.itviews[0].shape, (2,3,4))
@@ -1340,7 +1403,7 @@ def test_iter_remove_coords_inner_loop():
i.reset()
assert_equal(i.itersize, 24)
assert_equal(i[0].shape, tuple())
- i.remove_inner_loop()
+ i.enable_external_loop()
assert_equal(i.itersize, 24)
assert_equal(i[0].shape, (24,))
assert_equal(i.value, arange(24))
@@ -1351,27 +1414,27 @@ def test_iter_iterindex():
buffersize = 5
a = arange(24).reshape(4,3,2)
for flags in ([], ['buffered']):
- i = newiter(a, flags, buffersize=buffersize)
+ i = nditer(a, flags, buffersize=buffersize)
assert_equal(iter_iterindices(i), range(24))
i.iterindex = 2
assert_equal(iter_iterindices(i), range(2,24))
- i = newiter(a, flags, order='F', buffersize=buffersize)
+ i = nditer(a, flags, order='F', buffersize=buffersize)
assert_equal(iter_iterindices(i), range(24))
i.iterindex = 5
assert_equal(iter_iterindices(i), range(5,24))
- i = newiter(a[::-1], flags, order='F', buffersize=buffersize)
+ i = nditer(a[::-1], flags, order='F', buffersize=buffersize)
assert_equal(iter_iterindices(i), range(24))
i.iterindex = 9
assert_equal(iter_iterindices(i), range(9,24))
- i = newiter(a[::-1,::-1], flags, order='C', buffersize=buffersize)
+ i = nditer(a[::-1,::-1], flags, order='C', buffersize=buffersize)
assert_equal(iter_iterindices(i), range(24))
i.iterindex = 13
assert_equal(iter_iterindices(i), range(13,24))
- i = newiter(a[::1,::-1], flags, buffersize=buffersize)
+ i = nditer(a[::1,::-1], flags, buffersize=buffersize)
assert_equal(iter_iterindices(i), range(24))
i.iterindex = 23
assert_equal(iter_iterindices(i), range(23,24))
@@ -1386,7 +1449,7 @@ def test_iter_iterrange():
a = arange(24, dtype='i4').reshape(4,3,2)
a_fort = a.ravel(order='F')
- i = newiter(a, ['ranged'], ['readonly'], order='F',
+ i = nditer(a, ['ranged'], ['readonly'], order='F',
buffersize=buffersize)
assert_equal(i.iterrange, (0,24))
assert_equal([x[()] for x in i], a_fort)
@@ -1395,7 +1458,7 @@ def test_iter_iterrange():
assert_equal(i.iterrange, r)
assert_equal([x[()] for x in i], a_fort[r[0]:r[1]])
- i = newiter(a, ['ranged','buffered'], ['readonly'], order='F',
+ i = nditer(a, ['ranged','buffered'], ['readonly'], order='F',
op_dtypes='f8', buffersize=buffersize)
assert_equal(i.iterrange, (0,24))
assert_equal([x[()] for x in i], a_fort)
@@ -1410,7 +1473,7 @@ def test_iter_iterrange():
val = np.concatenate((val, x))
return val
- i = newiter(a, ['ranged','buffered','no_inner_iteration'],
+ i = nditer(a, ['ranged','buffered','external_loop'],
['readonly'], order='F',
op_dtypes='f8', buffersize=buffersize)
assert_equal(i.iterrange, (0,24))
@@ -1438,7 +1501,7 @@ def test_iter_buffering():
for a in arrays:
for buffersize in (1,2,3,5,8,11,16,1024):
vals = []
- i = newiter(a, ['buffered','no_inner_iteration'],
+ i = nditer(a, ['buffered','external_loop'],
[['readonly','nbo','aligned']],
order='C',
casting='equiv',
@@ -1454,7 +1517,7 @@ def test_iter_write_buffering():
# F-order swapped array
a = np.arange(24).reshape(2,3,4).T.newbyteorder().byteswap()
- i = newiter(a, ['buffered'],
+ i = nditer(a, ['buffered'],
[['readwrite','nbo','aligned']],
casting='equiv',
order='C',
@@ -1471,7 +1534,7 @@ def test_iter_buffering_delayed_alloc():
a = np.arange(6)
b = np.arange(1, dtype='f4')
- i = newiter([a,b], ['buffered','delay_bufalloc','coords','reduce_ok'],
+ i = nditer([a,b], ['buffered','delay_bufalloc','coords','reduce_ok'],
['readwrite'],
casting='unsafe',
op_dtypes='f4')
@@ -1495,7 +1558,7 @@ def test_iter_buffered_cast_simple():
# Test that buffering can handle a simple cast
a = np.arange(10, dtype='f4')
- i = newiter(a, ['buffered','no_inner_iteration'],
+ i = nditer(a, ['buffered','external_loop'],
[['readwrite','nbo','aligned']],
casting='same_kind',
op_dtypes=[np.dtype('f8')],
@@ -1509,7 +1572,7 @@ def test_iter_buffered_cast_byteswapped():
# Test that buffering can handle a cast which requires swap->cast->swap
a = np.arange(10, dtype='f4').newbyteorder().byteswap()
- i = newiter(a, ['buffered','no_inner_iteration'],
+ i = nditer(a, ['buffered','external_loop'],
[['readwrite','nbo','aligned']],
casting='same_kind',
op_dtypes=[np.dtype('f8').newbyteorder()],
@@ -1523,7 +1586,7 @@ def test_iter_buffered_cast_byteswapped():
warnings.simplefilter("ignore", np.ComplexWarning)
a = np.arange(10, dtype='f8').newbyteorder().byteswap()
- i = newiter(a, ['buffered','no_inner_iteration'],
+ i = nditer(a, ['buffered','external_loop'],
[['readwrite','nbo','aligned']],
casting='unsafe',
op_dtypes=[np.dtype('c8').newbyteorder()],
@@ -1540,7 +1603,7 @@ def test_iter_buffered_cast_byteswapped_complex():
a = np.arange(10, dtype='c8').newbyteorder().byteswap()
a += 2j
- i = newiter(a, ['buffered','no_inner_iteration'],
+ i = nditer(a, ['buffered','external_loop'],
[['readwrite','nbo','aligned']],
casting='same_kind',
op_dtypes=[np.dtype('c16')],
@@ -1551,7 +1614,7 @@ def test_iter_buffered_cast_byteswapped_complex():
a = np.arange(10, dtype='c8')
a += 2j
- i = newiter(a, ['buffered','no_inner_iteration'],
+ i = nditer(a, ['buffered','external_loop'],
[['readwrite','nbo','aligned']],
casting='same_kind',
op_dtypes=[np.dtype('c16').newbyteorder()],
@@ -1562,7 +1625,7 @@ def test_iter_buffered_cast_byteswapped_complex():
a = np.arange(10, dtype=np.clongdouble).newbyteorder().byteswap()
a += 2j
- i = newiter(a, ['buffered','no_inner_iteration'],
+ i = nditer(a, ['buffered','external_loop'],
[['readwrite','nbo','aligned']],
casting='same_kind',
op_dtypes=[np.dtype('c16')],
@@ -1572,7 +1635,7 @@ def test_iter_buffered_cast_byteswapped_complex():
assert_equal(a, 2*np.arange(10, dtype=np.clongdouble) + 4j)
a = np.arange(10, dtype=np.longdouble).newbyteorder().byteswap()
- i = newiter(a, ['buffered','no_inner_iteration'],
+ i = nditer(a, ['buffered','external_loop'],
[['readwrite','nbo','aligned']],
casting='same_kind',
op_dtypes=[np.dtype('f4')],
@@ -1587,7 +1650,7 @@ def test_iter_buffered_cast_structured_type():
# simple -> struct type (duplicates the value)
sdt = [('a', 'f4'), ('b', 'i8'), ('c', 'c8', (2,3)), ('d', 'O')]
a = np.arange(3, dtype='f4') + 0.5
- i = newiter(a, ['buffered','refs_ok'], ['readonly'],
+ i = nditer(a, ['buffered','refs_ok'], ['readonly'],
casting='unsafe',
op_dtypes=sdt)
vals = [np.array(x) for x in i]
@@ -1605,7 +1668,7 @@ def test_iter_buffered_cast_structured_type():
sdt = [('a', 'f4'), ('b', 'i8'), ('c', 'c8', (2,3)), ('d', 'O')]
a = np.arange(3, dtype='O') + 0.5
rc = sys.getrefcount(a[0])
- i = newiter(a, ['buffered','refs_ok'], ['readonly'],
+ i = nditer(a, ['buffered','refs_ok'], ['readonly'],
casting='unsafe',
op_dtypes=sdt)
vals = [np.array(x) for x in i]
@@ -1624,7 +1687,7 @@ def test_iter_buffered_cast_structured_type():
# struct type -> simple (takes the first value)
sdt = [('a', 'f4'), ('b', 'i8'), ('d', 'O')]
a = np.array([(5.5,7,'test'),(8,10,11)], dtype=sdt)
- i = newiter(a, ['buffered','refs_ok'], ['readonly'],
+ i = nditer(a, ['buffered','refs_ok'], ['readonly'],
casting='unsafe',
op_dtypes='i4')
assert_equal([x[()] for x in i], [5, 8])
@@ -1633,7 +1696,7 @@ def test_iter_buffered_cast_structured_type():
sdt1 = [('a', 'f4'), ('b', 'i8'), ('d', 'O')]
sdt2 = [('d', 'u2'), ('a', 'O'), ('b', 'f8')]
a = np.array([(1,2,3),(4,5,6)], dtype=sdt1)
- i = newiter(a, ['buffered','refs_ok'], ['readonly'],
+ i = nditer(a, ['buffered','refs_ok'], ['readonly'],
casting='unsafe',
op_dtypes=sdt2)
assert_equal(i[0].dtype, np.dtype(sdt2))
@@ -1645,7 +1708,7 @@ def test_iter_buffered_cast_structured_type():
sdt1 = [('a', 'f4'), ('b', 'i8'), ('d', 'O')]
sdt2 = [('b', 'O'), ('a', 'f8')]
a = np.array([(1,2,3),(4,5,6)], dtype=sdt1)
- i = newiter(a, ['buffered','refs_ok'], ['readwrite'],
+ i = nditer(a, ['buffered','refs_ok'], ['readwrite'],
casting='unsafe',
op_dtypes=sdt2)
assert_equal(i[0].dtype, np.dtype(sdt2))
@@ -1661,7 +1724,7 @@ def test_iter_buffered_cast_structured_type():
sdt1 = [('a', 'f4'), ('b', 'i8'), ('d', [('a', 'i2'),('b','i4')])]
sdt2 = [('b', 'O'), ('a', 'f8')]
a = np.array([(1,2,(0,9)),(4,5,(20,21))], dtype=sdt1)
- i = newiter(a, ['buffered','refs_ok'], ['readwrite'],
+ i = nditer(a, ['buffered','refs_ok'], ['readwrite'],
casting='unsafe',
op_dtypes=sdt2)
assert_equal(i[0].dtype, np.dtype(sdt2))
@@ -1677,7 +1740,7 @@ def test_iter_buffered_cast_structured_type():
sdt1 = [('a', 'f4'), ('b', 'i8'), ('d', [('a', 'i2'),('b','O')])]
sdt2 = [('b', 'O'), ('a', 'f8')]
a = np.array([(1,2,(0,9)),(4,5,(20,21))], dtype=sdt1)
- i = newiter(a, ['buffered','refs_ok'], ['readwrite'],
+ i = nditer(a, ['buffered','refs_ok'], ['readwrite'],
casting='unsafe',
op_dtypes=sdt2)
assert_equal(i[0].dtype, np.dtype(sdt2))
@@ -1693,7 +1756,7 @@ def test_iter_buffered_cast_structured_type():
sdt1 = [('b', 'O'), ('a', 'f8')]
sdt2 = [('a', 'f4'), ('b', 'i8'), ('d', [('a', 'i2'),('b','O')])]
a = np.array([(1,2),(4,5)], dtype=sdt1)
- i = newiter(a, ['buffered','refs_ok'], ['readwrite'],
+ i = nditer(a, ['buffered','refs_ok'], ['readwrite'],
casting='unsafe',
op_dtypes=sdt2)
assert_equal(i[0].dtype, np.dtype(sdt2))
@@ -1714,7 +1777,7 @@ def test_iter_buffered_cast_subarray():
sdt2 = [('a', 'f8', (3,2,2))]
a = np.zeros((6,), dtype=sdt1)
a['a'] = np.arange(6)
- i = newiter(a, ['buffered','refs_ok'], ['readonly'],
+ i = nditer(a, ['buffered','refs_ok'], ['readonly'],
casting='unsafe',
op_dtypes=sdt2)
assert_equal(i[0].dtype, np.dtype(sdt2))
@@ -1726,7 +1789,7 @@ def test_iter_buffered_cast_subarray():
sdt2 = [('a', 'O', (3,2,2))]
a = np.zeros((6,), dtype=sdt1)
a['a'][:,0,0] = np.arange(6)
- i = newiter(a, ['buffered','refs_ok'], ['readwrite'],
+ i = nditer(a, ['buffered','refs_ok'], ['readwrite'],
casting='unsafe',
op_dtypes=sdt2)
assert_equal(i[0].dtype, np.dtype(sdt2))
@@ -1742,7 +1805,7 @@ def test_iter_buffered_cast_subarray():
sdt2 = [('a', 'O', (1,))]
a = np.zeros((6,), dtype=sdt1)
a['a'][:,0,0,0] = np.arange(6)
- i = newiter(a, ['buffered','refs_ok'], ['readwrite'],
+ i = nditer(a, ['buffered','refs_ok'], ['readwrite'],
casting='unsafe',
op_dtypes=sdt2)
assert_equal(i[0].dtype, np.dtype(sdt2))
@@ -1758,7 +1821,7 @@ def test_iter_buffered_cast_subarray():
sdt2 = [('a', 'O', (1,))]
a = np.zeros((6,), dtype=sdt1)
a['a'][:,0,0,0] = np.arange(6)
- i = newiter(a, ['buffered','refs_ok'], ['readonly'],
+ i = nditer(a, ['buffered','refs_ok'], ['readonly'],
casting='unsafe',
op_dtypes=sdt2)
assert_equal(i[0].dtype, np.dtype(sdt2))
@@ -1772,7 +1835,7 @@ def test_iter_buffered_cast_subarray():
sdt2 = [('a', 'f4', (1,))]
a = np.zeros((6,), dtype=sdt1)
a['a'][:,0,0,0] = np.arange(6)
- i = newiter(a, ['buffered','refs_ok'], ['readonly'],
+ i = nditer(a, ['buffered','refs_ok'], ['readonly'],
casting='unsafe',
op_dtypes=sdt2)
assert_equal(i[0].dtype, np.dtype(sdt2))
@@ -1786,7 +1849,7 @@ def test_iter_buffered_cast_subarray():
sdt2 = [('a', 'f4', (3,2,2))]
a = np.zeros((6,), dtype=sdt1)
a['a'] = np.arange(6*3*2*2).reshape(6,3,2,2)
- i = newiter(a, ['buffered','refs_ok'], ['readonly'],
+ i = nditer(a, ['buffered','refs_ok'], ['readonly'],
casting='unsafe',
op_dtypes=sdt2)
assert_equal(i[0].dtype, np.dtype(sdt2))
@@ -1800,7 +1863,7 @@ def test_iter_buffered_cast_subarray():
sdt2 = [('a', 'f4', (2,))]
a = np.zeros((6,), dtype=sdt1)
a['a'] = np.arange(6*6).reshape(6,6)
- i = newiter(a, ['buffered','refs_ok'], ['readonly'],
+ i = nditer(a, ['buffered','refs_ok'], ['readonly'],
casting='unsafe',
op_dtypes=sdt2)
assert_equal(i[0].dtype, np.dtype(sdt2))
@@ -1814,7 +1877,7 @@ def test_iter_buffered_cast_subarray():
sdt2 = [('a', 'f4', (6,))]
a = np.zeros((6,), dtype=sdt1)
a['a'] = np.arange(6*2).reshape(6,2)
- i = newiter(a, ['buffered','refs_ok'], ['readonly'],
+ i = nditer(a, ['buffered','refs_ok'], ['readonly'],
casting='unsafe',
op_dtypes=sdt2)
assert_equal(i[0].dtype, np.dtype(sdt2))
@@ -1829,7 +1892,7 @@ def test_iter_buffered_cast_subarray():
sdt2 = [('a', 'f4', (2,2))]
a = np.zeros((6,), dtype=sdt1)
a['a'] = np.arange(6*2).reshape(6,2)
- i = newiter(a, ['buffered','refs_ok'], ['readonly'],
+ i = nditer(a, ['buffered','refs_ok'], ['readonly'],
casting='unsafe',
op_dtypes=sdt2)
assert_equal(i[0].dtype, np.dtype(sdt2))
@@ -1844,7 +1907,7 @@ def test_iter_buffered_cast_subarray():
sdt2 = [('a', 'f4', (3,2))]
a = np.zeros((6,), dtype=sdt1)
a['a'] = np.arange(6*2).reshape(6,2,1)
- i = newiter(a, ['buffered','refs_ok'], ['readonly'],
+ i = nditer(a, ['buffered','refs_ok'], ['readonly'],
casting='unsafe',
op_dtypes=sdt2)
assert_equal(i[0].dtype, np.dtype(sdt2))
@@ -1860,7 +1923,7 @@ def test_iter_buffered_cast_subarray():
sdt2 = [('a', 'f4', (3,2))]
a = np.zeros((6,), dtype=sdt1)
a['a'] = np.arange(6*2*3).reshape(6,2,3)
- i = newiter(a, ['buffered','refs_ok'], ['readonly'],
+ i = nditer(a, ['buffered','refs_ok'], ['readonly'],
casting='unsafe',
op_dtypes=sdt2)
assert_equal(i[0].dtype, np.dtype(sdt2))
@@ -1877,31 +1940,31 @@ def test_iter_buffering_badwriteback():
# a needs write buffering, but had a broadcast dimension
a = np.arange(6).reshape(2,3,1)
b = np.arange(12).reshape(2,3,2)
- assert_raises(ValueError,newiter,[a,b],
- ['buffered','no_inner_iteration'],
+ assert_raises(ValueError,nditer,[a,b],
+ ['buffered','external_loop'],
[['readwrite'],['writeonly']],
order='C')
# But if a is readonly, it's fine
- i = newiter([a,b],['buffered','no_inner_iteration'],
+ i = nditer([a,b],['buffered','external_loop'],
[['readonly'],['writeonly']],
order='C')
# If a has just one element, it's fine too (constant 0 stride, a reduction)
a = np.arange(1).reshape(1,1,1)
- i = newiter([a,b],['buffered','no_inner_iteration','reduce_ok'],
+ i = nditer([a,b],['buffered','external_loop','reduce_ok'],
[['readwrite'],['writeonly']],
order='C')
# check that it fails on other dimensions too
a = np.arange(6).reshape(1,3,2)
- assert_raises(ValueError,newiter,[a,b],
- ['buffered','no_inner_iteration'],
+ assert_raises(ValueError,nditer,[a,b],
+ ['buffered','external_loop'],
[['readwrite'],['writeonly']],
order='C')
a = np.arange(4).reshape(2,1,2)
- assert_raises(ValueError,newiter,[a,b],
- ['buffered','no_inner_iteration'],
+ assert_raises(ValueError,nditer,[a,b],
+ ['buffered','external_loop'],
[['readwrite'],['writeonly']],
order='C')
@@ -1909,24 +1972,24 @@ def test_iter_buffering_string():
# Safe casting disallows shrinking strings
a = np.array(['abc', 'a', 'abcd'], dtype=np.bytes_)
assert_equal(a.dtype, np.dtype('S4'));
- assert_raises(TypeError,newiter,a,['buffered'],['readonly'],
+ assert_raises(TypeError,nditer,a,['buffered'],['readonly'],
op_dtypes='S2')
- i = newiter(a, ['buffered'], ['readonly'], op_dtypes='S6')
+ i = nditer(a, ['buffered'], ['readonly'], op_dtypes='S6')
assert_equal(i[0], asbytes('abc'))
assert_equal(i[0].dtype, np.dtype('S6'))
a = np.array(['abc', 'a', 'abcd'], dtype=np.unicode)
assert_equal(a.dtype, np.dtype('U4'));
- assert_raises(TypeError,newiter,a,['buffered'],['readonly'],
+ assert_raises(TypeError,nditer,a,['buffered'],['readonly'],
op_dtypes='U2')
- i = newiter(a, ['buffered'], ['readonly'], op_dtypes='U6')
+ i = nditer(a, ['buffered'], ['readonly'], op_dtypes='U6')
assert_equal(i[0], u'abc')
assert_equal(i[0].dtype, np.dtype('U6'))
def test_iter_buffering_growinner():
# Test that the inner loop grows when no buffering is needed
a = np.arange(30)
- i = newiter(a, ['buffered','growinner','no_inner_iteration'],
+ i = nditer(a, ['buffered','growinner','external_loop'],
buffersize=5)
# Should end up with just one inner loop here
assert_equal(i[0].size, a.size)
@@ -1937,11 +2000,11 @@ def test_iter_no_broadcast():
b = np.arange(6).reshape(2,3,1)
c = np.arange(12).reshape(3,4)
- i = newiter([a,b,c], [],
+ i = nditer([a,b,c], [],
[['readonly','no_broadcast'],['readonly'],['readonly']])
- assert_raises(ValueError, newiter, [a,b,c], [],
+ assert_raises(ValueError, nditer, [a,b,c], [],
[['readonly'],['readonly','no_broadcast'],['readonly']])
- assert_raises(ValueError, newiter, [a,b,c], [],
+ assert_raises(ValueError, nditer, [a,b,c], [],
[['readonly'],['readonly'],['readonly','no_broadcast']])
def test_iter_nested_iters_basic():
@@ -2114,12 +2177,12 @@ def test_iter_nested_iters_dtype_buffered():
def test_iter_reduction_error():
a = np.arange(6)
- assert_raises(ValueError, newiter, [a,None], [],
+ assert_raises(ValueError, nditer, [a,None], [],
[['readonly'], ['readwrite','allocate']],
op_axes=[[0],[-1]])
a = np.arange(6).reshape(2,3)
- assert_raises(ValueError, newiter, [a,None], ['no_inner_iteration'],
+ assert_raises(ValueError, nditer, [a,None], ['external_loop'],
[['readonly'], ['readwrite','allocate']],
op_axes=[[0,1],[-1,-1]])
@@ -2127,7 +2190,7 @@ def test_iter_reduction():
# Test doing reductions with the iterator
a = np.arange(6)
- i = newiter([a,None], ['reduce_ok'],
+ i = nditer([a,None], ['reduce_ok'],
[['readonly'], ['readwrite','allocate']],
op_axes=[[0],[-1]])
# Need to initialize the output operand to the addition unit
@@ -2140,7 +2203,7 @@ def test_iter_reduction():
assert_equal(i.operands[1], np.sum(a))
a = np.arange(6).reshape(2,3)
- i = newiter([a,None], ['reduce_ok','no_inner_iteration'],
+ i = nditer([a,None], ['reduce_ok','external_loop'],
[['readonly'], ['readwrite','allocate']],
op_axes=[[0,1],[-1,-1]])
# Need to initialize the output operand to the addition unit
@@ -2161,7 +2224,7 @@ def test_iter_buffering_reduction():
a = np.arange(6)
b = np.array(0., dtype='f8').byteswap().newbyteorder()
- i = newiter([a,b], ['reduce_ok', 'buffered'],
+ i = nditer([a,b], ['reduce_ok', 'buffered'],
[['readonly'], ['readwrite','nbo']],
op_axes=[[0],[-1]])
assert_equal(i[1].dtype, np.dtype('f8'))
@@ -2174,7 +2237,7 @@ def test_iter_buffering_reduction():
a = np.arange(6).reshape(2,3)
b = np.array([0,0], dtype='f8').byteswap().newbyteorder()
- i = newiter([a,b], ['reduce_ok','no_inner_iteration', 'buffered'],
+ i = nditer([a,b], ['reduce_ok','external_loop', 'buffered'],
[['readonly'], ['readwrite','nbo']],
op_axes=[[0,1],[0,-1]])
# Reduction shape/strides for the output
diff --git a/numpy/core/tests/test_memmap.py b/numpy/core/tests/test_memmap.py
index 9e3cf2039..18b356ce2 100644
--- a/numpy/core/tests/test_memmap.py
+++ b/numpy/core/tests/test_memmap.py
@@ -4,7 +4,7 @@ import warnings
from numpy import memmap
from numpy import arange, allclose
-from numpy.testing import *
+from numpy.testing import TestCase, assert_, assert_array_equal
class TestMemmap(TestCase):
def setUp(self):
@@ -27,7 +27,7 @@ class TestMemmap(TestCase):
# Read data back from file
newfp = memmap(self.tmpfp, dtype=self.dtype, mode='r',
shape=self.shape)
- assert allclose(self.data, newfp)
+ assert_(allclose(self.data, newfp))
assert_array_equal(self.data, newfp)
def test_open_with_filename(self):
@@ -71,10 +71,6 @@ class TestMemmap(TestCase):
fp[:] = self.data[:]
fp.flush()
- warnings.simplefilter('ignore', DeprecationWarning)
- fp.sync()
- warnings.simplefilter('default', DeprecationWarning)
-
def test_del(self):
# Make sure a view does not delete the underlying mmap
fp_base = memmap(self.tmpfp, dtype=self.dtype, mode='w+',
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py
index f1165999e..811fb33ab 100644
--- a/numpy/core/tests/test_multiarray.py
+++ b/numpy/core/tests/test_multiarray.py
@@ -112,6 +112,30 @@ class TestAttributes(TestCase):
x.fill(x[0])
assert_equal(x['f1'][1], x['f1'][0])
+class TestAssignment(TestCase):
+ def test_assignment_broadcasting(self):
+ a = np.arange(6).reshape(2,3)
+
+ # Broadcasting the input to the output
+ a[...] = np.arange(3)
+ assert_equal(a, [[0,1,2],[0,1,2]])
+ a[...] = np.arange(2).reshape(2,1)
+ assert_equal(a, [[0,0,0],[1,1,1]])
+
+ # For compatibility with <= 1.5, a limited version of broadcasting
+ # the output to the input.
+ #
+ # This behavior is inconsistent with NumPy broadcasting
+ # in general, because it only uses one of the two broadcasting
+ # rules (adding a new "1" dimension to the left of the shape),
+ # applied to the output instead of an input. In NumPy 2.0, this kind
+ # of broadcasting assignment will likely be disallowed.
+ a[...] = np.arange(6)[::-1].reshape(1,2,3)
+ assert_equal(a, [[5,4,3],[2,1,0]])
+ # The other type of broadcasting would require a reduction operation.
+ def assign(a,b):
+ a[...] = b
+ assert_raises(ValueError, assign, a, np.arange(12).reshape(2,2,3))
class TestDtypedescr(TestCase):
def test_construction(self):
@@ -302,6 +326,35 @@ class TestCreation(TestCase):
msg = 'String conversion for %s' % type
assert_equal(array(nstr, dtype=type), result, err_msg=msg)
+ def test_non_sequence_sequence(self):
+ """Should not segfault.
+
+ Class Fail breaks the sequence protocol for new style classes, i.e.,
+ those derived from object. Class Map is a mapping type indicated by
+ raising a ValueError. At some point we may raise a warning instead
+ of an error in the Fail case.
+
+ """
+ class Fail(object):
+ def __len__(self):
+ return 1
+
+ def __getitem__(self, index):
+ raise ValueError()
+
+ class Map(object):
+ def __len__(self):
+ return 1
+
+ def __getitem__(self, index):
+ raise KeyError()
+
+ a = np.array([Map()])
+ assert_(a.shape == (1,))
+ assert_(a.dtype == np.dtype(object))
+ assert_raises(ValueError, np.array, [Fail()])
+
+
class TestStructured(TestCase):
def test_subarray_field_access(self):
a = np.zeros((3, 5), dtype=[('a', ('i4', (2, 2)))])
diff --git a/numpy/core/tests/test_regression.py b/numpy/core/tests/test_regression.py
index 3fbbb71df..5458fac33 100644
--- a/numpy/core/tests/test_regression.py
+++ b/numpy/core/tests/test_regression.py
@@ -1535,5 +1535,32 @@ class TestRegression(TestCase):
a[()] = np.array(4)
assert_equal(a, np.array(4))
+ def test_string_astype(self):
+ "Ticket #1748"
+ s1 = asbytes('black')
+ s2 = asbytes('white')
+ s3 = asbytes('other')
+ a = np.array([[s1],[s2],[s3]])
+ assert_equal(a.dtype, np.dtype('S5'))
+ b = a.astype('str')
+ assert_equal(b.dtype, np.dtype('S5'))
+
+ def test_string_astype(self):
+ """Ticket #1756 """
+ s = asbytes('0123456789abcdef')
+ a = np.array([s]*5)
+ for i in range(1,17):
+ a1 = np.array(a, "|S%d"%i)
+ a2 = np.array([s[:i]]*5)
+ assert_equal(a1, a2)
+
+ def test_fields_strides(self):
+ "Ticket #1760"
+ r=np.fromstring('abcdefghijklmnop'*4*3, dtype='i4,(2,3)u2')
+ assert_equal(r[0:3:2]['f1'], r['f1'][0:3:2])
+ assert_equal(r[0:3:2]['f1'][0], r[0:3:2][0]['f1'])
+ assert_equal(r[0:3:2]['f1'][0][()], r[0:3:2][0]['f1'][()])
+ assert_equal(r[0:3:2]['f1'][0].strides, r[0:3:2][0]['f1'].strides)
+
if __name__ == "__main__":
run_module_suite()
diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py
index 40b78fdb5..b5f9d5745 100644
--- a/numpy/core/tests/test_umath.py
+++ b/numpy/core/tests/test_umath.py
@@ -413,6 +413,27 @@ class TestLdexp(TestCase):
class TestMaximum(TestCase):
+ def test_reduce(self):
+ dflt = np.typecodes['AllFloat']
+ dint = np.typecodes['AllInteger']
+ seq1 = np.arange(11)
+ seq2 = seq1[::-1]
+ func = np.maximum.reduce
+ for dt in dint:
+ tmp1 = seq1.astype(dt)
+ tmp2 = seq2.astype(dt)
+ assert_equal(func(tmp1), 10)
+ assert_equal(func(tmp2), 10)
+ for dt in dflt:
+ tmp1 = seq1.astype(dt)
+ tmp2 = seq2.astype(dt)
+ assert_equal(func(tmp1), 10)
+ assert_equal(func(tmp2), 10)
+ tmp1[::2] = np.nan
+ tmp2[::2] = np.nan
+ assert_equal(func(tmp1), np.nan)
+ assert_equal(func(tmp2), np.nan)
+
def test_reduce_complex(self):
assert_equal(np.maximum.reduce([1,2j]),1)
assert_equal(np.maximum.reduce([1+3j,2j]),1+3j)
@@ -434,6 +455,27 @@ class TestMaximum(TestCase):
class TestMinimum(TestCase):
+ def test_reduce(self):
+ dflt = np.typecodes['AllFloat']
+ dint = np.typecodes['AllInteger']
+ seq1 = np.arange(11)
+ seq2 = seq1[::-1]
+ func = np.minimum.reduce
+ for dt in dint:
+ tmp1 = seq1.astype(dt)
+ tmp2 = seq2.astype(dt)
+ assert_equal(func(tmp1), 0)
+ assert_equal(func(tmp2), 0)
+ for dt in dflt:
+ tmp1 = seq1.astype(dt)
+ tmp2 = seq2.astype(dt)
+ assert_equal(func(tmp1), 0)
+ assert_equal(func(tmp2), 0)
+ tmp1[::2] = np.nan
+ tmp2[::2] = np.nan
+ assert_equal(func(tmp1), np.nan)
+ assert_equal(func(tmp2), np.nan)
+
def test_reduce_complex(self):
assert_equal(np.minimum.reduce([1,2j]),2j)
assert_equal(np.minimum.reduce([1+3j,2j]),2j)
@@ -455,6 +497,27 @@ class TestMinimum(TestCase):
class TestFmax(TestCase):
+ def test_reduce(self):
+ dflt = np.typecodes['AllFloat']
+ dint = np.typecodes['AllInteger']
+ seq1 = np.arange(11)
+ seq2 = seq1[::-1]
+ func = np.fmax.reduce
+ for dt in dint:
+ tmp1 = seq1.astype(dt)
+ tmp2 = seq2.astype(dt)
+ assert_equal(func(tmp1), 10)
+ assert_equal(func(tmp2), 10)
+ for dt in dflt:
+ tmp1 = seq1.astype(dt)
+ tmp2 = seq2.astype(dt)
+ assert_equal(func(tmp1), 10)
+ assert_equal(func(tmp2), 10)
+ tmp1[::2] = np.nan
+ tmp2[::2] = np.nan
+ assert_equal(func(tmp1), 9)
+ assert_equal(func(tmp2), 9)
+
def test_reduce_complex(self):
assert_equal(np.fmax.reduce([1,2j]),1)
assert_equal(np.fmax.reduce([1+3j,2j]),1+3j)
@@ -476,6 +539,27 @@ class TestFmax(TestCase):
class TestFmin(TestCase):
+ def test_reduce(self):
+ dflt = np.typecodes['AllFloat']
+ dint = np.typecodes['AllInteger']
+ seq1 = np.arange(11)
+ seq2 = seq1[::-1]
+ func = np.fmin.reduce
+ for dt in dint:
+ tmp1 = seq1.astype(dt)
+ tmp2 = seq2.astype(dt)
+ assert_equal(func(tmp1), 0)
+ assert_equal(func(tmp2), 0)
+ for dt in dflt:
+ tmp1 = seq1.astype(dt)
+ tmp2 = seq2.astype(dt)
+ assert_equal(func(tmp1), 0)
+ assert_equal(func(tmp2), 0)
+ tmp1[::2] = np.nan
+ tmp2[::2] = np.nan
+ assert_equal(func(tmp1), 1)
+ assert_equal(func(tmp2), 1)
+
def test_reduce_complex(self):
assert_equal(np.fmin.reduce([1,2j]),2j)
assert_equal(np.fmin.reduce([1+3j,2j]),2j)
diff --git a/numpy/core/tests/test_umath_complex.py b/numpy/core/tests/test_umath_complex.py
index 7f964e57e..5cc5d9566 100644
--- a/numpy/core/tests/test_umath_complex.py
+++ b/numpy/core/tests/test_umath_complex.py
@@ -11,15 +11,19 @@ import numpy as np
# At least on Windows the results of many complex functions are not conforming
# to the C99 standard. See ticket 1574.
-# Ditto for Solaris (ticket 1642).
-functions_seem_flaky = ((np.exp(complex(np.inf, 0)).imag != 0)
- or (np.log(complex(np.NZERO, 0)).imag != np.pi))
+# Ditto for Solaris (ticket 1642) and OS X on PowerPC.
+olderr = np.seterr(divide='ignore')
+try:
+ functions_seem_flaky = ((np.exp(complex(np.inf, 0)).imag != 0)
+ or (np.log(complex(np.NZERO, 0)).imag != np.pi))
+finally:
+ np.seterr(**olderr)
# TODO: replace with a check on whether platform-provided C99 funcs are used
-have_platform_functions = (sys.platform.startswith('win')
- or sys.platform.startswith('sunos')
- or (sys.platform == 'darwin' and 'powerpc' in
- platform.processor()))
-skip_complex_tests = have_platform_functions and functions_seem_flaky
+have_platform_functions = (sys.platform.startswith('sunos') or
+ (sys.platform == 'darwin' and 'powerpc' in
+ platform.processor()))
+skip_complex_tests = (sys.platform.startswith('win') or
+ (have_platform_functions and functions_seem_flaky))
def platform_skip(func):
return dec.skipif(skip_complex_tests,
diff --git a/numpy/distutils/ccompiler.py b/numpy/distutils/ccompiler.py
index 0e8f10fcf..14213dc4b 100644
--- a/numpy/distutils/ccompiler.py
+++ b/numpy/distutils/ccompiler.py
@@ -494,10 +494,13 @@ compiler_class['intel'] = ('intelccompiler','IntelCCompiler',
"Intel C Compiler for 32-bit applications")
compiler_class['intele'] = ('intelccompiler','IntelItaniumCCompiler',
"Intel C Itanium Compiler for Itanium-based applications")
+compiler_class['intelem'] = ('intelccompiler','IntelEM64TCCompiler',
+ "Intel C Compiler for 64-bit applications")
compiler_class['pathcc'] = ('pathccompiler','PathScaleCCompiler',
"PathScale Compiler for SiCortex-based applications")
ccompiler._default_compilers += (('linux.*','intel'),
('linux.*','intele'),
+ ('linux.*','intelem'),
('linux.*','pathcc'))
if sys.platform == 'win32':
diff --git a/numpy/distutils/fcompiler/intel.py b/numpy/distutils/fcompiler/intel.py
index d7effb01e..b593a91c7 100644
--- a/numpy/distutils/fcompiler/intel.py
+++ b/numpy/distutils/fcompiler/intel.py
@@ -136,9 +136,9 @@ class IntelItaniumFCompiler(IntelFCompiler):
class IntelEM64TFCompiler(IntelFCompiler):
compiler_type = 'intelem'
compiler_aliases = ()
- description = 'Intel Fortran Compiler for EM64T-based apps'
+ description = 'Intel Fortran Compiler for 64-bit apps'
- version_match = intel_version_match('EM64T-based|Intel\\(R\\) 64')
+ version_match = intel_version_match('EM64T-based|Intel\\(R\\) 64|64|IA-64|64-bit')
possible_executables = ['ifort', 'efort', 'efc']
@@ -165,9 +165,9 @@ class IntelVisualFCompiler(BaseIntelFCompiler):
compiler_type = 'intelv'
description = 'Intel Visual Fortran Compiler for 32-bit apps'
version_match = intel_version_match('32-bit|IA-32')
-
+
def update_executables(self):
- f = dummy_fortran_file()
+ f = dummy_fortran_file()
self.executables['version_cmd'] = ['<F77>', '/FI', '/c',
f + '.f', '/o', f + '.o']
diff --git a/numpy/distutils/intelccompiler.py b/numpy/distutils/intelccompiler.py
index e03c5beba..b82445ab8 100644
--- a/numpy/distutils/intelccompiler.py
+++ b/numpy/distutils/intelccompiler.py
@@ -9,9 +9,11 @@ class IntelCCompiler(UnixCCompiler):
compiler_type = 'intel'
cc_exe = 'icc'
+ cc_args = 'fPIC'
def __init__ (self, verbose=0, dry_run=0, force=0):
UnixCCompiler.__init__ (self, verbose,dry_run, force)
+ self.cc_exe = 'icc -fPIC'
compiler = self.cc_exe
self.set_executables(compiler=compiler,
compiler_so=compiler,
@@ -27,3 +29,21 @@ class IntelItaniumCCompiler(IntelCCompiler):
for cc_exe in map(find_executable,['icc','ecc']):
if cc_exe:
break
+
+class IntelEM64TCCompiler(UnixCCompiler):
+
+""" A modified Intel x86_64 compiler compatible with a 64bit gcc built Python.
+ """
+
+ compiler_type = 'intelem'
+ cc_exe = 'icc -m64 -fPIC'
+ cc_args = "-fPIC"
+ def __init__ (self, verbose=0, dry_run=0, force=0):
+ UnixCCompiler.__init__ (self, verbose,dry_run, force)
+ self.cc_exe = 'icc -m64 -fPIC'
+ compiler = self.cc_exe
+ self.set_executables(compiler=compiler,
+ compiler_so=compiler,
+ compiler_cxx=compiler,
+ linker_exe=compiler,
+ linker_so=compiler + ' -shared')
diff --git a/numpy/distutils/tests/test_fcompiler_intel.py b/numpy/distutils/tests/test_fcompiler_intel.py
new file mode 100644
index 000000000..ad03daeea
--- /dev/null
+++ b/numpy/distutils/tests/test_fcompiler_intel.py
@@ -0,0 +1,34 @@
+from numpy.testing import *
+
+import numpy.distutils.fcompiler
+
+intel_32bit_version_strings = [
+ ("Intel(R) Fortran Intel(R) 32-bit Compiler Professional for applications"\
+ "running on Intel(R) 32, Version 11.1", '11.1'),
+]
+
+intel_64bit_version_strings = [
+ ("Intel(R) Fortran IA-64 Compiler Professional for applications"\
+ "running on IA-64, Version 11.0", '11.0'),
+ ("Intel(R) Fortran Intel(R) 64 Compiler Professional for applications"\
+ "running on Intel(R) 64, Version 11.1", '11.1')
+]
+
+class TestIntelFCompilerVersions(TestCase):
+ def test_32bit_version(self):
+ fc = numpy.distutils.fcompiler.new_fcompiler(compiler='intel')
+ for vs, version in intel_32bit_version_strings:
+ v = fc.version_match(vs)
+ assert_(v == version)
+
+
+class TestIntelEM64TFCompilerVersions(TestCase):
+ def test_64bit_version(self):
+ fc = numpy.distutils.fcompiler.new_fcompiler(compiler='intelem')
+ for vs, version in intel_64bit_version_strings:
+ v = fc.version_match(vs)
+ assert_(v == version)
+
+
+if __name__ == '__main__':
+ run_module_suite()
diff --git a/numpy/doc/structured_arrays.py b/numpy/doc/structured_arrays.py
index a0d84bd79..af777efa4 100644
--- a/numpy/doc/structured_arrays.py
+++ b/numpy/doc/structured_arrays.py
@@ -26,7 +26,7 @@ position we get the second record: ::
Conveniently, one can access any field of the array by indexing using the
string that names that field. In this case the fields have received the
-default names 'f0', 'f1' and 'f2'.
+default names 'f0', 'f1' and 'f2'. ::
>>> y = x['f1']
>>> y
@@ -118,7 +118,7 @@ like Fortran equivalencing).
3) List argument: In this case the record structure is defined with a list of
tuples. Each tuple has 2 or 3 elements specifying: 1) The name of the field
('' is permitted), 2) the type of the field, and 3) the shape (optional).
-For example:
+For example::
>>> x = np.zeros(3, dtype=[('x','f4'),('y',np.float32),('value','f4',(2,2))])
>>> x
@@ -142,7 +142,7 @@ to be strings), where the value of None is permitted. As an example: ::
dtype=[('col1', '>i4'), ('col2', '>f4')])
The other dictionary form permitted is a dictionary of name keys with tuple
-values specifying type, offset, and an optional title.
+values specifying type, offset, and an optional title. ::
>>> x = np.zeros(3, dtype={'col1':('i1',0,'title 1'), 'col2':('f4',1,'title 2')})
>>> x
@@ -168,7 +168,7 @@ Accessing field titles
====================================
The field titles provide a standard place to put associated info for fields.
-They do not have to be strings.
+They do not have to be strings. ::
>>> x.dtype.fields['x'][2]
'title 1'
@@ -181,7 +181,7 @@ You can access multiple fields at once using a list of field names: ::
>>> x = np.array([(1.5,2.5,(1.0,2.0)),(3.,4.,(4.,5.)),(1.,3.,(2.,6.))],
dtype=[('x','f4'),('y',np.float32),('value','f4',(2,2))])
-Notice that `x` is created with a list of tuples.
+Notice that `x` is created with a list of tuples. ::
>>> x[['x','y']]
array([(1.5, 2.5), (3.0, 4.0), (1.0, 3.0)],
@@ -192,12 +192,28 @@ Notice that `x` is created with a list of tuples.
dtype=[('x', '<f4'), ('value', '<f4', (2, 2))])
Notice that the fields are always returned in the same order regardless of
-the sequence they are asked for.
+the sequence they are asked for. ::
>>> x[['y','x']]
array([(1.5, 2.5), (3.0, 4.0), (1.0, 3.0)],
dtype=[('x', '<f4'), ('y', '<f4')])
+Filling structured arrays
+=========================
+
+Structured arrays can be filled by field or row by row. ::
+
+ >>> arr = np.zeros((5,), dtype=[('var1','f8'),('var2','f8')])
+ >>> arr['var1'] = np.arange(5)
+
+If you fill it in row by row, it takes a take a tuple
+(but not a list or array!)::
+
+ >>> arr[0] = (10,20)
+ >>> arr
+ array([(10.0, 20.0), (1.0, 0.0), (2.0, 0.0), (3.0, 0.0), (4.0, 0.0)],
+ dtype=[('var1', '<f8'), ('var2', '<f8')])
+
More information
====================================
You can find some more information on recarrays and structured arrays
diff --git a/numpy/f2py/auxfuncs.py b/numpy/f2py/auxfuncs.py
index ac95669b7..a12d92b7e 100644
--- a/numpy/f2py/auxfuncs.py
+++ b/numpy/f2py/auxfuncs.py
@@ -206,6 +206,21 @@ def isfunction_wrap(rout):
def issubroutine(rout):
return ('block' in rout and 'subroutine'==rout['block'])
+def issubroutine_wrap(rout):
+ if isintent_c(rout):
+ return 0
+ return issubroutine(rout) and hasassumedshape(rout)
+
+def hasassumedshape(rout):
+ if rout.get('hasassumedshape'):
+ return True
+ for a in rout['args']:
+ for d in rout['vars'].get(a,{}).get('dimension',[]):
+ if d==':':
+ rout['hasassumedshape'] = True
+ return True
+ return False
+
def isroutine(rout):
return isfunction(rout) or issubroutine(rout)
diff --git a/numpy/f2py/capi_maps.py b/numpy/f2py/capi_maps.py
index c10e3ee84..beff1e212 100644
--- a/numpy/f2py/capi_maps.py
+++ b/numpy/f2py/capi_maps.py
@@ -192,8 +192,8 @@ if os.path.isfile('.f2py_f2cmap'):
else:
errmess("\tIgnoring map {'%s':{'%s':'%s'}}: '%s' must be in %s\n"%(k,k1,d[k][k1],d[k][k1],c2py_map.keys()))
outmess('Succesfully applied user defined changes from .f2py_f2cmap\n')
- except:
- errmess('Failed to apply user defined changes from .f2py_f2cmap. Skipping.\n')
+ except Exception, msg:
+ errmess('Failed to apply user defined changes from .f2py_f2cmap: %s. Skipping.\n' % (msg))
cformat_map={'double':'%g',
'float':'%g',
'long_double':'%Lg',
@@ -251,8 +251,9 @@ def getctype(var):
try:
ctype=f2cmap[str(var['kindselector']['kind'])]
except KeyError:
- errmess('getctype: "%s(kind=%s)" not supported (use .f2py_f2cmap).\n'\
- %(typespec,var['kindselector']['kind']))
+ errmess('getctype: "%s(kind=%s)" is mapped to C "%s" (to override define dict(%s = dict(%s="<C typespec>")) in %s/.f2py_f2cmap file).\n'\
+ %(typespec,var['kindselector']['kind'], ctype,
+ typespec,var['kindselector']['kind'], os.getcwd()))
else:
if not isexternal(var):
@@ -436,7 +437,7 @@ def getinit(a,var):
v = eval(v,{},{})
ret['init.r'],ret['init.i']=str(v.real),str(v.imag)
except:
- raise ValueError('sign2map: expected complex number `(r,i)\' but got `%s\' as initial value of %r.' % (init, a))
+ raise ValueError('getinit: expected complex number `(r,i)\' but got `%s\' as initial value of %r.' % (init, a))
if isarray(var):
init='(capi_c.r=%s,capi_c.i=%s,capi_c)'%(ret['init.r'],ret['init.i'])
elif isstring(var):
diff --git a/numpy/f2py/crackfortran.py b/numpy/f2py/crackfortran.py
index 5e2bb00a3..aa4c3bc0a 100755
--- a/numpy/f2py/crackfortran.py
+++ b/numpy/f2py/crackfortran.py
@@ -78,6 +78,7 @@ f2py_version = __version__.version
B['entry'] --- dictionary {entryname:argslist,..}
B['varnames'] --- list of variable names given in the order of reading the
Fortran code, useful for derived types.
+ B['saved_interface'] --- a string of scanned routine signature, defines explicit interface
*** Variable definition is a dictionary
D = B['vars'][<variable name>] =
{'typespec'[,'attrspec','kindselector','charselector','=','typename']}
@@ -1715,6 +1716,8 @@ def analyzebody(block,args,tab=''):
continue
if onlyfuncs and b['name'] not in onlyfuncs:
continue
+ b['saved_interface'] = crack2fortrangen(b, '\n'+' '*6, as_interface=True)
+
else: as_=args
b=postcrack(b,as_,tab=tab+'\t')
if b['block']=='interface' and not b['body']:
@@ -1961,15 +1964,23 @@ def _selected_int_kind_func(r):
if m<=2**8: return 1
if m<=2**16: return 2
if m<=2**32: return 4
- if m<=2**64: return 8
+ if m<=2**63: return 8
if m<=2**128: return 16
return -1
+def _selected_real_kind_func(p,r=0,radix=0):
+ #XXX: This should be processor dependent
+ if p<7: return 4
+ if p<16: return 8
+ if p<19: return 10
+ return -1
+
def get_parameters(vars, global_params={}):
params = copy.copy(global_params)
g_params = copy.copy(global_params)
for name,func in [('kind',_kind_func),
('selected_int_kind',_selected_int_kind_func),
+ ('selected_real_kind',_selected_real_kind_func),
]:
if name not in g_params:
g_params[name] = func
@@ -1979,6 +1990,7 @@ def get_parameters(vars, global_params={}):
param_names.append(n)
kind_re = re.compile(r'\bkind\s*\(\s*(?P<value>.*)\s*\)',re.I)
selected_int_kind_re = re.compile(r'\bselected_int_kind\s*\(\s*(?P<value>.*)\s*\)',re.I)
+ selected_kind_re = re.compile(r'\bselected_(int|real)_kind\s*\(\s*(?P<value>.*)\s*\)',re.I)
for n in param_names:
if '=' in vars[n]:
v = vars[n]['=']
@@ -1992,7 +2004,7 @@ def get_parameters(vars, global_params={}):
v = v.replace(*repl)
v = kind_re.sub(r'kind("\1")',v)
v = selected_int_kind_re.sub(r'selected_int_kind(\1)',v)
- if isinteger(vars[n]) and not selected_int_kind_re.match(v):
+ if isinteger(vars[n]) and not selected_kind_re.match(v):
v = v.split('_')[0]
if isdouble(vars[n]):
tt = list(v)
@@ -2025,7 +2037,7 @@ def _eval_length(length,params):
return '(*)'
return _eval_scalar(length,params)
-_is_kind_number = re.compile('\d+_').match
+_is_kind_number = re.compile(r'\d+_').match
def _eval_scalar(value,params):
if _is_kind_number(value):
@@ -2040,6 +2052,13 @@ def _eval_scalar(value,params):
% (msg,value,params.keys()))
return value
+_size_call_sub = re.compile(r'size\s*\((?P<arg1>\w+)\s*[,]').sub
+def two_argument_size_hook(expr):
+ new_expr = _size_call_sub(r'shape(\g<arg1>,-1+', expr)
+ if verbose > 1 and expr!=new_expr:
+ outmess('two_argument_size_hook: mapping %r to %r\n' % (expr, new_expr))
+ return new_expr
+
def analyzevars(block):
global f90modulevars
setmesstext(block)
@@ -2182,6 +2201,7 @@ def analyzevars(block):
if d[:4] == '1 * ': d = d[4:]
if di and di[-4:] == '/(1)': di = di[:-4]
if v: savelindims[d] = v,di
+ d = two_argument_size_hook(d)
vars[n]['dimension'].append(d)
if 'dimension' in vars[n]:
if isintent_c(vars[n]):
@@ -2298,6 +2318,7 @@ def analyzevars(block):
if not vars[n]['depend']: del vars[n]['depend']
if isscalar(vars[n]):
vars[n]['='] = _eval_scalar(vars[n]['='],params)
+ vars[n]['='] = two_argument_size_hook(vars[n]['='])
for n in vars.keys():
if n==block['name']: # n is block name
@@ -2459,7 +2480,7 @@ def determineexprtype(expr,vars,rules={}):
return t
######
-def crack2fortrangen(block,tab='\n'):
+def crack2fortrangen(block,tab='\n', as_interface=False):
global skipfuncs, onlyfuncs
setmesstext(block)
ret=''
@@ -2470,7 +2491,7 @@ def crack2fortrangen(block,tab='\n'):
continue
if onlyfuncs and g['name'] not in onlyfuncs:
continue
- ret=ret+crack2fortrangen(g,tab)
+ ret=ret+crack2fortrangen(g,tab,as_interface=as_interface)
return ret
prefix=''
name=''
@@ -2511,9 +2532,9 @@ def crack2fortrangen(block,tab='\n'):
#if 'prefix' in block:
# prefix=block['prefix']+' '
body=crack2fortrangen(block['body'],tab+tabchar)
- vars=vars2fortran(block,block['vars'],al,tab+tabchar)
+ vars=vars2fortran(block,block['vars'],al,tab+tabchar, as_interface=as_interface)
mess=''
- if 'from' in block:
+ if 'from' in block and not as_interface:
mess='! in %s'%block['from']
if 'entry' in block:
entry_stmts = ''
@@ -2543,7 +2564,7 @@ def use2fortran(use,tab=''):
if ret and ret[-1]==',': ret=ret[:-1]
continue
if 'only' in use[m] and use[m]['only']:
- ret='%s,only:'%(ret)
+ ret='%s only:'%(ret)
if 'map' in use[m] and use[m]['map']:
c=' '
for k in use[m]['map'].keys():
@@ -2566,7 +2587,7 @@ def true_intent_list(var):
ret.append(intent)
return ret
-def vars2fortran(block,vars,args,tab=''):
+def vars2fortran(block,vars,args,tab='', as_interface=False):
"""
TODO:
public sub
@@ -2587,9 +2608,10 @@ def vars2fortran(block,vars,args,tab=''):
errmess('vars2fortran: Confused?!: "%s" is not defined in vars.\n'%a)
if 'varnames' in block:
nout.extend(block['varnames'])
- for a in vars.keys():
- if a not in nout:
- nout.append(a)
+ if not as_interface:
+ for a in vars.keys():
+ if a not in nout:
+ nout.append(a)
for a in nout:
if 'depend' in vars[a]:
for d in vars[a]['depend']:
diff --git a/numpy/f2py/func2subr.py b/numpy/f2py/func2subr.py
index 7ce30bc70..02401d504 100644
--- a/numpy/f2py/func2subr.py
+++ b/numpy/f2py/func2subr.py
@@ -75,6 +75,23 @@ def var2fixfortran(vars,a,fa=None,f90mode=None):
def createfuncwrapper(rout,signature=0):
assert isfunction(rout)
+
+ extra_args = []
+ vars = rout['vars']
+ for a in rout['args']:
+ v = rout['vars'][a]
+ for i,d in enumerate(v.get('dimension',[])):
+ if d==':':
+ dn = 'f2py_%s_d%s' % (a, i)
+ dv = dict(typespec='integer', intent=['hide'])
+ dv['='] = 'shape(%s, %s)' % (a, i)
+ extra_args.append(dn)
+ vars[dn] = dv
+ v['dimension'][i] = dn
+ rout['args'].extend(extra_args)
+ need_interface = bool(extra_args)
+
+
ret = ['']
def add(line,ret=ret):
ret[0] = '%s\n %s'%(ret[0],line)
@@ -82,7 +99,7 @@ def createfuncwrapper(rout,signature=0):
fortranname = getfortranname(rout)
f90mode = ismoduleroutine(rout)
newname = '%sf2pywrap'%(name)
- vars = rout['vars']
+
if newname not in vars:
vars[newname] = vars[name]
args = [newname]+rout['args'][1:]
@@ -98,16 +115,23 @@ def createfuncwrapper(rout,signature=0):
charselect = vars[name]['charselector']
if charselect.get('*','')=='(*)':
charselect['*'] = '10'
+ sargs = ', '.join(args)
if f90mode:
- sargs = ', '.join(args)
add('subroutine f2pywrap_%s_%s (%s)'%(rout['modulename'],name,sargs))
if not signature:
add('use %s, only : %s'%(rout['modulename'],fortranname))
else:
- add('subroutine f2pywrap%s (%s)'%(name,', '.join(args)))
- add('external %s'%(fortranname))
+ add('subroutine f2pywrap%s (%s)'%(name,sargs))
+ if not need_interface:
+ add('external %s'%(fortranname))
#if not return_char_star:
l = l + ', '+fortranname
+
+ if need_interface:
+ for line in rout['saved_interface'].split('\n'):
+ if line.lstrip().startswith('use '):
+ add(line)
+
args = args[1:]
dumped_args = []
for a in args:
@@ -125,11 +149,18 @@ def createfuncwrapper(rout,signature=0):
add(l)
+ if need_interface:
+ add('interface')
+ add(rout['saved_interface'].lstrip())
+ add('end interface')
+
+ sargs = ', '.join([a for a in args if a not in extra_args])
+
if not signature:
if islogicalfunction(rout):
- add('%s = .not.(.not.%s(%s))'%(newname,fortranname,', '.join(args)))
+ add('%s = .not.(.not.%s(%s))'%(newname,fortranname,sargs))
else:
- add('%s = %s(%s)'%(newname,fortranname,', '.join(args)))
+ add('%s = %s(%s)'%(newname,fortranname,sargs))
if f90mode:
add('end subroutine f2pywrap_%s_%s'%(rout['modulename'],name))
else:
@@ -139,29 +170,112 @@ def createfuncwrapper(rout,signature=0):
#print '**'*10
return ret[0]
-def assubr(rout):
- if not isfunction_wrap(rout): return rout,''
- fortranname = getfortranname(rout)
+def createsubrwrapper(rout,signature=0):
+ assert issubroutine(rout)
+
+ extra_args = []
+ vars = rout['vars']
+ for a in rout['args']:
+ v = rout['vars'][a]
+ for i,d in enumerate(v.get('dimension',[])):
+ if d==':':
+ dn = 'f2py_%s_d%s' % (a, i)
+ dv = dict(typespec='integer', intent=['hide'])
+ dv['='] = 'shape(%s, %s)' % (a, i)
+ extra_args.append(dn)
+ vars[dn] = dv
+ v['dimension'][i] = dn
+ rout['args'].extend(extra_args)
+ need_interface = bool(extra_args)
+
+ ret = ['']
+ def add(line,ret=ret):
+ ret[0] = '%s\n %s'%(ret[0],line)
name = rout['name']
- outmess('\t\tCreating wrapper for Fortran function "%s"("%s")...\n'%(name,fortranname))
- rout = copy.copy(rout)
- fname = name
- rname = fname
- if 'result' in rout:
- rname = rout['result']
- rout['vars'][fname]=rout['vars'][rname]
- fvar = rout['vars'][fname]
- if not isintent_out(fvar):
- if 'intent' not in fvar:
- fvar['intent']=[]
- fvar['intent'].append('out')
- flag=1
- for i in fvar['intent']:
- if i.startswith('out='):
- flag = 0
- break
- if flag:
- fvar['intent'].append('out=%s' % (rname))
-
- rout['args'] = [fname] + rout['args']
- return rout,createfuncwrapper(rout)
+ fortranname = getfortranname(rout)
+ f90mode = ismoduleroutine(rout)
+
+ args = rout['args']
+
+ sargs = ', '.join(args)
+ if f90mode:
+ add('subroutine f2pywrap_%s_%s (%s)'%(rout['modulename'],name,sargs))
+ if not signature:
+ add('use %s, only : %s'%(rout['modulename'],fortranname))
+ else:
+ add('subroutine f2pywrap%s (%s)'%(name,sargs))
+ if not need_interface:
+ add('external %s'%(fortranname))
+
+ if need_interface:
+ for line in rout['saved_interface'].split('\n'):
+ if line.lstrip().startswith('use '):
+ add(line)
+
+ dumped_args = []
+ for a in args:
+ if isexternal(vars[a]):
+ add('external %s'%(a))
+ dumped_args.append(a)
+ for a in args:
+ if a in dumped_args: continue
+ if isscalar(vars[a]):
+ add(var2fixfortran(vars,a,f90mode=f90mode))
+ dumped_args.append(a)
+ for a in args:
+ if a in dumped_args: continue
+ add(var2fixfortran(vars,a,f90mode=f90mode))
+
+ if need_interface:
+ add('interface')
+ add(rout['saved_interface'].lstrip())
+ add('end interface')
+
+ sargs = ', '.join([a for a in args if a not in extra_args])
+
+ if not signature:
+ add('call %s(%s)'%(fortranname,sargs))
+ if f90mode:
+ add('end subroutine f2pywrap_%s_%s'%(rout['modulename'],name))
+ else:
+ add('end')
+ #print '**'*10
+ #print ret[0]
+ #print '**'*10
+ return ret[0]
+
+
+def assubr(rout):
+ if isfunction_wrap(rout):
+ fortranname = getfortranname(rout)
+ name = rout['name']
+ outmess('\t\tCreating wrapper for Fortran function "%s"("%s")...\n'%(name,fortranname))
+ rout = copy.copy(rout)
+ fname = name
+ rname = fname
+ if 'result' in rout:
+ rname = rout['result']
+ rout['vars'][fname]=rout['vars'][rname]
+ fvar = rout['vars'][fname]
+ if not isintent_out(fvar):
+ if 'intent' not in fvar:
+ fvar['intent']=[]
+ fvar['intent'].append('out')
+ flag=1
+ for i in fvar['intent']:
+ if i.startswith('out='):
+ flag = 0
+ break
+ if flag:
+ fvar['intent'].append('out=%s' % (rname))
+
+ rout['args'] = [fname] + rout['args']
+ return rout,createfuncwrapper(rout)
+ if issubroutine_wrap(rout):
+ fortranname = getfortranname(rout)
+ name = rout['name']
+ outmess('\t\tCreating wrapper for Fortran subroutine "%s"("%s")...\n'%(name,fortranname))
+ rout = copy.copy(rout)
+ return rout,createsubrwrapper(rout)
+ return rout,''
+
diff --git a/numpy/f2py/rules.py b/numpy/f2py/rules.py
index 62a80e25f..83f5811e5 100644
--- a/numpy/f2py/rules.py
+++ b/numpy/f2py/rules.py
@@ -408,7 +408,7 @@ rout_rules=[
{isthreadsafe:'\t\t\tPy_END_ALLOW_THREADS'},
{hasexternals:"""\t\t}"""}
],
- '_check':issubroutine,
+ '_check':l_and(issubroutine,l_not(issubroutine_wrap)),
},{ # Wrapped function
'functype':'void',
'declfortranroutine':{l_not(l_or(ismoduleroutine,isdummyroutine)):'extern void #F_WRAPPEDFUNC#(#name_lower#,#NAME#)(#callprotoargument#);',
@@ -444,6 +444,41 @@ rout_rules=[
{hasexternals:'\t}'}
],
'_check':isfunction_wrap,
+ },{ # Wrapped subroutine
+ 'functype':'void',
+ 'declfortranroutine':{l_not(l_or(ismoduleroutine,isdummyroutine)):'extern void #F_WRAPPEDFUNC#(#name_lower#,#NAME#)(#callprotoargument#);',
+ isdummyroutine:'',
+ },
+
+ 'routine_def':{l_not(l_or(ismoduleroutine,isdummyroutine)):'\t{\"#name#\",-1,{{-1}},0,(char *)#F_WRAPPEDFUNC#(#name_lower#,#NAME#),(f2py_init_func)#apiname#,doc_#apiname#},',
+ isdummyroutine:'\t{\"#name#\",-1,{{-1}},0,NULL,(f2py_init_func)#apiname#,doc_#apiname#},',
+ },
+ 'initf2pywraphook':{l_not(l_or(ismoduleroutine,isdummyroutine)):'''
+ {
+ extern void #F_FUNC#(#name_lower#,#NAME#)(void);
+ PyObject* o = PyDict_GetItemString(d,"#name#");
+ PyObject_SetAttrString(o,"_cpointer", F2PyCapsule_FromVoidPtr((void*)#F_FUNC#(#name_lower#,#NAME#),NULL));
+#if PY_VERSION_HEX >= 0x03000000
+ PyObject_SetAttrString(o,"__name__", PyUnicode_FromString("#name#"));
+#else
+ PyObject_SetAttrString(o,"__name__", PyString_FromString("#name#"));
+#endif
+ }
+ '''},
+ 'need':{l_not(l_or(ismoduleroutine,isdummyroutine)):['F_WRAPPEDFUNC','F_FUNC']},
+ 'callfortranroutine':[
+ {debugcapi:["""\tfprintf(stderr,\"debug-capi:Fortran subroutine `f2pywrap#name_lower#(#callfortran#)\'\\n\");"""]},
+ {hasexternals:"""\
+\tif (#setjmpbuf#) {
+\t\tf2py_success = 0;
+\t} else {"""},
+ {isthreadsafe:'\tPy_BEGIN_ALLOW_THREADS'},
+ {l_not(l_or(hascallstatement,isdummyroutine)):'\t(*f2py_func)(#callfortran#);'},
+ {hascallstatement:'\t#callstatement#;\n\t/*(*f2py_func)(#callfortran#);*/'},
+ {isthreadsafe:'\tPy_END_ALLOW_THREADS'},
+ {hasexternals:'\t}'}
+ ],
+ '_check':issubroutine_wrap,
},{ # Function
'functype':'#ctype#',
'docreturn':{l_not(isintent_hide):'#rname#,'},
diff --git a/numpy/f2py/tests/src/assumed_shape/.f2py_f2cmap b/numpy/f2py/tests/src/assumed_shape/.f2py_f2cmap
new file mode 100644
index 000000000..2665f89b5
--- /dev/null
+++ b/numpy/f2py/tests/src/assumed_shape/.f2py_f2cmap
@@ -0,0 +1 @@
+dict(real=dict(rk="double"))
diff --git a/numpy/f2py/tests/src/assumed_shape/foo_free.f90 b/numpy/f2py/tests/src/assumed_shape/foo_free.f90
new file mode 100644
index 000000000..b301710f5
--- /dev/null
+++ b/numpy/f2py/tests/src/assumed_shape/foo_free.f90
@@ -0,0 +1,34 @@
+
+subroutine sum(x, res)
+ implicit none
+ real, intent(in) :: x(:)
+ real, intent(out) :: res
+
+ integer :: i
+
+ !print *, "sum: size(x) = ", size(x)
+
+ res = 0.0
+
+ do i = 1, size(x)
+ res = res + x(i)
+ enddo
+
+end subroutine sum
+
+function fsum(x) result (res)
+ implicit none
+ real, intent(in) :: x(:)
+ real :: res
+
+ integer :: i
+
+ !print *, "fsum: size(x) = ", size(x)
+
+ res = 0.0
+
+ do i = 1, size(x)
+ res = res + x(i)
+ enddo
+
+end function fsum
diff --git a/numpy/f2py/tests/src/assumed_shape/foo_use.f90 b/numpy/f2py/tests/src/assumed_shape/foo_use.f90
new file mode 100644
index 000000000..337465ac5
--- /dev/null
+++ b/numpy/f2py/tests/src/assumed_shape/foo_use.f90
@@ -0,0 +1,19 @@
+subroutine sum_with_use(x, res)
+ use precision
+
+ implicit none
+
+ real(kind=rk), intent(in) :: x(:)
+ real(kind=rk), intent(out) :: res
+
+ integer :: i
+
+ !print *, "size(x) = ", size(x)
+
+ res = 0.0
+
+ do i = 1, size(x)
+ res = res + x(i)
+ enddo
+
+ end subroutine
diff --git a/numpy/f2py/tests/src/assumed_shape/precision.f90 b/numpy/f2py/tests/src/assumed_shape/precision.f90
new file mode 100644
index 000000000..ed6c70cbb
--- /dev/null
+++ b/numpy/f2py/tests/src/assumed_shape/precision.f90
@@ -0,0 +1,4 @@
+module precision
+ integer, parameter :: rk = selected_real_kind(8)
+ integer, parameter :: ik = selected_real_kind(4)
+end module
diff --git a/numpy/f2py/tests/src/kind/foo.f90 b/numpy/f2py/tests/src/kind/foo.f90
new file mode 100644
index 000000000..d3d15cfb2
--- /dev/null
+++ b/numpy/f2py/tests/src/kind/foo.f90
@@ -0,0 +1,20 @@
+
+
+subroutine selectedrealkind(p, r, res)
+ implicit none
+
+ integer, intent(in) :: p, r
+ !f2py integer :: r=0
+ integer, intent(out) :: res
+ res = selected_real_kind(p, r)
+
+end subroutine
+
+subroutine selectedintkind(p, res)
+ implicit none
+
+ integer, intent(in) :: p
+ integer, intent(out) :: res
+ res = selected_int_kind(p)
+
+end subroutine
diff --git a/numpy/f2py/tests/src/size/foo.f90 b/numpy/f2py/tests/src/size/foo.f90
new file mode 100644
index 000000000..9602837fe
--- /dev/null
+++ b/numpy/f2py/tests/src/size/foo.f90
@@ -0,0 +1,14 @@
+
+subroutine foo(a, n, m, b)
+ implicit none
+
+ real, intent(in) :: a(n, m)
+ integer, intent(in) :: n, m
+ real, intent(out) :: b(size(a, 1))
+
+ integer :: i
+
+ do i = 1, size(b)
+ b(i) = sum(a(i,:))
+ enddo
+end subroutine
diff --git a/numpy/f2py/tests/test_array_from_pyobj.py b/numpy/f2py/tests/test_array_from_pyobj.py
index 3b11a5b14..488fd4db5 100644
--- a/numpy/f2py/tests/test_array_from_pyobj.py
+++ b/numpy/f2py/tests/test_array_from_pyobj.py
@@ -47,7 +47,7 @@ def flags2names(flags):
'UPDATEIFCOPY','BEHAVED','BEHAVED_RO',
'CARRAY','FARRAY'
]:
- if abs(flags) & getattr(wrap,flagname):
+ if abs(flags) & getattr(wrap,flagname, 0):
info.append(flagname)
return info
@@ -177,19 +177,21 @@ class Array:
# arr.dtypechar may be different from typ.dtypechar
self.arr = wrap.call(typ.type_num,dims,intent.flags,obj)
+ assert_(isinstance(self.arr, ndarray),`type(self.arr)`)
+
self.arr_attr = wrap.array_attrs(self.arr)
if len(dims)>1:
if self.intent.is_intent('c'):
- assert intent.flags & wrap.F2PY_INTENT_C
- assert not self.arr.flags['FORTRAN'],`self.arr.flags,obj.flags`
- assert self.arr.flags['CONTIGUOUS']
- assert not self.arr_attr[6] & wrap.FORTRAN
+ assert_(intent.flags & wrap.F2PY_INTENT_C)
+ assert_(not self.arr.flags['FORTRAN'],`self.arr.flags,getattr(obj,'flags',None)`)
+ assert_(self.arr.flags['CONTIGUOUS'])
+ assert_(not self.arr_attr[6] & wrap.FORTRAN)
else:
- assert not intent.flags & wrap.F2PY_INTENT_C
- assert self.arr.flags['FORTRAN']
- assert not self.arr.flags['CONTIGUOUS']
- assert self.arr_attr[6] & wrap.FORTRAN
+ assert_(not intent.flags & wrap.F2PY_INTENT_C)
+ assert_(self.arr.flags['FORTRAN'])
+ assert_(not self.arr.flags['CONTIGUOUS'])
+ assert_(self.arr_attr[6] & wrap.FORTRAN)
if obj is None:
self.pyarr = None
@@ -197,50 +199,50 @@ class Array:
return
if intent.is_intent('cache'):
- assert isinstance(obj,ndarray),`type(obj)`
+ assert_(isinstance(obj,ndarray),`type(obj)`)
self.pyarr = array(obj).reshape(*dims).copy()
else:
self.pyarr = array(array(obj,
dtype = typ.dtypechar).reshape(*dims),
order=self.intent.is_intent('c') and 'C' or 'F')
- assert self.pyarr.dtype == typ, \
- `self.pyarr.dtype,typ`
- assert self.pyarr.flags['OWNDATA'], (obj, intent)
+ assert_(self.pyarr.dtype == typ, \
+ `self.pyarr.dtype,typ`)
+ assert_(self.pyarr.flags['OWNDATA'], (obj, intent))
self.pyarr_attr = wrap.array_attrs(self.pyarr)
if len(dims)>1:
if self.intent.is_intent('c'):
- assert not self.pyarr.flags['FORTRAN']
- assert self.pyarr.flags['CONTIGUOUS']
- assert not self.pyarr_attr[6] & wrap.FORTRAN
+ assert_(not self.pyarr.flags['FORTRAN'])
+ assert_(self.pyarr.flags['CONTIGUOUS'])
+ assert_(not self.pyarr_attr[6] & wrap.FORTRAN)
else:
- assert self.pyarr.flags['FORTRAN']
- assert not self.pyarr.flags['CONTIGUOUS']
- assert self.pyarr_attr[6] & wrap.FORTRAN
+ assert_(self.pyarr.flags['FORTRAN'])
+ assert_(not self.pyarr.flags['CONTIGUOUS'])
+ assert_(self.pyarr_attr[6] & wrap.FORTRAN)
- assert self.arr_attr[1]==self.pyarr_attr[1] # nd
- assert self.arr_attr[2]==self.pyarr_attr[2] # dimensions
+ assert_(self.arr_attr[1]==self.pyarr_attr[1]) # nd
+ assert_(self.arr_attr[2]==self.pyarr_attr[2]) # dimensions
if self.arr_attr[1]<=1:
- assert self.arr_attr[3]==self.pyarr_attr[3],\
- `self.arr_attr[3],self.pyarr_attr[3],self.arr.tostring(),self.pyarr.tostring()` # strides
- assert self.arr_attr[5][-2:]==self.pyarr_attr[5][-2:],\
- `self.arr_attr[5],self.pyarr_attr[5]` # descr
- assert self.arr_attr[6]==self.pyarr_attr[6],\
- `self.arr_attr[6],self.pyarr_attr[6],flags2names(0*self.arr_attr[6]-self.pyarr_attr[6]),flags2names(self.arr_attr[6]),intent` # flags
+ assert_(self.arr_attr[3]==self.pyarr_attr[3],\
+ `self.arr_attr[3],self.pyarr_attr[3],self.arr.tostring(),self.pyarr.tostring()`) # strides
+ assert_(self.arr_attr[5][-2:]==self.pyarr_attr[5][-2:],\
+ `self.arr_attr[5],self.pyarr_attr[5]`) # descr
+ assert_(self.arr_attr[6]==self.pyarr_attr[6],\
+ `self.arr_attr[6],self.pyarr_attr[6],flags2names(0*self.arr_attr[6]-self.pyarr_attr[6]),flags2names(self.arr_attr[6]),intent`) # flags
if intent.is_intent('cache'):
- assert self.arr_attr[5][3]>=self.type.elsize,\
- `self.arr_attr[5][3],self.type.elsize`
+ assert_(self.arr_attr[5][3]>=self.type.elsize,\
+ `self.arr_attr[5][3],self.type.elsize`)
else:
- assert self.arr_attr[5][3]==self.type.elsize,\
- `self.arr_attr[5][3],self.type.elsize`
- assert self.arr_equal(self.pyarr,self.arr)
+ assert_(self.arr_attr[5][3]==self.type.elsize,\
+ `self.arr_attr[5][3],self.type.elsize`)
+ assert_(self.arr_equal(self.pyarr,self.arr))
if isinstance(self.obj,ndarray):
if typ.elsize==Type(obj.dtype).elsize:
if not intent.is_intent('copy') and self.arr_attr[1]<=1:
- assert self.has_shared_memory()
+ assert_(self.has_shared_memory())
def arr_equal(self,arr1,arr2):
if arr1.shape != arr2.shape:
@@ -266,32 +268,32 @@ class Array:
class test_intent(unittest.TestCase):
def test_in_out(self):
assert_equal(str(intent.in_.out),'intent(in,out)')
- assert intent.in_.c.is_intent('c')
- assert not intent.in_.c.is_intent_exact('c')
- assert intent.in_.c.is_intent_exact('c','in')
- assert intent.in_.c.is_intent_exact('in','c')
- assert not intent.in_.is_intent('c')
+ assert_(intent.in_.c.is_intent('c'))
+ assert_(not intent.in_.c.is_intent_exact('c'))
+ assert_(intent.in_.c.is_intent_exact('c','in'))
+ assert_(intent.in_.c.is_intent_exact('in','c'))
+ assert_(not intent.in_.is_intent('c'))
class _test_shared_memory:
num2seq = [1,2]
num23seq = [[1,2,3],[4,5,6]]
def test_in_from_2seq(self):
a = self.array([2],intent.in_,self.num2seq)
- assert not a.has_shared_memory()
+ assert_(not a.has_shared_memory())
def test_in_from_2casttype(self):
for t in self.type.cast_types():
obj = array(self.num2seq,dtype=t.dtype)
a = self.array([len(self.num2seq)],intent.in_,obj)
if t.elsize==self.type.elsize:
- assert a.has_shared_memory(),`self.type.dtype,t.dtype`
+ assert_(a.has_shared_memory(),`self.type.dtype,t.dtype`)
else:
- assert not a.has_shared_memory(),`t.dtype`
+ assert_(not a.has_shared_memory(),`t.dtype`)
def test_inout_2seq(self):
obj = array(self.num2seq,dtype=self.type.dtype)
a = self.array([len(self.num2seq)],intent.inout,obj)
- assert a.has_shared_memory()
+ assert_(a.has_shared_memory())
try:
a = self.array([2],intent.in_.inout,self.num2seq)
@@ -305,7 +307,7 @@ class _test_shared_memory:
obj = array(self.num23seq,dtype=self.type.dtype,order='F')
shape = (len(self.num23seq),len(self.num23seq[0]))
a = self.array(shape,intent.in_.inout,obj)
- assert a.has_shared_memory()
+ assert_(a.has_shared_memory())
obj = array(self.num23seq,dtype=self.type.dtype,order='C')
shape = (len(self.num23seq),len(self.num23seq[0]))
@@ -321,25 +323,25 @@ class _test_shared_memory:
obj = array(self.num23seq,dtype=self.type.dtype)
shape = (len(self.num23seq),len(self.num23seq[0]))
a = self.array(shape,intent.in_.c.inout,obj)
- assert a.has_shared_memory()
+ assert_(a.has_shared_memory())
def test_in_copy_from_2casttype(self):
for t in self.type.cast_types():
obj = array(self.num2seq,dtype=t.dtype)
a = self.array([len(self.num2seq)],intent.in_.copy,obj)
- assert not a.has_shared_memory(),`t.dtype`
+ assert_(not a.has_shared_memory(),`t.dtype`)
def test_c_in_from_23seq(self):
a = self.array([len(self.num23seq),len(self.num23seq[0])],
intent.in_,self.num23seq)
- assert not a.has_shared_memory()
+ assert_(not a.has_shared_memory())
def test_in_from_23casttype(self):
for t in self.type.cast_types():
obj = array(self.num23seq,dtype=t.dtype)
a = self.array([len(self.num23seq),len(self.num23seq[0])],
intent.in_,obj)
- assert not a.has_shared_memory(),`t.dtype`
+ assert_(not a.has_shared_memory(),`t.dtype`)
def test_f_in_from_23casttype(self):
for t in self.type.cast_types():
@@ -347,9 +349,9 @@ class _test_shared_memory:
a = self.array([len(self.num23seq),len(self.num23seq[0])],
intent.in_,obj)
if t.elsize==self.type.elsize:
- assert a.has_shared_memory(),`t.dtype`
+ assert_(a.has_shared_memory(),`t.dtype`)
else:
- assert not a.has_shared_memory(),`t.dtype`
+ assert_(not a.has_shared_memory(),`t.dtype`)
def test_c_in_from_23casttype(self):
for t in self.type.cast_types():
@@ -357,23 +359,23 @@ class _test_shared_memory:
a = self.array([len(self.num23seq),len(self.num23seq[0])],
intent.in_.c,obj)
if t.elsize==self.type.elsize:
- assert a.has_shared_memory(),`t.dtype`
+ assert_(a.has_shared_memory(),`t.dtype`)
else:
- assert not a.has_shared_memory(),`t.dtype`
+ assert_(not a.has_shared_memory(),`t.dtype`)
def test_f_copy_in_from_23casttype(self):
for t in self.type.cast_types():
obj = array(self.num23seq,dtype=t.dtype,order='F')
a = self.array([len(self.num23seq),len(self.num23seq[0])],
intent.in_.copy,obj)
- assert not a.has_shared_memory(),`t.dtype`
+ assert_(not a.has_shared_memory(),`t.dtype`)
def test_c_copy_in_from_23casttype(self):
for t in self.type.cast_types():
obj = array(self.num23seq,dtype=t.dtype)
a = self.array([len(self.num23seq),len(self.num23seq[0])],
intent.in_.c.copy,obj)
- assert not a.has_shared_memory(),`t.dtype`
+ assert_(not a.has_shared_memory(),`t.dtype`)
def test_in_cache_from_2casttype(self):
for t in self.type.all_types():
@@ -382,17 +384,17 @@ class _test_shared_memory:
obj = array(self.num2seq,dtype=t.dtype)
shape = (len(self.num2seq),)
a = self.array(shape,intent.in_.c.cache,obj)
- assert a.has_shared_memory(),`t.dtype`
+ assert_(a.has_shared_memory(),`t.dtype`)
a = self.array(shape,intent.in_.cache,obj)
- assert a.has_shared_memory(),`t.dtype`
+ assert_(a.has_shared_memory(),`t.dtype`)
obj = array(self.num2seq,dtype=t.dtype,order='F')
a = self.array(shape,intent.in_.c.cache,obj)
- assert a.has_shared_memory(),`t.dtype`
+ assert_(a.has_shared_memory(),`t.dtype`)
a = self.array(shape,intent.in_.cache,obj)
- assert a.has_shared_memory(),`t.dtype`
+ assert_(a.has_shared_memory(),`t.dtype`)
try:
a = self.array(shape,intent.in_.cache,obj[::-1])
@@ -418,11 +420,11 @@ class _test_shared_memory:
def test_cache_hidden(self):
shape = (2,)
a = self.array(shape,intent.cache.hide,None)
- assert a.arr.shape==shape
+ assert_(a.arr.shape==shape)
shape = (2,3)
a = self.array(shape,intent.cache.hide,None)
- assert a.arr.shape==shape
+ assert_(a.arr.shape==shape)
shape = (-1,3)
try:
@@ -436,20 +438,20 @@ class _test_shared_memory:
def test_hidden(self):
shape = (2,)
a = self.array(shape,intent.hide,None)
- assert a.arr.shape==shape
- assert a.arr_equal(a.arr,zeros(shape,dtype=self.type.dtype))
+ assert_(a.arr.shape==shape)
+ assert_(a.arr_equal(a.arr,zeros(shape,dtype=self.type.dtype)))
shape = (2,3)
a = self.array(shape,intent.hide,None)
- assert a.arr.shape==shape
- assert a.arr_equal(a.arr,zeros(shape,dtype=self.type.dtype))
- assert a.arr.flags['FORTRAN'] and not a.arr.flags['CONTIGUOUS']
+ assert_(a.arr.shape==shape)
+ assert_(a.arr_equal(a.arr,zeros(shape,dtype=self.type.dtype)))
+ assert_(a.arr.flags['FORTRAN'] and not a.arr.flags['CONTIGUOUS'])
shape = (2,3)
a = self.array(shape,intent.c.hide,None)
- assert a.arr.shape==shape
- assert a.arr_equal(a.arr,zeros(shape,dtype=self.type.dtype))
- assert not a.arr.flags['FORTRAN'] and a.arr.flags['CONTIGUOUS']
+ assert_(a.arr.shape==shape)
+ assert_(a.arr_equal(a.arr,zeros(shape,dtype=self.type.dtype)))
+ assert_(not a.arr.flags['FORTRAN'] and a.arr.flags['CONTIGUOUS'])
shape = (-1,3)
try:
@@ -463,68 +465,68 @@ class _test_shared_memory:
def test_optional_none(self):
shape = (2,)
a = self.array(shape,intent.optional,None)
- assert a.arr.shape==shape
- assert a.arr_equal(a.arr,zeros(shape,dtype=self.type.dtype))
+ assert_(a.arr.shape==shape)
+ assert_(a.arr_equal(a.arr,zeros(shape,dtype=self.type.dtype)))
shape = (2,3)
a = self.array(shape,intent.optional,None)
- assert a.arr.shape==shape
- assert a.arr_equal(a.arr,zeros(shape,dtype=self.type.dtype))
- assert a.arr.flags['FORTRAN'] and not a.arr.flags['CONTIGUOUS']
+ assert_(a.arr.shape==shape)
+ assert_(a.arr_equal(a.arr,zeros(shape,dtype=self.type.dtype)))
+ assert_(a.arr.flags['FORTRAN'] and not a.arr.flags['CONTIGUOUS'])
shape = (2,3)
a = self.array(shape,intent.c.optional,None)
- assert a.arr.shape==shape
- assert a.arr_equal(a.arr,zeros(shape,dtype=self.type.dtype))
- assert not a.arr.flags['FORTRAN'] and a.arr.flags['CONTIGUOUS']
+ assert_(a.arr.shape==shape)
+ assert_(a.arr_equal(a.arr,zeros(shape,dtype=self.type.dtype)))
+ assert_(not a.arr.flags['FORTRAN'] and a.arr.flags['CONTIGUOUS'])
def test_optional_from_2seq(self):
obj = self.num2seq
shape = (len(obj),)
a = self.array(shape,intent.optional,obj)
- assert a.arr.shape==shape
- assert not a.has_shared_memory()
+ assert_(a.arr.shape==shape)
+ assert_(not a.has_shared_memory())
def test_optional_from_23seq(self):
obj = self.num23seq
shape = (len(obj),len(obj[0]))
a = self.array(shape,intent.optional,obj)
- assert a.arr.shape==shape
- assert not a.has_shared_memory()
+ assert_(a.arr.shape==shape)
+ assert_(not a.has_shared_memory())
a = self.array(shape,intent.optional.c,obj)
- assert a.arr.shape==shape
- assert not a.has_shared_memory()
+ assert_(a.arr.shape==shape)
+ assert_(not a.has_shared_memory())
def test_inplace(self):
obj = array(self.num23seq,dtype=self.type.dtype)
- assert not obj.flags['FORTRAN'] and obj.flags['CONTIGUOUS']
+ assert_(not obj.flags['FORTRAN'] and obj.flags['CONTIGUOUS'])
shape = obj.shape
a = self.array(shape,intent.inplace,obj)
- assert obj[1][2]==a.arr[1][2],`obj,a.arr`
+ assert_(obj[1][2]==a.arr[1][2],`obj,a.arr`)
a.arr[1][2]=54
- assert obj[1][2]==a.arr[1][2]==array(54,dtype=self.type.dtype),`obj,a.arr`
- assert a.arr is obj
- assert obj.flags['FORTRAN'] # obj attributes are changed inplace!
- assert not obj.flags['CONTIGUOUS']
+ assert_(obj[1][2]==a.arr[1][2]==array(54,dtype=self.type.dtype),`obj,a.arr`)
+ assert_(a.arr is obj)
+ assert_(obj.flags['FORTRAN']) # obj attributes are changed inplace!
+ assert_(not obj.flags['CONTIGUOUS'])
def test_inplace_from_casttype(self):
for t in self.type.cast_types():
if t is self.type:
continue
obj = array(self.num23seq,dtype=t.dtype)
- assert obj.dtype.type==t.dtype
- assert obj.dtype.type is not self.type.dtype
- assert not obj.flags['FORTRAN'] and obj.flags['CONTIGUOUS']
+ assert_(obj.dtype.type==t.dtype)
+ assert_(obj.dtype.type is not self.type.dtype)
+ assert_(not obj.flags['FORTRAN'] and obj.flags['CONTIGUOUS'])
shape = obj.shape
a = self.array(shape,intent.inplace,obj)
- assert obj[1][2]==a.arr[1][2],`obj,a.arr`
+ assert_(obj[1][2]==a.arr[1][2],`obj,a.arr`)
a.arr[1][2]=54
- assert obj[1][2]==a.arr[1][2]==array(54,dtype=self.type.dtype),`obj,a.arr`
- assert a.arr is obj
- assert obj.flags['FORTRAN'] # obj attributes are changed inplace!
- assert not obj.flags['CONTIGUOUS']
- assert obj.dtype.type is self.type.dtype # obj type is changed inplace!
+ assert_(obj[1][2]==a.arr[1][2]==array(54,dtype=self.type.dtype),`obj,a.arr`)
+ assert_(a.arr is obj)
+ assert_(obj.flags['FORTRAN']) # obj attributes are changed inplace!
+ assert_(not obj.flags['CONTIGUOUS'])
+ assert_(obj.dtype.type is self.type.dtype) # obj type is changed inplace!
for t in Type._type_names:
@@ -538,5 +540,6 @@ class test_%s_gen(unittest.TestCase,
''' % (t,t,t)
if __name__ == "__main__":
+ setup()
import nose
nose.runmodule()
diff --git a/numpy/f2py/tests/test_assumed_shape.py b/numpy/f2py/tests/test_assumed_shape.py
new file mode 100644
index 000000000..da362b760
--- /dev/null
+++ b/numpy/f2py/tests/test_assumed_shape.py
@@ -0,0 +1,30 @@
+import os
+import math
+
+from numpy.testing import *
+from numpy import array
+
+import util
+
+def _path(*a):
+ return os.path.join(*((os.path.dirname(__file__),) + a))
+
+class TestAssumedShapeSumExample(util.F2PyTest):
+ sources = [_path('src', 'assumed_shape', 'foo_free.f90'),
+ _path('src', 'assumed_shape', 'foo_use.f90'),
+ _path('src', 'assumed_shape', 'precision.f90'),
+ ]
+
+ @dec.slow
+ def test_all(self):
+ r = self.module.fsum([1,2])
+ assert_(r==3,`r`)
+ r = self.module.sum([1,2])
+ assert_(r==3,`r`)
+
+ r = self.module.sum_with_use([1,2])
+ assert_(r==3,`r`)
+
+if __name__ == "__main__":
+ import nose
+ nose.runmodule()
diff --git a/numpy/f2py/tests/test_callback.py b/numpy/f2py/tests/test_callback.py
index b42e70776..7f0107fd5 100644
--- a/numpy/f2py/tests/test_callback.py
+++ b/numpy/f2py/tests/test_callback.py
@@ -41,24 +41,24 @@ cf2py intent(out) a
def check_function(self, name):
t = getattr(self.module, name)
r = t(lambda : 4)
- assert r==4,`r`
+ assert_( r==4,`r`)
r = t(lambda a:5,fun_extra_args=(6,))
- assert r==5,`r`
+ assert_( r==5,`r`)
r = t(lambda a:a,fun_extra_args=(6,))
- assert r==6,`r`
+ assert_( r==6,`r`)
r = t(lambda a:5+a,fun_extra_args=(7,))
- assert r==12,`r`
+ assert_( r==12,`r`)
r = t(lambda a:math.degrees(a),fun_extra_args=(math.pi,))
- assert r==180,`r`
+ assert_( r==180,`r`)
r = t(math.degrees,fun_extra_args=(math.pi,))
- assert r==180,`r`
+ assert_( r==180,`r`)
r = t(self.module.func, fun_extra_args=(6,))
- assert r==17,`r`
+ assert_( r==17,`r`)
r = t(self.module.func0)
- assert r==11,`r`
+ assert_( r==11,`r`)
r = t(self.module.func0._cpointer)
- assert r==11,`r`
+ assert_( r==11,`r`)
class A:
def __call__(self):
return 7
@@ -66,9 +66,9 @@ cf2py intent(out) a
return 9
a = A()
r = t(a)
- assert r==7,`r`
+ assert_( r==7,`r`)
r = t(a.mth)
- assert r==9,`r`
+ assert_( r==9,`r`)
if __name__ == "__main__":
import nose
diff --git a/numpy/f2py/tests/test_kind.py b/numpy/f2py/tests/test_kind.py
new file mode 100644
index 000000000..a6d485a88
--- /dev/null
+++ b/numpy/f2py/tests/test_kind.py
@@ -0,0 +1,34 @@
+import os
+import math
+
+from numpy.testing import *
+from numpy import array
+
+import util
+
+def _path(*a):
+ return os.path.join(*((os.path.dirname(__file__),) + a))
+
+from numpy.f2py.crackfortran import _selected_int_kind_func as selected_int_kind
+from numpy.f2py.crackfortran import _selected_real_kind_func as selected_real_kind
+
+class TestKind(util.F2PyTest):
+ sources = [_path('src', 'kind', 'foo.f90'),
+ ]
+
+ @dec.slow
+ def test_all(self):
+ selectedrealkind = self.module.selectedrealkind
+ selectedintkind = self.module.selectedintkind
+
+ for i in range(40):
+ assert_(selectedintkind(i) in [selected_int_kind(i),-1],\
+ 'selectedintkind(%s): expected %r but got %r' % (i, selected_int_kind(i), selectedintkind(i)))
+
+ for i in range(20):
+ assert_(selectedrealkind(i) in [selected_real_kind(i),-1],\
+ 'selectedrealkind(%s): expected %r but got %r' % (i, selected_real_kind(i), selectedrealkind(i)))
+
+if __name__ == "__main__":
+ import nose
+ nose.runmodule()
diff --git a/numpy/f2py/tests/test_mixed.py b/numpy/f2py/tests/test_mixed.py
index e7a64c080..a8a14ca4b 100644
--- a/numpy/f2py/tests/test_mixed.py
+++ b/numpy/f2py/tests/test_mixed.py
@@ -16,9 +16,9 @@ class TestMixed(util.F2PyTest):
@dec.slow
def test_all(self):
- assert self.module.bar11() == 11
- assert self.module.foo_fixed.bar12() == 12
- assert self.module.foo_free.bar13() == 13
+ assert_( self.module.bar11() == 11)
+ assert_( self.module.foo_fixed.bar12() == 12)
+ assert_( self.module.foo_free.bar13() == 13)
if __name__ == "__main__":
import nose
diff --git a/numpy/f2py/tests/test_return_character.py b/numpy/f2py/tests/test_return_character.py
index a8ab4aaac..67c542688 100644
--- a/numpy/f2py/tests/test_return_character.py
+++ b/numpy/f2py/tests/test_return_character.py
@@ -7,19 +7,19 @@ class TestReturnCharacter(util.F2PyTest):
def check_function(self, t):
tname = t.__doc__.split()[0]
if tname in ['t0','t1','s0','s1']:
- assert t(23)==asbytes('2')
- r = t('ab');assert r==asbytes('a'),`r`
- r = t(array('ab'));assert r==asbytes('a'),`r`
- r = t(array(77,'u1'));assert r==asbytes('M'),`r`
- #assert_raises(ValueError, t, array([77,87]))
- #assert_raises(ValueError, t, array(77))
+ assert_( t(23)==asbytes('2'))
+ r = t('ab');assert_( r==asbytes('a'),`r`)
+ r = t(array('ab'));assert_( r==asbytes('a'),`r`)
+ r = t(array(77,'u1'));assert_( r==asbytes('M'),`r`)
+ #assert_(_raises(ValueError, t, array([77,87])))
+ #assert_(_raises(ValueError, t, array(77)))
elif tname in ['ts','ss']:
- assert t(23)==asbytes('23 '),`t(23)`
- assert t('123456789abcdef')==asbytes('123456789a')
+ assert_( t(23)==asbytes('23 '),`t(23)`)
+ assert_( t('123456789abcdef')==asbytes('123456789a'))
elif tname in ['t5','s5']:
- assert t(23)==asbytes('23 '),`t(23)`
- assert t('ab')==asbytes('ab '),`t('ab')`
- assert t('123456789abcdef')==asbytes('12345')
+ assert_( t(23)==asbytes('23 '),`t(23)`)
+ assert_( t('ab')==asbytes('ab '),`t('ab')`)
+ assert_( t('123456789abcdef')==asbytes('12345'))
else:
raise NotImplementedError
diff --git a/numpy/f2py/tests/test_return_complex.py b/numpy/f2py/tests/test_return_complex.py
index cff10fcde..f8c6d226a 100644
--- a/numpy/f2py/tests/test_return_complex.py
+++ b/numpy/f2py/tests/test_return_complex.py
@@ -9,28 +9,28 @@ class TestReturnComplex(util.F2PyTest):
err = 1e-5
else:
err = 0.0
- assert abs(t(234j)-234.0j)<=err
- assert abs(t(234.6)-234.6)<=err
- assert abs(t(234l)-234.0)<=err
- assert abs(t(234.6+3j)-(234.6+3j))<=err
- #assert abs(t('234')-234.)<=err
- #assert abs(t('234.6')-234.6)<=err
- assert abs(t(-234)+234.)<=err
- assert abs(t([234])-234.)<=err
- assert abs(t((234,))-234.)<=err
- assert abs(t(array(234))-234.)<=err
- assert abs(t(array(23+4j,'F'))-(23+4j))<=err
- assert abs(t(array([234]))-234.)<=err
- assert abs(t(array([[234]]))-234.)<=err
- assert abs(t(array([234],'b'))+22.)<=err
- assert abs(t(array([234],'h'))-234.)<=err
- assert abs(t(array([234],'i'))-234.)<=err
- assert abs(t(array([234],'l'))-234.)<=err
- assert abs(t(array([234],'q'))-234.)<=err
- assert abs(t(array([234],'f'))-234.)<=err
- assert abs(t(array([234],'d'))-234.)<=err
- assert abs(t(array([234+3j],'F'))-(234+3j))<=err
- assert abs(t(array([234],'D'))-234.)<=err
+ assert_( abs(t(234j)-234.0j)<=err)
+ assert_( abs(t(234.6)-234.6)<=err)
+ assert_( abs(t(234l)-234.0)<=err)
+ assert_( abs(t(234.6+3j)-(234.6+3j))<=err)
+ #assert_( abs(t('234')-234.)<=err)
+ #assert_( abs(t('234.6')-234.6)<=err)
+ assert_( abs(t(-234)+234.)<=err)
+ assert_( abs(t([234])-234.)<=err)
+ assert_( abs(t((234,))-234.)<=err)
+ assert_( abs(t(array(234))-234.)<=err)
+ assert_( abs(t(array(23+4j,'F'))-(23+4j))<=err)
+ assert_( abs(t(array([234]))-234.)<=err)
+ assert_( abs(t(array([[234]]))-234.)<=err)
+ assert_( abs(t(array([234],'b'))+22.)<=err)
+ assert_( abs(t(array([234],'h'))-234.)<=err)
+ assert_( abs(t(array([234],'i'))-234.)<=err)
+ assert_( abs(t(array([234],'l'))-234.)<=err)
+ assert_( abs(t(array([234],'q'))-234.)<=err)
+ assert_( abs(t(array([234],'f'))-234.)<=err)
+ assert_( abs(t(array([234],'d'))-234.)<=err)
+ assert_( abs(t(array([234+3j],'F'))-(234+3j))<=err)
+ assert_( abs(t(array([234],'D'))-234.)<=err)
#assert_raises(TypeError, t, array([234], 'a1'))
assert_raises(TypeError, t, 'abc')
@@ -43,7 +43,7 @@ class TestReturnComplex(util.F2PyTest):
try:
r = t(10l**400)
- assert `r` in ['(inf+0j)','(Infinity+0j)'],`r`
+ assert_( `r` in ['(inf+0j)','(Infinity+0j)'],`r`)
except OverflowError:
pass
diff --git a/numpy/f2py/tests/test_return_integer.py b/numpy/f2py/tests/test_return_integer.py
index 9285cf47f..e1b3a37aa 100644
--- a/numpy/f2py/tests/test_return_integer.py
+++ b/numpy/f2py/tests/test_return_integer.py
@@ -4,23 +4,23 @@ import util
class TestReturnInteger(util.F2PyTest):
def check_function(self, t):
- assert t(123)==123,`t(123)`
- assert t(123.6)==123
- assert t(123l)==123
- assert t('123')==123
- assert t(-123)==-123
- assert t([123])==123
- assert t((123,))==123
- assert t(array(123))==123
- assert t(array([123]))==123
- assert t(array([[123]]))==123
- assert t(array([123],'b'))==123
- assert t(array([123],'h'))==123
- assert t(array([123],'i'))==123
- assert t(array([123],'l'))==123
- assert t(array([123],'B'))==123
- assert t(array([123],'f'))==123
- assert t(array([123],'d'))==123
+ assert_( t(123)==123,`t(123)`)
+ assert_( t(123.6)==123)
+ assert_( t(123l)==123)
+ assert_( t('123')==123)
+ assert_( t(-123)==-123)
+ assert_( t([123])==123)
+ assert_( t((123,))==123)
+ assert_( t(array(123))==123)
+ assert_( t(array([123]))==123)
+ assert_( t(array([[123]]))==123)
+ assert_( t(array([123],'b'))==123)
+ assert_( t(array([123],'h'))==123)
+ assert_( t(array([123],'i'))==123)
+ assert_( t(array([123],'l'))==123)
+ assert_( t(array([123],'B'))==123)
+ assert_( t(array([123],'f'))==123)
+ assert_( t(array([123],'d'))==123)
#assert_raises(ValueError, t, array([123],'S3'))
assert_raises(ValueError, t, 'abc')
diff --git a/numpy/f2py/tests/test_return_logical.py b/numpy/f2py/tests/test_return_logical.py
index ab24517f2..059b843dc 100644
--- a/numpy/f2py/tests/test_return_logical.py
+++ b/numpy/f2py/tests/test_return_logical.py
@@ -4,44 +4,44 @@ import util
class TestReturnLogical(util.F2PyTest):
def check_function(self, t):
- assert t(True)==1,`t(True)`
- assert t(False)==0,`t(False)`
- assert t(0)==0
- assert t(None)==0
- assert t(0.0)==0
- assert t(0j)==0
- assert t(1j)==1
- assert t(234)==1
- assert t(234.6)==1
- assert t(234l)==1
- assert t(234.6+3j)==1
- assert t('234')==1
- assert t('aaa')==1
- assert t('')==0
- assert t([])==0
- assert t(())==0
- assert t({})==0
- assert t(t)==1
- assert t(-234)==1
- assert t(10l**100)==1
- assert t([234])==1
- assert t((234,))==1
- assert t(array(234))==1
- assert t(array([234]))==1
- assert t(array([[234]]))==1
- assert t(array([234],'b'))==1
- assert t(array([234],'h'))==1
- assert t(array([234],'i'))==1
- assert t(array([234],'l'))==1
- assert t(array([234],'f'))==1
- assert t(array([234],'d'))==1
- assert t(array([234+3j],'F'))==1
- assert t(array([234],'D'))==1
- assert t(array(0))==0
- assert t(array([0]))==0
- assert t(array([[0]]))==0
- assert t(array([0j]))==0
- assert t(array([1]))==1
+ assert_( t(True)==1,`t(True)`)
+ assert_( t(False)==0,`t(False)`)
+ assert_( t(0)==0)
+ assert_( t(None)==0)
+ assert_( t(0.0)==0)
+ assert_( t(0j)==0)
+ assert_( t(1j)==1)
+ assert_( t(234)==1)
+ assert_( t(234.6)==1)
+ assert_( t(234l)==1)
+ assert_( t(234.6+3j)==1)
+ assert_( t('234')==1)
+ assert_( t('aaa')==1)
+ assert_( t('')==0)
+ assert_( t([])==0)
+ assert_( t(())==0)
+ assert_( t({})==0)
+ assert_( t(t)==1)
+ assert_( t(-234)==1)
+ assert_( t(10l**100)==1)
+ assert_( t([234])==1)
+ assert_( t((234,))==1)
+ assert_( t(array(234))==1)
+ assert_( t(array([234]))==1)
+ assert_( t(array([[234]]))==1)
+ assert_( t(array([234],'b'))==1)
+ assert_( t(array([234],'h'))==1)
+ assert_( t(array([234],'i'))==1)
+ assert_( t(array([234],'l'))==1)
+ assert_( t(array([234],'f'))==1)
+ assert_( t(array([234],'d'))==1)
+ assert_( t(array([234+3j],'F'))==1)
+ assert_( t(array([234],'D'))==1)
+ assert_( t(array(0))==0)
+ assert_( t(array([0]))==0)
+ assert_( t(array([[0]]))==0)
+ assert_( t(array([0j]))==0)
+ assert_( t(array([1]))==1)
assert_raises(ValueError, t, array([0,0]))
diff --git a/numpy/f2py/tests/test_return_real.py b/numpy/f2py/tests/test_return_real.py
index eae098add..5dc12708e 100644
--- a/numpy/f2py/tests/test_return_real.py
+++ b/numpy/f2py/tests/test_return_real.py
@@ -9,26 +9,26 @@ class TestReturnReal(util.F2PyTest):
err = 1e-5
else:
err = 0.0
- assert abs(t(234)-234.0)<=err
- assert abs(t(234.6)-234.6)<=err
- assert abs(t(234l)-234.0)<=err
- assert abs(t('234')-234)<=err
- assert abs(t('234.6')-234.6)<=err
- assert abs(t(-234)+234)<=err
- assert abs(t([234])-234)<=err
- assert abs(t((234,))-234.)<=err
- assert abs(t(array(234))-234.)<=err
- assert abs(t(array([234]))-234.)<=err
- assert abs(t(array([[234]]))-234.)<=err
- assert abs(t(array([234],'b'))+22)<=err
- assert abs(t(array([234],'h'))-234.)<=err
- assert abs(t(array([234],'i'))-234.)<=err
- assert abs(t(array([234],'l'))-234.)<=err
- assert abs(t(array([234],'B'))-234.)<=err
- assert abs(t(array([234],'f'))-234.)<=err
- assert abs(t(array([234],'d'))-234.)<=err
+ assert_( abs(t(234)-234.0)<=err)
+ assert_( abs(t(234.6)-234.6)<=err)
+ assert_( abs(t(234l)-234.0)<=err)
+ assert_( abs(t('234')-234)<=err)
+ assert_( abs(t('234.6')-234.6)<=err)
+ assert_( abs(t(-234)+234)<=err)
+ assert_( abs(t([234])-234)<=err)
+ assert_( abs(t((234,))-234.)<=err)
+ assert_( abs(t(array(234))-234.)<=err)
+ assert_( abs(t(array([234]))-234.)<=err)
+ assert_( abs(t(array([[234]]))-234.)<=err)
+ assert_( abs(t(array([234],'b'))+22)<=err)
+ assert_( abs(t(array([234],'h'))-234.)<=err)
+ assert_( abs(t(array([234],'i'))-234.)<=err)
+ assert_( abs(t(array([234],'l'))-234.)<=err)
+ assert_( abs(t(array([234],'B'))-234.)<=err)
+ assert_( abs(t(array([234],'f'))-234.)<=err)
+ assert_( abs(t(array([234],'d'))-234.)<=err)
if t.__doc__.split()[0] in ['t0','t4','s0','s4']:
- assert t(1e200)==t(1e300) # inf
+ assert_( t(1e200)==t(1e300)) # inf
#assert_raises(ValueError, t, array([234], 'S1'))
assert_raises(ValueError, t, 'abc')
@@ -41,7 +41,7 @@ class TestReturnReal(util.F2PyTest):
try:
r = t(10l**400)
- assert `r` in ['inf','Infinity'],`r`
+ assert_( `r` in ['inf','Infinity'],`r`)
except OverflowError:
pass
diff --git a/numpy/f2py/tests/test_size.py b/numpy/f2py/tests/test_size.py
new file mode 100644
index 000000000..c00dd9a31
--- /dev/null
+++ b/numpy/f2py/tests/test_size.py
@@ -0,0 +1,29 @@
+import os
+import math
+
+from numpy.testing import *
+from numpy import array
+
+import util
+
+def _path(*a):
+ return os.path.join(*((os.path.dirname(__file__),) + a))
+
+class TestSizeSumExample(util.F2PyTest):
+ sources = [_path('src', 'size', 'foo.f90'),
+ ]
+
+ @dec.slow
+ def test_all(self):
+ r = self.module.foo([[1,2]])
+ assert_equal(r, [3],`r`)
+
+ r = self.module.foo([[1,2],[3,4]])
+ assert_equal(r, [3,7],`r`)
+
+ r = self.module.foo([[1,2],[3,4],[5,6]])
+ assert_equal(r, [3,7,11],`r`)
+
+if __name__ == "__main__":
+ import nose
+ nose.runmodule()
diff --git a/numpy/f2py/tests/util.py b/numpy/f2py/tests/util.py
index 422d5965e..a5816b96f 100644
--- a/numpy/f2py/tests/util.py
+++ b/numpy/f2py/tests/util.py
@@ -106,6 +106,12 @@ def build_module(source_files, options=[], skip=[], only=[], module_name=None):
shutil.copyfile(fn, dst)
dst_sources.append(dst)
+ fn = os.path.join(os.path.dirname(fn), '.f2py_f2cmap')
+ if os.path.isfile(fn):
+ dst = os.path.join(d, os.path.basename(fn))
+ if not os.path.isfile(dst):
+ shutil.copyfile(fn, dst)
+
# Prepare options
if module_name is None:
module_name = get_temp_module_name()
diff --git a/numpy/fft/fftpack.py b/numpy/fft/fftpack.py
index 52cd1ae0c..7f9ee57fd 100644
--- a/numpy/fft/fftpack.py
+++ b/numpy/fft/fftpack.py
@@ -31,8 +31,7 @@ version of the FFTPACK routines.
"""
__all__ = ['fft','ifft', 'rfft', 'irfft', 'hfft', 'ihfft', 'rfftn',
- 'irfftn', 'rfft2', 'irfft2', 'fft2', 'ifft2', 'fftn', 'ifftn',
- 'refft', 'irefft','refftn','irefftn', 'refft2', 'irefft2']
+ 'irfftn', 'rfft2', 'irfft2', 'fft2', 'ifft2', 'fftn', 'ifftn']
from numpy.core import asarray, zeros, swapaxes, shape, conjugate, \
take
@@ -1114,12 +1113,3 @@ def irfft2(a, s=None, axes=(-2,-1)):
"""
return irfftn(a, s, axes)
-
-# Deprecated names
-from numpy import deprecate
-refft = deprecate(rfft, 'refft', 'rfft')
-irefft = deprecate(irfft, 'irefft', 'irfft')
-refft2 = deprecate(rfft2, 'refft2', 'rfft2')
-irefft2 = deprecate(irfft2, 'irefft2', 'irfft2')
-refftn = deprecate(rfftn, 'refftn', 'rfftn')
-irefftn = deprecate(irfftn, 'irefftn', 'irfftn')
diff --git a/numpy/lib/arraysetops.py b/numpy/lib/arraysetops.py
index 042866f30..721039238 100644
--- a/numpy/lib/arraysetops.py
+++ b/numpy/lib/arraysetops.py
@@ -10,11 +10,6 @@ Set operations for 1D numeric arrays based on sorting.
union1d,
setdiff1d
-:Deprecated:
- unique1d,
- intersect1d_nu,
- setmember1d
-
:Notes:
For floating point arrays, inaccurate results may appear due to usual round-off
@@ -28,8 +23,8 @@ To do: Optionally return indices analogously to unique for all functions.
:Author: Robert Cimrman
"""
-__all__ = ['ediff1d', 'unique1d', 'intersect1d', 'intersect1d_nu', 'setxor1d',
- 'setmember1d', 'union1d', 'setdiff1d', 'unique', 'in1d']
+__all__ = ['ediff1d', 'intersect1d', 'setxor1d', 'union1d', 'setdiff1d',
+ 'unique', 'in1d']
import numpy as np
from numpy.lib.utils import deprecate
@@ -417,72 +412,3 @@ def setdiff1d(ar1, ar2, assume_unique=False):
return aux
else:
return np.asarray(ar1)[aux == 0]
-
-@deprecate
-def unique1d(ar1, return_index=False, return_inverse=False):
- """
- This function is deprecated. Use unique() instead.
- """
- if return_index:
- import warnings
- warnings.warn("The order of the output arguments for "
- "`return_index` has changed. Before, "
- "the output was (indices, unique_arr), but "
- "has now been reversed to be more consistent.")
-
- ar = np.asanyarray(ar1).flatten()
- if ar.size == 0:
- if return_inverse and return_index:
- return ar, np.empty(0, np.bool), np.empty(0, np.bool)
- elif return_inverse or return_index:
- return ar, np.empty(0, np.bool)
- else:
- return ar
-
- if return_inverse or return_index:
- perm = ar.argsort()
- aux = ar[perm]
- flag = np.concatenate(([True], aux[1:] != aux[:-1]))
- if return_inverse:
- iflag = np.cumsum(flag) - 1
- iperm = perm.argsort()
- if return_index:
- return aux[flag], perm[flag], iflag[iperm]
- else:
- return aux[flag], iflag[iperm]
- else:
- return aux[flag], perm[flag]
-
- else:
- ar.sort()
- flag = np.concatenate(([True], ar[1:] != ar[:-1]))
- return ar[flag]
-
-@deprecate
-def intersect1d_nu(ar1, ar2):
- """
- This function is deprecated. Use intersect1d()
- instead.
- """
- # Might be faster than unique1d( intersect1d( ar1, ar2 ) )?
- aux = np.concatenate((unique1d(ar1), unique1d(ar2)))
- aux.sort()
- return aux[aux[1:] == aux[:-1]]
-
-@deprecate
-def setmember1d(ar1, ar2):
- """
- This function is deprecated. Use in1d(assume_unique=True)
- instead.
- """
- # We need this to be a stable sort, so always use 'mergesort' here. The
- # values from the first array should always come before the values from the
- # second array.
- ar = np.concatenate( (ar1, ar2 ) )
- order = ar.argsort(kind='mergesort')
- sar = ar[order]
- equal_adj = (sar[1:] == sar[:-1])
- flag = np.concatenate( (equal_adj, [False] ) )
-
- indx = order.argsort(kind='mergesort')[:len( ar1 )]
- return flag[indx]
diff --git a/numpy/lib/benchmarks/bench_arraysetops.py b/numpy/lib/benchmarks/bench_arraysetops.py
deleted file mode 100644
index 2c77fb758..000000000
--- a/numpy/lib/benchmarks/bench_arraysetops.py
+++ /dev/null
@@ -1,65 +0,0 @@
-import numpy as np
-import time
-from numpy.lib.arraysetops import *
-
-def bench_unique1d( plot_results = False ):
- exponents = np.linspace( 2, 7, 9 )
- ratios = []
- nItems = []
- dt1s = []
- dt2s = []
- for ii in exponents:
-
- nItem = 10 ** ii
- print 'using %d items:' % nItem
- a = np.fix( nItem / 10 * np.random.random( nItem ) )
-
- print 'unique:'
- tt = time.clock()
- b = np.unique( a )
- dt1 = time.clock() - tt
- print dt1
-
- print 'unique1d:'
- tt = time.clock()
- c = unique1d( a )
- dt2 = time.clock() - tt
- print dt2
-
-
- if dt1 < 1e-8:
- ratio = 'ND'
- else:
- ratio = dt2 / dt1
- print 'ratio:', ratio
- print 'nUnique: %d == %d\n' % (len( b ), len( c ))
-
- nItems.append( nItem )
- ratios.append( ratio )
- dt1s.append( dt1 )
- dt2s.append( dt2 )
-
- assert np.alltrue( b == c )
-
- print nItems
- print dt1s
- print dt2s
- print ratios
-
- if plot_results:
- import pylab
-
- def plotMe( fig, fun, nItems, dt1s, dt2s ):
- pylab.figure( fig )
- fun( nItems, dt1s, 'g-o', linewidth = 2, markersize = 8 )
- fun( nItems, dt2s, 'b-x', linewidth = 2, markersize = 8 )
- pylab.legend( ('unique', 'unique1d' ) )
- pylab.xlabel( 'nItem' )
- pylab.ylabel( 'time [s]' )
-
- plotMe( 1, pylab.loglog, nItems, dt1s, dt2s )
- plotMe( 2, pylab.plot, nItems, dt1s, dt2s )
- pylab.show()
-
-if __name__ == '__main__':
- bench_unique1d( plot_results = True )
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index b2d2856d6..dd792c509 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -1447,8 +1447,7 @@ def nanmin(a, axis=None):
Positive infinity is treated as a very large number and negative infinity
is treated as a very small (i.e. negative) number.
- If the input has a integer type, an integer type is returned unless
- the input contains NaNs and infinity.
+ If the input has a integer type the function is equivalent to np.min.
Examples
@@ -1469,7 +1468,11 @@ def nanmin(a, axis=None):
-inf
"""
- return _nanop(np.min, np.inf, a, axis)
+ a = np.asanyarray(a)
+ if axis is not None:
+ return np.fmin.reduce(a, axis)
+ else:
+ return np.fmin.reduce(a.flat)
def nanargmin(a, axis=None):
"""
@@ -1541,8 +1544,7 @@ def nanmax(a, axis=None):
Positive infinity is treated as a very large number and negative infinity
is treated as a very small (i.e. negative) number.
- If the input has a integer type, an integer type is returned unless
- the input contains NaNs and infinity.
+ If the input has a integer type the function is equivalent to np.max.
Examples
--------
@@ -1562,7 +1564,11 @@ def nanmax(a, axis=None):
inf
"""
- return _nanop(np.max, -np.inf, a, axis)
+ a = np.asanyarray(a)
+ if axis is not None:
+ return np.fmax.reduce(a, axis)
+ else:
+ return np.fmax.reduce(a.flat)
def nanargmax(a, axis=None):
"""
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py
index 15d29d60b..9fbacaa22 100644
--- a/numpy/lib/npyio.py
+++ b/numpy/lib/npyio.py
@@ -1049,7 +1049,7 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None,
"""
Load data from a text file, with missing values handled as specified.
- Each line past the first `skiprows` lines is split at the `delimiter`
+ Each line past the first `skip_header` lines is split at the `delimiter`
character, and characters following the `comments` character are discarded.
Parameters
@@ -1072,20 +1072,20 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None,
The numbers of lines to skip at the beginning of the file.
skip_footer : int, optional
The numbers of lines to skip at the end of the file
- converters : variable or None, optional
+ converters : variable, optional
The set of functions that convert the data of a column to a value.
The converters can also be used to provide a default value
for missing data: ``converters = {3: lambda s: float(s or 0)}``.
- missing_values : variable or None, optional
+ missing_values : variable, optional
The set of strings corresponding to missing data.
- filling_values : variable or None, optional
+ filling_values : variable, optional
The set of values to be used as default when the data are missing.
- usecols : sequence or None, optional
+ 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.
names : {None, True, str, sequence}, optional
If `names` is True, the field names are read from the first valid line
- after the first `skiprows` lines.
+ after the first `skip_header` lines.
If `names` is a sequence or a single-string of comma-separated names,
the names will be used to define the field names in a structured dtype.
If `names` is None, the names of the dtype fields will be used, if any.
@@ -1218,9 +1218,10 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None,
# Get the first valid lines after the first skiprows ones ..
if skiprows:
- warnings.warn("The use of `skiprows` is deprecated.\n"\
- "Please use `skip_header` instead.",
- DeprecationWarning)
+ warnings.warn(\
+ "The use of `skiprows` is deprecated, it will be removed in numpy 2.0.\n" \
+ "Please use `skip_header` instead.",
+ DeprecationWarning)
skip_header = skiprows
# Skip the first `skip_header` rows
for i in xrange(skip_header):
@@ -1343,9 +1344,10 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None,
# Process the deprecated `missing`
if missing != asbytes(''):
- warnings.warn("The use of `missing` is deprecated.\n"\
- "Please use `missing_values` instead.",
- DeprecationWarning)
+ warnings.warn(\
+ "The use of `missing` is deprecated, it will be removed in Numpy 2.0.\n" \
+ "Please use `missing_values` instead.",
+ DeprecationWarning)
values = [str(_) for _ in missing.split(asbytes(","))]
for entry in missing_values:
entry.extend(values)
diff --git a/numpy/lib/src/_compiled_base.c b/numpy/lib/src/_compiled_base.c
index bca2426e6..b81d2783a 100644
--- a/numpy/lib/src/_compiled_base.c
+++ b/numpy/lib/src/_compiled_base.c
@@ -679,7 +679,8 @@ static PyObject *
arr_ravel_coords(PyObject *self, PyObject *args, PyObject *kwds)
{
int i, s;
- PyObject *mode0=NULL, *coords0=NULL, *ret;
+ PyObject *mode0=NULL, *coords0=NULL;
+ PyArrayObject *ret = NULL;
PyArray_Dims dimensions={0,0};
npy_intp ravel_strides[NPY_MAXDIMS];
PyArray_ORDER order = NPY_CORDER;
@@ -754,18 +755,17 @@ arr_ravel_coords(PyObject *self, PyObject *args, PyObject *kwds)
}
iter = NpyIter_MultiNew(dimensions.len+1, op, NPY_ITER_BUFFERED|
- NPY_ITER_NO_INNER_ITERATION|
+ NPY_ITER_EXTERNAL_LOOP|
NPY_ITER_ZEROSIZE_OK,
NPY_KEEPORDER,
NPY_SAME_KIND_CASTING,
- op_flags, dtype,
- 0, NULL, 0);
+ op_flags, dtype);
if (iter == NULL) {
goto fail;
}
if (NpyIter_GetIterSize(iter) != 0) {
- NpyIter_IterNext_Fn iternext;
+ NpyIter_IterNextFunc *iternext;
char **dataptr;
npy_intp *strides;
npy_intp *countptr;
@@ -787,7 +787,7 @@ arr_ravel_coords(PyObject *self, PyObject *args, PyObject *kwds)
} while(iternext(iter));
}
- ret = (PyObject *)NpyIter_GetOperandArray(iter)[dimensions.len];
+ ret = NpyIter_GetOperandArray(iter)[dimensions.len];
Py_INCREF(ret);
Py_DECREF(dtype[0]);
@@ -925,7 +925,7 @@ arr_unravel_index(PyObject *self, PyObject *args, PyObject *kwds)
NPY_ITER_DONT_NEGATE_STRIDES|
NPY_ITER_COORDS,
NPY_KEEPORDER, NPY_SAME_KIND_CASTING,
- dtype, 0, NULL, 0);
+ dtype);
if (iter == NULL) {
goto fail;
}
@@ -949,7 +949,7 @@ arr_unravel_index(PyObject *self, PyObject *args, PyObject *kwds)
if (NpyIter_RemoveCoords(iter) != NPY_SUCCEED) {
goto fail;
}
- if (NpyIter_RemoveInnerLoop(iter) != NPY_SUCCEED) {
+ if (NpyIter_EnableExternalLoop(iter) != NPY_SUCCEED) {
goto fail;
}
@@ -962,7 +962,7 @@ arr_unravel_index(PyObject *self, PyObject *args, PyObject *kwds)
if (order == NPY_CORDER) {
if (NpyIter_GetIterSize(iter) != 0) {
- NpyIter_IterNext_Fn iternext;
+ NpyIter_IterNextFunc *iternext;
char **dataptr;
npy_intp *strides;
npy_intp *countptr, count;
@@ -989,7 +989,7 @@ arr_unravel_index(PyObject *self, PyObject *args, PyObject *kwds)
}
else if (order == NPY_FORTRANORDER) {
if (NpyIter_GetIterSize(iter) != 0) {
- NpyIter_IterNext_Fn iternext;
+ NpyIter_IterNextFunc *iternext;
char **dataptr;
npy_intp *strides;
npy_intp *countptr, count;
diff --git a/numpy/lib/tests/test_arraysetops.py b/numpy/lib/tests/test_arraysetops.py
index dac39cd50..907a27a8c 100644
--- a/numpy/lib/tests/test_arraysetops.py
+++ b/numpy/lib/tests/test_arraysetops.py
@@ -17,7 +17,7 @@ class TestAso(TestCase):
assert_array_equal( c, ec )
vals, indices = unique( a, return_index=True )
-
+
ed = np.array( [2, 3, 0, 1] )
assert_array_equal(vals, ec)
@@ -25,7 +25,7 @@ class TestAso(TestCase):
vals, ind0, ind1 = unique( a, return_index=True,
return_inverse=True )
-
+
ee = np.array( [2, 3, 0, 1, 0, 2, 3] )
assert_array_equal(vals, ec)
@@ -53,21 +53,6 @@ class TestAso(TestCase):
assert_array_equal([], intersect1d([],[]))
- def test_intersect1d_nu( self ):
- # This should be removed when intersect1d_nu is removed.
- a = np.array( [5, 5, 7, 1, 2] )
- b = np.array( [2, 1, 4, 3, 3, 1, 5] )
-
- ec = np.array( [1, 2, 5] )
- warnings.filterwarnings('ignore', message='\s*`intersect1d_nu` is deprecated!')
- warnings.filterwarnings('ignore', message='\s*`unique1d` is deprecated!')
- c = intersect1d_nu( a, b )
- assert_array_equal( c, ec )
- assert_array_equal([], intersect1d_nu([],[]))
- warnings.filters.pop(0)
- warnings.filters.pop(0)
-
-
def test_setxor1d( self ):
a = np.array( [5, 7, 1, 2] )
b = np.array( [2, 4, 3, 1, 5] )
@@ -104,30 +89,6 @@ class TestAso(TestCase):
assert_array_equal([],ediff1d(one_elem))
assert_array_equal([1],ediff1d(two_elem))
- def test_setmember1d( self ):
- # This should be removed when setmember1d is removed.
- a = np.array( [5, 7, 1, 2] )
- b = np.array( [2, 4, 3, 1, 5] )
-
- ec = np.array( [True, False, True, True] )
- warnings.filterwarnings('ignore', '\s*`setmember1d` is deprecated!')
- c = setmember1d( a, b )
-
- assert_array_equal( c, ec )
-
- a[0] = 8
- ec = np.array( [False, False, True, True] )
- c = setmember1d( a, b )
- assert_array_equal( c, ec )
-
- a[0], a[3] = 4, 8
- ec = np.array( [True, False, True, False] )
- c = setmember1d( a, b )
- assert_array_equal( c, ec )
-
- assert_array_equal([], setmember1d([],[]))
- warnings.filters.pop(0)
-
def test_in1d(self):
a = np.array( [5, 7, 1, 2] )
b = np.array( [2, 4, 3, 1, 5] )
@@ -145,7 +106,7 @@ class TestAso(TestCase):
ec = np.array( [True, False, True, False] )
c = in1d( a, b, assume_unique=True )
assert_array_equal( c, ec )
-
+
a = np.array([5,4,5,3,4,4,3,4,3,5,2,1,5,5])
b = [2,3,4]
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py
index 700798e76..13930c79e 100644
--- a/numpy/lib/tests/test_function_base.py
+++ b/numpy/lib/tests/test_function_base.py
@@ -13,13 +13,13 @@ class TestAny(TestCase):
y1 = [0, 0, 1, 0]
y2 = [0, 0, 0, 0]
y3 = [1, 0, 1, 0]
- assert(any(y1))
- assert(any(y3))
- assert(not any(y2))
+ assert_(any(y1))
+ assert_(any(y3))
+ assert_(not any(y2))
def test_nd(self):
y1 = [[0, 0, 0], [0, 1, 0], [1, 1, 0]]
- assert(any(y1))
+ assert_(any(y1))
assert_array_equal(sometrue(y1, axis=0), [1, 1, 0])
assert_array_equal(sometrue(y1, axis=1), [0, 1, 1])
@@ -29,14 +29,14 @@ class TestAll(TestCase):
y1 = [0, 1, 1, 0]
y2 = [0, 0, 0, 0]
y3 = [1, 1, 1, 1]
- assert(not all(y1))
- assert(all(y3))
- assert(not all(y2))
- assert(all(~array(y2)))
+ assert_(not all(y1))
+ assert_(all(y3))
+ assert_(not all(y2))
+ assert_(all(~array(y2)))
def test_nd(self):
y1 = [[0, 0, 1], [0, 1, 1], [1, 1, 1]]
- assert(not all(y1))
+ assert_(not all(y1))
assert_array_equal(alltrue(y1, axis=0), [0, 0, 1])
assert_array_equal(alltrue(y1, axis=1), [0, 0, 1])
@@ -44,11 +44,11 @@ class TestAll(TestCase):
class TestAverage(TestCase):
def test_basic(self):
y1 = array([1, 2, 3])
- assert(average(y1, axis=0) == 2.)
+ assert_(average(y1, axis=0) == 2.)
y2 = array([1., 2., 3.])
- assert(average(y2, axis=0) == 2.)
+ assert_(average(y2, axis=0) == 2.)
y3 = [0., 0., 0.]
- assert(average(y3, axis=0) == 0.)
+ assert_(average(y3, axis=0) == 0.)
y4 = ones((4, 4))
y4[0, 1] = 0
@@ -407,7 +407,7 @@ class TestDigitize(TestCase):
def test_random(self):
x = rand(10)
bin = linspace(x.min(), x.max(), 10)
- assert all(digitize(x, bin) != 0)
+ assert_(all(digitize(x, bin) != 0))
class TestUnwrap(TestCase):
@@ -415,7 +415,7 @@ class TestUnwrap(TestCase):
#check that unwrap removes jumps greather that 2*pi
assert_array_equal(unwrap([1, 1 + 2 * pi]), [1, 1])
#check that unwrap maintans continuity
- assert(all(diff(unwrap(rand(10) * 100)) < pi))
+ assert_(all(diff(unwrap(rand(10) * 100)) < pi))
class TestFilterwindows(TestCase):
@@ -520,7 +520,7 @@ class TestTrapz(TestCase):
class TestSinc(TestCase):
def test_simple(self):
- assert(sinc(0) == 1)
+ assert_(sinc(0) == 1)
w = sinc(linspace(-1, 1, 100))
#check symmetry
assert_array_almost_equal(w, flipud(w), 7)
@@ -565,7 +565,7 @@ class TestHistogram(TestCase):
area = sum(a * diff(b))
assert_almost_equal(area, 1)
- warnings.filterwarnings('ignore',
+ warnings.filterwarnings('ignore',
message="\s*This release of NumPy fixes a normalization bug")
# Check with non-constant bin widths
v = np.arange(10)
@@ -573,20 +573,20 @@ class TestHistogram(TestCase):
a, b = histogram(v, bins, normed=True)
assert_array_equal(a, .1)
assert_equal(sum(a*diff(b)), 1)
-
+
# Variale bin widths are especially useful to deal with
# infinities.
v = np.arange(10)
bins = [0,1,3,6,np.inf]
a, b = histogram(v, bins, normed=True)
assert_array_equal(a, [.1,.1,.1,0.])
-
+
# Taken from a bug report from N. Becker on the numpy-discussion
- # mailing list Aug. 6, 2010.
+ # mailing list Aug. 6, 2010.
counts, dmy = np.histogram([1,2,3,4], [0.5,1.5,np.inf], normed=True)
assert_equal(counts, [.25, 0])
warnings.filters.pop(0)
-
+
def test_outliers(self):
# Check that outliers are not tallied
a = arange(10) + .5
@@ -615,16 +615,16 @@ class TestHistogram(TestCase):
# Check the type of the returned histogram
a = arange(10) + .5
h, b = histogram(a)
- assert(issubdtype(h.dtype, int))
+ assert_(issubdtype(h.dtype, int))
h, b = histogram(a, normed=True)
- assert(issubdtype(h.dtype, float))
+ assert_(issubdtype(h.dtype, float))
h, b = histogram(a, weights=ones(10, int))
- assert(issubdtype(h.dtype, int))
+ assert_(issubdtype(h.dtype, int))
h, b = histogram(a, weights=ones(10, float))
- assert(issubdtype(h.dtype, float))
+ assert_(issubdtype(h.dtype, float))
def test_weights(self):
v = rand(100)
@@ -655,7 +655,7 @@ class TestHistogram(TestCase):
weights=[2,1,1,1,1,1,1,1,1], normed=True)
assert_almost_equal(a, [.2, .1, .1, .075])
warnings.filters.pop(0)
-
+
class TestHistogramdd(TestCase):
def test_simple(self):
@@ -668,7 +668,7 @@ class TestHistogramdd(TestCase):
# Check normalization
ed = [[-2, 0, 2], [0, 1, 2, 3], [0, 1, 2, 3]]
H, edges = histogramdd(x, bins=ed, normed=True)
- assert(all(H == answer / 12.))
+ assert_(all(H == answer / 12.))
# Check that H has the correct shape.
H, edges = histogramdd(x, (2, 3, 4), range=[[-1, 1], [0, 3], [0, 4]],
normed=True)
@@ -697,7 +697,7 @@ class TestHistogramdd(TestCase):
r = rand(10, 3)
for b in bins:
H, edges = histogramdd(r, b)
- assert(H.shape == b)
+ assert_(H.shape == b)
def test_shape_4d(self):
# All possible permutations for bins of different lengths in 4D.
@@ -711,7 +711,7 @@ class TestHistogramdd(TestCase):
r = rand(10, 4)
for b in bins:
H, edges = histogramdd(r, b)
- assert(H.shape == b)
+ assert_(H.shape == b)
def test_weights(self):
v = rand(100, 2)
@@ -733,12 +733,12 @@ class TestHistogramdd(TestCase):
class TestUnique(TestCase):
def test_simple(self):
x = array([4, 3, 2, 1, 1, 2, 3, 4, 0])
- assert(all(unique(x) == [0, 1, 2, 3, 4]))
- assert(unique(array([1, 1, 1, 1, 1])) == array([1]))
+ assert_(all(unique(x) == [0, 1, 2, 3, 4]))
+ assert_(unique(array([1, 1, 1, 1, 1])) == array([1]))
x = ['widget', 'ham', 'foo', 'bar', 'foo', 'ham']
- assert(all(unique(x) == ['bar', 'foo', 'ham', 'widget']))
+ assert_(all(unique(x) == ['bar', 'foo', 'ham', 'widget']))
x = array([5 + 6j, 1 + 1j, 1 + 10j, 10, 5 + 6j])
- assert(all(unique(x) == [1 + 1j, 1 + 10j, 5 + 6j, 10]))
+ assert_(all(unique(x) == [1 + 1j, 1 + 10j, 5 + 6j, 10]))
class TestCheckFinite(TestCase):
@@ -792,7 +792,7 @@ class TestNaNFuncts(TestCase):
array([[ 0.01319214, 0.11704017, 0.1630199 ],
[ 0.37910852, 0.87964135, 0.34306596],
[ 0.72687499, 0.23913896, 0.33850425]]))
- assert nanmin([nan, nan]) is nan
+ assert_(np.isnan(nanmin([nan, nan])))
def test_nanargmin(self):
assert_almost_equal(nanargmin(self.A), 1)
@@ -823,6 +823,7 @@ class TestNaNFuncts(TestCase):
array([[ 0.01620964, 0.75157887, 0.28333658],
[ 0.59541557, 0.87964135, 0.70543747],
[ 0.91084584, 0.84386844, 0.37068164]]))
+ assert_(np.isnan(nanmax([nan, nan])))
def test_nanmin_allnan_on_axis(self):
assert_array_equal(isnan(nanmin([[nan] * 2] * 3, axis=1)),
@@ -923,7 +924,7 @@ class Test_i0(TestCase):
class TestKaiser(TestCase):
def test_simple(self):
assert_almost_equal(kaiser(0, 1.0), array([]))
- assert isfinite(kaiser(1, 1.0))
+ assert_(isfinite(kaiser(1, 1.0)))
assert_almost_equal(kaiser(2, 1.0), array([ 0.78984831, 0.78984831]))
assert_almost_equal(kaiser(5, 1.0),
array([ 0.78984831, 0.94503323, 1. ,
@@ -950,14 +951,14 @@ class TestMsort(TestCase):
class TestMeshgrid(TestCase):
def test_simple(self):
[X, Y] = meshgrid([1, 2, 3], [4, 5, 6, 7])
- assert all(X == array([[1, 2, 3],
+ assert_(all(X == array([[1, 2, 3],
[1, 2, 3],
[1, 2, 3],
- [1, 2, 3]]))
- assert all(Y == array([[4, 4, 4],
+ [1, 2, 3]])))
+ assert_(all(Y == array([[4, 4, 4],
[5, 5, 5],
[6, 6, 6],
- [7, 7, 7]]))
+ [7, 7, 7]])))
class TestPiecewise(TestCase):
@@ -1001,8 +1002,8 @@ class TestPiecewise(TestCase):
def test_0d(self):
x = array(3)
y = piecewise(x, x > 3, [4, 0])
- assert y.ndim == 0
- assert y == 0
+ assert_(y.ndim == 0)
+ assert_(y == 0)
class TestBincount(TestCase):
diff --git a/numpy/lib/tests/test_regression.py b/numpy/lib/tests/test_regression.py
index 0e63fb08c..c0cfff9a5 100644
--- a/numpy/lib/tests/test_regression.py
+++ b/numpy/lib/tests/test_regression.py
@@ -166,19 +166,18 @@ class TestRegression(TestCase):
except:
raise AssertionError("ticket #1243")
finally:
+ sys.stdout.close()
sys.stdout = oldstdout
def test_bincount_empty(self):
"""Ticket #1387: empty array as input for bincount."""
assert_raises(ValueError, lambda : np.bincount(np.array([], dtype=np.intp)))
- @dec.deprecated()
def test_include_dirs(self):
"""As a sanity check, just test that get_include and
get_numarray_include include something reasonable. Somewhat
related to ticket #1405."""
- include_dirs = [np.get_include(), np.get_numarray_include(),
- np.get_numpy_include()]
+ include_dirs = [np.get_include(), np.get_numarray_include()]
for path in include_dirs:
assert_(isinstance(path, (str, unicode)))
assert_(path != '')
diff --git a/numpy/lib/tests/test_ufunclike.py b/numpy/lib/tests/test_ufunclike.py
index e9c41d09c..29b47f257 100644
--- a/numpy/lib/tests/test_ufunclike.py
+++ b/numpy/lib/tests/test_ufunclike.py
@@ -27,17 +27,6 @@ class TestUfunclike(TestCase):
assert_equal(res, tgt)
assert_equal(out, tgt)
- @deprecated()
- def test_log2(self):
- a = nx.array([4.5, 2.3, 6.5])
- out = nx.zeros(a.shape, float)
- tgt = nx.array([2.169925, 1.20163386, 2.70043972])
- res = ufl.log2(a)
- assert_almost_equal(res, tgt)
- res = ufl.log2(a, out)
- assert_almost_equal(res, tgt)
- assert_almost_equal(out, tgt)
-
def test_fix(self):
a = nx.array([[1.0, 1.1, 1.5, 1.8], [-1.0, -1.1, -1.5, -1.8]])
out = nx.zeros(a.shape, float)
@@ -64,7 +53,7 @@ class TestUfunclike(TestCase):
m = MyArray(a, metadata='foo')
f = ufl.fix(m)
assert_array_equal(f, nx.array([1,-1]))
- assert isinstance(f, MyArray)
+ assert_(isinstance(f, MyArray))
assert_equal(f.metadata, 'foo')
if __name__ == "__main__":
diff --git a/numpy/lib/ufunclike.py b/numpy/lib/ufunclike.py
index 8f81fe4b2..b51365f41 100644
--- a/numpy/lib/ufunclike.py
+++ b/numpy/lib/ufunclike.py
@@ -172,45 +172,3 @@ def isneginf(x, y=None):
y = nx.empty(x.shape, dtype=nx.bool_)
nx.logical_and(nx.isinf(x), nx.signbit(x), y)
return y
-
-
-_log2 = nx.log(2)
-def log2(x, y=None):
- """
- Return the base 2 logarithm of the input array, element-wise.
- This function is now deprecated, use the np.log2 ufunc instead.
-
- Parameters
- ----------
- x : array_like
- Input array.
- y : array_like
- Optional output array with the same shape as `x`.
-
- Returns
- -------
- y : ndarray
- The logarithm to the base 2 of `x` element-wise.
- NaNs are returned where `x` is negative.
-
- See Also
- --------
- log, log1p, log10
-
- Examples
- --------
- >>> np.log2([-1, 2, 4])
- array([ NaN, 1., 2.])
-
- """
- import warnings
- msg = "numpy.lib.log2 is deprecated, use np.log2 instead."
- warnings.warn(msg, DeprecationWarning)
-
- x = nx.asanyarray(x)
- if y is None:
- y = nx.log(x)
- else:
- nx.log(x, y)
- y /= _log2
- return y
diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py
index fb597a7ed..1e7364adc 100644
--- a/numpy/lib/utils.py
+++ b/numpy/lib/utils.py
@@ -6,7 +6,7 @@ import re
from numpy.core.numerictypes import issubclass_, issubsctype, issubdtype
from numpy.core import product, ndarray, ufunc
-__all__ = ['issubclass_', 'get_numpy_include', 'issubsctype', 'issubdtype',
+__all__ = ['issubclass_', 'issubsctype', 'issubdtype',
'deprecate', 'deprecate_with_doc', 'get_numarray_include',
'get_include', 'info', 'source', 'who', 'lookfor', 'byte_bounds',
'may_share_memory', 'safe_eval']
@@ -215,7 +215,6 @@ def deprecate(*args, **kwargs):
return _Deprecate(*args, **kwargs)
deprecate_with_doc = lambda msg: _Deprecate(message=msg)
-get_numpy_include = deprecate(get_include, 'get_numpy_include', 'get_include')
#--------------------------------------------
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index 48ed424ff..936df17f3 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -1419,7 +1419,7 @@ def is_mask(m):
except AttributeError:
return False
-def make_mask(m, copy=False, shrink=True, flag=None, dtype=MaskType):
+def make_mask(m, copy=False, shrink=True, dtype=MaskType):
"""
Create a boolean mask from an array.
@@ -1436,8 +1436,6 @@ def make_mask(m, copy=False, shrink=True, flag=None, dtype=MaskType):
Whether to return a copy of `m` (True) or `m` itself (False).
shrink : bool, optional
Whether to shrink `m` to ``nomask`` if all its values are False.
- flag : bool, optional
- Deprecated equivalent of `shrink`.
dtype : dtype, optional
Data-type of the output mask. By default, the output mask has
a dtype of MaskType (bool). If the dtype is flexible, each field
@@ -1491,10 +1489,6 @@ def make_mask(m, copy=False, shrink=True, flag=None, dtype=MaskType):
dtype=[('man', '|b1'), ('mouse', '|b1')])
"""
- if flag is not None:
- warnings.warn("The flag 'flag' is now called 'shrink'!",
- DeprecationWarning)
- shrink = flag
if m is nomask:
return nomask
elif isinstance(m, ndarray):
@@ -2582,7 +2576,7 @@ class MaskedArray(ndarray):
x = MaskedArray(data, mask=nomask, dtype=None,
copy=False, subok=True, ndmin=0, fill_value=None,
- keep_mask=True, hard_mask=None, flag=None, shrink=True)
+ keep_mask=True, hard_mask=None, shrink=True)
Parameters
----------
@@ -2625,7 +2619,7 @@ class MaskedArray(ndarray):
def __new__(cls, data=None, mask=nomask, dtype=None, copy=False,
subok=True, ndmin=0, fill_value=None,
- keep_mask=True, hard_mask=None, flag=None, shrink=True,
+ keep_mask=True, hard_mask=None, shrink=True,
**options):
"""
Create a new masked array from scratch.
@@ -2635,10 +2629,6 @@ class MaskedArray(ndarray):
A masked array can also be created by taking a .view(MaskedArray).
"""
- if flag is not None:
- warnings.warn("The flag 'flag' is now called 'shrink'!",
- DeprecationWarning)
- shrink = flag
# Process data............
_data = np.array(data, dtype=dtype, copy=copy, subok=True, ndmin=ndmin)
_baseclass = getattr(data, '_baseclass', type(_data))
@@ -3258,27 +3248,6 @@ class MaskedArray(ndarray):
_data = property(fget=_get_data)
data = property(fget=_get_data)
- def raw_data(self):
- """
- Return the data part of the masked array.
-
- DEPRECATED: You should really use ``.data`` instead.
-
- Examples
- --------
- >>> x = np.ma.array([1, 2, 3], mask=[False, True, False])
- >>> x
- masked_array(data = [1 -- 3],
- mask = [False True False],
- fill_value = 999999)
- >>> x.data
- array([1, 2, 3])
-
- """
- warnings.warn('Use .data instead.', DeprecationWarning)
- return self._data
-
-
def _get_flat(self):
"Return a flat iterator."
return MaskedIterator(self)
@@ -5025,7 +4994,7 @@ class MaskedArray(ndarray):
>>> a.sort(endwith=False, fill_value=3)
>>> print a
[1 -- -- 3 5]
-
+
"""
if self._mask is nomask:
ndarray.sort(self, axis=axis, kind=kind, order=order)
@@ -6798,7 +6767,7 @@ def allequal (a, b, fill_value=True):
else:
return False
-def allclose (a, b, masked_equal=True, rtol=1e-5, atol=1e-8, fill_value=None):
+def allclose (a, b, masked_equal=True, rtol=1e-5, atol=1e-8):
"""
Returns True if two arrays are element-wise equal within a tolerance.
@@ -6819,9 +6788,6 @@ def allclose (a, b, masked_equal=True, rtol=1e-5, atol=1e-8, fill_value=None):
atol : float, optional
Absolute tolerance. The absolute difference is equal to `atol`.
Default is 1e-8.
- fill_value : bool, optional
- *Deprecated* - Whether masked values in `a` or `b` are considered equal
- (True) or not (False).
Returns
-------
@@ -6873,11 +6839,6 @@ def allclose (a, b, masked_equal=True, rtol=1e-5, atol=1e-8, fill_value=None):
False
"""
- if fill_value is not None:
- warnings.warn("The use of fill_value is deprecated."\
- " Please use masked_equal instead.")
- masked_equal = fill_value
- #
x = masked_array(a, copy=False)
y = masked_array(b, copy=False)
m = mask_or(getmask(x), getmask(y))
diff --git a/numpy/ma/extras.py b/numpy/ma/extras.py
index 5ca1e3d1b..1c28eadb8 100644
--- a/numpy/ma/extras.py
+++ b/numpy/ma/extras.py
@@ -1087,7 +1087,7 @@ def intersect1d(ar1, ar2, assume_unique=False):
if assume_unique:
aux = ma.concatenate((ar1, ar2))
else:
- # Might be faster than unique1d( intersect1d( ar1, ar2 ) )?
+ # Might be faster than unique( intersect1d( ar1, ar2 ) )?
aux = ma.concatenate((unique(ar1), unique(ar2)))
aux.sort()
return aux[aux[1:] == aux[:-1]]
@@ -1522,7 +1522,7 @@ def flatnotmasked_edges(a):
See Also
--------
- flatnotmasked_contiguous, notmasked_contiguous, notmasked_edges,
+ flatnotmasked_contiguous, notmasked_contiguous, notmasked_edges,
clump_masked, clump_unmasked
Notes
@@ -1637,7 +1637,7 @@ def flatnotmasked_contiguous(a):
>>> a = np.ma.arange(10)
>>> np.ma.extras.flatnotmasked_contiguous(a)
slice(0, 10, None)
-
+
>>> mask = (a < 3) | (a > 8) | (a == 5)
>>> a[mask] = np.ma.masked
>>> np.array(a[~a.mask])
@@ -1761,7 +1761,7 @@ def clump_unmasked(a):
See Also
--------
- flatnotmasked_edges, flatnotmasked_contiguous, notmasked_edges,
+ flatnotmasked_edges, flatnotmasked_contiguous, notmasked_edges,
notmasked_contiguous, clump_masked
Examples
@@ -1805,7 +1805,7 @@ def clump_masked(a):
See Also
--------
- flatnotmasked_edges, flatnotmasked_contiguous, notmasked_edges,
+ flatnotmasked_edges, flatnotmasked_contiguous, notmasked_edges,
notmasked_contiguous, clump_unmasked
Examples
diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py
index c55559001..070701089 100644
--- a/numpy/ma/tests/test_core.py
+++ b/numpy/ma/tests/test_core.py
@@ -243,9 +243,9 @@ class TestMaskedArray(TestCase):
junk, garbage = str(x2), repr(x2)
assert_equal(np.sort(x1), sort(x2, endwith=False))
# tests of indexing
- assert type(x2[1]) is type(x1[1])
- assert x1[1] == x2[1]
- assert x2[0] is masked
+ assert_(type(x2[1]) is type(x1[1]))
+ assert_(x1[1] == x2[1])
+ assert_(x2[0] is masked)
assert_equal(x1[2], x2[2])
assert_equal(x1[2:5], x2[2:5])
assert_equal(x1[:], x2[:])
@@ -262,16 +262,16 @@ class TestMaskedArray(TestCase):
assert_equal(x1, x2)
x2[:] = x1
x2[1] = masked
- assert allequal(getmask(x2), array([0, 1, 0, 0]))
+ assert_(allequal(getmask(x2), array([0, 1, 0, 0])))
x3[:] = masked_array([1, 2, 3, 4], [0, 1, 1, 0])
- assert allequal(getmask(x3), array([0, 1, 1, 0]))
+ assert_(allequal(getmask(x3), array([0, 1, 1, 0])))
x4[:] = masked_array([1, 2, 3, 4], [0, 1, 1, 0])
- assert allequal(getmask(x4), array([0, 1, 1, 0]))
- assert allequal(x4, array([1, 2, 3, 4]))
+ assert_(allequal(getmask(x4), array([0, 1, 1, 0])))
+ assert_(allequal(x4, array([1, 2, 3, 4])))
x1 = np.arange(5) * 1.0
x2 = masked_values(x1, 3.0)
assert_equal(x1, x2)
- assert allequal(array([0, 0, 0, 1, 0], MaskType), x2.mask)
+ assert_(allequal(array([0, 0, 0, 1, 0], MaskType), x2.mask))
assert_equal(3.0, x2.fill_value)
x1 = array([1, 'hello', 2, 3], object)
x2 = np.array([1, 'hello', 2, 3], object)
@@ -280,7 +280,7 @@ class TestMaskedArray(TestCase):
assert_equal(type(s2), str)
assert_equal(type(s1), str)
assert_equal(s1, s2)
- assert x1[1:1].shape == (0,)
+ assert_(x1[1:1].shape == (0,))
def test_copy(self):
@@ -292,23 +292,19 @@ class TestMaskedArray(TestCase):
m3 = make_mask(m, copy=1)
self.assertTrue(m is not m3)
- warnings.simplefilter('ignore', DeprecationWarning)
x1 = np.arange(5)
y1 = array(x1, mask=m)
#self.assertTrue( y1._data is x1)
assert_equal(y1._data.__array_interface__, x1.__array_interface__)
- self.assertTrue(allequal(x1, y1.raw_data()))
+ self.assertTrue(allequal(x1, y1.data))
#self.assertTrue( y1.mask is m)
assert_equal(y1._mask.__array_interface__, m.__array_interface__)
- warnings.simplefilter('default', DeprecationWarning)
y1a = array(y1)
- #self.assertTrue( y1a.raw_data() is y1.raw_data())
self.assertTrue(y1a._data.__array_interface__ == y1._data.__array_interface__)
self.assertTrue(y1a.mask is y1.mask)
y2 = array(x1, mask=m)
- #self.assertTrue( y2.raw_data() is x1)
self.assertTrue(y2._data.__array_interface__ == x1.__array_interface__)
#self.assertTrue( y2.mask is m)
self.assertTrue(y2._mask.__array_interface__ == m.__array_interface__)
@@ -431,7 +427,7 @@ class TestMaskedArray(TestCase):
self.assertRaises(TypeError, float, array([1, 1]))
#
warnings.simplefilter('ignore', UserWarning)
- assert np.isnan(float(array([1], mask=[1])))
+ assert_(np.isnan(float(array([1], mask=[1]))))
warnings.simplefilter('default', UserWarning)
#
a = array([1, 2, 3], mask=[1, 0, 0])
@@ -448,7 +444,7 @@ class TestMaskedArray(TestCase):
x = arange(20)
x = x.reshape(4, 5)
x.flat[5] = 12
- assert x[1, 0] == 12
+ assert_(x[1, 0] == 12)
z = x + 10j * x
assert_equal(z.real, x)
assert_equal(z.imag, 10 * x)
@@ -457,18 +453,18 @@ class TestMaskedArray(TestCase):
#
x = arange(10)
x[3] = masked
- assert str(x[3]) == str(masked)
+ assert_(str(x[3]) == str(masked))
c = x >= 8
- assert count(where(c, masked, masked)) == 0
- assert shape(where(c, masked, masked)) == c.shape
+ assert_(count(where(c, masked, masked)) == 0)
+ assert_(shape(where(c, masked, masked)) == c.shape)
#
z = masked_where(c, x)
- assert z.dtype is x.dtype
- assert z[3] is masked
- assert z[4] is not masked
- assert z[7] is not masked
- assert z[8] is masked
- assert z[9] is masked
+ assert_(z.dtype is x.dtype)
+ assert_(z[3] is masked)
+ assert_(z[4] is not masked)
+ assert_(z[7] is not masked)
+ assert_(z[8] is masked)
+ assert_(z[9] is masked)
assert_equal(x, z)
@@ -482,9 +478,9 @@ class TestMaskedArray(TestCase):
c[0] = masked
z = where(c, x, -x)
assert_equal(z, [1., 2., 0., -4., -5])
- assert z[0] is masked
- assert z[1] is not masked
- assert z[2] is masked
+ assert_(z[0] is masked)
+ assert_(z[1] is not masked)
+ assert_(z[2] is masked)
def test_oddfeatures_3(self):
@@ -769,7 +765,7 @@ class TestMaskedArrayArithmetic(TestCase):
assert_equal(y.shape, x.shape)
assert_equal(y._mask, [True, True])
y = x[0] * masked
- assert y is masked
+ assert_(y is masked)
y = x + masked
assert_equal(y.shape, x.shape)
assert_equal(y._mask, [True, True])
@@ -830,13 +826,13 @@ class TestMaskedArrayArithmetic(TestCase):
assert_equal(1, count(1))
assert_equal(0, array(1, mask=[1]))
ott = ott.reshape((2, 2))
- assert isinstance(count(ott, 0), ndarray)
+ assert_(isinstance(count(ott, 0), ndarray))
if sys.version_info[0] >= 3:
- assert isinstance(count(ott), np.integer)
+ assert_(isinstance(count(ott), np.integer))
else:
- assert isinstance(count(ott), types.IntType)
+ assert_(isinstance(count(ott), types.IntType))
assert_equal(3, count(ott))
- assert getmask(count(ott, 0)) is nomask
+ assert_(getmask(count(ott, 0)) is nomask)
assert_equal([1, 2], count(ott, 0))
@@ -856,8 +852,8 @@ class TestMaskedArrayArithmetic(TestCase):
y[0] = masked
assert_equal(minimum(x, y), where(less(x, y), x, y))
assert_equal(maximum(x, y), where(greater(x, y), x, y))
- assert minimum(x) == 0
- assert maximum(x) == 4
+ assert_(minimum(x) == 0)
+ assert_(maximum(x) == 4)
#
x = arange(4).reshape(2, 2)
x[-1, -1] = masked
@@ -1076,9 +1072,9 @@ class TestMaskedArrayArithmetic(TestCase):
y = array(['abc', 1, 'def', 2, 3], object)
y[2] = masked
t = take(y, [0, 3, 4])
- assert t[0] == 'abc'
- assert t[1] == 2
- assert t[2] == 3
+ assert_(t[0] == 'abc')
+ assert_(t[1] == 2)
+ assert_(t[2] == 3)
def test_imag_real(self):
@@ -1640,13 +1636,11 @@ class TestMaskedArrayInPlaceArithmetics(TestCase):
xm += 1
assert_equal(xm, y + 1)
#
- warnings.simplefilter('ignore', DeprecationWarning)
(x, _, xm) = self.floatdata
- id1 = x.raw_data().ctypes._data
+ id1 = x.data.ctypes._data
x += 1.
- assert (id1 == x.raw_data().ctypes._data)
+ assert_(id1 == x.data.ctypes._data)
assert_equal(x, y + 1.)
- warnings.simplefilter('default', DeprecationWarning)
def test_inplace_addition_array(self):
"""Test of inplace additions"""
@@ -1996,15 +1990,15 @@ class TestMaskedArrayMethods(TestCase):
mxbig = (mx > 0.5)
mxsmall = (mx < 0.5)
#
- assert (mxbig.all() == False)
- assert (mxbig.any() == True)
+ assert_((mxbig.all() == False))
+ assert_((mxbig.any() == True))
assert_equal(mxbig.all(0), [False, False, True])
assert_equal(mxbig.all(1), [False, False, True])
assert_equal(mxbig.any(0), [False, False, True])
assert_equal(mxbig.any(1), [True, True, True])
#
- assert (mxsmall.all() == False)
- assert (mxsmall.any() == True)
+ assert_((mxsmall.all() == False))
+ assert_((mxsmall.any() == True))
assert_equal(mxsmall.all(0), [True, True, False])
assert_equal(mxsmall.all(1), [False, False, False])
assert_equal(mxsmall.any(0), [True, True, False])
@@ -2023,15 +2017,15 @@ class TestMaskedArrayMethods(TestCase):
mXbig = (mX > 0.5)
mXsmall = (mX < 0.5)
#
- assert (mXbig.all() == False)
- assert (mXbig.any() == True)
+ assert_((mXbig.all() == False))
+ assert_((mXbig.any() == True))
assert_equal(mXbig.all(0), np.matrix([False, False, True]))
assert_equal(mXbig.all(1), np.matrix([False, False, True]).T)
assert_equal(mXbig.any(0), np.matrix([False, False, True]))
assert_equal(mXbig.any(1), np.matrix([ True, True, True]).T)
#
- assert (mXsmall.all() == False)
- assert (mXsmall.any() == True)
+ assert_((mXsmall.all() == False))
+ assert_((mXsmall.any() == True))
assert_equal(mXsmall.all(0), np.matrix([True, True, False]))
assert_equal(mXsmall.all(1), np.matrix([False, False, False]).T)
assert_equal(mXsmall.any(0), np.matrix([True, True, False]))
@@ -2942,9 +2936,9 @@ class TestMaskedArrayFunctions(TestCase):
c[0] = masked
z = where(c, x, -x)
assert_equal(z, [1., 2., 0., -4., -5])
- assert z[0] is masked
- assert z[1] is not masked
- assert z[2] is masked
+ assert_(z[0] is masked)
+ assert_(z[1] is not masked)
+ assert_(z[2] is masked)
def test_round_with_output(self):
@@ -3065,21 +3059,21 @@ class TestMaskedArrayFunctions(TestCase):
c = x >= 8
# Set False to masked
z = where(c , x, masked)
- assert z.dtype is x.dtype
- assert z[3] is masked
- assert z[4] is masked
- assert z[7] is masked
- assert z[8] is not masked
- assert z[9] is not masked
+ assert_(z.dtype is x.dtype)
+ assert_(z[3] is masked)
+ assert_(z[4] is masked)
+ assert_(z[7] is masked)
+ assert_(z[8] is not masked)
+ assert_(z[9] is not masked)
assert_equal(x, z)
# Set True to masked
z = where(c , masked, x)
- assert z.dtype is x.dtype
- assert z[3] is masked
- assert z[4] is not masked
- assert z[7] is not masked
- assert z[8] is masked
- assert z[9] is masked
+ assert_(z.dtype is x.dtype)
+ assert_(z[3] is masked)
+ assert_(z[4] is not masked)
+ assert_(z[7] is not masked)
+ assert_(z[8] is masked)
+ assert_(z[9] is masked)
def test_where_with_masked_condition(self):
x = array([1., 2., 3., 4., 5.])
@@ -3090,9 +3084,9 @@ class TestMaskedArrayFunctions(TestCase):
c[0] = masked
z = where(c, x, -x)
assert_equal(z, [1., 2., 0., -4., -5])
- assert z[0] is masked
- assert z[1] is not masked
- assert z[2] is masked
+ assert_(z[0] is masked)
+ assert_(z[1] is not masked)
+ assert_(z[2] is masked)
#
x = arange(1, 6)
x[-1] = masked
@@ -3103,7 +3097,7 @@ class TestMaskedArrayFunctions(TestCase):
z = where(c, x, y)
zm = where(cm, x, y)
assert_equal(z, zm)
- assert getmask(zm) is nomask
+ assert_(getmask(zm) is nomask)
assert_equal(zm, [1, 2, 3, 40, 50])
z = where(c, masked, 1)
assert_equal(z, [99, 99, 99, 1, 1])
diff --git a/numpy/ma/tests/test_subclassing.py b/numpy/ma/tests/test_subclassing.py
index 146ea3051..fb72ca773 100644
--- a/numpy/ma/tests/test_subclassing.py
+++ b/numpy/ma/tests/test_subclassing.py
@@ -93,8 +93,12 @@ class TestSubclassing(TestCase):
def test_masked_unary_operations(self):
"Tests masked_unary_operation"
(x, mx) = self.data
- self.assertTrue(isinstance(log(mx), mmatrix))
- assert_equal(log(x), np.log(x))
+ olderr = np.seterr(divide='ignore')
+ try:
+ self.assertTrue(isinstance(log(mx), mmatrix))
+ assert_equal(log(x), np.log(x))
+ finally:
+ np.seterr(**olderr)
def test_masked_binary_operations(self):
"Tests masked_binary_operation"
diff --git a/numpy/random/mtrand/mtrand.c b/numpy/random/mtrand/mtrand.c
index 909f743b8..eda815fdd 100644
--- a/numpy/random/mtrand/mtrand.c
+++ b/numpy/random/mtrand/mtrand.c
@@ -1,18 +1,39 @@
-/* Generated by Cython 0.12.1 on Wed Mar 2 12:31:18 2011 */
+/* Generated by Cython 0.14.1 on Thu Mar 10 10:20:54 2011 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
-#include "structmember.h"
#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
+#include <stddef.h> /* For offsetof */
+#ifndef offsetof
+#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
+#endif
+
+#if !defined(WIN32) && !defined(MS_WINDOWS)
+ #ifndef __stdcall
+ #define __stdcall
+ #endif
+ #ifndef __cdecl
+ #define __cdecl
+ #endif
+ #ifndef __fastcall
+ #define __fastcall
+ #endif
+#endif
+
+#ifndef DL_IMPORT
+ #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
#define DL_EXPORT(t) t
#endif
+
+#ifndef PY_LONG_LONG
+ #define PY_LONG_LONG LONG_LONG
+#endif
+
#if PY_VERSION_HEX < 0x02040000
#define METH_COEXIST 0
#define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
@@ -82,14 +103,43 @@
#if PY_MAJOR_VERSION >= 3
#define PyBaseString_Type PyUnicode_Type
+ #define PyStringObject PyUnicodeObject
#define PyString_Type PyUnicode_Type
+ #define PyString_Check PyUnicode_Check
#define PyString_CheckExact PyUnicode_CheckExact
-#else
+#endif
+
+#if PY_VERSION_HEX < 0x02060000
+ #define PyBytesObject PyStringObject
#define PyBytes_Type PyString_Type
+ #define PyBytes_Check PyString_Check
#define PyBytes_CheckExact PyString_CheckExact
+ #define PyBytes_FromString PyString_FromString
+ #define PyBytes_FromStringAndSize PyString_FromStringAndSize
+ #define PyBytes_FromFormat PyString_FromFormat
+ #define PyBytes_DecodeEscape PyString_DecodeEscape
+ #define PyBytes_AsString PyString_AsString
+ #define PyBytes_AsStringAndSize PyString_AsStringAndSize
+ #define PyBytes_Size PyString_Size
+ #define PyBytes_AS_STRING PyString_AS_STRING
+ #define PyBytes_GET_SIZE PyString_GET_SIZE
+ #define PyBytes_Repr PyString_Repr
+ #define PyBytes_Concat PyString_Concat
+ #define PyBytes_ConcatAndDel PyString_ConcatAndDel
+#endif
+
+#if PY_VERSION_HEX < 0x02060000
+ #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type)
+ #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type)
+#endif
+#ifndef PySet_CheckExact
+ #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
#endif
+#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
+
#if PY_MAJOR_VERSION >= 3
+ #define PyIntObject PyLongObject
#define PyInt_Type PyLong_Type
#define PyInt_Check(op) PyLong_Check(op)
#define PyInt_CheckExact(op) PyLong_CheckExact(op)
@@ -103,30 +153,42 @@
#define PyInt_AsSsize_t PyLong_AsSsize_t
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+ #define PyBoolObject PyLongObject
+#endif
+
+
+#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
#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)
+#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
+ #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
+ #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
+ #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
+#else
+ #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
+ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
+ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
+ (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
+ #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
+ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
+ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
+ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
+ #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
+ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
+ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
+ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
#endif
-#if !defined(WIN32) && !defined(MS_WINDOWS)
- #ifndef __stdcall
- #define __stdcall
- #endif
- #ifndef __cdecl
- #define __cdecl
- #endif
- #ifndef __fastcall
- #define __fastcall
- #endif
-#else
- #define _USE_MATH_DEFINES
+#if PY_MAJOR_VERSION >= 3
+ #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif
#if PY_VERSION_HEX < 0x02050000
@@ -146,11 +208,16 @@
#define __Pyx_NAMESTR(n) (n)
#define __Pyx_DOCSTR(n) (n)
#endif
+
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
+
+#if defined(WIN32) || defined(MS_WINDOWS)
+#define _USE_MATH_DEFINES
+#endif
#include <math.h>
#define __PYX_HAVE_API__mtrand
#include "string.h"
@@ -161,100 +228,51 @@
#include "distributions.h"
#include "initarray.h"
+#ifdef PYREX_WITHOUT_ASSERTIONS
+#define CYTHON_WITHOUT_ASSERTIONS
+#endif
+
+
+/* inline attribute */
#ifndef CYTHON_INLINE
#if defined(__GNUC__)
#define CYTHON_INLINE __inline__
#elif defined(_MSC_VER)
#define CYTHON_INLINE __inline
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_INLINE inline
#else
- #define CYTHON_INLINE
+ #define CYTHON_INLINE
#endif
#endif
+/* unused attribute */
+#ifndef CYTHON_UNUSED
+# if defined(__GNUC__)
+# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+# elif defined(__ICC) || defined(__INTEL_COMPILER)
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# 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*/
/* Type Conversion Predeclarations */
-#if PY_MAJOR_VERSION < 3
-#define __Pyx_PyBytes_FromString PyString_FromString
-#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize
-#define __Pyx_PyBytes_AsString PyString_AsString
-#else
-#define __Pyx_PyBytes_FromString PyBytes_FromString
-#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
-#define __Pyx_PyBytes_AsString PyBytes_AsString
-#endif
-
-#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s)
-#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s))
+#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
+#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s))
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
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
-#define T_PYSSIZET T_INT
-#elif !defined(T_LONGLONG)
-#define T_PYSSIZET \
- ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \
- ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1))
-#else
-#define T_PYSSIZET \
- ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \
- ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \
- ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1)))
-#endif
-#endif
-
-
-#if !defined(T_ULONGLONG)
-#define __Pyx_T_UNSIGNED_INT(x) \
- ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \
- ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \
- ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \
- ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : -1))))
-#else
-#define __Pyx_T_UNSIGNED_INT(x) \
- ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \
- ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \
- ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \
- ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : \
- ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))))
-#endif
-#if !defined(T_LONGLONG)
-#define __Pyx_T_SIGNED_INT(x) \
- ((sizeof(x) == sizeof(char)) ? T_BYTE : \
- ((sizeof(x) == sizeof(short)) ? T_SHORT : \
- ((sizeof(x) == sizeof(int)) ? T_INT : \
- ((sizeof(x) == sizeof(long)) ? T_LONG : -1))))
-#else
-#define __Pyx_T_SIGNED_INT(x) \
- ((sizeof(x) == sizeof(char)) ? T_BYTE : \
- ((sizeof(x) == sizeof(short)) ? T_SHORT : \
- ((sizeof(x) == sizeof(int)) ? T_INT : \
- ((sizeof(x) == sizeof(long)) ? T_LONG : \
- ((sizeof(x) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1)))))
-#endif
-
-#define __Pyx_T_FLOATING(x) \
- ((sizeof(x) == sizeof(float)) ? T_FLOAT : \
- ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1))
-
-#if !defined(T_SIZET)
-#if !defined(T_ULONGLONG)
-#define T_SIZET \
- ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \
- ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1))
-#else
-#define T_SIZET \
- ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \
- ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \
- ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))
-#endif
-#endif
-
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*);
@@ -264,7 +282,7 @@ static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
#ifdef __GNUC__
/* Test for GCC > 2.95 */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
+#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else /* __GNUC__ > 2 ... */
@@ -284,9 +302,13 @@ static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;
-static const char **__pyx_f;
+static const char *__pyx_f[] = {
+ "mtrand.pyx",
+ "numpy.pxi",
+};
+
/* Type declarations */
typedef double (*__pyx_t_6mtrand_rk_cont0)(rk_state *);
@@ -366,14 +388,21 @@ struct __pyx_obj_6mtrand_RandomState {
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0)
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0)
+static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*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 void __Pyx_RaiseDoubleKeywordsError(
const char* func_name, PyObject* kw_name); /*proto*/
+static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/
+
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
-static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/
-
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
PyObject *r;
@@ -384,11 +413,11 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j
}
-#define __Pyx_GetItemInt_List(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
- __Pyx_GetItemInt_List_Fast(o, i, size <= sizeof(long)) : \
+#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
+ __Pyx_GetItemInt_List_Fast(o, i) : \
__Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_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) {
if (likely(o != Py_None)) {
if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
PyObject *r = PyList_GET_ITEM(o, i);
@@ -401,14 +430,14 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_
return r;
}
}
- return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
+ return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}
-#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
- __Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \
+#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
+ __Pyx_GetItemInt_Tuple_Fast(o, i) : \
__Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_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) {
if (likely(o != Py_None)) {
if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
PyObject *r = PyTuple_GET_ITEM(o, i);
@@ -421,15 +450,15 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize
return r;
}
}
- return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
+ return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}
-#define __Pyx_GetItemInt(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
- __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \
+#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
+ __Pyx_GetItemInt_Fast(o, i) : \
__Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_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) {
PyObject *r;
if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
r = PyList_GET_ITEM(o, i);
@@ -443,17 +472,17 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
r = PySequence_GetItem(o, i);
}
else {
- r = __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
+ r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}
return r;
}
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
-static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void);
+static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/
-static int __Pyx_EndUnpack(PyObject *); /*proto*/
+static int __Pyx_EndUnpack(PyObject *, Py_ssize_t expected); /*proto*/
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
@@ -462,24 +491,8 @@ static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict,
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
-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);
- return Py_None; /* this is just to have an accurate signature */
- }
- else {
- PyObject *r, *m;
- m = __Pyx_GetAttrString(L, "append");
- if (!m) return NULL;
- r = PyObject_CallFunctionObjArgs(m, x, NULL);
- Py_DECREF(m);
- return r;
- }
-}
-
-#define __Pyx_SetItemInt(o, i, v, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
- __Pyx_SetItemInt_Fast(o, i, v, size <= sizeof(long)) : \
+#define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
+ __Pyx_SetItemInt_Fast(o, i, v) : \
__Pyx_SetItemInt_Generic(o, to_py_func(i), v))
static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
@@ -490,7 +503,7 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyOb
return r;
}
-static CYTHON_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) {
if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
Py_INCREF(v);
Py_DECREF(PyList_GET_ITEM(o, i));
@@ -500,7 +513,7 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObje
else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0)))
return PySequence_SetItem(o, i, v);
else {
- PyObject *j = fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i);
+ PyObject *j = PyInt_FromSsize_t(i);
return __Pyx_SetItemInt_Generic(o, j, v);
}
}
@@ -510,13 +523,6 @@ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb);
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*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 CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
@@ -535,6 +541,8 @@ static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
+static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);
+
static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
@@ -581,107 +589,147 @@ static PyObject *__pyx_f_6mtrand_discd_array_sc(rk_state *, __pyx_t_6mtrand_rk_d
static PyObject *__pyx_f_6mtrand_discd_array(rk_state *, __pyx_t_6mtrand_rk_discd, PyObject *, PyArrayObject *); /*proto*/
static double __pyx_f_6mtrand_kahan_sum(double *, long); /*proto*/
#define __Pyx_MODULE_NAME "mtrand"
-int __pyx_module_is_main_mtrand = 0;
+static int __pyx_module_is_main_mtrand = 0;
/* Implementation of mtrand */
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_TypeError;
static char __pyx_k_1[] = "size is not compatible with inputs";
-static char __pyx_k_2[] = "algorithm must be 'MT19937'";
-static char __pyx_k_3[] = "state must be 624 longs";
-static char __pyx_k_4[] = "low >= high";
-static char __pyx_k_9[] = "scale <= 0";
-static char __pyx_k_10[] = "a <= 0";
-static char __pyx_k_11[] = "b <= 0";
-static char __pyx_k_13[] = "shape <= 0";
-static char __pyx_k_15[] = "dfnum <= 0";
-static char __pyx_k_16[] = "dfden <= 0";
-static char __pyx_k_17[] = "dfnum <= 1";
-static char __pyx_k_18[] = "nonc < 0";
-static char __pyx_k_19[] = "df <= 0";
-static char __pyx_k_20[] = "nonc <= 0";
-static char __pyx_k_21[] = "df <= 1";
-static char __pyx_k_22[] = "kappa < 0";
-static char __pyx_k_31[] = "sigma <= 0";
-static char __pyx_k_32[] = "sigma <= 0.0";
-static char __pyx_k_34[] = "scale <= 0.0";
-static char __pyx_k_35[] = "mean <= 0";
-static char __pyx_k_36[] = "mean <= 0.0";
-static char __pyx_k_37[] = "left > mode";
-static char __pyx_k_38[] = "mode > right";
-static char __pyx_k_39[] = "left == right";
-static char __pyx_k_40[] = "n <= 0";
-static char __pyx_k_41[] = "p < 0";
-static char __pyx_k_42[] = "p > 1";
-static char __pyx_k_44[] = "lam < 0";
-static char __pyx_k_45[] = "a <= 1.0";
-static char __pyx_k_46[] = "p < 0.0";
-static char __pyx_k_47[] = "p > 1.0";
-static char __pyx_k_48[] = "ngood < 1";
-static char __pyx_k_49[] = "nbad < 1";
-static char __pyx_k_50[] = "nsample < 1";
-static char __pyx_k_51[] = "ngood + nbad < nsample";
-static char __pyx_k_52[] = "p <= 0.0";
-static char __pyx_k_53[] = "p >= 1.0";
-static char __pyx_k_54[] = "mean must be 1 dimensional";
-static char __pyx_k_55[] = "cov must be 2 dimensional and square";
-static char __pyx_k_56[] = "mean and cov must have same length";
-static char __pyx_k_57[] = "numpy.dual";
-static char __pyx_k_58[] = "sum(pvals[:-1]) > 1.0";
-static char __pyx_k_59[] = "standard_exponential";
-static char __pyx_k_60[] = "noncentral_chisquare";
-static char __pyx_k_61[] = "RandomState.seed (line 567)";
-static char __pyx_k_62[] = "RandomState.get_state (line 600)";
-static char __pyx_k_63[] = "RandomState.set_state (line 637)";
-static char __pyx_k_64[] = "RandomState.random_sample (line 718)";
-static char __pyx_k_65[] = "RandomState.tomaxint (line 761)";
-static char __pyx_k_66[] = "RandomState.randint (line 808)";
-static char __pyx_k_67[] = "RandomState.bytes (line 888)";
-static char __pyx_k_68[] = "RandomState.uniform (line 915)";
-static char __pyx_k_69[] = "RandomState.rand (line 1002)";
-static char __pyx_k_70[] = "RandomState.randn (line 1045)";
-static char __pyx_k_71[] = "RandomState.random_integers (line 1101)";
-static char __pyx_k_72[] = "RandomState.standard_normal (line 1179)";
-static char __pyx_k_73[] = "RandomState.normal (line 1211)";
-static char __pyx_k_74[] = "RandomState.beta (line 1311)";
-static char __pyx_k_75[] = "RandomState.exponential (line 1370)";
-static char __pyx_k_76[] = "RandomState.standard_exponential (line 1424)";
-static char __pyx_k_77[] = "RandomState.standard_gamma (line 1452)";
-static char __pyx_k_78[] = "RandomState.gamma (line 1534)";
-static char __pyx_k_79[] = "RandomState.f (line 1625)";
-static char __pyx_k_80[] = "RandomState.noncentral_f (line 1728)";
-static char __pyx_k_81[] = "RandomState.chisquare (line 1823)";
-static char __pyx_k_82[] = "RandomState.noncentral_chisquare (line 1901)";
-static char __pyx_k_83[] = "RandomState.standard_cauchy (line 1993)";
-static char __pyx_k_84[] = "RandomState.standard_t (line 2054)";
-static char __pyx_k_85[] = "RandomState.vonmises (line 2155)";
-static char __pyx_k_86[] = "RandomState.pareto (line 2249)";
-static char __pyx_k_87[] = "RandomState.weibull (line 2345)";
-static char __pyx_k_88[] = "RandomState.power (line 2445)";
-static char __pyx_k_89[] = "RandomState.laplace (line 2554)";
-static char __pyx_k_90[] = "RandomState.gumbel (line 2644)";
-static char __pyx_k_91[] = "RandomState.logistic (line 2775)";
-static char __pyx_k_92[] = "RandomState.lognormal (line 2863)";
-static char __pyx_k_93[] = "RandomState.rayleigh (line 2994)";
-static char __pyx_k_94[] = "RandomState.wald (line 3066)";
-static char __pyx_k_95[] = "RandomState.triangular (line 3152)";
-static char __pyx_k_96[] = "RandomState.binomial (line 3240)";
-static char __pyx_k_97[] = "RandomState.negative_binomial (line 3348)";
-static char __pyx_k_98[] = "RandomState.poisson (line 3443)";
-static char __pyx_k_99[] = "RandomState.zipf (line 3506)";
+static char __pyx_k_9[] = "algorithm must be 'MT19937'";
+static char __pyx_k_11[] = "state must be 624 longs";
+static char __pyx_k_13[] = "low >= high";
+static char __pyx_k_19[] = "scale <= 0";
+static char __pyx_k_22[] = "a <= 0";
+static char __pyx_k_24[] = "b <= 0";
+static char __pyx_k_31[] = "shape <= 0";
+static char __pyx_k_41[] = "dfnum <= 0";
+static char __pyx_k_43[] = "dfden <= 0";
+static char __pyx_k_45[] = "dfnum <= 1";
+static char __pyx_k_48[] = "nonc < 0";
+static char __pyx_k_53[] = "df <= 0";
+static char __pyx_k_57[] = "nonc <= 0";
+static char __pyx_k_59[] = "df <= 1";
+static char __pyx_k_64[] = "kappa < 0";
+static char __pyx_k_87[] = "sigma <= 0";
+static char __pyx_k_89[] = "sigma <= 0.0";
+static char __pyx_k_93[] = "scale <= 0.0";
+static char __pyx_k_95[] = "mean <= 0";
+static char __pyx_k_98[] = "mean <= 0.0";
static char __pyx_k__a[] = "a";
static char __pyx_k__b[] = "b";
static char __pyx_k__f[] = "f";
+static char __pyx_k__l[] = "l";
static char __pyx_k__n[] = "n";
static char __pyx_k__p[] = "p";
-static char __pyx_k_100[] = "RandomState.geometric (line 3594)";
-static char __pyx_k_101[] = "RandomState.hypergeometric (line 3660)";
-static char __pyx_k_102[] = "RandomState.logseries (line 3779)";
-static char __pyx_k_103[] = "RandomState.multivariate_normal (line 3874)";
-static char __pyx_k_104[] = "RandomState.multinomial (line 4006)";
-static char __pyx_k_105[] = "RandomState.dirichlet (line 4099)";
-static char __pyx_k_106[] = "RandomState.shuffle (line 4215)";
-static char __pyx_k_107[] = "RandomState.permutation (line 4277)";
+static char __pyx_k_101[] = "left > mode";
+static char __pyx_k_103[] = "mode > right";
+static char __pyx_k_105[] = "left == right";
+static char __pyx_k_110[] = "n <= 0";
+static char __pyx_k_112[] = "p < 0";
+static char __pyx_k_114[] = "p > 1";
+static char __pyx_k_126[] = "lam < 0";
+static char __pyx_k_128[] = "lam value too large";
+static char __pyx_k_131[] = "lam value too large.";
+static char __pyx_k_133[] = "a <= 1.0";
+static char __pyx_k_136[] = "p < 0.0";
+static char __pyx_k_138[] = "p > 1.0";
+static char __pyx_k_142[] = "ngood < 1";
+static char __pyx_k_144[] = "nbad < 1";
+static char __pyx_k_146[] = "nsample < 1";
+static char __pyx_k_148[] = "ngood + nbad < nsample";
+static char __pyx_k_154[] = "p <= 0.0";
+static char __pyx_k_156[] = "p >= 1.0";
+static char __pyx_k_160[] = "mean must be 1 dimensional";
+static char __pyx_k_162[] = "cov must be 2 dimensional and square";
+static char __pyx_k_164[] = "mean and cov must have same length";
+static char __pyx_k_166[] = "numpy.dual";
+static char __pyx_k_167[] = "sum(pvals[:-1]) > 1.0";
+static char __pyx_k_171[] = "standard_exponential";
+static char __pyx_k_172[] = "noncentral_chisquare";
+static char __pyx_k_173[] = "RandomState.random_sample (line 719)";
+static char __pyx_k_174[] = "\n random_sample(size=None)\n\n Return random floats in the half-open interval [0.0, 1.0).\n\n Results are from the \"continuous uniform\" distribution over the\n stated interval. To sample :math:`Unif[a, b), b > a` multiply\n the output of `random_sample` by `(b-a)` and add `a`::\n\n (b - a) * random_sample() + a\n\n Parameters\n ----------\n size : int or tuple of ints, optional\n Defines the shape of the returned array of random floats. If None\n (the default), returns a single float.\n\n Returns\n -------\n out : float or ndarray of floats\n Array of random floats of shape `size` (unless ``size=None``, in which\n case a single float is returned).\n\n Examples\n --------\n >>> np.random.random_sample()\n 0.47108547995356098\n >>> type(np.random.random_sample())\n <type 'float'>\n >>> np.random.random_sample((5,))\n array([ 0.30220482, 0.86820401, 0.1654503 , 0.11659149, 0.54323428])\n\n Three-by-two array of random numbers from [-5, 0):\n\n >>> 5 * np.random.random_sample((3, 2)) - 5\n array([[-3.99149989, -0.52338984],\n [-2.99091858, -0.79479508],\n [-1.23204345, -1.75224494]])\n\n ";
+static char __pyx_k_175[] = "RandomState.tomaxint (line 762)";
+static char __pyx_k_176[] = "\n tomaxint(size=None)\n\n Random integers between 0 and ``sys.maxint``, inclusive.\n\n Return a sample of uniformly distributed random integers in the interval\n [0, ``sys.maxint``].\n\n Parameters\n ----------\n size : tuple of ints, int, optional\n Shape of output. If this is, for example, (m,n,k), m*n*k samples\n are generated. If no shape is specified, a single sample is\n returned.\n\n Returns\n -------\n out : ndarray\n Drawn samples, with shape `size`.\n\n See Also\n --------\n randint : Uniform sampling over a given half-open interval of integers.\n random_integers : Uniform sampling over a given closed interval of\n integers.\n\n Examples\n --------\n >>> RS = np.random.mtrand.RandomState() # need a RandomState object\n >>> RS.tomaxint((2,2,2))\n array([[[1170048599, 1600360186],\n [ 739731006, 1947757578]],\n [[1871712945, 752307660],\n [1601631370, 1479324245]]])\n >>> import sys\n >>> sys.maxint\n 2147483647\n >>> RS.tomaxint((2,2,2)) < sys.maxint\n array([[[ True, True],\n [ True, True]],\n [[ True, True],\n [ True, True]]], dtype=bool)\n\n ";
+static char __pyx_k_177[] = "RandomState.randint (line 809)";
+static char __pyx_k_178[] = "\n randint(low, high=None, size=None)\n\n Return random integers from `low` (inclusive) to `high` (exclusive).\n\n Return random integers from the \"discrete uniform\" distribution in the\n \"half-open\" interval [`low`, `high`). If `high` is None (the default),\n then results are from [0, `low`).\n\n Parameters\n ----------\n low : int\n Lowest (signed) integer to be drawn from the distribution (unless\n ``high=None``, in which case this parameter is the *highest* such\n integer).\n high : int, optional\n If provided, one above the largest (signed) integer to be drawn\n from the distribution (see above for behavior if ``high=None``).\n size : int or tuple of ints, optional\n Output shape. Default is None, in which case a single int is\n returned.\n\n Returns\n -------\n out : int or ndarray of ints\n `size`-shaped array of random integers from the appropriate\n distribution, or a single such random int if `size` not provided.\n\n See Also\n --------\n random.random_integers : similar to `randint`, only for the closed\n interval [`low`, `high`], and 1 is the lowest value if `high` is\n omitted. In particular, this other one is the one to use to generate\n uniformly distributed discrete non-integers.\n\n Examples\n --------\n >>> np.random.randint(2, size=10)\n array([1, 0, 0, 0, 1, 1, 0, 0, 1, 0])\n >>> np.random.randint(1, size=10)\n array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])\n\n Generate a 2 x 4 array of ints between 0 and 4, inclusive:\n\n >>> np.random.randint(5, size=(2, 4))\n array([[4, 0, 2, 1],\n [3, 2, 2, 0]])\n\n ";
+static char __pyx_k_179[] = "RandomState.bytes (line 889)";
+static char __pyx_k_180[] = "\n bytes(length)\n\n Return random bytes.\n\n Parameters\n ----------\n length : int\n Number of random bytes.\n\n Returns\n -------\n out : str\n String of length `length`.\n\n Examples\n --------\n >>> np.random.bytes(10)\n ' eh\\x85\\x022SZ\\xbf\\xa4' #random\n\n ";
+static char __pyx_k_181[] = "RandomState.uniform (line 916)";
+static char __pyx_k_182[] = "\n uniform(low=0.0, high=1.0, size=1)\n\n Draw samples from a uniform distribution.\n\n Samples are uniformly distributed over the half-open interval\n ``[low, high)`` (includes low, but excludes high). In other words,\n any value within the given interval is equally likely to be drawn\n by `uniform`.\n\n Parameters\n ----------\n low : float, optional\n Lower boundary of the output interval. All values generated will be\n greater than or equal to low. The default value is 0.\n high : float\n Upper boundary of the output interval. All values generated will be\n less than high. The default value is 1.0.\n size : int or tuple of ints, optional\n Shape of output. If the given size is, for example, (m,n,k),\n m*n*k samples are generated. If no shape is specified, a single sample\n is returned.\n\n Returns\n -------\n out : ndarray\n Drawn samples, with shape `size`.\n\n See Also\n --------\n randint : Discrete uniform distribution, yielding integers.\n random_integers : Discrete uniform distribution over the closed\n interval ``[low, high]``.\n random_sample : Floats uniformly distributed over ``[0, 1)``.\n random : Alias for `random_sample`.\n rand : Convenience function that accepts dimensions as input, e.g.,\n ``rand(2,2)`` would generate a 2-by-2 array of floats,\n uniformly distributed over ``[0, 1)``.\n\n Notes\n -----\n The probability density function of the uniform distribution is\n\n .. math:: p(x) = \\frac{1}{b - a}\n\n anywhere within the interval ``[a, b)``, and zero elsewhere.\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> s = np.random.uniform(-1,0,1000)\n\n All values are w""ithin the given interval:\n\n >>> np.all(s >= -1)\n True\n >>> np.all(s < 0)\n True\n\n Display the histogram of the samples, along with the\n probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> count, bins, ignored = plt.hist(s, 15, normed=True)\n >>> plt.plot(bins, np.ones_like(bins), linewidth=2, color='r')\n >>> plt.show()\n\n ";
+static char __pyx_k_183[] = "RandomState.rand (line 1003)";
+static char __pyx_k_184[] = "\n rand(d0, d1, ..., dn)\n\n Random values in a given shape.\n\n Create an array of the given shape and propagate it with\n random samples from a uniform distribution\n over ``[0, 1)``.\n\n Parameters\n ----------\n d0, d1, ..., dn : int\n Shape of the output.\n\n Returns\n -------\n out : ndarray, shape ``(d0, d1, ..., dn)``\n Random values.\n\n See Also\n --------\n random\n\n Notes\n -----\n This is a convenience function. If you want an interface that\n takes a shape-tuple as the first argument, refer to\n `random`.\n\n Examples\n --------\n >>> np.random.rand(3,2)\n array([[ 0.14022471, 0.96360618], #random\n [ 0.37601032, 0.25528411], #random\n [ 0.49313049, 0.94909878]]) #random\n\n ";
+static char __pyx_k_185[] = "RandomState.randn (line 1046)";
+static char __pyx_k_186[] = "\n randn([d1, ..., dn])\n\n Return a sample (or samples) from the \"standard normal\" distribution.\n\n If positive, int_like or int-convertible arguments are provided,\n `randn` generates an array of shape ``(d1, ..., dn)``, filled\n with random floats sampled from a univariate \"normal\" (Gaussian)\n distribution of mean 0 and variance 1 (if any of the :math:`d_i` are\n floats, they are first converted to integers by truncation). A single\n float randomly sampled from the distribution is returned if no\n argument is provided.\n\n This is a convenience function. If you want an interface that takes a\n tuple as the first argument, use `numpy.random.standard_normal` instead.\n\n Parameters\n ----------\n d1, ..., dn : `n` ints, optional\n The dimensions of the returned array, should be all positive.\n\n Returns\n -------\n Z : ndarray or float\n A ``(d1, ..., dn)``-shaped array of floating-point samples from\n the standard normal distribution, or a single such float if\n no parameters were supplied.\n\n See Also\n --------\n random.standard_normal : Similar, but takes a tuple as its argument.\n\n Notes\n -----\n For random samples from :math:`N(\\mu, \\sigma^2)`, use:\n\n ``sigma * np.random.randn(...) + mu``\n\n Examples\n --------\n >>> np.random.randn()\n 2.1923875335537315 #random\n\n Two-by-four array of samples from N(3, 6.25):\n\n >>> 2.5 * np.random.randn(2, 4) + 3\n array([[-4.49401501, 4.00950034, -1.81814867, 7.29718677], #random\n [ 0.39924804, 4.68456316, 4.99394529, 4.84057254]]) #random\n\n ";
+static char __pyx_k_187[] = "RandomState.random_integers (line 1102)";
+static char __pyx_k_188[] = "\n random_integers(low, high=None, size=None)\n\n Return random integers between `low` and `high`, inclusive.\n\n Return random integers from the \"discrete uniform\" distribution in the\n closed interval [`low`, `high`]. If `high` is None (the default),\n then results are from [1, `low`].\n\n Parameters\n ----------\n low : int\n Lowest (signed) integer to be drawn from the distribution (unless\n ``high=None``, in which case this parameter is the *highest* such\n integer).\n high : int, optional\n If provided, the largest (signed) integer to be drawn from the\n distribution (see above for behavior if ``high=None``).\n size : int or tuple of ints, optional\n Output shape. Default is None, in which case a single int is returned.\n\n Returns\n -------\n out : int or ndarray of ints\n `size`-shaped array of random integers from the appropriate\n distribution, or a single such random int if `size` not provided.\n\n See Also\n --------\n random.randint : Similar to `random_integers`, only for the half-open\n interval [`low`, `high`), and 0 is the lowest value if `high` is\n omitted.\n\n Notes\n -----\n To sample from N evenly spaced floating-point numbers between a and b,\n use::\n\n a + (b - a) * (np.random.random_integers(N) - 1) / (N - 1.)\n\n Examples\n --------\n >>> np.random.random_integers(5)\n 4\n >>> type(np.random.random_integers(5))\n <type 'int'>\n >>> np.random.random_integers(5, size=(3.,2.))\n array([[5, 4],\n [3, 3],\n [4, 5]])\n\n Choose five random numbers from the set of five evenly-spaced\n numbers between 0 and 2.5, inclusive (*i.e.*, from the set\n :math:`{0, 5/8, 10/8, 15/8, 20/8}`):\n""\n >>> 2.5 * (np.random.random_integers(5, size=(5,)) - 1) / 4.\n array([ 0.625, 1.25 , 0.625, 0.625, 2.5 ])\n\n Roll two six sided dice 1000 times and sum the results:\n\n >>> d1 = np.random.random_integers(1, 6, 1000)\n >>> d2 = np.random.random_integers(1, 6, 1000)\n >>> dsums = d1 + d2\n\n Display results as a histogram:\n\n >>> import matplotlib.pyplot as plt\n >>> count, bins, ignored = plt.hist(dsums, 11, normed=True)\n >>> plt.show()\n\n ";
+static char __pyx_k_189[] = "RandomState.standard_normal (line 1180)";
+static char __pyx_k_190[] = "\n standard_normal(size=None)\n\n Returns samples from a Standard Normal distribution (mean=0, stdev=1).\n\n Parameters\n ----------\n size : int or tuple of ints, optional\n Output shape. Default is None, in which case a single value is\n returned.\n\n Returns\n -------\n out : float or ndarray\n Drawn samples.\n\n Examples\n --------\n >>> s = np.random.standard_normal(8000)\n >>> s\n array([ 0.6888893 , 0.78096262, -0.89086505, ..., 0.49876311, #random\n -0.38672696, -0.4685006 ]) #random\n >>> s.shape\n (8000,)\n >>> s = np.random.standard_normal(size=(3, 4, 2))\n >>> s.shape\n (3, 4, 2)\n\n ";
+static char __pyx_k_191[] = "RandomState.normal (line 1212)";
+static char __pyx_k_192[] = "\n normal(loc=0.0, scale=1.0, size=None)\n\n Draw random samples from a normal (Gaussian) distribution.\n\n The probability density function of the normal distribution, first\n derived by De Moivre and 200 years later by both Gauss and Laplace\n independently [2]_, is often called the bell curve because of\n its characteristic shape (see the example below).\n\n The normal distributions occurs often in nature. For example, it\n describes the commonly occurring distribution of samples influenced\n by a large number of tiny, random disturbances, each with its own\n unique distribution [2]_.\n\n Parameters\n ----------\n loc : float\n Mean (\"centre\") of the distribution.\n scale : float\n Standard deviation (spread or \"width\") of the distribution.\n size : tuple of ints\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n See Also\n --------\n scipy.stats.distributions.norm : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the Gaussian distribution is\n\n .. math:: p(x) = \\frac{1}{\\sqrt{ 2 \\pi \\sigma^2 }}\n e^{ - \\frac{ (x - \\mu)^2 } {2 \\sigma^2} },\n\n where :math:`\\mu` is the mean and :math:`\\sigma` the standard deviation.\n The square of the standard deviation, :math:`\\sigma^2`, is called the\n variance.\n\n The function has its peak at the mean, and its \"spread\" increases with\n the standard deviation (the function reaches 0.607 times its maximum at\n :math:`x + \\sigma` and :math:`x - \\sigma` [2]_). This implies that\n `numpy.random.normal` is more likely to return samples lying close to the\n mean, rather than those far away.\n""\n References\n ----------\n .. [1] Wikipedia, \"Normal distribution\",\n http://en.wikipedia.org/wiki/Normal_distribution\n .. [2] P. R. Peebles Jr., \"Central Limit Theorem\" in \"Probability, Random\n Variables and Random Signal Principles\", 4th ed., 2001,\n pp. 51, 51, 125.\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> mu, sigma = 0, 0.1 # mean and standard deviation\n >>> s = np.random.normal(mu, sigma, 1000)\n\n Verify the mean and the variance:\n\n >>> abs(mu - np.mean(s)) < 0.01\n True\n\n >>> abs(sigma - np.std(s, ddof=1)) < 0.01\n True\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> count, bins, ignored = plt.hist(s, 30, normed=True)\n >>> plt.plot(bins, 1/(sigma * np.sqrt(2 * np.pi)) *\n ... np.exp( - (bins - mu)**2 / (2 * sigma**2) ),\n ... linewidth=2, color='r')\n >>> plt.show()\n\n ";
+static char __pyx_k_193[] = "RandomState.standard_exponential (line 1425)";
+static char __pyx_k_194[] = "\n standard_exponential(size=None)\n\n Draw samples from the standard exponential distribution.\n\n `standard_exponential` is identical to the exponential distribution\n with a scale parameter of 1.\n\n Parameters\n ----------\n size : int or tuple of ints\n Shape of the output.\n\n Returns\n -------\n out : float or ndarray\n Drawn samples.\n\n Examples\n --------\n Output a 3x8000 array:\n\n >>> n = np.random.standard_exponential((3, 8000))\n\n ";
+static char __pyx_k_195[] = "RandomState.standard_gamma (line 1453)";
+static char __pyx_k_196[] = "\n standard_gamma(shape, size=None)\n\n Draw samples from a Standard Gamma distribution.\n\n Samples are drawn from a Gamma distribution with specified parameters,\n shape (sometimes designated \"k\") and scale=1.\n\n Parameters\n ----------\n shape : float\n Parameter, should be > 0.\n size : int or tuple of ints\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n samples : ndarray or scalar\n The drawn samples.\n\n See Also\n --------\n scipy.stats.distributions.gamma : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the Gamma distribution is\n\n .. math:: p(x) = x^{k-1}\\frac{e^{-x/\\theta}}{\\theta^k\\Gamma(k)},\n\n where :math:`k` is the shape and :math:`\\theta` the scale,\n and :math:`\\Gamma` is the Gamma function.\n\n The Gamma distribution is often used to model the times to failure of\n electronic components, and arises naturally in processes for which the\n waiting times between Poisson distributed events are relevant.\n\n References\n ----------\n .. [1] Weisstein, Eric W. \"Gamma Distribution.\" From MathWorld--A\n Wolfram Web Resource.\n http://mathworld.wolfram.com/GammaDistribution.html\n .. [2] Wikipedia, \"Gamma-distribution\",\n http://en.wikipedia.org/wiki/Gamma-distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> shape, scale = 2., 1. # mean and width\n >>> s = np.random.standard_gamma(shape, 1000000)\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt""\n >>> import scipy.special as sps\n >>> count, bins, ignored = plt.hist(s, 50, normed=True)\n >>> y = bins**(shape-1) * ((np.exp(-bins/scale))/ \\\n ... (sps.gamma(shape) * scale**shape))\n >>> plt.plot(bins, y, linewidth=2, color='r')\n >>> plt.show()\n\n ";
+static char __pyx_k_197[] = "RandomState.gamma (line 1535)";
+static char __pyx_k_198[] = "\n gamma(shape, scale=1.0, size=None)\n\n Draw samples from a Gamma distribution.\n\n Samples are drawn from a Gamma distribution with specified parameters,\n `shape` (sometimes designated \"k\") and `scale` (sometimes designated\n \"theta\"), where both parameters are > 0.\n\n Parameters\n ----------\n shape : scalar > 0\n The shape of the gamma distribution.\n scale : scalar > 0, optional\n The scale of the gamma distribution. Default is equal to 1.\n size : shape_tuple, optional\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n out : ndarray, float\n Returns one sample unless `size` parameter is specified.\n\n See Also\n --------\n scipy.stats.distributions.gamma : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the Gamma distribution is\n\n .. math:: p(x) = x^{k-1}\\frac{e^{-x/\\theta}}{\\theta^k\\Gamma(k)},\n\n where :math:`k` is the shape and :math:`\\theta` the scale,\n and :math:`\\Gamma` is the Gamma function.\n\n The Gamma distribution is often used to model the times to failure of\n electronic components, and arises naturally in processes for which the\n waiting times between Poisson distributed events are relevant.\n\n References\n ----------\n .. [1] Weisstein, Eric W. \"Gamma Distribution.\" From MathWorld--A\n Wolfram Web Resource.\n http://mathworld.wolfram.com/GammaDistribution.html\n .. [2] Wikipedia, \"Gamma-distribution\",\n http://en.wikipedia.org/wiki/Gamma-distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> shape, scale = 2.,"" 2. # mean and dispersion\n >>> s = np.random.gamma(shape, scale, 1000)\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> import scipy.special as sps\n >>> count, bins, ignored = plt.hist(s, 50, normed=True)\n >>> y = bins**(shape-1)*(np.exp(-bins/scale) /\n ... (sps.gamma(shape)*scale**shape))\n >>> plt.plot(bins, y, linewidth=2, color='r')\n >>> plt.show()\n\n ";
+static char __pyx_k_199[] = "RandomState.f (line 1626)";
+static char __pyx_k_200[] = "\n f(dfnum, dfden, size=None)\n\n Draw samples from a F distribution.\n\n Samples are drawn from an F distribution with specified parameters,\n `dfnum` (degrees of freedom in numerator) and `dfden` (degrees of freedom\n in denominator), where both parameters should be greater than zero.\n\n The random variate of the F distribution (also known as the\n Fisher distribution) is a continuous probability distribution\n that arises in ANOVA tests, and is the ratio of two chi-square\n variates.\n\n Parameters\n ----------\n dfnum : float\n Degrees of freedom in numerator. Should be greater than zero.\n dfden : float\n Degrees of freedom in denominator. Should be greater than zero.\n size : {tuple, int}, optional\n Output shape. If the given shape is, e.g., ``(m, n, k)``,\n then ``m * n * k`` samples are drawn. By default only one sample\n is returned.\n\n Returns\n -------\n samples : {ndarray, scalar}\n Samples from the Fisher distribution.\n\n See Also\n --------\n scipy.stats.distributions.f : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n\n The F statistic is used to compare in-group variances to between-group\n variances. Calculating the distribution depends on the sampling, and\n so it is a function of the respective degrees of freedom in the\n problem. The variable `dfnum` is the number of samples minus one, the\n between-groups degrees of freedom, while `dfden` is the within-groups\n degrees of freedom, the sum of the number of samples in each group\n minus the number of groups.\n\n References\n ----------\n .. [1] Glantz, Stanton A. \"Primer of Biostatistics.\", McGraw-Hill,\n Fifth Edition, 2002.""\n .. [2] Wikipedia, \"F-distribution\",\n http://en.wikipedia.org/wiki/F-distribution\n\n Examples\n --------\n An example from Glantz[1], pp 47-40.\n Two groups, children of diabetics (25 people) and children from people\n without diabetes (25 controls). Fasting blood glucose was measured,\n case group had a mean value of 86.1, controls had a mean value of\n 82.2. Standard deviations were 2.09 and 2.49 respectively. Are these\n data consistent with the null hypothesis that the parents diabetic\n status does not affect their children's blood glucose levels?\n Calculating the F statistic from the data gives a value of 36.01.\n\n Draw samples from the distribution:\n\n >>> dfnum = 1. # between group degrees of freedom\n >>> dfden = 48. # within groups degrees of freedom\n >>> s = np.random.f(dfnum, dfden, 1000)\n\n The lower bound for the top 1% of the samples is :\n\n >>> sort(s)[-10]\n 7.61988120985\n\n So there is about a 1% chance that the F statistic will exceed 7.62,\n the measured value is 36, so the null hypothesis is rejected at the 1%\n level.\n\n ";
+static char __pyx_k_201[] = "RandomState.noncentral_f (line 1729)";
+static char __pyx_k_202[] = "\n noncentral_f(dfnum, dfden, nonc, size=None)\n\n Draw samples from the noncentral F distribution.\n\n Samples are drawn from an F distribution with specified parameters,\n `dfnum` (degrees of freedom in numerator) and `dfden` (degrees of\n freedom in denominator), where both parameters > 1.\n `nonc` is the non-centrality parameter.\n\n Parameters\n ----------\n dfnum : int\n Parameter, should be > 1.\n dfden : int\n Parameter, should be > 1.\n nonc : float\n Parameter, should be >= 0.\n size : int or tuple of ints\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n samples : scalar or ndarray\n Drawn samples.\n\n Notes\n -----\n When calculating the power of an experiment (power = probability of\n rejecting the null hypothesis when a specific alternative is true) the\n non-central F statistic becomes important. When the null hypothesis is\n true, the F statistic follows a central F distribution. When the null\n hypothesis is not true, then it follows a non-central F statistic.\n\n References\n ----------\n Weisstein, Eric W. \"Noncentral F-Distribution.\" From MathWorld--A Wolfram\n Web Resource. http://mathworld.wolfram.com/NoncentralF-Distribution.html\n\n Wikipedia, \"Noncentral F distribution\",\n http://en.wikipedia.org/wiki/Noncentral_F-distribution\n\n Examples\n --------\n In a study, testing for a specific alternative to the null hypothesis\n requires use of the Noncentral F distribution. We need to calculate the\n area in the tail of the distribution that exceeds the value of the F\n distribution for the null hypothesis. We'll plot the two probability\n distributions for comp""arison.\n\n >>> dfnum = 3 # between group deg of freedom\n >>> dfden = 20 # within groups degrees of freedom\n >>> nonc = 3.0\n >>> nc_vals = np.random.noncentral_f(dfnum, dfden, nonc, 1000000)\n >>> NF = np.histogram(nc_vals, bins=50, normed=True)\n >>> c_vals = np.random.f(dfnum, dfden, 1000000)\n >>> F = np.histogram(c_vals, bins=50, normed=True)\n >>> plt.plot(F[1][1:], F[0])\n >>> plt.plot(NF[1][1:], NF[0])\n >>> plt.show()\n\n ";
+static char __pyx_k_203[] = "RandomState.chisquare (line 1824)";
+static char __pyx_k_204[] = "\n chisquare(df, size=None)\n\n Draw samples from a chi-square distribution.\n\n When `df` independent random variables, each with standard normal\n distributions (mean 0, variance 1), are squared and summed, the\n resulting distribution is chi-square (see Notes). This distribution\n is often used in hypothesis testing.\n\n Parameters\n ----------\n df : int\n Number of degrees of freedom.\n size : tuple of ints, int, optional\n Size of the returned array. By default, a scalar is\n returned.\n\n Returns\n -------\n output : ndarray\n Samples drawn from the distribution, packed in a `size`-shaped\n array.\n\n Raises\n ------\n ValueError\n When `df` <= 0 or when an inappropriate `size` (e.g. ``size=-1``)\n is given.\n\n Notes\n -----\n The variable obtained by summing the squares of `df` independent,\n standard normally distributed random variables:\n\n .. math:: Q = \\sum_{i=0}^{\\mathtt{df}} X^2_i\n\n is chi-square distributed, denoted\n\n .. math:: Q \\sim \\chi^2_k.\n\n The probability density function of the chi-squared distribution is\n\n .. math:: p(x) = \\frac{(1/2)^{k/2}}{\\Gamma(k/2)}\n x^{k/2 - 1} e^{-x/2},\n\n where :math:`\\Gamma` is the gamma function,\n\n .. math:: \\Gamma(x) = \\int_0^{-\\infty} t^{x - 1} e^{-t} dt.\n\n References\n ----------\n `NIST/SEMATECH e-Handbook of Statistical Methods\n <http://www.itl.nist.gov/div898/handbook/eda/section3/eda3666.htm>`_\n\n Examples\n --------\n >>> np.random.chisquare(2,4)\n array([ 1.89920014, 9.00867716, 3.13710533, 5.62318272])\n\n ";
+static char __pyx_k_205[] = "RandomState.noncentral_chisquare (line 1902)";
+static char __pyx_k_206[] = "\n noncentral_chisquare(df, nonc, size=None)\n\n Draw samples from a noncentral chi-square distribution.\n\n The noncentral :math:`\\chi^2` distribution is a generalisation of\n the :math:`\\chi^2` distribution.\n\n Parameters\n ----------\n df : int\n Degrees of freedom, should be >= 1.\n nonc : float\n Non-centrality, should be > 0.\n size : int or tuple of ints\n Shape of the output.\n\n Notes\n -----\n The probability density function for the noncentral Chi-square distribution\n is\n\n .. math:: P(x;df,nonc) = \\sum^{\\infty}_{i=0}\n \\frac{e^{-nonc/2}(nonc/2)^{i}}{i!}P_{Y_{df+2i}}(x),\n\n where :math:`Y_{q}` is the Chi-square with q degrees of freedom.\n\n In Delhi (2007), it is noted that the noncentral chi-square is useful in\n bombing and coverage problems, the probability of killing the point target\n given by the noncentral chi-squared distribution.\n\n References\n ----------\n .. [1] Delhi, M.S. Holla, \"On a noncentral chi-square distribution in the\n analysis of weapon systems effectiveness\", Metrika, Volume 15,\n Number 1 / December, 1970.\n .. [2] Wikipedia, \"Noncentral chi-square distribution\"\n http://en.wikipedia.org/wiki/Noncentral_chi-square_distribution\n\n Examples\n --------\n Draw values from the distribution and plot the histogram\n\n >>> import matplotlib.pyplot as plt\n >>> values = plt.hist(np.random.noncentral_chisquare(3, 20, 100000),\n ... bins=200, normed=True)\n >>> plt.show()\n\n Draw values from a noncentral chisquare with very small noncentrality,\n and compare to a chisquare.\n\n >>> plt.figure()\n >>> values = plt.hist(np.random.noncentral_chisquare(3, .0000001, 100000),\n "" ... bins=np.arange(0., 25, .1), normed=True)\n >>> values2 = plt.hist(np.random.chisquare(3, 100000),\n ... bins=np.arange(0., 25, .1), normed=True)\n >>> plt.plot(values[1][0:-1], values[0]-values2[0], 'ob')\n >>> plt.show()\n\n Demonstrate how large values of non-centrality lead to a more symmetric\n distribution.\n\n >>> plt.figure()\n >>> values = plt.hist(np.random.noncentral_chisquare(3, 20, 100000),\n ... bins=200, normed=True)\n >>> plt.show()\n\n ";
+static char __pyx_k_207[] = "RandomState.standard_cauchy (line 1994)";
+static char __pyx_k_208[] = "\n standard_cauchy(size=None)\n\n Standard Cauchy distribution with mode = 0.\n\n Also known as the Lorentz distribution.\n\n Parameters\n ----------\n size : int or tuple of ints\n Shape of the output.\n\n Returns\n -------\n samples : ndarray or scalar\n The drawn samples.\n\n Notes\n -----\n The probability density function for the full Cauchy distribution is\n\n .. math:: P(x; x_0, \\gamma) = \\frac{1}{\\pi \\gamma \\bigl[ 1+\n (\\frac{x-x_0}{\\gamma})^2 \\bigr] }\n\n and the Standard Cauchy distribution just sets :math:`x_0=0` and\n :math:`\\gamma=1`\n\n The Cauchy distribution arises in the solution to the driven harmonic\n oscillator problem, and also describes spectral line broadening. It\n also describes the distribution of values at which a line tilted at\n a random angle will cut the x axis.\n\n When studying hypothesis tests that assume normality, seeing how the\n tests perform on data from a Cauchy distribution is a good indicator of\n their sensitivity to a heavy-tailed distribution, since the Cauchy looks\n very much like a Gaussian distribution, but with heavier tails.\n\n References\n ----------\n ..[1] NIST/SEMATECH e-Handbook of Statistical Methods, \"Cauchy\n Distribution\",\n http://www.itl.nist.gov/div898/handbook/eda/section3/eda3663.htm\n ..[2] Weisstein, Eric W. \"Cauchy Distribution.\" From MathWorld--A\n Wolfram Web Resource.\n http://mathworld.wolfram.com/CauchyDistribution.html\n ..[3] Wikipedia, \"Cauchy distribution\"\n http://en.wikipedia.org/wiki/Cauchy_distribution\n\n Examples\n --------\n Draw samples and plot the distribution:\n\n >>> s = np.random.standard_cauchy(1000000)\n >>> s = s[(s>-25) & (s<25)""] # truncate distribution so it plots well\n >>> plt.hist(s, bins=100)\n >>> plt.show()\n\n ";
+static char __pyx_k_209[] = "RandomState.standard_t (line 2055)";
+static char __pyx_k_210[] = "\n standard_t(df, size=None)\n\n Standard Student's t distribution with df degrees of freedom.\n\n A special case of the hyperbolic distribution.\n As `df` gets large, the result resembles that of the standard normal\n distribution (`standard_normal`).\n\n Parameters\n ----------\n df : int\n Degrees of freedom, should be > 0.\n size : int or tuple of ints, optional\n Output shape. Default is None, in which case a single value is\n returned.\n\n Returns\n -------\n samples : ndarray or scalar\n Drawn samples.\n\n Notes\n -----\n The probability density function for the t distribution is\n\n .. math:: P(x, df) = \\frac{\\Gamma(\\frac{df+1}{2})}{\\sqrt{\\pi df}\n \\Gamma(\\frac{df}{2})}\\Bigl( 1+\\frac{x^2}{df} \\Bigr)^{-(df+1)/2}\n\n The t test is based on an assumption that the data come from a Normal\n distribution. The t test provides a way to test whether the sample mean\n (that is the mean calculated from the data) is a good estimate of the true\n mean.\n\n The derivation of the t-distribution was forst published in 1908 by William\n Gisset while working for the Guinness Brewery in Dublin. Due to proprietary\n issues, he had to publish under a pseudonym, and so he used the name\n Student.\n\n References\n ----------\n .. [1] Dalgaard, Peter, \"Introductory Statistics With R\",\n Springer, 2002.\n .. [2] Wikipedia, \"Student's t-distribution\"\n http://en.wikipedia.org/wiki/Student's_t-distribution\n\n Examples\n --------\n From Dalgaard page 83 [1]_, suppose the daily energy intake for 11\n women in Kj is:\n\n >>> intake = np.array([5260., 5470, 5640, 6180, 6390, 6515, 6805, 7515, \\\n ... 7515, 8230, 8770])\n\n Doe""s their energy intake deviate systematically from the recommended\n value of 7725 kJ?\n\n We have 10 degrees of freedom, so is the sample mean within 95% of the\n recommended value?\n\n >>> s = np.random.standard_t(10, size=100000)\n >>> np.mean(intake)\n 6753.636363636364\n >>> intake.std(ddof=1)\n 1142.1232221373727\n\n Calculate the t statistic, setting the ddof parameter to the unbiased\n value so the divisor in the standard deviation will be degrees of\n freedom, N-1.\n\n >>> t = (np.mean(intake)-7725)/(intake.std(ddof=1)/np.sqrt(len(intake)))\n >>> import matplotlib.pyplot as plt\n >>> h = plt.hist(s, bins=100, normed=True)\n\n For a one-sided t-test, how far out in the distribution does the t\n statistic appear?\n\n >>> >>> np.sum(s<t) / float(len(s))\n 0.0090699999999999999 #random\n\n So the p-value is about 0.009, which says the null hypothesis has a\n probability of about 99% of being true.\n\n ";
+static char __pyx_k_211[] = "RandomState.vonmises (line 2156)";
+static char __pyx_k_212[] = "\n vonmises(mu, kappa, size=None)\n\n Draw samples from a von Mises distribution.\n\n Samples are drawn from a von Mises distribution with specified mode\n (mu) and dispersion (kappa), on the interval [-pi, pi].\n\n The von Mises distribution (also known as the circular normal\n distribution) is a continuous probability distribution on the unit\n circle. It may be thought of as the circular analogue of the normal\n distribution.\n\n Parameters\n ----------\n mu : float\n Mode (\"center\") of the distribution.\n kappa : float\n Dispersion of the distribution, has to be >=0.\n size : int or tuple of int\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n samples : scalar or ndarray\n The returned samples, which are in the interval [-pi, pi].\n\n See Also\n --------\n scipy.stats.distributions.vonmises : probability density function,\n distribution, or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the von Mises distribution is\n\n .. math:: p(x) = \\frac{e^{\\kappa cos(x-\\mu)}}{2\\pi I_0(\\kappa)},\n\n where :math:`\\mu` is the mode and :math:`\\kappa` the dispersion,\n and :math:`I_0(\\kappa)` is the modified Bessel function of order 0.\n\n The von Mises is named for Richard Edler von Mises, who was born in\n Austria-Hungary, in what is now the Ukraine. He fled to the United\n States in 1939 and became a professor at Harvard. He worked in\n probability theory, aerodynamics, fluid mechanics, and philosophy of\n science.\n\n References\n ----------\n Abramowitz, M. and Stegun, I. A. (ed.), *Handbook of Mathematical\n Functions*, New York: Dover, 1965.\n\n "" von Mises, R., *Mathematical Theory of Probability and Statistics*,\n New York: Academic Press, 1964.\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> mu, kappa = 0.0, 4.0 # mean and dispersion\n >>> s = np.random.vonmises(mu, kappa, 1000)\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> import scipy.special as sps\n >>> count, bins, ignored = plt.hist(s, 50, normed=True)\n >>> x = np.arange(-np.pi, np.pi, 2*np.pi/50.)\n >>> y = -np.exp(kappa*np.cos(x-mu))/(2*np.pi*sps.jn(0,kappa))\n >>> plt.plot(x, y/max(y), linewidth=2, color='r')\n >>> plt.show()\n\n ";
+static char __pyx_k_213[] = "RandomState.pareto (line 2250)";
+static char __pyx_k_214[] = "\n pareto(a, size=None)\n\n Draw samples from a Pareto II or Lomax distribution with specified shape.\n\n The Lomax or Pareto II distribution is a shifted Pareto distribution. The\n classical Pareto distribution can be obtained from the Lomax distribution\n by adding the location parameter m, see below. The smallest value of the\n Lomax distribution is zero while for the classical Pareto distribution it\n is m, where the standard Pareto distribution has location m=1.\n Lomax can also be considered as a simplified version of the Generalized\n Pareto distribution (available in SciPy), with the scale set to one and\n the location set to zero.\n\n The Pareto distribution must be greater than zero, and is unbounded above.\n It is also known as the \"80-20 rule\". In this distribution, 80 percent of\n the weights are in the lowest 20 percent of the range, while the other 20\n percent fill the remaining 80 percent of the range.\n\n Parameters\n ----------\n shape : float, > 0.\n Shape of the distribution.\n size : tuple of ints\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n See Also\n --------\n scipy.stats.distributions.lomax.pdf : probability density function,\n distribution or cumulative density function, etc.\n scipy.stats.distributions.genpareto.pdf : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the Pareto distribution is\n\n .. math:: p(x) = \\frac{am^a}{x^{a+1}}\n\n where :math:`a` is the shape and :math:`m` the location\n\n The Pareto distribution, named after the Italian economist Vilfredo Pareto,\n is a power law probability distribution useful in many real world probl""ems.\n Outside the field of economics it is generally referred to as the Bradford\n distribution. Pareto developed the distribution to describe the\n distribution of wealth in an economy. It has also found use in insurance,\n web page access statistics, oil field sizes, and many other problems,\n including the download frequency for projects in Sourceforge [1]. It is\n one of the so-called \"fat-tailed\" distributions.\n\n\n References\n ----------\n .. [1] Francis Hunt and Paul Johnson, On the Pareto Distribution of\n Sourceforge projects.\n .. [2] Pareto, V. (1896). Course of Political Economy. Lausanne.\n .. [3] Reiss, R.D., Thomas, M.(2001), Statistical Analysis of Extreme\n Values, Birkhauser Verlag, Basel, pp 23-30.\n .. [4] Wikipedia, \"Pareto distribution\",\n http://en.wikipedia.org/wiki/Pareto_distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> a, m = 3., 1. # shape and mode\n >>> s = np.random.pareto(a, 1000) + m\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> count, bins, ignored = plt.hist(s, 100, normed=True, align='center')\n >>> fit = a*m**a/bins**(a+1)\n >>> plt.plot(bins, max(count)*fit/max(fit),linewidth=2, color='r')\n >>> plt.show()\n\n ";
+static char __pyx_k_215[] = "RandomState.weibull (line 2346)";
+static char __pyx_k_216[] = "\n weibull(a, size=None)\n\n Weibull distribution.\n\n Draw samples from a 1-parameter Weibull distribution with the given\n shape parameter `a`.\n\n .. math:: X = (-ln(U))^{1/a}\n\n Here, U is drawn from the uniform distribution over (0,1].\n\n The more common 2-parameter Weibull, including a scale parameter\n :math:`\\lambda` is just :math:`X = \\lambda(-ln(U))^{1/a}`.\n\n Parameters\n ----------\n a : float\n Shape of the distribution.\n size : tuple of ints\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n See Also\n --------\n scipy.stats.distributions.weibull : probability density function,\n distribution or cumulative density function, etc.\n\n gumbel, scipy.stats.distributions.genextreme\n\n Notes\n -----\n The Weibull (or Type III asymptotic extreme value distribution for smallest\n values, SEV Type III, or Rosin-Rammler distribution) is one of a class of\n Generalized Extreme Value (GEV) distributions used in modeling extreme\n value problems. This class includes the Gumbel and Frechet distributions.\n\n The probability density for the Weibull distribution is\n\n .. math:: p(x) = \\frac{a}\n {\\lambda}(\\frac{x}{\\lambda})^{a-1}e^{-(x/\\lambda)^a},\n\n where :math:`a` is the shape and :math:`\\lambda` the scale.\n\n The function has its peak (the mode) at\n :math:`\\lambda(\\frac{a-1}{a})^{1/a}`.\n\n When ``a = 1``, the Weibull distribution reduces to the exponential\n distribution.\n\n References\n ----------\n .. [1] Waloddi Weibull, Professor, Royal Technical University, Stockholm,\n 1939 \"A Statistical Theory Of The Strength Of Materials\",\n Ingeniorsvetenskapsakademiens Handlingar"" Nr 151, 1939,\n Generalstabens Litografiska Anstalts Forlag, Stockholm.\n .. [2] Waloddi Weibull, 1951 \"A Statistical Distribution Function of Wide\n Applicability\", Journal Of Applied Mechanics ASME Paper.\n .. [3] Wikipedia, \"Weibull distribution\",\n http://en.wikipedia.org/wiki/Weibull_distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> a = 5. # shape\n >>> s = np.random.weibull(a, 1000)\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> x = np.arange(1,100.)/50.\n >>> def weib(x,n,a):\n ... return (a / n) * (x / n)**(a - 1) * np.exp(-(x / n)**a)\n\n >>> count, bins, ignored = plt.hist(np.random.weibull(5.,1000))\n >>> x = np.arange(1,100.)/50.\n >>> scale = count.max()/weib(x, 1., 5.).max()\n >>> plt.plot(x, weib(x, 1., 5.)*scale)\n >>> plt.show()\n\n ";
+static char __pyx_k_217[] = "RandomState.power (line 2446)";
+static char __pyx_k_218[] = "\n power(a, size=None)\n\n Draws samples in [0, 1] from a power distribution with positive\n exponent a - 1.\n\n Also known as the power function distribution.\n\n Parameters\n ----------\n a : float\n parameter, > 0\n size : tuple of ints\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n samples : {ndarray, scalar}\n The returned samples lie in [0, 1].\n\n Raises\n ------\n ValueError\n If a<1.\n\n Notes\n -----\n The probability density function is\n\n .. math:: P(x; a) = ax^{a-1}, 0 \\le x \\le 1, a>0.\n\n The power function distribution is just the inverse of the Pareto\n distribution. It may also be seen as a special case of the Beta\n distribution.\n\n It is used, for example, in modeling the over-reporting of insurance\n claims.\n\n References\n ----------\n .. [1] Christian Kleiber, Samuel Kotz, \"Statistical size distributions\n in economics and actuarial sciences\", Wiley, 2003.\n .. [2] Heckert, N. A. and Filliben, James J. (2003). NIST Handbook 148:\n Dataplot Reference Manual, Volume 2: Let Subcommands and Library\n Functions\", National Institute of Standards and Technology Handbook\n Series, June 2003.\n http://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/powpdf.pdf\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> a = 5. # shape\n >>> samples = 1000\n >>> s = np.random.power(a, samples)\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> count, bins, ignored = plt.hist(s, bins=""30)\n >>> x = np.linspace(0, 1, 100)\n >>> y = a*x**(a-1.)\n >>> normed_y = samples*np.diff(bins)[0]*y\n >>> plt.plot(x, normed_y)\n >>> plt.show()\n\n Compare the power function distribution to the inverse of the Pareto.\n\n >>> from scipy import stats\n >>> rvs = np.random.power(5, 1000000)\n >>> rvsp = np.random.pareto(5, 1000000)\n >>> xx = np.linspace(0,1,100)\n >>> powpdf = stats.powerlaw.pdf(xx,5)\n\n >>> plt.figure()\n >>> plt.hist(rvs, bins=50, normed=True)\n >>> plt.plot(xx,powpdf,'r-')\n >>> plt.title('np.random.power(5)')\n\n >>> plt.figure()\n >>> plt.hist(1./(1.+rvsp), bins=50, normed=True)\n >>> plt.plot(xx,powpdf,'r-')\n >>> plt.title('inverse of 1 + np.random.pareto(5)')\n\n >>> plt.figure()\n >>> plt.hist(1./(1.+rvsp), bins=50, normed=True)\n >>> plt.plot(xx,powpdf,'r-')\n >>> plt.title('inverse of stats.pareto(5)')\n\n ";
+static char __pyx_k_219[] = "RandomState.laplace (line 2555)";
+static char __pyx_k_220[] = "\n laplace(loc=0.0, scale=1.0, size=None)\n\n Draw samples from the Laplace or double exponential distribution with\n specified location (or mean) and scale (decay).\n\n The Laplace distribution is similar to the Gaussian/normal distribution,\n but is sharper at the peak and has fatter tails. It represents the\n difference between two independent, identically distributed exponential\n random variables.\n\n Parameters\n ----------\n loc : float\n The position, :math:`\\mu`, of the distribution peak.\n scale : float\n :math:`\\lambda`, the exponential decay.\n\n Notes\n -----\n It has the probability density function\n\n .. math:: f(x; \\mu, \\lambda) = \\frac{1}{2\\lambda}\n \\exp\\left(-\\frac{|x - \\mu|}{\\lambda}\\right).\n\n The first law of Laplace, from 1774, states that the frequency of an error\n can be expressed as an exponential function of the absolute magnitude of\n the error, which leads to the Laplace distribution. For many problems in\n Economics and Health sciences, this distribution seems to model the data\n better than the standard Gaussian distribution\n\n\n References\n ----------\n .. [1] Abramowitz, M. and Stegun, I. A. (Eds.). Handbook of Mathematical\n Functions with Formulas, Graphs, and Mathematical Tables, 9th\n printing. New York: Dover, 1972.\n\n .. [2] The Laplace distribution and generalizations\n By Samuel Kotz, Tomasz J. Kozubowski, Krzysztof Podgorski,\n Birkhauser, 2001.\n\n .. [3] Weisstein, Eric W. \"Laplace Distribution.\"\n From MathWorld--A Wolfram Web Resource.\n http://mathworld.wolfram.com/LaplaceDistribution.html\n\n .. [4] Wikipedia, \"Laplace distribution\",\n http://en.wikipedia.org/wik""i/Laplace_distribution\n\n Examples\n --------\n Draw samples from the distribution\n\n >>> loc, scale = 0., 1.\n >>> s = np.random.laplace(loc, scale, 1000)\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> count, bins, ignored = plt.hist(s, 30, normed=True)\n >>> x = np.arange(-8., 8., .01)\n >>> pdf = np.exp(-abs(x-loc/scale))/(2.*scale)\n >>> plt.plot(x, pdf)\n\n Plot Gaussian for comparison:\n\n >>> g = (1/(scale * np.sqrt(2 * np.pi)) * \n ... np.exp( - (x - loc)**2 / (2 * scale**2) ))\n >>> plt.plot(x,g)\n\n ";
+static char __pyx_k_221[] = "RandomState.gumbel (line 2645)";
+static char __pyx_k_222[] = "\n gumbel(loc=0.0, scale=1.0, size=None)\n\n Gumbel distribution.\n\n Draw samples from a Gumbel distribution with specified location and scale.\n For more information on the Gumbel distribution, see Notes and References\n below.\n\n Parameters\n ----------\n loc : float\n The location of the mode of the distribution.\n scale : float\n The scale parameter of the distribution.\n size : tuple of ints\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n out : ndarray\n The samples\n\n See Also\n --------\n scipy.stats.gumbel_l\n scipy.stats.gumbel_r\n scipy.stats.genextreme\n probability density function, distribution, or cumulative density\n function, etc. for each of the above\n weibull\n\n Notes\n -----\n The Gumbel (or Smallest Extreme Value (SEV) or the Smallest Extreme Value\n Type I) distribution is one of a class of Generalized Extreme Value (GEV)\n distributions used in modeling extreme value problems. The Gumbel is a\n special case of the Extreme Value Type I distribution for maximums from\n distributions with \"exponential-like\" tails.\n\n The probability density for the Gumbel distribution is\n\n .. math:: p(x) = \\frac{e^{-(x - \\mu)/ \\beta}}{\\beta} e^{ -e^{-(x - \\mu)/\n \\beta}},\n\n where :math:`\\mu` is the mode, a location parameter, and :math:`\\beta` is\n the scale parameter.\n\n The Gumbel (named for German mathematician Emil Julius Gumbel) was used\n very early in the hydrology literature, for modeling the occurrence of\n flood events. It is also used for modeling maximum wind speed and rainfall\n rates. It is a \"fat-tailed\" distribution - the ""probability of an event in\n the tail of the distribution is larger than if one used a Gaussian, hence\n the surprisingly frequent occurrence of 100-year floods. Floods were\n initially modeled as a Gaussian process, which underestimated the frequency\n of extreme events.\n\n\n It is one of a class of extreme value distributions, the Generalized\n Extreme Value (GEV) distributions, which also includes the Weibull and\n Frechet.\n\n The function has a mean of :math:`\\mu + 0.57721\\beta` and a variance of\n :math:`\\frac{\\pi^2}{6}\\beta^2`.\n\n References\n ----------\n Gumbel, E. J., *Statistics of Extremes*, New York: Columbia University\n Press, 1958.\n\n Reiss, R.-D. and Thomas, M., *Statistical Analysis of Extreme Values from\n Insurance, Finance, Hydrology and Other Fields*, Basel: Birkhauser Verlag,\n 2001.\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> mu, beta = 0, 0.1 # location and scale\n >>> s = np.random.gumbel(mu, beta, 1000)\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> count, bins, ignored = plt.hist(s, 30, normed=True)\n >>> plt.plot(bins, (1/beta)*np.exp(-(bins - mu)/beta)\n ... * np.exp( -np.exp( -(bins - mu) /beta) ),\n ... linewidth=2, color='r')\n >>> plt.show()\n\n Show how an extreme value distribution can arise from a Gaussian process\n and compare to a Gaussian:\n\n >>> means = []\n >>> maxima = []\n >>> for i in range(0,1000) :\n ... a = np.random.normal(mu, beta, 1000)\n ... means.append(a.mean())\n ... maxima.append(a.max())\n >>> count, bins, ignored = plt.hist(maxima, 30, normed=True)\n >>> beta = np.std(maxima)*np.pi/np.sqrt(6)""\n >>> mu = np.mean(maxima) - 0.57721*beta\n >>> plt.plot(bins, (1/beta)*np.exp(-(bins - mu)/beta)\n ... * np.exp(-np.exp(-(bins - mu)/beta)),\n ... linewidth=2, color='r')\n >>> plt.plot(bins, 1/(beta * np.sqrt(2 * np.pi))\n ... * np.exp(-(bins - mu)**2 / (2 * beta**2)),\n ... linewidth=2, color='g')\n >>> plt.show()\n\n ";
+static char __pyx_k_223[] = "RandomState.logistic (line 2776)";
+static char __pyx_k_224[] = "\n logistic(loc=0.0, scale=1.0, size=None)\n\n Draw samples from a Logistic distribution.\n\n Samples are drawn from a Logistic distribution with specified\n parameters, loc (location or mean, also median), and scale (>0).\n\n Parameters\n ----------\n loc : float\n\n scale : float > 0.\n\n size : {tuple, int}\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n samples : {ndarray, scalar}\n where the values are all integers in [0, n].\n\n See Also\n --------\n scipy.stats.distributions.logistic : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the Logistic distribution is\n\n .. math:: P(x) = P(x) = \\frac{e^{-(x-\\mu)/s}}{s(1+e^{-(x-\\mu)/s})^2},\n\n where :math:`\\mu` = location and :math:`s` = scale.\n\n The Logistic distribution is used in Extreme Value problems where it\n can act as a mixture of Gumbel distributions, in Epidemiology, and by\n the World Chess Federation (FIDE) where it is used in the Elo ranking\n system, assuming the performance of each player is a logistically\n distributed random variable.\n\n References\n ----------\n .. [1] Reiss, R.-D. and Thomas M. (2001), Statistical Analysis of Extreme\n Values, from Insurance, Finance, Hydrology and Other Fields,\n Birkhauser Verlag, Basel, pp 132-133.\n .. [2] Weisstein, Eric W. \"Logistic Distribution.\" From\n MathWorld--A Wolfram Web Resource.\n http://mathworld.wolfram.com/LogisticDistribution.html\n .. [3] Wikipedia, \"Logistic-distribution\",\n http://en.wikipedia.org/wiki/Logistic-distribution\n\n Examples\n "" --------\n Draw samples from the distribution:\n\n >>> loc, scale = 10, 1\n >>> s = np.random.logistic(loc, scale, 10000)\n >>> count, bins, ignored = plt.hist(s, bins=50)\n\n # plot against distribution\n\n >>> def logist(x, loc, scale):\n ... return exp((loc-x)/scale)/(scale*(1+exp((loc-x)/scale))**2)\n >>> plt.plot(bins, logist(bins, loc, scale)*count.max()/\\\n ... logist(bins, loc, scale).max())\n >>> plt.show()\n\n ";
+static char __pyx_k_225[] = "RandomState.lognormal (line 2864)";
+static char __pyx_k_226[] = "\n lognormal(mean=0.0, sigma=1.0, size=None)\n\n Return samples drawn from a log-normal distribution.\n\n Draw samples from a log-normal distribution with specified mean, standard\n deviation, and shape. Note that the mean and standard deviation are not the\n values for the distribution itself, but of the underlying normal\n distribution it is derived from.\n\n\n Parameters\n ----------\n mean : float\n Mean value of the underlying normal distribution\n sigma : float, >0.\n Standard deviation of the underlying normal distribution\n size : tuple of ints\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n See Also\n --------\n scipy.stats.lognorm : probability density function, distribution,\n cumulative density function, etc.\n\n Notes\n -----\n A variable `x` has a log-normal distribution if `log(x)` is normally\n distributed.\n\n The probability density function for the log-normal distribution is\n\n .. math:: p(x) = \\frac{1}{\\sigma x \\sqrt{2\\pi}}\n e^{(-\\frac{(ln(x)-\\mu)^2}{2\\sigma^2})}\n\n where :math:`\\mu` is the mean and :math:`\\sigma` is the standard deviation\n of the normally distributed logarithm of the variable.\n\n A log-normal distribution results if a random variable is the *product* of\n a large number of independent, identically-distributed variables in the\n same way that a normal distribution results if the variable is the *sum*\n of a large number of independent, identically-distributed variables\n (see the last example). It is one of the so-called \"fat-tailed\"\n distributions.\n\n The log-normal distribution is commonly used to model the lifespan of units\n with fatigue-stress failure modes. Since thi""s includes\n most mechanical systems, the log-normal distribution has widespread\n application.\n\n It is also commonly used to model oil field sizes, species abundance, and\n latent periods of infectious diseases.\n\n References\n ----------\n .. [1] Eckhard Limpert, Werner A. Stahel, and Markus Abbt, \"Log-normal\n Distributions across the Sciences: Keys and Clues\", May 2001\n Vol. 51 No. 5 BioScience\n http://stat.ethz.ch/~stahel/lognormal/bioscience.pdf\n .. [2] Reiss, R.D., Thomas, M.(2001), Statistical Analysis of Extreme\n Values, Birkhauser Verlag, Basel, pp 31-32.\n .. [3] Wikipedia, \"Lognormal distribution\",\n http://en.wikipedia.org/wiki/Lognormal_distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> mu, sigma = 3., 1. # mean and standard deviation\n >>> s = np.random.lognormal(mu, sigma, 1000)\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> count, bins, ignored = plt.hist(s, 100, normed=True, align='mid')\n\n >>> x = np.linspace(min(bins), max(bins), 10000)\n >>> pdf = (np.exp(-(np.log(x) - mu)**2 / (2 * sigma**2))\n ... / (x * sigma * np.sqrt(2 * np.pi)))\n\n >>> plt.plot(x, pdf, linewidth=2, color='r')\n >>> plt.axis('tight')\n >>> plt.show()\n\n Demonstrate that taking the products of random samples from a uniform\n distribution can be fit well by a log-normal probability density function.\n\n >>> # Generate a thousand samples: each is the product of 100 random\n >>> # values, drawn from a normal distribution.\n >>> b = []\n >>> for i in range(1000):\n ... a = 10. + np.random.random(100)\n ... b.append(np.product(a))\n\n >>> b"" = np.array(b) / np.min(b) # scale values to be positive\n\n >>> count, bins, ignored = plt.hist(b, 100, normed=True, align='center')\n\n >>> sigma = np.std(np.log(b))\n >>> mu = np.mean(np.log(b))\n\n >>> x = np.linspace(min(bins), max(bins), 10000)\n >>> pdf = (np.exp(-(np.log(x) - mu)**2 / (2 * sigma**2))\n ... / (x * sigma * np.sqrt(2 * np.pi)))\n\n >>> plt.plot(x, pdf, color='r', linewidth=2)\n >>> plt.show()\n\n ";
+static char __pyx_k_227[] = "RandomState.rayleigh (line 2995)";
+static char __pyx_k_228[] = "\n rayleigh(scale=1.0, size=None)\n\n Draw samples from a Rayleigh distribution.\n\n The :math:`\\chi` and Weibull distributions are generalizations of the\n Rayleigh.\n\n Parameters\n ----------\n scale : scalar\n Scale, also equals the mode. Should be >= 0.\n size : int or tuple of ints, optional\n Shape of the output. Default is None, in which case a single\n value is returned.\n\n Notes\n -----\n The probability density function for the Rayleigh distribution is\n\n .. math:: P(x;scale) = \\frac{x}{scale^2}e^{\\frac{-x^2}{2 \\cdotp scale^2}}\n\n The Rayleigh distribution arises if the wind speed and wind direction are\n both gaussian variables, then the vector wind velocity forms a Rayleigh\n distribution. The Rayleigh distribution is used to model the expected\n output from wind turbines.\n\n References\n ----------\n ..[1] Brighton Webs Ltd., Rayleigh Distribution,\n http://www.brighton-webs.co.uk/distributions/rayleigh.asp\n ..[2] Wikipedia, \"Rayleigh distribution\"\n http://en.wikipedia.org/wiki/Rayleigh_distribution\n\n Examples\n --------\n Draw values from the distribution and plot the histogram\n\n >>> values = hist(np.random.rayleigh(3, 100000), bins=200, normed=True)\n\n Wave heights tend to follow a Rayleigh distribution. If the mean wave\n height is 1 meter, what fraction of waves are likely to be larger than 3\n meters?\n\n >>> meanvalue = 1\n >>> modevalue = np.sqrt(2 / np.pi) * meanvalue\n >>> s = np.random.rayleigh(modevalue, 1000000)\n\n The percentage of waves larger than 3 meters is:\n\n >>> 100.*sum(s>3)/1000000.\n 0.087300000000000003\n\n ";
+static char __pyx_k_229[] = "RandomState.wald (line 3067)";
+static char __pyx_k_230[] = "\n wald(mean, scale, size=None)\n\n Draw samples from a Wald, or Inverse Gaussian, distribution.\n\n As the scale approaches infinity, the distribution becomes more like a\n Gaussian.\n\n Some references claim that the Wald is an Inverse Gaussian with mean=1, but\n this is by no means universal.\n\n The Inverse Gaussian distribution was first studied in relationship to\n Brownian motion. In 1956 M.C.K. Tweedie used the name Inverse Gaussian\n because there is an inverse relationship between the time to cover a unit\n distance and distance covered in unit time.\n\n Parameters\n ----------\n mean : scalar\n Distribution mean, should be > 0.\n scale : scalar\n Scale parameter, should be >= 0.\n size : int or tuple of ints, optional\n Output shape. Default is None, in which case a single value is\n returned.\n\n Returns\n -------\n samples : ndarray or scalar\n Drawn sample, all greater than zero.\n\n Notes\n -----\n The probability density function for the Wald distribution is\n\n .. math:: P(x;mean,scale) = \\sqrt{\\frac{scale}{2\\pi x^3}}e^\n \\frac{-scale(x-mean)^2}{2\\cdotp mean^2x}\n\n As noted above the Inverse Gaussian distribution first arise from attempts\n to model Brownian Motion. It is also a competitor to the Weibull for use in\n reliability modeling and modeling stock returns and interest rate\n processes.\n\n References\n ----------\n ..[1] Brighton Webs Ltd., Wald Distribution,\n http://www.brighton-webs.co.uk/distributions/wald.asp\n ..[2] Chhikara, Raj S., and Folks, J. Leroy, \"The Inverse Gaussian\n Distribution: Theory : Methodology, and Applications\", CRC Press,\n 1988.\n ..[3] Wikipedia, \"Wald distributio""n\"\n http://en.wikipedia.org/wiki/Wald_distribution\n\n Examples\n --------\n Draw values from the distribution and plot the histogram:\n\n >>> import matplotlib.pyplot as plt\n >>> h = plt.hist(np.random.wald(3, 2, 100000), bins=200, normed=True)\n >>> plt.show()\n\n ";
+static char __pyx_k_231[] = "RandomState.triangular (line 3153)";
+static char __pyx_k_232[] = "\n triangular(left, mode, right, size=None)\n\n Draw samples from the triangular distribution.\n\n The triangular distribution is a continuous probability distribution with\n lower limit left, peak at mode, and upper limit right. Unlike the other\n distributions, these parameters directly define the shape of the pdf.\n\n Parameters\n ----------\n left : scalar\n Lower limit.\n mode : scalar\n The value where the peak of the distribution occurs.\n The value should fulfill the condition ``left <= mode <= right``.\n right : scalar\n Upper limit, should be larger than `left`.\n size : int or tuple of ints, optional\n Output shape. Default is None, in which case a single value is\n returned.\n\n Returns\n -------\n samples : ndarray or scalar\n The returned samples all lie in the interval [left, right].\n\n Notes\n -----\n The probability density function for the Triangular distribution is\n\n .. math:: P(x;l, m, r) = \\begin{cases}\n \\frac{2(x-l)}{(r-l)(m-l)}& \\text{for $l \\leq x \\leq m$},\\\\\n \\frac{2(m-x)}{(r-l)(r-m)}& \\text{for $m \\leq x \\leq r$},\\\\\n 0& \\text{otherwise}.\n \\end{cases}\n\n The triangular distribution is often used in ill-defined problems where the\n underlying distribution is not known, but some knowledge of the limits and\n mode exists. Often it is used in simulations.\n\n References\n ----------\n ..[1] Wikipedia, \"Triangular distribution\"\n http://en.wikipedia.org/wiki/Triangular_distribution\n\n Examples\n --------\n Draw values from the distribution and plot the histogram:\n\n >>> import matplotlib.pyplot as plt\n >>> h = plt.hist(np.random.triangular(-3, 0, 8, 100000), bins=2""00,\n ... normed=True)\n >>> plt.show()\n\n ";
+static char __pyx_k_233[] = "RandomState.binomial (line 3241)";
+static char __pyx_k_234[] = "\n binomial(n, p, size=None)\n\n Draw samples from a binomial distribution.\n\n Samples are drawn from a Binomial distribution with specified\n parameters, n trials and p probability of success where\n n an integer > 0 and p is in the interval [0,1]. (n may be\n input as a float, but it is truncated to an integer in use)\n\n Parameters\n ----------\n n : float (but truncated to an integer)\n parameter, > 0.\n p : float\n parameter, >= 0 and <=1.\n size : {tuple, int}\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n samples : {ndarray, scalar}\n where the values are all integers in [0, n].\n\n See Also\n --------\n scipy.stats.distributions.binom : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the Binomial distribution is\n\n .. math:: P(N) = \\binom{n}{N}p^N(1-p)^{n-N},\n\n where :math:`n` is the number of trials, :math:`p` is the probability\n of success, and :math:`N` is the number of successes.\n\n When estimating the standard error of a proportion in a population by\n using a random sample, the normal distribution works well unless the\n product p*n <=5, where p = population proportion estimate, and n =\n number of samples, in which case the binomial distribution is used\n instead. For example, a sample of 15 people shows 4 who are left\n handed, and 11 who are right handed. Then p = 4/15 = 27%. 0.27*15 = 4,\n so the binomial distribution should be used in this case.\n\n References\n ----------\n .. [1] Dalgaard, Peter, \"Introductory Statistics with R\",\n Springer-Verlag, 2002.\n "" .. [2] Glantz, Stanton A. \"Primer of Biostatistics.\", McGraw-Hill,\n Fifth Edition, 2002.\n .. [3] Lentner, Marvin, \"Elementary Applied Statistics\", Bogden\n and Quigley, 1972.\n .. [4] Weisstein, Eric W. \"Binomial Distribution.\" From MathWorld--A\n Wolfram Web Resource.\n http://mathworld.wolfram.com/BinomialDistribution.html\n .. [5] Wikipedia, \"Binomial-distribution\",\n http://en.wikipedia.org/wiki/Binomial_distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> n, p = 10, .5 # number of trials, probability of each trial\n >>> s = np.random.binomial(n, p, 1000)\n # result of flipping a coin 10 times, tested 1000 times.\n\n A real world example. A company drills 9 wild-cat oil exploration\n wells, each with an estimated probability of success of 0.1. All nine\n wells fail. What is the probability of that happening?\n\n Let's do 20,000 trials of the model, and count the number that\n generate zero positive results.\n\n >>> sum(np.random.binomial(9,0.1,20000)==0)/20000.\n answer = 0.38885, or 38%.\n\n ";
+static char __pyx_k_235[] = "RandomState.negative_binomial (line 3349)";
+static char __pyx_k_236[] = "\n negative_binomial(n, p, size=None)\n\n Draw samples from a negative_binomial distribution.\n\n Samples are drawn from a negative_Binomial distribution with specified\n parameters, `n` trials and `p` probability of success where `n` is an\n integer > 0 and `p` is in the interval [0, 1].\n\n Parameters\n ----------\n n : int\n Parameter, > 0.\n p : float\n Parameter, >= 0 and <=1.\n size : int or tuple of ints\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n samples : int or ndarray of ints\n Drawn samples.\n\n Notes\n -----\n The probability density for the Negative Binomial distribution is\n\n .. math:: P(N;n,p) = \\binom{N+n-1}{n-1}p^{n}(1-p)^{N},\n\n where :math:`n-1` is the number of successes, :math:`p` is the probability\n of success, and :math:`N+n-1` is the number of trials.\n\n The negative binomial distribution gives the probability of n-1 successes\n and N failures in N+n-1 trials, and success on the (N+n)th trial.\n\n If one throws a die repeatedly until the third time a \"1\" appears, then the\n probability distribution of the number of non-\"1\"s that appear before the\n third \"1\" is a negative binomial distribution.\n\n References\n ----------\n .. [1] Weisstein, Eric W. \"Negative Binomial Distribution.\" From\n MathWorld--A Wolfram Web Resource.\n http://mathworld.wolfram.com/NegativeBinomialDistribution.html\n .. [2] Wikipedia, \"Negative binomial distribution\",\n http://en.wikipedia.org/wiki/Negative_binomial_distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n A real world example. A company drills wild-cat oil exploration well""s, each\n with an estimated probability of success of 0.1. What is the probability\n of having one success for each successive well, that is what is the\n probability of a single success after drilling 5 wells, after 6 wells,\n etc.?\n\n >>> s = np.random.negative_binomial(1, 0.1, 100000)\n >>> for i in range(1, 11):\n ... probability = sum(s<i) / 100000.\n ... print i, \"wells drilled, probability of one success =\", probability\n\n ";
+static char __pyx_k_237[] = "RandomState.poisson (line 3444)";
+static char __pyx_k_238[] = "\n poisson(lam=1.0, size=None)\n\n Draw samples from a Poisson distribution.\n\n The Poisson distribution is the limit of the Binomial\n distribution for large N.\n\n Parameters\n ----------\n lam : float\n Expectation of interval, should be >= 0.\n size : int or tuple of ints, optional\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Notes\n -----\n The Poisson distribution\n\n .. math:: f(k; \\lambda)=\\frac{\\lambda^k e^{-\\lambda}}{k!}\n\n For events with an expected separation :math:`\\lambda` the Poisson\n distribution :math:`f(k; \\lambda)` describes the probability of\n :math:`k` events occurring within the observed interval :math:`\\lambda`.\n\n Because the output is limited to the range of the C long type, a\n ValueError is raised when `lam` is within 10 sigma of the maximum\n representable value.\n\n References\n ----------\n .. [1] Weisstein, Eric W. \"Poisson Distribution.\" From MathWorld--A Wolfram\n Web Resource. http://mathworld.wolfram.com/PoissonDistribution.html\n .. [2] Wikipedia, \"Poisson distribution\",\n http://en.wikipedia.org/wiki/Poisson_distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> import numpy as np\n >>> s = np.random.poisson(5, 10000)\n\n Display histogram of the sample:\n\n >>> import matplotlib.pyplot as plt\n >>> count, bins, ignored = plt.hist(s, 14, normed=True)\n >>> plt.show()\n\n ";
+static char __pyx_k_239[] = "RandomState.zipf (line 3515)";
+static char __pyx_k_240[] = "\n zipf(a, size=None)\n\n Draw samples from a Zipf distribution.\n\n Samples are drawn from a Zipf distribution with specified parameter\n `a` > 1.\n\n The Zipf distribution (also known as the zeta distribution) is a\n continuous probability distribution that satisfies Zipf's law: the\n frequency of an item is inversely proportional to its rank in a\n frequency table.\n\n Parameters\n ----------\n a : float > 1\n Distribution parameter.\n size : int or tuple of int, optional\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn; a single integer is equivalent in\n its result to providing a mono-tuple, i.e., a 1-D array of length\n *size* is returned. The default is None, in which case a single\n scalar is returned.\n\n Returns\n -------\n samples : scalar or ndarray\n The returned samples are greater than or equal to one.\n\n See Also\n --------\n scipy.stats.distributions.zipf : probability density function,\n distribution, or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the Zipf distribution is\n\n .. math:: p(x) = \\frac{x^{-a}}{\\zeta(a)},\n\n where :math:`\\zeta` is the Riemann Zeta function.\n\n It is named for the American linguist George Kingsley Zipf, who noted\n that the frequency of any word in a sample of a language is inversely\n proportional to its rank in the frequency table.\n\n References\n ----------\n Zipf, G. K., *Selected Studies of the Principle of Relative Frequency\n in Language*, Cambridge, MA: Harvard Univ. Press, 1932.\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> a = 2. # parameter\n >>> s = np.random.zipf""(a, 1000)\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> import scipy.special as sps\n Truncate s values at 50 so plot is interesting\n >>> count, bins, ignored = plt.hist(s[s<50], 50, normed=True)\n >>> x = np.arange(1., 50.)\n >>> y = x**(-a)/sps.zetac(a)\n >>> plt.plot(x, y/max(y), linewidth=2, color='r')\n >>> plt.show()\n\n ";
+static char __pyx_k_241[] = "RandomState.geometric (line 3603)";
+static char __pyx_k_242[] = "\n geometric(p, size=None)\n\n Draw samples from the geometric distribution.\n\n Bernoulli trials are experiments with one of two outcomes:\n success or failure (an example of such an experiment is flipping\n a coin). The geometric distribution models the number of trials\n that must be run in order to achieve success. It is therefore\n supported on the positive integers, ``k = 1, 2, ...``.\n\n The probability mass function of the geometric distribution is\n\n .. math:: f(k) = (1 - p)^{k - 1} p\n\n where `p` is the probability of success of an individual trial.\n\n Parameters\n ----------\n p : float\n The probability of success of an individual trial.\n size : tuple of ints\n Number of values to draw from the distribution. The output\n is shaped according to `size`.\n\n Returns\n -------\n out : ndarray\n Samples from the geometric distribution, shaped according to\n `size`.\n\n Examples\n --------\n Draw ten thousand values from the geometric distribution,\n with the probability of an individual success equal to 0.35:\n\n >>> z = np.random.geometric(p=0.35, size=10000)\n\n How many trials succeeded after a single run?\n\n >>> (z == 1).sum() / 10000.\n 0.34889999999999999 #random\n\n ";
+static char __pyx_k_243[] = "RandomState.hypergeometric (line 3669)";
+static char __pyx_k_244[] = "\n hypergeometric(ngood, nbad, nsample, size=None)\n\n Draw samples from a Hypergeometric distribution.\n\n Samples are drawn from a Hypergeometric distribution with specified\n parameters, ngood (ways to make a good selection), nbad (ways to make\n a bad selection), and nsample = number of items sampled, which is less\n than or equal to the sum ngood + nbad.\n\n Parameters\n ----------\n ngood : float (but truncated to an integer)\n parameter, > 0.\n nbad : float\n parameter, >= 0.\n nsample : float\n parameter, > 0 and <= ngood+nbad\n size : {tuple, int}\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n samples : {ndarray, scalar}\n where the values are all integers in [0, n].\n\n See Also\n --------\n scipy.stats.distributions.hypergeom : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the Hypergeometric distribution is\n\n .. math:: P(x) = \\frac{\\binom{m}{n}\\binom{N-m}{n-x}}{\\binom{N}{n}},\n\n where :math:`0 \\le x \\le m` and :math:`n+m-N \\le x \\le n`\n\n for P(x) the probability of x successes, n = ngood, m = nbad, and\n N = number of samples.\n\n Consider an urn with black and white marbles in it, ngood of them\n black and nbad are white. If you draw nsample balls without\n replacement, then the Hypergeometric distribution describes the\n distribution of black balls in the drawn sample.\n\n Note that this distribution is very similar to the Binomial\n distribution, except that in this case, samples are drawn without\n replacement, whereas in the Binomial case samples are drawn wit""h\n replacement (or the sample space is infinite). As the sample space\n becomes large, this distribution approaches the Binomial.\n\n References\n ----------\n .. [1] Lentner, Marvin, \"Elementary Applied Statistics\", Bogden\n and Quigley, 1972.\n .. [2] Weisstein, Eric W. \"Hypergeometric Distribution.\" From\n MathWorld--A Wolfram Web Resource.\n http://mathworld.wolfram.com/HypergeometricDistribution.html\n .. [3] Wikipedia, \"Hypergeometric-distribution\",\n http://en.wikipedia.org/wiki/Hypergeometric-distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> ngood, nbad, nsamp = 100, 2, 10\n # number of good, number of bad, and number of samples\n >>> s = np.random.hypergeometric(ngood, nbad, nsamp, 1000)\n >>> hist(s)\n # note that it is very unlikely to grab both bad items\n\n Suppose you have an urn with 15 white and 15 black marbles.\n If you pull 15 marbles at random, how likely is it that\n 12 or more of them are one color?\n\n >>> s = np.random.hypergeometric(15, 15, 15, 100000)\n >>> sum(s>=12)/100000. + sum(s<=3)/100000.\n # answer = 0.003 ... pretty unlikely!\n\n ";
+static char __pyx_k_245[] = "RandomState.logseries (line 3788)";
+static char __pyx_k_246[] = "\n logseries(p, size=None)\n\n Draw samples from a Logarithmic Series distribution.\n\n Samples are drawn from a Log Series distribution with specified\n parameter, p (probability, 0 < p < 1).\n\n Parameters\n ----------\n loc : float\n\n scale : float > 0.\n\n size : {tuple, int}\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n samples : {ndarray, scalar}\n where the values are all integers in [0, n].\n\n See Also\n --------\n scipy.stats.distributions.logser : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the Log Series distribution is\n\n .. math:: P(k) = \\frac{-p^k}{k \\ln(1-p)},\n\n where p = probability.\n\n The Log Series distribution is frequently used to represent species\n richness and occurrence, first proposed by Fisher, Corbet, and\n Williams in 1943 [2]. It may also be used to model the numbers of\n occupants seen in cars [3].\n\n References\n ----------\n .. [1] Buzas, Martin A.; Culver, Stephen J., Understanding regional\n species diversity through the log series distribution of\n occurrences: BIODIVERSITY RESEARCH Diversity & Distributions,\n Volume 5, Number 5, September 1999 , pp. 187-195(9).\n .. [2] Fisher, R.A,, A.S. Corbet, and C.B. Williams. 1943. The\n relation between the number of species and the number of\n individuals in a random sample of an animal population.\n Journal of Animal Ecology, 12:42-58.\n .. [3] D. J. Hand, F. Daly, D. Lunn, E. Ostrowski, A Handbook of Small\n Data Sets, CRC Press, 1994.\n .. [4] Wikipedia, \"Log""arithmic-distribution\",\n http://en.wikipedia.org/wiki/Logarithmic-distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> a = .6\n >>> s = np.random.logseries(a, 10000)\n >>> count, bins, ignored = plt.hist(s)\n\n # plot against distribution\n\n >>> def logseries(k, p):\n ... return -p**k/(k*log(1-p))\n >>> plt.plot(bins, logseries(bins, a)*count.max()/\n logseries(bins, a).max(), 'r')\n >>> plt.show()\n\n ";
+static char __pyx_k_247[] = "RandomState.multivariate_normal (line 3883)";
+static char __pyx_k_248[] = "\n multivariate_normal(mean, cov[, size])\n\n Draw random samples from a multivariate normal distribution.\n\n The multivariate normal, multinormal or Gaussian distribution is a\n generalization of the one-dimensional normal distribution to higher\n dimensions. Such a distribution is specified by its mean and\n covariance matrix. These parameters are analogous to the mean\n (average or \"center\") and variance (standard deviation, or \"width,\"\n squared) of the one-dimensional normal distribution.\n\n Parameters\n ----------\n mean : 1-D array_like, of length N\n Mean of the N-dimensional distribution.\n cov : 2-D array_like, of shape (N, N)\n Covariance matrix of the distribution. Must be symmetric and\n positive semi-definite for \"physically meaningful\" results.\n size : tuple of ints, optional\n Given a shape of, for example, ``(m,n,k)``, ``m*n*k`` samples are\n generated, and packed in an `m`-by-`n`-by-`k` arrangement. Because\n each sample is `N`-dimensional, the output shape is ``(m,n,k,N)``.\n If no shape is specified, a single (`N`-D) sample is returned.\n\n Returns\n -------\n out : ndarray\n The drawn samples, of shape *size*, if that was provided. If not,\n the shape is ``(N,)``.\n\n In other words, each entry ``out[i,j,...,:]`` is an N-dimensional\n value drawn from the distribution.\n\n Notes\n -----\n The mean is a coordinate in N-dimensional space, which represents the\n location where samples are most likely to be generated. This is\n analogous to the peak of the bell curve for the one-dimensional or\n univariate normal distribution.\n\n Covariance indicates the level to which two variables vary together.\n From the multivariate normal distribution, we draw ""N-dimensional\n samples, :math:`X = [x_1, x_2, ... x_N]`. The covariance matrix\n element :math:`C_{ij}` is the covariance of :math:`x_i` and :math:`x_j`.\n The element :math:`C_{ii}` is the variance of :math:`x_i` (i.e. its\n \"spread\").\n\n Instead of specifying the full covariance matrix, popular\n approximations include:\n\n - Spherical covariance (*cov* is a multiple of the identity matrix)\n - Diagonal covariance (*cov* has non-negative elements, and only on\n the diagonal)\n\n This geometrical property can be seen in two dimensions by plotting\n generated data-points:\n\n >>> mean = [0,0]\n >>> cov = [[1,0],[0,100]] # diagonal covariance, points lie on x or y-axis\n\n >>> import matplotlib.pyplot as plt\n >>> x,y = np.random.multivariate_normal(mean,cov,5000).T\n >>> plt.plot(x,y,'x'); plt.axis('equal'); plt.show()\n\n Note that the covariance matrix must be non-negative definite.\n\n References\n ----------\n Papoulis, A., *Probability, Random Variables, and Stochastic Processes*,\n 3rd ed., New York: McGraw-Hill, 1991.\n\n Duda, R. O., Hart, P. E., and Stork, D. G., *Pattern Classification*,\n 2nd ed., New York: Wiley, 2001.\n\n Examples\n --------\n >>> mean = (1,2)\n >>> cov = [[1,0],[1,0]]\n >>> x = np.random.multivariate_normal(mean,cov,(3,3))\n >>> x.shape\n (3, 3, 2)\n\n The following is probably true, given that 0.6 is roughly twice the\n standard deviation:\n\n >>> print list( (x[0,0,:] - mean) < 0.6 )\n [True, True]\n\n ";
+static char __pyx_k_249[] = "RandomState.multinomial (line 4015)";
+static char __pyx_k_250[] = "\n multinomial(n, pvals, size=None)\n\n Draw samples from a multinomial distribution.\n\n The multinomial distribution is a multivariate generalisation of the\n binomial distribution. Take an experiment with one of ``p``\n possible outcomes. An example of such an experiment is throwing a dice,\n where the outcome can be 1 through 6. Each sample drawn from the\n distribution represents `n` such experiments. Its values,\n ``X_i = [X_0, X_1, ..., X_p]``, represent the number of times the outcome\n was ``i``.\n\n Parameters\n ----------\n n : int\n Number of experiments.\n pvals : sequence of floats, length p\n Probabilities of each of the ``p`` different outcomes. These\n should sum to 1 (however, the last element is always assumed to\n account for the remaining probability, as long as\n ``sum(pvals[:-1]) <= 1)``.\n size : tuple of ints\n Given a `size` of ``(M, N, K)``, then ``M*N*K`` samples are drawn,\n and the output shape becomes ``(M, N, K, p)``, since each sample\n has shape ``(p,)``.\n\n Examples\n --------\n Throw a dice 20 times:\n\n >>> np.random.multinomial(20, [1/6.]*6, size=1)\n array([[4, 1, 7, 5, 2, 1]])\n\n It landed 4 times on 1, once on 2, etc.\n\n Now, throw the dice 20 times, and 20 times again:\n\n >>> np.random.multinomial(20, [1/6.]*6, size=2)\n array([[3, 4, 3, 3, 4, 3],\n [2, 4, 3, 4, 0, 7]])\n\n For the first run, we threw 3 times 1, 4 times 2, etc. For the second,\n we threw 2 times 1, 4 times 2, etc.\n\n A loaded dice is more likely to land on number 6:\n\n >>> np.random.multinomial(100, [1/7.]*5)\n array([13, 16, 13, 16, 42])\n\n ";
+static char __pyx_k_251[] = "RandomState.dirichlet (line 4108)";
+static char __pyx_k_252[] = "\n dirichlet(alpha, size=None)\n\n Draw samples from the Dirichlet distribution.\n\n Draw `size` samples of dimension k from a Dirichlet distribution. A\n Dirichlet-distributed random variable can be seen as a multivariate\n generalization of a Beta distribution. Dirichlet pdf is the conjugate\n prior of a multinomial in Bayesian inference.\n\n Parameters\n ----------\n alpha : array\n Parameter of the distribution (k dimension for sample of\n dimension k).\n size : array\n Number of samples to draw.\n\n Returns\n -------\n samples : ndarray,\n The drawn samples, of shape (alpha.ndim, size).\n\n Notes\n -----\n .. math:: X \\approx \\prod_{i=1}^{k}{x^{\\alpha_i-1}_i}\n\n Uses the following property for computation: for each dimension,\n draw a random sample y_i from a standard gamma generator of shape\n `alpha_i`, then\n :math:`X = \\frac{1}{\\sum_{i=1}^k{y_i}} (y_1, \\ldots, y_n)` is\n Dirichlet distributed.\n\n References\n ----------\n .. [1] David McKay, \"Information Theory, Inference and Learning\n Algorithms,\" chapter 23,\n http://www.inference.phy.cam.ac.uk/mackay/\n .. [2] Wikipedia, \"Dirichlet distribution\",\n http://en.wikipedia.org/wiki/Dirichlet_distribution\n\n Examples\n --------\n Taking an example cited in Wikipedia, this distribution can be used if\n one wanted to cut strings (each of initial length 1.0) into K pieces\n with different lengths, where each piece had, on average, a designated\n average length, but allowing some variation in the relative sizes of the\n pieces.\n\n >>> s = np.random.dirichlet((10, 5, 3), 20).transpose()\n\n >>> plt.barh(range(20), s[0])\n >>> plt.barh(range(20), s[1], left=s[0], color='g')""\n >>> plt.barh(range(20), s[2], left=s[0]+s[1], color='r')\n >>> plt.title(\"Lengths of Strings\")\n\n ";
+static char __pyx_k_253[] = "RandomState.shuffle (line 4224)";
+static char __pyx_k_254[] = "\n shuffle(x)\n\n Modify a sequence in-place by shuffling its contents.\n\n Parameters\n ----------\n x : array_like\n The array or list to be shuffled.\n\n Returns\n -------\n None\n\n Examples\n --------\n >>> arr = np.arange(10)\n >>> np.random.shuffle(arr)\n >>> arr\n [1 7 5 2 9 4 3 6 0 8]\n\n This function only shuffles the array along the first index of a\n multi-dimensional array:\n\n >>> arr = np.arange(9).reshape((3, 3))\n >>> np.random.shuffle(arr)\n >>> arr\n array([[3, 4, 5],\n [6, 7, 8],\n [0, 1, 2]])\n\n ";
+static char __pyx_k_255[] = "RandomState.permutation (line 4286)";
+static char __pyx_k_256[] = "\n permutation(x)\n\n Randomly permute a sequence, or return a permuted range.\n\n If `x` is a multi-dimensional array, it is only shuffled along its\n first index.\n\n Parameters\n ----------\n x : int or array_like\n If `x` is an integer, randomly permute ``np.arange(x)``.\n If `x` is an array, make a copy and shuffle the elements\n randomly.\n\n Returns\n -------\n out : ndarray\n Permuted sequence or array range.\n\n Examples\n --------\n >>> np.random.permutation(10)\n array([1, 7, 4, 3, 0, 9, 2, 5, 8, 6])\n\n >>> np.random.permutation([1, 4, 9, 12, 15])\n array([15, 1, 9, 4, 12])\n\n >>> arr = np.arange(9).reshape((3, 3))\n >>> np.random.permutation(arr)\n array([[6, 7, 8],\n [0, 1, 2],\n [3, 4, 5]])\n\n ";
static char __pyx_k__df[] = "df";
static char __pyx_k__mu[] = "mu";
static char __pyx_k__nd[] = "nd";
@@ -694,6 +742,7 @@ static char __pyx_k__key[] = "key";
static char __pyx_k__lam[] = "lam";
static char __pyx_k__loc[] = "loc";
static char __pyx_k__low[] = "low";
+static char __pyx_k__max[] = "max";
static char __pyx_k__pos[] = "pos";
static char __pyx_k__svd[] = "svd";
static char __pyx_k__beta[] = "beta";
@@ -723,6 +772,7 @@ static char __pyx_k__empty[] = "empty";
static char __pyx_k__equal[] = "equal";
static char __pyx_k__gamma[] = "gamma";
static char __pyx_k__gauss[] = "gauss";
+static char __pyx_k__iinfo[] = "iinfo";
static char __pyx_k__kappa[] = "kappa";
static char __pyx_k__ngood[] = "ngood";
static char __pyx_k__numpy[] = "numpy";
@@ -734,6 +784,7 @@ static char __pyx_k__scale[] = "scale";
static char __pyx_k__shape[] = "shape";
static char __pyx_k__sigma[] = "sigma";
static char __pyx_k__zeros[] = "zeros";
+static char __pyx_k__append[] = "append";
static char __pyx_k__arange[] = "arange";
static char __pyx_k__gumbel[] = "gumbel";
static char __pyx_k__normal[] = "normal";
@@ -761,7 +812,6 @@ static char __pyx_k__logistic[] = "logistic";
static char __pyx_k__multiply[] = "multiply";
static char __pyx_k__rayleigh[] = "rayleigh";
static char __pyx_k__subtract[] = "subtract";
-static char __pyx_k__tomaxint[] = "tomaxint";
static char __pyx_k__vonmises[] = "vonmises";
static char __pyx_k__TypeError[] = "TypeError";
static char __pyx_k__chisquare[] = "chisquare";
@@ -777,7 +827,6 @@ static char __pyx_k__dimensions[] = "dimensions";
static char __pyx_k__less_equal[] = "less_equal";
static char __pyx_k__standard_t[] = "standard_t";
static char __pyx_k__triangular[] = "triangular";
-static char __pyx_k__RandomState[] = "RandomState";
static char __pyx_k__exponential[] = "exponential";
static char __pyx_k__multinomial[] = "multinomial";
static char __pyx_k__permutation[] = "permutation";
@@ -787,6 +836,7 @@ static char __pyx_k__random_sample[] = "random_sample";
static char __pyx_k__hypergeometric[] = "hypergeometric";
static char __pyx_k__internal_state[] = "internal_state";
static char __pyx_k__standard_gamma[] = "standard_gamma";
+static char __pyx_k__poisson_lam_max[] = "poisson_lam_max";
static char __pyx_k__random_integers[] = "random_integers";
static char __pyx_k__standard_cauchy[] = "standard_cauchy";
static char __pyx_k__standard_normal[] = "standard_normal";
@@ -794,98 +844,136 @@ static char __pyx_k__negative_binomial[] = "negative_binomial";
static char __pyx_k____RandomState_ctor[] = "__RandomState_ctor";
static char __pyx_k__multivariate_normal[] = "multivariate_normal";
static PyObject *__pyx_kp_s_1;
-static PyObject *__pyx_kp_s_10;
-static PyObject *__pyx_kp_u_100;
-static PyObject *__pyx_kp_u_101;
-static PyObject *__pyx_kp_u_102;
-static PyObject *__pyx_kp_u_103;
-static PyObject *__pyx_kp_u_104;
-static PyObject *__pyx_kp_u_105;
-static PyObject *__pyx_kp_u_106;
-static PyObject *__pyx_kp_u_107;
+static PyObject *__pyx_kp_s_101;
+static PyObject *__pyx_kp_s_103;
+static PyObject *__pyx_kp_s_105;
static PyObject *__pyx_kp_s_11;
+static PyObject *__pyx_kp_s_110;
+static PyObject *__pyx_kp_s_112;
+static PyObject *__pyx_kp_s_114;
+static PyObject *__pyx_kp_s_126;
+static PyObject *__pyx_kp_s_128;
static PyObject *__pyx_kp_s_13;
-static PyObject *__pyx_kp_s_15;
-static PyObject *__pyx_kp_s_16;
-static PyObject *__pyx_kp_s_17;
-static PyObject *__pyx_kp_s_18;
+static PyObject *__pyx_kp_s_131;
+static PyObject *__pyx_kp_s_133;
+static PyObject *__pyx_kp_s_136;
+static PyObject *__pyx_kp_s_138;
+static PyObject *__pyx_kp_s_142;
+static PyObject *__pyx_kp_s_144;
+static PyObject *__pyx_kp_s_146;
+static PyObject *__pyx_kp_s_148;
+static PyObject *__pyx_kp_s_154;
+static PyObject *__pyx_kp_s_156;
+static PyObject *__pyx_kp_s_160;
+static PyObject *__pyx_kp_s_162;
+static PyObject *__pyx_kp_s_164;
+static PyObject *__pyx_n_s_166;
+static PyObject *__pyx_kp_s_167;
+static PyObject *__pyx_n_s_171;
+static PyObject *__pyx_n_s_172;
+static PyObject *__pyx_kp_u_173;
+static PyObject *__pyx_kp_u_174;
+static PyObject *__pyx_kp_u_175;
+static PyObject *__pyx_kp_u_176;
+static PyObject *__pyx_kp_u_177;
+static PyObject *__pyx_kp_u_178;
+static PyObject *__pyx_kp_u_179;
+static PyObject *__pyx_kp_u_180;
+static PyObject *__pyx_kp_u_181;
+static PyObject *__pyx_kp_u_182;
+static PyObject *__pyx_kp_u_183;
+static PyObject *__pyx_kp_u_184;
+static PyObject *__pyx_kp_u_185;
+static PyObject *__pyx_kp_u_186;
+static PyObject *__pyx_kp_u_187;
+static PyObject *__pyx_kp_u_188;
+static PyObject *__pyx_kp_u_189;
static PyObject *__pyx_kp_s_19;
-static PyObject *__pyx_kp_s_2;
-static PyObject *__pyx_kp_s_20;
-static PyObject *__pyx_kp_s_21;
+static PyObject *__pyx_kp_u_190;
+static PyObject *__pyx_kp_u_191;
+static PyObject *__pyx_kp_u_192;
+static PyObject *__pyx_kp_u_193;
+static PyObject *__pyx_kp_u_194;
+static PyObject *__pyx_kp_u_195;
+static PyObject *__pyx_kp_u_196;
+static PyObject *__pyx_kp_u_197;
+static PyObject *__pyx_kp_u_198;
+static PyObject *__pyx_kp_u_199;
+static PyObject *__pyx_kp_u_200;
+static PyObject *__pyx_kp_u_201;
+static PyObject *__pyx_kp_u_202;
+static PyObject *__pyx_kp_u_203;
+static PyObject *__pyx_kp_u_204;
+static PyObject *__pyx_kp_u_205;
+static PyObject *__pyx_kp_u_206;
+static PyObject *__pyx_kp_u_207;
+static PyObject *__pyx_kp_u_208;
+static PyObject *__pyx_kp_u_209;
+static PyObject *__pyx_kp_u_210;
+static PyObject *__pyx_kp_u_211;
+static PyObject *__pyx_kp_u_212;
+static PyObject *__pyx_kp_u_213;
+static PyObject *__pyx_kp_u_214;
+static PyObject *__pyx_kp_u_215;
+static PyObject *__pyx_kp_u_216;
+static PyObject *__pyx_kp_u_217;
+static PyObject *__pyx_kp_u_218;
+static PyObject *__pyx_kp_u_219;
static PyObject *__pyx_kp_s_22;
-static PyObject *__pyx_kp_s_3;
+static PyObject *__pyx_kp_u_220;
+static PyObject *__pyx_kp_u_221;
+static PyObject *__pyx_kp_u_222;
+static PyObject *__pyx_kp_u_223;
+static PyObject *__pyx_kp_u_224;
+static PyObject *__pyx_kp_u_225;
+static PyObject *__pyx_kp_u_226;
+static PyObject *__pyx_kp_u_227;
+static PyObject *__pyx_kp_u_228;
+static PyObject *__pyx_kp_u_229;
+static PyObject *__pyx_kp_u_230;
+static PyObject *__pyx_kp_u_231;
+static PyObject *__pyx_kp_u_232;
+static PyObject *__pyx_kp_u_233;
+static PyObject *__pyx_kp_u_234;
+static PyObject *__pyx_kp_u_235;
+static PyObject *__pyx_kp_u_236;
+static PyObject *__pyx_kp_u_237;
+static PyObject *__pyx_kp_u_238;
+static PyObject *__pyx_kp_u_239;
+static PyObject *__pyx_kp_s_24;
+static PyObject *__pyx_kp_u_240;
+static PyObject *__pyx_kp_u_241;
+static PyObject *__pyx_kp_u_242;
+static PyObject *__pyx_kp_u_243;
+static PyObject *__pyx_kp_u_244;
+static PyObject *__pyx_kp_u_245;
+static PyObject *__pyx_kp_u_246;
+static PyObject *__pyx_kp_u_247;
+static PyObject *__pyx_kp_u_248;
+static PyObject *__pyx_kp_u_249;
+static PyObject *__pyx_kp_u_250;
+static PyObject *__pyx_kp_u_251;
+static PyObject *__pyx_kp_u_252;
+static PyObject *__pyx_kp_u_253;
+static PyObject *__pyx_kp_u_254;
+static PyObject *__pyx_kp_u_255;
+static PyObject *__pyx_kp_u_256;
static PyObject *__pyx_kp_s_31;
-static PyObject *__pyx_kp_s_32;
-static PyObject *__pyx_kp_s_34;
-static PyObject *__pyx_kp_s_35;
-static PyObject *__pyx_kp_s_36;
-static PyObject *__pyx_kp_s_37;
-static PyObject *__pyx_kp_s_38;
-static PyObject *__pyx_kp_s_39;
-static PyObject *__pyx_kp_s_4;
-static PyObject *__pyx_kp_s_40;
static PyObject *__pyx_kp_s_41;
-static PyObject *__pyx_kp_s_42;
-static PyObject *__pyx_kp_s_44;
+static PyObject *__pyx_kp_s_43;
static PyObject *__pyx_kp_s_45;
-static PyObject *__pyx_kp_s_46;
-static PyObject *__pyx_kp_s_47;
static PyObject *__pyx_kp_s_48;
-static PyObject *__pyx_kp_s_49;
-static PyObject *__pyx_kp_s_50;
-static PyObject *__pyx_kp_s_51;
-static PyObject *__pyx_kp_s_52;
static PyObject *__pyx_kp_s_53;
-static PyObject *__pyx_kp_s_54;
-static PyObject *__pyx_kp_s_55;
-static PyObject *__pyx_kp_s_56;
-static PyObject *__pyx_n_s_57;
-static PyObject *__pyx_kp_s_58;
-static PyObject *__pyx_n_s_59;
-static PyObject *__pyx_n_s_60;
-static PyObject *__pyx_kp_u_61;
-static PyObject *__pyx_kp_u_62;
-static PyObject *__pyx_kp_u_63;
-static PyObject *__pyx_kp_u_64;
-static PyObject *__pyx_kp_u_65;
-static PyObject *__pyx_kp_u_66;
-static PyObject *__pyx_kp_u_67;
-static PyObject *__pyx_kp_u_68;
-static PyObject *__pyx_kp_u_69;
-static PyObject *__pyx_kp_u_70;
-static PyObject *__pyx_kp_u_71;
-static PyObject *__pyx_kp_u_72;
-static PyObject *__pyx_kp_u_73;
-static PyObject *__pyx_kp_u_74;
-static PyObject *__pyx_kp_u_75;
-static PyObject *__pyx_kp_u_76;
-static PyObject *__pyx_kp_u_77;
-static PyObject *__pyx_kp_u_78;
-static PyObject *__pyx_kp_u_79;
-static PyObject *__pyx_kp_u_80;
-static PyObject *__pyx_kp_u_81;
-static PyObject *__pyx_kp_u_82;
-static PyObject *__pyx_kp_u_83;
-static PyObject *__pyx_kp_u_84;
-static PyObject *__pyx_kp_u_85;
-static PyObject *__pyx_kp_u_86;
-static PyObject *__pyx_kp_u_87;
-static PyObject *__pyx_kp_u_88;
-static PyObject *__pyx_kp_u_89;
+static PyObject *__pyx_kp_s_57;
+static PyObject *__pyx_kp_s_59;
+static PyObject *__pyx_kp_s_64;
+static PyObject *__pyx_kp_s_87;
+static PyObject *__pyx_kp_s_89;
static PyObject *__pyx_kp_s_9;
-static PyObject *__pyx_kp_u_90;
-static PyObject *__pyx_kp_u_91;
-static PyObject *__pyx_kp_u_92;
-static PyObject *__pyx_kp_u_93;
-static PyObject *__pyx_kp_u_94;
-static PyObject *__pyx_kp_u_95;
-static PyObject *__pyx_kp_u_96;
-static PyObject *__pyx_kp_u_97;
-static PyObject *__pyx_kp_u_98;
-static PyObject *__pyx_kp_u_99;
+static PyObject *__pyx_kp_s_93;
+static PyObject *__pyx_kp_s_95;
+static PyObject *__pyx_kp_s_98;
static PyObject *__pyx_n_s__MT19937;
-static PyObject *__pyx_n_s__RandomState;
static PyObject *__pyx_n_s__TypeError;
static PyObject *__pyx_n_s__ValueError;
static PyObject *__pyx_n_s____RandomState_ctor;
@@ -896,6 +984,7 @@ static PyObject *__pyx_n_s__a;
static PyObject *__pyx_n_s__add;
static PyObject *__pyx_n_s__alpha;
static PyObject *__pyx_n_s__any;
+static PyObject *__pyx_n_s__append;
static PyObject *__pyx_n_s__arange;
static PyObject *__pyx_n_s__array;
static PyObject *__pyx_n_s__asarray;
@@ -929,10 +1018,12 @@ static PyObject *__pyx_n_s__gumbel;
static PyObject *__pyx_n_s__has_gauss;
static PyObject *__pyx_n_s__high;
static PyObject *__pyx_n_s__hypergeometric;
+static PyObject *__pyx_n_s__iinfo;
static PyObject *__pyx_n_s__integer;
static PyObject *__pyx_n_s__internal_state;
static PyObject *__pyx_n_s__kappa;
static PyObject *__pyx_n_s__key;
+static PyObject *__pyx_n_s__l;
static PyObject *__pyx_n_s__lam;
static PyObject *__pyx_n_s__laplace;
static PyObject *__pyx_n_s__left;
@@ -943,6 +1034,7 @@ static PyObject *__pyx_n_s__logistic;
static PyObject *__pyx_n_s__lognormal;
static PyObject *__pyx_n_s__logseries;
static PyObject *__pyx_n_s__low;
+static PyObject *__pyx_n_s__max;
static PyObject *__pyx_n_s__mean;
static PyObject *__pyx_n_s__mode;
static PyObject *__pyx_n_s__mu;
@@ -964,6 +1056,7 @@ static PyObject *__pyx_n_s__p;
static PyObject *__pyx_n_s__pareto;
static PyObject *__pyx_n_s__permutation;
static PyObject *__pyx_n_s__poisson;
+static PyObject *__pyx_n_s__poisson_lam_max;
static PyObject *__pyx_n_s__pos;
static PyObject *__pyx_n_s__power;
static PyObject *__pyx_n_s__pvals;
@@ -990,7 +1083,6 @@ static PyObject *__pyx_n_s__standard_normal;
static PyObject *__pyx_n_s__standard_t;
static PyObject *__pyx_n_s__subtract;
static PyObject *__pyx_n_s__svd;
-static PyObject *__pyx_n_s__tomaxint;
static PyObject *__pyx_n_s__triangular;
static PyObject *__pyx_n_s__uint;
static PyObject *__pyx_n_s__uint32;
@@ -1002,23 +1094,134 @@ static PyObject *__pyx_n_s__zeros;
static PyObject *__pyx_n_s__zipf;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
+static PyObject *__pyx_int_10;
static PyObject *__pyx_int_624;
-static PyObject *__pyx_k_5;
-static PyObject *__pyx_k_6;
-static PyObject *__pyx_k_7;
-static PyObject *__pyx_k_8;
-static PyObject *__pyx_k_12;
-static PyObject *__pyx_k_14;
-static PyObject *__pyx_k_23;
-static PyObject *__pyx_k_24;
-static PyObject *__pyx_k_25;
-static PyObject *__pyx_k_26;
-static PyObject *__pyx_k_27;
+static PyObject *__pyx_k_15;
+static PyObject *__pyx_k_16;
+static PyObject *__pyx_k_17;
+static PyObject *__pyx_k_18;
static PyObject *__pyx_k_28;
-static PyObject *__pyx_k_29;
-static PyObject *__pyx_k_30;
-static PyObject *__pyx_k_33;
-static PyObject *__pyx_k_43;
+static PyObject *__pyx_k_34;
+static PyObject *__pyx_k_73;
+static PyObject *__pyx_k_74;
+static PyObject *__pyx_k_77;
+static PyObject *__pyx_k_78;
+static PyObject *__pyx_k_81;
+static PyObject *__pyx_k_82;
+static PyObject *__pyx_k_85;
+static PyObject *__pyx_k_86;
+static PyObject *__pyx_k_91;
+static PyObject *__pyx_k_125;
+static PyObject *__pyx_k_tuple_2;
+static PyObject *__pyx_k_tuple_3;
+static PyObject *__pyx_k_tuple_4;
+static PyObject *__pyx_k_tuple_5;
+static PyObject *__pyx_k_tuple_6;
+static PyObject *__pyx_k_tuple_7;
+static PyObject *__pyx_k_tuple_8;
+static PyObject *__pyx_k_tuple_10;
+static PyObject *__pyx_k_tuple_12;
+static PyObject *__pyx_k_tuple_14;
+static PyObject *__pyx_k_tuple_20;
+static PyObject *__pyx_k_tuple_21;
+static PyObject *__pyx_k_tuple_23;
+static PyObject *__pyx_k_tuple_25;
+static PyObject *__pyx_k_tuple_26;
+static PyObject *__pyx_k_tuple_27;
+static PyObject *__pyx_k_tuple_29;
+static PyObject *__pyx_k_tuple_30;
+static PyObject *__pyx_k_tuple_32;
+static PyObject *__pyx_k_tuple_33;
+static PyObject *__pyx_k_tuple_35;
+static PyObject *__pyx_k_tuple_36;
+static PyObject *__pyx_k_tuple_37;
+static PyObject *__pyx_k_tuple_38;
+static PyObject *__pyx_k_tuple_39;
+static PyObject *__pyx_k_tuple_40;
+static PyObject *__pyx_k_tuple_42;
+static PyObject *__pyx_k_tuple_44;
+static PyObject *__pyx_k_tuple_46;
+static PyObject *__pyx_k_tuple_47;
+static PyObject *__pyx_k_tuple_49;
+static PyObject *__pyx_k_tuple_50;
+static PyObject *__pyx_k_tuple_51;
+static PyObject *__pyx_k_tuple_52;
+static PyObject *__pyx_k_tuple_54;
+static PyObject *__pyx_k_tuple_55;
+static PyObject *__pyx_k_tuple_56;
+static PyObject *__pyx_k_tuple_58;
+static PyObject *__pyx_k_tuple_60;
+static PyObject *__pyx_k_tuple_61;
+static PyObject *__pyx_k_tuple_62;
+static PyObject *__pyx_k_tuple_63;
+static PyObject *__pyx_k_tuple_65;
+static PyObject *__pyx_k_tuple_66;
+static PyObject *__pyx_k_tuple_67;
+static PyObject *__pyx_k_tuple_68;
+static PyObject *__pyx_k_tuple_69;
+static PyObject *__pyx_k_tuple_70;
+static PyObject *__pyx_k_tuple_71;
+static PyObject *__pyx_k_tuple_72;
+static PyObject *__pyx_k_tuple_75;
+static PyObject *__pyx_k_tuple_76;
+static PyObject *__pyx_k_tuple_79;
+static PyObject *__pyx_k_tuple_80;
+static PyObject *__pyx_k_tuple_83;
+static PyObject *__pyx_k_tuple_84;
+static PyObject *__pyx_k_tuple_88;
+static PyObject *__pyx_k_tuple_90;
+static PyObject *__pyx_k_tuple_92;
+static PyObject *__pyx_k_tuple_94;
+static PyObject *__pyx_k_tuple_96;
+static PyObject *__pyx_k_tuple_97;
+static PyObject *__pyx_k_tuple_99;
+static PyObject *__pyx_k_tuple_100;
+static PyObject *__pyx_k_tuple_102;
+static PyObject *__pyx_k_tuple_104;
+static PyObject *__pyx_k_tuple_106;
+static PyObject *__pyx_k_tuple_107;
+static PyObject *__pyx_k_tuple_108;
+static PyObject *__pyx_k_tuple_109;
+static PyObject *__pyx_k_tuple_111;
+static PyObject *__pyx_k_tuple_113;
+static PyObject *__pyx_k_tuple_115;
+static PyObject *__pyx_k_tuple_116;
+static PyObject *__pyx_k_tuple_117;
+static PyObject *__pyx_k_tuple_118;
+static PyObject *__pyx_k_tuple_119;
+static PyObject *__pyx_k_tuple_120;
+static PyObject *__pyx_k_tuple_121;
+static PyObject *__pyx_k_tuple_122;
+static PyObject *__pyx_k_tuple_123;
+static PyObject *__pyx_k_tuple_124;
+static PyObject *__pyx_k_tuple_127;
+static PyObject *__pyx_k_tuple_129;
+static PyObject *__pyx_k_tuple_130;
+static PyObject *__pyx_k_tuple_132;
+static PyObject *__pyx_k_tuple_134;
+static PyObject *__pyx_k_tuple_135;
+static PyObject *__pyx_k_tuple_137;
+static PyObject *__pyx_k_tuple_139;
+static PyObject *__pyx_k_tuple_140;
+static PyObject *__pyx_k_tuple_141;
+static PyObject *__pyx_k_tuple_143;
+static PyObject *__pyx_k_tuple_145;
+static PyObject *__pyx_k_tuple_147;
+static PyObject *__pyx_k_tuple_149;
+static PyObject *__pyx_k_tuple_150;
+static PyObject *__pyx_k_tuple_151;
+static PyObject *__pyx_k_tuple_152;
+static PyObject *__pyx_k_tuple_153;
+static PyObject *__pyx_k_tuple_155;
+static PyObject *__pyx_k_tuple_157;
+static PyObject *__pyx_k_tuple_158;
+static PyObject *__pyx_k_tuple_159;
+static PyObject *__pyx_k_tuple_161;
+static PyObject *__pyx_k_tuple_163;
+static PyObject *__pyx_k_tuple_165;
+static PyObject *__pyx_k_tuple_168;
+static PyObject *__pyx_k_tuple_169;
+static PyObject *__pyx_k_tuple_170;
/* "mtrand.pyx":128
* import numpy as np
@@ -1040,7 +1243,6 @@ static PyObject *__pyx_f_6mtrand_cont0_array(rk_state *__pyx_v_state, __pyx_t_6
PyObject *__pyx_t_4 = NULL;
long __pyx_t_5;
__Pyx_RefNannySetupContext("cont0_array");
- __Pyx_INCREF(__pyx_v_size);
arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
/* "mtrand.pyx":134
@@ -1088,17 +1290,17 @@ static PyObject *__pyx_f_6mtrand_cont0_array(rk_state *__pyx_v_state, __pyx_t_6
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_size);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size);
__Pyx_GIVEREF(__pyx_v_size);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_4)));
__Pyx_DECREF(((PyObject *)arrayObject));
arrayObject = ((PyArrayObject *)__pyx_t_4);
@@ -1166,7 +1368,6 @@ static PyObject *__pyx_f_6mtrand_cont0_array(rk_state *__pyx_v_state, __pyx_t_6
__pyx_r = 0;
__pyx_L0:;
__Pyx_DECREF((PyObject *)arrayObject);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
@@ -1192,7 +1393,6 @@ static PyObject *__pyx_f_6mtrand_cont1_array_sc(rk_state *__pyx_v_state, __pyx_
PyObject *__pyx_t_4 = NULL;
long __pyx_t_5;
__Pyx_RefNannySetupContext("cont1_array_sc");
- __Pyx_INCREF(__pyx_v_size);
arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
/* "mtrand.pyx":151
@@ -1240,17 +1440,17 @@ static PyObject *__pyx_f_6mtrand_cont1_array_sc(rk_state *__pyx_v_state, __pyx_
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_size);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size);
__Pyx_GIVEREF(__pyx_v_size);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_4)));
__Pyx_DECREF(((PyObject *)arrayObject));
arrayObject = ((PyArrayObject *)__pyx_t_4);
@@ -1318,7 +1518,6 @@ static PyObject *__pyx_f_6mtrand_cont1_array_sc(rk_state *__pyx_v_state, __pyx_
__pyx_r = 0;
__pyx_L0:;
__Pyx_DECREF((PyObject *)arrayObject);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
@@ -1347,8 +1546,6 @@ static PyObject *__pyx_f_6mtrand_cont1_array(rk_state *__pyx_v_state, __pyx_t_6
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
__Pyx_RefNannySetupContext("cont1_array");
- __Pyx_INCREF(__pyx_v_size);
- __Pyx_INCREF((PyObject *)__pyx_v_oa);
arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_itera = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); __Pyx_INCREF(Py_None);
@@ -1459,17 +1656,17 @@ static PyObject *__pyx_f_6mtrand_cont1_array(rk_state *__pyx_v_state, __pyx_t_6
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_size);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size);
__Pyx_GIVEREF(__pyx_v_size);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_5)));
__Pyx_DECREF(((PyObject *)arrayObject));
arrayObject = ((PyArrayObject *)__pyx_t_5);
@@ -1515,16 +1712,10 @@ static PyObject *__pyx_f_6mtrand_cont1_array(rk_state *__pyx_v_state, __pyx_t_6
* for i from 0 <= i < multi.size:
* oa_data = <double *>PyArray_MultiIter_DATA(multi, 1)
*/
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
- __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_5, 0, 0);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_Raise(__pyx_t_2, 0, 0);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L6;
}
@@ -1594,8 +1785,6 @@ static PyObject *__pyx_f_6mtrand_cont1_array(rk_state *__pyx_v_state, __pyx_t_6
__Pyx_DECREF((PyObject *)arrayObject);
__Pyx_DECREF((PyObject *)__pyx_v_itera);
__Pyx_DECREF((PyObject *)__pyx_v_multi);
- __Pyx_DECREF(__pyx_v_size);
- __Pyx_DECREF((PyObject *)__pyx_v_oa);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
@@ -1621,7 +1810,6 @@ static PyObject *__pyx_f_6mtrand_cont2_array_sc(rk_state *__pyx_v_state, __pyx_
PyObject *__pyx_t_4 = NULL;
long __pyx_t_5;
__Pyx_RefNannySetupContext("cont2_array_sc");
- __Pyx_INCREF(__pyx_v_size);
arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
/* "mtrand.pyx":198
@@ -1669,17 +1857,17 @@ static PyObject *__pyx_f_6mtrand_cont2_array_sc(rk_state *__pyx_v_state, __pyx_
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_size);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size);
__Pyx_GIVEREF(__pyx_v_size);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_4)));
__Pyx_DECREF(((PyObject *)arrayObject));
arrayObject = ((PyArrayObject *)__pyx_t_4);
@@ -1747,7 +1935,6 @@ static PyObject *__pyx_f_6mtrand_cont2_array_sc(rk_state *__pyx_v_state, __pyx_
__pyx_r = 0;
__pyx_L0:;
__Pyx_DECREF((PyObject *)arrayObject);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
@@ -1775,9 +1962,6 @@ static PyObject *__pyx_f_6mtrand_cont2_array(rk_state *__pyx_v_state, __pyx_t_6
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
__Pyx_RefNannySetupContext("cont2_array");
- __Pyx_INCREF(__pyx_v_size);
- __Pyx_INCREF((PyObject *)__pyx_v_oa);
- __Pyx_INCREF((PyObject *)__pyx_v_ob);
arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); __Pyx_INCREF(Py_None);
@@ -1896,17 +2080,17 @@ static PyObject *__pyx_f_6mtrand_cont2_array(rk_state *__pyx_v_state, __pyx_t_6
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_size);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size);
__Pyx_GIVEREF(__pyx_v_size);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_5)));
__Pyx_DECREF(((PyObject *)arrayObject));
arrayObject = ((PyArrayObject *)__pyx_t_5);
@@ -1952,16 +2136,10 @@ static PyObject *__pyx_f_6mtrand_cont2_array(rk_state *__pyx_v_state, __pyx_t_6
* for i from 0 <= i < multi.size:
* oa_data = <double *>PyArray_MultiIter_DATA(multi, 1)
*/
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
- __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_5, 0, 0);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_Raise(__pyx_t_2, 0, 0);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L6;
}
@@ -2048,9 +2226,6 @@ static PyObject *__pyx_f_6mtrand_cont2_array(rk_state *__pyx_v_state, __pyx_t_6
__pyx_L0:;
__Pyx_DECREF((PyObject *)arrayObject);
__Pyx_DECREF((PyObject *)__pyx_v_multi);
- __Pyx_DECREF(__pyx_v_size);
- __Pyx_DECREF((PyObject *)__pyx_v_oa);
- __Pyx_DECREF((PyObject *)__pyx_v_ob);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
@@ -2076,7 +2251,6 @@ static PyObject *__pyx_f_6mtrand_cont3_array_sc(rk_state *__pyx_v_state, __pyx_
PyObject *__pyx_t_4 = NULL;
long __pyx_t_5;
__Pyx_RefNannySetupContext("cont3_array_sc");
- __Pyx_INCREF(__pyx_v_size);
arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
/* "mtrand.pyx":250
@@ -2124,17 +2298,17 @@ static PyObject *__pyx_f_6mtrand_cont3_array_sc(rk_state *__pyx_v_state, __pyx_
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_size);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size);
__Pyx_GIVEREF(__pyx_v_size);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_4)));
__Pyx_DECREF(((PyObject *)arrayObject));
arrayObject = ((PyArrayObject *)__pyx_t_4);
@@ -2202,7 +2376,6 @@ static PyObject *__pyx_f_6mtrand_cont3_array_sc(rk_state *__pyx_v_state, __pyx_
__pyx_r = 0;
__pyx_L0:;
__Pyx_DECREF((PyObject *)arrayObject);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
@@ -2231,10 +2404,6 @@ static PyObject *__pyx_f_6mtrand_cont3_array(rk_state *__pyx_v_state, __pyx_t_6
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
__Pyx_RefNannySetupContext("cont3_array");
- __Pyx_INCREF(__pyx_v_size);
- __Pyx_INCREF((PyObject *)__pyx_v_oa);
- __Pyx_INCREF((PyObject *)__pyx_v_ob);
- __Pyx_INCREF((PyObject *)__pyx_v_oc);
arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); __Pyx_INCREF(Py_None);
@@ -2362,17 +2531,17 @@ static PyObject *__pyx_f_6mtrand_cont3_array(rk_state *__pyx_v_state, __pyx_t_6
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_size);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size);
__Pyx_GIVEREF(__pyx_v_size);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_5)));
__Pyx_DECREF(((PyObject *)arrayObject));
arrayObject = ((PyArrayObject *)__pyx_t_5);
@@ -2418,16 +2587,10 @@ static PyObject *__pyx_f_6mtrand_cont3_array(rk_state *__pyx_v_state, __pyx_t_6
* for i from 0 <= i < multi.size:
* oa_data = <double *>PyArray_MultiIter_DATA(multi, 1)
*/
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
- __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_5, 0, 0);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_Raise(__pyx_t_2, 0, 0);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L6;
}
@@ -2514,10 +2677,6 @@ static PyObject *__pyx_f_6mtrand_cont3_array(rk_state *__pyx_v_state, __pyx_t_6
__pyx_L0:;
__Pyx_DECREF((PyObject *)arrayObject);
__Pyx_DECREF((PyObject *)__pyx_v_multi);
- __Pyx_DECREF(__pyx_v_size);
- __Pyx_DECREF((PyObject *)__pyx_v_oa);
- __Pyx_DECREF((PyObject *)__pyx_v_ob);
- __Pyx_DECREF((PyObject *)__pyx_v_oc);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
@@ -2543,7 +2702,6 @@ static PyObject *__pyx_f_6mtrand_disc0_array(rk_state *__pyx_v_state, __pyx_t_6
PyObject *__pyx_t_4 = NULL;
long __pyx_t_5;
__Pyx_RefNannySetupContext("disc0_array");
- __Pyx_INCREF(__pyx_v_size);
arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
/* "mtrand.pyx":303
@@ -2586,17 +2744,17 @@ static PyObject *__pyx_f_6mtrand_disc0_array(rk_state *__pyx_v_state, __pyx_t_6
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_size);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size);
__Pyx_GIVEREF(__pyx_v_size);
- __Pyx_INCREF(((PyObject *)((PyObject*)&PyInt_Type)));
- PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyInt_Type)));
- __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyInt_Type)));
- __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyInt_Type))));
+ __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_4)));
__Pyx_DECREF(((PyObject *)arrayObject));
arrayObject = ((PyArrayObject *)__pyx_t_4);
@@ -2664,7 +2822,6 @@ static PyObject *__pyx_f_6mtrand_disc0_array(rk_state *__pyx_v_state, __pyx_t_6
__pyx_r = 0;
__pyx_L0:;
__Pyx_DECREF((PyObject *)arrayObject);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
@@ -2690,7 +2847,6 @@ static PyObject *__pyx_f_6mtrand_discnp_array_sc(rk_state *__pyx_v_state, __pyx
PyObject *__pyx_t_4 = NULL;
long __pyx_t_5;
__Pyx_RefNannySetupContext("discnp_array_sc");
- __Pyx_INCREF(__pyx_v_size);
arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
/* "mtrand.pyx":319
@@ -2733,17 +2889,17 @@ static PyObject *__pyx_f_6mtrand_discnp_array_sc(rk_state *__pyx_v_state, __pyx
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_size);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size);
__Pyx_GIVEREF(__pyx_v_size);
- __Pyx_INCREF(((PyObject *)((PyObject*)&PyInt_Type)));
- PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyInt_Type)));
- __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyInt_Type)));
- __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyInt_Type))));
+ __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_4)));
__Pyx_DECREF(((PyObject *)arrayObject));
arrayObject = ((PyArrayObject *)__pyx_t_4);
@@ -2811,7 +2967,6 @@ static PyObject *__pyx_f_6mtrand_discnp_array_sc(rk_state *__pyx_v_state, __pyx
__pyx_r = 0;
__pyx_L0:;
__Pyx_DECREF((PyObject *)arrayObject);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
@@ -2839,9 +2994,6 @@ static PyObject *__pyx_f_6mtrand_discnp_array(rk_state *__pyx_v_state, __pyx_t_
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
__Pyx_RefNannySetupContext("discnp_array");
- __Pyx_INCREF(__pyx_v_size);
- __Pyx_INCREF((PyObject *)__pyx_v_on);
- __Pyx_INCREF((PyObject *)__pyx_v_op);
arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); __Pyx_INCREF(Py_None);
@@ -2955,17 +3107,17 @@ static PyObject *__pyx_f_6mtrand_discnp_array(rk_state *__pyx_v_state, __pyx_t_
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_size);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size);
__Pyx_GIVEREF(__pyx_v_size);
- __Pyx_INCREF(((PyObject *)((PyObject*)&PyInt_Type)));
- PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyInt_Type)));
- __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyInt_Type)));
- __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyInt_Type))));
+ __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_5)));
__Pyx_DECREF(((PyObject *)arrayObject));
arrayObject = ((PyArrayObject *)__pyx_t_5);
@@ -3011,16 +3163,10 @@ static PyObject *__pyx_f_6mtrand_discnp_array(rk_state *__pyx_v_state, __pyx_t_
* for i from 0 <= i < multi.size:
* on_data = <long *>PyArray_MultiIter_DATA(multi, 1)
*/
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
- __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_5, 0, 0);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_Raise(__pyx_t_2, 0, 0);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L6;
}
@@ -3107,9 +3253,6 @@ static PyObject *__pyx_f_6mtrand_discnp_array(rk_state *__pyx_v_state, __pyx_t_
__pyx_L0:;
__Pyx_DECREF((PyObject *)arrayObject);
__Pyx_DECREF((PyObject *)__pyx_v_multi);
- __Pyx_DECREF(__pyx_v_size);
- __Pyx_DECREF((PyObject *)__pyx_v_on);
- __Pyx_DECREF((PyObject *)__pyx_v_op);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
@@ -3135,7 +3278,6 @@ static PyObject *__pyx_f_6mtrand_discdd_array_sc(rk_state *__pyx_v_state, __pyx
PyObject *__pyx_t_4 = NULL;
long __pyx_t_5;
__Pyx_RefNannySetupContext("discdd_array_sc");
- __Pyx_INCREF(__pyx_v_size);
arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
/* "mtrand.pyx":368
@@ -3178,17 +3320,17 @@ static PyObject *__pyx_f_6mtrand_discdd_array_sc(rk_state *__pyx_v_state, __pyx
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_size);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size);
__Pyx_GIVEREF(__pyx_v_size);
- __Pyx_INCREF(((PyObject *)((PyObject*)&PyInt_Type)));
- PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyInt_Type)));
- __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyInt_Type)));
- __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyInt_Type))));
+ __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_4)));
__Pyx_DECREF(((PyObject *)arrayObject));
arrayObject = ((PyArrayObject *)__pyx_t_4);
@@ -3256,7 +3398,6 @@ static PyObject *__pyx_f_6mtrand_discdd_array_sc(rk_state *__pyx_v_state, __pyx
__pyx_r = 0;
__pyx_L0:;
__Pyx_DECREF((PyObject *)arrayObject);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
@@ -3284,9 +3425,6 @@ static PyObject *__pyx_f_6mtrand_discdd_array(rk_state *__pyx_v_state, __pyx_t_
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
__Pyx_RefNannySetupContext("discdd_array");
- __Pyx_INCREF(__pyx_v_size);
- __Pyx_INCREF((PyObject *)__pyx_v_on);
- __Pyx_INCREF((PyObject *)__pyx_v_op);
arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); __Pyx_INCREF(Py_None);
@@ -3400,17 +3538,17 @@ static PyObject *__pyx_f_6mtrand_discdd_array(rk_state *__pyx_v_state, __pyx_t_
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_size);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size);
__Pyx_GIVEREF(__pyx_v_size);
- __Pyx_INCREF(((PyObject *)((PyObject*)&PyInt_Type)));
- PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyInt_Type)));
- __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyInt_Type)));
- __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyInt_Type))));
+ __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_5)));
__Pyx_DECREF(((PyObject *)arrayObject));
arrayObject = ((PyArrayObject *)__pyx_t_5);
@@ -3456,16 +3594,10 @@ static PyObject *__pyx_f_6mtrand_discdd_array(rk_state *__pyx_v_state, __pyx_t_
* for i from 0 <= i < multi.size:
* on_data = <double *>PyArray_MultiIter_DATA(multi, 1)
*/
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
- __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_5, 0, 0);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_Raise(__pyx_t_2, 0, 0);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L6;
}
@@ -3552,9 +3684,6 @@ static PyObject *__pyx_f_6mtrand_discdd_array(rk_state *__pyx_v_state, __pyx_t_
__pyx_L0:;
__Pyx_DECREF((PyObject *)arrayObject);
__Pyx_DECREF((PyObject *)__pyx_v_multi);
- __Pyx_DECREF(__pyx_v_size);
- __Pyx_DECREF((PyObject *)__pyx_v_on);
- __Pyx_DECREF((PyObject *)__pyx_v_op);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
@@ -3580,7 +3709,6 @@ static PyObject *__pyx_f_6mtrand_discnmN_array_sc(rk_state *__pyx_v_state, __py
PyObject *__pyx_t_4 = NULL;
long __pyx_t_5;
__Pyx_RefNannySetupContext("discnmN_array_sc");
- __Pyx_INCREF(__pyx_v_size);
arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
/* "mtrand.pyx":418
@@ -3623,17 +3751,17 @@ static PyObject *__pyx_f_6mtrand_discnmN_array_sc(rk_state *__pyx_v_state, __py
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_size);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size);
__Pyx_GIVEREF(__pyx_v_size);
- __Pyx_INCREF(((PyObject *)((PyObject*)&PyInt_Type)));
- PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyInt_Type)));
- __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyInt_Type)));
- __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyInt_Type))));
+ __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_4)));
__Pyx_DECREF(((PyObject *)arrayObject));
arrayObject = ((PyArrayObject *)__pyx_t_4);
@@ -3701,7 +3829,6 @@ static PyObject *__pyx_f_6mtrand_discnmN_array_sc(rk_state *__pyx_v_state, __py
__pyx_r = 0;
__pyx_L0:;
__Pyx_DECREF((PyObject *)arrayObject);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
@@ -3730,10 +3857,6 @@ static PyObject *__pyx_f_6mtrand_discnmN_array(rk_state *__pyx_v_state, __pyx_t
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
__Pyx_RefNannySetupContext("discnmN_array");
- __Pyx_INCREF(__pyx_v_size);
- __Pyx_INCREF((PyObject *)__pyx_v_on);
- __Pyx_INCREF((PyObject *)__pyx_v_om);
- __Pyx_INCREF((PyObject *)__pyx_v_oN);
arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); __Pyx_INCREF(Py_None);
@@ -3856,17 +3979,17 @@ static PyObject *__pyx_f_6mtrand_discnmN_array(rk_state *__pyx_v_state, __pyx_t
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_size);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size);
__Pyx_GIVEREF(__pyx_v_size);
- __Pyx_INCREF(((PyObject *)((PyObject*)&PyInt_Type)));
- PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyInt_Type)));
- __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyInt_Type)));
- __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyInt_Type))));
+ __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_5)));
__Pyx_DECREF(((PyObject *)arrayObject));
arrayObject = ((PyArrayObject *)__pyx_t_5);
@@ -3912,16 +4035,10 @@ static PyObject *__pyx_f_6mtrand_discnmN_array(rk_state *__pyx_v_state, __pyx_t
* for i from 0 <= i < multi.size:
* on_data = <long *>PyArray_MultiIter_DATA(multi, 1)
*/
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
- __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_5, 0, 0);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_Raise(__pyx_t_2, 0, 0);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L6;
}
@@ -4008,10 +4125,6 @@ static PyObject *__pyx_f_6mtrand_discnmN_array(rk_state *__pyx_v_state, __pyx_t
__pyx_L0:;
__Pyx_DECREF((PyObject *)arrayObject);
__Pyx_DECREF((PyObject *)__pyx_v_multi);
- __Pyx_DECREF(__pyx_v_size);
- __Pyx_DECREF((PyObject *)__pyx_v_on);
- __Pyx_DECREF((PyObject *)__pyx_v_om);
- __Pyx_DECREF((PyObject *)__pyx_v_oN);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
@@ -4037,7 +4150,6 @@ static PyObject *__pyx_f_6mtrand_discd_array_sc(rk_state *__pyx_v_state, __pyx_
PyObject *__pyx_t_4 = NULL;
long __pyx_t_5;
__Pyx_RefNannySetupContext("discd_array_sc");
- __Pyx_INCREF(__pyx_v_size);
arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
/* "mtrand.pyx":471
@@ -4080,17 +4192,17 @@ static PyObject *__pyx_f_6mtrand_discd_array_sc(rk_state *__pyx_v_state, __pyx_
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_size);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size);
__Pyx_GIVEREF(__pyx_v_size);
- __Pyx_INCREF(((PyObject *)((PyObject*)&PyInt_Type)));
- PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyInt_Type)));
- __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyInt_Type)));
- __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyInt_Type))));
+ __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_4)));
__Pyx_DECREF(((PyObject *)arrayObject));
arrayObject = ((PyArrayObject *)__pyx_t_4);
@@ -4158,7 +4270,6 @@ static PyObject *__pyx_f_6mtrand_discd_array_sc(rk_state *__pyx_v_state, __pyx_
__pyx_r = 0;
__pyx_L0:;
__Pyx_DECREF((PyObject *)arrayObject);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
@@ -4187,8 +4298,6 @@ static PyObject *__pyx_f_6mtrand_discd_array(rk_state *__pyx_v_state, __pyx_t_6
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
__Pyx_RefNannySetupContext("discd_array");
- __Pyx_INCREF(__pyx_v_size);
- __Pyx_INCREF((PyObject *)__pyx_v_oa);
arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_itera = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
@@ -4294,17 +4403,17 @@ static PyObject *__pyx_f_6mtrand_discd_array(rk_state *__pyx_v_state, __pyx_t_6
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_size);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size);
__Pyx_GIVEREF(__pyx_v_size);
- __Pyx_INCREF(((PyObject *)((PyObject*)&PyInt_Type)));
- PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyInt_Type)));
- __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyInt_Type)));
- __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyInt_Type))));
+ __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_5)));
__Pyx_DECREF(((PyObject *)arrayObject));
arrayObject = ((PyArrayObject *)__pyx_t_5);
@@ -4350,16 +4459,10 @@ static PyObject *__pyx_f_6mtrand_discd_array(rk_state *__pyx_v_state, __pyx_t_6
* for i from 0 <= i < multi.size:
* oa_data = <double *>PyArray_MultiIter_DATA(multi, 1)
*/
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
- __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_5, 0, 0);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_Raise(__pyx_t_2, 0, 0);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L6;
}
@@ -4429,8 +4532,6 @@ static PyObject *__pyx_f_6mtrand_discd_array(rk_state *__pyx_v_state, __pyx_t_6
__Pyx_DECREF((PyObject *)arrayObject);
__Pyx_DECREF((PyObject *)__pyx_v_multi);
__Pyx_DECREF((PyObject *)__pyx_v_itera);
- __Pyx_DECREF(__pyx_v_size);
- __Pyx_DECREF((PyObject *)__pyx_v_oa);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
@@ -4535,8 +4636,8 @@ static double __pyx_f_6mtrand_kahan_sum(double *__pyx_v_darr, long __pyx_v_n) {
return __pyx_r;
}
-/* "mtrand.pyx":557
- * cdef rk_state *internal_state
+/* "mtrand.pyx":558
+ * poisson_lam_max = np.iinfo('l').max - np.sqrt(np.iinfo('l').max)*10
*
* def __init__(self, seed=None): # <<<<<<<<<<<<<<
* self.internal_state = <rk_state*>PyMem_Malloc(sizeof(rk_state))
@@ -4563,13 +4664,13 @@ static int __pyx_pf_6mtrand_11RandomState___init__(PyObject *__pyx_v_self, PyObj
}
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 0:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seed);
- if (unlikely(value)) { values[0] = value; kw_args--; }
+ if (value) { values[0] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_seed = values[0];
} else {
@@ -4582,13 +4683,14 @@ static int __pyx_pf_6mtrand_11RandomState___init__(PyObject *__pyx_v_self, PyObj
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.__init__");
+ __Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
- /* "mtrand.pyx":558
+ /* "mtrand.pyx":559
*
* def __init__(self, seed=None):
* self.internal_state = <rk_state*>PyMem_Malloc(sizeof(rk_state)) # <<<<<<<<<<<<<<
@@ -4597,24 +4699,24 @@ static int __pyx_pf_6mtrand_11RandomState___init__(PyObject *__pyx_v_self, PyObj
*/
((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state = ((rk_state *)PyMem_Malloc((sizeof(rk_state))));
- /* "mtrand.pyx":560
+ /* "mtrand.pyx":561
* self.internal_state = <rk_state*>PyMem_Malloc(sizeof(rk_state))
*
* self.seed(seed) # <<<<<<<<<<<<<<
*
* def __dealloc__(self):
*/
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__seed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__seed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_seed);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_seed);
__Pyx_GIVEREF(__pyx_v_seed);
- __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = 0;
@@ -4630,7 +4732,7 @@ static int __pyx_pf_6mtrand_11RandomState___init__(PyObject *__pyx_v_self, PyObj
return __pyx_r;
}
-/* "mtrand.pyx":562
+/* "mtrand.pyx":563
* self.seed(seed)
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -4638,13 +4740,12 @@ static int __pyx_pf_6mtrand_11RandomState___init__(PyObject *__pyx_v_self, PyObj
* PyMem_Free(self.internal_state)
*/
-static void __pyx_pf_6mtrand_11RandomState___dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pf_6mtrand_11RandomState___dealloc__(PyObject *__pyx_v_self) {
+static void __pyx_pf_6mtrand_11RandomState_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pf_6mtrand_11RandomState_1__dealloc__(PyObject *__pyx_v_self) {
int __pyx_t_1;
__Pyx_RefNannySetupContext("__dealloc__");
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- /* "mtrand.pyx":563
+ /* "mtrand.pyx":564
*
* def __dealloc__(self):
* if self.internal_state != NULL: # <<<<<<<<<<<<<<
@@ -4654,7 +4755,7 @@ static void __pyx_pf_6mtrand_11RandomState___dealloc__(PyObject *__pyx_v_self) {
__pyx_t_1 = (((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state != NULL);
if (__pyx_t_1) {
- /* "mtrand.pyx":564
+ /* "mtrand.pyx":565
* def __dealloc__(self):
* if self.internal_state != NULL:
* PyMem_Free(self.internal_state) # <<<<<<<<<<<<<<
@@ -4663,7 +4764,7 @@ static void __pyx_pf_6mtrand_11RandomState___dealloc__(PyObject *__pyx_v_self) {
*/
PyMem_Free(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);
- /* "mtrand.pyx":565
+ /* "mtrand.pyx":566
* if self.internal_state != NULL:
* PyMem_Free(self.internal_state)
* self.internal_state = NULL # <<<<<<<<<<<<<<
@@ -4675,11 +4776,10 @@ static void __pyx_pf_6mtrand_11RandomState___dealloc__(PyObject *__pyx_v_self) {
}
__pyx_L5:;
- __Pyx_DECREF((PyObject *)__pyx_v_self);
__Pyx_RefNannyFinishContext();
}
-/* "mtrand.pyx":567
+/* "mtrand.pyx":568
* self.internal_state = NULL
*
* def seed(self, seed=None): # <<<<<<<<<<<<<<
@@ -4687,9 +4787,9 @@ static void __pyx_pf_6mtrand_11RandomState___dealloc__(PyObject *__pyx_v_self) {
* seed(seed=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_seed[] = "\n seed(seed=None)\n\n Seed the generator.\n\n This method is called when `RandomState` is initialized. It can be\n called again to re-seed the generator. For details, see `RandomState`.\n\n Parameters\n ----------\n seed : int or array_like, optional\n Seed for `RandomState`.\n\n See Also\n --------\n RandomState\n\n ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_2seed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_2seed[] = "\n seed(seed=None)\n\n Seed the generator.\n\n This method is called when `RandomState` is initialized. It can be\n called again to re-seed the generator. For details, see `RandomState`.\n\n Parameters\n ----------\n seed : int or array_like, optional\n Seed for `RandomState`.\n\n See Also\n --------\n RandomState\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_2seed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_seed = 0;
rk_error __pyx_v_errcode;
PyArrayObject *arrayObject_obj;
@@ -4712,13 +4812,13 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyO
}
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 0:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seed);
- if (unlikely(value)) { values[0] = value; kw_args--; }
+ if (value) { values[0] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "seed") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "seed") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_seed = values[0];
} else {
@@ -4731,17 +4831,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyO
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("seed", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("seed", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.seed");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_seed);
arrayObject_obj = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_iseed = Py_None; __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":588
+ /* "mtrand.pyx":589
* cdef rk_error errcode
* cdef ndarray obj "arrayObject_obj"
* if seed is None: # <<<<<<<<<<<<<<
@@ -4751,7 +4850,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyO
__pyx_t_1 = (__pyx_v_seed == Py_None);
if (__pyx_t_1) {
- /* "mtrand.pyx":589
+ /* "mtrand.pyx":590
* cdef ndarray obj "arrayObject_obj"
* if seed is None:
* errcode = rk_randomseed(self.internal_state) # <<<<<<<<<<<<<<
@@ -4762,91 +4861,91 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyO
goto __pyx_L6;
}
- /* "mtrand.pyx":590
+ /* "mtrand.pyx":591
* 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_1 = (((PyObject *)Py_TYPE(__pyx_v_seed)) == ((PyObject *)((PyObject*)&PyInt_Type)));
+ __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_seed)) == ((PyObject *)((PyObject*)(&PyInt_Type))));
if (__pyx_t_1) {
- /* "mtrand.pyx":591
+ /* "mtrand.pyx":592
* 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_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;}
+ __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 = 592; __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;
}
- /* "mtrand.pyx":592
+ /* "mtrand.pyx":593
* 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_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_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); 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_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_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__integer); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__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_t_1 = PyObject_IsInstance(__pyx_v_seed, __pyx_t_4); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":593
+ /* "mtrand.pyx":594
* rk_seed(seed, self.internal_state)
* elif isinstance(seed, np.integer):
* iseed = int(seed) # <<<<<<<<<<<<<<
* rk_seed(iseed, self.internal_state)
* else:
*/
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
__Pyx_INCREF(__pyx_v_seed);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_seed);
__Pyx_GIVEREF(__pyx_v_seed);
- __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_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_v_iseed);
__pyx_v_iseed = __pyx_t_3;
__pyx_t_3 = 0;
- /* "mtrand.pyx":594
+ /* "mtrand.pyx":595
* elif isinstance(seed, np.integer):
* iseed = int(seed)
* rk_seed(iseed, self.internal_state) # <<<<<<<<<<<<<<
* else:
* obj = <ndarray>PyArray_ContiguousFromObject(seed, NPY_LONG, 1, 1)
*/
- __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;}
+ __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 = 595; __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*/ {
- /* "mtrand.pyx":596
+ /* "mtrand.pyx":597
* rk_seed(iseed, self.internal_state)
* else:
* obj = <ndarray>PyArray_ContiguousFromObject(seed, NPY_LONG, 1, 1) # <<<<<<<<<<<<<<
* init_by_array(self.internal_state, <unsigned long *>(obj.data),
* obj.dimensions[0])
*/
- __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_t_3 = PyArray_ContiguousFromObject(__pyx_v_seed, NPY_LONG, 1, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __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_3);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "mtrand.pyx":598
+ /* "mtrand.pyx":599
* obj = <ndarray>PyArray_ContiguousFromObject(seed, NPY_LONG, 1, 1)
* init_by_array(self.internal_state, <unsigned long *>(obj.data),
* obj.dimensions[0]) # <<<<<<<<<<<<<<
@@ -4867,14 +4966,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyO
__pyx_L0:;
__Pyx_DECREF((PyObject *)arrayObject_obj);
__Pyx_DECREF(__pyx_v_iseed);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_seed);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":600
+/* "mtrand.pyx":601
* obj.dimensions[0])
*
* def get_state(self): # <<<<<<<<<<<<<<
@@ -4882,9 +4979,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyO
* get_state()
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_get_state(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_get_state[] = "\n get_state()\n\n Return a tuple representing the internal state of the generator.\n\n For more details, see `set_state`.\n\n Returns\n -------\n out : tuple(str, ndarray of 624 uints, int, int, float)\n The returned tuple has the following items:\n\n 1. the string 'MT19937'.\n 2. a 1-D array of 624 unsigned integer keys.\n 3. an integer ``pos``.\n 4. an integer ``has_gauss``.\n 5. a float ``cached_gaussian``.\n\n See Also\n --------\n set_state\n\n Notes\n -----\n `set_state` and `get_state` are not needed to work with any of the\n random distributions in NumPy. If the internal state is manually altered,\n the user should know exactly what he/she is doing.\n\n ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_get_state(PyObject *__pyx_v_self, PyObject *unused) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_3get_state(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_3get_state[] = "\n get_state()\n\n Return a tuple representing the internal state of the generator.\n\n For more details, see `set_state`.\n\n Returns\n -------\n out : tuple(str, ndarray of 624 uints, int, int, float)\n The returned tuple has the following items:\n\n 1. the string 'MT19937'.\n 2. a 1-D array of 624 unsigned integer keys.\n 3. an integer ``pos``.\n 4. an integer ``has_gauss``.\n 5. a float ``cached_gaussian``.\n\n See Also\n --------\n set_state\n\n Notes\n -----\n `set_state` and `get_state` are not needed to work with any of the\n random distributions in NumPy. If the internal state is manually altered,\n the user should know exactly what he/she is doing.\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_3get_state(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyArrayObject *arrayObject_state;
PyObject *__pyx_r = NULL;
PyObject *__pyx_t_1 = NULL;
@@ -4894,41 +4991,41 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_get_state(PyObject *__pyx_v_self
__Pyx_RefNannySetupContext("get_state");
arrayObject_state = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":631
+ /* "mtrand.pyx":632
* """
* cdef ndarray state "arrayObject_state"
* state = <ndarray>np.empty(624, np.uint) # <<<<<<<<<<<<<<
* memcpy(<void*>(state.data), <void*>(self.internal_state.key), 624*sizeof(long))
* state = <ndarray>np.asarray(state, np.uint32)
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__uint); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__uint); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__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 = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_1));
__Pyx_INCREF(__pyx_int_624);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_624);
__Pyx_GIVEREF(__pyx_int_624);
PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
__Pyx_DECREF(((PyObject *)arrayObject_state));
arrayObject_state = ((PyArrayObject *)__pyx_t_3);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "mtrand.pyx":632
+ /* "mtrand.pyx":633
* cdef ndarray state "arrayObject_state"
* state = <ndarray>np.empty(624, np.uint)
* memcpy(<void*>(state.data), <void*>(self.internal_state.key), 624*sizeof(long)) # <<<<<<<<<<<<<<
@@ -4937,41 +5034,41 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_get_state(PyObject *__pyx_v_self
*/
memcpy(((void *)arrayObject_state->data), ((void *)((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->key), (624 * (sizeof(long))));
- /* "mtrand.pyx":633
+ /* "mtrand.pyx":634
* state = <ndarray>np.empty(624, np.uint)
* memcpy(<void*>(state.data), <void*>(self.internal_state.key), 624*sizeof(long))
* state = <ndarray>np.asarray(state, np.uint32) # <<<<<<<<<<<<<<
* return ('MT19937', state, self.internal_state.pos,
* self.internal_state.has_gauss, self.internal_state.gauss)
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __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 = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__asarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__asarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __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 = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__uint32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__uint32); 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);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
__Pyx_INCREF(((PyObject *)arrayObject_state));
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)arrayObject_state));
__Pyx_GIVEREF(((PyObject *)arrayObject_state));
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); 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);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)arrayObject_state));
arrayObject_state = ((PyArrayObject *)__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":634
+ /* "mtrand.pyx":635
* memcpy(<void*>(state.data), <void*>(self.internal_state.key), 624*sizeof(long))
* state = <ndarray>np.asarray(state, np.uint32)
* return ('MT19937', state, self.internal_state.pos, # <<<<<<<<<<<<<<
@@ -4979,22 +5076,22 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_get_state(PyObject *__pyx_v_self
*
*/
__Pyx_XDECREF(__pyx_r);
- __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_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 = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- /* "mtrand.pyx":635
+ /* "mtrand.pyx":636
* state = <ndarray>np.asarray(state, np.uint32)
* return ('MT19937', state, self.internal_state.pos,
* self.internal_state.has_gauss, self.internal_state.gauss) # <<<<<<<<<<<<<<
*
* def set_state(self, state):
*/
- __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->has_gauss); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->has_gauss); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->gauss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->gauss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
__Pyx_INCREF(((PyObject *)__pyx_n_s__MT19937));
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_n_s__MT19937));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__MT19937));
@@ -5010,7 +5107,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_get_state(PyObject *__pyx_v_self
__pyx_t_2 = 0;
__pyx_t_3 = 0;
__pyx_t_1 = 0;
- __pyx_r = __pyx_t_4;
+ __pyx_r = ((PyObject *)__pyx_t_4);
__pyx_t_4 = 0;
goto __pyx_L0;
@@ -5030,7 +5127,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_get_state(PyObject *__pyx_v_self
return __pyx_r;
}
-/* "mtrand.pyx":637
+/* "mtrand.pyx":638
* self.internal_state.has_gauss, self.internal_state.gauss)
*
* def set_state(self, state): # <<<<<<<<<<<<<<
@@ -5038,9 +5135,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_get_state(PyObject *__pyx_v_self
* set_state(state)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_set_state[] = "\n set_state(state)\n\n Set the internal state of the generator from a tuple.\n\n For use if one has reason to manually (re-)set the internal state of the\n \"Mersenne Twister\"[1]_ pseudo-random number generating algorithm.\n\n Parameters\n ----------\n state : tuple(str, ndarray of 624 uints, int, int, float)\n The `state` tuple has the following items:\n\n 1. the string 'MT19937', specifying the Mersenne Twister algorithm.\n 2. a 1-D array of 624 unsigned integers ``keys``.\n 3. an integer ``pos``.\n 4. an integer ``has_gauss``.\n 5. a float ``cached_gaussian``.\n\n Returns\n -------\n out : None\n Returns 'None' on success.\n\n See Also\n --------\n get_state\n\n Notes\n -----\n `set_state` and `get_state` are not needed to work with any of the\n random distributions in NumPy. If the internal state is manually altered,\n the user should know exactly what he/she is doing.\n\n For backwards compatibility, the form (str, array of 624 uints, int) is\n also accepted although it is missing some information about the cached\n Gaussian value: ``state = ('MT19937', keys, pos)``.\n\n References\n ----------\n .. [1] M. Matsumoto and T. Nishimura, \"Mersenne Twister: A\n 623-dimensionally equidistributed uniform pseudorandom number\n generator,\" *ACM Trans. on Modeling and Computer Simulation*,\n Vol. 8, No. 1, pp. 3-30, Jan. 1998.\n\n ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self, PyObject *__pyx_v_state) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_4set_state(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_4set_state[] = "\n set_state(state)\n\n Set the internal state of the generator from a tuple.\n\n For use if one has reason to manually (re-)set the internal state of the\n \"Mersenne Twister\"[1]_ pseudo-random number generating algorithm.\n\n Parameters\n ----------\n state : tuple(str, ndarray of 624 uints, int, int, float)\n The `state` tuple has the following items:\n\n 1. the string 'MT19937', specifying the Mersenne Twister algorithm.\n 2. a 1-D array of 624 unsigned integers ``keys``.\n 3. an integer ``pos``.\n 4. an integer ``has_gauss``.\n 5. a float ``cached_gaussian``.\n\n Returns\n -------\n out : None\n Returns 'None' on success.\n\n See Also\n --------\n get_state\n\n Notes\n -----\n `set_state` and `get_state` are not needed to work with any of the\n random distributions in NumPy. If the internal state is manually altered,\n the user should know exactly what he/she is doing.\n\n For backwards compatibility, the form (str, array of 624 uints, int) is\n also accepted although it is missing some information about the cached\n Gaussian value: ``state = ('MT19937', keys, pos)``.\n\n References\n ----------\n .. [1] M. Matsumoto and T. Nishimura, \"Mersenne Twister: A\n 623-dimensionally equidistributed uniform pseudorandom number\n generator,\" *ACM Trans. on Modeling and Computer Simulation*,\n Vol. 8, No. 1, pp. 3-30, Jan. 1998.\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_4set_state(PyObject *__pyx_v_self, PyObject *__pyx_v_state) {
PyArrayObject *arrayObject_obj;
int __pyx_v_pos;
PyObject *__pyx_v_algorithm_name;
@@ -5057,112 +5154,104 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self
Py_ssize_t __pyx_t_7;
double __pyx_t_8;
__Pyx_RefNannySetupContext("set_state");
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_state);
arrayObject_obj = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_algorithm_name = Py_None; __Pyx_INCREF(Py_None);
__pyx_v_key = Py_None; __Pyx_INCREF(Py_None);
__pyx_v_has_gauss = Py_None; __Pyx_INCREF(Py_None);
__pyx_v_cached_gaussian = Py_None; __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":686
+ /* "mtrand.pyx":687
* cdef ndarray obj "arrayObject_obj"
* cdef int pos
* algorithm_name = state[0] # <<<<<<<<<<<<<<
* if algorithm_name != 'MT19937':
* raise ValueError("algorithm must be 'MT19937'")
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_state, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_state, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_v_algorithm_name);
__pyx_v_algorithm_name = __pyx_t_1;
__pyx_t_1 = 0;
- /* "mtrand.pyx":687
+ /* "mtrand.pyx":688
* cdef int pos
* algorithm_name = state[0]
* if algorithm_name != 'MT19937': # <<<<<<<<<<<<<<
* raise ValueError("algorithm must be 'MT19937'")
* key, pos = state[1:3]
*/
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_algorithm_name, ((PyObject *)__pyx_n_s__MT19937), Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_algorithm_name, ((PyObject *)__pyx_n_s__MT19937), Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
- /* "mtrand.pyx":688
+ /* "mtrand.pyx":689
* algorithm_name = state[0]
* if algorithm_name != 'MT19937':
* raise ValueError("algorithm must be 'MT19937'") # <<<<<<<<<<<<<<
* key, pos = state[1:3]
* if len(state) == 3:
*/
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
- PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_2));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_1, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L5;
}
__pyx_L5:;
- /* "mtrand.pyx":689
+ /* "mtrand.pyx":690
* if algorithm_name != 'MT19937':
* raise ValueError("algorithm must be 'MT19937'")
* key, pos = state[1:3] # <<<<<<<<<<<<<<
* if len(state) == 3:
* has_gauss = 0
*/
- __pyx_t_3 = PySequence_GetSlice(__pyx_v_state, 1, 3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) {
- PyObject* tuple = __pyx_t_3;
- __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
+ __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_v_state, 1, 3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) {
+ PyObject* tuple = __pyx_t_1;
+ __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3);
__pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4);
- __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_v_key);
- __pyx_v_key = __pyx_t_1;
- __pyx_t_1 = 0;
+ __pyx_v_key = __pyx_t_3;
+ __pyx_t_3 = 0;
__pyx_v_pos = __pyx_t_5;
} else {
- __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (__Pyx_EndUnpack(__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_v_key);
- __pyx_v_key = __pyx_t_1;
- __pyx_t_1 = 0;
+ __pyx_v_key = __pyx_t_3;
+ __pyx_t_3 = 0;
__pyx_v_pos = __pyx_t_5;
}
- /* "mtrand.pyx":690
+ /* "mtrand.pyx":691
* raise ValueError("algorithm must be 'MT19937'")
* key, pos = state[1:3]
* if len(state) == 3: # <<<<<<<<<<<<<<
* has_gauss = 0
* cached_gaussian = 0.0
*/
- __pyx_t_7 = PyObject_Length(__pyx_v_state); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyObject_Length(__pyx_v_state); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_2 = (__pyx_t_7 == 3);
if (__pyx_t_2) {
- /* "mtrand.pyx":691
+ /* "mtrand.pyx":692
* key, pos = state[1:3]
* if len(state) == 3:
* has_gauss = 0 # <<<<<<<<<<<<<<
@@ -5173,63 +5262,63 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self
__Pyx_DECREF(__pyx_v_has_gauss);
__pyx_v_has_gauss = __pyx_int_0;
- /* "mtrand.pyx":692
+ /* "mtrand.pyx":693
* if len(state) == 3:
* has_gauss = 0
* cached_gaussian = 0.0 # <<<<<<<<<<<<<<
* else:
* has_gauss, cached_gaussian = state[3:5]
*/
- __pyx_t_3 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_v_cached_gaussian);
- __pyx_v_cached_gaussian = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_v_cached_gaussian = __pyx_t_1;
+ __pyx_t_1 = 0;
goto __pyx_L6;
}
/*else*/ {
- /* "mtrand.pyx":694
+ /* "mtrand.pyx":695
* cached_gaussian = 0.0
* else:
* has_gauss, cached_gaussian = state[3:5] # <<<<<<<<<<<<<<
* try:
* obj = <ndarray>PyArray_ContiguousFromObject(key, NPY_ULONG, 1, 1)
*/
- __pyx_t_3 = PySequence_GetSlice(__pyx_v_state, 3, 5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) {
- PyObject* tuple = __pyx_t_3;
+ __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_v_state, 3, 5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) {
+ PyObject* tuple = __pyx_t_1;
__pyx_t_4 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_4);
- __pyx_t_1 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_v_has_gauss);
__pyx_v_has_gauss = __pyx_t_4;
__pyx_t_4 = 0;
__Pyx_DECREF(__pyx_v_cached_gaussian);
- __pyx_v_cached_gaussian = __pyx_t_1;
- __pyx_t_1 = 0;
+ __pyx_v_cached_gaussian = __pyx_t_3;
+ __pyx_t_3 = 0;
} else {
- __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- if (__Pyx_EndUnpack(__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_v_has_gauss);
__pyx_v_has_gauss = __pyx_t_4;
__pyx_t_4 = 0;
__Pyx_DECREF(__pyx_v_cached_gaussian);
- __pyx_v_cached_gaussian = __pyx_t_1;
- __pyx_t_1 = 0;
+ __pyx_v_cached_gaussian = __pyx_t_3;
+ __pyx_t_3 = 0;
}
}
__pyx_L6:;
- /* "mtrand.pyx":695
+ /* "mtrand.pyx":696
* else:
* has_gauss, cached_gaussian = state[3:5]
* try: # <<<<<<<<<<<<<<
@@ -5244,19 +5333,19 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self
__Pyx_XGOTREF(__pyx_save_exc_tb);
/*try:*/ {
- /* "mtrand.pyx":696
+ /* "mtrand.pyx":697
* has_gauss, cached_gaussian = state[3:5]
* try:
* obj = <ndarray>PyArray_ContiguousFromObject(key, NPY_ULONG, 1, 1) # <<<<<<<<<<<<<<
* except TypeError:
* # compatibility -- could be an older pickle
*/
- __pyx_t_3 = PyArray_ContiguousFromObject(__pyx_v_key, NPY_ULONG, 1, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
+ __pyx_t_1 = PyArray_ContiguousFromObject(__pyx_v_key, NPY_ULONG, 1, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_1)));
__Pyx_DECREF(((PyObject *)arrayObject_obj));
- arrayObject_obj = ((PyArrayObject *)__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ arrayObject_obj = ((PyArrayObject *)__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
__Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
__Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
@@ -5265,10 +5354,10 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self
__pyx_L7_error:;
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "mtrand.pyx":697
+ /* "mtrand.pyx":698
* try:
* obj = <ndarray>PyArray_ContiguousFromObject(key, NPY_ULONG, 1, 1)
* except TypeError: # <<<<<<<<<<<<<<
@@ -5278,26 +5367,26 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self
__pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_TypeError);
if (__pyx_t_5) {
__Pyx_AddTraceback("mtrand.RandomState.set_state");
- if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_GOTREF(__pyx_t_4);
- /* "mtrand.pyx":699
+ /* "mtrand.pyx":700
* except TypeError:
* # compatibility -- could be an older pickle
* obj = <ndarray>PyArray_ContiguousFromObject(key, NPY_LONG, 1, 1) # <<<<<<<<<<<<<<
* if obj.dimensions[0] != 624:
* raise ValueError("state must be 624 longs")
*/
- __pyx_t_6 = PyArray_ContiguousFromObject(__pyx_v_key, NPY_LONG, 1, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __pyx_t_6 = PyArray_ContiguousFromObject(__pyx_v_key, NPY_LONG, 1, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_6)));
__Pyx_DECREF(((PyObject *)arrayObject_obj));
arrayObject_obj = ((PyArrayObject *)__pyx_t_6);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
goto __pyx_L8_exception_handled;
}
@@ -5315,7 +5404,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self
__pyx_L14_try_end:;
}
- /* "mtrand.pyx":700
+ /* "mtrand.pyx":701
* # compatibility -- could be an older pickle
* obj = <ndarray>PyArray_ContiguousFromObject(key, NPY_LONG, 1, 1)
* if obj.dimensions[0] != 624: # <<<<<<<<<<<<<<
@@ -5325,29 +5414,23 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self
__pyx_t_2 = ((arrayObject_obj->dimensions[0]) != 624);
if (__pyx_t_2) {
- /* "mtrand.pyx":701
+ /* "mtrand.pyx":702
* obj = <ndarray>PyArray_ContiguousFromObject(key, NPY_LONG, 1, 1)
* if obj.dimensions[0] != 624:
* raise ValueError("state must be 624 longs") # <<<<<<<<<<<<<<
* memcpy(<void*>(self.internal_state.key), <void*>(obj.data), 624*sizeof(long))
* self.internal_state.pos = pos
*/
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
- PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_3));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
- __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_Raise(__pyx_t_4, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_Raise(__pyx_t_1, 0, 0);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L17;
}
__pyx_L17:;
- /* "mtrand.pyx":702
+ /* "mtrand.pyx":703
* if obj.dimensions[0] != 624:
* raise ValueError("state must be 624 longs")
* memcpy(<void*>(self.internal_state.key), <void*>(obj.data), 624*sizeof(long)) # <<<<<<<<<<<<<<
@@ -5356,7 +5439,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self
*/
memcpy(((void *)((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->key), ((void *)arrayObject_obj->data), (624 * (sizeof(long))));
- /* "mtrand.pyx":703
+ /* "mtrand.pyx":704
* raise ValueError("state must be 624 longs")
* memcpy(<void*>(self.internal_state.key), <void*>(obj.data), 624*sizeof(long))
* self.internal_state.pos = pos # <<<<<<<<<<<<<<
@@ -5365,24 +5448,24 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self
*/
((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos = __pyx_v_pos;
- /* "mtrand.pyx":704
+ /* "mtrand.pyx":705
* memcpy(<void*>(self.internal_state.key), <void*>(obj.data), 624*sizeof(long))
* self.internal_state.pos = pos
* self.internal_state.has_gauss = has_gauss # <<<<<<<<<<<<<<
* self.internal_state.gauss = cached_gaussian
*
*/
- __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;}
+ __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 = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->has_gauss = __pyx_t_5;
- /* "mtrand.pyx":705
+ /* "mtrand.pyx":706
* 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((__pyx_t_8 == (double)-1) && 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 = 706; __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,14 +5483,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self
__Pyx_DECREF(__pyx_v_key);
__Pyx_DECREF(__pyx_v_has_gauss);
__Pyx_DECREF(__pyx_v_cached_gaussian);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_state);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":708
+/* "mtrand.pyx":709
*
* # Pickling support:
* def __getstate__(self): # <<<<<<<<<<<<<<
@@ -5415,14 +5496,14 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self
*
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState___getstate__(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
-static PyObject *__pyx_pf_6mtrand_11RandomState___getstate__(PyObject *__pyx_v_self, PyObject *unused) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_5__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyObject *__pyx_pf_6mtrand_11RandomState_5__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = NULL;
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
__Pyx_RefNannySetupContext("__getstate__");
- /* "mtrand.pyx":709
+ /* "mtrand.pyx":710
* # Pickling support:
* def __getstate__(self):
* return self.get_state() # <<<<<<<<<<<<<<
@@ -5430,9 +5511,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState___getstate__(PyObject *__pyx_v_s
* def __setstate__(self, state):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__get_state); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__get_state); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_2;
@@ -5452,7 +5533,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState___getstate__(PyObject *__pyx_v_s
return __pyx_r;
}
-/* "mtrand.pyx":711
+/* "mtrand.pyx":712
* return self.get_state()
*
* def __setstate__(self, state): # <<<<<<<<<<<<<<
@@ -5460,32 +5541,32 @@ static PyObject *__pyx_pf_6mtrand_11RandomState___getstate__(PyObject *__pyx_v_s
*
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState___setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/
-static PyObject *__pyx_pf_6mtrand_11RandomState___setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_6__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/
+static PyObject *__pyx_pf_6mtrand_11RandomState_6__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) {
PyObject *__pyx_r = NULL;
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
__Pyx_RefNannySetupContext("__setstate__");
- /* "mtrand.pyx":712
+ /* "mtrand.pyx":713
*
* def __setstate__(self, state):
* self.set_state(state) # <<<<<<<<<<<<<<
*
* def __reduce__(self):
*/
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__set_state); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__set_state); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_state);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_state);
__Pyx_GIVEREF(__pyx_v_state);
- __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -5502,7 +5583,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState___setstate__(PyObject *__pyx_v_s
return __pyx_r;
}
-/* "mtrand.pyx":714
+/* "mtrand.pyx":715
* self.set_state(state)
*
* def __reduce__(self): # <<<<<<<<<<<<<<
@@ -5510,15 +5591,15 @@ static PyObject *__pyx_pf_6mtrand_11RandomState___setstate__(PyObject *__pyx_v_s
*
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState___reduce__(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
-static PyObject *__pyx_pf_6mtrand_11RandomState___reduce__(PyObject *__pyx_v_self, PyObject *unused) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_7__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyObject *__pyx_pf_6mtrand_11RandomState_7__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = NULL;
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
__Pyx_RefNannySetupContext("__reduce__");
- /* "mtrand.pyx":715
+ /* "mtrand.pyx":716
*
* def __reduce__(self):
* return (np.random.__RandomState_ctor, (), self.get_state()) # <<<<<<<<<<<<<<
@@ -5526,21 +5607,21 @@ static PyObject *__pyx_pf_6mtrand_11RandomState___reduce__(PyObject *__pyx_v_sel
* # Basic distributions:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__random); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__random); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____RandomState_ctor); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____RandomState_ctor); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__get_state); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__get_state); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__Pyx_INCREF(((PyObject *)__pyx_empty_tuple));
@@ -5550,7 +5631,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState___reduce__(PyObject *__pyx_v_sel
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_1 = 0;
__pyx_t_3 = 0;
- __pyx_r = __pyx_t_2;
+ __pyx_r = ((PyObject *)__pyx_t_2);
__pyx_t_2 = 0;
goto __pyx_L0;
@@ -5568,7 +5649,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState___reduce__(PyObject *__pyx_v_sel
return __pyx_r;
}
-/* "mtrand.pyx":718
+/* "mtrand.pyx":719
*
* # Basic distributions:
* def random_sample(self, size=None): # <<<<<<<<<<<<<<
@@ -5576,9 +5657,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState___reduce__(PyObject *__pyx_v_sel
* random_sample(size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_random_sample(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_random_sample[] = "\n random_sample(size=None)\n\n Return random floats in the half-open interval [0.0, 1.0).\n\n Results are from the \"continuous uniform\" distribution over the\n stated interval. To sample :math:`Unif[a, b), b > a` multiply\n the output of `random_sample` by `(b-a)` and add `a`::\n\n (b - a) * random_sample() + a\n\n Parameters\n ----------\n size : int or tuple of ints, optional\n Defines the shape of the returned array of random floats. If None\n (the default), returns a single float.\n\n Returns\n -------\n out : float or ndarray of floats\n Array of random floats of shape `size` (unless ``size=None``, in which\n case a single float is returned).\n\n Examples\n --------\n >>> np.random.random_sample()\n 0.47108547995356098\n >>> type(np.random.random_sample())\n <type 'float'>\n >>> np.random.random_sample((5,))\n array([ 0.30220482, 0.86820401, 0.1654503 , 0.11659149, 0.54323428])\n\n Three-by-two array of random numbers from [-5, 0):\n\n >>> 5 * np.random.random_sample((3, 2)) - 5\n array([[-3.99149989, -0.52338984],\n [-2.99091858, -0.79479508],\n [-1.23204345, -1.75224494]])\n\n ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_random_sample(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_8random_sample(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_8random_sample[] = "\n random_sample(size=None)\n\n Return random floats in the half-open interval [0.0, 1.0).\n\n Results are from the \"continuous uniform\" distribution over the\n stated interval. To sample :math:`Unif[a, b), b > a` multiply\n the output of `random_sample` by `(b-a)` and add `a`::\n\n (b - a) * random_sample() + a\n\n Parameters\n ----------\n size : int or tuple of ints, optional\n Defines the shape of the returned array of random floats. If None\n (the default), returns a single float.\n\n Returns\n -------\n out : float or ndarray of floats\n Array of random floats of shape `size` (unless ``size=None``, in which\n case a single float is returned).\n\n Examples\n --------\n >>> np.random.random_sample()\n 0.47108547995356098\n >>> type(np.random.random_sample())\n <type 'float'>\n >>> np.random.random_sample((5,))\n array([ 0.30220482, 0.86820401, 0.1654503 , 0.11659149, 0.54323428])\n\n Three-by-two array of random numbers from [-5, 0):\n\n >>> 5 * np.random.random_sample((3, 2)) - 5\n array([[-3.99149989, -0.52338984],\n [-2.99091858, -0.79479508],\n [-1.23204345, -1.75224494]])\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_8random_sample(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_size = 0;
PyObject *__pyx_r = NULL;
PyObject *__pyx_t_1 = NULL;
@@ -5595,13 +5676,13 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_random_sample(PyObject *__pyx_v_
}
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 0:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[0] = value; kw_args--; }
+ if (value) { values[0] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "random_sample") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "random_sample") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_size = values[0];
} else {
@@ -5614,13 +5695,14 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_random_sample(PyObject *__pyx_v_
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("random_sample", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("random_sample", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.random_sample");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- /* "mtrand.pyx":759
+ /* "mtrand.pyx":760
*
* """
* return cont0_array(self.internal_state, rk_double, size) # <<<<<<<<<<<<<<
@@ -5628,7 +5710,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_random_sample(PyObject *__pyx_v_
* def tomaxint(self, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_double, __pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_double, __pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -5646,7 +5728,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_random_sample(PyObject *__pyx_v_
return __pyx_r;
}
-/* "mtrand.pyx":761
+/* "mtrand.pyx":762
* return cont0_array(self.internal_state, rk_double, size)
*
* def tomaxint(self, size=None): # <<<<<<<<<<<<<<
@@ -5654,9 +5736,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_random_sample(PyObject *__pyx_v_
* tomaxint(size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_tomaxint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_tomaxint[] = "\n tomaxint(size=None)\n\n Random integers between 0 and ``sys.maxint``, inclusive.\n\n Return a sample of uniformly distributed random integers in the interval\n [0, ``sys.maxint``].\n\n Parameters\n ----------\n size : tuple of ints, int, optional\n Shape of output. If this is, for example, (m,n,k), m*n*k samples\n are generated. If no shape is specified, a single sample is\n returned.\n\n Returns\n -------\n out : ndarray\n Drawn samples, with shape `size`.\n\n See Also\n --------\n randint : Uniform sampling over a given half-open interval of integers.\n random_integers : Uniform sampling over a given closed interval of\n integers.\n\n Examples\n --------\n >>> RS = np.random.mtrand.RandomState() # need a RandomState object\n >>> RS.tomaxint((2,2,2))\n array([[[1170048599, 1600360186],\n [ 739731006, 1947757578]],\n [[1871712945, 752307660],\n [1601631370, 1479324245]]])\n >>> import sys\n >>> sys.maxint\n 2147483647\n >>> RS.tomaxint((2,2,2)) < sys.maxint\n array([[[ True, True],\n [ True, True]],\n [[ True, True],\n [ True, True]]], dtype=bool)\n\n ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_tomaxint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_9tomaxint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_9tomaxint[] = "\n tomaxint(size=None)\n\n Random integers between 0 and ``sys.maxint``, inclusive.\n\n Return a sample of uniformly distributed random integers in the interval\n [0, ``sys.maxint``].\n\n Parameters\n ----------\n size : tuple of ints, int, optional\n Shape of output. If this is, for example, (m,n,k), m*n*k samples\n are generated. If no shape is specified, a single sample is\n returned.\n\n Returns\n -------\n out : ndarray\n Drawn samples, with shape `size`.\n\n See Also\n --------\n randint : Uniform sampling over a given half-open interval of integers.\n random_integers : Uniform sampling over a given closed interval of\n integers.\n\n Examples\n --------\n >>> RS = np.random.mtrand.RandomState() # need a RandomState object\n >>> RS.tomaxint((2,2,2))\n array([[[1170048599, 1600360186],\n [ 739731006, 1947757578]],\n [[1871712945, 752307660],\n [1601631370, 1479324245]]])\n >>> import sys\n >>> sys.maxint\n 2147483647\n >>> RS.tomaxint((2,2,2)) < sys.maxint\n array([[[ True, True],\n [ True, True]],\n [[ True, True],\n [ True, True]]], dtype=bool)\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_9tomaxint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_size = 0;
PyObject *__pyx_r = NULL;
PyObject *__pyx_t_1 = NULL;
@@ -5673,13 +5755,13 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_tomaxint(PyObject *__pyx_v_self,
}
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 0:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[0] = value; kw_args--; }
+ if (value) { values[0] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "tomaxint") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "tomaxint") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_size = values[0];
} else {
@@ -5692,13 +5774,14 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_tomaxint(PyObject *__pyx_v_self,
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("tomaxint", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("tomaxint", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.tomaxint");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- /* "mtrand.pyx":806
+ /* "mtrand.pyx":807
*
* """
* return disc0_array(self.internal_state, rk_long, size) # <<<<<<<<<<<<<<
@@ -5706,7 +5789,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_tomaxint(PyObject *__pyx_v_self,
* def randint(self, low, high=None, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __pyx_f_6mtrand_disc0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_long, __pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_f_6mtrand_disc0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_long, __pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -5724,7 +5807,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_tomaxint(PyObject *__pyx_v_self,
return __pyx_r;
}
-/* "mtrand.pyx":808
+/* "mtrand.pyx":809
* return disc0_array(self.internal_state, rk_long, size)
*
* def randint(self, low, high=None, size=None): # <<<<<<<<<<<<<<
@@ -5732,9 +5815,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_tomaxint(PyObject *__pyx_v_self,
* randint(low, high=None, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_randint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_randint[] = "\n randint(low, high=None, size=None)\n\n Return random integers from `low` (inclusive) to `high` (exclusive).\n\n Return random integers from the \"discrete uniform\" distribution in the\n \"half-open\" interval [`low`, `high`). If `high` is None (the default),\n then results are from [0, `low`).\n\n Parameters\n ----------\n low : int\n Lowest (signed) integer to be drawn from the distribution (unless\n ``high=None``, in which case this parameter is the *highest* such\n integer).\n high : int, optional\n If provided, one above the largest (signed) integer to be drawn\n from the distribution (see above for behavior if ``high=None``).\n size : int or tuple of ints, optional\n Output shape. Default is None, in which case a single int is\n returned.\n\n Returns\n -------\n out : int or ndarray of ints\n `size`-shaped array of random integers from the appropriate\n distribution, or a single such random int if `size` not provided.\n\n See Also\n --------\n random.random_integers : similar to `randint`, only for the closed\n interval [`low`, `high`], and 1 is the lowest value if `high` is\n omitted. In particular, this other one is the one to use to generate\n uniformly distributed discrete non-integers.\n\n Examples\n --------\n >>> np.random.randint(2, size=10)\n array([1, 0, 0, 0, 1, 1, 0, 0, 1, 0])\n >>> np.random.randint(1, size=10)\n array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])\n\n Generate a 2 x 4 array of ints between 0 and 4, inclusive:\n\n >>> np.random.randint(5, size=(2, 4))\n array([[4, 0, 2, 1],\n [3, 2, 2, 0]])\n\n ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_randint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_10randint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_10randint[] = "\n randint(low, high=None, size=None)\n\n Return random integers from `low` (inclusive) to `high` (exclusive).\n\n Return random integers from the \"discrete uniform\" distribution in the\n \"half-open\" interval [`low`, `high`). If `high` is None (the default),\n then results are from [0, `low`).\n\n Parameters\n ----------\n low : int\n Lowest (signed) integer to be drawn from the distribution (unless\n ``high=None``, in which case this parameter is the *highest* such\n integer).\n high : int, optional\n If provided, one above the largest (signed) integer to be drawn\n from the distribution (see above for behavior if ``high=None``).\n size : int or tuple of ints, optional\n Output shape. Default is None, in which case a single int is\n returned.\n\n Returns\n -------\n out : int or ndarray of ints\n `size`-shaped array of random integers from the appropriate\n distribution, or a single such random int if `size` not provided.\n\n See Also\n --------\n random.random_integers : similar to `randint`, only for the closed\n interval [`low`, `high`], and 1 is the lowest value if `high` is\n omitted. In particular, this other one is the one to use to generate\n uniformly distributed discrete non-integers.\n\n Examples\n --------\n >>> np.random.randint(2, size=10)\n array([1, 0, 0, 0, 1, 1, 0, 0, 1, 0])\n >>> np.random.randint(1, size=10)\n array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])\n\n Generate a 2 x 4 array of ints between 0 and 4, inclusive:\n\n >>> np.random.randint(5, size=(2, 4))\n array([[4, 0, 2, 1],\n [3, 2, 2, 0]])\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_10randint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_low = 0;
PyObject *__pyx_v_high = 0;
PyObject *__pyx_v_size = 0;
@@ -5772,18 +5855,18 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_randint(PyObject *__pyx_v_self,
if (likely(values[0])) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__high);
- if (unlikely(value)) { values[1] = value; kw_args--; }
+ if (value) { values[1] = value; kw_args--; }
}
case 2:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[2] = value; kw_args--; }
+ if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "randint") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "randint") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_low = values[0];
__pyx_v_high = values[1];
@@ -5801,18 +5884,15 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_randint(PyObject *__pyx_v_self,
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("randint", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("randint", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.randint");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_low);
- __Pyx_INCREF(__pyx_v_high);
- __Pyx_INCREF(__pyx_v_size);
arrayObject = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":865
+ /* "mtrand.pyx":866
* cdef long i
*
* if high is None: # <<<<<<<<<<<<<<
@@ -5822,7 +5902,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_randint(PyObject *__pyx_v_self,
__pyx_t_1 = (__pyx_v_high == Py_None);
if (__pyx_t_1) {
- /* "mtrand.pyx":866
+ /* "mtrand.pyx":867
*
* if high is None:
* lo = 0 # <<<<<<<<<<<<<<
@@ -5831,42 +5911,42 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_randint(PyObject *__pyx_v_self,
*/
__pyx_v_lo = 0;
- /* "mtrand.pyx":867
+ /* "mtrand.pyx":868
* if high is None:
* lo = 0
* hi = low # <<<<<<<<<<<<<<
* else:
* lo = low
*/
- __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 = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_hi = __pyx_t_2;
goto __pyx_L6;
}
/*else*/ {
- /* "mtrand.pyx":869
+ /* "mtrand.pyx":870
* hi = low
* else:
* lo = low # <<<<<<<<<<<<<<
* hi = high
*
*/
- __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 = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_lo = __pyx_t_2;
- /* "mtrand.pyx":870
+ /* "mtrand.pyx":871
* else:
* lo = low
* hi = high # <<<<<<<<<<<<<<
*
* if lo >= hi :
*/
- __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_v_high); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_v_high); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_hi = __pyx_t_2;
}
__pyx_L6:;
- /* "mtrand.pyx":872
+ /* "mtrand.pyx":873
* hi = high
*
* if lo >= hi : # <<<<<<<<<<<<<<
@@ -5876,29 +5956,23 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_randint(PyObject *__pyx_v_self,
__pyx_t_1 = (__pyx_v_lo >= __pyx_v_hi);
if (__pyx_t_1) {
- /* "mtrand.pyx":873
+ /* "mtrand.pyx":874
*
* if lo >= hi :
* raise ValueError("low >= high") # <<<<<<<<<<<<<<
*
* diff = <unsigned long>hi - <unsigned long>lo - 1UL
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_4));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_4));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4));
- __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_Raise(__pyx_t_3, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_4, 0, 0);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":875
+ /* "mtrand.pyx":876
* raise ValueError("low >= high")
*
* diff = <unsigned long>hi - <unsigned long>lo - 1UL # <<<<<<<<<<<<<<
@@ -5907,7 +5981,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_randint(PyObject *__pyx_v_self,
*/
__pyx_v_diff = ((((unsigned long)__pyx_v_hi) - ((unsigned long)__pyx_v_lo)) - 1UL);
- /* "mtrand.pyx":876
+ /* "mtrand.pyx":877
*
* diff = <unsigned long>hi - <unsigned long>lo - 1UL
* if size is None: # <<<<<<<<<<<<<<
@@ -5917,7 +5991,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_randint(PyObject *__pyx_v_self,
__pyx_t_1 = (__pyx_v_size == Py_None);
if (__pyx_t_1) {
- /* "mtrand.pyx":877
+ /* "mtrand.pyx":878
* diff = <unsigned long>hi - <unsigned long>lo - 1UL
* if size is None:
* rv = lo + <long>rk_interval(diff, self. internal_state) # <<<<<<<<<<<<<<
@@ -5926,7 +6000,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_randint(PyObject *__pyx_v_self,
*/
__pyx_v_rv = (__pyx_v_lo + ((long)rk_interval(__pyx_v_diff, ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state)));
- /* "mtrand.pyx":878
+ /* "mtrand.pyx":879
* if size is None:
* rv = lo + <long>rk_interval(diff, self. internal_state)
* return rv # <<<<<<<<<<<<<<
@@ -5934,45 +6008,45 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_randint(PyObject *__pyx_v_self,
* array = <ndarray>np.empty(size, int)
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_4 = PyInt_FromLong(__pyx_v_rv); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_r = __pyx_t_4;
- __pyx_t_4 = 0;
+ __pyx_t_3 = PyInt_FromLong(__pyx_v_rv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_r = __pyx_t_3;
+ __pyx_t_3 = 0;
goto __pyx_L0;
goto __pyx_L8;
}
/*else*/ {
- /* "mtrand.pyx":880
+ /* "mtrand.pyx":881
* return rv
* else:
* array = <ndarray>np.empty(size, int) # <<<<<<<<<<<<<<
* length = PyArray_SIZE(array)
* array_data = <long *>array.data
*/
- __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __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 = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
__Pyx_INCREF(__pyx_v_size);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_size);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_size);
__Pyx_GIVEREF(__pyx_v_size);
- __Pyx_INCREF(((PyObject *)((PyObject*)&PyInt_Type)));
- PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)((PyObject*)&PyInt_Type)));
- __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyInt_Type)));
- __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)((PyObject*)(&PyInt_Type))));
+ __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_5)));
__Pyx_DECREF(((PyObject *)arrayObject));
arrayObject = ((PyArrayObject *)__pyx_t_5);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- /* "mtrand.pyx":881
+ /* "mtrand.pyx":882
* else:
* array = <ndarray>np.empty(size, int)
* length = PyArray_SIZE(array) # <<<<<<<<<<<<<<
@@ -5981,7 +6055,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_randint(PyObject *__pyx_v_self,
*/
__pyx_v_length = PyArray_SIZE(arrayObject);
- /* "mtrand.pyx":882
+ /* "mtrand.pyx":883
* array = <ndarray>np.empty(size, int)
* length = PyArray_SIZE(array)
* array_data = <long *>array.data # <<<<<<<<<<<<<<
@@ -5990,7 +6064,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_randint(PyObject *__pyx_v_self,
*/
__pyx_v_array_data = ((long *)arrayObject->data);
- /* "mtrand.pyx":883
+ /* "mtrand.pyx":884
* length = PyArray_SIZE(array)
* array_data = <long *>array.data
* for i from 0 <= i < length: # <<<<<<<<<<<<<<
@@ -6000,7 +6074,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_randint(PyObject *__pyx_v_self,
__pyx_t_2 = __pyx_v_length;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) {
- /* "mtrand.pyx":884
+ /* "mtrand.pyx":885
* array_data = <long *>array.data
* for i from 0 <= i < length:
* rv = lo + <long>rk_interval(diff, self. internal_state) # <<<<<<<<<<<<<<
@@ -6009,7 +6083,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_randint(PyObject *__pyx_v_self,
*/
__pyx_v_rv = (__pyx_v_lo + ((long)rk_interval(__pyx_v_diff, ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state)));
- /* "mtrand.pyx":885
+ /* "mtrand.pyx":886
* for i from 0 <= i < length:
* rv = lo + <long>rk_interval(diff, self. internal_state)
* array_data[i] = rv # <<<<<<<<<<<<<<
@@ -6019,7 +6093,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_randint(PyObject *__pyx_v_self,
(__pyx_v_array_data[__pyx_v_i]) = __pyx_v_rv;
}
- /* "mtrand.pyx":886
+ /* "mtrand.pyx":887
* rv = lo + <long>rk_interval(diff, self. internal_state)
* array_data[i] = rv
* return array # <<<<<<<<<<<<<<
@@ -6043,16 +6117,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_randint(PyObject *__pyx_v_self,
__pyx_r = NULL;
__pyx_L0:;
__Pyx_DECREF((PyObject *)arrayObject);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_low);
- __Pyx_DECREF(__pyx_v_high);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":888
+/* "mtrand.pyx":889
* return array
*
* def bytes(self, unsigned int length): # <<<<<<<<<<<<<<
@@ -6060,9 +6130,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_randint(PyObject *__pyx_v_self,
* bytes(length)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_bytes(PyObject *__pyx_v_self, PyObject *__pyx_arg_length); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_bytes[] = "\n bytes(length)\n\n Return random bytes.\n\n Parameters\n ----------\n length : int\n Number of random bytes.\n\n Returns\n -------\n out : str\n String of length `length`.\n\n Examples\n --------\n >>> np.random.bytes(10)\n ' eh\\x85\\x022SZ\\xbf\\xa4' #random\n\n ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_bytes(PyObject *__pyx_v_self, PyObject *__pyx_arg_length) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_11bytes(PyObject *__pyx_v_self, PyObject *__pyx_arg_length); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_11bytes[] = "\n bytes(length)\n\n Return random bytes.\n\n Parameters\n ----------\n length : int\n Number of random bytes.\n\n Returns\n -------\n out : str\n String of length `length`.\n\n Examples\n --------\n >>> np.random.bytes(10)\n ' eh\\x85\\x022SZ\\xbf\\xa4' #random\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_11bytes(PyObject *__pyx_v_self, PyObject *__pyx_arg_length) {
unsigned int __pyx_v_length;
void *__pyx_v_bytes;
PyObject *__pyx_v_bytestring;
@@ -6070,29 +6140,30 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_bytes(PyObject *__pyx_v_self, Py
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("bytes");
assert(__pyx_arg_length); {
- __pyx_v_length = __Pyx_PyInt_AsUnsignedInt(__pyx_arg_length); if (unlikely((__pyx_v_length == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_length = __Pyx_PyInt_AsUnsignedInt(__pyx_arg_length); if (unlikely((__pyx_v_length == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.bytes");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_v_bytestring = Py_None; __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":911
+ /* "mtrand.pyx":912
* """
* cdef void *bytes
* bytestring = empty_py_bytes(length, &bytes) # <<<<<<<<<<<<<<
* rk_fill(bytes, length, self.internal_state)
* return bytestring
*/
- __pyx_t_1 = empty_py_bytes(__pyx_v_length, (&__pyx_v_bytes)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = empty_py_bytes(__pyx_v_length, (&__pyx_v_bytes)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_v_bytestring);
__pyx_v_bytestring = __pyx_t_1;
__pyx_t_1 = 0;
- /* "mtrand.pyx":912
+ /* "mtrand.pyx":913
* cdef void *bytes
* bytestring = empty_py_bytes(length, &bytes)
* rk_fill(bytes, length, self.internal_state) # <<<<<<<<<<<<<<
@@ -6101,7 +6172,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_bytes(PyObject *__pyx_v_self, Py
*/
rk_fill(__pyx_v_bytes, __pyx_v_length, ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);
- /* "mtrand.pyx":913
+ /* "mtrand.pyx":914
* bytestring = empty_py_bytes(length, &bytes)
* rk_fill(bytes, length, self.internal_state)
* return bytestring # <<<<<<<<<<<<<<
@@ -6126,7 +6197,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_bytes(PyObject *__pyx_v_self, Py
return __pyx_r;
}
-/* "mtrand.pyx":915
+/* "mtrand.pyx":916
* return bytestring
*
* def uniform(self, low=0.0, high=1.0, size=None): # <<<<<<<<<<<<<<
@@ -6134,9 +6205,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_bytes(PyObject *__pyx_v_self, Py
* uniform(low=0.0, high=1.0, size=1)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_uniform[] = "\n"" uniform(low=0.0, high=1.0, size=1)\n""\n"" Draw samples from a uniform distribution.\n""\n"" Samples are uniformly distributed over the half-open interval\n"" ``[low, high)`` (includes low, but excludes high). In other words,\n"" any value within the given interval is equally likely to be drawn\n"" by `uniform`.\n""\n"" Parameters\n"" ----------\n"" low : float, optional\n"" Lower boundary of the output interval. All values generated will be\n"" greater than or equal to low. The default value is 0.\n"" high : float\n"" Upper boundary of the output interval. All values generated will be\n"" less than high. The default value is 1.0.\n"" size : int or tuple of ints, optional\n"" Shape of output. If the given size is, for example, (m,n,k),\n"" m*n*k samples are generated. If no shape is specified, a single sample\n"" is returned.\n""\n"" Returns\n"" -------\n"" out : ndarray\n"" Drawn samples, with shape `size`.\n""\n"" See Also\n"" --------\n"" randint : Discrete uniform distribution, yielding integers.\n"" random_integers : Discrete uniform distribution over the closed\n"" interval ``[low, high]``.\n"" random_sample : Floats uniformly distributed over ``[0, 1)``.\n"" random : Alias for `random_sample`.\n"" rand : Convenience function that accepts dimensions as input, e.g.,\n"" ``rand(2,2)`` would generate a 2-by-2 array of floats,\n"" uniformly distributed over ``[0, 1)``.\n""\n"" Notes\n"" -----\n"" The probability density function of the uniform distribution is\n""\n"" .. math:: p(x) = \\frac{1}{b - a}\n""\n"" anywhere within the interval ``[a, b)``, and zero elsewhere.\n""\n"" Examples\n"" --------\n"" Draw samples from the distribution:\n""\n"" >>> s = np.random.uniform(-1,0,1000)\n""\n"" All values are within the given interval:\n""\n"" >>> np.all(s >= -1)\n"" True\n"" >>> np.all(s < 0)\n"" True\n""\n"" Display the histogram of the samples, along with the\n"" probability density function:\n""\n"" >>> import matplotlib.pyplot as plt\n"" >>> count, bins, ignored = plt.hist(s, 15, normed=True)\n"" >>> plt.plot(bins, np.ones_like(bins), linewidth=2, color='r')\n"" >>> plt.show()\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_12uniform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_12uniform[] = "\n uniform(low=0.0, high=1.0, size=1)\n\n Draw samples from a uniform distribution.\n\n Samples are uniformly distributed over the half-open interval\n ``[low, high)`` (includes low, but excludes high). In other words,\n any value within the given interval is equally likely to be drawn\n by `uniform`.\n\n Parameters\n ----------\n low : float, optional\n Lower boundary of the output interval. All values generated will be\n greater than or equal to low. The default value is 0.\n high : float\n Upper boundary of the output interval. All values generated will be\n less than high. The default value is 1.0.\n size : int or tuple of ints, optional\n Shape of output. If the given size is, for example, (m,n,k),\n m*n*k samples are generated. If no shape is specified, a single sample\n is returned.\n\n Returns\n -------\n out : ndarray\n Drawn samples, with shape `size`.\n\n See Also\n --------\n randint : Discrete uniform distribution, yielding integers.\n random_integers : Discrete uniform distribution over the closed\n interval ``[low, high]``.\n random_sample : Floats uniformly distributed over ``[0, 1)``.\n random : Alias for `random_sample`.\n rand : Convenience function that accepts dimensions as input, e.g.,\n ``rand(2,2)`` would generate a 2-by-2 array of floats,\n uniformly distributed over ``[0, 1)``.\n\n Notes\n -----\n The probability density function of the uniform distribution is\n\n .. math:: p(x) = \\frac{1}{b - a}\n\n anywhere within the interval ``[a, b)``, and zero elsewhere.\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> s = np.random.uniform(-1,0,1000)\n\n All values are w""ithin the given interval:\n\n >>> np.all(s >= -1)\n True\n >>> np.all(s < 0)\n True\n\n Display the histogram of the samples, along with the\n probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> count, bins, ignored = plt.hist(s, 15, normed=True)\n >>> plt.plot(bins, np.ones_like(bins), linewidth=2, color='r')\n >>> plt.show()\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_12uniform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_low = 0;
PyObject *__pyx_v_high = 0;
PyObject *__pyx_v_size = 0;
@@ -6156,8 +6227,8 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self,
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
PyObject* values[3] = {0,0,0};
- values[0] = __pyx_k_5;
- values[1] = __pyx_k_6;
+ values[0] = __pyx_k_15;
+ values[1] = __pyx_k_16;
values[2] = ((PyObject *)Py_None);
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
@@ -6168,30 +6239,30 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self,
}
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 0:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__low);
- if (unlikely(value)) { values[0] = value; kw_args--; }
+ if (value) { values[0] = value; kw_args--; }
}
case 1:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__high);
- if (unlikely(value)) { values[1] = value; kw_args--; }
+ if (value) { values[1] = value; kw_args--; }
}
case 2:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[2] = value; kw_args--; }
+ if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "uniform") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "uniform") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_low = values[0];
__pyx_v_high = values[1];
__pyx_v_size = values[2];
} else {
- __pyx_v_low = __pyx_k_5;
- __pyx_v_high = __pyx_k_6;
+ __pyx_v_low = __pyx_k_15;
+ __pyx_v_high = __pyx_k_16;
__pyx_v_size = ((PyObject *)Py_None);
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: __pyx_v_size = PyTuple_GET_ITEM(__pyx_args, 2);
@@ -6203,21 +6274,18 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self,
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("uniform", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("uniform", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.uniform");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_low);
- __Pyx_INCREF(__pyx_v_high);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_olow = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_ohigh = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_odiff = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_temp = Py_None; __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":989
+ /* "mtrand.pyx":990
* cdef object temp
*
* flow = PyFloat_AsDouble(low) # <<<<<<<<<<<<<<
@@ -6226,7 +6294,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self,
*/
__pyx_v_flow = PyFloat_AsDouble(__pyx_v_low);
- /* "mtrand.pyx":990
+ /* "mtrand.pyx":991
*
* flow = PyFloat_AsDouble(low)
* fhigh = PyFloat_AsDouble(high) # <<<<<<<<<<<<<<
@@ -6235,7 +6303,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self,
*/
__pyx_v_fhigh = PyFloat_AsDouble(__pyx_v_high);
- /* "mtrand.pyx":991
+ /* "mtrand.pyx":992
* flow = PyFloat_AsDouble(low)
* fhigh = PyFloat_AsDouble(high)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -6245,7 +6313,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self,
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":992
+ /* "mtrand.pyx":993
* fhigh = PyFloat_AsDouble(high)
* if not PyErr_Occurred():
* return cont2_array_sc(self.internal_state, rk_uniform, size, flow, fhigh-flow) # <<<<<<<<<<<<<<
@@ -6253,7 +6321,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self,
* olow = <ndarray>PyArray_FROM_OTF(low, NPY_DOUBLE, NPY_ALIGNED)
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_uniform, __pyx_v_size, __pyx_v_flow, (__pyx_v_fhigh - __pyx_v_flow)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_uniform, __pyx_v_size, __pyx_v_flow, (__pyx_v_fhigh - __pyx_v_flow)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
@@ -6262,7 +6330,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self,
}
__pyx_L6:;
- /* "mtrand.pyx":993
+ /* "mtrand.pyx":994
* if not PyErr_Occurred():
* return cont2_array_sc(self.internal_state, rk_uniform, size, flow, fhigh-flow)
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -6271,63 +6339,63 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self,
*/
PyErr_Clear();
- /* "mtrand.pyx":994
+ /* "mtrand.pyx":995
* return cont2_array_sc(self.internal_state, rk_uniform, size, flow, fhigh-flow)
* PyErr_Clear()
* olow = <ndarray>PyArray_FROM_OTF(low, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* ohigh = <ndarray>PyArray_FROM_OTF(high, NPY_DOUBLE, NPY_ALIGNED)
* temp = np.subtract(ohigh, olow)
*/
- __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_low, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_low, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_olow));
__pyx_v_olow = ((PyArrayObject *)__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":995
+ /* "mtrand.pyx":996
* PyErr_Clear()
* olow = <ndarray>PyArray_FROM_OTF(low, NPY_DOUBLE, NPY_ALIGNED)
* ohigh = <ndarray>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
*/
- __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_high, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_high, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_ohigh));
__pyx_v_ohigh = ((PyArrayObject *)__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":996
+ /* "mtrand.pyx":997
* olow = <ndarray>PyArray_FROM_OTF(low, NPY_DOUBLE, NPY_ALIGNED)
* ohigh = <ndarray>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
* # rules because EnsureArray steals a reference
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__subtract); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__subtract); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(((PyObject *)__pyx_v_ohigh));
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_ohigh));
__Pyx_GIVEREF(((PyObject *)__pyx_v_ohigh));
__Pyx_INCREF(((PyObject *)__pyx_v_olow));
PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_olow));
__Pyx_GIVEREF(((PyObject *)__pyx_v_olow));
- __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_v_temp);
__pyx_v_temp = __pyx_t_4;
__pyx_t_4 = 0;
- /* "mtrand.pyx":997
+ /* "mtrand.pyx":998
* ohigh = <ndarray>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 # <<<<<<<<<<<<<<
@@ -6336,21 +6404,21 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self,
*/
Py_INCREF(__pyx_v_temp);
- /* "mtrand.pyx":999
+ /* "mtrand.pyx":1000
* Py_INCREF(temp) # needed to get around Pyrex's automatic reference-counting
* # rules because EnsureArray steals a reference
* odiff = <ndarray>PyArray_EnsureArray(temp) # <<<<<<<<<<<<<<
* return cont2_array(self.internal_state, rk_uniform, size, olow, odiff)
*
*/
- __pyx_t_4 = PyArray_EnsureArray(__pyx_v_temp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyArray_EnsureArray(__pyx_v_temp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_4)));
__Pyx_DECREF(((PyObject *)__pyx_v_odiff));
__pyx_v_odiff = ((PyArrayObject *)__pyx_t_4);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "mtrand.pyx":1000
+ /* "mtrand.pyx":1001
* # rules because EnsureArray steals a reference
* odiff = <ndarray>PyArray_EnsureArray(temp)
* return cont2_array(self.internal_state, rk_uniform, size, olow, odiff) # <<<<<<<<<<<<<<
@@ -6358,7 +6426,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self,
* def rand(self, *args):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_4 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_uniform, __pyx_v_size, __pyx_v_olow, __pyx_v_odiff); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_uniform, __pyx_v_size, __pyx_v_olow, __pyx_v_odiff); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
@@ -6377,16 +6445,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self,
__Pyx_DECREF((PyObject *)__pyx_v_ohigh);
__Pyx_DECREF((PyObject *)__pyx_v_odiff);
__Pyx_DECREF(__pyx_v_temp);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_low);
- __Pyx_DECREF(__pyx_v_high);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":1002
+/* "mtrand.pyx":1003
* return cont2_array(self.internal_state, rk_uniform, size, olow, odiff)
*
* def rand(self, *args): # <<<<<<<<<<<<<<
@@ -6394,9 +6458,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self,
* rand(d0, d1, ..., dn)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_rand(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_rand[] = "\n rand(d0, d1, ..., dn)\n\n Random values in a given shape.\n\n Create an array of the given shape and propagate it with\n random samples from a uniform distribution\n over ``[0, 1)``.\n\n Parameters\n ----------\n d0, d1, ..., dn : int\n Shape of the output.\n\n Returns\n -------\n out : ndarray, shape ``(d0, d1, ..., dn)``\n Random values.\n\n See Also\n --------\n random\n\n Notes\n -----\n This is a convenience function. If you want an interface that\n takes a shape-tuple as the first argument, refer to\n `random`.\n\n Examples\n --------\n >>> np.random.rand(3,2)\n array([[ 0.14022471, 0.96360618], #random\n [ 0.37601032, 0.25528411], #random\n [ 0.49313049, 0.94909878]]) #random\n\n ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_rand(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_13rand(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_13rand[] = "\n rand(d0, d1, ..., dn)\n\n Random values in a given shape.\n\n Create an array of the given shape and propagate it with\n random samples from a uniform distribution\n over ``[0, 1)``.\n\n Parameters\n ----------\n d0, d1, ..., dn : int\n Shape of the output.\n\n Returns\n -------\n out : ndarray, shape ``(d0, d1, ..., dn)``\n Random values.\n\n See Also\n --------\n random\n\n Notes\n -----\n This is a convenience function. If you want an interface that\n takes a shape-tuple as the first argument, refer to\n `random`.\n\n Examples\n --------\n >>> np.random.rand(3,2)\n array([[ 0.14022471, 0.96360618], #random\n [ 0.37601032, 0.25528411], #random\n [ 0.49313049, 0.94909878]]) #random\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_13rand(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_args = 0;
PyObject *__pyx_r = NULL;
Py_ssize_t __pyx_t_1;
@@ -6408,20 +6472,22 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_rand(PyObject *__pyx_v_self, PyO
if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "rand", 0))) return NULL;
__Pyx_INCREF(__pyx_args);
__pyx_v_args = __pyx_args;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- /* "mtrand.pyx":1040
+ /* "mtrand.pyx":1041
*
* """
* if len(args) == 0: # <<<<<<<<<<<<<<
* return self.random_sample()
* else:
*/
- __pyx_t_1 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__pyx_v_args == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __pyx_t_1 = PyTuple_GET_SIZE(((PyObject *)__pyx_v_args));
__pyx_t_2 = (__pyx_t_1 == 0);
if (__pyx_t_2) {
- /* "mtrand.pyx":1041
+ /* "mtrand.pyx":1042
* """
* if len(args) == 0:
* return self.random_sample() # <<<<<<<<<<<<<<
@@ -6429,9 +6495,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_rand(PyObject *__pyx_v_self, PyO
* return self.random_sample(size=args)
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__random_sample); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__random_sample); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
@@ -6441,7 +6507,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_rand(PyObject *__pyx_v_self, PyO
}
/*else*/ {
- /* "mtrand.pyx":1043
+ /* "mtrand.pyx":1044
* return self.random_sample()
* else:
* return self.random_sample(size=args) # <<<<<<<<<<<<<<
@@ -6449,12 +6515,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_rand(PyObject *__pyx_v_self, PyO
* def randn(self, *args):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__random_sample); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__random_sample); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
- if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__size), __pyx_v_args) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__size), ((PyObject *)__pyx_v_args)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
@@ -6474,13 +6540,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_rand(PyObject *__pyx_v_self, PyO
__pyx_r = NULL;
__pyx_L0:;
__Pyx_DECREF(__pyx_v_args);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":1045
+/* "mtrand.pyx":1046
* return self.random_sample(size=args)
*
* def randn(self, *args): # <<<<<<<<<<<<<<
@@ -6488,9 +6553,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_rand(PyObject *__pyx_v_self, PyO
* randn([d1, ..., dn])
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_randn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_randn[] = "\n randn([d1, ..., dn])\n\n Return a sample (or samples) from the \"standard normal\" distribution.\n\n If positive, int_like or int-convertible arguments are provided,\n `randn` generates an array of shape ``(d1, ..., dn)``, filled\n with random floats sampled from a univariate \"normal\" (Gaussian)\n distribution of mean 0 and variance 1 (if any of the :math:`d_i` are\n floats, they are first converted to integers by truncation). A single\n float randomly sampled from the distribution is returned if no\n argument is provided.\n\n This is a convenience function. If you want an interface that takes a\n tuple as the first argument, use `numpy.random.standard_normal` instead.\n\n Parameters\n ----------\n d1, ..., dn : `n` ints, optional\n The dimensions of the returned array, should be all positive.\n\n Returns\n -------\n Z : ndarray or float\n A ``(d1, ..., dn)``-shaped array of floating-point samples from\n the standard normal distribution, or a single such float if\n no parameters were supplied.\n\n See Also\n --------\n random.standard_normal : Similar, but takes a tuple as its argument.\n\n Notes\n -----\n For random samples from :math:`N(\\mu, \\sigma^2)`, use:\n\n ``sigma * np.random.randn(...) + mu``\n\n Examples\n --------\n >>> np.random.randn()\n 2.1923875335537315 #random\n\n Two-by-four array of samples from N(3, 6.25):\n\n >>> 2.5 * np.random.randn(2, 4) + 3\n array([[-4.49401501, 4.00950034, -1.81814867, 7.29718677], #random\n [ 0.39924804, 4.68456316, 4.99394529, 4.84057254]]) #random\n\n ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_randn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_14randn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_14randn[] = "\n randn([d1, ..., dn])\n\n Return a sample (or samples) from the \"standard normal\" distribution.\n\n If positive, int_like or int-convertible arguments are provided,\n `randn` generates an array of shape ``(d1, ..., dn)``, filled\n with random floats sampled from a univariate \"normal\" (Gaussian)\n distribution of mean 0 and variance 1 (if any of the :math:`d_i` are\n floats, they are first converted to integers by truncation). A single\n float randomly sampled from the distribution is returned if no\n argument is provided.\n\n This is a convenience function. If you want an interface that takes a\n tuple as the first argument, use `numpy.random.standard_normal` instead.\n\n Parameters\n ----------\n d1, ..., dn : `n` ints, optional\n The dimensions of the returned array, should be all positive.\n\n Returns\n -------\n Z : ndarray or float\n A ``(d1, ..., dn)``-shaped array of floating-point samples from\n the standard normal distribution, or a single such float if\n no parameters were supplied.\n\n See Also\n --------\n random.standard_normal : Similar, but takes a tuple as its argument.\n\n Notes\n -----\n For random samples from :math:`N(\\mu, \\sigma^2)`, use:\n\n ``sigma * np.random.randn(...) + mu``\n\n Examples\n --------\n >>> np.random.randn()\n 2.1923875335537315 #random\n\n Two-by-four array of samples from N(3, 6.25):\n\n >>> 2.5 * np.random.randn(2, 4) + 3\n array([[-4.49401501, 4.00950034, -1.81814867, 7.29718677], #random\n [ 0.39924804, 4.68456316, 4.99394529, 4.84057254]]) #random\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_14randn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_args = 0;
PyObject *__pyx_r = NULL;
Py_ssize_t __pyx_t_1;
@@ -6502,20 +6567,22 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_randn(PyObject *__pyx_v_self, Py
if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "randn", 0))) return NULL;
__Pyx_INCREF(__pyx_args);
__pyx_v_args = __pyx_args;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- /* "mtrand.pyx":1096
+ /* "mtrand.pyx":1097
*
* """
* if len(args) == 0: # <<<<<<<<<<<<<<
* return self.standard_normal()
* else:
*/
- __pyx_t_1 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__pyx_v_args == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __pyx_t_1 = PyTuple_GET_SIZE(((PyObject *)__pyx_v_args));
__pyx_t_2 = (__pyx_t_1 == 0);
if (__pyx_t_2) {
- /* "mtrand.pyx":1097
+ /* "mtrand.pyx":1098
* """
* if len(args) == 0:
* return self.standard_normal() # <<<<<<<<<<<<<<
@@ -6523,9 +6590,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_randn(PyObject *__pyx_v_self, Py
* return self.standard_normal(args)
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__standard_normal); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__standard_normal); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
@@ -6535,7 +6602,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_randn(PyObject *__pyx_v_self, Py
}
/*else*/ {
- /* "mtrand.pyx":1099
+ /* "mtrand.pyx":1100
* return self.standard_normal()
* else:
* return self.standard_normal(args) # <<<<<<<<<<<<<<
@@ -6543,17 +6610,17 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_randn(PyObject *__pyx_v_self, Py
* def random_integers(self, low, high=None, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__standard_normal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__standard_normal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(__pyx_v_args);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_args);
- __Pyx_GIVEREF(__pyx_v_args);
- __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+ __Pyx_INCREF(((PyObject *)__pyx_v_args));
+ PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_args));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_args));
+ __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_r = __pyx_t_5;
__pyx_t_5 = 0;
goto __pyx_L0;
@@ -6570,13 +6637,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_randn(PyObject *__pyx_v_self, Py
__pyx_r = NULL;
__pyx_L0:;
__Pyx_DECREF(__pyx_v_args);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":1101
+/* "mtrand.pyx":1102
* return self.standard_normal(args)
*
* def random_integers(self, low, high=None, size=None): # <<<<<<<<<<<<<<
@@ -6584,9 +6650,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_randn(PyObject *__pyx_v_self, Py
* random_integers(low, high=None, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_random_integers(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_random_integers[] = "\n"" random_integers(low, high=None, size=None)\n""\n"" Return random integers between `low` and `high`, inclusive.\n""\n"" Return random integers from the \"discrete uniform\" distribution in the\n"" closed interval [`low`, `high`]. If `high` is None (the default),\n"" then results are from [1, `low`].\n""\n"" Parameters\n"" ----------\n"" low : int\n"" Lowest (signed) integer to be drawn from the distribution (unless\n"" ``high=None``, in which case this parameter is the *highest* such\n"" integer).\n"" high : int, optional\n"" If provided, the largest (signed) integer to be drawn from the\n"" distribution (see above for behavior if ``high=None``).\n"" size : int or tuple of ints, optional\n"" Output shape. Default is None, in which case a single int is returned.\n""\n"" Returns\n"" -------\n"" out : int or ndarray of ints\n"" `size`-shaped array of random integers from the appropriate\n"" distribution, or a single such random int if `size` not provided.\n""\n"" See Also\n"" --------\n"" random.randint : Similar to `random_integers`, only for the half-open\n"" interval [`low`, `high`), and 0 is the lowest value if `high` is\n"" omitted.\n""\n"" Notes\n"" -----\n"" To sample from N evenly spaced floating-point numbers between a and b,\n"" use::\n""\n"" a + (b - a) * (np.random.random_integers(N) - 1) / (N - 1.)\n""\n"" Examples\n"" --------\n"" >>> np.random.random_integers(5)\n"" 4\n"" >>> type(np.random.random_integers(5))\n"" <type 'int'>\n"" >>> np.random.random_integers(5, size=(3.,2.))\n"" array([[5, 4],\n"" [3, 3],\n"" [4, 5]])\n""\n"" Choose five random numbers from the set of five evenly-spaced\n"" numbers between 0 and 2.5, inclusive (*i.e.*, from the set\n"" :math:`{0, 5/8, 10/8, 15/8, 20/8}`):\n""\n"" >>> 2.5 * (np.random.random_integers(5, size=(5,)) - 1) / 4.\n"" array([ 0.625, 1.25 , 0.625, 0.625, 2.5 ])\n""\n"" Roll two six sided dice 1000 times and sum the results:\n""\n"" >>> d1 = np.random.random_integers(1, 6, 1000)\n"" >>> d2 = np.random.random_integers(1, 6, 1000)\n"" >>> dsums = d1 + d2\n""\n"" Display results as a histogram:\n""\n"" >>> import matplotlib.pyplot as plt\n"" >>> count, bins, ignored = plt.hist(dsums, 11, normed=True)\n"" >>> plt.show()\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_random_integers(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_15random_integers(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_15random_integers[] = "\n random_integers(low, high=None, size=None)\n\n Return random integers between `low` and `high`, inclusive.\n\n Return random integers from the \"discrete uniform\" distribution in the\n closed interval [`low`, `high`]. If `high` is None (the default),\n then results are from [1, `low`].\n\n Parameters\n ----------\n low : int\n Lowest (signed) integer to be drawn from the distribution (unless\n ``high=None``, in which case this parameter is the *highest* such\n integer).\n high : int, optional\n If provided, the largest (signed) integer to be drawn from the\n distribution (see above for behavior if ``high=None``).\n size : int or tuple of ints, optional\n Output shape. Default is None, in which case a single int is returned.\n\n Returns\n -------\n out : int or ndarray of ints\n `size`-shaped array of random integers from the appropriate\n distribution, or a single such random int if `size` not provided.\n\n See Also\n --------\n random.randint : Similar to `random_integers`, only for the half-open\n interval [`low`, `high`), and 0 is the lowest value if `high` is\n omitted.\n\n Notes\n -----\n To sample from N evenly spaced floating-point numbers between a and b,\n use::\n\n a + (b - a) * (np.random.random_integers(N) - 1) / (N - 1.)\n\n Examples\n --------\n >>> np.random.random_integers(5)\n 4\n >>> type(np.random.random_integers(5))\n <type 'int'>\n >>> np.random.random_integers(5, size=(3.,2.))\n array([[5, 4],\n [3, 3],\n [4, 5]])\n\n Choose five random numbers from the set of five evenly-spaced\n numbers between 0 and 2.5, inclusive (*i.e.*, from the set\n :math:`{0, 5/8, 10/8, 15/8, 20/8}`):\n""\n >>> 2.5 * (np.random.random_integers(5, size=(5,)) - 1) / 4.\n array([ 0.625, 1.25 , 0.625, 0.625, 2.5 ])\n\n Roll two six sided dice 1000 times and sum the results:\n\n >>> d1 = np.random.random_integers(1, 6, 1000)\n >>> d2 = np.random.random_integers(1, 6, 1000)\n >>> dsums = d1 + d2\n\n Display results as a histogram:\n\n >>> import matplotlib.pyplot as plt\n >>> count, bins, ignored = plt.hist(dsums, 11, normed=True)\n >>> plt.show()\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_15random_integers(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_low = 0;
PyObject *__pyx_v_high = 0;
PyObject *__pyx_v_size = 0;
@@ -6615,18 +6681,18 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_random_integers(PyObject *__pyx_
if (likely(values[0])) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__high);
- if (unlikely(value)) { values[1] = value; kw_args--; }
+ if (value) { values[1] = value; kw_args--; }
}
case 2:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[2] = value; kw_args--; }
+ if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "random_integers") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "random_integers") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_low = values[0];
__pyx_v_high = values[1];
@@ -6644,17 +6710,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_random_integers(PyObject *__pyx_
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("random_integers", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("random_integers", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.random_integers");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
__Pyx_INCREF(__pyx_v_low);
__Pyx_INCREF(__pyx_v_high);
- __Pyx_INCREF(__pyx_v_size);
- /* "mtrand.pyx":1173
+ /* "mtrand.pyx":1174
*
* """
* if high is None: # <<<<<<<<<<<<<<
@@ -6664,7 +6729,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_random_integers(PyObject *__pyx_
__pyx_t_1 = (__pyx_v_high == Py_None);
if (__pyx_t_1) {
- /* "mtrand.pyx":1174
+ /* "mtrand.pyx":1175
* """
* if high is None:
* high = low # <<<<<<<<<<<<<<
@@ -6675,7 +6740,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_random_integers(PyObject *__pyx_
__Pyx_DECREF(__pyx_v_high);
__pyx_v_high = __pyx_v_low;
- /* "mtrand.pyx":1175
+ /* "mtrand.pyx":1176
* if high is None:
* high = low
* low = 1 # <<<<<<<<<<<<<<
@@ -6689,7 +6754,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_random_integers(PyObject *__pyx_
}
__pyx_L6:;
- /* "mtrand.pyx":1176
+ /* "mtrand.pyx":1177
* high = low
* low = 1
* return self.randint(low, high+1, size) # <<<<<<<<<<<<<<
@@ -6697,12 +6762,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_random_integers(PyObject *__pyx_
* # Complicated, continuous distributions:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__randint); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__randint); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyNumber_Add(__pyx_v_high, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyNumber_Add(__pyx_v_high, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
__Pyx_INCREF(__pyx_v_low);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_low);
__Pyx_GIVEREF(__pyx_v_low);
@@ -6712,10 +6777,10 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_random_integers(PyObject *__pyx_
PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_size);
__Pyx_GIVEREF(__pyx_v_size);
__pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
@@ -6729,16 +6794,14 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_random_integers(PyObject *__pyx_
__Pyx_AddTraceback("mtrand.RandomState.random_integers");
__pyx_r = NULL;
__pyx_L0:;
- __Pyx_DECREF((PyObject *)__pyx_v_self);
__Pyx_DECREF(__pyx_v_low);
__Pyx_DECREF(__pyx_v_high);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":1179
+/* "mtrand.pyx":1180
*
* # Complicated, continuous distributions:
* def standard_normal(self, size=None): # <<<<<<<<<<<<<<
@@ -6746,9 +6809,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_random_integers(PyObject *__pyx_
* standard_normal(size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_standard_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_standard_normal[] = "\n standard_normal(size=None)\n\n Returns samples from a Standard Normal distribution (mean=0, stdev=1).\n\n Parameters\n ----------\n size : int or tuple of ints, optional\n Output shape. Default is None, in which case a single value is\n returned.\n\n Returns\n -------\n out : float or ndarray\n Drawn samples.\n\n Examples\n --------\n >>> s = np.random.standard_normal(8000)\n >>> s\n array([ 0.6888893 , 0.78096262, -0.89086505, ..., 0.49876311, #random\n -0.38672696, -0.4685006 ]) #random\n >>> s.shape\n (8000,)\n >>> s = np.random.standard_normal(size=(3, 4, 2))\n >>> s.shape\n (3, 4, 2)\n\n ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_standard_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_16standard_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_16standard_normal[] = "\n standard_normal(size=None)\n\n Returns samples from a Standard Normal distribution (mean=0, stdev=1).\n\n Parameters\n ----------\n size : int or tuple of ints, optional\n Output shape. Default is None, in which case a single value is\n returned.\n\n Returns\n -------\n out : float or ndarray\n Drawn samples.\n\n Examples\n --------\n >>> s = np.random.standard_normal(8000)\n >>> s\n array([ 0.6888893 , 0.78096262, -0.89086505, ..., 0.49876311, #random\n -0.38672696, -0.4685006 ]) #random\n >>> s.shape\n (8000,)\n >>> s = np.random.standard_normal(size=(3, 4, 2))\n >>> s.shape\n (3, 4, 2)\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_16standard_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_size = 0;
PyObject *__pyx_r = NULL;
PyObject *__pyx_t_1 = NULL;
@@ -6765,13 +6828,13 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_normal(PyObject *__pyx_
}
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 0:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[0] = value; kw_args--; }
+ if (value) { values[0] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "standard_normal") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "standard_normal") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_size = values[0];
} else {
@@ -6784,13 +6847,14 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_normal(PyObject *__pyx_
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("standard_normal", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("standard_normal", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.standard_normal");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- /* "mtrand.pyx":1209
+ /* "mtrand.pyx":1210
*
* """
* return cont0_array(self.internal_state, rk_gauss, size) # <<<<<<<<<<<<<<
@@ -6798,7 +6862,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_normal(PyObject *__pyx_
* def normal(self, loc=0.0, scale=1.0, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_gauss, __pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_gauss, __pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -6816,7 +6880,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_normal(PyObject *__pyx_
return __pyx_r;
}
-/* "mtrand.pyx":1211
+/* "mtrand.pyx":1212
* return cont0_array(self.internal_state, rk_gauss, size)
*
* def normal(self, loc=0.0, scale=1.0, size=None): # <<<<<<<<<<<<<<
@@ -6824,9 +6888,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_normal(PyObject *__pyx_
* normal(loc=0.0, scale=1.0, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_normal[] = "\n"" normal(loc=0.0, scale=1.0, size=None)\n""\n"" Draw random samples from a normal (Gaussian) distribution.\n""\n"" The probability density function of the normal distribution, first\n"" derived by De Moivre and 200 years later by both Gauss and Laplace\n"" independently [2]_, is often called the bell curve because of\n"" its characteristic shape (see the example below).\n""\n"" The normal distributions occurs often in nature. For example, it\n"" describes the commonly occurring distribution of samples influenced\n"" by a large number of tiny, random disturbances, each with its own\n"" unique distribution [2]_.\n""\n"" Parameters\n"" ----------\n"" loc : float\n"" Mean (\"centre\") of the distribution.\n"" scale : float\n"" Standard deviation (spread or \"width\") of the distribution.\n"" size : tuple of ints\n"" Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n"" ``m * n * k`` samples are drawn.\n""\n"" See Also\n"" --------\n"" scipy.stats.distributions.norm : probability density function,\n"" distribution or cumulative density function, etc.\n""\n"" Notes\n"" -----\n"" The probability density for the Gaussian distribution is\n""\n"" .. math:: p(x) = \\frac{1}{\\sqrt{ 2 \\pi \\sigma^2 }}\n"" e^{ - \\frac{ (x - \\mu)^2 } {2 \\sigma^2} },\n""\n"" where :math:`\\mu` is the mean and :math:`\\sigma` the standard deviation.\n"" The square of the standard deviation, :math:`\\sigma^2`, is called the\n"" variance.\n""\n"" The function has its peak at the mean, and its \"spread\" increases with\n"" the standard deviation (the function reaches 0.607 times its maximum at\n"" :math:`x + \\sigma` and :math:`x - \\sigma` [2]_). This implies that\n"" `numpy.random.normal` is more likely to return samples lying close to the\n"" mean, rather than those far away.\n""\n"" References\n"" ----------\n"" .. [1] Wikipedia, \"Normal distribution\",\n"" http://en.wikipedia.org/wiki/Normal_distribution\n"" .. [2] P. R. Peebles Jr., \"Central Limit Theorem\" in \"Probability, Random\n"" Variables and Random Signal Principles\", 4th ed., 2001,\n"" pp. 51, 51, 125.\n""\n"" Examples\n"" --------\n"" Draw samples from the distribution:\n""\n"" >>> mu, sigma = 0, 0.1 # mean and standard deviation\n"" >>> s = np.random.normal(mu, sigma, 1000)\n""\n"" Verify the mean and the variance:\n""\n"" >>> abs(mu - np.mean(s)) < 0.01\n"" True\n""\n"" >>> abs(sigma - np.std(s, ddof=1)) < 0.01\n"" True\n""\n"" Display the histogram of the samples, along with\n"" the probability density function:\n""\n"" >>> import matplotlib.pyplot as plt\n"" >>> count, bins, ignored = plt.hist(s, 30, normed=True)\n"" >>> plt.plot(bins, 1/(sigma * np.sqrt(2 * np.pi)) *\n"" ... np.exp( - (bins - mu)**2 / (2 * sigma**2) ),\n"" ... linewidth=2, color='r')\n"" >>> plt.show()\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_17normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_17normal[] = "\n normal(loc=0.0, scale=1.0, size=None)\n\n Draw random samples from a normal (Gaussian) distribution.\n\n The probability density function of the normal distribution, first\n derived by De Moivre and 200 years later by both Gauss and Laplace\n independently [2]_, is often called the bell curve because of\n its characteristic shape (see the example below).\n\n The normal distributions occurs often in nature. For example, it\n describes the commonly occurring distribution of samples influenced\n by a large number of tiny, random disturbances, each with its own\n unique distribution [2]_.\n\n Parameters\n ----------\n loc : float\n Mean (\"centre\") of the distribution.\n scale : float\n Standard deviation (spread or \"width\") of the distribution.\n size : tuple of ints\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n See Also\n --------\n scipy.stats.distributions.norm : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the Gaussian distribution is\n\n .. math:: p(x) = \\frac{1}{\\sqrt{ 2 \\pi \\sigma^2 }}\n e^{ - \\frac{ (x - \\mu)^2 } {2 \\sigma^2} },\n\n where :math:`\\mu` is the mean and :math:`\\sigma` the standard deviation.\n The square of the standard deviation, :math:`\\sigma^2`, is called the\n variance.\n\n The function has its peak at the mean, and its \"spread\" increases with\n the standard deviation (the function reaches 0.607 times its maximum at\n :math:`x + \\sigma` and :math:`x - \\sigma` [2]_). This implies that\n `numpy.random.normal` is more likely to return samples lying close to the\n mean, rather than those far away.\n""\n References\n ----------\n .. [1] Wikipedia, \"Normal distribution\",\n http://en.wikipedia.org/wiki/Normal_distribution\n .. [2] P. R. Peebles Jr., \"Central Limit Theorem\" in \"Probability, Random\n Variables and Random Signal Principles\", 4th ed., 2001,\n pp. 51, 51, 125.\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> mu, sigma = 0, 0.1 # mean and standard deviation\n >>> s = np.random.normal(mu, sigma, 1000)\n\n Verify the mean and the variance:\n\n >>> abs(mu - np.mean(s)) < 0.01\n True\n\n >>> abs(sigma - np.std(s, ddof=1)) < 0.01\n True\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> count, bins, ignored = plt.hist(s, 30, normed=True)\n >>> plt.plot(bins, 1/(sigma * np.sqrt(2 * np.pi)) *\n ... np.exp( - (bins - mu)**2 / (2 * sigma**2) ),\n ... linewidth=2, color='r')\n >>> plt.show()\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_17normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_loc = 0;
PyObject *__pyx_v_scale = 0;
PyObject *__pyx_v_size = 0;
@@ -6845,8 +6909,8 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, P
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
PyObject* values[3] = {0,0,0};
- values[0] = __pyx_k_7;
- values[1] = __pyx_k_8;
+ values[0] = __pyx_k_17;
+ values[1] = __pyx_k_18;
values[2] = ((PyObject *)Py_None);
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
@@ -6857,30 +6921,30 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, P
}
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 0:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__loc);
- if (unlikely(value)) { values[0] = value; kw_args--; }
+ if (value) { values[0] = value; kw_args--; }
}
case 1:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scale);
- if (unlikely(value)) { values[1] = value; kw_args--; }
+ if (value) { values[1] = value; kw_args--; }
}
case 2:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[2] = value; kw_args--; }
+ if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "normal") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "normal") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_loc = values[0];
__pyx_v_scale = values[1];
__pyx_v_size = values[2];
} else {
- __pyx_v_loc = __pyx_k_7;
- __pyx_v_scale = __pyx_k_8;
+ __pyx_v_loc = __pyx_k_17;
+ __pyx_v_scale = __pyx_k_18;
__pyx_v_size = ((PyObject *)Py_None);
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: __pyx_v_size = PyTuple_GET_ITEM(__pyx_args, 2);
@@ -6892,19 +6956,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, P
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("normal", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("normal", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.normal");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_loc);
- __Pyx_INCREF(__pyx_v_scale);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_oloc = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_oscale = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":1296
+ /* "mtrand.pyx":1297
* cdef double floc, fscale
*
* floc = PyFloat_AsDouble(loc) # <<<<<<<<<<<<<<
@@ -6913,7 +6974,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, P
*/
__pyx_v_floc = PyFloat_AsDouble(__pyx_v_loc);
- /* "mtrand.pyx":1297
+ /* "mtrand.pyx":1298
*
* floc = PyFloat_AsDouble(loc)
* fscale = PyFloat_AsDouble(scale) # <<<<<<<<<<<<<<
@@ -6922,7 +6983,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, P
*/
__pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale);
- /* "mtrand.pyx":1298
+ /* "mtrand.pyx":1299
* floc = PyFloat_AsDouble(loc)
* fscale = PyFloat_AsDouble(scale)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -6932,39 +6993,33 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, P
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":1299
+ /* "mtrand.pyx":1300
* fscale = PyFloat_AsDouble(scale)
* if not PyErr_Occurred():
* if fscale <= 0: # <<<<<<<<<<<<<<
* raise ValueError("scale <= 0")
* return cont2_array_sc(self.internal_state, rk_normal, size, floc, fscale)
*/
- __pyx_t_1 = (__pyx_v_fscale <= 0);
+ __pyx_t_1 = (__pyx_v_fscale <= 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":1300
+ /* "mtrand.pyx":1301
* if not PyErr_Occurred():
* if fscale <= 0:
* raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
* return cont2_array_sc(self.internal_state, rk_normal, size, floc, fscale)
*
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_9));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":1301
+ /* "mtrand.pyx":1302
* if fscale <= 0:
* raise ValueError("scale <= 0")
* return cont2_array_sc(self.internal_state, rk_normal, size, floc, fscale) # <<<<<<<<<<<<<<
@@ -6972,16 +7027,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, P
* PyErr_Clear()
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_normal, __pyx_v_size, __pyx_v_floc, __pyx_v_fscale); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_normal, __pyx_v_size, __pyx_v_floc, __pyx_v_fscale); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L6;
}
__pyx_L6:;
- /* "mtrand.pyx":1303
+ /* "mtrand.pyx":1304
* return cont2_array_sc(self.internal_state, rk_normal, size, floc, fscale)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -6990,99 +7045,93 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, P
*/
PyErr_Clear();
- /* "mtrand.pyx":1305
+ /* "mtrand.pyx":1306
* PyErr_Clear()
*
* oloc = <ndarray>PyArray_FROM_OTF(loc, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* oscale = <ndarray>PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(oscale, 0)):
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_loc, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_loc, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_oloc));
- __pyx_v_oloc = ((PyArrayObject *)__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_oloc = ((PyArrayObject *)__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":1306
+ /* "mtrand.pyx":1307
*
* oloc = <ndarray>PyArray_FROM_OTF(loc, NPY_DOUBLE, NPY_ALIGNED)
* oscale = <ndarray>PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* if np.any(np.less_equal(oscale, 0)):
* raise ValueError("scale <= 0")
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_scale, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_scale, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_oscale));
- __pyx_v_oscale = ((PyArrayObject *)__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_oscale = ((PyArrayObject *)__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":1307
+ /* "mtrand.pyx":1308
* oloc = <ndarray>PyArray_FROM_OTF(loc, NPY_DOUBLE, NPY_ALIGNED)
* oscale = <ndarray>PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(oscale, 0)): # <<<<<<<<<<<<<<
* raise ValueError("scale <= 0")
* return cont2_array(self.internal_state, rk_normal, size, oloc, oscale)
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(((PyObject *)__pyx_v_oscale));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_oscale));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_oscale));
__Pyx_GIVEREF(((PyObject *)__pyx_v_oscale));
__Pyx_INCREF(__pyx_int_0);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
- __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":1308
+ /* "mtrand.pyx":1309
* oscale = <ndarray>PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(oscale, 0)):
* raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
* return cont2_array(self.internal_state, rk_normal, size, oloc, oscale)
*
*/
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_9));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_5, 0, 0);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":1309
+ /* "mtrand.pyx":1310
* if np.any(np.less_equal(oscale, 0)):
* raise ValueError("scale <= 0")
* return cont2_array(self.internal_state, rk_normal, size, oloc, oscale) # <<<<<<<<<<<<<<
@@ -7090,10 +7139,10 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, P
* def beta(self, a, b, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_normal, __pyx_v_size, __pyx_v_oloc, __pyx_v_oscale); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_5 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_normal, __pyx_v_size, __pyx_v_oloc, __pyx_v_oscale); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_r = __pyx_t_5;
+ __pyx_t_5 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -7108,16 +7157,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, P
__pyx_L0:;
__Pyx_DECREF((PyObject *)__pyx_v_oloc);
__Pyx_DECREF((PyObject *)__pyx_v_oscale);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_loc);
- __Pyx_DECREF(__pyx_v_scale);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":1311
+/* "mtrand.pyx":1312
* return cont2_array(self.internal_state, rk_normal, size, oloc, oscale)
*
* def beta(self, a, b, size=None): # <<<<<<<<<<<<<<
@@ -7125,9 +7170,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, P
* beta(a, b, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_beta[] = "\n beta(a, b, size=None)\n\n The Beta distribution over ``[0, 1]``.\n\n The Beta distribution is a special case of the Dirichlet distribution,\n and is related to the Gamma distribution. It has the probability\n distribution function\n\n .. math:: f(x; a,b) = \\frac{1}{B(\\alpha, \\beta)} x^{\\alpha - 1}\n (1 - x)^{\\beta - 1},\n\n where the normalisation, B, is the beta function,\n\n .. math:: B(\\alpha, \\beta) = \\int_0^1 t^{\\alpha - 1}\n (1 - t)^{\\beta - 1} dt.\n\n It is often seen in Bayesian inference and order statistics.\n\n Parameters\n ----------\n a : float\n Alpha, non-negative.\n b : float\n Beta, non-negative.\n size : tuple of ints, optional\n The number of samples to draw. The ouput is packed according to\n the size given.\n\n Returns\n -------\n out : ndarray\n Array of the given shape, containing values drawn from a\n Beta distribution.\n\n ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_18beta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_18beta[] = "\n beta(a, b, size=None)\n\n The Beta distribution over ``[0, 1]``.\n\n The Beta distribution is a special case of the Dirichlet distribution,\n and is related to the Gamma distribution. It has the probability\n distribution function\n\n .. math:: f(x; a,b) = \\frac{1}{B(\\alpha, \\beta)} x^{\\alpha - 1}\n (1 - x)^{\\beta - 1},\n\n where the normalisation, B, is the beta function,\n\n .. math:: B(\\alpha, \\beta) = \\int_0^1 t^{\\alpha - 1}\n (1 - t)^{\\beta - 1} dt.\n\n It is often seen in Bayesian inference and order statistics.\n\n Parameters\n ----------\n a : float\n Alpha, non-negative.\n b : float\n Beta, non-negative.\n size : tuple of ints, optional\n The number of samples to draw. The ouput is packed according to\n the size given.\n\n Returns\n -------\n out : ndarray\n Array of the given shape, containing values drawn from a\n Beta distribution.\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_18beta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_a = 0;
PyObject *__pyx_v_b = 0;
PyObject *__pyx_v_size = 0;
@@ -7163,16 +7208,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyO
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__b);
if (likely(values[1])) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("beta", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("beta", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1312; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[2] = value; kw_args--; }
+ if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "beta") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "beta") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1312; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_a = values[0];
__pyx_v_b = values[1];
@@ -7191,19 +7236,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyO
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("beta", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("beta", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1312; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.beta");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_a);
- __Pyx_INCREF(__pyx_v_b);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_oa = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_ob = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":1351
+ /* "mtrand.pyx":1352
* cdef double fa, fb
*
* fa = PyFloat_AsDouble(a) # <<<<<<<<<<<<<<
@@ -7212,7 +7254,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyO
*/
__pyx_v_fa = PyFloat_AsDouble(__pyx_v_a);
- /* "mtrand.pyx":1352
+ /* "mtrand.pyx":1353
*
* fa = PyFloat_AsDouble(a)
* fb = PyFloat_AsDouble(b) # <<<<<<<<<<<<<<
@@ -7221,7 +7263,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyO
*/
__pyx_v_fb = PyFloat_AsDouble(__pyx_v_b);
- /* "mtrand.pyx":1353
+ /* "mtrand.pyx":1354
* fa = PyFloat_AsDouble(a)
* fb = PyFloat_AsDouble(b)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -7231,71 +7273,59 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyO
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":1354
+ /* "mtrand.pyx":1355
* fb = PyFloat_AsDouble(b)
* if not PyErr_Occurred():
* if fa <= 0: # <<<<<<<<<<<<<<
* raise ValueError("a <= 0")
* if fb <= 0:
*/
- __pyx_t_1 = (__pyx_v_fa <= 0);
+ __pyx_t_1 = (__pyx_v_fa <= 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":1355
+ /* "mtrand.pyx":1356
* if not PyErr_Occurred():
* if fa <= 0:
* raise ValueError("a <= 0") # <<<<<<<<<<<<<<
* if fb <= 0:
* raise ValueError("b <= 0")
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_10));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":1356
+ /* "mtrand.pyx":1357
* if fa <= 0:
* raise ValueError("a <= 0")
* if fb <= 0: # <<<<<<<<<<<<<<
* raise ValueError("b <= 0")
* return cont2_array_sc(self.internal_state, rk_beta, size, fa, fb)
*/
- __pyx_t_1 = (__pyx_v_fb <= 0);
+ __pyx_t_1 = (__pyx_v_fb <= 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":1357
+ /* "mtrand.pyx":1358
* raise ValueError("a <= 0")
* if fb <= 0:
* raise ValueError("b <= 0") # <<<<<<<<<<<<<<
* return cont2_array_sc(self.internal_state, rk_beta, size, fa, fb)
*
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_11));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
- __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_25), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":1358
+ /* "mtrand.pyx":1359
* if fb <= 0:
* raise ValueError("b <= 0")
* return cont2_array_sc(self.internal_state, rk_beta, size, fa, fb) # <<<<<<<<<<<<<<
@@ -7303,7 +7333,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyO
* PyErr_Clear()
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_beta, __pyx_v_size, __pyx_v_fa, __pyx_v_fb); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_beta, __pyx_v_size, __pyx_v_fa, __pyx_v_fb); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
@@ -7312,7 +7342,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyO
}
__pyx_L6:;
- /* "mtrand.pyx":1360
+ /* "mtrand.pyx":1361
* return cont2_array_sc(self.internal_state, rk_beta, size, fa, fb)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -7321,163 +7351,151 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyO
*/
PyErr_Clear();
- /* "mtrand.pyx":1362
+ /* "mtrand.pyx":1363
* PyErr_Clear()
*
* oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* ob = <ndarray>PyArray_FROM_OTF(b, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(oa, 0)):
*/
- __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_a, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_a, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_oa));
__pyx_v_oa = ((PyArrayObject *)__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":1363
+ /* "mtrand.pyx":1364
*
* oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED)
* ob = <ndarray>PyArray_FROM_OTF(b, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* if np.any(np.less_equal(oa, 0)):
* raise ValueError("a <= 0")
*/
- __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_b, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_b, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_ob));
__pyx_v_ob = ((PyArrayObject *)__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":1364
+ /* "mtrand.pyx":1365
* oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED)
* ob = <ndarray>PyArray_FROM_OTF(b, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(oa, 0)): # <<<<<<<<<<<<<<
* raise ValueError("a <= 0")
* if np.any(np.less_equal(ob, 0)):
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(((PyObject *)__pyx_v_oa));
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_oa));
__Pyx_GIVEREF(((PyObject *)__pyx_v_oa));
__Pyx_INCREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
- __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":1365
+ /* "mtrand.pyx":1366
* ob = <ndarray>PyArray_FROM_OTF(b, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(oa, 0)):
* raise ValueError("a <= 0") # <<<<<<<<<<<<<<
* if np.any(np.less_equal(ob, 0)):
* raise ValueError("b <= 0")
*/
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_10));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
- __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_5, 0, 0);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_Raise(__pyx_t_2, 0, 0);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L9;
}
__pyx_L9:;
- /* "mtrand.pyx":1366
+ /* "mtrand.pyx":1367
* if np.any(np.less_equal(oa, 0)):
* raise ValueError("a <= 0")
* if np.any(np.less_equal(ob, 0)): # <<<<<<<<<<<<<<
* raise ValueError("b <= 0")
* return cont2_array(self.internal_state, rk_beta, size, oa, ob)
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(((PyObject *)__pyx_v_ob));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_ob));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_ob));
__Pyx_GIVEREF(((PyObject *)__pyx_v_ob));
__Pyx_INCREF(__pyx_int_0);
- PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_0);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
- __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":1367
+ /* "mtrand.pyx":1368
* raise ValueError("a <= 0")
* if np.any(np.less_equal(ob, 0)):
* raise ValueError("b <= 0") # <<<<<<<<<<<<<<
* return cont2_array(self.internal_state, rk_beta, size, oa, ob)
*
*/
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
- PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_11));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
- __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_4, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_Raise(__pyx_t_2, 0, 0);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L10;
}
__pyx_L10:;
- /* "mtrand.pyx":1368
+ /* "mtrand.pyx":1369
* if np.any(np.less_equal(ob, 0)):
* raise ValueError("b <= 0")
* return cont2_array(self.internal_state, rk_beta, size, oa, ob) # <<<<<<<<<<<<<<
@@ -7485,10 +7503,10 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyO
* def exponential(self, scale=1.0, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_beta, __pyx_v_size, __pyx_v_oa, __pyx_v_ob); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_r = __pyx_t_2;
- __pyx_t_2 = 0;
+ __pyx_t_4 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_beta, __pyx_v_size, __pyx_v_oa, __pyx_v_ob); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_r = __pyx_t_4;
+ __pyx_t_4 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -7503,16 +7521,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyO
__pyx_L0:;
__Pyx_DECREF((PyObject *)__pyx_v_oa);
__Pyx_DECREF((PyObject *)__pyx_v_ob);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_a);
- __Pyx_DECREF(__pyx_v_b);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":1370
+/* "mtrand.pyx":1371
* return cont2_array(self.internal_state, rk_beta, size, oa, ob)
*
* def exponential(self, scale=1.0, size=None): # <<<<<<<<<<<<<<
@@ -7520,9 +7534,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyO
* exponential(scale=1.0, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_exponential[] = "\n exponential(scale=1.0, size=None)\n\n Exponential distribution.\n\n Its probability density function is\n\n .. math:: f(x; \\frac{1}{\\beta}) = \\frac{1}{\\beta} \\exp(-\\frac{x}{\\beta}),\n\n for ``x > 0`` and 0 elsewhere. :math:`\\beta` is the scale parameter,\n which is the inverse of the rate parameter :math:`\\lambda = 1/\\beta`.\n The rate parameter is an alternative, widely used parameterization\n of the exponential distribution [3]_.\n\n The exponential distribution is a continuous analogue of the\n geometric distribution. It describes many common situations, such as\n the size of raindrops measured over many rainstorms [1]_, or the time\n between page requests to Wikipedia [2]_.\n\n Parameters\n ----------\n scale : float\n The scale parameter, :math:`\\beta = 1/\\lambda`.\n size : tuple of ints\n Number of samples to draw. The output is shaped\n according to `size`.\n\n References\n ----------\n .. [1] Peyton Z. Peebles Jr., \"Probability, Random Variables and\n Random Signal Principles\", 4th ed, 2001, p. 57.\n .. [2] \"Poisson Process\", Wikipedia,\n http://en.wikipedia.org/wiki/Poisson_process\n .. [3] \"Exponential Distribution, Wikipedia,\n http://en.wikipedia.org/wiki/Exponential_distribution\n\n ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_19exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_19exponential[] = "\n exponential(scale=1.0, size=None)\n\n Exponential distribution.\n\n Its probability density function is\n\n .. math:: f(x; \\frac{1}{\\beta}) = \\frac{1}{\\beta} \\exp(-\\frac{x}{\\beta}),\n\n for ``x > 0`` and 0 elsewhere. :math:`\\beta` is the scale parameter,\n which is the inverse of the rate parameter :math:`\\lambda = 1/\\beta`.\n The rate parameter is an alternative, widely used parameterization\n of the exponential distribution [3]_.\n\n The exponential distribution is a continuous analogue of the\n geometric distribution. It describes many common situations, such as\n the size of raindrops measured over many rainstorms [1]_, or the time\n between page requests to Wikipedia [2]_.\n\n Parameters\n ----------\n scale : float\n The scale parameter, :math:`\\beta = 1/\\lambda`.\n size : tuple of ints\n Number of samples to draw. The output is shaped\n according to `size`.\n\n References\n ----------\n .. [1] Peyton Z. Peebles Jr., \"Probability, Random Variables and\n Random Signal Principles\", 4th ed, 2001, p. 57.\n .. [2] \"Poisson Process\", Wikipedia,\n http://en.wikipedia.org/wiki/Poisson_process\n .. [3] \"Exponential Distribution, Wikipedia,\n http://en.wikipedia.org/wiki/Exponential_distribution\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_19exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_scale = 0;
PyObject *__pyx_v_size = 0;
PyArrayObject *__pyx_v_oscale;
@@ -7538,7 +7552,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_exponential(PyObject *__pyx_v_se
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
PyObject* values[2] = {0,0};
- values[0] = __pyx_k_12;
+ values[0] = __pyx_k_28;
values[1] = ((PyObject *)Py_None);
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
@@ -7548,23 +7562,23 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_exponential(PyObject *__pyx_v_se
}
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 0:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scale);
- if (unlikely(value)) { values[0] = value; kw_args--; }
+ if (value) { values[0] = value; kw_args--; }
}
case 1:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[1] = value; kw_args--; }
+ if (value) { values[1] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "exponential") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "exponential") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_scale = values[0];
__pyx_v_size = values[1];
} else {
- __pyx_v_scale = __pyx_k_12;
+ __pyx_v_scale = __pyx_k_28;
__pyx_v_size = ((PyObject *)Py_None);
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 2: __pyx_v_size = PyTuple_GET_ITEM(__pyx_args, 1);
@@ -7575,17 +7589,15 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_exponential(PyObject *__pyx_v_se
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("exponential", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("exponential", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.exponential");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_scale);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_oscale = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":1411
+ /* "mtrand.pyx":1412
* cdef double fscale
*
* fscale = PyFloat_AsDouble(scale) # <<<<<<<<<<<<<<
@@ -7594,7 +7606,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_exponential(PyObject *__pyx_v_se
*/
__pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale);
- /* "mtrand.pyx":1412
+ /* "mtrand.pyx":1413
*
* fscale = PyFloat_AsDouble(scale)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -7604,39 +7616,33 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_exponential(PyObject *__pyx_v_se
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":1413
+ /* "mtrand.pyx":1414
* fscale = PyFloat_AsDouble(scale)
* if not PyErr_Occurred():
* if fscale <= 0: # <<<<<<<<<<<<<<
* raise ValueError("scale <= 0")
* return cont1_array_sc(self.internal_state, rk_exponential, size, fscale)
*/
- __pyx_t_1 = (__pyx_v_fscale <= 0);
+ __pyx_t_1 = (__pyx_v_fscale <= 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":1414
+ /* "mtrand.pyx":1415
* if not PyErr_Occurred():
* if fscale <= 0:
* raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
* return cont1_array_sc(self.internal_state, rk_exponential, size, fscale)
*
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_29), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_9));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":1415
+ /* "mtrand.pyx":1416
* if fscale <= 0:
* raise ValueError("scale <= 0")
* return cont1_array_sc(self.internal_state, rk_exponential, size, fscale) # <<<<<<<<<<<<<<
@@ -7644,16 +7650,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_exponential(PyObject *__pyx_v_se
* PyErr_Clear()
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_exponential, __pyx_v_size, __pyx_v_fscale); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_exponential, __pyx_v_size, __pyx_v_fscale); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L6;
}
__pyx_L6:;
- /* "mtrand.pyx":1417
+ /* "mtrand.pyx":1418
* return cont1_array_sc(self.internal_state, rk_exponential, size, fscale)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -7662,87 +7668,81 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_exponential(PyObject *__pyx_v_se
*/
PyErr_Clear();
- /* "mtrand.pyx":1419
+ /* "mtrand.pyx":1420
* PyErr_Clear()
*
* oscale = <ndarray> PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* if np.any(np.less_equal(oscale, 0.0)):
* raise ValueError("scale <= 0")
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_scale, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_scale, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_oscale));
- __pyx_v_oscale = ((PyArrayObject *)__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_oscale = ((PyArrayObject *)__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":1420
+ /* "mtrand.pyx":1421
*
* oscale = <ndarray> PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(oscale, 0.0)): # <<<<<<<<<<<<<<
* raise ValueError("scale <= 0")
* return cont1_array(self.internal_state, rk_exponential, size, oscale)
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(((PyObject *)__pyx_v_oscale));
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_oscale));
__Pyx_GIVEREF(((PyObject *)__pyx_v_oscale));
- PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":1421
+ /* "mtrand.pyx":1422
* oscale = <ndarray> PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(oscale, 0.0)):
* raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
* return cont1_array(self.internal_state, rk_exponential, size, oscale)
*
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_9));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
- __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_30), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":1422
+ /* "mtrand.pyx":1423
* if np.any(np.less_equal(oscale, 0.0)):
* raise ValueError("scale <= 0")
* return cont1_array(self.internal_state, rk_exponential, size, oscale) # <<<<<<<<<<<<<<
@@ -7750,10 +7750,10 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_exponential(PyObject *__pyx_v_se
* def standard_exponential(self, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_5 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_exponential, __pyx_v_size, __pyx_v_oscale); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_r = __pyx_t_5;
- __pyx_t_5 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_exponential, __pyx_v_size, __pyx_v_oscale); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -7767,15 +7767,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_exponential(PyObject *__pyx_v_se
__pyx_r = NULL;
__pyx_L0:;
__Pyx_DECREF((PyObject *)__pyx_v_oscale);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_scale);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":1424
+/* "mtrand.pyx":1425
* return cont1_array(self.internal_state, rk_exponential, size, oscale)
*
* def standard_exponential(self, size=None): # <<<<<<<<<<<<<<
@@ -7783,9 +7780,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_exponential(PyObject *__pyx_v_se
* standard_exponential(size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_standard_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_standard_exponential[] = "\n standard_exponential(size=None)\n\n Draw samples from the standard exponential distribution.\n\n `standard_exponential` is identical to the exponential distribution\n with a scale parameter of 1.\n\n Parameters\n ----------\n size : int or tuple of ints\n Shape of the output.\n\n Returns\n -------\n out : float or ndarray\n Drawn samples.\n\n Examples\n --------\n Output a 3x8000 array:\n\n >>> n = np.random.standard_exponential((3, 8000))\n\n ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_standard_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_20standard_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_20standard_exponential[] = "\n standard_exponential(size=None)\n\n Draw samples from the standard exponential distribution.\n\n `standard_exponential` is identical to the exponential distribution\n with a scale parameter of 1.\n\n Parameters\n ----------\n size : int or tuple of ints\n Shape of the output.\n\n Returns\n -------\n out : float or ndarray\n Drawn samples.\n\n Examples\n --------\n Output a 3x8000 array:\n\n >>> n = np.random.standard_exponential((3, 8000))\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_20standard_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_size = 0;
PyObject *__pyx_r = NULL;
PyObject *__pyx_t_1 = NULL;
@@ -7802,13 +7799,13 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_exponential(PyObject *_
}
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 0:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[0] = value; kw_args--; }
+ if (value) { values[0] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "standard_exponential") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "standard_exponential") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1425; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_size = values[0];
} else {
@@ -7821,13 +7818,14 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_exponential(PyObject *_
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("standard_exponential", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("standard_exponential", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1425; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.standard_exponential");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- /* "mtrand.pyx":1450
+ /* "mtrand.pyx":1451
*
* """
* return cont0_array(self.internal_state, rk_standard_exponential, size) # <<<<<<<<<<<<<<
@@ -7835,7 +7833,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_exponential(PyObject *_
* def standard_gamma(self, shape, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_standard_exponential, __pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_standard_exponential, __pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -7853,7 +7851,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_exponential(PyObject *_
return __pyx_r;
}
-/* "mtrand.pyx":1452
+/* "mtrand.pyx":1453
* return cont0_array(self.internal_state, rk_standard_exponential, size)
*
* def standard_gamma(self, shape, size=None): # <<<<<<<<<<<<<<
@@ -7861,9 +7859,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_exponential(PyObject *_
* standard_gamma(shape, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_standard_gamma[] = "\n"" standard_gamma(shape, size=None)\n""\n"" Draw samples from a Standard Gamma distribution.\n""\n"" Samples are drawn from a Gamma distribution with specified parameters,\n"" shape (sometimes designated \"k\") and scale=1.\n""\n"" Parameters\n"" ----------\n"" shape : float\n"" Parameter, should be > 0.\n"" size : int or tuple of ints\n"" Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n"" ``m * n * k`` samples are drawn.\n""\n"" Returns\n"" -------\n"" samples : ndarray or scalar\n"" The drawn samples.\n""\n"" See Also\n"" --------\n"" scipy.stats.distributions.gamma : probability density function,\n"" distribution or cumulative density function, etc.\n""\n"" Notes\n"" -----\n"" The probability density for the Gamma distribution is\n""\n"" .. math:: p(x) = x^{k-1}\\frac{e^{-x/\\theta}}{\\theta^k\\Gamma(k)},\n""\n"" where :math:`k` is the shape and :math:`\\theta` the scale,\n"" and :math:`\\Gamma` is the Gamma function.\n""\n"" The Gamma distribution is often used to model the times to failure of\n"" electronic components, and arises naturally in processes for which the\n"" waiting times between Poisson distributed events are relevant.\n""\n"" References\n"" ----------\n"" .. [1] Weisstein, Eric W. \"Gamma Distribution.\" From MathWorld--A\n"" Wolfram Web Resource.\n"" http://mathworld.wolfram.com/GammaDistribution.html\n"" .. [2] Wikipedia, \"Gamma-distribution\",\n"" http://en.wikipedia.org/wiki/Gamma-distribution\n""\n"" Examples\n"" --------\n"" Draw samples from the distribution:\n""\n"" >>> shape, scale = 2., 1. # mean and width\n"" >>> s = np.random.standard_gamma(shape, 1000000)\n""\n"" Display the histogram of the samples, along with\n"" the probability density function:\n""\n"" >>> import matplotlib.pyplot as plt\n"" >>> import scipy.special as sps\n"" >>> count, bins, ignored = plt.hist(s, 50, normed=True)\n"" >>> y = bins**(shape-1) * ((np.exp(-bins/scale))/ \\\n"" ... (sps.gamma(shape) * scale**shape))\n"" >>> plt.plot(bins, y, linewidth=2, color='r')\n"" >>> plt.show()\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_21standard_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_21standard_gamma[] = "\n standard_gamma(shape, size=None)\n\n Draw samples from a Standard Gamma distribution.\n\n Samples are drawn from a Gamma distribution with specified parameters,\n shape (sometimes designated \"k\") and scale=1.\n\n Parameters\n ----------\n shape : float\n Parameter, should be > 0.\n size : int or tuple of ints\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n samples : ndarray or scalar\n The drawn samples.\n\n See Also\n --------\n scipy.stats.distributions.gamma : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the Gamma distribution is\n\n .. math:: p(x) = x^{k-1}\\frac{e^{-x/\\theta}}{\\theta^k\\Gamma(k)},\n\n where :math:`k` is the shape and :math:`\\theta` the scale,\n and :math:`\\Gamma` is the Gamma function.\n\n The Gamma distribution is often used to model the times to failure of\n electronic components, and arises naturally in processes for which the\n waiting times between Poisson distributed events are relevant.\n\n References\n ----------\n .. [1] Weisstein, Eric W. \"Gamma Distribution.\" From MathWorld--A\n Wolfram Web Resource.\n http://mathworld.wolfram.com/GammaDistribution.html\n .. [2] Wikipedia, \"Gamma-distribution\",\n http://en.wikipedia.org/wiki/Gamma-distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> shape, scale = 2., 1. # mean and width\n >>> s = np.random.standard_gamma(shape, 1000000)\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt""\n >>> import scipy.special as sps\n >>> count, bins, ignored = plt.hist(s, 50, normed=True)\n >>> y = bins**(shape-1) * ((np.exp(-bins/scale))/ \\\n ... (sps.gamma(shape) * scale**shape))\n >>> plt.plot(bins, y, linewidth=2, color='r')\n >>> plt.show()\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_21standard_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_shape = 0;
PyObject *__pyx_v_size = 0;
PyArrayObject *__pyx_v_oshape;
@@ -7892,13 +7890,13 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v
if (likely(values[0])) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[1] = value; kw_args--; }
+ if (value) { values[1] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "standard_gamma") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1452; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "standard_gamma") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1453; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_shape = values[0];
__pyx_v_size = values[1];
@@ -7913,17 +7911,15 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("standard_gamma", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1452; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("standard_gamma", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1453; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.standard_gamma");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_shape);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_oshape = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":1522
+ /* "mtrand.pyx":1523
* cdef double fshape
*
* fshape = PyFloat_AsDouble(shape) # <<<<<<<<<<<<<<
@@ -7932,7 +7928,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v
*/
__pyx_v_fshape = PyFloat_AsDouble(__pyx_v_shape);
- /* "mtrand.pyx":1523
+ /* "mtrand.pyx":1524
*
* fshape = PyFloat_AsDouble(shape)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -7942,39 +7938,33 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":1524
+ /* "mtrand.pyx":1525
* fshape = PyFloat_AsDouble(shape)
* if not PyErr_Occurred():
* if fshape <= 0: # <<<<<<<<<<<<<<
* raise ValueError("shape <= 0")
* return cont1_array_sc(self.internal_state, rk_standard_gamma, size, fshape)
*/
- __pyx_t_1 = (__pyx_v_fshape <= 0);
+ __pyx_t_1 = (__pyx_v_fshape <= 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":1525
+ /* "mtrand.pyx":1526
* if not PyErr_Occurred():
* if fshape <= 0:
* raise ValueError("shape <= 0") # <<<<<<<<<<<<<<
* return cont1_array_sc(self.internal_state, rk_standard_gamma, size, fshape)
*
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_13));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_13));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":1526
+ /* "mtrand.pyx":1527
* if fshape <= 0:
* raise ValueError("shape <= 0")
* return cont1_array_sc(self.internal_state, rk_standard_gamma, size, fshape) # <<<<<<<<<<<<<<
@@ -7982,16 +7972,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v
* PyErr_Clear()
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_standard_gamma, __pyx_v_size, __pyx_v_fshape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_standard_gamma, __pyx_v_size, __pyx_v_fshape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L6;
}
__pyx_L6:;
- /* "mtrand.pyx":1528
+ /* "mtrand.pyx":1529
* return cont1_array_sc(self.internal_state, rk_standard_gamma, size, fshape)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -8000,87 +7990,81 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v
*/
PyErr_Clear();
- /* "mtrand.pyx":1529
+ /* "mtrand.pyx":1530
*
* PyErr_Clear()
* oshape = <ndarray> PyArray_FROM_OTF(shape, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* if np.any(np.less_equal(oshape, 0.0)):
* raise ValueError("shape <= 0")
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_shape, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_shape, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_oshape));
- __pyx_v_oshape = ((PyArrayObject *)__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_oshape = ((PyArrayObject *)__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":1530
+ /* "mtrand.pyx":1531
* PyErr_Clear()
* oshape = <ndarray> PyArray_FROM_OTF(shape, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(oshape, 0.0)): # <<<<<<<<<<<<<<
* raise ValueError("shape <= 0")
* return cont1_array(self.internal_state, rk_standard_gamma, size, oshape)
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(((PyObject *)__pyx_v_oshape));
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_oshape));
__Pyx_GIVEREF(((PyObject *)__pyx_v_oshape));
- PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":1531
+ /* "mtrand.pyx":1532
* oshape = <ndarray> PyArray_FROM_OTF(shape, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(oshape, 0.0)):
* raise ValueError("shape <= 0") # <<<<<<<<<<<<<<
* return cont1_array(self.internal_state, rk_standard_gamma, size, oshape)
*
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_13));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_13));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13));
- __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_33), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":1532
+ /* "mtrand.pyx":1533
* if np.any(np.less_equal(oshape, 0.0)):
* raise ValueError("shape <= 0")
* return cont1_array(self.internal_state, rk_standard_gamma, size, oshape) # <<<<<<<<<<<<<<
@@ -8088,10 +8072,10 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v
* def gamma(self, shape, scale=1.0, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_5 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_standard_gamma, __pyx_v_size, __pyx_v_oshape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_r = __pyx_t_5;
- __pyx_t_5 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_standard_gamma, __pyx_v_size, __pyx_v_oshape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -8105,15 +8089,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v
__pyx_r = NULL;
__pyx_L0:;
__Pyx_DECREF((PyObject *)__pyx_v_oshape);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_shape);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":1534
+/* "mtrand.pyx":1535
* return cont1_array(self.internal_state, rk_standard_gamma, size, oshape)
*
* def gamma(self, shape, scale=1.0, size=None): # <<<<<<<<<<<<<<
@@ -8121,9 +8102,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v
* gamma(shape, scale=1.0, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_gamma[] = "\n"" gamma(shape, scale=1.0, size=None)\n""\n"" Draw samples from a Gamma distribution.\n""\n"" Samples are drawn from a Gamma distribution with specified parameters,\n"" `shape` (sometimes designated \"k\") and `scale` (sometimes designated\n"" \"theta\"), where both parameters are > 0.\n""\n"" Parameters\n"" ----------\n"" shape : scalar > 0\n"" The shape of the gamma distribution.\n"" scale : scalar > 0, optional\n"" The scale of the gamma distribution. Default is equal to 1.\n"" size : shape_tuple, optional\n"" Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n"" ``m * n * k`` samples are drawn.\n""\n"" Returns\n"" -------\n"" out : ndarray, float\n"" Returns one sample unless `size` parameter is specified.\n""\n"" See Also\n"" --------\n"" scipy.stats.distributions.gamma : probability density function,\n"" distribution or cumulative density function, etc.\n""\n"" Notes\n"" -----\n"" The probability density for the Gamma distribution is\n""\n"" .. math:: p(x) = x^{k-1}\\frac{e^{-x/\\theta}}{\\theta^k\\Gamma(k)},\n""\n"" where :math:`k` is the shape and :math:`\\theta` the scale,\n"" and :math:`\\Gamma` is the Gamma function.\n""\n"" The Gamma distribution is often used to model the times to failure of\n"" electronic components, and arises naturally in processes for which the\n"" waiting times between Poisson distributed events are relevant.\n""\n"" References\n"" ----------\n"" .. [1] Weisstein, Eric W. \"Gamma Distribution.\" From MathWorld--A\n"" Wolfram Web Resource.\n"" http://mathworld.wolfram.com/GammaDistribution.html\n"" .. [2] Wikipedia, \"Gamma-distribution\",\n"" http://en.wikipedia.org/wiki/Gamma-distribution\n""\n"" Examples\n"" --------\n"" Draw samples from the distribution:\n""\n"" >>> shape, scale = 2., 2. # mean and dispersion\n"" >>> s = np.random.gamma(shape, scale, 1000)\n""\n"" Display the histogram of the samples, along with\n"" the probability density function:\n""\n"" >>> import matplotlib.pyplot as plt\n"" >>> import scipy.special as sps\n"" >>> count, bins, ignored = plt.hist(s, 50, normed=True)\n"" >>> y = bins**(shape-1)*(np.exp(-bins/scale) /\n"" ... (sps.gamma(shape)*scale**shape))\n"" >>> plt.plot(bins, y, linewidth=2, color='r')\n"" >>> plt.show()\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_22gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_22gamma[] = "\n gamma(shape, scale=1.0, size=None)\n\n Draw samples from a Gamma distribution.\n\n Samples are drawn from a Gamma distribution with specified parameters,\n `shape` (sometimes designated \"k\") and `scale` (sometimes designated\n \"theta\"), where both parameters are > 0.\n\n Parameters\n ----------\n shape : scalar > 0\n The shape of the gamma distribution.\n scale : scalar > 0, optional\n The scale of the gamma distribution. Default is equal to 1.\n size : shape_tuple, optional\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n out : ndarray, float\n Returns one sample unless `size` parameter is specified.\n\n See Also\n --------\n scipy.stats.distributions.gamma : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the Gamma distribution is\n\n .. math:: p(x) = x^{k-1}\\frac{e^{-x/\\theta}}{\\theta^k\\Gamma(k)},\n\n where :math:`k` is the shape and :math:`\\theta` the scale,\n and :math:`\\Gamma` is the Gamma function.\n\n The Gamma distribution is often used to model the times to failure of\n electronic components, and arises naturally in processes for which the\n waiting times between Poisson distributed events are relevant.\n\n References\n ----------\n .. [1] Weisstein, Eric W. \"Gamma Distribution.\" From MathWorld--A\n Wolfram Web Resource.\n http://mathworld.wolfram.com/GammaDistribution.html\n .. [2] Wikipedia, \"Gamma-distribution\",\n http://en.wikipedia.org/wiki/Gamma-distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> shape, scale = 2.,"" 2. # mean and dispersion\n >>> s = np.random.gamma(shape, scale, 1000)\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> import scipy.special as sps\n >>> count, bins, ignored = plt.hist(s, 50, normed=True)\n >>> y = bins**(shape-1)*(np.exp(-bins/scale) /\n ... (sps.gamma(shape)*scale**shape))\n >>> plt.plot(bins, y, linewidth=2, color='r')\n >>> plt.show()\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_22gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_shape = 0;
PyObject *__pyx_v_scale = 0;
PyObject *__pyx_v_size = 0;
@@ -8142,7 +8123,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, Py
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
PyObject* values[3] = {0,0,0};
- values[1] = __pyx_k_14;
+ values[1] = __pyx_k_34;
values[2] = ((PyObject *)Py_None);
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
@@ -8157,24 +8138,24 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, Py
if (likely(values[0])) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scale);
- if (unlikely(value)) { values[1] = value; kw_args--; }
+ if (value) { values[1] = value; kw_args--; }
}
case 2:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[2] = value; kw_args--; }
+ if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "gamma") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1534; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "gamma") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1535; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_shape = values[0];
__pyx_v_scale = values[1];
__pyx_v_size = values[2];
} else {
- __pyx_v_scale = __pyx_k_14;
+ __pyx_v_scale = __pyx_k_34;
__pyx_v_size = ((PyObject *)Py_None);
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: __pyx_v_size = PyTuple_GET_ITEM(__pyx_args, 2);
@@ -8186,19 +8167,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, Py
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("gamma", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1534; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("gamma", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1535; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.gamma");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_shape);
- __Pyx_INCREF(__pyx_v_scale);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_oshape = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_oscale = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":1607
+ /* "mtrand.pyx":1608
* cdef double fshape, fscale
*
* fshape = PyFloat_AsDouble(shape) # <<<<<<<<<<<<<<
@@ -8207,7 +8185,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, Py
*/
__pyx_v_fshape = PyFloat_AsDouble(__pyx_v_shape);
- /* "mtrand.pyx":1608
+ /* "mtrand.pyx":1609
*
* fshape = PyFloat_AsDouble(shape)
* fscale = PyFloat_AsDouble(scale) # <<<<<<<<<<<<<<
@@ -8216,7 +8194,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, Py
*/
__pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale);
- /* "mtrand.pyx":1609
+ /* "mtrand.pyx":1610
* fshape = PyFloat_AsDouble(shape)
* fscale = PyFloat_AsDouble(scale)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -8226,71 +8204,59 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, Py
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":1610
+ /* "mtrand.pyx":1611
* fscale = PyFloat_AsDouble(scale)
* if not PyErr_Occurred():
* if fshape <= 0: # <<<<<<<<<<<<<<
* raise ValueError("shape <= 0")
* if fscale <= 0:
*/
- __pyx_t_1 = (__pyx_v_fshape <= 0);
+ __pyx_t_1 = (__pyx_v_fshape <= 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":1611
+ /* "mtrand.pyx":1612
* if not PyErr_Occurred():
* if fshape <= 0:
* raise ValueError("shape <= 0") # <<<<<<<<<<<<<<
* if fscale <= 0:
* raise ValueError("scale <= 0")
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_35), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_13));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_13));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":1612
+ /* "mtrand.pyx":1613
* if fshape <= 0:
* raise ValueError("shape <= 0")
* if fscale <= 0: # <<<<<<<<<<<<<<
* raise ValueError("scale <= 0")
* return cont2_array_sc(self.internal_state, rk_gamma, size, fshape, fscale)
*/
- __pyx_t_1 = (__pyx_v_fscale <= 0);
+ __pyx_t_1 = (__pyx_v_fscale <= 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":1613
+ /* "mtrand.pyx":1614
* raise ValueError("shape <= 0")
* if fscale <= 0:
* raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
* return cont2_array_sc(self.internal_state, rk_gamma, size, fshape, fscale)
*
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_9));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
- __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":1614
+ /* "mtrand.pyx":1615
* if fscale <= 0:
* raise ValueError("scale <= 0")
* return cont2_array_sc(self.internal_state, rk_gamma, size, fshape, fscale) # <<<<<<<<<<<<<<
@@ -8298,7 +8264,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, Py
* PyErr_Clear()
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_gamma, __pyx_v_size, __pyx_v_fshape, __pyx_v_fscale); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_gamma, __pyx_v_size, __pyx_v_fshape, __pyx_v_fscale); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
@@ -8307,7 +8273,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, Py
}
__pyx_L6:;
- /* "mtrand.pyx":1616
+ /* "mtrand.pyx":1617
* return cont2_array_sc(self.internal_state, rk_gamma, size, fshape, fscale)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -8316,167 +8282,155 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, Py
*/
PyErr_Clear();
- /* "mtrand.pyx":1617
+ /* "mtrand.pyx":1618
*
* PyErr_Clear()
* oshape = <ndarray>PyArray_FROM_OTF(shape, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* oscale = <ndarray>PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(oshape, 0.0)):
*/
- __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_shape, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_shape, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_oshape));
__pyx_v_oshape = ((PyArrayObject *)__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":1618
+ /* "mtrand.pyx":1619
* PyErr_Clear()
* oshape = <ndarray>PyArray_FROM_OTF(shape, NPY_DOUBLE, NPY_ALIGNED)
* oscale = <ndarray>PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* if np.any(np.less_equal(oshape, 0.0)):
* raise ValueError("shape <= 0")
*/
- __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_scale, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_scale, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_oscale));
__pyx_v_oscale = ((PyArrayObject *)__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":1619
+ /* "mtrand.pyx":1620
* oshape = <ndarray>PyArray_FROM_OTF(shape, NPY_DOUBLE, NPY_ALIGNED)
* oscale = <ndarray>PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(oshape, 0.0)): # <<<<<<<<<<<<<<
* raise ValueError("shape <= 0")
* if np.any(np.less_equal(oscale, 0.0)):
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(((PyObject *)__pyx_v_oshape));
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_oshape));
__Pyx_GIVEREF(((PyObject *)__pyx_v_oshape));
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":1620
+ /* "mtrand.pyx":1621
* oscale = <ndarray>PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(oshape, 0.0)):
* raise ValueError("shape <= 0") # <<<<<<<<<<<<<<
* if np.any(np.less_equal(oscale, 0.0)):
* raise ValueError("scale <= 0")
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_37), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_13));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_13));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13));
- __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L9;
}
__pyx_L9:;
- /* "mtrand.pyx":1621
+ /* "mtrand.pyx":1622
* if np.any(np.less_equal(oshape, 0.0)):
* raise ValueError("shape <= 0")
* if np.any(np.less_equal(oscale, 0.0)): # <<<<<<<<<<<<<<
* raise ValueError("scale <= 0")
* return cont2_array(self.internal_state, rk_gamma, size, oshape, oscale)
*/
- __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
__Pyx_INCREF(((PyObject *)__pyx_v_oscale));
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_oscale));
__Pyx_GIVEREF(((PyObject *)__pyx_v_oscale));
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":1622
+ /* "mtrand.pyx":1623
* raise ValueError("shape <= 0")
* if np.any(np.less_equal(oscale, 0.0)):
* raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
* return cont2_array(self.internal_state, rk_gamma, size, oshape, oscale)
*
*/
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_9));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
- __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_Raise(__pyx_t_4, 0, 0);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_38), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L10;
}
__pyx_L10:;
- /* "mtrand.pyx":1623
+ /* "mtrand.pyx":1624
* if np.any(np.less_equal(oscale, 0.0)):
* raise ValueError("scale <= 0")
* return cont2_array(self.internal_state, rk_gamma, size, oshape, oscale) # <<<<<<<<<<<<<<
@@ -8484,10 +8438,10 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, Py
* def f(self, dfnum, dfden, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_4 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_gamma, __pyx_v_size, __pyx_v_oshape, __pyx_v_oscale); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_r = __pyx_t_4;
- __pyx_t_4 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_gamma, __pyx_v_size, __pyx_v_oshape, __pyx_v_oscale); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -8502,16 +8456,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, Py
__pyx_L0:;
__Pyx_DECREF((PyObject *)__pyx_v_oshape);
__Pyx_DECREF((PyObject *)__pyx_v_oscale);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_shape);
- __Pyx_DECREF(__pyx_v_scale);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":1625
+/* "mtrand.pyx":1626
* return cont2_array(self.internal_state, rk_gamma, size, oshape, oscale)
*
* def f(self, dfnum, dfden, size=None): # <<<<<<<<<<<<<<
@@ -8519,9 +8469,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, Py
* f(dfnum, dfden, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_f[] = "\n"" f(dfnum, dfden, size=None)\n""\n"" Draw samples from a F distribution.\n""\n"" Samples are drawn from an F distribution with specified parameters,\n"" `dfnum` (degrees of freedom in numerator) and `dfden` (degrees of freedom\n"" in denominator), where both parameters should be greater than zero.\n""\n"" The random variate of the F distribution (also known as the\n"" Fisher distribution) is a continuous probability distribution\n"" that arises in ANOVA tests, and is the ratio of two chi-square\n"" variates.\n""\n"" Parameters\n"" ----------\n"" dfnum : float\n"" Degrees of freedom in numerator. Should be greater than zero.\n"" dfden : float\n"" Degrees of freedom in denominator. Should be greater than zero.\n"" size : {tuple, int}, optional\n"" Output shape. If the given shape is, e.g., ``(m, n, k)``,\n"" then ``m * n * k`` samples are drawn. By default only one sample\n"" is returned.\n""\n"" Returns\n"" -------\n"" samples : {ndarray, scalar}\n"" Samples from the Fisher distribution.\n""\n"" See Also\n"" --------\n"" scipy.stats.distributions.f : probability density function,\n"" distribution or cumulative density function, etc.\n""\n"" Notes\n"" -----\n""\n"" The F statistic is used to compare in-group variances to between-group\n"" variances. Calculating the distribution depends on the sampling, and\n"" so it is a function of the respective degrees of freedom in the\n"" problem. The variable `dfnum` is the number of samples minus one, the\n"" between-groups degrees of freedom, while `dfden` is the within-groups\n"" degrees of freedom, the sum of the number of samples in each group\n"" minus the number of groups.\n""\n"" References\n"" ----------\n"" .. [1] Glantz, Stanton A. \"Primer of Biostatistics.\", McGraw-Hill,\n"" Fifth Edition, 2002.\n"" .. [2] Wikipedia, \"F-distribution\",\n"" http://en.wikipedia.org/wiki/F-distribution\n""\n"" Examples\n"" --------\n"" An example from Glantz[1], pp 47-40.\n"" Two groups, children of diabetics (25 people) and children from people\n"" without diabetes (25 controls). Fasting blood glucose was measured,\n"" case group had a mean value of 86.1, controls had a mean value of\n"" 82.2. Standard deviations were 2.09 and 2.49 respectively. Are these\n"" data consistent with the null hypothesis that the parents diabetic\n"" status does not affect their children's blood glucose levels?\n"" Calculating the F statistic from the data gives a value of 36.01.\n""\n"" Draw samples from the distribution:\n""\n"" >>> dfnum = 1. # between group degrees of freedom\n"" >>> dfden = 48. # within groups degrees of freedom\n"" >>> s = np.random.f(dfnum, dfden, 1000)\n""\n"" The lower bound for the top 1% of the samples is :\n""\n"" >>> sort(s)[-10]\n"" 7.61988120985\n""\n"" So there is about a 1% chance that the F statistic will exceed 7.62,\n"" the measured value is 36, so the null hypothesis is rejected at the 1%\n"" level.\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_23f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_23f[] = "\n f(dfnum, dfden, size=None)\n\n Draw samples from a F distribution.\n\n Samples are drawn from an F distribution with specified parameters,\n `dfnum` (degrees of freedom in numerator) and `dfden` (degrees of freedom\n in denominator), where both parameters should be greater than zero.\n\n The random variate of the F distribution (also known as the\n Fisher distribution) is a continuous probability distribution\n that arises in ANOVA tests, and is the ratio of two chi-square\n variates.\n\n Parameters\n ----------\n dfnum : float\n Degrees of freedom in numerator. Should be greater than zero.\n dfden : float\n Degrees of freedom in denominator. Should be greater than zero.\n size : {tuple, int}, optional\n Output shape. If the given shape is, e.g., ``(m, n, k)``,\n then ``m * n * k`` samples are drawn. By default only one sample\n is returned.\n\n Returns\n -------\n samples : {ndarray, scalar}\n Samples from the Fisher distribution.\n\n See Also\n --------\n scipy.stats.distributions.f : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n\n The F statistic is used to compare in-group variances to between-group\n variances. Calculating the distribution depends on the sampling, and\n so it is a function of the respective degrees of freedom in the\n problem. The variable `dfnum` is the number of samples minus one, the\n between-groups degrees of freedom, while `dfden` is the within-groups\n degrees of freedom, the sum of the number of samples in each group\n minus the number of groups.\n\n References\n ----------\n .. [1] Glantz, Stanton A. \"Primer of Biostatistics.\", McGraw-Hill,\n Fifth Edition, 2002.""\n .. [2] Wikipedia, \"F-distribution\",\n http://en.wikipedia.org/wiki/F-distribution\n\n Examples\n --------\n An example from Glantz[1], pp 47-40.\n Two groups, children of diabetics (25 people) and children from people\n without diabetes (25 controls). Fasting blood glucose was measured,\n case group had a mean value of 86.1, controls had a mean value of\n 82.2. Standard deviations were 2.09 and 2.49 respectively. Are these\n data consistent with the null hypothesis that the parents diabetic\n status does not affect their children's blood glucose levels?\n Calculating the F statistic from the data gives a value of 36.01.\n\n Draw samples from the distribution:\n\n >>> dfnum = 1. # between group degrees of freedom\n >>> dfden = 48. # within groups degrees of freedom\n >>> s = np.random.f(dfnum, dfden, 1000)\n\n The lower bound for the top 1% of the samples is :\n\n >>> sort(s)[-10]\n 7.61988120985\n\n So there is about a 1% chance that the F statistic will exceed 7.62,\n the measured value is 36, so the null hypothesis is rejected at the 1%\n level.\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_23f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_dfnum = 0;
PyObject *__pyx_v_dfden = 0;
PyObject *__pyx_v_size = 0;
@@ -8557,16 +8507,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObje
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dfden);
if (likely(values[1])) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("f", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1625; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("f", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1626; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[2] = value; kw_args--; }
+ if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "f") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1625; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "f") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1626; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_dfnum = values[0];
__pyx_v_dfden = values[1];
@@ -8585,19 +8535,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObje
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("f", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1625; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("f", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1626; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.f");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_dfnum);
- __Pyx_INCREF(__pyx_v_dfden);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_odfnum = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_odfden = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":1709
+ /* "mtrand.pyx":1710
* cdef double fdfnum, fdfden
*
* fdfnum = PyFloat_AsDouble(dfnum) # <<<<<<<<<<<<<<
@@ -8606,7 +8553,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObje
*/
__pyx_v_fdfnum = PyFloat_AsDouble(__pyx_v_dfnum);
- /* "mtrand.pyx":1710
+ /* "mtrand.pyx":1711
*
* fdfnum = PyFloat_AsDouble(dfnum)
* fdfden = PyFloat_AsDouble(dfden) # <<<<<<<<<<<<<<
@@ -8615,7 +8562,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObje
*/
__pyx_v_fdfden = PyFloat_AsDouble(__pyx_v_dfden);
- /* "mtrand.pyx":1711
+ /* "mtrand.pyx":1712
* fdfnum = PyFloat_AsDouble(dfnum)
* fdfden = PyFloat_AsDouble(dfden)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -8625,71 +8572,59 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObje
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":1712
+ /* "mtrand.pyx":1713
* fdfden = PyFloat_AsDouble(dfden)
* if not PyErr_Occurred():
* if fdfnum <= 0: # <<<<<<<<<<<<<<
* raise ValueError("shape <= 0")
* if fdfden <= 0:
*/
- __pyx_t_1 = (__pyx_v_fdfnum <= 0);
+ __pyx_t_1 = (__pyx_v_fdfnum <= 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":1713
+ /* "mtrand.pyx":1714
* if not PyErr_Occurred():
* if fdfnum <= 0:
* raise ValueError("shape <= 0") # <<<<<<<<<<<<<<
* if fdfden <= 0:
* raise ValueError("scale <= 0")
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_39), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_13));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_13));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":1714
+ /* "mtrand.pyx":1715
* if fdfnum <= 0:
* raise ValueError("shape <= 0")
* if fdfden <= 0: # <<<<<<<<<<<<<<
* raise ValueError("scale <= 0")
* return cont2_array_sc(self.internal_state, rk_f, size, fdfnum, fdfden)
*/
- __pyx_t_1 = (__pyx_v_fdfden <= 0);
+ __pyx_t_1 = (__pyx_v_fdfden <= 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":1715
+ /* "mtrand.pyx":1716
* raise ValueError("shape <= 0")
* if fdfden <= 0:
* raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
* return cont2_array_sc(self.internal_state, rk_f, size, fdfnum, fdfden)
*
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_9));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
- __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_40), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":1716
+ /* "mtrand.pyx":1717
* if fdfden <= 0:
* raise ValueError("scale <= 0")
* return cont2_array_sc(self.internal_state, rk_f, size, fdfnum, fdfden) # <<<<<<<<<<<<<<
@@ -8697,7 +8632,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObje
* PyErr_Clear()
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_f, __pyx_v_size, __pyx_v_fdfnum, __pyx_v_fdfden); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_f, __pyx_v_size, __pyx_v_fdfnum, __pyx_v_fdfden); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
@@ -8706,7 +8641,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObje
}
__pyx_L6:;
- /* "mtrand.pyx":1718
+ /* "mtrand.pyx":1719
* return cont2_array_sc(self.internal_state, rk_f, size, fdfnum, fdfden)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -8715,167 +8650,155 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObje
*/
PyErr_Clear();
- /* "mtrand.pyx":1720
+ /* "mtrand.pyx":1721
* PyErr_Clear()
*
* odfnum = <ndarray>PyArray_FROM_OTF(dfnum, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* odfden = <ndarray>PyArray_FROM_OTF(dfden, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(odfnum, 0.0)):
*/
- __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_dfnum, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_dfnum, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_odfnum));
__pyx_v_odfnum = ((PyArrayObject *)__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":1721
+ /* "mtrand.pyx":1722
*
* odfnum = <ndarray>PyArray_FROM_OTF(dfnum, NPY_DOUBLE, NPY_ALIGNED)
* odfden = <ndarray>PyArray_FROM_OTF(dfden, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* if np.any(np.less_equal(odfnum, 0.0)):
* raise ValueError("dfnum <= 0")
*/
- __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_dfden, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_dfden, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_odfden));
__pyx_v_odfden = ((PyArrayObject *)__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":1722
+ /* "mtrand.pyx":1723
* odfnum = <ndarray>PyArray_FROM_OTF(dfnum, NPY_DOUBLE, NPY_ALIGNED)
* odfden = <ndarray>PyArray_FROM_OTF(dfden, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(odfnum, 0.0)): # <<<<<<<<<<<<<<
* raise ValueError("dfnum <= 0")
* if np.any(np.less_equal(odfden, 0.0)):
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(((PyObject *)__pyx_v_odfnum));
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_odfnum));
__Pyx_GIVEREF(((PyObject *)__pyx_v_odfnum));
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":1723
+ /* "mtrand.pyx":1724
* odfden = <ndarray>PyArray_FROM_OTF(dfden, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(odfnum, 0.0)):
* raise ValueError("dfnum <= 0") # <<<<<<<<<<<<<<
* if np.any(np.less_equal(odfden, 0.0)):
* raise ValueError("dfden <= 0")
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_42), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_15));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_15));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_15));
- __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L9;
}
__pyx_L9:;
- /* "mtrand.pyx":1724
+ /* "mtrand.pyx":1725
* if np.any(np.less_equal(odfnum, 0.0)):
* raise ValueError("dfnum <= 0")
* if np.any(np.less_equal(odfden, 0.0)): # <<<<<<<<<<<<<<
* raise ValueError("dfden <= 0")
* return cont2_array(self.internal_state, rk_f, size, odfnum, odfden)
*/
- __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
__Pyx_INCREF(((PyObject *)__pyx_v_odfden));
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_odfden));
__Pyx_GIVEREF(((PyObject *)__pyx_v_odfden));
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":1725
+ /* "mtrand.pyx":1726
* raise ValueError("dfnum <= 0")
* if np.any(np.less_equal(odfden, 0.0)):
* raise ValueError("dfden <= 0") # <<<<<<<<<<<<<<
* return cont2_array(self.internal_state, rk_f, size, odfnum, odfden)
*
*/
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_16));
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_16));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_16));
- __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_Raise(__pyx_t_4, 0, 0);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_44), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L10;
}
__pyx_L10:;
- /* "mtrand.pyx":1726
+ /* "mtrand.pyx":1727
* if np.any(np.less_equal(odfden, 0.0)):
* raise ValueError("dfden <= 0")
* return cont2_array(self.internal_state, rk_f, size, odfnum, odfden) # <<<<<<<<<<<<<<
@@ -8883,10 +8806,10 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObje
* def noncentral_f(self, dfnum, dfden, nonc, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_4 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_f, __pyx_v_size, __pyx_v_odfnum, __pyx_v_odfden); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_r = __pyx_t_4;
- __pyx_t_4 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_f, __pyx_v_size, __pyx_v_odfnum, __pyx_v_odfden); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -8901,16 +8824,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObje
__pyx_L0:;
__Pyx_DECREF((PyObject *)__pyx_v_odfnum);
__Pyx_DECREF((PyObject *)__pyx_v_odfden);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_dfnum);
- __Pyx_DECREF(__pyx_v_dfden);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":1728
+/* "mtrand.pyx":1729
* return cont2_array(self.internal_state, rk_f, size, odfnum, odfden)
*
* def noncentral_f(self, dfnum, dfden, nonc, size=None): # <<<<<<<<<<<<<<
@@ -8918,9 +8837,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObje
* noncentral_f(dfnum, dfden, nonc, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_noncentral_f[] = "\n"" noncentral_f(dfnum, dfden, nonc, size=None)\n""\n"" Draw samples from the noncentral F distribution.\n""\n"" Samples are drawn from an F distribution with specified parameters,\n"" `dfnum` (degrees of freedom in numerator) and `dfden` (degrees of\n"" freedom in denominator), where both parameters > 1.\n"" `nonc` is the non-centrality parameter.\n""\n"" Parameters\n"" ----------\n"" dfnum : int\n"" Parameter, should be > 1.\n"" dfden : int\n"" Parameter, should be > 1.\n"" nonc : float\n"" Parameter, should be >= 0.\n"" size : int or tuple of ints\n"" Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n"" ``m * n * k`` samples are drawn.\n""\n"" Returns\n"" -------\n"" samples : scalar or ndarray\n"" Drawn samples.\n""\n"" Notes\n"" -----\n"" When calculating the power of an experiment (power = probability of\n"" rejecting the null hypothesis when a specific alternative is true) the\n"" non-central F statistic becomes important. When the null hypothesis is\n"" true, the F statistic follows a central F distribution. When the null\n"" hypothesis is not true, then it follows a non-central F statistic.\n""\n"" References\n"" ----------\n"" Weisstein, Eric W. \"Noncentral F-Distribution.\" From MathWorld--A Wolfram\n"" Web Resource. http://mathworld.wolfram.com/NoncentralF-Distribution.html\n""\n"" Wikipedia, \"Noncentral F distribution\",\n"" http://en.wikipedia.org/wiki/Noncentral_F-distribution\n""\n"" Examples\n"" --------\n"" In a study, testing for a specific alternative to the null hypothesis\n"" requires use of the Noncentral F distribution. We need to calculate the\n"" area in the tail of the distribution that exceeds the value of the F\n"" distribution for the null hypothesis. We'll plot the two probability\n"" distributions for comparison.\n""\n"" >>> dfnum = 3 # between group deg of freedom\n"" >>> dfden = 20 # within groups degrees of freedom\n"" >>> nonc = 3.0\n"" >>> nc_vals = np.random.noncentral_f(dfnum, dfden, nonc, 1000000)\n"" >>> NF = np.histogram(nc_vals, bins=50, normed=True)\n"" >>> c_vals = np.random.f(dfnum, dfden, 1000000)\n"" >>> F = np.histogram(c_vals, bins=50, normed=True)\n"" >>> plt.plot(F[1][1:], F[0])\n"" >>> plt.plot(NF[1][1:], NF[0])\n"" >>> plt.show()\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_24noncentral_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_24noncentral_f[] = "\n noncentral_f(dfnum, dfden, nonc, size=None)\n\n Draw samples from the noncentral F distribution.\n\n Samples are drawn from an F distribution with specified parameters,\n `dfnum` (degrees of freedom in numerator) and `dfden` (degrees of\n freedom in denominator), where both parameters > 1.\n `nonc` is the non-centrality parameter.\n\n Parameters\n ----------\n dfnum : int\n Parameter, should be > 1.\n dfden : int\n Parameter, should be > 1.\n nonc : float\n Parameter, should be >= 0.\n size : int or tuple of ints\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n samples : scalar or ndarray\n Drawn samples.\n\n Notes\n -----\n When calculating the power of an experiment (power = probability of\n rejecting the null hypothesis when a specific alternative is true) the\n non-central F statistic becomes important. When the null hypothesis is\n true, the F statistic follows a central F distribution. When the null\n hypothesis is not true, then it follows a non-central F statistic.\n\n References\n ----------\n Weisstein, Eric W. \"Noncentral F-Distribution.\" From MathWorld--A Wolfram\n Web Resource. http://mathworld.wolfram.com/NoncentralF-Distribution.html\n\n Wikipedia, \"Noncentral F distribution\",\n http://en.wikipedia.org/wiki/Noncentral_F-distribution\n\n Examples\n --------\n In a study, testing for a specific alternative to the null hypothesis\n requires use of the Noncentral F distribution. We need to calculate the\n area in the tail of the distribution that exceeds the value of the F\n distribution for the null hypothesis. We'll plot the two probability\n distributions for comp""arison.\n\n >>> dfnum = 3 # between group deg of freedom\n >>> dfden = 20 # within groups degrees of freedom\n >>> nonc = 3.0\n >>> nc_vals = np.random.noncentral_f(dfnum, dfden, nonc, 1000000)\n >>> NF = np.histogram(nc_vals, bins=50, normed=True)\n >>> c_vals = np.random.f(dfnum, dfden, 1000000)\n >>> F = np.histogram(c_vals, bins=50, normed=True)\n >>> plt.plot(F[1][1:], F[0])\n >>> plt.plot(NF[1][1:], NF[0])\n >>> plt.show()\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_24noncentral_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_dfnum = 0;
PyObject *__pyx_v_dfden = 0;
PyObject *__pyx_v_nonc = 0;
@@ -8960,22 +8879,22 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_s
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dfden);
if (likely(values[1])) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("noncentral_f", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1728; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("noncentral_f", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1729; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nonc);
if (likely(values[2])) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("noncentral_f", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1728; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("noncentral_f", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1729; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 3:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[3] = value; kw_args--; }
+ if (value) { values[3] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "noncentral_f") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1728; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "noncentral_f") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1729; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_dfnum = values[0];
__pyx_v_dfden = values[1];
@@ -8996,21 +8915,17 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_s
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("noncentral_f", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1728; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("noncentral_f", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1729; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.noncentral_f");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_dfnum);
- __Pyx_INCREF(__pyx_v_dfden);
- __Pyx_INCREF(__pyx_v_nonc);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_odfnum = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_odfden = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_ononc = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":1795
+ /* "mtrand.pyx":1796
* cdef double fdfnum, fdfden, fnonc
*
* fdfnum = PyFloat_AsDouble(dfnum) # <<<<<<<<<<<<<<
@@ -9019,7 +8934,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_s
*/
__pyx_v_fdfnum = PyFloat_AsDouble(__pyx_v_dfnum);
- /* "mtrand.pyx":1796
+ /* "mtrand.pyx":1797
*
* fdfnum = PyFloat_AsDouble(dfnum)
* fdfden = PyFloat_AsDouble(dfden) # <<<<<<<<<<<<<<
@@ -9028,7 +8943,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_s
*/
__pyx_v_fdfden = PyFloat_AsDouble(__pyx_v_dfden);
- /* "mtrand.pyx":1797
+ /* "mtrand.pyx":1798
* fdfnum = PyFloat_AsDouble(dfnum)
* fdfden = PyFloat_AsDouble(dfden)
* fnonc = PyFloat_AsDouble(nonc) # <<<<<<<<<<<<<<
@@ -9037,7 +8952,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_s
*/
__pyx_v_fnonc = PyFloat_AsDouble(__pyx_v_nonc);
- /* "mtrand.pyx":1798
+ /* "mtrand.pyx":1799
* fdfden = PyFloat_AsDouble(dfden)
* fnonc = PyFloat_AsDouble(nonc)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -9047,103 +8962,85 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_s
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":1799
+ /* "mtrand.pyx":1800
* fnonc = PyFloat_AsDouble(nonc)
* if not PyErr_Occurred():
* if fdfnum <= 1: # <<<<<<<<<<<<<<
* raise ValueError("dfnum <= 1")
* if fdfden <= 0:
*/
- __pyx_t_1 = (__pyx_v_fdfnum <= 1);
+ __pyx_t_1 = (__pyx_v_fdfnum <= 1.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":1800
+ /* "mtrand.pyx":1801
* if not PyErr_Occurred():
* if fdfnum <= 1:
* raise ValueError("dfnum <= 1") # <<<<<<<<<<<<<<
* if fdfden <= 0:
* raise ValueError("dfden <= 0")
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_46), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_17));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_17));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_17));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":1801
+ /* "mtrand.pyx":1802
* if fdfnum <= 1:
* raise ValueError("dfnum <= 1")
* if fdfden <= 0: # <<<<<<<<<<<<<<
* raise ValueError("dfden <= 0")
* if fnonc < 0:
*/
- __pyx_t_1 = (__pyx_v_fdfden <= 0);
+ __pyx_t_1 = (__pyx_v_fdfden <= 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":1802
+ /* "mtrand.pyx":1803
* raise ValueError("dfnum <= 1")
* if fdfden <= 0:
* raise ValueError("dfden <= 0") # <<<<<<<<<<<<<<
* if fnonc < 0:
* raise ValueError("nonc < 0")
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_16));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_16));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_16));
- __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_47), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":1803
+ /* "mtrand.pyx":1804
* if fdfden <= 0:
* raise ValueError("dfden <= 0")
* if fnonc < 0: # <<<<<<<<<<<<<<
* raise ValueError("nonc < 0")
* return cont3_array_sc(self.internal_state, rk_noncentral_f, size,
*/
- __pyx_t_1 = (__pyx_v_fnonc < 0);
+ __pyx_t_1 = (__pyx_v_fnonc < 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":1804
+ /* "mtrand.pyx":1805
* raise ValueError("dfden <= 0")
* if fnonc < 0:
* raise ValueError("nonc < 0") # <<<<<<<<<<<<<<
* return cont3_array_sc(self.internal_state, rk_noncentral_f, size,
* fdfnum, fdfden, fnonc)
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_49), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_18));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_18));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L9;
}
__pyx_L9:;
- /* "mtrand.pyx":1805
+ /* "mtrand.pyx":1806
* if fnonc < 0:
* raise ValueError("nonc < 0")
* return cont3_array_sc(self.internal_state, rk_noncentral_f, size, # <<<<<<<<<<<<<<
@@ -9152,23 +9049,23 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_s
*/
__Pyx_XDECREF(__pyx_r);
- /* "mtrand.pyx":1806
+ /* "mtrand.pyx":1807
* raise ValueError("nonc < 0")
* return cont3_array_sc(self.internal_state, rk_noncentral_f, size,
* fdfnum, fdfden, fnonc) # <<<<<<<<<<<<<<
*
* PyErr_Clear()
*/
- __pyx_t_3 = __pyx_f_6mtrand_cont3_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_noncentral_f, __pyx_v_size, __pyx_v_fdfnum, __pyx_v_fdfden, __pyx_v_fnonc); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont3_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_noncentral_f, __pyx_v_size, __pyx_v_fdfnum, __pyx_v_fdfden, __pyx_v_fnonc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L6;
}
__pyx_L6:;
- /* "mtrand.pyx":1808
+ /* "mtrand.pyx":1809
* fdfnum, fdfden, fnonc)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -9177,247 +9074,229 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_s
*/
PyErr_Clear();
- /* "mtrand.pyx":1810
+ /* "mtrand.pyx":1811
* PyErr_Clear()
*
* odfnum = <ndarray>PyArray_FROM_OTF(dfnum, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* odfden = <ndarray>PyArray_FROM_OTF(dfden, NPY_DOUBLE, NPY_ALIGNED)
* ononc = <ndarray>PyArray_FROM_OTF(nonc, NPY_DOUBLE, NPY_ALIGNED)
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_dfnum, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_dfnum, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_odfnum));
- __pyx_v_odfnum = ((PyArrayObject *)__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_odfnum = ((PyArrayObject *)__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":1811
+ /* "mtrand.pyx":1812
*
* odfnum = <ndarray>PyArray_FROM_OTF(dfnum, NPY_DOUBLE, NPY_ALIGNED)
* odfden = <ndarray>PyArray_FROM_OTF(dfden, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* ononc = <ndarray>PyArray_FROM_OTF(nonc, NPY_DOUBLE, NPY_ALIGNED)
*
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_dfden, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_dfden, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_odfden));
- __pyx_v_odfden = ((PyArrayObject *)__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_odfden = ((PyArrayObject *)__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":1812
+ /* "mtrand.pyx":1813
* odfnum = <ndarray>PyArray_FROM_OTF(dfnum, NPY_DOUBLE, NPY_ALIGNED)
* odfden = <ndarray>PyArray_FROM_OTF(dfden, NPY_DOUBLE, NPY_ALIGNED)
* ononc = <ndarray>PyArray_FROM_OTF(nonc, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
*
* if np.any(np.less_equal(odfnum, 1.0)):
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_nonc, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_nonc, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_ononc));
- __pyx_v_ononc = ((PyArrayObject *)__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_ononc = ((PyArrayObject *)__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":1814
+ /* "mtrand.pyx":1815
* ononc = <ndarray>PyArray_FROM_OTF(nonc, NPY_DOUBLE, NPY_ALIGNED)
*
* if np.any(np.less_equal(odfnum, 1.0)): # <<<<<<<<<<<<<<
* raise ValueError("dfnum <= 1")
* if np.any(np.less_equal(odfden, 0.0)):
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(((PyObject *)__pyx_v_odfnum));
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_odfnum));
__Pyx_GIVEREF(((PyObject *)__pyx_v_odfnum));
- PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":1815
+ /* "mtrand.pyx":1816
*
* if np.any(np.less_equal(odfnum, 1.0)):
* raise ValueError("dfnum <= 1") # <<<<<<<<<<<<<<
* if np.any(np.less_equal(odfden, 0.0)):
* raise ValueError("dfden <= 0")
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_17));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_17));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_17));
- __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_50), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L10;
}
__pyx_L10:;
- /* "mtrand.pyx":1816
+ /* "mtrand.pyx":1817
* if np.any(np.less_equal(odfnum, 1.0)):
* raise ValueError("dfnum <= 1")
* if np.any(np.less_equal(odfden, 0.0)): # <<<<<<<<<<<<<<
* raise ValueError("dfden <= 0")
* if np.any(np.less(ononc, 0.0)):
*/
- __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
__Pyx_INCREF(((PyObject *)__pyx_v_odfden));
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_odfden));
__Pyx_GIVEREF(((PyObject *)__pyx_v_odfden));
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":1817
+ /* "mtrand.pyx":1818
* raise ValueError("dfnum <= 1")
* if np.any(np.less_equal(odfden, 0.0)):
* raise ValueError("dfden <= 0") # <<<<<<<<<<<<<<
* if np.any(np.less(ononc, 0.0)):
* raise ValueError("nonc < 0")
*/
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_16));
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_16));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_16));
- __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_Raise(__pyx_t_4, 0, 0);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L11;
}
__pyx_L11:;
- /* "mtrand.pyx":1818
+ /* "mtrand.pyx":1819
* if np.any(np.less_equal(odfden, 0.0)):
* raise ValueError("dfden <= 0")
* if np.any(np.less(ononc, 0.0)): # <<<<<<<<<<<<<<
* raise ValueError("nonc < 0")
* return cont3_array(self.internal_state, rk_noncentral_f, size, odfnum,
*/
- __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__any); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__less); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
__Pyx_INCREF(((PyObject *)__pyx_v_ononc));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_ononc));
+ PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_ononc));
__Pyx_GIVEREF(((PyObject *)__pyx_v_ononc));
- PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- __pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- __pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":1819
+ /* "mtrand.pyx":1820
* raise ValueError("dfden <= 0")
* if np.any(np.less(ononc, 0.0)):
* raise ValueError("nonc < 0") # <<<<<<<<<<<<<<
* return cont3_array(self.internal_state, rk_noncentral_f, size, odfnum,
* odfden, ononc)
*/
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_18));
- PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_18));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18));
- __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_52), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L12;
}
__pyx_L12:;
- /* "mtrand.pyx":1820
+ /* "mtrand.pyx":1821
* if np.any(np.less(ononc, 0.0)):
* raise ValueError("nonc < 0")
* return cont3_array(self.internal_state, rk_noncentral_f, size, odfnum, # <<<<<<<<<<<<<<
@@ -9426,14 +9305,14 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_s
*/
__Pyx_XDECREF(__pyx_r);
- /* "mtrand.pyx":1821
+ /* "mtrand.pyx":1822
* raise ValueError("nonc < 0")
* return cont3_array(self.internal_state, rk_noncentral_f, size, odfnum,
* odfden, ononc) # <<<<<<<<<<<<<<
*
* def chisquare(self, df, size=None):
*/
- __pyx_t_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_noncentral_f, __pyx_v_size, __pyx_v_odfnum, __pyx_v_odfden, __pyx_v_ononc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_noncentral_f, __pyx_v_size, __pyx_v_odfnum, __pyx_v_odfden, __pyx_v_ononc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
@@ -9452,17 +9331,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_s
__Pyx_DECREF((PyObject *)__pyx_v_odfnum);
__Pyx_DECREF((PyObject *)__pyx_v_odfden);
__Pyx_DECREF((PyObject *)__pyx_v_ononc);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_dfnum);
- __Pyx_DECREF(__pyx_v_dfden);
- __Pyx_DECREF(__pyx_v_nonc);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":1823
+/* "mtrand.pyx":1824
* odfden, ononc)
*
* def chisquare(self, df, size=None): # <<<<<<<<<<<<<<
@@ -9470,9 +9344,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_s
* chisquare(df, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_chisquare[] = "\n chisquare(df, size=None)\n\n Draw samples from a chi-square distribution.\n\n When `df` independent random variables, each with standard normal\n distributions (mean 0, variance 1), are squared and summed, the\n resulting distribution is chi-square (see Notes). This distribution\n is often used in hypothesis testing.\n\n Parameters\n ----------\n df : int\n Number of degrees of freedom.\n size : tuple of ints, int, optional\n Size of the returned array. By default, a scalar is\n returned.\n\n Returns\n -------\n output : ndarray\n Samples drawn from the distribution, packed in a `size`-shaped\n array.\n\n Raises\n ------\n ValueError\n When `df` <= 0 or when an inappropriate `size` (e.g. ``size=-1``)\n is given.\n\n Notes\n -----\n The variable obtained by summing the squares of `df` independent,\n standard normally distributed random variables:\n\n .. math:: Q = \\sum_{i=0}^{\\mathtt{df}} X^2_i\n\n is chi-square distributed, denoted\n\n .. math:: Q \\sim \\chi^2_k.\n\n The probability density function of the chi-squared distribution is\n\n .. math:: p(x) = \\frac{(1/2)^{k/2}}{\\Gamma(k/2)}\n x^{k/2 - 1} e^{-x/2},\n\n where :math:`\\Gamma` is the gamma function,\n\n .. math:: \\Gamma(x) = \\int_0^{-\\infty} t^{x - 1} e^{-t} dt.\n\n References\n ----------\n `NIST/SEMATECH e-Handbook of Statistical Methods\n <http://www.itl.nist.gov/div898/handbook/eda/section3/eda3666.htm>`_\n\n Examples\n --------\n >>> np.random.chisquare(2,4)\n array([ 1.89920014, 9.00867716, 3.13710533, 5.62318272])\n\n ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_25chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_25chisquare[] = "\n chisquare(df, size=None)\n\n Draw samples from a chi-square distribution.\n\n When `df` independent random variables, each with standard normal\n distributions (mean 0, variance 1), are squared and summed, the\n resulting distribution is chi-square (see Notes). This distribution\n is often used in hypothesis testing.\n\n Parameters\n ----------\n df : int\n Number of degrees of freedom.\n size : tuple of ints, int, optional\n Size of the returned array. By default, a scalar is\n returned.\n\n Returns\n -------\n output : ndarray\n Samples drawn from the distribution, packed in a `size`-shaped\n array.\n\n Raises\n ------\n ValueError\n When `df` <= 0 or when an inappropriate `size` (e.g. ``size=-1``)\n is given.\n\n Notes\n -----\n The variable obtained by summing the squares of `df` independent,\n standard normally distributed random variables:\n\n .. math:: Q = \\sum_{i=0}^{\\mathtt{df}} X^2_i\n\n is chi-square distributed, denoted\n\n .. math:: Q \\sim \\chi^2_k.\n\n The probability density function of the chi-squared distribution is\n\n .. math:: p(x) = \\frac{(1/2)^{k/2}}{\\Gamma(k/2)}\n x^{k/2 - 1} e^{-x/2},\n\n where :math:`\\Gamma` is the gamma function,\n\n .. math:: \\Gamma(x) = \\int_0^{-\\infty} t^{x - 1} e^{-t} dt.\n\n References\n ----------\n `NIST/SEMATECH e-Handbook of Statistical Methods\n <http://www.itl.nist.gov/div898/handbook/eda/section3/eda3666.htm>`_\n\n Examples\n --------\n >>> np.random.chisquare(2,4)\n array([ 1.89920014, 9.00867716, 3.13710533, 5.62318272])\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_25chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_df = 0;
PyObject *__pyx_v_size = 0;
PyArrayObject *__pyx_v_odf;
@@ -9501,13 +9375,13 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self
if (likely(values[0])) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[1] = value; kw_args--; }
+ if (value) { values[1] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "chisquare") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1823; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "chisquare") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1824; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_df = values[0];
__pyx_v_size = values[1];
@@ -9522,17 +9396,15 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("chisquare", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1823; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("chisquare", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1824; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.chisquare");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_df);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_odf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":1888
+ /* "mtrand.pyx":1889
* cdef double fdf
*
* fdf = PyFloat_AsDouble(df) # <<<<<<<<<<<<<<
@@ -9541,7 +9413,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self
*/
__pyx_v_fdf = PyFloat_AsDouble(__pyx_v_df);
- /* "mtrand.pyx":1889
+ /* "mtrand.pyx":1890
*
* fdf = PyFloat_AsDouble(df)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -9551,39 +9423,33 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":1890
+ /* "mtrand.pyx":1891
* fdf = PyFloat_AsDouble(df)
* if not PyErr_Occurred():
* if fdf <= 0: # <<<<<<<<<<<<<<
* raise ValueError("df <= 0")
* return cont1_array_sc(self.internal_state, rk_chisquare, size, fdf)
*/
- __pyx_t_1 = (__pyx_v_fdf <= 0);
+ __pyx_t_1 = (__pyx_v_fdf <= 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":1891
+ /* "mtrand.pyx":1892
* if not PyErr_Occurred():
* if fdf <= 0:
* raise ValueError("df <= 0") # <<<<<<<<<<<<<<
* return cont1_array_sc(self.internal_state, rk_chisquare, size, fdf)
*
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_54), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_19));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":1892
+ /* "mtrand.pyx":1893
* if fdf <= 0:
* raise ValueError("df <= 0")
* return cont1_array_sc(self.internal_state, rk_chisquare, size, fdf) # <<<<<<<<<<<<<<
@@ -9591,16 +9457,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self
* PyErr_Clear()
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_chisquare, __pyx_v_size, __pyx_v_fdf); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_chisquare, __pyx_v_size, __pyx_v_fdf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L6;
}
__pyx_L6:;
- /* "mtrand.pyx":1894
+ /* "mtrand.pyx":1895
* return cont1_array_sc(self.internal_state, rk_chisquare, size, fdf)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -9609,87 +9475,81 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self
*/
PyErr_Clear();
- /* "mtrand.pyx":1896
+ /* "mtrand.pyx":1897
* PyErr_Clear()
*
* odf = <ndarray>PyArray_FROM_OTF(df, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* if np.any(np.less_equal(odf, 0.0)):
* raise ValueError("df <= 0")
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_df, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_df, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_odf));
- __pyx_v_odf = ((PyArrayObject *)__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_odf = ((PyArrayObject *)__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":1897
+ /* "mtrand.pyx":1898
*
* odf = <ndarray>PyArray_FROM_OTF(df, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(odf, 0.0)): # <<<<<<<<<<<<<<
* raise ValueError("df <= 0")
* return cont1_array(self.internal_state, rk_chisquare, size, odf)
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(((PyObject *)__pyx_v_odf));
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_odf));
__Pyx_GIVEREF(((PyObject *)__pyx_v_odf));
- PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":1898
+ /* "mtrand.pyx":1899
* odf = <ndarray>PyArray_FROM_OTF(df, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(odf, 0.0)):
* raise ValueError("df <= 0") # <<<<<<<<<<<<<<
* return cont1_array(self.internal_state, rk_chisquare, size, odf)
*
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_19));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
- __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_55), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":1899
+ /* "mtrand.pyx":1900
* if np.any(np.less_equal(odf, 0.0)):
* raise ValueError("df <= 0")
* return cont1_array(self.internal_state, rk_chisquare, size, odf) # <<<<<<<<<<<<<<
@@ -9697,10 +9557,10 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self
* def noncentral_chisquare(self, df, nonc, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_5 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_chisquare, __pyx_v_size, __pyx_v_odf); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_r = __pyx_t_5;
- __pyx_t_5 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_chisquare, __pyx_v_size, __pyx_v_odf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -9714,15 +9574,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self
__pyx_r = NULL;
__pyx_L0:;
__Pyx_DECREF((PyObject *)__pyx_v_odf);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_df);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":1901
+/* "mtrand.pyx":1902
* return cont1_array(self.internal_state, rk_chisquare, size, odf)
*
* def noncentral_chisquare(self, df, nonc, size=None): # <<<<<<<<<<<<<<
@@ -9730,9 +9587,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self
* noncentral_chisquare(df, nonc, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_noncentral_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_noncentral_chisquare[] = "\n"" noncentral_chisquare(df, nonc, size=None)\n""\n"" Draw samples from a noncentral chi-square distribution.\n""\n"" The noncentral :math:`\\chi^2` distribution is a generalisation of\n"" the :math:`\\chi^2` distribution.\n""\n"" Parameters\n"" ----------\n"" df : int\n"" Degrees of freedom, should be >= 1.\n"" nonc : float\n"" Non-centrality, should be > 0.\n"" size : int or tuple of ints\n"" Shape of the output.\n""\n"" Notes\n"" -----\n"" The probability density function for the noncentral Chi-square distribution\n"" is\n""\n"" .. math:: P(x;df,nonc) = \\sum^{\\infty}_{i=0}\n"" \\frac{e^{-nonc/2}(nonc/2)^{i}}{i!}P_{Y_{df+2i}}(x),\n""\n"" where :math:`Y_{q}` is the Chi-square with q degrees of freedom.\n""\n"" In Delhi (2007), it is noted that the noncentral chi-square is useful in\n"" bombing and coverage problems, the probability of killing the point target\n"" given by the noncentral chi-squared distribution.\n""\n"" References\n"" ----------\n"" .. [1] Delhi, M.S. Holla, \"On a noncentral chi-square distribution in the\n"" analysis of weapon systems effectiveness\", Metrika, Volume 15,\n"" Number 1 / December, 1970.\n"" .. [2] Wikipedia, \"Noncentral chi-square distribution\"\n"" http://en.wikipedia.org/wiki/Noncentral_chi-square_distribution\n""\n"" Examples\n"" --------\n"" Draw values from the distribution and plot the histogram\n""\n"" >>> import matplotlib.pyplot as plt\n"" >>> values = plt.hist(np.random.noncentral_chisquare(3, 20, 100000),\n"" ... bins=200, normed=True)\n"" >>> plt.show()\n""\n"" Draw values from a noncentral chisquare with very small noncentrality,\n"" and compare to a chisquare.\n""\n"" >>> plt.figure()\n"" >>> values = plt.hist(np.random.noncentral_chisquare(3, .0000001, 100000),\n"" ... bins=np.arange(0., 25, .1), normed=True)\n"" >>> values2 = plt.hist(np.random.chisquare(3, 100000),\n"" ... bins=np.arange(0., 25, .1), normed=True)\n"" >>> plt.plot(values[1][0:-1], values[0]-values2[0], 'ob')\n"" >>> plt.show()\n""\n"" Demonstrate how large values of non-centrality lead to a more symmetric\n"" distribution.\n""\n"" >>> plt.figure()\n"" >>> values = plt.hist(np.random.noncentral_chisquare(3, 20, 100000),\n"" ... bins=200, normed=True)\n"" >>> plt.show()\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_noncentral_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_26noncentral_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_26noncentral_chisquare[] = "\n noncentral_chisquare(df, nonc, size=None)\n\n Draw samples from a noncentral chi-square distribution.\n\n The noncentral :math:`\\chi^2` distribution is a generalisation of\n the :math:`\\chi^2` distribution.\n\n Parameters\n ----------\n df : int\n Degrees of freedom, should be >= 1.\n nonc : float\n Non-centrality, should be > 0.\n size : int or tuple of ints\n Shape of the output.\n\n Notes\n -----\n The probability density function for the noncentral Chi-square distribution\n is\n\n .. math:: P(x;df,nonc) = \\sum^{\\infty}_{i=0}\n \\frac{e^{-nonc/2}(nonc/2)^{i}}{i!}P_{Y_{df+2i}}(x),\n\n where :math:`Y_{q}` is the Chi-square with q degrees of freedom.\n\n In Delhi (2007), it is noted that the noncentral chi-square is useful in\n bombing and coverage problems, the probability of killing the point target\n given by the noncentral chi-squared distribution.\n\n References\n ----------\n .. [1] Delhi, M.S. Holla, \"On a noncentral chi-square distribution in the\n analysis of weapon systems effectiveness\", Metrika, Volume 15,\n Number 1 / December, 1970.\n .. [2] Wikipedia, \"Noncentral chi-square distribution\"\n http://en.wikipedia.org/wiki/Noncentral_chi-square_distribution\n\n Examples\n --------\n Draw values from the distribution and plot the histogram\n\n >>> import matplotlib.pyplot as plt\n >>> values = plt.hist(np.random.noncentral_chisquare(3, 20, 100000),\n ... bins=200, normed=True)\n >>> plt.show()\n\n Draw values from a noncentral chisquare with very small noncentrality,\n and compare to a chisquare.\n\n >>> plt.figure()\n >>> values = plt.hist(np.random.noncentral_chisquare(3, .0000001, 100000),\n "" ... bins=np.arange(0., 25, .1), normed=True)\n >>> values2 = plt.hist(np.random.chisquare(3, 100000),\n ... bins=np.arange(0., 25, .1), normed=True)\n >>> plt.plot(values[1][0:-1], values[0]-values2[0], 'ob')\n >>> plt.show()\n\n Demonstrate how large values of non-centrality lead to a more symmetric\n distribution.\n\n >>> plt.figure()\n >>> values = plt.hist(np.random.noncentral_chisquare(3, 20, 100000),\n ... bins=200, normed=True)\n >>> plt.show()\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_26noncentral_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_df = 0;
PyObject *__pyx_v_nonc = 0;
PyObject *__pyx_v_size = 0;
@@ -9768,16 +9625,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_noncentral_chisquare(PyObject *_
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nonc);
if (likely(values[1])) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("noncentral_chisquare", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1901; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("noncentral_chisquare", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1902; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[2] = value; kw_args--; }
+ if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "noncentral_chisquare") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1901; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "noncentral_chisquare") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1902; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_df = values[0];
__pyx_v_nonc = values[1];
@@ -9796,19 +9653,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_noncentral_chisquare(PyObject *_
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("noncentral_chisquare", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1901; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("noncentral_chisquare", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1902; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.noncentral_chisquare");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_df);
- __Pyx_INCREF(__pyx_v_nonc);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_odf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_ononc = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":1972
+ /* "mtrand.pyx":1973
* cdef ndarray odf, ononc
* cdef double fdf, fnonc
* fdf = PyFloat_AsDouble(df) # <<<<<<<<<<<<<<
@@ -9817,7 +9671,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_noncentral_chisquare(PyObject *_
*/
__pyx_v_fdf = PyFloat_AsDouble(__pyx_v_df);
- /* "mtrand.pyx":1973
+ /* "mtrand.pyx":1974
* cdef double fdf, fnonc
* fdf = PyFloat_AsDouble(df)
* fnonc = PyFloat_AsDouble(nonc) # <<<<<<<<<<<<<<
@@ -9826,7 +9680,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_noncentral_chisquare(PyObject *_
*/
__pyx_v_fnonc = PyFloat_AsDouble(__pyx_v_nonc);
- /* "mtrand.pyx":1974
+ /* "mtrand.pyx":1975
* fdf = PyFloat_AsDouble(df)
* fnonc = PyFloat_AsDouble(nonc)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -9836,71 +9690,59 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_noncentral_chisquare(PyObject *_
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":1975
+ /* "mtrand.pyx":1976
* fnonc = PyFloat_AsDouble(nonc)
* if not PyErr_Occurred():
* if fdf <= 1: # <<<<<<<<<<<<<<
* raise ValueError("df <= 0")
* if fnonc <= 0:
*/
- __pyx_t_1 = (__pyx_v_fdf <= 1);
+ __pyx_t_1 = (__pyx_v_fdf <= 1.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":1976
+ /* "mtrand.pyx":1977
* if not PyErr_Occurred():
* if fdf <= 1:
* raise ValueError("df <= 0") # <<<<<<<<<<<<<<
* if fnonc <= 0:
* raise ValueError("nonc <= 0")
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_56), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_19));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":1977
+ /* "mtrand.pyx":1978
* if fdf <= 1:
* raise ValueError("df <= 0")
* if fnonc <= 0: # <<<<<<<<<<<<<<
* raise ValueError("nonc <= 0")
* return cont2_array_sc(self.internal_state, rk_noncentral_chisquare,
*/
- __pyx_t_1 = (__pyx_v_fnonc <= 0);
+ __pyx_t_1 = (__pyx_v_fnonc <= 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":1978
+ /* "mtrand.pyx":1979
* raise ValueError("df <= 0")
* if fnonc <= 0:
* raise ValueError("nonc <= 0") # <<<<<<<<<<<<<<
* return cont2_array_sc(self.internal_state, rk_noncentral_chisquare,
* size, fdf, fnonc)
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_20));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_20));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_20));
- __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_58), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":1979
+ /* "mtrand.pyx":1980
* if fnonc <= 0:
* raise ValueError("nonc <= 0")
* return cont2_array_sc(self.internal_state, rk_noncentral_chisquare, # <<<<<<<<<<<<<<
@@ -9909,14 +9751,14 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_noncentral_chisquare(PyObject *_
*/
__Pyx_XDECREF(__pyx_r);
- /* "mtrand.pyx":1980
+ /* "mtrand.pyx":1981
* raise ValueError("nonc <= 0")
* return cont2_array_sc(self.internal_state, rk_noncentral_chisquare,
* size, fdf, fnonc) # <<<<<<<<<<<<<<
*
* PyErr_Clear()
*/
- __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_noncentral_chisquare, __pyx_v_size, __pyx_v_fdf, __pyx_v_fnonc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_noncentral_chisquare, __pyx_v_size, __pyx_v_fdf, __pyx_v_fnonc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
@@ -9925,7 +9767,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_noncentral_chisquare(PyObject *_
}
__pyx_L6:;
- /* "mtrand.pyx":1982
+ /* "mtrand.pyx":1983
* size, fdf, fnonc)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -9934,167 +9776,155 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_noncentral_chisquare(PyObject *_
*/
PyErr_Clear();
- /* "mtrand.pyx":1984
+ /* "mtrand.pyx":1985
* PyErr_Clear()
*
* odf = <ndarray>PyArray_FROM_OTF(df, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* ononc = <ndarray>PyArray_FROM_OTF(nonc, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(odf, 0.0)):
*/
- __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_df, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_df, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_odf));
__pyx_v_odf = ((PyArrayObject *)__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":1985
+ /* "mtrand.pyx":1986
*
* odf = <ndarray>PyArray_FROM_OTF(df, NPY_DOUBLE, NPY_ALIGNED)
* ononc = <ndarray>PyArray_FROM_OTF(nonc, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* if np.any(np.less_equal(odf, 0.0)):
* raise ValueError("df <= 1")
*/
- __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_nonc, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_nonc, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_ononc));
__pyx_v_ononc = ((PyArrayObject *)__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":1986
+ /* "mtrand.pyx":1987
* odf = <ndarray>PyArray_FROM_OTF(df, NPY_DOUBLE, NPY_ALIGNED)
* ononc = <ndarray>PyArray_FROM_OTF(nonc, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(odf, 0.0)): # <<<<<<<<<<<<<<
* raise ValueError("df <= 1")
* if np.any(np.less_equal(ononc, 0.0)):
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(((PyObject *)__pyx_v_odf));
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_odf));
__Pyx_GIVEREF(((PyObject *)__pyx_v_odf));
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":1987
+ /* "mtrand.pyx":1988
* ononc = <ndarray>PyArray_FROM_OTF(nonc, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(odf, 0.0)):
* raise ValueError("df <= 1") # <<<<<<<<<<<<<<
* if np.any(np.less_equal(ononc, 0.0)):
* raise ValueError("nonc < 0")
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_60), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_21));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_21));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_21));
- __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L9;
}
__pyx_L9:;
- /* "mtrand.pyx":1988
+ /* "mtrand.pyx":1989
* if np.any(np.less_equal(odf, 0.0)):
* raise ValueError("df <= 1")
* if np.any(np.less_equal(ononc, 0.0)): # <<<<<<<<<<<<<<
* raise ValueError("nonc < 0")
* return cont2_array(self.internal_state, rk_noncentral_chisquare, size,
*/
- __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
__Pyx_INCREF(((PyObject *)__pyx_v_ononc));
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_ononc));
__Pyx_GIVEREF(((PyObject *)__pyx_v_ononc));
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":1989
+ /* "mtrand.pyx":1990
* raise ValueError("df <= 1")
* if np.any(np.less_equal(ononc, 0.0)):
* raise ValueError("nonc < 0") # <<<<<<<<<<<<<<
* return cont2_array(self.internal_state, rk_noncentral_chisquare, size,
* odf, ononc)
*/
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_18));
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_18));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18));
- __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_Raise(__pyx_t_4, 0, 0);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_61), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L10;
}
__pyx_L10:;
- /* "mtrand.pyx":1990
+ /* "mtrand.pyx":1991
* if np.any(np.less_equal(ononc, 0.0)):
* raise ValueError("nonc < 0")
* return cont2_array(self.internal_state, rk_noncentral_chisquare, size, # <<<<<<<<<<<<<<
@@ -10103,17 +9933,17 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_noncentral_chisquare(PyObject *_
*/
__Pyx_XDECREF(__pyx_r);
- /* "mtrand.pyx":1991
+ /* "mtrand.pyx":1992
* raise ValueError("nonc < 0")
* return cont2_array(self.internal_state, rk_noncentral_chisquare, size,
* odf, ononc) # <<<<<<<<<<<<<<
*
* def standard_cauchy(self, size=None):
*/
- __pyx_t_4 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_noncentral_chisquare, __pyx_v_size, __pyx_v_odf, __pyx_v_ononc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_r = __pyx_t_4;
- __pyx_t_4 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_noncentral_chisquare, __pyx_v_size, __pyx_v_odf, __pyx_v_ononc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -10128,16 +9958,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_noncentral_chisquare(PyObject *_
__pyx_L0:;
__Pyx_DECREF((PyObject *)__pyx_v_odf);
__Pyx_DECREF((PyObject *)__pyx_v_ononc);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_df);
- __Pyx_DECREF(__pyx_v_nonc);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":1993
+/* "mtrand.pyx":1994
* odf, ononc)
*
* def standard_cauchy(self, size=None): # <<<<<<<<<<<<<<
@@ -10145,9 +9971,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_noncentral_chisquare(PyObject *_
* standard_cauchy(size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_standard_cauchy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_standard_cauchy[] = "\n"" standard_cauchy(size=None)\n""\n"" Standard Cauchy distribution with mode = 0.\n""\n"" Also known as the Lorentz distribution.\n""\n"" Parameters\n"" ----------\n"" size : int or tuple of ints\n"" Shape of the output.\n""\n"" Returns\n"" -------\n"" samples : ndarray or scalar\n"" The drawn samples.\n""\n"" Notes\n"" -----\n"" The probability density function for the full Cauchy distribution is\n""\n"" .. math:: P(x; x_0, \\gamma) = \\frac{1}{\\pi \\gamma \\bigl[ 1+\n"" (\\frac{x-x_0}{\\gamma})^2 \\bigr] }\n""\n"" and the Standard Cauchy distribution just sets :math:`x_0=0` and\n"" :math:`\\gamma=1`\n""\n"" The Cauchy distribution arises in the solution to the driven harmonic\n"" oscillator problem, and also describes spectral line broadening. It\n"" also describes the distribution of values at which a line tilted at\n"" a random angle will cut the x axis.\n""\n"" When studying hypothesis tests that assume normality, seeing how the\n"" tests perform on data from a Cauchy distribution is a good indicator of\n"" their sensitivity to a heavy-tailed distribution, since the Cauchy looks\n"" very much like a Gaussian distribution, but with heavier tails.\n""\n"" References\n"" ----------\n"" ..[1] NIST/SEMATECH e-Handbook of Statistical Methods, \"Cauchy\n"" Distribution\",\n"" http://www.itl.nist.gov/div898/handbook/eda/section3/eda3663.htm\n"" ..[2] Weisstein, Eric W. \"Cauchy Distribution.\" From MathWorld--A\n"" Wolfram Web Resource.\n"" http://mathworld.wolfram.com/CauchyDistribution.html\n"" ..[3] Wikipedia, \"Cauchy distribution\"\n"" http://en.wikipedia.org/wiki/Cauchy_distribution\n""\n"" Examples\n"" --------\n"" Draw samples and plot the distribution:\n""\n"" >>> s = np.random.standard_cauchy(1000000)\n"" >>> s = s[(s>-25) & (s<25)] # truncate distribution so it plots well\n"" >>> plt.hist(s, bins=100)\n"" >>> plt.show()\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_standard_cauchy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_27standard_cauchy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_27standard_cauchy[] = "\n standard_cauchy(size=None)\n\n Standard Cauchy distribution with mode = 0.\n\n Also known as the Lorentz distribution.\n\n Parameters\n ----------\n size : int or tuple of ints\n Shape of the output.\n\n Returns\n -------\n samples : ndarray or scalar\n The drawn samples.\n\n Notes\n -----\n The probability density function for the full Cauchy distribution is\n\n .. math:: P(x; x_0, \\gamma) = \\frac{1}{\\pi \\gamma \\bigl[ 1+\n (\\frac{x-x_0}{\\gamma})^2 \\bigr] }\n\n and the Standard Cauchy distribution just sets :math:`x_0=0` and\n :math:`\\gamma=1`\n\n The Cauchy distribution arises in the solution to the driven harmonic\n oscillator problem, and also describes spectral line broadening. It\n also describes the distribution of values at which a line tilted at\n a random angle will cut the x axis.\n\n When studying hypothesis tests that assume normality, seeing how the\n tests perform on data from a Cauchy distribution is a good indicator of\n their sensitivity to a heavy-tailed distribution, since the Cauchy looks\n very much like a Gaussian distribution, but with heavier tails.\n\n References\n ----------\n ..[1] NIST/SEMATECH e-Handbook of Statistical Methods, \"Cauchy\n Distribution\",\n http://www.itl.nist.gov/div898/handbook/eda/section3/eda3663.htm\n ..[2] Weisstein, Eric W. \"Cauchy Distribution.\" From MathWorld--A\n Wolfram Web Resource.\n http://mathworld.wolfram.com/CauchyDistribution.html\n ..[3] Wikipedia, \"Cauchy distribution\"\n http://en.wikipedia.org/wiki/Cauchy_distribution\n\n Examples\n --------\n Draw samples and plot the distribution:\n\n >>> s = np.random.standard_cauchy(1000000)\n >>> s = s[(s>-25) & (s<25)""] # truncate distribution so it plots well\n >>> plt.hist(s, bins=100)\n >>> plt.show()\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_27standard_cauchy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_size = 0;
PyObject *__pyx_r = NULL;
PyObject *__pyx_t_1 = NULL;
@@ -10164,13 +9990,13 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_cauchy(PyObject *__pyx_
}
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 0:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[0] = value; kw_args--; }
+ if (value) { values[0] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "standard_cauchy") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1993; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "standard_cauchy") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_size = values[0];
} else {
@@ -10183,13 +10009,14 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_cauchy(PyObject *__pyx_
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("standard_cauchy", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1993; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("standard_cauchy", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.standard_cauchy");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- /* "mtrand.pyx":2052
+ /* "mtrand.pyx":2053
*
* """
* return cont0_array(self.internal_state, rk_standard_cauchy, size) # <<<<<<<<<<<<<<
@@ -10197,7 +10024,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_cauchy(PyObject *__pyx_
* def standard_t(self, df, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_standard_cauchy, __pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_standard_cauchy, __pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -10215,7 +10042,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_cauchy(PyObject *__pyx_
return __pyx_r;
}
-/* "mtrand.pyx":2054
+/* "mtrand.pyx":2055
* return cont0_array(self.internal_state, rk_standard_cauchy, size)
*
* def standard_t(self, df, size=None): # <<<<<<<<<<<<<<
@@ -10223,9 +10050,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_cauchy(PyObject *__pyx_
* standard_t(df, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_standard_t[] = "\n"" standard_t(df, size=None)\n""\n"" Standard Student's t distribution with df degrees of freedom.\n""\n"" A special case of the hyperbolic distribution.\n"" As `df` gets large, the result resembles that of the standard normal\n"" distribution (`standard_normal`).\n""\n"" Parameters\n"" ----------\n"" df : int\n"" Degrees of freedom, should be > 0.\n"" size : int or tuple of ints, optional\n"" Output shape. Default is None, in which case a single value is\n"" returned.\n""\n"" Returns\n"" -------\n"" samples : ndarray or scalar\n"" Drawn samples.\n""\n"" Notes\n"" -----\n"" The probability density function for the t distribution is\n""\n"" .. math:: P(x, df) = \\frac{\\Gamma(\\frac{df+1}{2})}{\\sqrt{\\pi df}\n"" \\Gamma(\\frac{df}{2})}\\Bigl( 1+\\frac{x^2}{df} \\Bigr)^{-(df+1)/2}\n""\n"" The t test is based on an assumption that the data come from a Normal\n"" distribution. The t test provides a way to test whether the sample mean\n"" (that is the mean calculated from the data) is a good estimate of the true\n"" mean.\n""\n"" The derivation of the t-distribution was forst published in 1908 by William\n"" Gisset while working for the Guinness Brewery in Dublin. Due to proprietary\n"" issues, he had to publish under a pseudonym, and so he used the name\n"" Student.\n""\n"" References\n"" ----------\n"" .. [1] Dalgaard, Peter, \"Introductory Statistics With R\",\n"" Springer, 2002.\n"" .. [2] Wikipedia, \"Student's t-distribution\"\n"" http://en.wikipedia.org/wiki/Student's_t-distribution\n""\n"" Examples\n"" --------\n"" From Dalgaard page 83 [1]_, suppose the daily energy intake for 11\n"" women in Kj is:\n""\n"" >>> intake = np.array([5260., 5470, 5640, 6180, 6390, 6515, 6805, 7515, \\\n"" ... 7515, 8230, 8770])\n""\n"" Does their energy intake deviate systematically from the recommended\n"" value of 7725 kJ?\n""\n"" We have 10 degrees of freedom, so is the sample mean within 95% of the\n"" recommended value?\n""\n"" >>> s = np.random.standard_t(10, size=100000)\n"" >>> np.mean(intake)\n"" 6753.636363636364\n"" >>> intake.std(ddof=1)\n"" 1142.1232221373727\n""\n"" Calculate the t statistic, setting the ddof parameter to the unbiased\n"" value so the divisor in the standard deviation will be degrees of\n"" freedom, N-1.\n""\n"" >>> t = (np.mean(intake)-7725)/(intake.std(ddof=1)/np.sqrt(len(intake)))\n"" >>> import matplotlib.pyplot as plt\n"" >>> h = plt.hist(s, bins=100, normed=True)\n""\n"" For a one-sided t-test, how far out in the distribution does the t\n"" statistic appear?\n""\n"" >>> >>> np.sum(s<t) / float(len(s))\n"" 0.0090699999999999999 #random\n""\n"" So the p-value is about 0.009, which says the null hypothesis has a\n"" probability of about 99% of being true.\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_28standard_t(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_28standard_t[] = "\n standard_t(df, size=None)\n\n Standard Student's t distribution with df degrees of freedom.\n\n A special case of the hyperbolic distribution.\n As `df` gets large, the result resembles that of the standard normal\n distribution (`standard_normal`).\n\n Parameters\n ----------\n df : int\n Degrees of freedom, should be > 0.\n size : int or tuple of ints, optional\n Output shape. Default is None, in which case a single value is\n returned.\n\n Returns\n -------\n samples : ndarray or scalar\n Drawn samples.\n\n Notes\n -----\n The probability density function for the t distribution is\n\n .. math:: P(x, df) = \\frac{\\Gamma(\\frac{df+1}{2})}{\\sqrt{\\pi df}\n \\Gamma(\\frac{df}{2})}\\Bigl( 1+\\frac{x^2}{df} \\Bigr)^{-(df+1)/2}\n\n The t test is based on an assumption that the data come from a Normal\n distribution. The t test provides a way to test whether the sample mean\n (that is the mean calculated from the data) is a good estimate of the true\n mean.\n\n The derivation of the t-distribution was forst published in 1908 by William\n Gisset while working for the Guinness Brewery in Dublin. Due to proprietary\n issues, he had to publish under a pseudonym, and so he used the name\n Student.\n\n References\n ----------\n .. [1] Dalgaard, Peter, \"Introductory Statistics With R\",\n Springer, 2002.\n .. [2] Wikipedia, \"Student's t-distribution\"\n http://en.wikipedia.org/wiki/Student's_t-distribution\n\n Examples\n --------\n From Dalgaard page 83 [1]_, suppose the daily energy intake for 11\n women in Kj is:\n\n >>> intake = np.array([5260., 5470, 5640, 6180, 6390, 6515, 6805, 7515, \\\n ... 7515, 8230, 8770])\n\n Doe""s their energy intake deviate systematically from the recommended\n value of 7725 kJ?\n\n We have 10 degrees of freedom, so is the sample mean within 95% of the\n recommended value?\n\n >>> s = np.random.standard_t(10, size=100000)\n >>> np.mean(intake)\n 6753.636363636364\n >>> intake.std(ddof=1)\n 1142.1232221373727\n\n Calculate the t statistic, setting the ddof parameter to the unbiased\n value so the divisor in the standard deviation will be degrees of\n freedom, N-1.\n\n >>> t = (np.mean(intake)-7725)/(intake.std(ddof=1)/np.sqrt(len(intake)))\n >>> import matplotlib.pyplot as plt\n >>> h = plt.hist(s, bins=100, normed=True)\n\n For a one-sided t-test, how far out in the distribution does the t\n statistic appear?\n\n >>> >>> np.sum(s<t) / float(len(s))\n 0.0090699999999999999 #random\n\n So the p-value is about 0.009, which says the null hypothesis has a\n probability of about 99% of being true.\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_28standard_t(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_df = 0;
PyObject *__pyx_v_size = 0;
PyArrayObject *__pyx_v_odf;
@@ -10254,13 +10081,13 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_sel
if (likely(values[0])) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[1] = value; kw_args--; }
+ if (value) { values[1] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "standard_t") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2054; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "standard_t") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_df = values[0];
__pyx_v_size = values[1];
@@ -10275,17 +10102,15 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_sel
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("standard_t", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2054; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("standard_t", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.standard_t");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_df);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_odf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":2142
+ /* "mtrand.pyx":2143
* cdef double fdf
*
* fdf = PyFloat_AsDouble(df) # <<<<<<<<<<<<<<
@@ -10294,7 +10119,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_sel
*/
__pyx_v_fdf = PyFloat_AsDouble(__pyx_v_df);
- /* "mtrand.pyx":2143
+ /* "mtrand.pyx":2144
*
* fdf = PyFloat_AsDouble(df)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -10304,39 +10129,33 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_sel
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":2144
+ /* "mtrand.pyx":2145
* fdf = PyFloat_AsDouble(df)
* if not PyErr_Occurred():
* if fdf <= 0: # <<<<<<<<<<<<<<
* raise ValueError("df <= 0")
* return cont1_array_sc(self.internal_state, rk_standard_t, size, fdf)
*/
- __pyx_t_1 = (__pyx_v_fdf <= 0);
+ __pyx_t_1 = (__pyx_v_fdf <= 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":2145
+ /* "mtrand.pyx":2146
* if not PyErr_Occurred():
* if fdf <= 0:
* raise ValueError("df <= 0") # <<<<<<<<<<<<<<
* return cont1_array_sc(self.internal_state, rk_standard_t, size, fdf)
*
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_62), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_19));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":2146
+ /* "mtrand.pyx":2147
* if fdf <= 0:
* raise ValueError("df <= 0")
* return cont1_array_sc(self.internal_state, rk_standard_t, size, fdf) # <<<<<<<<<<<<<<
@@ -10344,16 +10163,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_sel
* PyErr_Clear()
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_standard_t, __pyx_v_size, __pyx_v_fdf); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_standard_t, __pyx_v_size, __pyx_v_fdf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L6;
}
__pyx_L6:;
- /* "mtrand.pyx":2148
+ /* "mtrand.pyx":2149
* return cont1_array_sc(self.internal_state, rk_standard_t, size, fdf)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -10362,87 +10181,81 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_sel
*/
PyErr_Clear();
- /* "mtrand.pyx":2150
+ /* "mtrand.pyx":2151
* PyErr_Clear()
*
* odf = <ndarray> PyArray_FROM_OTF(df, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* if np.any(np.less_equal(odf, 0.0)):
* raise ValueError("df <= 0")
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_df, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_df, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_odf));
- __pyx_v_odf = ((PyArrayObject *)__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_odf = ((PyArrayObject *)__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":2151
+ /* "mtrand.pyx":2152
*
* odf = <ndarray> PyArray_FROM_OTF(df, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(odf, 0.0)): # <<<<<<<<<<<<<<
* raise ValueError("df <= 0")
* return cont1_array(self.internal_state, rk_standard_t, size, odf)
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(((PyObject *)__pyx_v_odf));
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_odf));
__Pyx_GIVEREF(((PyObject *)__pyx_v_odf));
- PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":2152
+ /* "mtrand.pyx":2153
* odf = <ndarray> PyArray_FROM_OTF(df, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(odf, 0.0)):
* raise ValueError("df <= 0") # <<<<<<<<<<<<<<
* return cont1_array(self.internal_state, rk_standard_t, size, odf)
*
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_19));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
- __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_63), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":2153
+ /* "mtrand.pyx":2154
* if np.any(np.less_equal(odf, 0.0)):
* raise ValueError("df <= 0")
* return cont1_array(self.internal_state, rk_standard_t, size, odf) # <<<<<<<<<<<<<<
@@ -10450,10 +10263,10 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_sel
* def vonmises(self, mu, kappa, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_5 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_standard_t, __pyx_v_size, __pyx_v_odf); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_r = __pyx_t_5;
- __pyx_t_5 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_standard_t, __pyx_v_size, __pyx_v_odf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -10467,15 +10280,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_sel
__pyx_r = NULL;
__pyx_L0:;
__Pyx_DECREF((PyObject *)__pyx_v_odf);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_df);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":2155
+/* "mtrand.pyx":2156
* return cont1_array(self.internal_state, rk_standard_t, size, odf)
*
* def vonmises(self, mu, kappa, size=None): # <<<<<<<<<<<<<<
@@ -10483,9 +10293,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_sel
* vonmises(mu, kappa, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_vonmises[] = "\n"" vonmises(mu, kappa, size=None)\n""\n"" Draw samples from a von Mises distribution.\n""\n"" Samples are drawn from a von Mises distribution with specified mode\n"" (mu) and dispersion (kappa), on the interval [-pi, pi].\n""\n"" The von Mises distribution (also known as the circular normal\n"" distribution) is a continuous probability distribution on the unit\n"" circle. It may be thought of as the circular analogue of the normal\n"" distribution.\n""\n"" Parameters\n"" ----------\n"" mu : float\n"" Mode (\"center\") of the distribution.\n"" kappa : float\n"" Dispersion of the distribution, has to be >=0.\n"" size : int or tuple of int\n"" Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n"" ``m * n * k`` samples are drawn.\n""\n"" Returns\n"" -------\n"" samples : scalar or ndarray\n"" The returned samples, which are in the interval [-pi, pi].\n""\n"" See Also\n"" --------\n"" scipy.stats.distributions.vonmises : probability density function,\n"" distribution, or cumulative density function, etc.\n""\n"" Notes\n"" -----\n"" The probability density for the von Mises distribution is\n""\n"" .. math:: p(x) = \\frac{e^{\\kappa cos(x-\\mu)}}{2\\pi I_0(\\kappa)},\n""\n"" where :math:`\\mu` is the mode and :math:`\\kappa` the dispersion,\n"" and :math:`I_0(\\kappa)` is the modified Bessel function of order 0.\n""\n"" The von Mises is named for Richard Edler von Mises, who was born in\n"" Austria-Hungary, in what is now the Ukraine. He fled to the United\n"" States in 1939 and became a professor at Harvard. He worked in\n"" probability theory, aerodynamics, fluid mechanics, and philosophy of\n"" science.\n""\n"" References\n"" ----------\n"" Abramowitz, M. and Stegun, I. A. (ed.), *Handbook of Mathematical\n"" Functions*, New York: Dover, 1965.\n""\n"" von Mises, R., *Mathematical Theory of Probability and Statistics*,\n"" New York: Academic Press, 1964.\n""\n"" Examples\n"" --------\n"" Draw samples from the distribution:\n""\n"" >>> mu, kappa = 0.0, 4.0 # mean and dispersion\n"" >>> s = np.random.vonmises(mu, kappa, 1000)\n""\n"" Display the histogram of the samples, along with\n"" the probability density function:\n""\n"" >>> import matplotlib.pyplot as plt\n"" >>> import scipy.special as sps\n"" >>> count, bins, ignored = plt.hist(s, 50, normed=True)\n"" >>> x = np.arange(-np.pi, np.pi, 2*np.pi/50.)\n"" >>> y = -np.exp(kappa*np.cos(x-mu))/(2*np.pi*sps.jn(0,kappa))\n"" >>> plt.plot(x, y/max(y), linewidth=2, color='r')\n"" >>> plt.show()\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_29vonmises(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_29vonmises[] = "\n vonmises(mu, kappa, size=None)\n\n Draw samples from a von Mises distribution.\n\n Samples are drawn from a von Mises distribution with specified mode\n (mu) and dispersion (kappa), on the interval [-pi, pi].\n\n The von Mises distribution (also known as the circular normal\n distribution) is a continuous probability distribution on the unit\n circle. It may be thought of as the circular analogue of the normal\n distribution.\n\n Parameters\n ----------\n mu : float\n Mode (\"center\") of the distribution.\n kappa : float\n Dispersion of the distribution, has to be >=0.\n size : int or tuple of int\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n samples : scalar or ndarray\n The returned samples, which are in the interval [-pi, pi].\n\n See Also\n --------\n scipy.stats.distributions.vonmises : probability density function,\n distribution, or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the von Mises distribution is\n\n .. math:: p(x) = \\frac{e^{\\kappa cos(x-\\mu)}}{2\\pi I_0(\\kappa)},\n\n where :math:`\\mu` is the mode and :math:`\\kappa` the dispersion,\n and :math:`I_0(\\kappa)` is the modified Bessel function of order 0.\n\n The von Mises is named for Richard Edler von Mises, who was born in\n Austria-Hungary, in what is now the Ukraine. He fled to the United\n States in 1939 and became a professor at Harvard. He worked in\n probability theory, aerodynamics, fluid mechanics, and philosophy of\n science.\n\n References\n ----------\n Abramowitz, M. and Stegun, I. A. (ed.), *Handbook of Mathematical\n Functions*, New York: Dover, 1965.\n\n "" von Mises, R., *Mathematical Theory of Probability and Statistics*,\n New York: Academic Press, 1964.\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> mu, kappa = 0.0, 4.0 # mean and dispersion\n >>> s = np.random.vonmises(mu, kappa, 1000)\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> import scipy.special as sps\n >>> count, bins, ignored = plt.hist(s, 50, normed=True)\n >>> x = np.arange(-np.pi, np.pi, 2*np.pi/50.)\n >>> y = -np.exp(kappa*np.cos(x-mu))/(2*np.pi*sps.jn(0,kappa))\n >>> plt.plot(x, y/max(y), linewidth=2, color='r')\n >>> plt.show()\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_29vonmises(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_mu = 0;
PyObject *__pyx_v_kappa = 0;
PyObject *__pyx_v_size = 0;
@@ -10521,16 +10331,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self,
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__kappa);
if (likely(values[1])) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("vonmises", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("vonmises", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[2] = value; kw_args--; }
+ if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "vonmises") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "vonmises") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_mu = values[0];
__pyx_v_kappa = values[1];
@@ -10549,19 +10359,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self,
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("vonmises", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("vonmises", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.vonmises");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_mu);
- __Pyx_INCREF(__pyx_v_kappa);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_omu = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_okappa = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":2234
+ /* "mtrand.pyx":2235
* cdef double fmu, fkappa
*
* fmu = PyFloat_AsDouble(mu) # <<<<<<<<<<<<<<
@@ -10570,7 +10377,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self,
*/
__pyx_v_fmu = PyFloat_AsDouble(__pyx_v_mu);
- /* "mtrand.pyx":2235
+ /* "mtrand.pyx":2236
*
* fmu = PyFloat_AsDouble(mu)
* fkappa = PyFloat_AsDouble(kappa) # <<<<<<<<<<<<<<
@@ -10579,7 +10386,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self,
*/
__pyx_v_fkappa = PyFloat_AsDouble(__pyx_v_kappa);
- /* "mtrand.pyx":2236
+ /* "mtrand.pyx":2237
* fmu = PyFloat_AsDouble(mu)
* fkappa = PyFloat_AsDouble(kappa)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -10589,39 +10396,33 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self,
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":2237
+ /* "mtrand.pyx":2238
* fkappa = PyFloat_AsDouble(kappa)
* if not PyErr_Occurred():
* if fkappa < 0: # <<<<<<<<<<<<<<
* raise ValueError("kappa < 0")
* return cont2_array_sc(self.internal_state, rk_vonmises, size, fmu, fkappa)
*/
- __pyx_t_1 = (__pyx_v_fkappa < 0);
+ __pyx_t_1 = (__pyx_v_fkappa < 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":2238
+ /* "mtrand.pyx":2239
* if not PyErr_Occurred():
* if fkappa < 0:
* raise ValueError("kappa < 0") # <<<<<<<<<<<<<<
* return cont2_array_sc(self.internal_state, rk_vonmises, size, fmu, fkappa)
*
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_65), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_22));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_22));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":2239
+ /* "mtrand.pyx":2240
* if fkappa < 0:
* raise ValueError("kappa < 0")
* return cont2_array_sc(self.internal_state, rk_vonmises, size, fmu, fkappa) # <<<<<<<<<<<<<<
@@ -10629,16 +10430,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self,
* PyErr_Clear()
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_vonmises, __pyx_v_size, __pyx_v_fmu, __pyx_v_fkappa); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_vonmises, __pyx_v_size, __pyx_v_fmu, __pyx_v_fkappa); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L6;
}
__pyx_L6:;
- /* "mtrand.pyx":2241
+ /* "mtrand.pyx":2242
* return cont2_array_sc(self.internal_state, rk_vonmises, size, fmu, fkappa)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -10647,101 +10448,95 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self,
*/
PyErr_Clear();
- /* "mtrand.pyx":2243
+ /* "mtrand.pyx":2244
* PyErr_Clear()
*
* omu = <ndarray> PyArray_FROM_OTF(mu, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* okappa = <ndarray> PyArray_FROM_OTF(kappa, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less(okappa, 0.0)):
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_mu, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_mu, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_omu));
- __pyx_v_omu = ((PyArrayObject *)__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_omu = ((PyArrayObject *)__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":2244
+ /* "mtrand.pyx":2245
*
* omu = <ndarray> PyArray_FROM_OTF(mu, NPY_DOUBLE, NPY_ALIGNED)
* okappa = <ndarray> PyArray_FROM_OTF(kappa, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* if np.any(np.less(okappa, 0.0)):
* raise ValueError("kappa < 0")
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_kappa, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_kappa, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_okappa));
- __pyx_v_okappa = ((PyArrayObject *)__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_okappa = ((PyArrayObject *)__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":2245
+ /* "mtrand.pyx":2246
* omu = <ndarray> PyArray_FROM_OTF(mu, NPY_DOUBLE, NPY_ALIGNED)
* okappa = <ndarray> PyArray_FROM_OTF(kappa, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less(okappa, 0.0)): # <<<<<<<<<<<<<<
* raise ValueError("kappa < 0")
* return cont2_array(self.internal_state, rk_vonmises, size, omu, okappa)
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(((PyObject *)__pyx_v_okappa));
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_okappa));
__Pyx_GIVEREF(((PyObject *)__pyx_v_okappa));
- PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":2246
+ /* "mtrand.pyx":2247
* okappa = <ndarray> PyArray_FROM_OTF(kappa, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less(okappa, 0.0)):
* raise ValueError("kappa < 0") # <<<<<<<<<<<<<<
* return cont2_array(self.internal_state, rk_vonmises, size, omu, okappa)
*
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_22));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_22));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22));
- __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_66), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":2247
+ /* "mtrand.pyx":2248
* if np.any(np.less(okappa, 0.0)):
* raise ValueError("kappa < 0")
* return cont2_array(self.internal_state, rk_vonmises, size, omu, okappa) # <<<<<<<<<<<<<<
@@ -10749,10 +10544,10 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self,
* def pareto(self, a, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_5 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_vonmises, __pyx_v_size, __pyx_v_omu, __pyx_v_okappa); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_r = __pyx_t_5;
- __pyx_t_5 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_vonmises, __pyx_v_size, __pyx_v_omu, __pyx_v_okappa); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -10767,16 +10562,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self,
__pyx_L0:;
__Pyx_DECREF((PyObject *)__pyx_v_omu);
__Pyx_DECREF((PyObject *)__pyx_v_okappa);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_mu);
- __Pyx_DECREF(__pyx_v_kappa);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":2249
+/* "mtrand.pyx":2250
* return cont2_array(self.internal_state, rk_vonmises, size, omu, okappa)
*
* def pareto(self, a, size=None): # <<<<<<<<<<<<<<
@@ -10784,9 +10575,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self,
* pareto(a, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_pareto[] = "\n"" pareto(a, size=None)\n""\n"" Draw samples from a Pareto II or Lomax distribution with specified shape.\n""\n"" The Lomax or Pareto II distribution is a shifted Pareto distribution. The\n"" classical Pareto distribution can be obtained from the Lomax distribution\n"" by adding the location parameter m, see below. The smallest value of the\n"" Lomax distribution is zero while for the classical Pareto distribution it\n"" is m, where the standard Pareto distribution has location m=1.\n"" Lomax can also be considered as a simplified version of the Generalized\n"" Pareto distribution (available in SciPy), with the scale set to one and\n"" the location set to zero.\n""\n"" The Pareto distribution must be greater than zero, and is unbounded above.\n"" It is also known as the \"80-20 rule\". In this distribution, 80 percent of\n"" the weights are in the lowest 20 percent of the range, while the other 20\n"" percent fill the remaining 80 percent of the range.\n""\n"" Parameters\n"" ----------\n"" shape : float, > 0.\n"" Shape of the distribution.\n"" size : tuple of ints\n"" Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n"" ``m * n * k`` samples are drawn.\n""\n"" See Also\n"" --------\n"" scipy.stats.distributions.lomax.pdf : probability density function,\n"" distribution or cumulative density function, etc.\n"" scipy.stats.distributions.genpareto.pdf : probability density function,\n"" distribution or cumulative density function, etc.\n""\n"" Notes\n"" -----\n"" The probability density for the Pareto distribution is\n""\n"" .. math:: p(x) = \\frac{am^a}{x^{a+1}}\n""\n"" where :math:`a` is the shape and :math:`m` the location\n""\n"" The Pareto distribution, named after the Italian economist Vilfredo Pareto,\n"" is a power law probability distribution useful in many real world problems.\n"" Outside the field of economics it is generally referred to as the Bradford\n"" distribution. Pareto developed the distribution to describe the\n"" distribution of wealth in an economy. It has also found use in insurance,\n"" web page access statistics, oil field sizes, and many other problems,\n"" including the download frequency for projects in Sourceforge [1]. It is\n"" one of the so-called \"fat-tailed\" distributions.\n""\n""\n"" References\n"" ----------\n"" .. [1] Francis Hunt and Paul Johnson, On the Pareto Distribution of\n"" Sourceforge projects.\n"" .. [2] Pareto, V. (1896). Course of Political Economy. Lausanne.\n"" .. [3] Reiss, R.D., Thomas, M.(2001), Statistical Analysis of Extreme\n"" Values, Birkhauser Verlag, Basel, pp 23-30.\n"" .. [4] Wikipedia, \"Pareto distribution\",\n"" http://en.wikipedia.org/wiki/Pareto_distribution\n""\n"" Examples\n"" --------\n"" Draw samples from the distribution:\n""\n"" >>> a, m = 3., 1. # shape and mode\n"" >>> s = np.random.pareto(a, 1000) + m\n""\n"" Display the histogram of the samples, along with\n"" the probability density function:\n""\n"" >>> import matplotlib.pyplot as plt\n"" >>> count, bins, ignored = plt.hist(s, 100, normed=True, align='center')\n"" >>> fit = a*m**a/bins**(a+1)\n"" >>> plt.plot(bins, max(count)*fit/max(fit),linewidth=2, color='r')\n"" >>> plt.show()\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_30pareto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_30pareto[] = "\n pareto(a, size=None)\n\n Draw samples from a Pareto II or Lomax distribution with specified shape.\n\n The Lomax or Pareto II distribution is a shifted Pareto distribution. The\n classical Pareto distribution can be obtained from the Lomax distribution\n by adding the location parameter m, see below. The smallest value of the\n Lomax distribution is zero while for the classical Pareto distribution it\n is m, where the standard Pareto distribution has location m=1.\n Lomax can also be considered as a simplified version of the Generalized\n Pareto distribution (available in SciPy), with the scale set to one and\n the location set to zero.\n\n The Pareto distribution must be greater than zero, and is unbounded above.\n It is also known as the \"80-20 rule\". In this distribution, 80 percent of\n the weights are in the lowest 20 percent of the range, while the other 20\n percent fill the remaining 80 percent of the range.\n\n Parameters\n ----------\n shape : float, > 0.\n Shape of the distribution.\n size : tuple of ints\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n See Also\n --------\n scipy.stats.distributions.lomax.pdf : probability density function,\n distribution or cumulative density function, etc.\n scipy.stats.distributions.genpareto.pdf : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the Pareto distribution is\n\n .. math:: p(x) = \\frac{am^a}{x^{a+1}}\n\n where :math:`a` is the shape and :math:`m` the location\n\n The Pareto distribution, named after the Italian economist Vilfredo Pareto,\n is a power law probability distribution useful in many real world probl""ems.\n Outside the field of economics it is generally referred to as the Bradford\n distribution. Pareto developed the distribution to describe the\n distribution of wealth in an economy. It has also found use in insurance,\n web page access statistics, oil field sizes, and many other problems,\n including the download frequency for projects in Sourceforge [1]. It is\n one of the so-called \"fat-tailed\" distributions.\n\n\n References\n ----------\n .. [1] Francis Hunt and Paul Johnson, On the Pareto Distribution of\n Sourceforge projects.\n .. [2] Pareto, V. (1896). Course of Political Economy. Lausanne.\n .. [3] Reiss, R.D., Thomas, M.(2001), Statistical Analysis of Extreme\n Values, Birkhauser Verlag, Basel, pp 23-30.\n .. [4] Wikipedia, \"Pareto distribution\",\n http://en.wikipedia.org/wiki/Pareto_distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> a, m = 3., 1. # shape and mode\n >>> s = np.random.pareto(a, 1000) + m\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> count, bins, ignored = plt.hist(s, 100, normed=True, align='center')\n >>> fit = a*m**a/bins**(a+1)\n >>> plt.plot(bins, max(count)*fit/max(fit),linewidth=2, color='r')\n >>> plt.show()\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_30pareto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_a = 0;
PyObject *__pyx_v_size = 0;
PyArrayObject *__pyx_v_oa;
@@ -10815,13 +10606,13 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, P
if (likely(values[0])) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[1] = value; kw_args--; }
+ if (value) { values[1] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "pareto") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2249; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "pareto") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2250; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_a = values[0];
__pyx_v_size = values[1];
@@ -10836,17 +10627,15 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, P
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("pareto", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2249; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("pareto", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2250; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.pareto");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_a);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_oa = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":2332
+ /* "mtrand.pyx":2333
* cdef double fa
*
* fa = PyFloat_AsDouble(a) # <<<<<<<<<<<<<<
@@ -10855,7 +10644,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, P
*/
__pyx_v_fa = PyFloat_AsDouble(__pyx_v_a);
- /* "mtrand.pyx":2333
+ /* "mtrand.pyx":2334
*
* fa = PyFloat_AsDouble(a)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -10865,39 +10654,33 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, P
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":2334
+ /* "mtrand.pyx":2335
* fa = PyFloat_AsDouble(a)
* if not PyErr_Occurred():
* if fa <= 0: # <<<<<<<<<<<<<<
* raise ValueError("a <= 0")
* return cont1_array_sc(self.internal_state, rk_pareto, size, fa)
*/
- __pyx_t_1 = (__pyx_v_fa <= 0);
+ __pyx_t_1 = (__pyx_v_fa <= 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":2335
+ /* "mtrand.pyx":2336
* if not PyErr_Occurred():
* if fa <= 0:
* raise ValueError("a <= 0") # <<<<<<<<<<<<<<
* return cont1_array_sc(self.internal_state, rk_pareto, size, fa)
*
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_67), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_10));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":2336
+ /* "mtrand.pyx":2337
* if fa <= 0:
* raise ValueError("a <= 0")
* return cont1_array_sc(self.internal_state, rk_pareto, size, fa) # <<<<<<<<<<<<<<
@@ -10905,16 +10688,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, P
* PyErr_Clear()
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_pareto, __pyx_v_size, __pyx_v_fa); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_pareto, __pyx_v_size, __pyx_v_fa); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L6;
}
__pyx_L6:;
- /* "mtrand.pyx":2338
+ /* "mtrand.pyx":2339
* return cont1_array_sc(self.internal_state, rk_pareto, size, fa)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -10923,87 +10706,81 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, P
*/
PyErr_Clear();
- /* "mtrand.pyx":2340
+ /* "mtrand.pyx":2341
* PyErr_Clear()
*
* oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* if np.any(np.less_equal(oa, 0.0)):
* raise ValueError("a <= 0")
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_a, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_a, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_oa));
- __pyx_v_oa = ((PyArrayObject *)__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_oa = ((PyArrayObject *)__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":2341
+ /* "mtrand.pyx":2342
*
* oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(oa, 0.0)): # <<<<<<<<<<<<<<
* raise ValueError("a <= 0")
* return cont1_array(self.internal_state, rk_pareto, size, oa)
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(((PyObject *)__pyx_v_oa));
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_oa));
__Pyx_GIVEREF(((PyObject *)__pyx_v_oa));
- PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":2342
+ /* "mtrand.pyx":2343
* oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(oa, 0.0)):
* raise ValueError("a <= 0") # <<<<<<<<<<<<<<
* return cont1_array(self.internal_state, rk_pareto, size, oa)
*
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_10));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
- __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_68), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":2343
+ /* "mtrand.pyx":2344
* if np.any(np.less_equal(oa, 0.0)):
* raise ValueError("a <= 0")
* return cont1_array(self.internal_state, rk_pareto, size, oa) # <<<<<<<<<<<<<<
@@ -11011,10 +10788,10 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, P
* def weibull(self, a, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_5 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_pareto, __pyx_v_size, __pyx_v_oa); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_r = __pyx_t_5;
- __pyx_t_5 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_pareto, __pyx_v_size, __pyx_v_oa); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -11028,15 +10805,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, P
__pyx_r = NULL;
__pyx_L0:;
__Pyx_DECREF((PyObject *)__pyx_v_oa);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_a);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":2345
+/* "mtrand.pyx":2346
* return cont1_array(self.internal_state, rk_pareto, size, oa)
*
* def weibull(self, a, size=None): # <<<<<<<<<<<<<<
@@ -11044,9 +10818,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, P
* weibull(a, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_weibull[] = "\n"" weibull(a, size=None)\n""\n"" Weibull distribution.\n""\n"" Draw samples from a 1-parameter Weibull distribution with the given\n"" shape parameter `a`.\n""\n"" .. math:: X = (-ln(U))^{1/a}\n""\n"" Here, U is drawn from the uniform distribution over (0,1].\n""\n"" The more common 2-parameter Weibull, including a scale parameter\n"" :math:`\\lambda` is just :math:`X = \\lambda(-ln(U))^{1/a}`.\n""\n"" Parameters\n"" ----------\n"" a : float\n"" Shape of the distribution.\n"" size : tuple of ints\n"" Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n"" ``m * n * k`` samples are drawn.\n""\n"" See Also\n"" --------\n"" scipy.stats.distributions.weibull : probability density function,\n"" distribution or cumulative density function, etc.\n""\n"" gumbel, scipy.stats.distributions.genextreme\n""\n"" Notes\n"" -----\n"" The Weibull (or Type III asymptotic extreme value distribution for smallest\n"" values, SEV Type III, or Rosin-Rammler distribution) is one of a class of\n"" Generalized Extreme Value (GEV) distributions used in modeling extreme\n"" value problems. This class includes the Gumbel and Frechet distributions.\n""\n"" The probability density for the Weibull distribution is\n""\n"" .. math:: p(x) = \\frac{a}\n"" {\\lambda}(\\frac{x}{\\lambda})^{a-1}e^{-(x/\\lambda)^a},\n""\n"" where :math:`a` is the shape and :math:`\\lambda` the scale.\n""\n"" The function has its peak (the mode) at\n"" :math:`\\lambda(\\frac{a-1}{a})^{1/a}`.\n""\n"" When ``a = 1``, the Weibull distribution reduces to the exponential\n"" distribution.\n""\n"" References\n"" ----------\n"" .. [1] Waloddi Weibull, Professor, Royal Technical University, Stockholm,\n"" 1939 \"A Statistical Theory Of The Strength Of Materials\",\n"" Ingeniorsvetenskapsakademiens Handlingar Nr 151, 1939,\n"" Generalstabens Litografiska Anstalts Forlag, Stockholm.\n"" .. [2] Waloddi Weibull, 1951 \"A Statistical Distribution Function of Wide\n"" Applicability\", Journal Of Applied Mechanics ASME Paper.\n"" .. [3] Wikipedia, \"Weibull distribution\",\n"" http://en.wikipedia.org/wiki/Weibull_distribution\n""\n"" Examples\n"" --------\n"" Draw samples from the distribution:\n""\n"" >>> a = 5. # shape\n"" >>> s = np.random.weibull(a, 1000)\n""\n"" Display the histogram of the samples, along with\n"" the probability density function:\n""\n"" >>> import matplotlib.pyplot as plt\n"" >>> x = np.arange(1,100.)/50.\n"" >>> def weib(x,n,a):\n"" ... return (a / n) * (x / n)**(a - 1) * np.exp(-(x / n)**a)\n""\n"" >>> count, bins, ignored = plt.hist(np.random.weibull(5.,1000))\n"" >>> x = np.arange(1,100.)/50.\n"" >>> scale = count.max()/weib(x, 1., 5.).max()\n"" >>> plt.plot(x, weib(x, 1., 5.)*scale)\n"" >>> plt.show()\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_31weibull(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_31weibull[] = "\n weibull(a, size=None)\n\n Weibull distribution.\n\n Draw samples from a 1-parameter Weibull distribution with the given\n shape parameter `a`.\n\n .. math:: X = (-ln(U))^{1/a}\n\n Here, U is drawn from the uniform distribution over (0,1].\n\n The more common 2-parameter Weibull, including a scale parameter\n :math:`\\lambda` is just :math:`X = \\lambda(-ln(U))^{1/a}`.\n\n Parameters\n ----------\n a : float\n Shape of the distribution.\n size : tuple of ints\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n See Also\n --------\n scipy.stats.distributions.weibull : probability density function,\n distribution or cumulative density function, etc.\n\n gumbel, scipy.stats.distributions.genextreme\n\n Notes\n -----\n The Weibull (or Type III asymptotic extreme value distribution for smallest\n values, SEV Type III, or Rosin-Rammler distribution) is one of a class of\n Generalized Extreme Value (GEV) distributions used in modeling extreme\n value problems. This class includes the Gumbel and Frechet distributions.\n\n The probability density for the Weibull distribution is\n\n .. math:: p(x) = \\frac{a}\n {\\lambda}(\\frac{x}{\\lambda})^{a-1}e^{-(x/\\lambda)^a},\n\n where :math:`a` is the shape and :math:`\\lambda` the scale.\n\n The function has its peak (the mode) at\n :math:`\\lambda(\\frac{a-1}{a})^{1/a}`.\n\n When ``a = 1``, the Weibull distribution reduces to the exponential\n distribution.\n\n References\n ----------\n .. [1] Waloddi Weibull, Professor, Royal Technical University, Stockholm,\n 1939 \"A Statistical Theory Of The Strength Of Materials\",\n Ingeniorsvetenskapsakademiens Handlingar"" Nr 151, 1939,\n Generalstabens Litografiska Anstalts Forlag, Stockholm.\n .. [2] Waloddi Weibull, 1951 \"A Statistical Distribution Function of Wide\n Applicability\", Journal Of Applied Mechanics ASME Paper.\n .. [3] Wikipedia, \"Weibull distribution\",\n http://en.wikipedia.org/wiki/Weibull_distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> a = 5. # shape\n >>> s = np.random.weibull(a, 1000)\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> x = np.arange(1,100.)/50.\n >>> def weib(x,n,a):\n ... return (a / n) * (x / n)**(a - 1) * np.exp(-(x / n)**a)\n\n >>> count, bins, ignored = plt.hist(np.random.weibull(5.,1000))\n >>> x = np.arange(1,100.)/50.\n >>> scale = count.max()/weib(x, 1., 5.).max()\n >>> plt.plot(x, weib(x, 1., 5.)*scale)\n >>> plt.show()\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_31weibull(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_a = 0;
PyObject *__pyx_v_size = 0;
PyArrayObject *__pyx_v_oa;
@@ -11075,13 +10849,13 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self,
if (likely(values[0])) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[1] = value; kw_args--; }
+ if (value) { values[1] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "weibull") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2345; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "weibull") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2346; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_a = values[0];
__pyx_v_size = values[1];
@@ -11096,17 +10870,15 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self,
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("weibull", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2345; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("weibull", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2346; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.weibull");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_a);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_oa = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":2432
+ /* "mtrand.pyx":2433
* cdef double fa
*
* fa = PyFloat_AsDouble(a) # <<<<<<<<<<<<<<
@@ -11115,7 +10887,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self,
*/
__pyx_v_fa = PyFloat_AsDouble(__pyx_v_a);
- /* "mtrand.pyx":2433
+ /* "mtrand.pyx":2434
*
* fa = PyFloat_AsDouble(a)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -11125,39 +10897,33 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self,
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":2434
+ /* "mtrand.pyx":2435
* fa = PyFloat_AsDouble(a)
* if not PyErr_Occurred():
* if fa <= 0: # <<<<<<<<<<<<<<
* raise ValueError("a <= 0")
* return cont1_array_sc(self.internal_state, rk_weibull, size, fa)
*/
- __pyx_t_1 = (__pyx_v_fa <= 0);
+ __pyx_t_1 = (__pyx_v_fa <= 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":2435
+ /* "mtrand.pyx":2436
* if not PyErr_Occurred():
* if fa <= 0:
* raise ValueError("a <= 0") # <<<<<<<<<<<<<<
* return cont1_array_sc(self.internal_state, rk_weibull, size, fa)
*
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_69), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_10));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":2436
+ /* "mtrand.pyx":2437
* if fa <= 0:
* raise ValueError("a <= 0")
* return cont1_array_sc(self.internal_state, rk_weibull, size, fa) # <<<<<<<<<<<<<<
@@ -11165,16 +10931,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self,
* PyErr_Clear()
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_weibull, __pyx_v_size, __pyx_v_fa); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_weibull, __pyx_v_size, __pyx_v_fa); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L6;
}
__pyx_L6:;
- /* "mtrand.pyx":2438
+ /* "mtrand.pyx":2439
* return cont1_array_sc(self.internal_state, rk_weibull, size, fa)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -11183,87 +10949,81 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self,
*/
PyErr_Clear();
- /* "mtrand.pyx":2440
+ /* "mtrand.pyx":2441
* PyErr_Clear()
*
* oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* if np.any(np.less_equal(oa, 0.0)):
* raise ValueError("a <= 0")
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_a, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_a, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_oa));
- __pyx_v_oa = ((PyArrayObject *)__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_oa = ((PyArrayObject *)__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":2441
+ /* "mtrand.pyx":2442
*
* oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(oa, 0.0)): # <<<<<<<<<<<<<<
* raise ValueError("a <= 0")
* return cont1_array(self.internal_state, rk_weibull, size, oa)
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(((PyObject *)__pyx_v_oa));
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_oa));
__Pyx_GIVEREF(((PyObject *)__pyx_v_oa));
- PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":2442
+ /* "mtrand.pyx":2443
* oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(oa, 0.0)):
* raise ValueError("a <= 0") # <<<<<<<<<<<<<<
* return cont1_array(self.internal_state, rk_weibull, size, oa)
*
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_10));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
- __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_70), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":2443
+ /* "mtrand.pyx":2444
* if np.any(np.less_equal(oa, 0.0)):
* raise ValueError("a <= 0")
* return cont1_array(self.internal_state, rk_weibull, size, oa) # <<<<<<<<<<<<<<
@@ -11271,10 +11031,10 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self,
* def power(self, a, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_5 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_weibull, __pyx_v_size, __pyx_v_oa); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_r = __pyx_t_5;
- __pyx_t_5 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_weibull, __pyx_v_size, __pyx_v_oa); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -11288,15 +11048,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self,
__pyx_r = NULL;
__pyx_L0:;
__Pyx_DECREF((PyObject *)__pyx_v_oa);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_a);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":2445
+/* "mtrand.pyx":2446
* return cont1_array(self.internal_state, rk_weibull, size, oa)
*
* def power(self, a, size=None): # <<<<<<<<<<<<<<
@@ -11304,9 +11061,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self,
* power(a, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_power(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_power[] = "\n"" power(a, size=None)\n""\n"" Draws samples in [0, 1] from a power distribution with positive\n"" exponent a - 1.\n""\n"" Also known as the power function distribution.\n""\n"" Parameters\n"" ----------\n"" a : float\n"" parameter, > 0\n"" size : tuple of ints\n"" Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n"" ``m * n * k`` samples are drawn.\n""\n"" Returns\n"" -------\n"" samples : {ndarray, scalar}\n"" The returned samples lie in [0, 1].\n""\n"" Raises\n"" ------\n"" ValueError\n"" If a<1.\n""\n"" Notes\n"" -----\n"" The probability density function is\n""\n"" .. math:: P(x; a) = ax^{a-1}, 0 \\le x \\le 1, a>0.\n""\n"" The power function distribution is just the inverse of the Pareto\n"" distribution. It may also be seen as a special case of the Beta\n"" distribution.\n""\n"" It is used, for example, in modeling the over-reporting of insurance\n"" claims.\n""\n"" References\n"" ----------\n"" .. [1] Christian Kleiber, Samuel Kotz, \"Statistical size distributions\n"" in economics and actuarial sciences\", Wiley, 2003.\n"" .. [2] Heckert, N. A. and Filliben, James J. (2003). NIST Handbook 148:\n"" Dataplot Reference Manual, Volume 2: Let Subcommands and Library\n"" Functions\", National Institute of Standards and Technology Handbook\n"" Series, June 2003.\n"" http://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/powpdf.pdf\n""\n"" Examples\n"" --------\n"" Draw samples from the distribution:\n""\n"" >>> a = 5. # shape\n"" >>> samples = 1000\n"" >>> s = np.random.power(a, samples)\n""\n"" Display the histogram of the samples, along with\n"" the probability density function:\n""\n"" >>> import matplotlib.pyplot as plt\n"" >>> count, bins, ignored = plt.hist(s, bins=30)\n"" >>> x = np.linspace(0, 1, 100)\n"" >>> y = a*x**(a-1.)\n"" >>> normed_y = samples*np.diff(bins)[0]*y\n"" >>> plt.plot(x, normed_y)\n"" >>> plt.show()\n""\n"" Compare the power function distribution to the inverse of the Pareto.\n""\n"" >>> from scipy import stats\n"" >>> rvs = np.random.power(5, 1000000)\n"" >>> rvsp = np.random.pareto(5, 1000000)\n"" >>> xx = np.linspace(0,1,100)\n"" >>> powpdf = stats.powerlaw.pdf(xx,5)\n""\n"" >>> plt.figure()\n"" >>> plt.hist(rvs, bins=50, normed=True)\n"" >>> plt.plot(xx,powpdf,'r-')\n"" >>> plt.title('np.random.power(5)')\n""\n"" >>> plt.figure()\n"" >>> plt.hist(1./(1.+rvsp), bins=50, normed=True)\n"" >>> plt.plot(xx,powpdf,'r-')\n"" >>> plt.title('inverse of 1 + np.random.pareto(5)')\n""\n"" >>> plt.figure()\n"" >>> plt.hist(1./(1.+rvsp), bins=50, normed=True)\n"" >>> plt.plot(xx,powpdf,'r-')\n"" >>> plt.title('inverse of stats.pareto(5)')\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_power(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_32power(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_32power[] = "\n power(a, size=None)\n\n Draws samples in [0, 1] from a power distribution with positive\n exponent a - 1.\n\n Also known as the power function distribution.\n\n Parameters\n ----------\n a : float\n parameter, > 0\n size : tuple of ints\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n samples : {ndarray, scalar}\n The returned samples lie in [0, 1].\n\n Raises\n ------\n ValueError\n If a<1.\n\n Notes\n -----\n The probability density function is\n\n .. math:: P(x; a) = ax^{a-1}, 0 \\le x \\le 1, a>0.\n\n The power function distribution is just the inverse of the Pareto\n distribution. It may also be seen as a special case of the Beta\n distribution.\n\n It is used, for example, in modeling the over-reporting of insurance\n claims.\n\n References\n ----------\n .. [1] Christian Kleiber, Samuel Kotz, \"Statistical size distributions\n in economics and actuarial sciences\", Wiley, 2003.\n .. [2] Heckert, N. A. and Filliben, James J. (2003). NIST Handbook 148:\n Dataplot Reference Manual, Volume 2: Let Subcommands and Library\n Functions\", National Institute of Standards and Technology Handbook\n Series, June 2003.\n http://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/powpdf.pdf\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> a = 5. # shape\n >>> samples = 1000\n >>> s = np.random.power(a, samples)\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> count, bins, ignored = plt.hist(s, bins=""30)\n >>> x = np.linspace(0, 1, 100)\n >>> y = a*x**(a-1.)\n >>> normed_y = samples*np.diff(bins)[0]*y\n >>> plt.plot(x, normed_y)\n >>> plt.show()\n\n Compare the power function distribution to the inverse of the Pareto.\n\n >>> from scipy import stats\n >>> rvs = np.random.power(5, 1000000)\n >>> rvsp = np.random.pareto(5, 1000000)\n >>> xx = np.linspace(0,1,100)\n >>> powpdf = stats.powerlaw.pdf(xx,5)\n\n >>> plt.figure()\n >>> plt.hist(rvs, bins=50, normed=True)\n >>> plt.plot(xx,powpdf,'r-')\n >>> plt.title('np.random.power(5)')\n\n >>> plt.figure()\n >>> plt.hist(1./(1.+rvsp), bins=50, normed=True)\n >>> plt.plot(xx,powpdf,'r-')\n >>> plt.title('inverse of 1 + np.random.pareto(5)')\n\n >>> plt.figure()\n >>> plt.hist(1./(1.+rvsp), bins=50, normed=True)\n >>> plt.plot(xx,powpdf,'r-')\n >>> plt.title('inverse of stats.pareto(5)')\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_32power(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_a = 0;
PyObject *__pyx_v_size = 0;
PyArrayObject *__pyx_v_oa;
@@ -11335,13 +11092,13 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_power(PyObject *__pyx_v_self, Py
if (likely(values[0])) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[1] = value; kw_args--; }
+ if (value) { values[1] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "power") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2445; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "power") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_a = values[0];
__pyx_v_size = values[1];
@@ -11356,17 +11113,15 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_power(PyObject *__pyx_v_self, Py
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("power", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2445; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("power", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.power");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_a);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_oa = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":2541
+ /* "mtrand.pyx":2542
* cdef double fa
*
* fa = PyFloat_AsDouble(a) # <<<<<<<<<<<<<<
@@ -11375,7 +11130,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_power(PyObject *__pyx_v_self, Py
*/
__pyx_v_fa = PyFloat_AsDouble(__pyx_v_a);
- /* "mtrand.pyx":2542
+ /* "mtrand.pyx":2543
*
* fa = PyFloat_AsDouble(a)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -11385,39 +11140,33 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_power(PyObject *__pyx_v_self, Py
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":2543
+ /* "mtrand.pyx":2544
* fa = PyFloat_AsDouble(a)
* if not PyErr_Occurred():
* if fa <= 0: # <<<<<<<<<<<<<<
* raise ValueError("a <= 0")
* return cont1_array_sc(self.internal_state, rk_power, size, fa)
*/
- __pyx_t_1 = (__pyx_v_fa <= 0);
+ __pyx_t_1 = (__pyx_v_fa <= 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":2544
+ /* "mtrand.pyx":2545
* if not PyErr_Occurred():
* if fa <= 0:
* raise ValueError("a <= 0") # <<<<<<<<<<<<<<
* return cont1_array_sc(self.internal_state, rk_power, size, fa)
*
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_71), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_10));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":2545
+ /* "mtrand.pyx":2546
* if fa <= 0:
* raise ValueError("a <= 0")
* return cont1_array_sc(self.internal_state, rk_power, size, fa) # <<<<<<<<<<<<<<
@@ -11425,16 +11174,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_power(PyObject *__pyx_v_self, Py
* PyErr_Clear()
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_power, __pyx_v_size, __pyx_v_fa); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_power, __pyx_v_size, __pyx_v_fa); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L6;
}
__pyx_L6:;
- /* "mtrand.pyx":2547
+ /* "mtrand.pyx":2548
* return cont1_array_sc(self.internal_state, rk_power, size, fa)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -11443,87 +11192,81 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_power(PyObject *__pyx_v_self, Py
*/
PyErr_Clear();
- /* "mtrand.pyx":2549
+ /* "mtrand.pyx":2550
* PyErr_Clear()
*
* oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* if np.any(np.less_equal(oa, 0.0)):
* raise ValueError("a <= 0")
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_a, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_a, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_oa));
- __pyx_v_oa = ((PyArrayObject *)__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_oa = ((PyArrayObject *)__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":2550
+ /* "mtrand.pyx":2551
*
* oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(oa, 0.0)): # <<<<<<<<<<<<<<
* raise ValueError("a <= 0")
* return cont1_array(self.internal_state, rk_power, size, oa)
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(((PyObject *)__pyx_v_oa));
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_oa));
__Pyx_GIVEREF(((PyObject *)__pyx_v_oa));
- PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":2551
+ /* "mtrand.pyx":2552
* oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(oa, 0.0)):
* raise ValueError("a <= 0") # <<<<<<<<<<<<<<
* return cont1_array(self.internal_state, rk_power, size, oa)
*
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_10));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
- __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_72), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":2552
+ /* "mtrand.pyx":2553
* if np.any(np.less_equal(oa, 0.0)):
* raise ValueError("a <= 0")
* return cont1_array(self.internal_state, rk_power, size, oa) # <<<<<<<<<<<<<<
@@ -11531,10 +11274,10 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_power(PyObject *__pyx_v_self, Py
* def laplace(self, loc=0.0, scale=1.0, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_5 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_power, __pyx_v_size, __pyx_v_oa); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_r = __pyx_t_5;
- __pyx_t_5 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_power, __pyx_v_size, __pyx_v_oa); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -11548,15 +11291,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_power(PyObject *__pyx_v_self, Py
__pyx_r = NULL;
__pyx_L0:;
__Pyx_DECREF((PyObject *)__pyx_v_oa);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_a);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":2554
+/* "mtrand.pyx":2555
* return cont1_array(self.internal_state, rk_power, size, oa)
*
* def laplace(self, loc=0.0, scale=1.0, size=None): # <<<<<<<<<<<<<<
@@ -11564,9 +11304,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_power(PyObject *__pyx_v_self, Py
* laplace(loc=0.0, scale=1.0, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_laplace[] = "\n"" laplace(loc=0.0, scale=1.0, size=None)\n""\n"" Draw samples from the Laplace or double exponential distribution with\n"" specified location (or mean) and scale (decay).\n""\n"" The Laplace distribution is similar to the Gaussian/normal distribution,\n"" but is sharper at the peak and has fatter tails. It represents the\n"" difference between two independent, identically distributed exponential\n"" random variables.\n""\n"" Parameters\n"" ----------\n"" loc : float\n"" The position, :math:`\\mu`, of the distribution peak.\n"" scale : float\n"" :math:`\\lambda`, the exponential decay.\n""\n"" Notes\n"" -----\n"" It has the probability density function\n""\n"" .. math:: f(x; \\mu, \\lambda) = \\frac{1}{2\\lambda}\n"" \\exp\\left(-\\frac{|x - \\mu|}{\\lambda}\\right).\n""\n"" The first law of Laplace, from 1774, states that the frequency of an error\n"" can be expressed as an exponential function of the absolute magnitude of\n"" the error, which leads to the Laplace distribution. For many problems in\n"" Economics and Health sciences, this distribution seems to model the data\n"" better than the standard Gaussian distribution\n""\n""\n"" References\n"" ----------\n"" .. [1] Abramowitz, M. and Stegun, I. A. (Eds.). Handbook of Mathematical\n"" Functions with Formulas, Graphs, and Mathematical Tables, 9th\n"" printing. New York: Dover, 1972.\n""\n"" .. [2] The Laplace distribution and generalizations\n"" By Samuel Kotz, Tomasz J. Kozubowski, Krzysztof Podgorski,\n"" Birkhauser, 2001.\n""\n"" .. [3] Weisstein, Eric W. \"Laplace Distribution.\"\n"" From MathWorld--A Wolfram Web Resource.\n"" http://mathworld.wolfram.com/LaplaceDistribution.html\n""\n"" .. [4] Wikipedia, \"Laplace distribution\",\n"" http://en.wikipedia.org/wiki/Laplace_distribution\n""\n"" Examples\n"" --------\n"" Draw samples from the distribution\n""\n"" >>> loc, scale = 0., 1.\n"" >>> s = np.random.laplace(loc, scale, 1000)\n""\n"" Display the histogram of the samples, along with\n"" the probability density function:\n""\n"" >>> import matplotlib.pyplot as plt\n"" >>> count, bins, ignored = plt.hist(s, 30, normed=True)\n"" >>> x = np.arange(-8., 8., .01)\n"" >>> pdf = np.exp(-abs(x-loc/scale))/(2.*scale)\n"" >>> plt.plot(x, pdf)\n""\n"" Plot Gaussian for comparison:\n""\n"" >>> g = (1/(scale * np.sqrt(2 * np.pi)) * \n"" ... np.exp( - (x - loc)**2 / (2 * scale**2) ))\n"" >>> plt.plot(x,g)\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_33laplace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_33laplace[] = "\n laplace(loc=0.0, scale=1.0, size=None)\n\n Draw samples from the Laplace or double exponential distribution with\n specified location (or mean) and scale (decay).\n\n The Laplace distribution is similar to the Gaussian/normal distribution,\n but is sharper at the peak and has fatter tails. It represents the\n difference between two independent, identically distributed exponential\n random variables.\n\n Parameters\n ----------\n loc : float\n The position, :math:`\\mu`, of the distribution peak.\n scale : float\n :math:`\\lambda`, the exponential decay.\n\n Notes\n -----\n It has the probability density function\n\n .. math:: f(x; \\mu, \\lambda) = \\frac{1}{2\\lambda}\n \\exp\\left(-\\frac{|x - \\mu|}{\\lambda}\\right).\n\n The first law of Laplace, from 1774, states that the frequency of an error\n can be expressed as an exponential function of the absolute magnitude of\n the error, which leads to the Laplace distribution. For many problems in\n Economics and Health sciences, this distribution seems to model the data\n better than the standard Gaussian distribution\n\n\n References\n ----------\n .. [1] Abramowitz, M. and Stegun, I. A. (Eds.). Handbook of Mathematical\n Functions with Formulas, Graphs, and Mathematical Tables, 9th\n printing. New York: Dover, 1972.\n\n .. [2] The Laplace distribution and generalizations\n By Samuel Kotz, Tomasz J. Kozubowski, Krzysztof Podgorski,\n Birkhauser, 2001.\n\n .. [3] Weisstein, Eric W. \"Laplace Distribution.\"\n From MathWorld--A Wolfram Web Resource.\n http://mathworld.wolfram.com/LaplaceDistribution.html\n\n .. [4] Wikipedia, \"Laplace distribution\",\n http://en.wikipedia.org/wik""i/Laplace_distribution\n\n Examples\n --------\n Draw samples from the distribution\n\n >>> loc, scale = 0., 1.\n >>> s = np.random.laplace(loc, scale, 1000)\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> count, bins, ignored = plt.hist(s, 30, normed=True)\n >>> x = np.arange(-8., 8., .01)\n >>> pdf = np.exp(-abs(x-loc/scale))/(2.*scale)\n >>> plt.plot(x, pdf)\n\n Plot Gaussian for comparison:\n\n >>> g = (1/(scale * np.sqrt(2 * np.pi)) * \n ... np.exp( - (x - loc)**2 / (2 * scale**2) ))\n >>> plt.plot(x,g)\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_33laplace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_loc = 0;
PyObject *__pyx_v_scale = 0;
PyObject *__pyx_v_size = 0;
@@ -11585,8 +11325,8 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self,
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
PyObject* values[3] = {0,0,0};
- values[0] = __pyx_k_23;
- values[1] = __pyx_k_24;
+ values[0] = __pyx_k_73;
+ values[1] = __pyx_k_74;
values[2] = ((PyObject *)Py_None);
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
@@ -11597,30 +11337,30 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self,
}
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 0:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__loc);
- if (unlikely(value)) { values[0] = value; kw_args--; }
+ if (value) { values[0] = value; kw_args--; }
}
case 1:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scale);
- if (unlikely(value)) { values[1] = value; kw_args--; }
+ if (value) { values[1] = value; kw_args--; }
}
case 2:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[2] = value; kw_args--; }
+ if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "laplace") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "laplace") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2555; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_loc = values[0];
__pyx_v_scale = values[1];
__pyx_v_size = values[2];
} else {
- __pyx_v_loc = __pyx_k_23;
- __pyx_v_scale = __pyx_k_24;
+ __pyx_v_loc = __pyx_k_73;
+ __pyx_v_scale = __pyx_k_74;
__pyx_v_size = ((PyObject *)Py_None);
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: __pyx_v_size = PyTuple_GET_ITEM(__pyx_args, 2);
@@ -11632,19 +11372,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self,
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("laplace", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("laplace", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2555; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.laplace");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_loc);
- __Pyx_INCREF(__pyx_v_scale);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_oloc = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_oscale = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":2630
+ /* "mtrand.pyx":2631
* cdef double floc, fscale
*
* floc = PyFloat_AsDouble(loc) # <<<<<<<<<<<<<<
@@ -11653,7 +11390,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self,
*/
__pyx_v_floc = PyFloat_AsDouble(__pyx_v_loc);
- /* "mtrand.pyx":2631
+ /* "mtrand.pyx":2632
*
* floc = PyFloat_AsDouble(loc)
* fscale = PyFloat_AsDouble(scale) # <<<<<<<<<<<<<<
@@ -11662,7 +11399,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self,
*/
__pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale);
- /* "mtrand.pyx":2632
+ /* "mtrand.pyx":2633
* floc = PyFloat_AsDouble(loc)
* fscale = PyFloat_AsDouble(scale)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -11672,39 +11409,33 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self,
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":2633
+ /* "mtrand.pyx":2634
* fscale = PyFloat_AsDouble(scale)
* if not PyErr_Occurred():
* if fscale <= 0: # <<<<<<<<<<<<<<
* raise ValueError("scale <= 0")
* return cont2_array_sc(self.internal_state, rk_laplace, size, floc, fscale)
*/
- __pyx_t_1 = (__pyx_v_fscale <= 0);
+ __pyx_t_1 = (__pyx_v_fscale <= 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":2634
+ /* "mtrand.pyx":2635
* if not PyErr_Occurred():
* if fscale <= 0:
* raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
* return cont2_array_sc(self.internal_state, rk_laplace, size, floc, fscale)
*
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_75), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_9));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":2635
+ /* "mtrand.pyx":2636
* if fscale <= 0:
* raise ValueError("scale <= 0")
* return cont2_array_sc(self.internal_state, rk_laplace, size, floc, fscale) # <<<<<<<<<<<<<<
@@ -11712,16 +11443,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self,
* PyErr_Clear()
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_laplace, __pyx_v_size, __pyx_v_floc, __pyx_v_fscale); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_laplace, __pyx_v_size, __pyx_v_floc, __pyx_v_fscale); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L6;
}
__pyx_L6:;
- /* "mtrand.pyx":2637
+ /* "mtrand.pyx":2638
* return cont2_array_sc(self.internal_state, rk_laplace, size, floc, fscale)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -11730,101 +11461,95 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self,
*/
PyErr_Clear();
- /* "mtrand.pyx":2638
+ /* "mtrand.pyx":2639
*
* PyErr_Clear()
* 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)):
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_loc, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6mtrand_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_loc, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6mtrand_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_v_oloc));
- __pyx_v_oloc = ((PyArrayObject *)__pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_v_oloc = ((PyArrayObject *)__pyx_t_2);
+ __pyx_t_2 = 0;
- /* "mtrand.pyx":2639
+ /* "mtrand.pyx":2640
* PyErr_Clear()
* 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)):
* raise ValueError("scale <= 0")
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_scale, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6mtrand_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_scale, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6mtrand_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_v_oscale));
- __pyx_v_oscale = ((PyArrayObject *)__pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_v_oscale = ((PyArrayObject *)__pyx_t_2);
+ __pyx_t_2 = 0;
- /* "mtrand.pyx":2640
+ /* "mtrand.pyx":2641
* 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)): # <<<<<<<<<<<<<<
* raise ValueError("scale <= 0")
* return cont2_array(self.internal_state, rk_laplace, size, oloc, oscale)
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(((PyObject *)__pyx_v_oscale));
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_oscale));
__Pyx_GIVEREF(((PyObject *)__pyx_v_oscale));
- PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":2641
+ /* "mtrand.pyx":2642
* oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(oscale, 0.0)):
* raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
* return cont2_array(self.internal_state, rk_laplace, size, oloc, oscale)
*
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_9));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
- __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_76), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":2642
+ /* "mtrand.pyx":2643
* if np.any(np.less_equal(oscale, 0.0)):
* raise ValueError("scale <= 0")
* return cont2_array(self.internal_state, rk_laplace, size, oloc, oscale) # <<<<<<<<<<<<<<
@@ -11832,10 +11557,10 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self,
* def gumbel(self, loc=0.0, scale=1.0, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_5 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_laplace, __pyx_v_size, __pyx_v_oloc, __pyx_v_oscale); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_r = __pyx_t_5;
- __pyx_t_5 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_laplace, __pyx_v_size, __pyx_v_oloc, __pyx_v_oscale); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -11850,16 +11575,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self,
__pyx_L0:;
__Pyx_DECREF((PyObject *)__pyx_v_oloc);
__Pyx_DECREF((PyObject *)__pyx_v_oscale);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_loc);
- __Pyx_DECREF(__pyx_v_scale);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":2644
+/* "mtrand.pyx":2645
* return cont2_array(self.internal_state, rk_laplace, size, oloc, oscale)
*
* def gumbel(self, loc=0.0, scale=1.0, size=None): # <<<<<<<<<<<<<<
@@ -11867,9 +11588,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self,
* gumbel(loc=0.0, scale=1.0, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_gumbel[] = "\n"" gumbel(loc=0.0, scale=1.0, size=None)\n""\n"" Gumbel distribution.\n""\n"" Draw samples from a Gumbel distribution with specified location and scale.\n"" For more information on the Gumbel distribution, see Notes and References\n"" below.\n""\n"" Parameters\n"" ----------\n"" loc : float\n"" The location of the mode of the distribution.\n"" scale : float\n"" The scale parameter of the distribution.\n"" size : tuple of ints\n"" Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n"" ``m * n * k`` samples are drawn.\n""\n"" Returns\n"" -------\n"" out : ndarray\n"" The samples\n""\n"" See Also\n"" --------\n"" scipy.stats.gumbel_l\n"" scipy.stats.gumbel_r\n"" scipy.stats.genextreme\n"" probability density function, distribution, or cumulative density\n"" function, etc. for each of the above\n"" weibull\n""\n"" Notes\n"" -----\n"" The Gumbel (or Smallest Extreme Value (SEV) or the Smallest Extreme Value\n"" Type I) distribution is one of a class of Generalized Extreme Value (GEV)\n"" distributions used in modeling extreme value problems. The Gumbel is a\n"" special case of the Extreme Value Type I distribution for maximums from\n"" distributions with \"exponential-like\" tails.\n""\n"" The probability density for the Gumbel distribution is\n""\n"" .. math:: p(x) = \\frac{e^{-(x - \\mu)/ \\beta}}{\\beta} e^{ -e^{-(x - \\mu)/\n"" \\beta}},\n""\n"" where :math:`\\mu` is the mode, a location parameter, and :math:`\\beta` is\n"" the scale parameter.\n""\n"" The Gumbel (named for German mathematician Emil Julius Gumbel) was used\n"" very early in the hydrology literature, for modeling the occurrence of\n"" flood events. It is also used for modeling maximum wind speed and rainfall\n"" rates. It is a \"fat-tailed\" distribution - the probability of an event in\n"" the tail of the distribution is larger than if one used a Gaussian, hence\n"" the surprisingly frequent occurrence of 100-year floods. Floods were\n"" initially modeled as a Gaussian process, which underestimated the frequency\n"" of extreme events.\n""\n""\n"" It is one of a class of extreme value distributions, the Generalized\n"" Extreme Value (GEV) distributions, which also includes the Weibull and\n"" Frechet.\n""\n"" The function has a mean of :math:`\\mu + 0.57721\\beta` and a variance of\n"" :math:`\\frac{\\pi^2}{6}\\beta^2`.\n""\n"" References\n"" ----------\n"" Gumbel, E. J., *Statistics of Extremes*, New York: Columbia University\n"" Press, 1958.\n""\n"" Reiss, R.-D. and Thomas, M., *Statistical Analysis of Extreme Values from\n"" Insurance, Finance, Hydrology and Other Fields*, Basel: Birkhauser Verlag,\n"" 2001.\n""\n"" Examples\n"" --------\n"" Draw samples from the distribution:\n""\n"" >>> mu, beta = 0, 0.1 # location and scale\n"" >>> s = np.random.gumbel(mu, beta, 1000)\n""\n"" Display the histogram of the samples, along with\n"" the probability density function:\n""\n"" >>> import matplotlib.pyplot as plt\n"" >>> count, bins, ignored = plt.hist(s, 30, normed=True)\n"" >>> plt.plot(bins, (1/beta)*np.exp(-(bins - mu)/beta)\n"" ... * np.exp( -np.exp( -(bins - mu) /beta) ),\n"" ... linewidth=2, color='r')\n"" >>> plt.show()\n""\n"" Show how an extreme value distribution can arise from a Gaussian process\n"" and compare to a Gaussian:\n""\n"" >>> means = []\n"" >>> maxima = []\n"" >>> for i in range(0,1000) :\n"" ... a = np.random.normal(mu, beta, 1000)\n"" ... means.append(a.mean())\n"" ... maxima.append(a.max())\n"" >>> count, bins, ignored = plt.hist(maxima, 30, normed=True)\n"" >>> beta = np.std(maxima)*np.pi/np.sqrt(6)\n"" >>> mu = np.mean(maxima) - 0.57721*beta\n"" >>> plt.plot(bins, (1/beta)*np.exp(-(bins - mu)/beta)\n"" ... * np.exp(-np.exp(-(bins - mu)/beta)),\n"" ... linewidth=2, color='r')\n"" >>> plt.plot(bins, 1/(beta * np.sqrt(2 * np.pi))\n"" ... * np.exp(-(bins - mu)**2 / (2 * beta**2)),\n"" ... linewidth=2, color='g')\n"" >>> plt.show()\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_34gumbel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_34gumbel[] = "\n gumbel(loc=0.0, scale=1.0, size=None)\n\n Gumbel distribution.\n\n Draw samples from a Gumbel distribution with specified location and scale.\n For more information on the Gumbel distribution, see Notes and References\n below.\n\n Parameters\n ----------\n loc : float\n The location of the mode of the distribution.\n scale : float\n The scale parameter of the distribution.\n size : tuple of ints\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n out : ndarray\n The samples\n\n See Also\n --------\n scipy.stats.gumbel_l\n scipy.stats.gumbel_r\n scipy.stats.genextreme\n probability density function, distribution, or cumulative density\n function, etc. for each of the above\n weibull\n\n Notes\n -----\n The Gumbel (or Smallest Extreme Value (SEV) or the Smallest Extreme Value\n Type I) distribution is one of a class of Generalized Extreme Value (GEV)\n distributions used in modeling extreme value problems. The Gumbel is a\n special case of the Extreme Value Type I distribution for maximums from\n distributions with \"exponential-like\" tails.\n\n The probability density for the Gumbel distribution is\n\n .. math:: p(x) = \\frac{e^{-(x - \\mu)/ \\beta}}{\\beta} e^{ -e^{-(x - \\mu)/\n \\beta}},\n\n where :math:`\\mu` is the mode, a location parameter, and :math:`\\beta` is\n the scale parameter.\n\n The Gumbel (named for German mathematician Emil Julius Gumbel) was used\n very early in the hydrology literature, for modeling the occurrence of\n flood events. It is also used for modeling maximum wind speed and rainfall\n rates. It is a \"fat-tailed\" distribution - the ""probability of an event in\n the tail of the distribution is larger than if one used a Gaussian, hence\n the surprisingly frequent occurrence of 100-year floods. Floods were\n initially modeled as a Gaussian process, which underestimated the frequency\n of extreme events.\n\n\n It is one of a class of extreme value distributions, the Generalized\n Extreme Value (GEV) distributions, which also includes the Weibull and\n Frechet.\n\n The function has a mean of :math:`\\mu + 0.57721\\beta` and a variance of\n :math:`\\frac{\\pi^2}{6}\\beta^2`.\n\n References\n ----------\n Gumbel, E. J., *Statistics of Extremes*, New York: Columbia University\n Press, 1958.\n\n Reiss, R.-D. and Thomas, M., *Statistical Analysis of Extreme Values from\n Insurance, Finance, Hydrology and Other Fields*, Basel: Birkhauser Verlag,\n 2001.\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> mu, beta = 0, 0.1 # location and scale\n >>> s = np.random.gumbel(mu, beta, 1000)\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> count, bins, ignored = plt.hist(s, 30, normed=True)\n >>> plt.plot(bins, (1/beta)*np.exp(-(bins - mu)/beta)\n ... * np.exp( -np.exp( -(bins - mu) /beta) ),\n ... linewidth=2, color='r')\n >>> plt.show()\n\n Show how an extreme value distribution can arise from a Gaussian process\n and compare to a Gaussian:\n\n >>> means = []\n >>> maxima = []\n >>> for i in range(0,1000) :\n ... a = np.random.normal(mu, beta, 1000)\n ... means.append(a.mean())\n ... maxima.append(a.max())\n >>> count, bins, ignored = plt.hist(maxima, 30, normed=True)\n >>> beta = np.std(maxima)*np.pi/np.sqrt(6)""\n >>> mu = np.mean(maxima) - 0.57721*beta\n >>> plt.plot(bins, (1/beta)*np.exp(-(bins - mu)/beta)\n ... * np.exp(-np.exp(-(bins - mu)/beta)),\n ... linewidth=2, color='r')\n >>> plt.plot(bins, 1/(beta * np.sqrt(2 * np.pi))\n ... * np.exp(-(bins - mu)**2 / (2 * beta**2)),\n ... linewidth=2, color='g')\n >>> plt.show()\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_34gumbel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_loc = 0;
PyObject *__pyx_v_scale = 0;
PyObject *__pyx_v_size = 0;
@@ -11888,8 +11609,8 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, P
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
PyObject* values[3] = {0,0,0};
- values[0] = __pyx_k_25;
- values[1] = __pyx_k_26;
+ values[0] = __pyx_k_77;
+ values[1] = __pyx_k_78;
values[2] = ((PyObject *)Py_None);
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
@@ -11900,30 +11621,30 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, P
}
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 0:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__loc);
- if (unlikely(value)) { values[0] = value; kw_args--; }
+ if (value) { values[0] = value; kw_args--; }
}
case 1:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scale);
- if (unlikely(value)) { values[1] = value; kw_args--; }
+ if (value) { values[1] = value; kw_args--; }
}
case 2:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[2] = value; kw_args--; }
+ if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "gumbel") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2644; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "gumbel") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2645; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_loc = values[0];
__pyx_v_scale = values[1];
__pyx_v_size = values[2];
} else {
- __pyx_v_loc = __pyx_k_25;
- __pyx_v_scale = __pyx_k_26;
+ __pyx_v_loc = __pyx_k_77;
+ __pyx_v_scale = __pyx_k_78;
__pyx_v_size = ((PyObject *)Py_None);
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: __pyx_v_size = PyTuple_GET_ITEM(__pyx_args, 2);
@@ -11935,19 +11656,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, P
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("gumbel", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2644; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("gumbel", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2645; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.gumbel");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_loc);
- __Pyx_INCREF(__pyx_v_scale);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_oloc = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_oscale = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":2761
+ /* "mtrand.pyx":2762
* cdef double floc, fscale
*
* floc = PyFloat_AsDouble(loc) # <<<<<<<<<<<<<<
@@ -11956,7 +11674,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, P
*/
__pyx_v_floc = PyFloat_AsDouble(__pyx_v_loc);
- /* "mtrand.pyx":2762
+ /* "mtrand.pyx":2763
*
* floc = PyFloat_AsDouble(loc)
* fscale = PyFloat_AsDouble(scale) # <<<<<<<<<<<<<<
@@ -11965,7 +11683,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, P
*/
__pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale);
- /* "mtrand.pyx":2763
+ /* "mtrand.pyx":2764
* floc = PyFloat_AsDouble(loc)
* fscale = PyFloat_AsDouble(scale)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -11975,39 +11693,33 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, P
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":2764
+ /* "mtrand.pyx":2765
* fscale = PyFloat_AsDouble(scale)
* if not PyErr_Occurred():
* if fscale <= 0: # <<<<<<<<<<<<<<
* raise ValueError("scale <= 0")
* return cont2_array_sc(self.internal_state, rk_gumbel, size, floc, fscale)
*/
- __pyx_t_1 = (__pyx_v_fscale <= 0);
+ __pyx_t_1 = (__pyx_v_fscale <= 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":2765
+ /* "mtrand.pyx":2766
* if not PyErr_Occurred():
* if fscale <= 0:
* raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
* return cont2_array_sc(self.internal_state, rk_gumbel, size, floc, fscale)
*
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_79), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_9));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":2766
+ /* "mtrand.pyx":2767
* if fscale <= 0:
* raise ValueError("scale <= 0")
* return cont2_array_sc(self.internal_state, rk_gumbel, size, floc, fscale) # <<<<<<<<<<<<<<
@@ -12015,16 +11727,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, P
* PyErr_Clear()
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_gumbel, __pyx_v_size, __pyx_v_floc, __pyx_v_fscale); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_gumbel, __pyx_v_size, __pyx_v_floc, __pyx_v_fscale); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L6;
}
__pyx_L6:;
- /* "mtrand.pyx":2768
+ /* "mtrand.pyx":2769
* return cont2_array_sc(self.internal_state, rk_gumbel, size, floc, fscale)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -12033,101 +11745,95 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, P
*/
PyErr_Clear();
- /* "mtrand.pyx":2769
+ /* "mtrand.pyx":2770
*
* PyErr_Clear()
* 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)):
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_loc, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6mtrand_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_loc, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6mtrand_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_v_oloc));
- __pyx_v_oloc = ((PyArrayObject *)__pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_v_oloc = ((PyArrayObject *)__pyx_t_2);
+ __pyx_t_2 = 0;
- /* "mtrand.pyx":2770
+ /* "mtrand.pyx":2771
* PyErr_Clear()
* 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)):
* raise ValueError("scale <= 0")
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_scale, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6mtrand_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_scale, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6mtrand_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_v_oscale));
- __pyx_v_oscale = ((PyArrayObject *)__pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_v_oscale = ((PyArrayObject *)__pyx_t_2);
+ __pyx_t_2 = 0;
- /* "mtrand.pyx":2771
+ /* "mtrand.pyx":2772
* 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)): # <<<<<<<<<<<<<<
* raise ValueError("scale <= 0")
* return cont2_array(self.internal_state, rk_gumbel, size, oloc, oscale)
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(((PyObject *)__pyx_v_oscale));
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_oscale));
__Pyx_GIVEREF(((PyObject *)__pyx_v_oscale));
- PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":2772
+ /* "mtrand.pyx":2773
* oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(oscale, 0.0)):
* raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
* return cont2_array(self.internal_state, rk_gumbel, size, oloc, oscale)
*
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_9));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
- __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_80), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":2773
+ /* "mtrand.pyx":2774
* if np.any(np.less_equal(oscale, 0.0)):
* raise ValueError("scale <= 0")
* return cont2_array(self.internal_state, rk_gumbel, size, oloc, oscale) # <<<<<<<<<<<<<<
@@ -12135,10 +11841,10 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, P
* def logistic(self, loc=0.0, scale=1.0, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_5 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_gumbel, __pyx_v_size, __pyx_v_oloc, __pyx_v_oscale); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_r = __pyx_t_5;
- __pyx_t_5 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_gumbel, __pyx_v_size, __pyx_v_oloc, __pyx_v_oscale); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -12153,16 +11859,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, P
__pyx_L0:;
__Pyx_DECREF((PyObject *)__pyx_v_oloc);
__Pyx_DECREF((PyObject *)__pyx_v_oscale);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_loc);
- __Pyx_DECREF(__pyx_v_scale);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":2775
+/* "mtrand.pyx":2776
* return cont2_array(self.internal_state, rk_gumbel, size, oloc, oscale)
*
* def logistic(self, loc=0.0, scale=1.0, size=None): # <<<<<<<<<<<<<<
@@ -12170,9 +11872,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, P
* logistic(loc=0.0, scale=1.0, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_logistic[] = "\n"" logistic(loc=0.0, scale=1.0, size=None)\n""\n"" Draw samples from a Logistic distribution.\n""\n"" Samples are drawn from a Logistic distribution with specified\n"" parameters, loc (location or mean, also median), and scale (>0).\n""\n"" Parameters\n"" ----------\n"" loc : float\n""\n"" scale : float > 0.\n""\n"" size : {tuple, int}\n"" Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n"" ``m * n * k`` samples are drawn.\n""\n"" Returns\n"" -------\n"" samples : {ndarray, scalar}\n"" where the values are all integers in [0, n].\n""\n"" See Also\n"" --------\n"" scipy.stats.distributions.logistic : probability density function,\n"" distribution or cumulative density function, etc.\n""\n"" Notes\n"" -----\n"" The probability density for the Logistic distribution is\n""\n"" .. math:: P(x) = P(x) = \\frac{e^{-(x-\\mu)/s}}{s(1+e^{-(x-\\mu)/s})^2},\n""\n"" where :math:`\\mu` = location and :math:`s` = scale.\n""\n"" The Logistic distribution is used in Extreme Value problems where it\n"" can act as a mixture of Gumbel distributions, in Epidemiology, and by\n"" the World Chess Federation (FIDE) where it is used in the Elo ranking\n"" system, assuming the performance of each player is a logistically\n"" distributed random variable.\n""\n"" References\n"" ----------\n"" .. [1] Reiss, R.-D. and Thomas M. (2001), Statistical Analysis of Extreme\n"" Values, from Insurance, Finance, Hydrology and Other Fields,\n"" Birkhauser Verlag, Basel, pp 132-133.\n"" .. [2] Weisstein, Eric W. \"Logistic Distribution.\" From\n"" MathWorld--A Wolfram Web Resource.\n"" http://mathworld.wolfram.com/LogisticDistribution.html\n"" .. [3] Wikipedia, \"Logistic-distribution\",\n"" http://en.wikipedia.org/wiki/Logistic-distribution\n""\n"" Examples\n"" --------\n"" Draw samples from the distribution:\n""\n"" >>> loc, scale = 10, 1\n"" >>> s = np.random.logistic(loc, scale, 10000)\n"" >>> count, bins, ignored = plt.hist(s, bins=50)\n""\n"" # plot against distribution\n""\n"" >>> def logist(x, loc, scale):\n"" ... return exp((loc-x)/scale)/(scale*(1+exp((loc-x)/scale))**2)\n"" >>> plt.plot(bins, logist(bins, loc, scale)*count.max()/\\\n"" ... logist(bins, loc, scale).max())\n"" >>> plt.show()\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_35logistic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_35logistic[] = "\n logistic(loc=0.0, scale=1.0, size=None)\n\n Draw samples from a Logistic distribution.\n\n Samples are drawn from a Logistic distribution with specified\n parameters, loc (location or mean, also median), and scale (>0).\n\n Parameters\n ----------\n loc : float\n\n scale : float > 0.\n\n size : {tuple, int}\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n samples : {ndarray, scalar}\n where the values are all integers in [0, n].\n\n See Also\n --------\n scipy.stats.distributions.logistic : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the Logistic distribution is\n\n .. math:: P(x) = P(x) = \\frac{e^{-(x-\\mu)/s}}{s(1+e^{-(x-\\mu)/s})^2},\n\n where :math:`\\mu` = location and :math:`s` = scale.\n\n The Logistic distribution is used in Extreme Value problems where it\n can act as a mixture of Gumbel distributions, in Epidemiology, and by\n the World Chess Federation (FIDE) where it is used in the Elo ranking\n system, assuming the performance of each player is a logistically\n distributed random variable.\n\n References\n ----------\n .. [1] Reiss, R.-D. and Thomas M. (2001), Statistical Analysis of Extreme\n Values, from Insurance, Finance, Hydrology and Other Fields,\n Birkhauser Verlag, Basel, pp 132-133.\n .. [2] Weisstein, Eric W. \"Logistic Distribution.\" From\n MathWorld--A Wolfram Web Resource.\n http://mathworld.wolfram.com/LogisticDistribution.html\n .. [3] Wikipedia, \"Logistic-distribution\",\n http://en.wikipedia.org/wiki/Logistic-distribution\n\n Examples\n "" --------\n Draw samples from the distribution:\n\n >>> loc, scale = 10, 1\n >>> s = np.random.logistic(loc, scale, 10000)\n >>> count, bins, ignored = plt.hist(s, bins=50)\n\n # plot against distribution\n\n >>> def logist(x, loc, scale):\n ... return exp((loc-x)/scale)/(scale*(1+exp((loc-x)/scale))**2)\n >>> plt.plot(bins, logist(bins, loc, scale)*count.max()/\\\n ... logist(bins, loc, scale).max())\n >>> plt.show()\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_35logistic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_loc = 0;
PyObject *__pyx_v_scale = 0;
PyObject *__pyx_v_size = 0;
@@ -12191,8 +11893,8 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self,
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
PyObject* values[3] = {0,0,0};
- values[0] = __pyx_k_27;
- values[1] = __pyx_k_28;
+ values[0] = __pyx_k_81;
+ values[1] = __pyx_k_82;
values[2] = ((PyObject *)Py_None);
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
@@ -12203,30 +11905,30 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self,
}
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 0:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__loc);
- if (unlikely(value)) { values[0] = value; kw_args--; }
+ if (value) { values[0] = value; kw_args--; }
}
case 1:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scale);
- if (unlikely(value)) { values[1] = value; kw_args--; }
+ if (value) { values[1] = value; kw_args--; }
}
case 2:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[2] = value; kw_args--; }
+ if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "logistic") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2775; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "logistic") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2776; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_loc = values[0];
__pyx_v_scale = values[1];
__pyx_v_size = values[2];
} else {
- __pyx_v_loc = __pyx_k_27;
- __pyx_v_scale = __pyx_k_28;
+ __pyx_v_loc = __pyx_k_81;
+ __pyx_v_scale = __pyx_k_82;
__pyx_v_size = ((PyObject *)Py_None);
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: __pyx_v_size = PyTuple_GET_ITEM(__pyx_args, 2);
@@ -12238,19 +11940,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self,
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("logistic", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2775; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("logistic", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2776; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.logistic");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_loc);
- __Pyx_INCREF(__pyx_v_scale);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_oloc = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_oscale = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":2849
+ /* "mtrand.pyx":2850
* cdef double floc, fscale
*
* floc = PyFloat_AsDouble(loc) # <<<<<<<<<<<<<<
@@ -12259,7 +11958,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self,
*/
__pyx_v_floc = PyFloat_AsDouble(__pyx_v_loc);
- /* "mtrand.pyx":2850
+ /* "mtrand.pyx":2851
*
* floc = PyFloat_AsDouble(loc)
* fscale = PyFloat_AsDouble(scale) # <<<<<<<<<<<<<<
@@ -12268,7 +11967,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self,
*/
__pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale);
- /* "mtrand.pyx":2851
+ /* "mtrand.pyx":2852
* floc = PyFloat_AsDouble(loc)
* fscale = PyFloat_AsDouble(scale)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -12278,39 +11977,33 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self,
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":2852
+ /* "mtrand.pyx":2853
* fscale = PyFloat_AsDouble(scale)
* if not PyErr_Occurred():
* if fscale <= 0: # <<<<<<<<<<<<<<
* raise ValueError("scale <= 0")
* return cont2_array_sc(self.internal_state, rk_logistic, size, floc, fscale)
*/
- __pyx_t_1 = (__pyx_v_fscale <= 0);
+ __pyx_t_1 = (__pyx_v_fscale <= 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":2853
+ /* "mtrand.pyx":2854
* if not PyErr_Occurred():
* if fscale <= 0:
* raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
* return cont2_array_sc(self.internal_state, rk_logistic, size, floc, fscale)
*
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_83), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_9));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":2854
+ /* "mtrand.pyx":2855
* if fscale <= 0:
* raise ValueError("scale <= 0")
* return cont2_array_sc(self.internal_state, rk_logistic, size, floc, fscale) # <<<<<<<<<<<<<<
@@ -12318,16 +12011,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self,
* PyErr_Clear()
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_logistic, __pyx_v_size, __pyx_v_floc, __pyx_v_fscale); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_logistic, __pyx_v_size, __pyx_v_floc, __pyx_v_fscale); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L6;
}
__pyx_L6:;
- /* "mtrand.pyx":2856
+ /* "mtrand.pyx":2857
* return cont2_array_sc(self.internal_state, rk_logistic, size, floc, fscale)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -12336,101 +12029,95 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self,
*/
PyErr_Clear();
- /* "mtrand.pyx":2857
+ /* "mtrand.pyx":2858
*
* PyErr_Clear()
* 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)):
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_loc, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6mtrand_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_loc, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6mtrand_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_v_oloc));
- __pyx_v_oloc = ((PyArrayObject *)__pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_v_oloc = ((PyArrayObject *)__pyx_t_2);
+ __pyx_t_2 = 0;
- /* "mtrand.pyx":2858
+ /* "mtrand.pyx":2859
* PyErr_Clear()
* 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)):
* raise ValueError("scale <= 0")
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_scale, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6mtrand_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_scale, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6mtrand_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_v_oscale));
- __pyx_v_oscale = ((PyArrayObject *)__pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_v_oscale = ((PyArrayObject *)__pyx_t_2);
+ __pyx_t_2 = 0;
- /* "mtrand.pyx":2859
+ /* "mtrand.pyx":2860
* 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)): # <<<<<<<<<<<<<<
* raise ValueError("scale <= 0")
* return cont2_array(self.internal_state, rk_logistic, size, oloc, oscale)
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(((PyObject *)__pyx_v_oscale));
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_oscale));
__Pyx_GIVEREF(((PyObject *)__pyx_v_oscale));
- PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":2860
+ /* "mtrand.pyx":2861
* oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(oscale, 0.0)):
* raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
* return cont2_array(self.internal_state, rk_logistic, size, oloc, oscale)
*
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_9));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
- __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_84), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":2861
+ /* "mtrand.pyx":2862
* if np.any(np.less_equal(oscale, 0.0)):
* raise ValueError("scale <= 0")
* return cont2_array(self.internal_state, rk_logistic, size, oloc, oscale) # <<<<<<<<<<<<<<
@@ -12438,10 +12125,10 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self,
* def lognormal(self, mean=0.0, sigma=1.0, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_5 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_logistic, __pyx_v_size, __pyx_v_oloc, __pyx_v_oscale); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_r = __pyx_t_5;
- __pyx_t_5 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_logistic, __pyx_v_size, __pyx_v_oloc, __pyx_v_oscale); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -12456,16 +12143,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self,
__pyx_L0:;
__Pyx_DECREF((PyObject *)__pyx_v_oloc);
__Pyx_DECREF((PyObject *)__pyx_v_oscale);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_loc);
- __Pyx_DECREF(__pyx_v_scale);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":2863
+/* "mtrand.pyx":2864
* return cont2_array(self.internal_state, rk_logistic, size, oloc, oscale)
*
* def lognormal(self, mean=0.0, sigma=1.0, size=None): # <<<<<<<<<<<<<<
@@ -12473,9 +12156,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self,
* lognormal(mean=0.0, sigma=1.0, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_lognormal[] = "\n"" lognormal(mean=0.0, sigma=1.0, size=None)\n""\n"" Return samples drawn from a log-normal distribution.\n""\n"" Draw samples from a log-normal distribution with specified mean, standard\n"" deviation, and shape. Note that the mean and standard deviation are not the\n"" values for the distribution itself, but of the underlying normal\n"" distribution it is derived from.\n""\n""\n"" Parameters\n"" ----------\n"" mean : float\n"" Mean value of the underlying normal distribution\n"" sigma : float, >0.\n"" Standard deviation of the underlying normal distribution\n"" size : tuple of ints\n"" Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n"" ``m * n * k`` samples are drawn.\n""\n"" See Also\n"" --------\n"" scipy.stats.lognorm : probability density function, distribution,\n"" cumulative density function, etc.\n""\n"" Notes\n"" -----\n"" A variable `x` has a log-normal distribution if `log(x)` is normally\n"" distributed.\n""\n"" The probability density function for the log-normal distribution is\n""\n"" .. math:: p(x) = \\frac{1}{\\sigma x \\sqrt{2\\pi}}\n"" e^{(-\\frac{(ln(x)-\\mu)^2}{2\\sigma^2})}\n""\n"" where :math:`\\mu` is the mean and :math:`\\sigma` is the standard deviation\n"" of the normally distributed logarithm of the variable.\n""\n"" A log-normal distribution results if a random variable is the *product* of\n"" a large number of independent, identically-distributed variables in the\n"" same way that a normal distribution results if the variable is the *sum*\n"" of a large number of independent, identically-distributed variables\n"" (see the last example). It is one of the so-called \"fat-tailed\"\n"" distributions.\n""\n"" The log-normal distribution is commonly used to model the lifespan of units\n"" with fatigue-stress failure modes. Since this includes\n"" most mechanical systems, the log-normal distribution has widespread\n"" application.\n""\n"" It is also commonly used to model oil field sizes, species abundance, and\n"" latent periods of infectious diseases.\n""\n"" References\n"" ----------\n"" .. [1] Eckhard Limpert, Werner A. Stahel, and Markus Abbt, \"Log-normal\n"" Distributions across the Sciences: Keys and Clues\", May 2001\n"" Vol. 51 No. 5 BioScience\n"" http://stat.ethz.ch/~stahel/lognormal/bioscience.pdf\n"" .. [2] Reiss, R.D., Thomas, M.(2001), Statistical Analysis of Extreme\n"" Values, Birkhauser Verlag, Basel, pp 31-32.\n"" .. [3] Wikipedia, \"Lognormal distribution\",\n"" http://en.wikipedia.org/wiki/Lognormal_distribution\n""\n"" Examples\n"" --------\n"" Draw samples from the distribution:\n""\n"" >>> mu, sigma = 3., 1. # mean and standard deviation\n"" >>> s = np.random.lognormal(mu, sigma, 1000)\n""\n"" Display the histogram of the samples, along with\n"" the probability density function:\n""\n"" >>> import matplotlib.pyplot as plt\n"" >>> count, bins, ignored = plt.hist(s, 100, normed=True, align='mid')\n""\n"" >>> x = np.linspace(min(bins), max(bins), 10000)\n"" >>> pdf = (np.exp(-(np.log(x) - mu)**2 / (2 * sigma**2))\n"" ... / (x * sigma * np.sqrt(2 * np.pi)))\n""\n"" >>> plt.plot(x, pdf, linewidth=2, color='r')\n"" >>> plt.axis('tight')\n"" >>> plt.show()\n""\n"" Demonstrate that taking the products of random samples from a uniform\n"" distribution can be fit well by a log-normal probability density function.\n""\n"" >>> # Generate a thousand samples: each is the product of 100 random\n"" >>> # values, drawn from a normal distribution.\n"" >>> b = []\n"" >>> for i in range(1000):\n"" ... a = 10. + np.random.random(100)\n"" ... b.append(np.product(a))\n""\n"" >>> b = np.array(b) / np.min(b) # scale values to be positive\n""\n"" >>> count, bins, ignored = plt.hist(b, 100, normed=True, align='center')\n""\n"" >>> sigma = np.std(np.log(b))\n"" >>> mu = np.mean(np.log(b))\n""\n"" >>> x = np.linspace(min(bins), max(bins), 10000)\n"" >>> pdf = (np.exp(-(np.log(x) - mu)**2 / (2 * sigma**2))\n"" ... / (x * sigma * np.sqrt(2 * np.pi)))\n""\n"" >>> plt.plot(x, pdf, color='r', linewidth=2)\n"" >>> plt.show()\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_36lognormal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_36lognormal[] = "\n lognormal(mean=0.0, sigma=1.0, size=None)\n\n Return samples drawn from a log-normal distribution.\n\n Draw samples from a log-normal distribution with specified mean, standard\n deviation, and shape. Note that the mean and standard deviation are not the\n values for the distribution itself, but of the underlying normal\n distribution it is derived from.\n\n\n Parameters\n ----------\n mean : float\n Mean value of the underlying normal distribution\n sigma : float, >0.\n Standard deviation of the underlying normal distribution\n size : tuple of ints\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n See Also\n --------\n scipy.stats.lognorm : probability density function, distribution,\n cumulative density function, etc.\n\n Notes\n -----\n A variable `x` has a log-normal distribution if `log(x)` is normally\n distributed.\n\n The probability density function for the log-normal distribution is\n\n .. math:: p(x) = \\frac{1}{\\sigma x \\sqrt{2\\pi}}\n e^{(-\\frac{(ln(x)-\\mu)^2}{2\\sigma^2})}\n\n where :math:`\\mu` is the mean and :math:`\\sigma` is the standard deviation\n of the normally distributed logarithm of the variable.\n\n A log-normal distribution results if a random variable is the *product* of\n a large number of independent, identically-distributed variables in the\n same way that a normal distribution results if the variable is the *sum*\n of a large number of independent, identically-distributed variables\n (see the last example). It is one of the so-called \"fat-tailed\"\n distributions.\n\n The log-normal distribution is commonly used to model the lifespan of units\n with fatigue-stress failure modes. Since thi""s includes\n most mechanical systems, the log-normal distribution has widespread\n application.\n\n It is also commonly used to model oil field sizes, species abundance, and\n latent periods of infectious diseases.\n\n References\n ----------\n .. [1] Eckhard Limpert, Werner A. Stahel, and Markus Abbt, \"Log-normal\n Distributions across the Sciences: Keys and Clues\", May 2001\n Vol. 51 No. 5 BioScience\n http://stat.ethz.ch/~stahel/lognormal/bioscience.pdf\n .. [2] Reiss, R.D., Thomas, M.(2001), Statistical Analysis of Extreme\n Values, Birkhauser Verlag, Basel, pp 31-32.\n .. [3] Wikipedia, \"Lognormal distribution\",\n http://en.wikipedia.org/wiki/Lognormal_distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> mu, sigma = 3., 1. # mean and standard deviation\n >>> s = np.random.lognormal(mu, sigma, 1000)\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> count, bins, ignored = plt.hist(s, 100, normed=True, align='mid')\n\n >>> x = np.linspace(min(bins), max(bins), 10000)\n >>> pdf = (np.exp(-(np.log(x) - mu)**2 / (2 * sigma**2))\n ... / (x * sigma * np.sqrt(2 * np.pi)))\n\n >>> plt.plot(x, pdf, linewidth=2, color='r')\n >>> plt.axis('tight')\n >>> plt.show()\n\n Demonstrate that taking the products of random samples from a uniform\n distribution can be fit well by a log-normal probability density function.\n\n >>> # Generate a thousand samples: each is the product of 100 random\n >>> # values, drawn from a normal distribution.\n >>> b = []\n >>> for i in range(1000):\n ... a = 10. + np.random.random(100)\n ... b.append(np.product(a))\n\n >>> b"" = np.array(b) / np.min(b) # scale values to be positive\n\n >>> count, bins, ignored = plt.hist(b, 100, normed=True, align='center')\n\n >>> sigma = np.std(np.log(b))\n >>> mu = np.mean(np.log(b))\n\n >>> x = np.linspace(min(bins), max(bins), 10000)\n >>> pdf = (np.exp(-(np.log(x) - mu)**2 / (2 * sigma**2))\n ... / (x * sigma * np.sqrt(2 * np.pi)))\n\n >>> plt.plot(x, pdf, color='r', linewidth=2)\n >>> plt.show()\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_36lognormal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_mean = 0;
PyObject *__pyx_v_sigma = 0;
PyObject *__pyx_v_size = 0;
@@ -12494,8 +12177,8 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
PyObject* values[3] = {0,0,0};
- values[0] = __pyx_k_29;
- values[1] = __pyx_k_30;
+ values[0] = __pyx_k_85;
+ values[1] = __pyx_k_86;
values[2] = ((PyObject *)Py_None);
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
@@ -12506,30 +12189,30 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self
}
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 0:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mean);
- if (unlikely(value)) { values[0] = value; kw_args--; }
+ if (value) { values[0] = value; kw_args--; }
}
case 1:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sigma);
- if (unlikely(value)) { values[1] = value; kw_args--; }
+ if (value) { values[1] = value; kw_args--; }
}
case 2:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[2] = value; kw_args--; }
+ if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "lognormal") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2863; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "lognormal") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2864; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_mean = values[0];
__pyx_v_sigma = values[1];
__pyx_v_size = values[2];
} else {
- __pyx_v_mean = __pyx_k_29;
- __pyx_v_sigma = __pyx_k_30;
+ __pyx_v_mean = __pyx_k_85;
+ __pyx_v_sigma = __pyx_k_86;
__pyx_v_size = ((PyObject *)Py_None);
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: __pyx_v_size = PyTuple_GET_ITEM(__pyx_args, 2);
@@ -12541,19 +12224,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("lognormal", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2863; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("lognormal", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2864; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.lognormal");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_mean);
- __Pyx_INCREF(__pyx_v_sigma);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_omean = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_osigma = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":2978
+ /* "mtrand.pyx":2979
* cdef double fmean, fsigma
*
* fmean = PyFloat_AsDouble(mean) # <<<<<<<<<<<<<<
@@ -12562,7 +12242,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self
*/
__pyx_v_fmean = PyFloat_AsDouble(__pyx_v_mean);
- /* "mtrand.pyx":2979
+ /* "mtrand.pyx":2980
*
* fmean = PyFloat_AsDouble(mean)
* fsigma = PyFloat_AsDouble(sigma) # <<<<<<<<<<<<<<
@@ -12571,7 +12251,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self
*/
__pyx_v_fsigma = PyFloat_AsDouble(__pyx_v_sigma);
- /* "mtrand.pyx":2981
+ /* "mtrand.pyx":2982
* fsigma = PyFloat_AsDouble(sigma)
*
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -12581,39 +12261,33 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":2982
+ /* "mtrand.pyx":2983
*
* if not PyErr_Occurred():
* if fsigma <= 0: # <<<<<<<<<<<<<<
* raise ValueError("sigma <= 0")
* return cont2_array_sc(self.internal_state, rk_lognormal, size, fmean, fsigma)
*/
- __pyx_t_1 = (__pyx_v_fsigma <= 0);
+ __pyx_t_1 = (__pyx_v_fsigma <= 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":2983
+ /* "mtrand.pyx":2984
* if not PyErr_Occurred():
* if fsigma <= 0:
* raise ValueError("sigma <= 0") # <<<<<<<<<<<<<<
* return cont2_array_sc(self.internal_state, rk_lognormal, size, fmean, fsigma)
*
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_88), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_31));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_31));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_31));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":2984
+ /* "mtrand.pyx":2985
* if fsigma <= 0:
* raise ValueError("sigma <= 0")
* return cont2_array_sc(self.internal_state, rk_lognormal, size, fmean, fsigma) # <<<<<<<<<<<<<<
@@ -12621,16 +12295,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self
* PyErr_Clear()
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_lognormal, __pyx_v_size, __pyx_v_fmean, __pyx_v_fsigma); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_lognormal, __pyx_v_size, __pyx_v_fmean, __pyx_v_fsigma); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L6;
}
__pyx_L6:;
- /* "mtrand.pyx":2986
+ /* "mtrand.pyx":2987
* return cont2_array_sc(self.internal_state, rk_lognormal, size, fmean, fsigma)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -12639,101 +12313,95 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self
*/
PyErr_Clear();
- /* "mtrand.pyx":2988
+ /* "mtrand.pyx":2989
* PyErr_Clear()
*
* 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)):
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_mean, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6mtrand_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_mean, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6mtrand_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_v_omean));
- __pyx_v_omean = ((PyArrayObject *)__pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_v_omean = ((PyArrayObject *)__pyx_t_2);
+ __pyx_t_2 = 0;
- /* "mtrand.pyx":2989
+ /* "mtrand.pyx":2990
*
* 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)):
* raise ValueError("sigma <= 0.0")
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_sigma, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6mtrand_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_sigma, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6mtrand_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_v_osigma));
- __pyx_v_osigma = ((PyArrayObject *)__pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_v_osigma = ((PyArrayObject *)__pyx_t_2);
+ __pyx_t_2 = 0;
- /* "mtrand.pyx":2990
+ /* "mtrand.pyx":2991
* 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)): # <<<<<<<<<<<<<<
* raise ValueError("sigma <= 0.0")
* return cont2_array(self.internal_state, rk_lognormal, size, omean, osigma)
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(((PyObject *)__pyx_v_osigma));
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_osigma));
__Pyx_GIVEREF(((PyObject *)__pyx_v_osigma));
- PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":2991
+ /* "mtrand.pyx":2992
* osigma = PyArray_FROM_OTF(sigma, NPY_DOUBLE, NPY_ALIGNED)
* 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)
*
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_32));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_32));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_32));
- __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_90), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":2992
+ /* "mtrand.pyx":2993
* 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) # <<<<<<<<<<<<<<
@@ -12741,10 +12409,10 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self
* def rayleigh(self, scale=1.0, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_5 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_lognormal, __pyx_v_size, __pyx_v_omean, __pyx_v_osigma); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_r = __pyx_t_5;
- __pyx_t_5 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_lognormal, __pyx_v_size, __pyx_v_omean, __pyx_v_osigma); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -12759,16 +12427,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self
__pyx_L0:;
__Pyx_DECREF((PyObject *)__pyx_v_omean);
__Pyx_DECREF((PyObject *)__pyx_v_osigma);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_mean);
- __Pyx_DECREF(__pyx_v_sigma);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":2994
+/* "mtrand.pyx":2995
* return cont2_array(self.internal_state, rk_lognormal, size, omean, osigma)
*
* def rayleigh(self, scale=1.0, size=None): # <<<<<<<<<<<<<<
@@ -12776,9 +12440,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self
* rayleigh(scale=1.0, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_rayleigh[] = "\n rayleigh(scale=1.0, size=None)\n\n Draw samples from a Rayleigh distribution.\n\n The :math:`\\chi` and Weibull distributions are generalizations of the\n Rayleigh.\n\n Parameters\n ----------\n scale : scalar\n Scale, also equals the mode. Should be >= 0.\n size : int or tuple of ints, optional\n Shape of the output. Default is None, in which case a single\n value is returned.\n\n Notes\n -----\n The probability density function for the Rayleigh distribution is\n\n .. math:: P(x;scale) = \\frac{x}{scale^2}e^{\\frac{-x^2}{2 \\cdotp scale^2}}\n\n The Rayleigh distribution arises if the wind speed and wind direction are\n both gaussian variables, then the vector wind velocity forms a Rayleigh\n distribution. The Rayleigh distribution is used to model the expected\n output from wind turbines.\n\n References\n ----------\n ..[1] Brighton Webs Ltd., Rayleigh Distribution,\n http://www.brighton-webs.co.uk/distributions/rayleigh.asp\n ..[2] Wikipedia, \"Rayleigh distribution\"\n http://en.wikipedia.org/wiki/Rayleigh_distribution\n\n Examples\n --------\n Draw values from the distribution and plot the histogram\n\n >>> values = hist(np.random.rayleigh(3, 100000), bins=200, normed=True)\n\n Wave heights tend to follow a Rayleigh distribution. If the mean wave\n height is 1 meter, what fraction of waves are likely to be larger than 3\n meters?\n\n >>> meanvalue = 1\n >>> modevalue = np.sqrt(2 / np.pi) * meanvalue\n >>> s = np.random.rayleigh(modevalue, 1000000)\n\n The percentage of waves larger than 3 meters is:\n\n >>> 100.*sum(s>3)/1000000.\n 0.087300000000000003\n\n ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_37rayleigh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_37rayleigh[] = "\n rayleigh(scale=1.0, size=None)\n\n Draw samples from a Rayleigh distribution.\n\n The :math:`\\chi` and Weibull distributions are generalizations of the\n Rayleigh.\n\n Parameters\n ----------\n scale : scalar\n Scale, also equals the mode. Should be >= 0.\n size : int or tuple of ints, optional\n Shape of the output. Default is None, in which case a single\n value is returned.\n\n Notes\n -----\n The probability density function for the Rayleigh distribution is\n\n .. math:: P(x;scale) = \\frac{x}{scale^2}e^{\\frac{-x^2}{2 \\cdotp scale^2}}\n\n The Rayleigh distribution arises if the wind speed and wind direction are\n both gaussian variables, then the vector wind velocity forms a Rayleigh\n distribution. The Rayleigh distribution is used to model the expected\n output from wind turbines.\n\n References\n ----------\n ..[1] Brighton Webs Ltd., Rayleigh Distribution,\n http://www.brighton-webs.co.uk/distributions/rayleigh.asp\n ..[2] Wikipedia, \"Rayleigh distribution\"\n http://en.wikipedia.org/wiki/Rayleigh_distribution\n\n Examples\n --------\n Draw values from the distribution and plot the histogram\n\n >>> values = hist(np.random.rayleigh(3, 100000), bins=200, normed=True)\n\n Wave heights tend to follow a Rayleigh distribution. If the mean wave\n height is 1 meter, what fraction of waves are likely to be larger than 3\n meters?\n\n >>> meanvalue = 1\n >>> modevalue = np.sqrt(2 / np.pi) * meanvalue\n >>> s = np.random.rayleigh(modevalue, 1000000)\n\n The percentage of waves larger than 3 meters is:\n\n >>> 100.*sum(s>3)/1000000.\n 0.087300000000000003\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_37rayleigh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_scale = 0;
PyObject *__pyx_v_size = 0;
PyArrayObject *__pyx_v_oscale;
@@ -12794,7 +12458,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self,
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
PyObject* values[2] = {0,0};
- values[0] = __pyx_k_33;
+ values[0] = __pyx_k_91;
values[1] = ((PyObject *)Py_None);
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
@@ -12804,23 +12468,23 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self,
}
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 0:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scale);
- if (unlikely(value)) { values[0] = value; kw_args--; }
+ if (value) { values[0] = value; kw_args--; }
}
case 1:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[1] = value; kw_args--; }
+ if (value) { values[1] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "rayleigh") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2994; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "rayleigh") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2995; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_scale = values[0];
__pyx_v_size = values[1];
} else {
- __pyx_v_scale = __pyx_k_33;
+ __pyx_v_scale = __pyx_k_91;
__pyx_v_size = ((PyObject *)Py_None);
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 2: __pyx_v_size = PyTuple_GET_ITEM(__pyx_args, 1);
@@ -12831,17 +12495,15 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self,
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("rayleigh", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2994; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("rayleigh", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2995; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.rayleigh");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_scale);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_oscale = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":3052
+ /* "mtrand.pyx":3053
* cdef double fscale
*
* fscale = PyFloat_AsDouble(scale) # <<<<<<<<<<<<<<
@@ -12850,7 +12512,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self,
*/
__pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale);
- /* "mtrand.pyx":3054
+ /* "mtrand.pyx":3055
* fscale = PyFloat_AsDouble(scale)
*
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -12860,39 +12522,33 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self,
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":3055
+ /* "mtrand.pyx":3056
*
* if not PyErr_Occurred():
* if fscale <= 0: # <<<<<<<<<<<<<<
* raise ValueError("scale <= 0")
* return cont1_array_sc(self.internal_state, rk_rayleigh, size, fscale)
*/
- __pyx_t_1 = (__pyx_v_fscale <= 0);
+ __pyx_t_1 = (__pyx_v_fscale <= 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":3056
+ /* "mtrand.pyx":3057
* if not PyErr_Occurred():
* if fscale <= 0:
* raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
* return cont1_array_sc(self.internal_state, rk_rayleigh, size, fscale)
*
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_92), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_9));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":3057
+ /* "mtrand.pyx":3058
* if fscale <= 0:
* raise ValueError("scale <= 0")
* return cont1_array_sc(self.internal_state, rk_rayleigh, size, fscale) # <<<<<<<<<<<<<<
@@ -12900,16 +12556,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self,
* PyErr_Clear()
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_rayleigh, __pyx_v_size, __pyx_v_fscale); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_rayleigh, __pyx_v_size, __pyx_v_fscale); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L6;
}
__pyx_L6:;
- /* "mtrand.pyx":3059
+ /* "mtrand.pyx":3060
* return cont1_array_sc(self.internal_state, rk_rayleigh, size, fscale)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -12918,87 +12574,81 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self,
*/
PyErr_Clear();
- /* "mtrand.pyx":3061
+ /* "mtrand.pyx":3062
* PyErr_Clear()
*
* oscale = <ndarray>PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* if np.any(np.less_equal(oscale, 0.0)):
* raise ValueError("scale <= 0.0")
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_scale, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_scale, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_oscale));
- __pyx_v_oscale = ((PyArrayObject *)__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_oscale = ((PyArrayObject *)__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":3062
+ /* "mtrand.pyx":3063
*
* oscale = <ndarray>PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(oscale, 0.0)): # <<<<<<<<<<<<<<
* raise ValueError("scale <= 0.0")
* return cont1_array(self.internal_state, rk_rayleigh, size, oscale)
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(((PyObject *)__pyx_v_oscale));
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_oscale));
__Pyx_GIVEREF(((PyObject *)__pyx_v_oscale));
- PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3063
+ /* "mtrand.pyx":3064
* oscale = <ndarray>PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(oscale, 0.0)):
* raise ValueError("scale <= 0.0") # <<<<<<<<<<<<<<
* return cont1_array(self.internal_state, rk_rayleigh, size, oscale)
*
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_34));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_34));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_34));
- __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_94), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":3064
+ /* "mtrand.pyx":3065
* if np.any(np.less_equal(oscale, 0.0)):
* raise ValueError("scale <= 0.0")
* return cont1_array(self.internal_state, rk_rayleigh, size, oscale) # <<<<<<<<<<<<<<
@@ -13006,10 +12656,10 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self,
* def wald(self, mean, scale, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_5 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_rayleigh, __pyx_v_size, __pyx_v_oscale); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_r = __pyx_t_5;
- __pyx_t_5 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_rayleigh, __pyx_v_size, __pyx_v_oscale); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -13023,15 +12673,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self,
__pyx_r = NULL;
__pyx_L0:;
__Pyx_DECREF((PyObject *)__pyx_v_oscale);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_scale);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":3066
+/* "mtrand.pyx":3067
* return cont1_array(self.internal_state, rk_rayleigh, size, oscale)
*
* def wald(self, mean, scale, size=None): # <<<<<<<<<<<<<<
@@ -13039,9 +12686,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self,
* wald(mean, scale, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_wald[] = "\n"" wald(mean, scale, size=None)\n""\n"" Draw samples from a Wald, or Inverse Gaussian, distribution.\n""\n"" As the scale approaches infinity, the distribution becomes more like a\n"" Gaussian.\n""\n"" Some references claim that the Wald is an Inverse Gaussian with mean=1, but\n"" this is by no means universal.\n""\n"" The Inverse Gaussian distribution was first studied in relationship to\n"" Brownian motion. In 1956 M.C.K. Tweedie used the name Inverse Gaussian\n"" because there is an inverse relationship between the time to cover a unit\n"" distance and distance covered in unit time.\n""\n"" Parameters\n"" ----------\n"" mean : scalar\n"" Distribution mean, should be > 0.\n"" scale : scalar\n"" Scale parameter, should be >= 0.\n"" size : int or tuple of ints, optional\n"" Output shape. Default is None, in which case a single value is\n"" returned.\n""\n"" Returns\n"" -------\n"" samples : ndarray or scalar\n"" Drawn sample, all greater than zero.\n""\n"" Notes\n"" -----\n"" The probability density function for the Wald distribution is\n""\n"" .. math:: P(x;mean,scale) = \\sqrt{\\frac{scale}{2\\pi x^3}}e^\n"" \\frac{-scale(x-mean)^2}{2\\cdotp mean^2x}\n""\n"" As noted above the Inverse Gaussian distribution first arise from attempts\n"" to model Brownian Motion. It is also a competitor to the Weibull for use in\n"" reliability modeling and modeling stock returns and interest rate\n"" processes.\n""\n"" References\n"" ----------\n"" ..[1] Brighton Webs Ltd., Wald Distribution,\n"" http://www.brighton-webs.co.uk/distributions/wald.asp\n"" ..[2] Chhikara, Raj S., and Folks, J. Leroy, \"The Inverse Gaussian\n"" Distribution: Theory : Methodology, and Applications\", CRC Press,\n"" 1988.\n"" ..[3] Wikipedia, \"Wald distribution\"\n"" http://en.wikipedia.org/wiki/Wald_distribution\n""\n"" Examples\n"" --------\n"" Draw values from the distribution and plot the histogram:\n""\n"" >>> import matplotlib.pyplot as plt\n"" >>> h = plt.hist(np.random.wald(3, 2, 100000), bins=200, normed=True)\n"" >>> plt.show()\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_38wald(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_38wald[] = "\n wald(mean, scale, size=None)\n\n Draw samples from a Wald, or Inverse Gaussian, distribution.\n\n As the scale approaches infinity, the distribution becomes more like a\n Gaussian.\n\n Some references claim that the Wald is an Inverse Gaussian with mean=1, but\n this is by no means universal.\n\n The Inverse Gaussian distribution was first studied in relationship to\n Brownian motion. In 1956 M.C.K. Tweedie used the name Inverse Gaussian\n because there is an inverse relationship between the time to cover a unit\n distance and distance covered in unit time.\n\n Parameters\n ----------\n mean : scalar\n Distribution mean, should be > 0.\n scale : scalar\n Scale parameter, should be >= 0.\n size : int or tuple of ints, optional\n Output shape. Default is None, in which case a single value is\n returned.\n\n Returns\n -------\n samples : ndarray or scalar\n Drawn sample, all greater than zero.\n\n Notes\n -----\n The probability density function for the Wald distribution is\n\n .. math:: P(x;mean,scale) = \\sqrt{\\frac{scale}{2\\pi x^3}}e^\n \\frac{-scale(x-mean)^2}{2\\cdotp mean^2x}\n\n As noted above the Inverse Gaussian distribution first arise from attempts\n to model Brownian Motion. It is also a competitor to the Weibull for use in\n reliability modeling and modeling stock returns and interest rate\n processes.\n\n References\n ----------\n ..[1] Brighton Webs Ltd., Wald Distribution,\n http://www.brighton-webs.co.uk/distributions/wald.asp\n ..[2] Chhikara, Raj S., and Folks, J. Leroy, \"The Inverse Gaussian\n Distribution: Theory : Methodology, and Applications\", CRC Press,\n 1988.\n ..[3] Wikipedia, \"Wald distributio""n\"\n http://en.wikipedia.org/wiki/Wald_distribution\n\n Examples\n --------\n Draw values from the distribution and plot the histogram:\n\n >>> import matplotlib.pyplot as plt\n >>> h = plt.hist(np.random.wald(3, 2, 100000), bins=200, normed=True)\n >>> plt.show()\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_38wald(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_mean = 0;
PyObject *__pyx_v_scale = 0;
PyObject *__pyx_v_size = 0;
@@ -13077,16 +12724,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyO
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scale);
if (likely(values[1])) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("wald", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3066; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("wald", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3067; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[2] = value; kw_args--; }
+ if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "wald") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3066; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "wald") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3067; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_mean = values[0];
__pyx_v_scale = values[1];
@@ -13105,19 +12752,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyO
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("wald", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3066; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("wald", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3067; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.wald");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_mean);
- __Pyx_INCREF(__pyx_v_scale);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_omean = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_oscale = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":3132
+ /* "mtrand.pyx":3133
* cdef double fmean, fscale
*
* fmean = PyFloat_AsDouble(mean) # <<<<<<<<<<<<<<
@@ -13126,7 +12770,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyO
*/
__pyx_v_fmean = PyFloat_AsDouble(__pyx_v_mean);
- /* "mtrand.pyx":3133
+ /* "mtrand.pyx":3134
*
* fmean = PyFloat_AsDouble(mean)
* fscale = PyFloat_AsDouble(scale) # <<<<<<<<<<<<<<
@@ -13135,7 +12779,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyO
*/
__pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale);
- /* "mtrand.pyx":3134
+ /* "mtrand.pyx":3135
* fmean = PyFloat_AsDouble(mean)
* fscale = PyFloat_AsDouble(scale)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -13145,71 +12789,59 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyO
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":3135
+ /* "mtrand.pyx":3136
* fscale = PyFloat_AsDouble(scale)
* if not PyErr_Occurred():
* if fmean <= 0: # <<<<<<<<<<<<<<
* raise ValueError("mean <= 0")
* if fscale <= 0:
*/
- __pyx_t_1 = (__pyx_v_fmean <= 0);
+ __pyx_t_1 = (__pyx_v_fmean <= 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":3136
+ /* "mtrand.pyx":3137
* if not PyErr_Occurred():
* if fmean <= 0:
* raise ValueError("mean <= 0") # <<<<<<<<<<<<<<
* if fscale <= 0:
* raise ValueError("scale <= 0")
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_96), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_35));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_35));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_35));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":3137
+ /* "mtrand.pyx":3138
* if fmean <= 0:
* raise ValueError("mean <= 0")
* if fscale <= 0: # <<<<<<<<<<<<<<
* raise ValueError("scale <= 0")
* return cont2_array_sc(self.internal_state, rk_wald, size, fmean, fscale)
*/
- __pyx_t_1 = (__pyx_v_fscale <= 0);
+ __pyx_t_1 = (__pyx_v_fscale <= 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":3138
+ /* "mtrand.pyx":3139
* raise ValueError("mean <= 0")
* if fscale <= 0:
* raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
* return cont2_array_sc(self.internal_state, rk_wald, size, fmean, fscale)
*
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_9));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
- __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_97), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":3139
+ /* "mtrand.pyx":3140
* if fscale <= 0:
* raise ValueError("scale <= 0")
* return cont2_array_sc(self.internal_state, rk_wald, size, fmean, fscale) # <<<<<<<<<<<<<<
@@ -13217,7 +12849,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyO
* PyErr_Clear()
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_wald, __pyx_v_size, __pyx_v_fmean, __pyx_v_fscale); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_wald, __pyx_v_size, __pyx_v_fmean, __pyx_v_fscale); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
@@ -13226,7 +12858,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyO
}
__pyx_L6:;
- /* "mtrand.pyx":3141
+ /* "mtrand.pyx":3142
* return cont2_array_sc(self.internal_state, rk_wald, size, fmean, fscale)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -13235,166 +12867,154 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyO
*/
PyErr_Clear();
- /* "mtrand.pyx":3142
+ /* "mtrand.pyx":3143
*
* PyErr_Clear()
* 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)):
*/
- __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_mean, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_mean, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6mtrand_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6mtrand_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_v_omean));
__pyx_v_omean = ((PyArrayObject *)__pyx_t_2);
__pyx_t_2 = 0;
- /* "mtrand.pyx":3143
+ /* "mtrand.pyx":3144
* PyErr_Clear()
* 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)):
* raise ValueError("mean <= 0.0")
*/
- __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_scale, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_scale, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6mtrand_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6mtrand_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_v_oscale));
__pyx_v_oscale = ((PyArrayObject *)__pyx_t_2);
__pyx_t_2 = 0;
- /* "mtrand.pyx":3144
+ /* "mtrand.pyx":3145
* 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)): # <<<<<<<<<<<<<<
* raise ValueError("mean <= 0.0")
* elif np.any(np.less_equal(oscale,0.0)):
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(((PyObject *)__pyx_v_omean));
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_omean));
__Pyx_GIVEREF(((PyObject *)__pyx_v_omean));
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3145
+ /* "mtrand.pyx":3146
* oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(omean,0.0)):
* raise ValueError("mean <= 0.0") # <<<<<<<<<<<<<<
* elif np.any(np.less_equal(oscale,0.0)):
* raise ValueError("scale <= 0.0")
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_99), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_36));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_36));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_36));
- __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L9;
}
- /* "mtrand.pyx":3146
+ /* "mtrand.pyx":3147
* if np.any(np.less_equal(omean,0.0)):
* raise ValueError("mean <= 0.0")
* 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)
*/
- __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
__Pyx_INCREF(((PyObject *)__pyx_v_oscale));
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_oscale));
__Pyx_GIVEREF(((PyObject *)__pyx_v_oscale));
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3147
+ /* "mtrand.pyx":3148
* raise ValueError("mean <= 0.0")
* 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)
*
*/
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_34));
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_34));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_34));
- __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_Raise(__pyx_t_4, 0, 0);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_100), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L9;
}
__pyx_L9:;
- /* "mtrand.pyx":3148
+ /* "mtrand.pyx":3149
* 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) # <<<<<<<<<<<<<<
@@ -13402,10 +13022,10 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyO
*
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_4 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_wald, __pyx_v_size, __pyx_v_omean, __pyx_v_oscale); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_r = __pyx_t_4;
- __pyx_t_4 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_wald, __pyx_v_size, __pyx_v_omean, __pyx_v_oscale); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -13420,16 +13040,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyO
__pyx_L0:;
__Pyx_DECREF((PyObject *)__pyx_v_omean);
__Pyx_DECREF((PyObject *)__pyx_v_oscale);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_mean);
- __Pyx_DECREF(__pyx_v_scale);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":3152
+/* "mtrand.pyx":3153
*
*
* def triangular(self, left, mode, right, size=None): # <<<<<<<<<<<<<<
@@ -13437,9 +13053,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyO
* triangular(left, mode, right, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_triangular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_triangular[] = "\n"" triangular(left, mode, right, size=None)\n""\n"" Draw samples from the triangular distribution.\n""\n"" The triangular distribution is a continuous probability distribution with\n"" lower limit left, peak at mode, and upper limit right. Unlike the other\n"" distributions, these parameters directly define the shape of the pdf.\n""\n"" Parameters\n"" ----------\n"" left : scalar\n"" Lower limit.\n"" mode : scalar\n"" The value where the peak of the distribution occurs.\n"" The value should fulfill the condition ``left <= mode <= right``.\n"" right : scalar\n"" Upper limit, should be larger than `left`.\n"" size : int or tuple of ints, optional\n"" Output shape. Default is None, in which case a single value is\n"" returned.\n""\n"" Returns\n"" -------\n"" samples : ndarray or scalar\n"" The returned samples all lie in the interval [left, right].\n""\n"" Notes\n"" -----\n"" The probability density function for the Triangular distribution is\n""\n"" .. math:: P(x;l, m, r) = \\begin{cases}\n"" \\frac{2(x-l)}{(r-l)(m-l)}& \\text{for $l \\leq x \\leq m$},\\\\\n"" \\frac{2(m-x)}{(r-l)(r-m)}& \\text{for $m \\leq x \\leq r$},\\\\\n"" 0& \\text{otherwise}.\n"" \\end{cases}\n""\n"" The triangular distribution is often used in ill-defined problems where the\n"" underlying distribution is not known, but some knowledge of the limits and\n"" mode exists. Often it is used in simulations.\n""\n"" References\n"" ----------\n"" ..[1] Wikipedia, \"Triangular distribution\"\n"" http://en.wikipedia.org/wiki/Triangular_distribution\n""\n"" Examples\n"" --------\n"" Draw values from the distribution and plot the histogram:\n""\n"" >>> import matplotlib.pyplot as plt\n"" >>> h = plt.hist(np.random.triangular(-3, 0, 8, 100000), bins=200,\n"" ... normed=True)\n"" >>> plt.show()\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_triangular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_39triangular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_39triangular[] = "\n triangular(left, mode, right, size=None)\n\n Draw samples from the triangular distribution.\n\n The triangular distribution is a continuous probability distribution with\n lower limit left, peak at mode, and upper limit right. Unlike the other\n distributions, these parameters directly define the shape of the pdf.\n\n Parameters\n ----------\n left : scalar\n Lower limit.\n mode : scalar\n The value where the peak of the distribution occurs.\n The value should fulfill the condition ``left <= mode <= right``.\n right : scalar\n Upper limit, should be larger than `left`.\n size : int or tuple of ints, optional\n Output shape. Default is None, in which case a single value is\n returned.\n\n Returns\n -------\n samples : ndarray or scalar\n The returned samples all lie in the interval [left, right].\n\n Notes\n -----\n The probability density function for the Triangular distribution is\n\n .. math:: P(x;l, m, r) = \\begin{cases}\n \\frac{2(x-l)}{(r-l)(m-l)}& \\text{for $l \\leq x \\leq m$},\\\\\n \\frac{2(m-x)}{(r-l)(r-m)}& \\text{for $m \\leq x \\leq r$},\\\\\n 0& \\text{otherwise}.\n \\end{cases}\n\n The triangular distribution is often used in ill-defined problems where the\n underlying distribution is not known, but some knowledge of the limits and\n mode exists. Often it is used in simulations.\n\n References\n ----------\n ..[1] Wikipedia, \"Triangular distribution\"\n http://en.wikipedia.org/wiki/Triangular_distribution\n\n Examples\n --------\n Draw values from the distribution and plot the histogram:\n\n >>> import matplotlib.pyplot as plt\n >>> h = plt.hist(np.random.triangular(-3, 0, 8, 100000), bins=2""00,\n ... normed=True)\n >>> plt.show()\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_39triangular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_left = 0;
PyObject *__pyx_v_mode = 0;
PyObject *__pyx_v_right = 0;
@@ -13479,22 +13095,22 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_triangular(PyObject *__pyx_v_sel
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mode);
if (likely(values[1])) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("triangular", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3152; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("triangular", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3153; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right);
if (likely(values[2])) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("triangular", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3152; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("triangular", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3153; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 3:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[3] = value; kw_args--; }
+ if (value) { values[3] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "triangular") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3152; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "triangular") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3153; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_left = values[0];
__pyx_v_mode = values[1];
@@ -13515,21 +13131,17 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_triangular(PyObject *__pyx_v_sel
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("triangular", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3152; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("triangular", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3153; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.triangular");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_left);
- __Pyx_INCREF(__pyx_v_mode);
- __Pyx_INCREF(__pyx_v_right);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_oleft = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_omode = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_oright = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":3212
+ /* "mtrand.pyx":3213
* cdef double fleft, fmode, fright
*
* fleft = PyFloat_AsDouble(left) # <<<<<<<<<<<<<<
@@ -13538,7 +13150,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_triangular(PyObject *__pyx_v_sel
*/
__pyx_v_fleft = PyFloat_AsDouble(__pyx_v_left);
- /* "mtrand.pyx":3213
+ /* "mtrand.pyx":3214
*
* fleft = PyFloat_AsDouble(left)
* fright = PyFloat_AsDouble(right) # <<<<<<<<<<<<<<
@@ -13547,7 +13159,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_triangular(PyObject *__pyx_v_sel
*/
__pyx_v_fright = PyFloat_AsDouble(__pyx_v_right);
- /* "mtrand.pyx":3214
+ /* "mtrand.pyx":3215
* fleft = PyFloat_AsDouble(left)
* fright = PyFloat_AsDouble(right)
* fmode = PyFloat_AsDouble(mode) # <<<<<<<<<<<<<<
@@ -13556,7 +13168,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_triangular(PyObject *__pyx_v_sel
*/
__pyx_v_fmode = PyFloat_AsDouble(__pyx_v_mode);
- /* "mtrand.pyx":3215
+ /* "mtrand.pyx":3216
* fright = PyFloat_AsDouble(right)
* fmode = PyFloat_AsDouble(mode)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -13566,7 +13178,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_triangular(PyObject *__pyx_v_sel
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":3216
+ /* "mtrand.pyx":3217
* fmode = PyFloat_AsDouble(mode)
* if not PyErr_Occurred():
* if fleft > fmode: # <<<<<<<<<<<<<<
@@ -13576,29 +13188,23 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_triangular(PyObject *__pyx_v_sel
__pyx_t_1 = (__pyx_v_fleft > __pyx_v_fmode);
if (__pyx_t_1) {
- /* "mtrand.pyx":3217
+ /* "mtrand.pyx":3218
* if not PyErr_Occurred():
* if fleft > fmode:
* raise ValueError("left > mode") # <<<<<<<<<<<<<<
* if fmode > fright:
* raise ValueError("mode > right")
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_102), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_37));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_37));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_37));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":3218
+ /* "mtrand.pyx":3219
* if fleft > fmode:
* raise ValueError("left > mode")
* if fmode > fright: # <<<<<<<<<<<<<<
@@ -13608,29 +13214,23 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_triangular(PyObject *__pyx_v_sel
__pyx_t_1 = (__pyx_v_fmode > __pyx_v_fright);
if (__pyx_t_1) {
- /* "mtrand.pyx":3219
+ /* "mtrand.pyx":3220
* raise ValueError("left > mode")
* if fmode > fright:
* raise ValueError("mode > right") # <<<<<<<<<<<<<<
* if fleft == fright:
* raise ValueError("left == right")
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_38));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
- __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_104), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":3220
+ /* "mtrand.pyx":3221
* if fmode > fright:
* raise ValueError("mode > right")
* if fleft == fright: # <<<<<<<<<<<<<<
@@ -13640,29 +13240,23 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_triangular(PyObject *__pyx_v_sel
__pyx_t_1 = (__pyx_v_fleft == __pyx_v_fright);
if (__pyx_t_1) {
- /* "mtrand.pyx":3221
+ /* "mtrand.pyx":3222
* raise ValueError("mode > right")
* if fleft == fright:
* raise ValueError("left == right") # <<<<<<<<<<<<<<
* return cont3_array_sc(self.internal_state, rk_triangular, size, fleft,
* fmode, fright)
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_106), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_39));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_39));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_39));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L9;
}
__pyx_L9:;
- /* "mtrand.pyx":3222
+ /* "mtrand.pyx":3223
* if fleft == fright:
* raise ValueError("left == right")
* return cont3_array_sc(self.internal_state, rk_triangular, size, fleft, # <<<<<<<<<<<<<<
@@ -13671,23 +13265,23 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_triangular(PyObject *__pyx_v_sel
*/
__Pyx_XDECREF(__pyx_r);
- /* "mtrand.pyx":3223
+ /* "mtrand.pyx":3224
* raise ValueError("left == right")
* return cont3_array_sc(self.internal_state, rk_triangular, size, fleft,
* fmode, fright) # <<<<<<<<<<<<<<
*
* PyErr_Clear()
*/
- __pyx_t_3 = __pyx_f_6mtrand_cont3_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_triangular, __pyx_v_size, __pyx_v_fleft, __pyx_v_fmode, __pyx_v_fright); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_cont3_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_triangular, __pyx_v_size, __pyx_v_fleft, __pyx_v_fmode, __pyx_v_fright); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L6;
}
__pyx_L6:;
- /* "mtrand.pyx":3225
+ /* "mtrand.pyx":3226
* fmode, fright)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -13696,241 +13290,223 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_triangular(PyObject *__pyx_v_sel
*/
PyErr_Clear();
- /* "mtrand.pyx":3226
+ /* "mtrand.pyx":3227
*
* PyErr_Clear()
* oleft = <ndarray>PyArray_FROM_OTF(left, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* omode = <ndarray>PyArray_FROM_OTF(mode, NPY_DOUBLE, NPY_ALIGNED)
* oright = <ndarray>PyArray_FROM_OTF(right, NPY_DOUBLE, NPY_ALIGNED)
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_left, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_left, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_oleft));
- __pyx_v_oleft = ((PyArrayObject *)__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_oleft = ((PyArrayObject *)__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":3227
+ /* "mtrand.pyx":3228
* PyErr_Clear()
* oleft = <ndarray>PyArray_FROM_OTF(left, NPY_DOUBLE, NPY_ALIGNED)
* omode = <ndarray>PyArray_FROM_OTF(mode, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* oright = <ndarray>PyArray_FROM_OTF(right, NPY_DOUBLE, NPY_ALIGNED)
*
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_mode, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_mode, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_omode));
- __pyx_v_omode = ((PyArrayObject *)__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_omode = ((PyArrayObject *)__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":3228
+ /* "mtrand.pyx":3229
* oleft = <ndarray>PyArray_FROM_OTF(left, NPY_DOUBLE, NPY_ALIGNED)
* omode = <ndarray>PyArray_FROM_OTF(mode, NPY_DOUBLE, NPY_ALIGNED)
* oright = <ndarray>PyArray_FROM_OTF(right, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
*
* if np.any(np.greater(oleft, omode)):
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_right, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_right, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_oright));
- __pyx_v_oright = ((PyArrayObject *)__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_oright = ((PyArrayObject *)__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":3230
+ /* "mtrand.pyx":3231
* oright = <ndarray>PyArray_FROM_OTF(right, NPY_DOUBLE, NPY_ALIGNED)
*
* if np.any(np.greater(oleft, omode)): # <<<<<<<<<<<<<<
* raise ValueError("left > mode")
* if np.any(np.greater(omode, oright)):
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__greater); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__greater); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(((PyObject *)__pyx_v_oleft));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_oleft));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_oleft));
__Pyx_GIVEREF(((PyObject *)__pyx_v_oleft));
__Pyx_INCREF(((PyObject *)__pyx_v_omode));
- PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_omode));
+ PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_omode));
__Pyx_GIVEREF(((PyObject *)__pyx_v_omode));
- __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3231
+ /* "mtrand.pyx":3232
*
* if np.any(np.greater(oleft, omode)):
* raise ValueError("left > mode") # <<<<<<<<<<<<<<
* if np.any(np.greater(omode, oright)):
* raise ValueError("mode > right")
*/
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_107), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_37));
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_37));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_37));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_5, 0, 0);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L10;
}
__pyx_L10:;
- /* "mtrand.pyx":3232
+ /* "mtrand.pyx":3233
* if np.any(np.greater(oleft, omode)):
* raise ValueError("left > mode")
* if np.any(np.greater(omode, oright)): # <<<<<<<<<<<<<<
* raise ValueError("mode > right")
* if np.any(np.equal(oleft, oright)):
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__greater); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__greater); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(((PyObject *)__pyx_v_omode));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_omode));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_omode));
__Pyx_GIVEREF(((PyObject *)__pyx_v_omode));
__Pyx_INCREF(((PyObject *)__pyx_v_oright));
- PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_oright));
+ PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_oright));
__Pyx_GIVEREF(((PyObject *)__pyx_v_oright));
- __pyx_t_4 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3233; __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_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3233
+ /* "mtrand.pyx":3234
* raise ValueError("left > mode")
* if np.any(np.greater(omode, oright)):
* raise ValueError("mode > right") # <<<<<<<<<<<<<<
* if np.any(np.equal(oleft, oright)):
* raise ValueError("left == right")
*/
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_108), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
- PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_38));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_4, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L11;
}
__pyx_L11:;
- /* "mtrand.pyx":3234
+ /* "mtrand.pyx":3235
* if np.any(np.greater(omode, oright)):
* raise ValueError("mode > right")
* if np.any(np.equal(oleft, oright)): # <<<<<<<<<<<<<<
* raise ValueError("left == right")
* return cont3_array(self.internal_state, rk_triangular, size, oleft,
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__equal); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__any); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__equal); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
__Pyx_INCREF(((PyObject *)__pyx_v_oleft));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_oleft));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_oleft));
__Pyx_GIVEREF(((PyObject *)__pyx_v_oleft));
__Pyx_INCREF(((PyObject *)__pyx_v_oright));
- PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_oright));
+ PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_oright));
__Pyx_GIVEREF(((PyObject *)__pyx_v_oright));
- __pyx_t_2 = PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3235
+ /* "mtrand.pyx":3236
* raise ValueError("mode > right")
* if np.any(np.equal(oleft, oright)):
* raise ValueError("left == right") # <<<<<<<<<<<<<<
* return cont3_array(self.internal_state, rk_triangular, size, oleft,
* omode, oright)
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_39));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_39));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_39));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_109), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_Raise(__pyx_t_3, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L12;
}
__pyx_L12:;
- /* "mtrand.pyx":3236
+ /* "mtrand.pyx":3237
* if np.any(np.equal(oleft, oright)):
* raise ValueError("left == right")
* return cont3_array(self.internal_state, rk_triangular, size, oleft, # <<<<<<<<<<<<<<
@@ -13939,14 +13515,14 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_triangular(PyObject *__pyx_v_sel
*/
__Pyx_XDECREF(__pyx_r);
- /* "mtrand.pyx":3237
+ /* "mtrand.pyx":3238
* raise ValueError("left == right")
* return cont3_array(self.internal_state, rk_triangular, size, oleft,
* omode, oright) # <<<<<<<<<<<<<<
*
* # Complicated, discrete distributions:
*/
- __pyx_t_3 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_triangular, __pyx_v_size, __pyx_v_oleft, __pyx_v_omode, __pyx_v_oright); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_triangular, __pyx_v_size, __pyx_v_oleft, __pyx_v_omode, __pyx_v_oright); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
@@ -13965,17 +13541,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_triangular(PyObject *__pyx_v_sel
__Pyx_DECREF((PyObject *)__pyx_v_oleft);
__Pyx_DECREF((PyObject *)__pyx_v_omode);
__Pyx_DECREF((PyObject *)__pyx_v_oright);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_left);
- __Pyx_DECREF(__pyx_v_mode);
- __Pyx_DECREF(__pyx_v_right);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":3240
+/* "mtrand.pyx":3241
*
* # Complicated, discrete distributions:
* def binomial(self, n, p, size=None): # <<<<<<<<<<<<<<
@@ -13983,9 +13554,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_triangular(PyObject *__pyx_v_sel
* binomial(n, p, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_binomial[] = "\n"" binomial(n, p, size=None)\n""\n"" Draw samples from a binomial distribution.\n""\n"" Samples are drawn from a Binomial distribution with specified\n"" parameters, n trials and p probability of success where\n"" n an integer > 0 and p is in the interval [0,1]. (n may be\n"" input as a float, but it is truncated to an integer in use)\n""\n"" Parameters\n"" ----------\n"" n : float (but truncated to an integer)\n"" parameter, > 0.\n"" p : float\n"" parameter, >= 0 and <=1.\n"" size : {tuple, int}\n"" Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n"" ``m * n * k`` samples are drawn.\n""\n"" Returns\n"" -------\n"" samples : {ndarray, scalar}\n"" where the values are all integers in [0, n].\n""\n"" See Also\n"" --------\n"" scipy.stats.distributions.binom : probability density function,\n"" distribution or cumulative density function, etc.\n""\n"" Notes\n"" -----\n"" The probability density for the Binomial distribution is\n""\n"" .. math:: P(N) = \\binom{n}{N}p^N(1-p)^{n-N},\n""\n"" where :math:`n` is the number of trials, :math:`p` is the probability\n"" of success, and :math:`N` is the number of successes.\n""\n"" When estimating the standard error of a proportion in a population by\n"" using a random sample, the normal distribution works well unless the\n"" product p*n <=5, where p = population proportion estimate, and n =\n"" number of samples, in which case the binomial distribution is used\n"" instead. For example, a sample of 15 people shows 4 who are left\n"" handed, and 11 who are right handed. Then p = 4/15 = 27%. 0.27*15 = 4,\n"" so the binomial distribution should be used in this case.\n""\n"" References\n"" ----------\n"" .. [1] Dalgaard, Peter, \"Introductory Statistics with R\",\n"" Springer-Verlag, 2002.\n"" .. [2] Glantz, Stanton A. \"Primer of Biostatistics.\", McGraw-Hill,\n"" Fifth Edition, 2002.\n"" .. [3] Lentner, Marvin, \"Elementary Applied Statistics\", Bogden\n"" and Quigley, 1972.\n"" .. [4] Weisstein, Eric W. \"Binomial Distribution.\" From MathWorld--A\n"" Wolfram Web Resource.\n"" http://mathworld.wolfram.com/BinomialDistribution.html\n"" .. [5] Wikipedia, \"Binomial-distribution\",\n"" http://en.wikipedia.org/wiki/Binomial_distribution\n""\n"" Examples\n"" --------\n"" Draw samples from the distribution:\n""\n"" >>> n, p = 10, .5 # number of trials, probability of each trial\n"" >>> s = np.random.binomial(n, p, 1000)\n"" # result of flipping a coin 10 times, tested 1000 times.\n""\n"" A real world example. A company drills 9 wild-cat oil exploration\n"" wells, each with an estimated probability of success of 0.1. All nine\n"" wells fail. What is the probability of that happening?\n""\n"" Let's do 20,000 trials of the model, and count the number that\n"" generate zero positive results.\n""\n"" >>> sum(np.random.binomial(9,0.1,20000)==0)/20000.\n"" answer = 0.38885, or 38%.\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_40binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_40binomial[] = "\n binomial(n, p, size=None)\n\n Draw samples from a binomial distribution.\n\n Samples are drawn from a Binomial distribution with specified\n parameters, n trials and p probability of success where\n n an integer > 0 and p is in the interval [0,1]. (n may be\n input as a float, but it is truncated to an integer in use)\n\n Parameters\n ----------\n n : float (but truncated to an integer)\n parameter, > 0.\n p : float\n parameter, >= 0 and <=1.\n size : {tuple, int}\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n samples : {ndarray, scalar}\n where the values are all integers in [0, n].\n\n See Also\n --------\n scipy.stats.distributions.binom : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the Binomial distribution is\n\n .. math:: P(N) = \\binom{n}{N}p^N(1-p)^{n-N},\n\n where :math:`n` is the number of trials, :math:`p` is the probability\n of success, and :math:`N` is the number of successes.\n\n When estimating the standard error of a proportion in a population by\n using a random sample, the normal distribution works well unless the\n product p*n <=5, where p = population proportion estimate, and n =\n number of samples, in which case the binomial distribution is used\n instead. For example, a sample of 15 people shows 4 who are left\n handed, and 11 who are right handed. Then p = 4/15 = 27%. 0.27*15 = 4,\n so the binomial distribution should be used in this case.\n\n References\n ----------\n .. [1] Dalgaard, Peter, \"Introductory Statistics with R\",\n Springer-Verlag, 2002.\n "" .. [2] Glantz, Stanton A. \"Primer of Biostatistics.\", McGraw-Hill,\n Fifth Edition, 2002.\n .. [3] Lentner, Marvin, \"Elementary Applied Statistics\", Bogden\n and Quigley, 1972.\n .. [4] Weisstein, Eric W. \"Binomial Distribution.\" From MathWorld--A\n Wolfram Web Resource.\n http://mathworld.wolfram.com/BinomialDistribution.html\n .. [5] Wikipedia, \"Binomial-distribution\",\n http://en.wikipedia.org/wiki/Binomial_distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> n, p = 10, .5 # number of trials, probability of each trial\n >>> s = np.random.binomial(n, p, 1000)\n # result of flipping a coin 10 times, tested 1000 times.\n\n A real world example. A company drills 9 wild-cat oil exploration\n wells, each with an estimated probability of success of 0.1. All nine\n wells fail. What is the probability of that happening?\n\n Let's do 20,000 trials of the model, and count the number that\n generate zero positive results.\n\n >>> sum(np.random.binomial(9,0.1,20000)==0)/20000.\n answer = 0.38885, or 38%.\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_40binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_n = 0;
PyObject *__pyx_v_p = 0;
PyObject *__pyx_v_size = 0;
@@ -14021,16 +13592,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self,
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p);
if (likely(values[1])) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("binomial", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3240; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("binomial", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3241; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[2] = value; kw_args--; }
+ if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "binomial") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3240; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "binomial") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3241; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_n = values[0];
__pyx_v_p = values[1];
@@ -14049,19 +13620,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self,
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("binomial", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3240; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("binomial", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3241; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.binomial");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_n);
- __Pyx_INCREF(__pyx_v_p);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_on = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_op = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":3325
+ /* "mtrand.pyx":3326
* cdef double fp
*
* fp = PyFloat_AsDouble(p) # <<<<<<<<<<<<<<
@@ -14070,7 +13638,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self,
*/
__pyx_v_fp = PyFloat_AsDouble(__pyx_v_p);
- /* "mtrand.pyx":3326
+ /* "mtrand.pyx":3327
*
* fp = PyFloat_AsDouble(p)
* ln = PyInt_AsLong(n) # <<<<<<<<<<<<<<
@@ -14079,7 +13647,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self,
*/
__pyx_v_ln = PyInt_AsLong(__pyx_v_n);
- /* "mtrand.pyx":3327
+ /* "mtrand.pyx":3328
* fp = PyFloat_AsDouble(p)
* ln = PyInt_AsLong(n)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -14089,7 +13657,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self,
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":3328
+ /* "mtrand.pyx":3329
* ln = PyInt_AsLong(n)
* if not PyErr_Occurred():
* if ln <= 0: # <<<<<<<<<<<<<<
@@ -14099,92 +13667,74 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self,
__pyx_t_1 = (__pyx_v_ln <= 0);
if (__pyx_t_1) {
- /* "mtrand.pyx":3329
+ /* "mtrand.pyx":3330
* if not PyErr_Occurred():
* if ln <= 0:
* raise ValueError("n <= 0") # <<<<<<<<<<<<<<
* if fp < 0:
* raise ValueError("p < 0")
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_111), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_40));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_40));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_40));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":3330
+ /* "mtrand.pyx":3331
* if ln <= 0:
* raise ValueError("n <= 0")
* if fp < 0: # <<<<<<<<<<<<<<
* raise ValueError("p < 0")
* elif fp > 1:
*/
- __pyx_t_1 = (__pyx_v_fp < 0);
+ __pyx_t_1 = (__pyx_v_fp < 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":3331
+ /* "mtrand.pyx":3332
* raise ValueError("n <= 0")
* if fp < 0:
* raise ValueError("p < 0") # <<<<<<<<<<<<<<
* elif fp > 1:
* raise ValueError("p > 1")
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_41));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_41));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_41));
- __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_113), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
- /* "mtrand.pyx":3332
+ /* "mtrand.pyx":3333
* if fp < 0:
* raise ValueError("p < 0")
* elif fp > 1: # <<<<<<<<<<<<<<
* raise ValueError("p > 1")
* return discnp_array_sc(self.internal_state, rk_binomial, size, ln, fp)
*/
- __pyx_t_1 = (__pyx_v_fp > 1);
+ __pyx_t_1 = (__pyx_v_fp > 1.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":3333
+ /* "mtrand.pyx":3334
* raise ValueError("p < 0")
* elif fp > 1:
* raise ValueError("p > 1") # <<<<<<<<<<<<<<
* return discnp_array_sc(self.internal_state, rk_binomial, size, ln, fp)
*
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_115), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_42));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_42));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_42));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":3334
+ /* "mtrand.pyx":3335
* elif fp > 1:
* raise ValueError("p > 1")
* return discnp_array_sc(self.internal_state, rk_binomial, size, ln, fp) # <<<<<<<<<<<<<<
@@ -14192,16 +13742,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self,
* PyErr_Clear()
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = __pyx_f_6mtrand_discnp_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_binomial, __pyx_v_size, __pyx_v_ln, __pyx_v_fp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_discnp_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_binomial, __pyx_v_size, __pyx_v_ln, __pyx_v_fp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L6;
}
__pyx_L6:;
- /* "mtrand.pyx":3336
+ /* "mtrand.pyx":3337
* return discnp_array_sc(self.internal_state, rk_binomial, size, ln, fp)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -14210,227 +13760,209 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self,
*/
PyErr_Clear();
- /* "mtrand.pyx":3338
+ /* "mtrand.pyx":3339
* PyErr_Clear()
*
* on = <ndarray>PyArray_FROM_OTF(n, NPY_LONG, NPY_ALIGNED) # <<<<<<<<<<<<<<
* op = <ndarray>PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(n, 0)):
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_n, NPY_LONG, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_n, NPY_LONG, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_on));
- __pyx_v_on = ((PyArrayObject *)__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_on = ((PyArrayObject *)__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":3339
+ /* "mtrand.pyx":3340
*
* on = <ndarray>PyArray_FROM_OTF(n, NPY_LONG, NPY_ALIGNED)
* op = <ndarray>PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* if np.any(np.less_equal(n, 0)):
* raise ValueError("n <= 0")
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_p, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_p, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_op));
- __pyx_v_op = ((PyArrayObject *)__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_op = ((PyArrayObject *)__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":3340
+ /* "mtrand.pyx":3341
* on = <ndarray>PyArray_FROM_OTF(n, NPY_LONG, NPY_ALIGNED)
* op = <ndarray>PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(n, 0)): # <<<<<<<<<<<<<<
* raise ValueError("n <= 0")
* if np.any(np.less(p, 0)):
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_n);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_n);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_n);
__Pyx_GIVEREF(__pyx_v_n);
__Pyx_INCREF(__pyx_int_0);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
- __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3341
+ /* "mtrand.pyx":3342
* op = <ndarray>PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(n, 0)):
* raise ValueError("n <= 0") # <<<<<<<<<<<<<<
* if np.any(np.less(p, 0)):
* raise ValueError("p < 0")
*/
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_116), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_40));
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_40));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_40));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_5, 0, 0);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L9;
}
__pyx_L9:;
- /* "mtrand.pyx":3342
+ /* "mtrand.pyx":3343
* if np.any(np.less_equal(n, 0)):
* raise ValueError("n <= 0")
* if np.any(np.less(p, 0)): # <<<<<<<<<<<<<<
* raise ValueError("p < 0")
* if np.any(np.greater(p, 1)):
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__less); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(__pyx_v_p);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_p);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_p);
__Pyx_GIVEREF(__pyx_v_p);
__Pyx_INCREF(__pyx_int_0);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
- __pyx_t_4 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3343; __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_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3343
+ /* "mtrand.pyx":3344
* raise ValueError("n <= 0")
* if np.any(np.less(p, 0)):
* raise ValueError("p < 0") # <<<<<<<<<<<<<<
* if np.any(np.greater(p, 1)):
* raise ValueError("p > 1")
*/
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_117), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_41));
- PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_41));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_41));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_4, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L10;
}
__pyx_L10:;
- /* "mtrand.pyx":3344
+ /* "mtrand.pyx":3345
* if np.any(np.less(p, 0)):
* raise ValueError("p < 0")
* if np.any(np.greater(p, 1)): # <<<<<<<<<<<<<<
* raise ValueError("p > 1")
* return discnp_array(self.internal_state, rk_binomial, size, on, op)
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__greater); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__any); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__greater); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
__Pyx_INCREF(__pyx_v_p);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_p);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_p);
__Pyx_GIVEREF(__pyx_v_p);
__Pyx_INCREF(__pyx_int_1);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1);
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_1);
__Pyx_GIVEREF(__pyx_int_1);
- __pyx_t_2 = PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3345
+ /* "mtrand.pyx":3346
* raise ValueError("p < 0")
* if np.any(np.greater(p, 1)):
* raise ValueError("p > 1") # <<<<<<<<<<<<<<
* return discnp_array(self.internal_state, rk_binomial, size, on, op)
*
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_42));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_42));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_42));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_118), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_Raise(__pyx_t_3, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L11;
}
__pyx_L11:;
- /* "mtrand.pyx":3346
+ /* "mtrand.pyx":3347
* if np.any(np.greater(p, 1)):
* raise ValueError("p > 1")
* return discnp_array(self.internal_state, rk_binomial, size, on, op) # <<<<<<<<<<<<<<
@@ -14438,7 +13970,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self,
* def negative_binomial(self, n, p, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_binomial, __pyx_v_size, __pyx_v_on, __pyx_v_op); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_binomial, __pyx_v_size, __pyx_v_on, __pyx_v_op); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
@@ -14456,16 +13988,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self,
__pyx_L0:;
__Pyx_DECREF((PyObject *)__pyx_v_on);
__Pyx_DECREF((PyObject *)__pyx_v_op);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_n);
- __Pyx_DECREF(__pyx_v_p);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":3348
+/* "mtrand.pyx":3349
* return discnp_array(self.internal_state, rk_binomial, size, on, op)
*
* def negative_binomial(self, n, p, size=None): # <<<<<<<<<<<<<<
@@ -14473,9 +14001,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self,
* negative_binomial(n, p, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_negative_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_negative_binomial[] = "\n"" negative_binomial(n, p, size=None)\n""\n"" Draw samples from a negative_binomial distribution.\n""\n"" Samples are drawn from a negative_Binomial distribution with specified\n"" parameters, `n` trials and `p` probability of success where `n` is an\n"" integer > 0 and `p` is in the interval [0, 1].\n""\n"" Parameters\n"" ----------\n"" n : int\n"" Parameter, > 0.\n"" p : float\n"" Parameter, >= 0 and <=1.\n"" size : int or tuple of ints\n"" Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n"" ``m * n * k`` samples are drawn.\n""\n"" Returns\n"" -------\n"" samples : int or ndarray of ints\n"" Drawn samples.\n""\n"" Notes\n"" -----\n"" The probability density for the Negative Binomial distribution is\n""\n"" .. math:: P(N;n,p) = \\binom{N+n-1}{n-1}p^{n}(1-p)^{N},\n""\n"" where :math:`n-1` is the number of successes, :math:`p` is the probability\n"" of success, and :math:`N+n-1` is the number of trials.\n""\n"" The negative binomial distribution gives the probability of n-1 successes\n"" and N failures in N+n-1 trials, and success on the (N+n)th trial.\n""\n"" If one throws a die repeatedly until the third time a \"1\" appears, then the\n"" probability distribution of the number of non-\"1\"s that appear before the\n"" third \"1\" is a negative binomial distribution.\n""\n"" References\n"" ----------\n"" .. [1] Weisstein, Eric W. \"Negative Binomial Distribution.\" From\n"" MathWorld--A Wolfram Web Resource.\n"" http://mathworld.wolfram.com/NegativeBinomialDistribution.html\n"" .. [2] Wikipedia, \"Negative binomial distribution\",\n"" http://en.wikipedia.org/wiki/Negative_binomial_distribution\n""\n"" Examples\n"" --------\n"" Draw samples from the distribution:\n""\n"" A real world example. A company drills wild-cat oil exploration wells, each\n"" with an estimated probability of success of 0.1. What is the probability\n"" of having one success for each successive well, that is what is the\n"" probability of a single success after drilling 5 wells, after 6 wells,\n"" etc.?\n""\n"" >>> s = np.random.negative_binomial(1, 0.1, 100000)\n"" >>> for i in range(1, 11):\n"" ... probability = sum(s<i) / 100000.\n"" ... print i, \"wells drilled, probability of one success =\", probability\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_negative_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_41negative_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_41negative_binomial[] = "\n negative_binomial(n, p, size=None)\n\n Draw samples from a negative_binomial distribution.\n\n Samples are drawn from a negative_Binomial distribution with specified\n parameters, `n` trials and `p` probability of success where `n` is an\n integer > 0 and `p` is in the interval [0, 1].\n\n Parameters\n ----------\n n : int\n Parameter, > 0.\n p : float\n Parameter, >= 0 and <=1.\n size : int or tuple of ints\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n samples : int or ndarray of ints\n Drawn samples.\n\n Notes\n -----\n The probability density for the Negative Binomial distribution is\n\n .. math:: P(N;n,p) = \\binom{N+n-1}{n-1}p^{n}(1-p)^{N},\n\n where :math:`n-1` is the number of successes, :math:`p` is the probability\n of success, and :math:`N+n-1` is the number of trials.\n\n The negative binomial distribution gives the probability of n-1 successes\n and N failures in N+n-1 trials, and success on the (N+n)th trial.\n\n If one throws a die repeatedly until the third time a \"1\" appears, then the\n probability distribution of the number of non-\"1\"s that appear before the\n third \"1\" is a negative binomial distribution.\n\n References\n ----------\n .. [1] Weisstein, Eric W. \"Negative Binomial Distribution.\" From\n MathWorld--A Wolfram Web Resource.\n http://mathworld.wolfram.com/NegativeBinomialDistribution.html\n .. [2] Wikipedia, \"Negative binomial distribution\",\n http://en.wikipedia.org/wiki/Negative_binomial_distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n A real world example. A company drills wild-cat oil exploration well""s, each\n with an estimated probability of success of 0.1. What is the probability\n of having one success for each successive well, that is what is the\n probability of a single success after drilling 5 wells, after 6 wells,\n etc.?\n\n >>> s = np.random.negative_binomial(1, 0.1, 100000)\n >>> for i in range(1, 11):\n ... probability = sum(s<i) / 100000.\n ... print i, \"wells drilled, probability of one success =\", probability\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_41negative_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_n = 0;
PyObject *__pyx_v_p = 0;
PyObject *__pyx_v_size = 0;
@@ -14511,16 +14039,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_negative_binomial(PyObject *__py
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p);
if (likely(values[1])) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("negative_binomial", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3348; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("negative_binomial", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3349; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[2] = value; kw_args--; }
+ if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "negative_binomial") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3348; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "negative_binomial") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3349; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_n = values[0];
__pyx_v_p = values[1];
@@ -14539,19 +14067,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_negative_binomial(PyObject *__py
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("negative_binomial", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3348; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("negative_binomial", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3349; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.negative_binomial");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_n);
- __Pyx_INCREF(__pyx_v_p);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_on = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_op = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":3418
+ /* "mtrand.pyx":3419
* cdef double fp
*
* fp = PyFloat_AsDouble(p) # <<<<<<<<<<<<<<
@@ -14560,7 +14085,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_negative_binomial(PyObject *__py
*/
__pyx_v_fp = PyFloat_AsDouble(__pyx_v_p);
- /* "mtrand.pyx":3419
+ /* "mtrand.pyx":3420
*
* fp = PyFloat_AsDouble(p)
* fn = PyFloat_AsDouble(n) # <<<<<<<<<<<<<<
@@ -14569,7 +14094,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_negative_binomial(PyObject *__py
*/
__pyx_v_fn = PyFloat_AsDouble(__pyx_v_n);
- /* "mtrand.pyx":3420
+ /* "mtrand.pyx":3421
* fp = PyFloat_AsDouble(p)
* fn = PyFloat_AsDouble(n)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -14579,102 +14104,84 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_negative_binomial(PyObject *__py
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":3421
+ /* "mtrand.pyx":3422
* fn = PyFloat_AsDouble(n)
* if not PyErr_Occurred():
* if fn <= 0: # <<<<<<<<<<<<<<
* raise ValueError("n <= 0")
* if fp < 0:
*/
- __pyx_t_1 = (__pyx_v_fn <= 0);
+ __pyx_t_1 = (__pyx_v_fn <= 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":3422
+ /* "mtrand.pyx":3423
* if not PyErr_Occurred():
* if fn <= 0:
* raise ValueError("n <= 0") # <<<<<<<<<<<<<<
* if fp < 0:
* raise ValueError("p < 0")
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_119), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_40));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_40));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_40));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":3423
+ /* "mtrand.pyx":3424
* if fn <= 0:
* raise ValueError("n <= 0")
* if fp < 0: # <<<<<<<<<<<<<<
* raise ValueError("p < 0")
* elif fp > 1:
*/
- __pyx_t_1 = (__pyx_v_fp < 0);
+ __pyx_t_1 = (__pyx_v_fp < 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":3424
+ /* "mtrand.pyx":3425
* raise ValueError("n <= 0")
* if fp < 0:
* raise ValueError("p < 0") # <<<<<<<<<<<<<<
* elif fp > 1:
* raise ValueError("p > 1")
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_41));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_41));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_41));
- __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_120), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
- /* "mtrand.pyx":3425
+ /* "mtrand.pyx":3426
* if fp < 0:
* raise ValueError("p < 0")
* elif fp > 1: # <<<<<<<<<<<<<<
* raise ValueError("p > 1")
* return discdd_array_sc(self.internal_state, rk_negative_binomial,
*/
- __pyx_t_1 = (__pyx_v_fp > 1);
+ __pyx_t_1 = (__pyx_v_fp > 1.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":3426
+ /* "mtrand.pyx":3427
* raise ValueError("p < 0")
* elif fp > 1:
* raise ValueError("p > 1") # <<<<<<<<<<<<<<
* return discdd_array_sc(self.internal_state, rk_negative_binomial,
* size, fn, fp)
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_121), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_42));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_42));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_42));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":3427
+ /* "mtrand.pyx":3428
* elif fp > 1:
* raise ValueError("p > 1")
* return discdd_array_sc(self.internal_state, rk_negative_binomial, # <<<<<<<<<<<<<<
@@ -14683,23 +14190,23 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_negative_binomial(PyObject *__py
*/
__Pyx_XDECREF(__pyx_r);
- /* "mtrand.pyx":3428
+ /* "mtrand.pyx":3429
* raise ValueError("p > 1")
* return discdd_array_sc(self.internal_state, rk_negative_binomial,
* size, fn, fp) # <<<<<<<<<<<<<<
*
* PyErr_Clear()
*/
- __pyx_t_3 = __pyx_f_6mtrand_discdd_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_negative_binomial, __pyx_v_size, __pyx_v_fn, __pyx_v_fp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_discdd_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_negative_binomial, __pyx_v_size, __pyx_v_fn, __pyx_v_fp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L6;
}
__pyx_L6:;
- /* "mtrand.pyx":3430
+ /* "mtrand.pyx":3431
* size, fn, fp)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -14708,227 +14215,209 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_negative_binomial(PyObject *__py
*/
PyErr_Clear();
- /* "mtrand.pyx":3432
+ /* "mtrand.pyx":3433
* PyErr_Clear()
*
* on = <ndarray>PyArray_FROM_OTF(n, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* op = <ndarray>PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(n, 0)):
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_n, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_n, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_on));
- __pyx_v_on = ((PyArrayObject *)__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_on = ((PyArrayObject *)__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":3433
+ /* "mtrand.pyx":3434
*
* on = <ndarray>PyArray_FROM_OTF(n, NPY_DOUBLE, NPY_ALIGNED)
* op = <ndarray>PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* if np.any(np.less_equal(n, 0)):
* raise ValueError("n <= 0")
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_p, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_p, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_op));
- __pyx_v_op = ((PyArrayObject *)__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_op = ((PyArrayObject *)__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":3434
+ /* "mtrand.pyx":3435
* on = <ndarray>PyArray_FROM_OTF(n, NPY_DOUBLE, NPY_ALIGNED)
* op = <ndarray>PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(n, 0)): # <<<<<<<<<<<<<<
* raise ValueError("n <= 0")
* if np.any(np.less(p, 0)):
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_n);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_n);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_n);
__Pyx_GIVEREF(__pyx_v_n);
__Pyx_INCREF(__pyx_int_0);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
- __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3435
+ /* "mtrand.pyx":3436
* op = <ndarray>PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(n, 0)):
* raise ValueError("n <= 0") # <<<<<<<<<<<<<<
* if np.any(np.less(p, 0)):
* raise ValueError("p < 0")
*/
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_122), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_40));
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_40));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_40));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_5, 0, 0);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L9;
}
__pyx_L9:;
- /* "mtrand.pyx":3436
+ /* "mtrand.pyx":3437
* if np.any(np.less_equal(n, 0)):
* raise ValueError("n <= 0")
* if np.any(np.less(p, 0)): # <<<<<<<<<<<<<<
* raise ValueError("p < 0")
* if np.any(np.greater(p, 1)):
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__less); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(__pyx_v_p);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_p);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_p);
__Pyx_GIVEREF(__pyx_v_p);
__Pyx_INCREF(__pyx_int_0);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
- __pyx_t_4 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3437; __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_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3437
+ /* "mtrand.pyx":3438
* raise ValueError("n <= 0")
* if np.any(np.less(p, 0)):
* raise ValueError("p < 0") # <<<<<<<<<<<<<<
* if np.any(np.greater(p, 1)):
* raise ValueError("p > 1")
*/
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_123), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_41));
- PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_41));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_41));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_4, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L10;
}
__pyx_L10:;
- /* "mtrand.pyx":3438
+ /* "mtrand.pyx":3439
* if np.any(np.less(p, 0)):
* raise ValueError("p < 0")
* if np.any(np.greater(p, 1)): # <<<<<<<<<<<<<<
* raise ValueError("p > 1")
* return discdd_array(self.internal_state, rk_negative_binomial, size,
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__greater); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__any); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__greater); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
__Pyx_INCREF(__pyx_v_p);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_p);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_p);
__Pyx_GIVEREF(__pyx_v_p);
__Pyx_INCREF(__pyx_int_1);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1);
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_1);
__Pyx_GIVEREF(__pyx_int_1);
- __pyx_t_2 = PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3439
+ /* "mtrand.pyx":3440
* raise ValueError("p < 0")
* if np.any(np.greater(p, 1)):
* raise ValueError("p > 1") # <<<<<<<<<<<<<<
* return discdd_array(self.internal_state, rk_negative_binomial, size,
* on, op)
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_42));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_42));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_42));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_124), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_Raise(__pyx_t_3, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L11;
}
__pyx_L11:;
- /* "mtrand.pyx":3440
+ /* "mtrand.pyx":3441
* if np.any(np.greater(p, 1)):
* raise ValueError("p > 1")
* return discdd_array(self.internal_state, rk_negative_binomial, size, # <<<<<<<<<<<<<<
@@ -14937,14 +14426,14 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_negative_binomial(PyObject *__py
*/
__Pyx_XDECREF(__pyx_r);
- /* "mtrand.pyx":3441
+ /* "mtrand.pyx":3442
* raise ValueError("p > 1")
* return discdd_array(self.internal_state, rk_negative_binomial, size,
* on, op) # <<<<<<<<<<<<<<
*
* def poisson(self, lam=1.0, size=None):
*/
- __pyx_t_3 = __pyx_f_6mtrand_discdd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_negative_binomial, __pyx_v_size, __pyx_v_on, __pyx_v_op); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __pyx_f_6mtrand_discdd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_negative_binomial, __pyx_v_size, __pyx_v_on, __pyx_v_op); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
@@ -14962,16 +14451,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_negative_binomial(PyObject *__py
__pyx_L0:;
__Pyx_DECREF((PyObject *)__pyx_v_on);
__Pyx_DECREF((PyObject *)__pyx_v_op);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_n);
- __Pyx_DECREF(__pyx_v_p);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":3443
+/* "mtrand.pyx":3444
* on, op)
*
* def poisson(self, lam=1.0, size=None): # <<<<<<<<<<<<<<
@@ -14979,9 +14464,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_negative_binomial(PyObject *__py
* poisson(lam=1.0, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_poisson[] = "\n poisson(lam=1.0, size=None)\n\n Draw samples from a Poisson distribution.\n\n The Poisson distribution is the limit of the Binomial\n distribution for large N.\n\n Parameters\n ----------\n lam : float\n Expectation of interval, should be >= 0.\n size : int or tuple of ints, optional\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Notes\n -----\n The Poisson distribution\n\n .. math:: f(k; \\lambda)=\\frac{\\lambda^k e^{-\\lambda}}{k!}\n\n For events with an expected separation :math:`\\lambda` the Poisson\n distribution :math:`f(k; \\lambda)` describes the probability of\n :math:`k` events occurring within the observed interval :math:`\\lambda`.\n\n References\n ----------\n .. [1] Weisstein, Eric W. \"Poisson Distribution.\" From MathWorld--A Wolfram\n Web Resource. http://mathworld.wolfram.com/PoissonDistribution.html\n .. [2] Wikipedia, \"Poisson distribution\",\n http://en.wikipedia.org/wiki/Poisson_distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> import numpy as np\n >>> s = np.random.poisson(5, 10000)\n\n Display histogram of the sample:\n\n >>> import matplotlib.pyplot as plt\n >>> count, bins, ignored = plt.hist(s, 14, normed=True)\n >>> plt.show()\n\n ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_42poisson(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_42poisson[] = "\n poisson(lam=1.0, size=None)\n\n Draw samples from a Poisson distribution.\n\n The Poisson distribution is the limit of the Binomial\n distribution for large N.\n\n Parameters\n ----------\n lam : float\n Expectation of interval, should be >= 0.\n size : int or tuple of ints, optional\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Notes\n -----\n The Poisson distribution\n\n .. math:: f(k; \\lambda)=\\frac{\\lambda^k e^{-\\lambda}}{k!}\n\n For events with an expected separation :math:`\\lambda` the Poisson\n distribution :math:`f(k; \\lambda)` describes the probability of\n :math:`k` events occurring within the observed interval :math:`\\lambda`.\n\n Because the output is limited to the range of the C long type, a\n ValueError is raised when `lam` is within 10 sigma of the maximum\n representable value.\n\n References\n ----------\n .. [1] Weisstein, Eric W. \"Poisson Distribution.\" From MathWorld--A Wolfram\n Web Resource. http://mathworld.wolfram.com/PoissonDistribution.html\n .. [2] Wikipedia, \"Poisson distribution\",\n http://en.wikipedia.org/wiki/Poisson_distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> import numpy as np\n >>> s = np.random.poisson(5, 10000)\n\n Display histogram of the sample:\n\n >>> import matplotlib.pyplot as plt\n >>> count, bins, ignored = plt.hist(s, 14, normed=True)\n >>> plt.show()\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_42poisson(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_lam = 0;
PyObject *__pyx_v_size = 0;
PyArrayObject *__pyx_v_olam;
@@ -14997,7 +14482,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self,
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
PyObject* values[2] = {0,0};
- values[0] = __pyx_k_43;
+ values[0] = __pyx_k_125;
values[1] = ((PyObject *)Py_None);
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
@@ -15007,23 +14492,23 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self,
}
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 0:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lam);
- if (unlikely(value)) { values[0] = value; kw_args--; }
+ if (value) { values[0] = value; kw_args--; }
}
case 1:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[1] = value; kw_args--; }
+ if (value) { values[1] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "poisson") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3443; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "poisson") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3444; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_lam = values[0];
__pyx_v_size = values[1];
} else {
- __pyx_v_lam = __pyx_k_43;
+ __pyx_v_lam = __pyx_k_125;
__pyx_v_size = ((PyObject *)Py_None);
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 2: __pyx_v_size = PyTuple_GET_ITEM(__pyx_args, 1);
@@ -15034,17 +14519,15 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self,
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("poisson", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3443; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("poisson", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3444; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.poisson");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_lam);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_olam = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":3493
+ /* "mtrand.pyx":3498
* cdef ndarray olam
* cdef double flam
* flam = PyFloat_AsDouble(lam) # <<<<<<<<<<<<<<
@@ -15053,7 +14536,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self,
*/
__pyx_v_flam = PyFloat_AsDouble(__pyx_v_lam);
- /* "mtrand.pyx":3494
+ /* "mtrand.pyx":3499
* cdef double flam
* flam = PyFloat_AsDouble(lam)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -15063,50 +14546,76 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self,
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":3495
+ /* "mtrand.pyx":3500
* flam = PyFloat_AsDouble(lam)
* if not PyErr_Occurred():
* if lam < 0: # <<<<<<<<<<<<<<
* raise ValueError("lam < 0")
- * return discd_array_sc(self.internal_state, rk_poisson, size, flam)
+ * if lam > self.poisson_lam_max:
*/
- __pyx_t_2 = PyObject_RichCompare(__pyx_v_lam, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_RichCompare(__pyx_v_lam, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3496
+ /* "mtrand.pyx":3501
* if not PyErr_Occurred():
* if lam < 0:
* raise ValueError("lam < 0") # <<<<<<<<<<<<<<
- * return discd_array_sc(self.internal_state, rk_poisson, size, flam)
- *
+ * if lam > self.poisson_lam_max:
+ * raise ValueError("lam value too large")
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_127), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_44));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_44));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_44));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":3497
+ /* "mtrand.pyx":3502
* if lam < 0:
* raise ValueError("lam < 0")
+ * if lam > self.poisson_lam_max: # <<<<<<<<<<<<<<
+ * raise ValueError("lam value too large")
+ * return discd_array_sc(self.internal_state, rk_poisson, size, flam)
+ */
+ __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__poisson_lam_max); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_RichCompare(__pyx_v_lam, __pyx_t_2, Py_GT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (__pyx_t_1) {
+
+ /* "mtrand.pyx":3503
+ * raise ValueError("lam < 0")
+ * if lam > self.poisson_lam_max:
+ * raise ValueError("lam value too large") # <<<<<<<<<<<<<<
+ * return discd_array_sc(self.internal_state, rk_poisson, size, flam)
+ *
+ */
+ __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_129), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_3, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L8;
+ }
+ __pyx_L8:;
+
+ /* "mtrand.pyx":3504
+ * if lam > self.poisson_lam_max:
+ * raise ValueError("lam value too large")
* return discd_array_sc(self.internal_state, rk_poisson, size, flam) # <<<<<<<<<<<<<<
*
* PyErr_Clear()
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = __pyx_f_6mtrand_discd_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_poisson, __pyx_v_size, __pyx_v_flam); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __pyx_f_6mtrand_discd_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_poisson, __pyx_v_size, __pyx_v_flam); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
@@ -15115,7 +14624,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self,
}
__pyx_L6:;
- /* "mtrand.pyx":3499
+ /* "mtrand.pyx":3506
* return discd_array_sc(self.internal_state, rk_poisson, size, flam)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -15124,96 +14633,150 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self,
*/
PyErr_Clear();
- /* "mtrand.pyx":3501
+ /* "mtrand.pyx":3508
* PyErr_Clear()
*
* olam = <ndarray>PyArray_FROM_OTF(lam, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* if np.any(np.less(olam, 0)):
* raise ValueError("lam < 0")
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_lam, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_lam, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
__Pyx_DECREF(((PyObject *)__pyx_v_olam));
__pyx_v_olam = ((PyArrayObject *)__pyx_t_3);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "mtrand.pyx":3502
+ /* "mtrand.pyx":3509
*
* olam = <ndarray>PyArray_FROM_OTF(lam, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less(olam, 0)): # <<<<<<<<<<<<<<
* raise ValueError("lam < 0")
- * return discd_array(self.internal_state, rk_poisson, size, olam)
+ * if np.any(np.greater(olam, self.poisson_lam_max)):
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3502; __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 = 3509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3502; __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 = 3509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
__Pyx_INCREF(((PyObject *)__pyx_v_olam));
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_olam));
__Pyx_GIVEREF(((PyObject *)__pyx_v_olam));
__Pyx_INCREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
- __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3503
+ /* "mtrand.pyx":3510
* olam = <ndarray>PyArray_FROM_OTF(lam, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less(olam, 0)):
* raise ValueError("lam < 0") # <<<<<<<<<<<<<<
- * return discd_array(self.internal_state, rk_poisson, size, olam)
- *
+ * if np.any(np.greater(olam, self.poisson_lam_max)):
+ * raise ValueError("lam value too large.")
*/
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_130), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_44));
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_44));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_44));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_5, 0, 0);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L8;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L9;
}
- __pyx_L8:;
+ __pyx_L9:;
- /* "mtrand.pyx":3504
+ /* "mtrand.pyx":3511
* if np.any(np.less(olam, 0)):
* raise ValueError("lam < 0")
+ * if np.any(np.greater(olam, self.poisson_lam_max)): # <<<<<<<<<<<<<<
+ * raise ValueError("lam value too large.")
+ * return discd_array(self.internal_state, rk_poisson, size, olam)
+ */
+ __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__greater); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__poisson_lam_max); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+ __Pyx_INCREF(((PyObject *)__pyx_v_olam));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_olam));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_olam));
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (__pyx_t_1) {
+
+ /* "mtrand.pyx":3512
+ * raise ValueError("lam < 0")
+ * if np.any(np.greater(olam, self.poisson_lam_max)):
+ * raise ValueError("lam value too large.") # <<<<<<<<<<<<<<
+ * return discd_array(self.internal_state, rk_poisson, size, olam)
+ *
+ */
+ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_132), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_Raise(__pyx_t_5, 0, 0);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L10;
+ }
+ __pyx_L10:;
+
+ /* "mtrand.pyx":3513
+ * if np.any(np.greater(olam, self.poisson_lam_max)):
+ * raise ValueError("lam value too large.")
* return discd_array(self.internal_state, rk_poisson, size, olam) # <<<<<<<<<<<<<<
*
* def zipf(self, a, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_poisson, __pyx_v_size, __pyx_v_olam); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_5 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_poisson, __pyx_v_size, __pyx_v_olam); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_r = __pyx_t_5;
+ __pyx_t_5 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -15227,15 +14790,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self,
__pyx_r = NULL;
__pyx_L0:;
__Pyx_DECREF((PyObject *)__pyx_v_olam);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_lam);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":3506
+/* "mtrand.pyx":3515
* return discd_array(self.internal_state, rk_poisson, size, olam)
*
* def zipf(self, a, size=None): # <<<<<<<<<<<<<<
@@ -15243,9 +14803,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self,
* zipf(a, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_zipf[] = "\n"" zipf(a, size=None)\n""\n"" Draw samples from a Zipf distribution.\n""\n"" Samples are drawn from a Zipf distribution with specified parameter\n"" `a` > 1.\n""\n"" The Zipf distribution (also known as the zeta distribution) is a\n"" continuous probability distribution that satisfies Zipf's law: the\n"" frequency of an item is inversely proportional to its rank in a\n"" frequency table.\n""\n"" Parameters\n"" ----------\n"" a : float > 1\n"" Distribution parameter.\n"" size : int or tuple of int, optional\n"" Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n"" ``m * n * k`` samples are drawn; a single integer is equivalent in\n"" its result to providing a mono-tuple, i.e., a 1-D array of length\n"" *size* is returned. The default is None, in which case a single\n"" scalar is returned.\n""\n"" Returns\n"" -------\n"" samples : scalar or ndarray\n"" The returned samples are greater than or equal to one.\n""\n"" See Also\n"" --------\n"" scipy.stats.distributions.zipf : probability density function,\n"" distribution, or cumulative density function, etc.\n""\n"" Notes\n"" -----\n"" The probability density for the Zipf distribution is\n""\n"" .. math:: p(x) = \\frac{x^{-a}}{\\zeta(a)},\n""\n"" where :math:`\\zeta` is the Riemann Zeta function.\n""\n"" It is named for the American linguist George Kingsley Zipf, who noted\n"" that the frequency of any word in a sample of a language is inversely\n"" proportional to its rank in the frequency table.\n""\n"" References\n"" ----------\n"" Zipf, G. K., *Selected Studies of the Principle of Relative Frequency\n"" in Language*, Cambridge, MA: Harvard Univ. Press, 1932.\n""\n"" Examples\n"" --------\n"" Draw samples from the distribution:\n""\n"" >>> a = 2. # parameter\n"" >>> s = np.random.zipf(a, 1000)\n""\n"" Display the histogram of the samples, along with\n"" the probability density function:\n""\n"" >>> import matplotlib.pyplot as plt\n"" >>> import scipy.special as sps\n"" Truncate s values at 50 so plot is interesting\n"" >>> count, bins, ignored = plt.hist(s[s<50], 50, normed=True)\n"" >>> x = np.arange(1., 50.)\n"" >>> y = x**(-a)/sps.zetac(a)\n"" >>> plt.plot(x, y/max(y), linewidth=2, color='r')\n"" >>> plt.show()\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_43zipf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_43zipf[] = "\n zipf(a, size=None)\n\n Draw samples from a Zipf distribution.\n\n Samples are drawn from a Zipf distribution with specified parameter\n `a` > 1.\n\n The Zipf distribution (also known as the zeta distribution) is a\n continuous probability distribution that satisfies Zipf's law: the\n frequency of an item is inversely proportional to its rank in a\n frequency table.\n\n Parameters\n ----------\n a : float > 1\n Distribution parameter.\n size : int or tuple of int, optional\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn; a single integer is equivalent in\n its result to providing a mono-tuple, i.e., a 1-D array of length\n *size* is returned. The default is None, in which case a single\n scalar is returned.\n\n Returns\n -------\n samples : scalar or ndarray\n The returned samples are greater than or equal to one.\n\n See Also\n --------\n scipy.stats.distributions.zipf : probability density function,\n distribution, or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the Zipf distribution is\n\n .. math:: p(x) = \\frac{x^{-a}}{\\zeta(a)},\n\n where :math:`\\zeta` is the Riemann Zeta function.\n\n It is named for the American linguist George Kingsley Zipf, who noted\n that the frequency of any word in a sample of a language is inversely\n proportional to its rank in the frequency table.\n\n References\n ----------\n Zipf, G. K., *Selected Studies of the Principle of Relative Frequency\n in Language*, Cambridge, MA: Harvard Univ. Press, 1932.\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> a = 2. # parameter\n >>> s = np.random.zipf""(a, 1000)\n\n Display the histogram of the samples, along with\n the probability density function:\n\n >>> import matplotlib.pyplot as plt\n >>> import scipy.special as sps\n Truncate s values at 50 so plot is interesting\n >>> count, bins, ignored = plt.hist(s[s<50], 50, normed=True)\n >>> x = np.arange(1., 50.)\n >>> y = x**(-a)/sps.zetac(a)\n >>> plt.plot(x, y/max(y), linewidth=2, color='r')\n >>> plt.show()\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_43zipf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_a = 0;
PyObject *__pyx_v_size = 0;
PyArrayObject *__pyx_v_oa;
@@ -15274,13 +14834,13 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyO
if (likely(values[0])) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[1] = value; kw_args--; }
+ if (value) { values[1] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "zipf") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3506; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "zipf") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3515; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_a = values[0];
__pyx_v_size = values[1];
@@ -15295,17 +14855,15 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyO
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("zipf", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3506; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("zipf", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3515; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.zipf");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_a);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_oa = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":3581
+ /* "mtrand.pyx":3590
* cdef double fa
*
* fa = PyFloat_AsDouble(a) # <<<<<<<<<<<<<<
@@ -15314,7 +14872,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyO
*/
__pyx_v_fa = PyFloat_AsDouble(__pyx_v_a);
- /* "mtrand.pyx":3582
+ /* "mtrand.pyx":3591
*
* fa = PyFloat_AsDouble(a)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -15324,7 +14882,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyO
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":3583
+ /* "mtrand.pyx":3592
* fa = PyFloat_AsDouble(a)
* if not PyErr_Occurred():
* if fa <= 1.0: # <<<<<<<<<<<<<<
@@ -15334,29 +14892,23 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyO
__pyx_t_1 = (__pyx_v_fa <= 1.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":3584
+ /* "mtrand.pyx":3593
* if not PyErr_Occurred():
* if fa <= 1.0:
* raise ValueError("a <= 1.0") # <<<<<<<<<<<<<<
* return discd_array_sc(self.internal_state, rk_zipf, size, fa)
*
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_134), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_45));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_45));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_45));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":3585
+ /* "mtrand.pyx":3594
* if fa <= 1.0:
* raise ValueError("a <= 1.0")
* return discd_array_sc(self.internal_state, rk_zipf, size, fa) # <<<<<<<<<<<<<<
@@ -15364,16 +14916,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyO
* PyErr_Clear()
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = __pyx_f_6mtrand_discd_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_zipf, __pyx_v_size, __pyx_v_fa); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_discd_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_zipf, __pyx_v_size, __pyx_v_fa); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L6;
}
__pyx_L6:;
- /* "mtrand.pyx":3587
+ /* "mtrand.pyx":3596
* return discd_array_sc(self.internal_state, rk_zipf, size, fa)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -15382,87 +14934,81 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyO
*/
PyErr_Clear();
- /* "mtrand.pyx":3589
+ /* "mtrand.pyx":3598
* PyErr_Clear()
*
* oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* if np.any(np.less_equal(oa, 1.0)):
* raise ValueError("a <= 1.0")
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_a, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_a, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_oa));
- __pyx_v_oa = ((PyArrayObject *)__pyx_t_3);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_oa = ((PyArrayObject *)__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":3590
+ /* "mtrand.pyx":3599
*
* oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(oa, 1.0)): # <<<<<<<<<<<<<<
* raise ValueError("a <= 1.0")
* return discd_array(self.internal_state, rk_zipf, size, oa)
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(((PyObject *)__pyx_v_oa));
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_oa));
__Pyx_GIVEREF(((PyObject *)__pyx_v_oa));
- PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3591
+ /* "mtrand.pyx":3600
* oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(oa, 1.0)):
* raise ValueError("a <= 1.0") # <<<<<<<<<<<<<<
* return discd_array(self.internal_state, rk_zipf, size, oa)
*
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_45));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_45));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_45));
- __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_135), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":3592
+ /* "mtrand.pyx":3601
* if np.any(np.less_equal(oa, 1.0)):
* raise ValueError("a <= 1.0")
* return discd_array(self.internal_state, rk_zipf, size, oa) # <<<<<<<<<<<<<<
@@ -15470,10 +15016,10 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyO
* def geometric(self, p, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_5 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_zipf, __pyx_v_size, __pyx_v_oa); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_r = __pyx_t_5;
- __pyx_t_5 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_zipf, __pyx_v_size, __pyx_v_oa); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -15487,15 +15033,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyO
__pyx_r = NULL;
__pyx_L0:;
__Pyx_DECREF((PyObject *)__pyx_v_oa);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_a);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":3594
+/* "mtrand.pyx":3603
* return discd_array(self.internal_state, rk_zipf, size, oa)
*
* def geometric(self, p, size=None): # <<<<<<<<<<<<<<
@@ -15503,9 +15046,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyO
* geometric(p, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_geometric[] = "\n geometric(p, size=None)\n\n Draw samples from the geometric distribution.\n\n Bernoulli trials are experiments with one of two outcomes:\n success or failure (an example of such an experiment is flipping\n a coin). The geometric distribution models the number of trials\n that must be run in order to achieve success. It is therefore\n supported on the positive integers, ``k = 1, 2, ...``.\n\n The probability mass function of the geometric distribution is\n\n .. math:: f(k) = (1 - p)^{k - 1} p\n\n where `p` is the probability of success of an individual trial.\n\n Parameters\n ----------\n p : float\n The probability of success of an individual trial.\n size : tuple of ints\n Number of values to draw from the distribution. The output\n is shaped according to `size`.\n\n Returns\n -------\n out : ndarray\n Samples from the geometric distribution, shaped according to\n `size`.\n\n Examples\n --------\n Draw ten thousand values from the geometric distribution,\n with the probability of an individual success equal to 0.35:\n\n >>> z = np.random.geometric(p=0.35, size=10000)\n\n How many trials succeeded after a single run?\n\n >>> (z == 1).sum() / 10000.\n 0.34889999999999999 #random\n\n ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_44geometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_44geometric[] = "\n geometric(p, size=None)\n\n Draw samples from the geometric distribution.\n\n Bernoulli trials are experiments with one of two outcomes:\n success or failure (an example of such an experiment is flipping\n a coin). The geometric distribution models the number of trials\n that must be run in order to achieve success. It is therefore\n supported on the positive integers, ``k = 1, 2, ...``.\n\n The probability mass function of the geometric distribution is\n\n .. math:: f(k) = (1 - p)^{k - 1} p\n\n where `p` is the probability of success of an individual trial.\n\n Parameters\n ----------\n p : float\n The probability of success of an individual trial.\n size : tuple of ints\n Number of values to draw from the distribution. The output\n is shaped according to `size`.\n\n Returns\n -------\n out : ndarray\n Samples from the geometric distribution, shaped according to\n `size`.\n\n Examples\n --------\n Draw ten thousand values from the geometric distribution,\n with the probability of an individual success equal to 0.35:\n\n >>> z = np.random.geometric(p=0.35, size=10000)\n\n How many trials succeeded after a single run?\n\n >>> (z == 1).sum() / 10000.\n 0.34889999999999999 #random\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_44geometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_p = 0;
PyObject *__pyx_v_size = 0;
PyArrayObject *__pyx_v_op;
@@ -15534,13 +15077,13 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self
if (likely(values[0])) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[1] = value; kw_args--; }
+ if (value) { values[1] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "geometric") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3594; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "geometric") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3603; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_p = values[0];
__pyx_v_size = values[1];
@@ -15555,17 +15098,15 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("geometric", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3594; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("geometric", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3603; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.geometric");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_p);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_op = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":3642
+ /* "mtrand.pyx":3651
* cdef double fp
*
* fp = PyFloat_AsDouble(p) # <<<<<<<<<<<<<<
@@ -15574,7 +15115,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self
*/
__pyx_v_fp = PyFloat_AsDouble(__pyx_v_p);
- /* "mtrand.pyx":3643
+ /* "mtrand.pyx":3652
*
* fp = PyFloat_AsDouble(p)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -15584,7 +15125,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":3644
+ /* "mtrand.pyx":3653
* fp = PyFloat_AsDouble(p)
* if not PyErr_Occurred():
* if fp < 0.0: # <<<<<<<<<<<<<<
@@ -15594,29 +15135,23 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self
__pyx_t_1 = (__pyx_v_fp < 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":3645
+ /* "mtrand.pyx":3654
* if not PyErr_Occurred():
* if fp < 0.0:
* raise ValueError("p < 0.0") # <<<<<<<<<<<<<<
* if fp > 1.0:
* raise ValueError("p > 1.0")
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_137), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_46));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_46));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_46));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":3646
+ /* "mtrand.pyx":3655
* if fp < 0.0:
* raise ValueError("p < 0.0")
* if fp > 1.0: # <<<<<<<<<<<<<<
@@ -15626,29 +15161,23 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self
__pyx_t_1 = (__pyx_v_fp > 1.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":3647
+ /* "mtrand.pyx":3656
* raise ValueError("p < 0.0")
* if fp > 1.0:
* raise ValueError("p > 1.0") # <<<<<<<<<<<<<<
* return discd_array_sc(self.internal_state, rk_geometric, size, fp)
*
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_47));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_47));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_47));
- __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_139), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":3648
+ /* "mtrand.pyx":3657
* if fp > 1.0:
* raise ValueError("p > 1.0")
* return discd_array_sc(self.internal_state, rk_geometric, size, fp) # <<<<<<<<<<<<<<
@@ -15656,7 +15185,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self
* PyErr_Clear()
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = __pyx_f_6mtrand_discd_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_geometric, __pyx_v_size, __pyx_v_fp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __pyx_f_6mtrand_discd_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_geometric, __pyx_v_size, __pyx_v_fp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
@@ -15665,7 +15194,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self
}
__pyx_L6:;
- /* "mtrand.pyx":3650
+ /* "mtrand.pyx":3659
* return discd_array_sc(self.internal_state, rk_geometric, size, fp)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -15674,153 +15203,141 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self
*/
PyErr_Clear();
- /* "mtrand.pyx":3653
+ /* "mtrand.pyx":3662
*
*
* op = <ndarray>PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* if np.any(np.less(op, 0.0)):
* raise ValueError("p < 0.0")
*/
- __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_p, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_p, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_op));
__pyx_v_op = ((PyArrayObject *)__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":3654
+ /* "mtrand.pyx":3663
*
* op = <ndarray>PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less(op, 0.0)): # <<<<<<<<<<<<<<
* raise ValueError("p < 0.0")
* if np.any(np.greater(op, 1.0)):
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(((PyObject *)__pyx_v_op));
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_op));
__Pyx_GIVEREF(((PyObject *)__pyx_v_op));
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3655
+ /* "mtrand.pyx":3664
* op = <ndarray>PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less(op, 0.0)):
* raise ValueError("p < 0.0") # <<<<<<<<<<<<<<
* if np.any(np.greater(op, 1.0)):
* raise ValueError("p > 1.0")
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_140), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_46));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_46));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_46));
- __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L9;
}
__pyx_L9:;
- /* "mtrand.pyx":3656
+ /* "mtrand.pyx":3665
* if np.any(np.less(op, 0.0)):
* raise ValueError("p < 0.0")
* if np.any(np.greater(op, 1.0)): # <<<<<<<<<<<<<<
* raise ValueError("p > 1.0")
* return discd_array(self.internal_state, rk_geometric, size, op)
*/
- __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__greater); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__greater); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
__Pyx_INCREF(((PyObject *)__pyx_v_op));
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_op));
__Pyx_GIVEREF(((PyObject *)__pyx_v_op));
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3657
+ /* "mtrand.pyx":3666
* raise ValueError("p < 0.0")
* if np.any(np.greater(op, 1.0)):
* raise ValueError("p > 1.0") # <<<<<<<<<<<<<<
* return discd_array(self.internal_state, rk_geometric, size, op)
*
*/
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_47));
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_47));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_47));
- __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_Raise(__pyx_t_4, 0, 0);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_141), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L10;
}
__pyx_L10:;
- /* "mtrand.pyx":3658
+ /* "mtrand.pyx":3667
* if np.any(np.greater(op, 1.0)):
* raise ValueError("p > 1.0")
* return discd_array(self.internal_state, rk_geometric, size, op) # <<<<<<<<<<<<<<
@@ -15828,10 +15345,10 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self
* def hypergeometric(self, ngood, nbad, nsample, size=None):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_4 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_geometric, __pyx_v_size, __pyx_v_op); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_r = __pyx_t_4;
- __pyx_t_4 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_geometric, __pyx_v_size, __pyx_v_op); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -15845,15 +15362,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self
__pyx_r = NULL;
__pyx_L0:;
__Pyx_DECREF((PyObject *)__pyx_v_op);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_p);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":3660
+/* "mtrand.pyx":3669
* return discd_array(self.internal_state, rk_geometric, size, op)
*
* def hypergeometric(self, ngood, nbad, nsample, size=None): # <<<<<<<<<<<<<<
@@ -15861,9 +15375,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self
* hypergeometric(ngood, nbad, nsample, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_hypergeometric[] = "\n"" hypergeometric(ngood, nbad, nsample, size=None)\n""\n"" Draw samples from a Hypergeometric distribution.\n""\n"" Samples are drawn from a Hypergeometric distribution with specified\n"" parameters, ngood (ways to make a good selection), nbad (ways to make\n"" a bad selection), and nsample = number of items sampled, which is less\n"" than or equal to the sum ngood + nbad.\n""\n"" Parameters\n"" ----------\n"" ngood : float (but truncated to an integer)\n"" parameter, > 0.\n"" nbad : float\n"" parameter, >= 0.\n"" nsample : float\n"" parameter, > 0 and <= ngood+nbad\n"" size : {tuple, int}\n"" Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n"" ``m * n * k`` samples are drawn.\n""\n"" Returns\n"" -------\n"" samples : {ndarray, scalar}\n"" where the values are all integers in [0, n].\n""\n"" See Also\n"" --------\n"" scipy.stats.distributions.hypergeom : probability density function,\n"" distribution or cumulative density function, etc.\n""\n"" Notes\n"" -----\n"" The probability density for the Hypergeometric distribution is\n""\n"" .. math:: P(x) = \\frac{\\binom{m}{n}\\binom{N-m}{n-x}}{\\binom{N}{n}},\n""\n"" where :math:`0 \\le x \\le m` and :math:`n+m-N \\le x \\le n`\n""\n"" for P(x) the probability of x successes, n = ngood, m = nbad, and\n"" N = number of samples.\n""\n"" Consider an urn with black and white marbles in it, ngood of them\n"" black and nbad are white. If you draw nsample balls without\n"" replacement, then the Hypergeometric distribution describes the\n"" distribution of black balls in the drawn sample.\n""\n"" Note that this distribution is very similar to the Binomial\n"" distribution, except that in this case, samples are drawn without\n"" replacement, whereas in the Binomial case samples are drawn with\n"" replacement (or the sample space is infinite). As the sample space\n"" becomes large, this distribution approaches the Binomial.\n""\n"" References\n"" ----------\n"" .. [1] Lentner, Marvin, \"Elementary Applied Statistics\", Bogden\n"" and Quigley, 1972.\n"" .. [2] Weisstein, Eric W. \"Hypergeometric Distribution.\" From\n"" MathWorld--A Wolfram Web Resource.\n"" http://mathworld.wolfram.com/HypergeometricDistribution.html\n"" .. [3] Wikipedia, \"Hypergeometric-distribution\",\n"" http://en.wikipedia.org/wiki/Hypergeometric-distribution\n""\n"" Examples\n"" --------\n"" Draw samples from the distribution:\n""\n"" >>> ngood, nbad, nsamp = 100, 2, 10\n"" # number of good, number of bad, and number of samples\n"" >>> s = np.random.hypergeometric(ngood, nbad, nsamp, 1000)\n"" >>> hist(s)\n"" # note that it is very unlikely to grab both bad items\n""\n"" Suppose you have an urn with 15 white and 15 black marbles.\n"" If you pull 15 marbles at random, how likely is it that\n"" 12 or more of them are one color?\n""\n"" >>> s = np.random.hypergeometric(15, 15, 15, 100000)\n"" >>> sum(s>=12)/100000. + sum(s<=3)/100000.\n"" # answer = 0.003 ... pretty unlikely!\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_45hypergeometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_45hypergeometric[] = "\n hypergeometric(ngood, nbad, nsample, size=None)\n\n Draw samples from a Hypergeometric distribution.\n\n Samples are drawn from a Hypergeometric distribution with specified\n parameters, ngood (ways to make a good selection), nbad (ways to make\n a bad selection), and nsample = number of items sampled, which is less\n than or equal to the sum ngood + nbad.\n\n Parameters\n ----------\n ngood : float (but truncated to an integer)\n parameter, > 0.\n nbad : float\n parameter, >= 0.\n nsample : float\n parameter, > 0 and <= ngood+nbad\n size : {tuple, int}\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n samples : {ndarray, scalar}\n where the values are all integers in [0, n].\n\n See Also\n --------\n scipy.stats.distributions.hypergeom : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the Hypergeometric distribution is\n\n .. math:: P(x) = \\frac{\\binom{m}{n}\\binom{N-m}{n-x}}{\\binom{N}{n}},\n\n where :math:`0 \\le x \\le m` and :math:`n+m-N \\le x \\le n`\n\n for P(x) the probability of x successes, n = ngood, m = nbad, and\n N = number of samples.\n\n Consider an urn with black and white marbles in it, ngood of them\n black and nbad are white. If you draw nsample balls without\n replacement, then the Hypergeometric distribution describes the\n distribution of black balls in the drawn sample.\n\n Note that this distribution is very similar to the Binomial\n distribution, except that in this case, samples are drawn without\n replacement, whereas in the Binomial case samples are drawn wit""h\n replacement (or the sample space is infinite). As the sample space\n becomes large, this distribution approaches the Binomial.\n\n References\n ----------\n .. [1] Lentner, Marvin, \"Elementary Applied Statistics\", Bogden\n and Quigley, 1972.\n .. [2] Weisstein, Eric W. \"Hypergeometric Distribution.\" From\n MathWorld--A Wolfram Web Resource.\n http://mathworld.wolfram.com/HypergeometricDistribution.html\n .. [3] Wikipedia, \"Hypergeometric-distribution\",\n http://en.wikipedia.org/wiki/Hypergeometric-distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> ngood, nbad, nsamp = 100, 2, 10\n # number of good, number of bad, and number of samples\n >>> s = np.random.hypergeometric(ngood, nbad, nsamp, 1000)\n >>> hist(s)\n # note that it is very unlikely to grab both bad items\n\n Suppose you have an urn with 15 white and 15 black marbles.\n If you pull 15 marbles at random, how likely is it that\n 12 or more of them are one color?\n\n >>> s = np.random.hypergeometric(15, 15, 15, 100000)\n >>> sum(s>=12)/100000. + sum(s<=3)/100000.\n # answer = 0.003 ... pretty unlikely!\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_45hypergeometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_ngood = 0;
PyObject *__pyx_v_nbad = 0;
PyObject *__pyx_v_nsample = 0;
@@ -15904,22 +15418,22 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nbad);
if (likely(values[1])) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("hypergeometric", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3660; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("hypergeometric", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3669; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nsample);
if (likely(values[2])) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("hypergeometric", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3660; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("hypergeometric", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3669; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 3:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[3] = value; kw_args--; }
+ if (value) { values[3] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "hypergeometric") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3660; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "hypergeometric") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3669; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_ngood = values[0];
__pyx_v_nbad = values[1];
@@ -15940,21 +15454,17 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("hypergeometric", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3660; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("hypergeometric", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3669; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.hypergeometric");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_ngood);
- __Pyx_INCREF(__pyx_v_nbad);
- __Pyx_INCREF(__pyx_v_nsample);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_ongood = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_onbad = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_onsample = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":3747
+ /* "mtrand.pyx":3756
* cdef long lngood, lnbad, lnsample
*
* lngood = PyInt_AsLong(ngood) # <<<<<<<<<<<<<<
@@ -15963,7 +15473,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v
*/
__pyx_v_lngood = PyInt_AsLong(__pyx_v_ngood);
- /* "mtrand.pyx":3748
+ /* "mtrand.pyx":3757
*
* lngood = PyInt_AsLong(ngood)
* lnbad = PyInt_AsLong(nbad) # <<<<<<<<<<<<<<
@@ -15972,7 +15482,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v
*/
__pyx_v_lnbad = PyInt_AsLong(__pyx_v_nbad);
- /* "mtrand.pyx":3749
+ /* "mtrand.pyx":3758
* lngood = PyInt_AsLong(ngood)
* lnbad = PyInt_AsLong(nbad)
* lnsample = PyInt_AsLong(nsample) # <<<<<<<<<<<<<<
@@ -15981,7 +15491,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v
*/
__pyx_v_lnsample = PyInt_AsLong(__pyx_v_nsample);
- /* "mtrand.pyx":3750
+ /* "mtrand.pyx":3759
* lnbad = PyInt_AsLong(nbad)
* lnsample = PyInt_AsLong(nsample)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -15991,150 +15501,126 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":3751
+ /* "mtrand.pyx":3760
* lnsample = PyInt_AsLong(nsample)
* if not PyErr_Occurred():
* if ngood < 1: # <<<<<<<<<<<<<<
* raise ValueError("ngood < 1")
* if nbad < 1:
*/
- __pyx_t_2 = PyObject_RichCompare(__pyx_v_ngood, __pyx_int_1, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_RichCompare(__pyx_v_ngood, __pyx_int_1, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3752
+ /* "mtrand.pyx":3761
* if not PyErr_Occurred():
* if ngood < 1:
* raise ValueError("ngood < 1") # <<<<<<<<<<<<<<
* if nbad < 1:
* raise ValueError("nbad < 1")
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_143), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_48));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_48));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_48));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":3753
+ /* "mtrand.pyx":3762
* if ngood < 1:
* raise ValueError("ngood < 1")
* if nbad < 1: # <<<<<<<<<<<<<<
* raise ValueError("nbad < 1")
* if nsample < 1:
*/
- __pyx_t_3 = PyObject_RichCompare(__pyx_v_nbad, __pyx_int_1, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_2 = PyObject_RichCompare(__pyx_v_nbad, __pyx_int_1, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3754
+ /* "mtrand.pyx":3763
* raise ValueError("ngood < 1")
* if nbad < 1:
* raise ValueError("nbad < 1") # <<<<<<<<<<<<<<
* if nsample < 1:
* raise ValueError("nsample < 1")
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_49));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_49));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_49));
- __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_145), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":3755
+ /* "mtrand.pyx":3764
* if nbad < 1:
* raise ValueError("nbad < 1")
* if nsample < 1: # <<<<<<<<<<<<<<
* raise ValueError("nsample < 1")
* if ngood + nbad < nsample:
*/
- __pyx_t_2 = PyObject_RichCompare(__pyx_v_nsample, __pyx_int_1, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_RichCompare(__pyx_v_nsample, __pyx_int_1, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3756
+ /* "mtrand.pyx":3765
* raise ValueError("nbad < 1")
* if nsample < 1:
* raise ValueError("nsample < 1") # <<<<<<<<<<<<<<
* if ngood + nbad < nsample:
* raise ValueError("ngood + nbad < nsample")
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_147), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_50));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_50));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_50));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L9;
}
__pyx_L9:;
- /* "mtrand.pyx":3757
+ /* "mtrand.pyx":3766
* if nsample < 1:
* raise ValueError("nsample < 1")
* if ngood + nbad < nsample: # <<<<<<<<<<<<<<
* raise ValueError("ngood + nbad < nsample")
* return discnmN_array_sc(self.internal_state, rk_hypergeometric, size,
*/
- __pyx_t_3 = PyNumber_Add(__pyx_v_ngood, __pyx_v_nbad); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_v_nsample, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_Add(__pyx_v_ngood, __pyx_v_nbad); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_v_nsample, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3758
+ /* "mtrand.pyx":3767
* raise ValueError("nsample < 1")
* if ngood + nbad < nsample:
* raise ValueError("ngood + nbad < nsample") # <<<<<<<<<<<<<<
* return discnmN_array_sc(self.internal_state, rk_hypergeometric, size,
* lngood, lnbad, lnsample)
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_51));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_149), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_Raise(__pyx_t_3, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L10;
}
__pyx_L10:;
- /* "mtrand.pyx":3759
+ /* "mtrand.pyx":3768
* if ngood + nbad < nsample:
* raise ValueError("ngood + nbad < nsample")
* return discnmN_array_sc(self.internal_state, rk_hypergeometric, size, # <<<<<<<<<<<<<<
@@ -16143,14 +15629,14 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v
*/
__Pyx_XDECREF(__pyx_r);
- /* "mtrand.pyx":3760
+ /* "mtrand.pyx":3769
* raise ValueError("ngood + nbad < nsample")
* return discnmN_array_sc(self.internal_state, rk_hypergeometric, size,
* lngood, lnbad, lnsample) # <<<<<<<<<<<<<<
*
*
*/
- __pyx_t_3 = __pyx_f_6mtrand_discnmN_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_hypergeometric, __pyx_v_size, __pyx_v_lngood, __pyx_v_lnbad, __pyx_v_lnsample); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __pyx_f_6mtrand_discnmN_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_hypergeometric, __pyx_v_size, __pyx_v_lngood, __pyx_v_lnbad, __pyx_v_lnsample); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
@@ -16159,7 +15645,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v
}
__pyx_L6:;
- /* "mtrand.pyx":3763
+ /* "mtrand.pyx":3772
*
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -16168,322 +15654,298 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v
*/
PyErr_Clear();
- /* "mtrand.pyx":3765
+ /* "mtrand.pyx":3774
* PyErr_Clear()
*
* ongood = <ndarray>PyArray_FROM_OTF(ngood, NPY_LONG, NPY_ALIGNED) # <<<<<<<<<<<<<<
* onbad = <ndarray>PyArray_FROM_OTF(nbad, NPY_LONG, NPY_ALIGNED)
* onsample = <ndarray>PyArray_FROM_OTF(nsample, NPY_LONG, NPY_ALIGNED)
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_ngood, NPY_LONG, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_ngood, NPY_LONG, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
__Pyx_DECREF(((PyObject *)__pyx_v_ongood));
__pyx_v_ongood = ((PyArrayObject *)__pyx_t_3);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "mtrand.pyx":3766
+ /* "mtrand.pyx":3775
*
* ongood = <ndarray>PyArray_FROM_OTF(ngood, NPY_LONG, NPY_ALIGNED)
* onbad = <ndarray>PyArray_FROM_OTF(nbad, NPY_LONG, NPY_ALIGNED) # <<<<<<<<<<<<<<
* onsample = <ndarray>PyArray_FROM_OTF(nsample, NPY_LONG, NPY_ALIGNED)
* if np.any(np.less(ongood, 1)):
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_nbad, NPY_LONG, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_nbad, NPY_LONG, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
__Pyx_DECREF(((PyObject *)__pyx_v_onbad));
__pyx_v_onbad = ((PyArrayObject *)__pyx_t_3);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "mtrand.pyx":3767
+ /* "mtrand.pyx":3776
* ongood = <ndarray>PyArray_FROM_OTF(ngood, NPY_LONG, NPY_ALIGNED)
* onbad = <ndarray>PyArray_FROM_OTF(nbad, NPY_LONG, NPY_ALIGNED)
* onsample = <ndarray>PyArray_FROM_OTF(nsample, NPY_LONG, NPY_ALIGNED) # <<<<<<<<<<<<<<
* if np.any(np.less(ongood, 1)):
* raise ValueError("ngood < 1")
*/
- __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_nsample, NPY_LONG, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyArray_FROM_OTF(__pyx_v_nsample, NPY_LONG, NPY_ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_3)));
__Pyx_DECREF(((PyObject *)__pyx_v_onsample));
__pyx_v_onsample = ((PyArrayObject *)__pyx_t_3);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "mtrand.pyx":3768
+ /* "mtrand.pyx":3777
* onbad = <ndarray>PyArray_FROM_OTF(nbad, NPY_LONG, NPY_ALIGNED)
* onsample = <ndarray>PyArray_FROM_OTF(nsample, NPY_LONG, NPY_ALIGNED)
* if np.any(np.less(ongood, 1)): # <<<<<<<<<<<<<<
* raise ValueError("ngood < 1")
* if np.any(np.less(onbad, 1)):
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3768; __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 = 3777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3768; __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 = 3777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
__Pyx_INCREF(((PyObject *)__pyx_v_ongood));
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_ongood));
__Pyx_GIVEREF(((PyObject *)__pyx_v_ongood));
__Pyx_INCREF(__pyx_int_1);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1);
__Pyx_GIVEREF(__pyx_int_1);
- __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3769
+ /* "mtrand.pyx":3778
* onsample = <ndarray>PyArray_FROM_OTF(nsample, NPY_LONG, NPY_ALIGNED)
* if np.any(np.less(ongood, 1)):
* raise ValueError("ngood < 1") # <<<<<<<<<<<<<<
* if np.any(np.less(onbad, 1)):
* raise ValueError("nbad < 1")
*/
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_150), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_48));
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_48));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_48));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_5, 0, 0);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L11;
}
__pyx_L11:;
- /* "mtrand.pyx":3770
+ /* "mtrand.pyx":3779
* if np.any(np.less(ongood, 1)):
* raise ValueError("ngood < 1")
* if np.any(np.less(onbad, 1)): # <<<<<<<<<<<<<<
* raise ValueError("nbad < 1")
* if np.any(np.less(onsample, 1)):
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__less); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(((PyObject *)__pyx_v_onbad));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_onbad));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_onbad));
__Pyx_GIVEREF(((PyObject *)__pyx_v_onbad));
__Pyx_INCREF(__pyx_int_1);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_1);
__Pyx_GIVEREF(__pyx_int_1);
- __pyx_t_4 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3779; __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_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3771
+ /* "mtrand.pyx":3780
* raise ValueError("ngood < 1")
* if np.any(np.less(onbad, 1)):
* raise ValueError("nbad < 1") # <<<<<<<<<<<<<<
* if np.any(np.less(onsample, 1)):
* raise ValueError("nsample < 1")
*/
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_151), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_49));
- PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_49));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_49));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_4, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L12;
}
__pyx_L12:;
- /* "mtrand.pyx":3772
+ /* "mtrand.pyx":3781
* if np.any(np.less(onbad, 1)):
* raise ValueError("nbad < 1")
* if np.any(np.less(onsample, 1)): # <<<<<<<<<<<<<<
* raise ValueError("nsample < 1")
* if np.any(np.less(np.add(ongood, onbad),onsample)):
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__any); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__less); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
__Pyx_INCREF(((PyObject *)__pyx_v_onsample));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_onsample));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_onsample));
__Pyx_GIVEREF(((PyObject *)__pyx_v_onsample));
__Pyx_INCREF(__pyx_int_1);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1);
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_1);
__Pyx_GIVEREF(__pyx_int_1);
- __pyx_t_2 = PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3773
+ /* "mtrand.pyx":3782
* raise ValueError("nbad < 1")
* if np.any(np.less(onsample, 1)):
* raise ValueError("nsample < 1") # <<<<<<<<<<<<<<
* if np.any(np.less(np.add(ongood, onbad),onsample)):
* raise ValueError("ngood + nbad < nsample")
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_152), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_50));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_50));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_50));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L13;
}
__pyx_L13:;
- /* "mtrand.pyx":3774
+ /* "mtrand.pyx":3783
* if np.any(np.less(onsample, 1)):
* raise ValueError("nsample < 1")
* if np.any(np.less(np.add(ongood, onbad),onsample)): # <<<<<<<<<<<<<<
* raise ValueError("ngood + nbad < nsample")
* return discnmN_array(self.internal_state, rk_hypergeometric, size,
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__less); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__add); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__add); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(((PyObject *)__pyx_v_ongood));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_ongood));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_ongood));
__Pyx_GIVEREF(((PyObject *)__pyx_v_ongood));
__Pyx_INCREF(((PyObject *)__pyx_v_onbad));
- PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_onbad));
+ PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_onbad));
__Pyx_GIVEREF(((PyObject *)__pyx_v_onbad));
- __pyx_t_6 = PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
__Pyx_GIVEREF(__pyx_t_6);
__Pyx_INCREF(((PyObject *)__pyx_v_onsample));
- PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_onsample));
+ PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_onsample));
__Pyx_GIVEREF(((PyObject *)__pyx_v_onsample));
__pyx_t_6 = 0;
- __pyx_t_6 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
__Pyx_GIVEREF(__pyx_t_6);
__pyx_t_6 = 0;
- __pyx_t_6 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3775
+ /* "mtrand.pyx":3784
* raise ValueError("nsample < 1")
* if np.any(np.less(np.add(ongood, onbad),onsample)):
* raise ValueError("ngood + nbad < nsample") # <<<<<<<<<<<<<<
* return discnmN_array(self.internal_state, rk_hypergeometric, size,
* ongood, onbad, onsample)
*/
- __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_153), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
- PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s_51));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_6, 0, 0);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L14;
}
__pyx_L14:;
- /* "mtrand.pyx":3776
+ /* "mtrand.pyx":3785
* if np.any(np.less(np.add(ongood, onbad),onsample)):
* raise ValueError("ngood + nbad < nsample")
* return discnmN_array(self.internal_state, rk_hypergeometric, size, # <<<<<<<<<<<<<<
@@ -16492,17 +15954,17 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v
*/
__Pyx_XDECREF(__pyx_r);
- /* "mtrand.pyx":3777
+ /* "mtrand.pyx":3786
* raise ValueError("ngood + nbad < nsample")
* return discnmN_array(self.internal_state, rk_hypergeometric, size,
* ongood, onbad, onsample) # <<<<<<<<<<<<<<
*
* def logseries(self, p, size=None):
*/
- __pyx_t_3 = __pyx_f_6mtrand_discnmN_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_hypergeometric, __pyx_v_size, __pyx_v_ongood, __pyx_v_onbad, __pyx_v_onsample); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_6 = __pyx_f_6mtrand_discnmN_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_hypergeometric, __pyx_v_size, __pyx_v_ongood, __pyx_v_onbad, __pyx_v_onsample); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_r = __pyx_t_6;
+ __pyx_t_6 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -16519,17 +15981,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v
__Pyx_DECREF((PyObject *)__pyx_v_ongood);
__Pyx_DECREF((PyObject *)__pyx_v_onbad);
__Pyx_DECREF((PyObject *)__pyx_v_onsample);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_ngood);
- __Pyx_DECREF(__pyx_v_nbad);
- __Pyx_DECREF(__pyx_v_nsample);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":3779
+/* "mtrand.pyx":3788
* ongood, onbad, onsample)
*
* def logseries(self, p, size=None): # <<<<<<<<<<<<<<
@@ -16537,9 +15994,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v
* logseries(p, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_logseries[] = "\n"" logseries(p, size=None)\n""\n"" Draw samples from a Logarithmic Series distribution.\n""\n"" Samples are drawn from a Log Series distribution with specified\n"" parameter, p (probability, 0 < p < 1).\n""\n"" Parameters\n"" ----------\n"" loc : float\n""\n"" scale : float > 0.\n""\n"" size : {tuple, int}\n"" Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n"" ``m * n * k`` samples are drawn.\n""\n"" Returns\n"" -------\n"" samples : {ndarray, scalar}\n"" where the values are all integers in [0, n].\n""\n"" See Also\n"" --------\n"" scipy.stats.distributions.logser : probability density function,\n"" distribution or cumulative density function, etc.\n""\n"" Notes\n"" -----\n"" The probability density for the Log Series distribution is\n""\n"" .. math:: P(k) = \\frac{-p^k}{k \\ln(1-p)},\n""\n"" where p = probability.\n""\n"" The Log Series distribution is frequently used to represent species\n"" richness and occurrence, first proposed by Fisher, Corbet, and\n"" Williams in 1943 [2]. It may also be used to model the numbers of\n"" occupants seen in cars [3].\n""\n"" References\n"" ----------\n"" .. [1] Buzas, Martin A.; Culver, Stephen J., Understanding regional\n"" species diversity through the log series distribution of\n"" occurrences: BIODIVERSITY RESEARCH Diversity & Distributions,\n"" Volume 5, Number 5, September 1999 , pp. 187-195(9).\n"" .. [2] Fisher, R.A,, A.S. Corbet, and C.B. Williams. 1943. The\n"" relation between the number of species and the number of\n"" individuals in a random sample of an animal population.\n"" Journal of Animal Ecology, 12:42-58.\n"" .. [3] D. J. Hand, F. Daly, D. Lunn, E. Ostrowski, A Handbook of Small\n"" Data Sets, CRC Press, 1994.\n"" .. [4] Wikipedia, \"Logarithmic-distribution\",\n"" http://en.wikipedia.org/wiki/Logarithmic-distribution\n""\n"" Examples\n"" --------\n"" Draw samples from the distribution:\n""\n"" >>> a = .6\n"" >>> s = np.random.logseries(a, 10000)\n"" >>> count, bins, ignored = plt.hist(s)\n""\n"" # plot against distribution\n""\n"" >>> def logseries(k, p):\n"" ... return -p**k/(k*log(1-p))\n"" >>> plt.plot(bins, logseries(bins, a)*count.max()/\n"" logseries(bins, a).max(), 'r')\n"" >>> plt.show()\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_46logseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_46logseries[] = "\n logseries(p, size=None)\n\n Draw samples from a Logarithmic Series distribution.\n\n Samples are drawn from a Log Series distribution with specified\n parameter, p (probability, 0 < p < 1).\n\n Parameters\n ----------\n loc : float\n\n scale : float > 0.\n\n size : {tuple, int}\n Output shape. If the given shape is, e.g., ``(m, n, k)``, then\n ``m * n * k`` samples are drawn.\n\n Returns\n -------\n samples : {ndarray, scalar}\n where the values are all integers in [0, n].\n\n See Also\n --------\n scipy.stats.distributions.logser : probability density function,\n distribution or cumulative density function, etc.\n\n Notes\n -----\n The probability density for the Log Series distribution is\n\n .. math:: P(k) = \\frac{-p^k}{k \\ln(1-p)},\n\n where p = probability.\n\n The Log Series distribution is frequently used to represent species\n richness and occurrence, first proposed by Fisher, Corbet, and\n Williams in 1943 [2]. It may also be used to model the numbers of\n occupants seen in cars [3].\n\n References\n ----------\n .. [1] Buzas, Martin A.; Culver, Stephen J., Understanding regional\n species diversity through the log series distribution of\n occurrences: BIODIVERSITY RESEARCH Diversity & Distributions,\n Volume 5, Number 5, September 1999 , pp. 187-195(9).\n .. [2] Fisher, R.A,, A.S. Corbet, and C.B. Williams. 1943. The\n relation between the number of species and the number of\n individuals in a random sample of an animal population.\n Journal of Animal Ecology, 12:42-58.\n .. [3] D. J. Hand, F. Daly, D. Lunn, E. Ostrowski, A Handbook of Small\n Data Sets, CRC Press, 1994.\n .. [4] Wikipedia, \"Log""arithmic-distribution\",\n http://en.wikipedia.org/wiki/Logarithmic-distribution\n\n Examples\n --------\n Draw samples from the distribution:\n\n >>> a = .6\n >>> s = np.random.logseries(a, 10000)\n >>> count, bins, ignored = plt.hist(s)\n\n # plot against distribution\n\n >>> def logseries(k, p):\n ... return -p**k/(k*log(1-p))\n >>> plt.plot(bins, logseries(bins, a)*count.max()/\n logseries(bins, a).max(), 'r')\n >>> plt.show()\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_46logseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_p = 0;
PyObject *__pyx_v_size = 0;
PyArrayObject *__pyx_v_op;
@@ -16568,13 +16025,13 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self
if (likely(values[0])) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[1] = value; kw_args--; }
+ if (value) { values[1] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "logseries") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3779; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "logseries") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3788; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_p = values[0];
__pyx_v_size = values[1];
@@ -16589,17 +16046,15 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("logseries", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3779; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("logseries", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3788; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.logseries");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_p);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_op = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":3856
+ /* "mtrand.pyx":3865
* cdef double fp
*
* fp = PyFloat_AsDouble(p) # <<<<<<<<<<<<<<
@@ -16608,7 +16063,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self
*/
__pyx_v_fp = PyFloat_AsDouble(__pyx_v_p);
- /* "mtrand.pyx":3857
+ /* "mtrand.pyx":3866
*
* fp = PyFloat_AsDouble(p)
* if not PyErr_Occurred(): # <<<<<<<<<<<<<<
@@ -16618,7 +16073,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self
__pyx_t_1 = (!PyErr_Occurred());
if (__pyx_t_1) {
- /* "mtrand.pyx":3858
+ /* "mtrand.pyx":3867
* fp = PyFloat_AsDouble(p)
* if not PyErr_Occurred():
* if fp <= 0.0: # <<<<<<<<<<<<<<
@@ -16628,29 +16083,23 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self
__pyx_t_1 = (__pyx_v_fp <= 0.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":3859
+ /* "mtrand.pyx":3868
* if not PyErr_Occurred():
* if fp <= 0.0:
* raise ValueError("p <= 0.0") # <<<<<<<<<<<<<<
* if fp >= 1.0:
* raise ValueError("p >= 1.0")
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_155), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_52));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_52));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_52));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":3860
+ /* "mtrand.pyx":3869
* if fp <= 0.0:
* raise ValueError("p <= 0.0")
* if fp >= 1.0: # <<<<<<<<<<<<<<
@@ -16660,29 +16109,23 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self
__pyx_t_1 = (__pyx_v_fp >= 1.0);
if (__pyx_t_1) {
- /* "mtrand.pyx":3861
+ /* "mtrand.pyx":3870
* raise ValueError("p <= 0.0")
* if fp >= 1.0:
* raise ValueError("p >= 1.0") # <<<<<<<<<<<<<<
* return discd_array_sc(self.internal_state, rk_logseries, size, fp)
*
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_53));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_53));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_53));
- __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_157), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":3862
+ /* "mtrand.pyx":3871
* if fp >= 1.0:
* raise ValueError("p >= 1.0")
* return discd_array_sc(self.internal_state, rk_logseries, size, fp) # <<<<<<<<<<<<<<
@@ -16690,7 +16133,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self
* PyErr_Clear()
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = __pyx_f_6mtrand_discd_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_logseries, __pyx_v_size, __pyx_v_fp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __pyx_f_6mtrand_discd_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_logseries, __pyx_v_size, __pyx_v_fp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
@@ -16699,7 +16142,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self
}
__pyx_L6:;
- /* "mtrand.pyx":3864
+ /* "mtrand.pyx":3873
* return discd_array_sc(self.internal_state, rk_logseries, size, fp)
*
* PyErr_Clear() # <<<<<<<<<<<<<<
@@ -16708,153 +16151,141 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self
*/
PyErr_Clear();
- /* "mtrand.pyx":3866
+ /* "mtrand.pyx":3875
* PyErr_Clear()
*
* op = <ndarray>PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED) # <<<<<<<<<<<<<<
* if np.any(np.less_equal(op, 0.0)):
* raise ValueError("p <= 0.0")
*/
- __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_p, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyArray_FROM_OTF(__pyx_v_p, NPY_DOUBLE, NPY_ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_op));
__pyx_v_op = ((PyArrayObject *)__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":3867
+ /* "mtrand.pyx":3876
*
* op = <ndarray>PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(op, 0.0)): # <<<<<<<<<<<<<<
* raise ValueError("p <= 0.0")
* if np.any(np.greater_equal(op, 1.0)):
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__less_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(((PyObject *)__pyx_v_op));
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_op));
__Pyx_GIVEREF(((PyObject *)__pyx_v_op));
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3868
+ /* "mtrand.pyx":3877
* op = <ndarray>PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED)
* if np.any(np.less_equal(op, 0.0)):
* raise ValueError("p <= 0.0") # <<<<<<<<<<<<<<
* if np.any(np.greater_equal(op, 1.0)):
* raise ValueError("p >= 1.0")
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_158), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_52));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_52));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_52));
- __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L9;
}
__pyx_L9:;
- /* "mtrand.pyx":3869
+ /* "mtrand.pyx":3878
* if np.any(np.less_equal(op, 0.0)):
* raise ValueError("p <= 0.0")
* if np.any(np.greater_equal(op, 1.0)): # <<<<<<<<<<<<<<
* raise ValueError("p >= 1.0")
* return discd_array(self.internal_state, rk_logseries, size, op)
*/
- __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__greater_equal); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__greater_equal); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
__Pyx_INCREF(((PyObject *)__pyx_v_op));
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_op));
__Pyx_GIVEREF(((PyObject *)__pyx_v_op));
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "mtrand.pyx":3870
+ /* "mtrand.pyx":3879
* raise ValueError("p <= 0.0")
* if np.any(np.greater_equal(op, 1.0)):
* raise ValueError("p >= 1.0") # <<<<<<<<<<<<<<
* return discd_array(self.internal_state, rk_logseries, size, op)
*
*/
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_53));
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_53));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_53));
- __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_Raise(__pyx_t_4, 0, 0);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_159), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L10;
}
__pyx_L10:;
- /* "mtrand.pyx":3871
+ /* "mtrand.pyx":3880
* if np.any(np.greater_equal(op, 1.0)):
* raise ValueError("p >= 1.0")
* return discd_array(self.internal_state, rk_logseries, size, op) # <<<<<<<<<<<<<<
@@ -16862,10 +16293,10 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self
* # Multivariate distributions:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_4 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_logseries, __pyx_v_size, __pyx_v_op); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_r = __pyx_t_4;
- __pyx_t_4 = 0;
+ __pyx_t_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, rk_logseries, __pyx_v_size, __pyx_v_op); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -16879,15 +16310,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self
__pyx_r = NULL;
__pyx_L0:;
__Pyx_DECREF((PyObject *)__pyx_v_op);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_p);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":3874
+/* "mtrand.pyx":3883
*
* # Multivariate distributions:
* def multivariate_normal(self, mean, cov, size=None): # <<<<<<<<<<<<<<
@@ -16895,9 +16323,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self
* multivariate_normal(mean, cov[, size])
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_multivariate_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_multivariate_normal[] = "\n"" multivariate_normal(mean, cov[, size])\n""\n"" Draw random samples from a multivariate normal distribution.\n""\n"" The multivariate normal, multinormal or Gaussian distribution is a\n"" generalization of the one-dimensional normal distribution to higher\n"" dimensions. Such a distribution is specified by its mean and\n"" covariance matrix. These parameters are analogous to the mean\n"" (average or \"center\") and variance (standard deviation, or \"width,\"\n"" squared) of the one-dimensional normal distribution.\n""\n"" Parameters\n"" ----------\n"" mean : 1-D array_like, of length N\n"" Mean of the N-dimensional distribution.\n"" cov : 2-D array_like, of shape (N, N)\n"" Covariance matrix of the distribution. Must be symmetric and\n"" positive semi-definite for \"physically meaningful\" results.\n"" size : tuple of ints, optional\n"" Given a shape of, for example, ``(m,n,k)``, ``m*n*k`` samples are\n"" generated, and packed in an `m`-by-`n`-by-`k` arrangement. Because\n"" each sample is `N`-dimensional, the output shape is ``(m,n,k,N)``.\n"" If no shape is specified, a single (`N`-D) sample is returned.\n""\n"" Returns\n"" -------\n"" out : ndarray\n"" The drawn samples, of shape *size*, if that was provided. If not,\n"" the shape is ``(N,)``.\n""\n"" In other words, each entry ``out[i,j,...,:]`` is an N-dimensional\n"" value drawn from the distribution.\n""\n"" Notes\n"" -----\n"" The mean is a coordinate in N-dimensional space, which represents the\n"" location where samples are most likely to be generated. This is\n"" analogous to the peak of the bell curve for the one-dimensional or\n"" univariate normal distribution.\n""\n"" Covariance indicates the level to which two variables vary together.\n"" From the multivariate normal distribution, we draw N-dimensional\n"" samples, :math:`X = [x_1, x_2, ... x_N]`. The covariance matrix\n"" element :math:`C_{ij}` is the covariance of :math:`x_i` and :math:`x_j`.\n"" The element :math:`C_{ii}` is the variance of :math:`x_i` (i.e. its\n"" \"spread\").\n""\n"" Instead of specifying the full covariance matrix, popular\n"" approximations include:\n""\n"" - Spherical covariance (*cov* is a multiple of the identity matrix)\n"" - Diagonal covariance (*cov* has non-negative elements, and only on\n"" the diagonal)\n""\n"" This geometrical property can be seen in two dimensions by plotting\n"" generated data-points:\n""\n"" >>> mean = [0,0]\n"" >>> cov = [[1,0],[0,100]] # diagonal covariance, points lie on x or y-axis\n""\n"" >>> import matplotlib.pyplot as plt\n"" >>> x,y = np.random.multivariate_normal(mean,cov,5000).T\n"" >>> plt.plot(x,y,'x'); plt.axis('equal'); plt.show()\n""\n"" Note that the covariance matrix must be non-negative definite.\n""\n"" References\n"" ----------\n"" Papoulis, A., *Probability, Random Variables, and Stochastic Processes*,\n"" 3rd ed., New York: McGraw-Hill, 1991.\n""\n"" Duda, R. O., Hart, P. E., and Stork, D. G., *Pattern Classification*,\n"" 2nd ed., New York: Wiley, 2001.\n""\n"" Examples\n"" --------\n"" >>> mean = (1,2)\n"" >>> cov = [[1,0],[1,0]]\n"" >>> x = np.random.multivariate_normal(mean,cov,(3,3))\n"" >>> x.shape\n"" (3, 3, 2)\n""\n"" The following is probably true, given that 0.6 is roughly twice the\n"" standard deviation:\n""\n"" >>> print list( (x[0,0,:] - mean) < 0.6 )\n"" [True, True]\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_multivariate_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_47multivariate_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_47multivariate_normal[] = "\n multivariate_normal(mean, cov[, size])\n\n Draw random samples from a multivariate normal distribution.\n\n The multivariate normal, multinormal or Gaussian distribution is a\n generalization of the one-dimensional normal distribution to higher\n dimensions. Such a distribution is specified by its mean and\n covariance matrix. These parameters are analogous to the mean\n (average or \"center\") and variance (standard deviation, or \"width,\"\n squared) of the one-dimensional normal distribution.\n\n Parameters\n ----------\n mean : 1-D array_like, of length N\n Mean of the N-dimensional distribution.\n cov : 2-D array_like, of shape (N, N)\n Covariance matrix of the distribution. Must be symmetric and\n positive semi-definite for \"physically meaningful\" results.\n size : tuple of ints, optional\n Given a shape of, for example, ``(m,n,k)``, ``m*n*k`` samples are\n generated, and packed in an `m`-by-`n`-by-`k` arrangement. Because\n each sample is `N`-dimensional, the output shape is ``(m,n,k,N)``.\n If no shape is specified, a single (`N`-D) sample is returned.\n\n Returns\n -------\n out : ndarray\n The drawn samples, of shape *size*, if that was provided. If not,\n the shape is ``(N,)``.\n\n In other words, each entry ``out[i,j,...,:]`` is an N-dimensional\n value drawn from the distribution.\n\n Notes\n -----\n The mean is a coordinate in N-dimensional space, which represents the\n location where samples are most likely to be generated. This is\n analogous to the peak of the bell curve for the one-dimensional or\n univariate normal distribution.\n\n Covariance indicates the level to which two variables vary together.\n From the multivariate normal distribution, we draw ""N-dimensional\n samples, :math:`X = [x_1, x_2, ... x_N]`. The covariance matrix\n element :math:`C_{ij}` is the covariance of :math:`x_i` and :math:`x_j`.\n The element :math:`C_{ii}` is the variance of :math:`x_i` (i.e. its\n \"spread\").\n\n Instead of specifying the full covariance matrix, popular\n approximations include:\n\n - Spherical covariance (*cov* is a multiple of the identity matrix)\n - Diagonal covariance (*cov* has non-negative elements, and only on\n the diagonal)\n\n This geometrical property can be seen in two dimensions by plotting\n generated data-points:\n\n >>> mean = [0,0]\n >>> cov = [[1,0],[0,100]] # diagonal covariance, points lie on x or y-axis\n\n >>> import matplotlib.pyplot as plt\n >>> x,y = np.random.multivariate_normal(mean,cov,5000).T\n >>> plt.plot(x,y,'x'); plt.axis('equal'); plt.show()\n\n Note that the covariance matrix must be non-negative definite.\n\n References\n ----------\n Papoulis, A., *Probability, Random Variables, and Stochastic Processes*,\n 3rd ed., New York: McGraw-Hill, 1991.\n\n Duda, R. O., Hart, P. E., and Stork, D. G., *Pattern Classification*,\n 2nd ed., New York: Wiley, 2001.\n\n Examples\n --------\n >>> mean = (1,2)\n >>> cov = [[1,0],[1,0]]\n >>> x = np.random.multivariate_normal(mean,cov,(3,3))\n >>> x.shape\n (3, 3, 2)\n\n The following is probably true, given that 0.6 is roughly twice the\n standard deviation:\n\n >>> print list( (x[0,0,:] - mean) < 0.6 )\n [True, True]\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_47multivariate_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_mean = 0;
PyObject *__pyx_v_cov = 0;
PyObject *__pyx_v_size = 0;
@@ -16916,8 +16344,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multivariate_normal(PyObject *__
Py_ssize_t __pyx_t_5;
int __pyx_t_6;
int __pyx_t_7;
- PyObject *__pyx_t_8 = NULL;
+ int __pyx_t_8;
PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__mean,&__pyx_n_s__cov,&__pyx_n_s__size,0};
__Pyx_RefNannySetupContext("multivariate_normal");
if (unlikely(__pyx_kwds)) {
@@ -16940,16 +16369,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multivariate_normal(PyObject *__
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cov);
if (likely(values[1])) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("multivariate_normal", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3874; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("multivariate_normal", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3883; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[2] = value; kw_args--; }
+ if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "multivariate_normal") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3874; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "multivariate_normal") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3883; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_mean = values[0];
__pyx_v_cov = values[1];
@@ -16968,74 +16397,73 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multivariate_normal(PyObject *__
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("multivariate_normal", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3874; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("multivariate_normal", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3883; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.multivariate_normal");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
__Pyx_INCREF(__pyx_v_mean);
__Pyx_INCREF(__pyx_v_cov);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_shape = Py_None; __Pyx_INCREF(Py_None);
- __pyx_v_final_shape = Py_None; __Pyx_INCREF(Py_None);
+ __pyx_v_final_shape = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_x = Py_None; __Pyx_INCREF(Py_None);
__pyx_v_svd = Py_None; __Pyx_INCREF(Py_None);
__pyx_v_u = Py_None; __Pyx_INCREF(Py_None);
__pyx_v_s = Py_None; __Pyx_INCREF(Py_None);
__pyx_v_v = Py_None; __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":3966
+ /* "mtrand.pyx":3975
* """
* # Check preconditions on arguments
* mean = np.array(mean) # <<<<<<<<<<<<<<
* cov = np.array(cov)
* if size is None:
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__array); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__array); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3975; __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(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_1));
__Pyx_INCREF(__pyx_v_mean);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_mean);
__Pyx_GIVEREF(__pyx_v_mean);
- __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_v_mean);
__pyx_v_mean = __pyx_t_3;
__pyx_t_3 = 0;
- /* "mtrand.pyx":3967
+ /* "mtrand.pyx":3976
* # Check preconditions on arguments
* mean = np.array(mean)
* cov = np.array(cov) # <<<<<<<<<<<<<<
* if size is None:
* shape = []
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3967; __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 = 3976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
__Pyx_INCREF(__pyx_v_cov);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_cov);
__Pyx_GIVEREF(__pyx_v_cov);
- __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_v_cov);
__pyx_v_cov = __pyx_t_2;
__pyx_t_2 = 0;
- /* "mtrand.pyx":3968
+ /* "mtrand.pyx":3977
* mean = np.array(mean)
* cov = np.array(cov)
* if size is None: # <<<<<<<<<<<<<<
@@ -17045,14 +16473,14 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multivariate_normal(PyObject *__
__pyx_t_4 = (__pyx_v_size == Py_None);
if (__pyx_t_4) {
- /* "mtrand.pyx":3969
+ /* "mtrand.pyx":3978
* cov = np.array(cov)
* if size is None:
* shape = [] # <<<<<<<<<<<<<<
* else:
* shape = size
*/
- __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_DECREF(__pyx_v_shape);
__pyx_v_shape = ((PyObject *)__pyx_t_2);
@@ -17061,7 +16489,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multivariate_normal(PyObject *__
}
/*else*/ {
- /* "mtrand.pyx":3971
+ /* "mtrand.pyx":3980
* shape = []
* else:
* shape = size # <<<<<<<<<<<<<<
@@ -17074,164 +16502,146 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multivariate_normal(PyObject *__
}
__pyx_L6:;
- /* "mtrand.pyx":3972
+ /* "mtrand.pyx":3981
* else:
* shape = size
* if len(mean.shape) != 1: # <<<<<<<<<<<<<<
* raise ValueError("mean must be 1 dimensional")
* if (len(cov.shape) != 2) or (cov.shape[0] != cov.shape[1]):
*/
- __pyx_t_2 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_5 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_4 = (__pyx_t_5 != 1);
if (__pyx_t_4) {
- /* "mtrand.pyx":3973
+ /* "mtrand.pyx":3982
* shape = size
* if len(mean.shape) != 1:
* 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")
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_161), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_54));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_54));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_54));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "mtrand.pyx":3974
+ /* "mtrand.pyx":3983
* if len(mean.shape) != 1:
* 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")
* if mean.shape[0] != cov.shape[0]:
*/
- __pyx_t_3 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_2 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_4 = (__pyx_t_5 != 2);
if (!__pyx_t_4) {
- __pyx_t_3 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_7 = __pyx_t_6;
} else {
__pyx_t_7 = __pyx_t_4;
}
if (__pyx_t_7) {
- /* "mtrand.pyx":3975
+ /* "mtrand.pyx":3984
* 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") # <<<<<<<<<<<<<<
* if mean.shape[0] != cov.shape[0]:
* raise ValueError("mean and cov must have same length")
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_55));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_55));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_55));
- __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_1, 0, 0);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_163), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
- /* "mtrand.pyx":3976
+ /* "mtrand.pyx":3985
* 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]: # <<<<<<<<<<<<<<
* raise ValueError("mean and cov must have same length")
* # Compute shape of output
*/
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_7) {
- /* "mtrand.pyx":3977
+ /* "mtrand.pyx":3986
* 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") # <<<<<<<<<<<<<<
* # Compute shape of output
* if isinstance(shape, int):
*/
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_56));
- PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_56));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_56));
- __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_165), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L9;
}
__pyx_L9:;
- /* "mtrand.pyx":3979
+ /* "mtrand.pyx":3988
* raise ValueError("mean and cov must have same length")
* # Compute shape of output
* if isinstance(shape, int): # <<<<<<<<<<<<<<
* shape = [shape]
* final_shape = list(shape[:])
*/
- __pyx_t_7 = PyObject_TypeCheck(__pyx_v_shape, ((PyTypeObject *)((PyObject*)&PyInt_Type)));
+ __pyx_t_7 = PyInt_Check(__pyx_v_shape);
if (__pyx_t_7) {
- /* "mtrand.pyx":3980
+ /* "mtrand.pyx":3989
* # Compute shape of output
* if isinstance(shape, int):
* shape = [shape] # <<<<<<<<<<<<<<
* final_shape = list(shape[:])
* final_shape.append(mean.shape[0])
*/
- __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_shape);
PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
@@ -17243,311 +16653,312 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multivariate_normal(PyObject *__
}
__pyx_L10:;
- /* "mtrand.pyx":3981
+ /* "mtrand.pyx":3990
* if isinstance(shape, int):
* shape = [shape]
* final_shape = list(shape[:]) # <<<<<<<<<<<<<<
* final_shape.append(mean.shape[0])
* # Create a matrix of independent standard normally distributed random
*/
- __pyx_t_2 = PySequence_GetSlice(__pyx_v_shape, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_shape, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)&PyList_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_v_final_shape);
- __pyx_v_final_shape = __pyx_t_2;
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_v_final_shape));
+ __pyx_v_final_shape = ((PyObject*)__pyx_t_2);
__pyx_t_2 = 0;
- /* "mtrand.pyx":3982
+ /* "mtrand.pyx":3991
* shape = [shape]
* final_shape = list(shape[:])
* final_shape.append(mean.shape[0]) # <<<<<<<<<<<<<<
* # Create a matrix of independent standard normally distributed random
* # numbers. The matrix has rows with the same length as mean and as
*/
- __pyx_t_2 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_final_shape, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__pyx_v_final_shape == Py_None)) {
+ PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __pyx_t_2 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_8 = PyList_Append(__pyx_v_final_shape, __pyx_t_3); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "mtrand.pyx":3986
+ /* "mtrand.pyx":3995
* # 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)) # <<<<<<<<<<<<<<
* x.shape = (np.multiply.reduce(final_shape[0:len(final_shape)-1]),
* mean.shape[0])
*/
- __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__standard_normal); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__multiply); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__standard_normal); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__reduce); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__multiply); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(__pyx_v_final_shape);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_final_shape);
- __Pyx_GIVEREF(__pyx_v_final_shape);
- __pyx_t_8 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__reduce); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8);
- __Pyx_GIVEREF(__pyx_t_8);
- __pyx_t_8 = 0;
- __pyx_t_8 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __Pyx_INCREF(((PyObject *)__pyx_v_final_shape));
+ PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_final_shape));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_final_shape));
+ __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
+ __Pyx_GIVEREF(__pyx_t_9);
+ __pyx_t_9 = 0;
+ __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_v_x);
- __pyx_v_x = __pyx_t_8;
- __pyx_t_8 = 0;
+ __pyx_v_x = __pyx_t_9;
+ __pyx_t_9 = 0;
- /* "mtrand.pyx":3987
+ /* "mtrand.pyx":3996
* # 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]), # <<<<<<<<<<<<<<
* mean.shape[0])
* # Transform matrix of standard normals into matrix where each row
*/
- __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__multiply); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_8 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__reduce); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_5 = PyObject_Length(__pyx_v_final_shape); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = PySequence_GetSlice(__pyx_v_final_shape, 0, (__pyx_t_5 - 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_8, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__multiply); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__reduce); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (unlikely(__pyx_v_final_shape == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __pyx_t_5 = PyList_GET_SIZE(((PyObject *)__pyx_v_final_shape));
+ __pyx_t_1 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_final_shape), 0, (__pyx_t_5 - 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+ PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+ __pyx_t_1 = 0;
+ __pyx_t_1 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- /* "mtrand.pyx":3988
+ /* "mtrand.pyx":3997
* x = self.standard_normal(np.multiply.reduce(final_shape))
* x.shape = (np.multiply.reduce(final_shape[0:len(final_shape)-1]),
* mean.shape[0]) # <<<<<<<<<<<<<<
* # Transform matrix of standard normals into matrix where each row
* # contains multivariate normals with the desired covariance.
*/
- __pyx_t_2 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_8);
- __Pyx_GIVEREF(__pyx_t_8);
- __pyx_t_3 = 0;
- __pyx_t_8 = 0;
+ __pyx_t_3 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_9);
+ __Pyx_GIVEREF(__pyx_t_9);
+ __pyx_t_1 = 0;
+ __pyx_t_9 = 0;
- /* "mtrand.pyx":3987
+ /* "mtrand.pyx":3996
* # 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]), # <<<<<<<<<<<<<<
* mean.shape[0])
* # Transform matrix of standard normals into matrix where each row
*/
- if (PyObject_SetAttr(__pyx_v_x, __pyx_n_s__shape, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (PyObject_SetAttr(__pyx_v_x, __pyx_n_s__shape, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- /* "mtrand.pyx":3996
+ /* "mtrand.pyx":4005
* # decomposition of cov is such an A.
*
* from numpy.dual import svd # <<<<<<<<<<<<<<
* # XXX: we really should be doing this by Cholesky decomposition
* (u,s,v) = svd(cov)
*/
- __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
__Pyx_INCREF(((PyObject *)__pyx_n_s__svd));
- PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__svd));
+ PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s__svd));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__svd));
- __pyx_t_8 = __Pyx_Import(((PyObject *)__pyx_n_s_57), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__svd); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(__pyx_t_2);
+ __pyx_t_9 = __Pyx_Import(((PyObject *)__pyx_n_s_166), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__svd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_3);
__Pyx_DECREF(__pyx_v_svd);
- __pyx_v_svd = __pyx_t_2;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_v_svd = __pyx_t_3;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- /* "mtrand.pyx":3998
+ /* "mtrand.pyx":4007
* from numpy.dual import svd
* # XXX: we really should be doing this by Cholesky decomposition
* (u,s,v) = svd(cov) # <<<<<<<<<<<<<<
* x = np.dot(x*np.sqrt(s),v)
* # The rows of x now have the correct covariance but mean 0. Add
*/
- __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_9));
__Pyx_INCREF(__pyx_v_cov);
- PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_cov);
+ PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_cov);
__Pyx_GIVEREF(__pyx_v_cov);
- __pyx_t_2 = PyObject_Call(__pyx_v_svd, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 3)) {
- PyObject* tuple = __pyx_t_2;
- __pyx_t_8 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_8);
- __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
- __pyx_t_1 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_3 = PyObject_Call(__pyx_v_svd, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+ if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 3)) {
+ PyObject* tuple = __pyx_t_3;
+ __pyx_t_9 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_9);
+ __pyx_t_1 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_1);
+ __pyx_t_2 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_v_u);
- __pyx_v_u = __pyx_t_8;
- __pyx_t_8 = 0;
+ __pyx_v_u = __pyx_t_9;
+ __pyx_t_9 = 0;
__Pyx_DECREF(__pyx_v_s);
- __pyx_v_s = __pyx_t_3;
- __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_v_v);
- __pyx_v_v = __pyx_t_1;
+ __pyx_v_s = __pyx_t_1;
__pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_v_v);
+ __pyx_v_v = __pyx_t_2;
+ __pyx_t_2 = 0;
} else {
- __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_9 = __Pyx_UnpackItem(__pyx_t_10, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_8 = __Pyx_UnpackItem(__pyx_t_9, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_9, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_9, 2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_10, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- if (__Pyx_EndUnpack(__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_10, 2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (__Pyx_EndUnpack(__pyx_t_10, 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_DECREF(__pyx_v_u);
- __pyx_v_u = __pyx_t_8;
- __pyx_t_8 = 0;
+ __pyx_v_u = __pyx_t_9;
+ __pyx_t_9 = 0;
__Pyx_DECREF(__pyx_v_s);
- __pyx_v_s = __pyx_t_3;
- __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_v_v);
- __pyx_v_v = __pyx_t_1;
+ __pyx_v_s = __pyx_t_1;
__pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_v_v);
+ __pyx_v_v = __pyx_t_2;
+ __pyx_t_2 = 0;
}
- /* "mtrand.pyx":3999
+ /* "mtrand.pyx":4008
* # XXX: we really should be doing this by Cholesky decomposition
* (u,s,v) = svd(cov)
* x = np.dot(x*np.sqrt(s),v) # <<<<<<<<<<<<<<
* # The rows of x now have the correct covariance but mean 0. Add
* # mean to each row. Then each row will have mean mean.
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3999; __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 = 4008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
__Pyx_INCREF(__pyx_v_s);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_s);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_s);
__Pyx_GIVEREF(__pyx_v_s);
- __pyx_t_8 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyNumber_Multiply(__pyx_v_x, __pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __pyx_t_3 = PyNumber_Multiply(__pyx_v_x, __pyx_t_9); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_9));
+ PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_v);
- PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_v);
+ PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_v);
__Pyx_GIVEREF(__pyx_v_v);
- __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_3 = 0;
+ __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
__Pyx_DECREF(__pyx_v_x);
- __pyx_v_x = __pyx_t_2;
- __pyx_t_2 = 0;
+ __pyx_v_x = __pyx_t_3;
+ __pyx_t_3 = 0;
- /* "mtrand.pyx":4002
+ /* "mtrand.pyx":4011
* # 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) # <<<<<<<<<<<<<<
* x.shape = tuple(final_shape)
* return x
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_8 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__add); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_9 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__add); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_3));
__Pyx_INCREF(__pyx_v_mean);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_mean);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_mean);
__Pyx_GIVEREF(__pyx_v_mean);
__Pyx_INCREF(__pyx_v_x);
- PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_x);
+ PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_x);
__Pyx_GIVEREF(__pyx_v_x);
__Pyx_INCREF(__pyx_v_x);
- PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_x);
+ PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_x);
__Pyx_GIVEREF(__pyx_v_x);
- __pyx_t_1 = PyObject_Call(__pyx_t_8, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_2 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "mtrand.pyx":4003
+ /* "mtrand.pyx":4012
* # mean to each row. Then each row will have mean mean.
* np.add(mean,x,x)
* x.shape = tuple(final_shape) # <<<<<<<<<<<<<<
* return x
*
*/
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4003; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_INCREF(__pyx_v_final_shape);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_final_shape);
- __Pyx_GIVEREF(__pyx_v_final_shape);
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)&PyTuple_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4003; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyObject_SetAttr(__pyx_v_x, __pyx_n_s__shape, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4003; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (unlikely(__pyx_v_final_shape == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __pyx_t_2 = ((PyObject *)PyList_AsTuple(__pyx_v_final_shape)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ if (PyObject_SetAttr(__pyx_v_x, __pyx_n_s__shape, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- /* "mtrand.pyx":4004
+ /* "mtrand.pyx":4013
* np.add(mean,x,x)
* x.shape = tuple(final_shape)
* return x # <<<<<<<<<<<<<<
@@ -17565,8 +16976,8 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multivariate_normal(PyObject *__
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
- __Pyx_XDECREF(__pyx_t_8);
__Pyx_XDECREF(__pyx_t_9);
+ __Pyx_XDECREF(__pyx_t_10);
__Pyx_AddTraceback("mtrand.RandomState.multivariate_normal");
__pyx_r = NULL;
__pyx_L0:;
@@ -17577,16 +16988,14 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multivariate_normal(PyObject *__
__Pyx_DECREF(__pyx_v_u);
__Pyx_DECREF(__pyx_v_s);
__Pyx_DECREF(__pyx_v_v);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
__Pyx_DECREF(__pyx_v_mean);
__Pyx_DECREF(__pyx_v_cov);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":4006
+/* "mtrand.pyx":4015
* return x
*
* def multinomial(self, long n, object pvals, size=None): # <<<<<<<<<<<<<<
@@ -17594,9 +17003,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multivariate_normal(PyObject *__
* multinomial(n, pvals, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_multinomial[] = "\n multinomial(n, pvals, size=None)\n\n Draw samples from a multinomial distribution.\n\n The multinomial distribution is a multivariate generalisation of the\n binomial distribution. Take an experiment with one of ``p``\n possible outcomes. An example of such an experiment is throwing a dice,\n where the outcome can be 1 through 6. Each sample drawn from the\n distribution represents `n` such experiments. Its values,\n ``X_i = [X_0, X_1, ..., X_p]``, represent the number of times the outcome\n was ``i``.\n\n Parameters\n ----------\n n : int\n Number of experiments.\n pvals : sequence of floats, length p\n Probabilities of each of the ``p`` different outcomes. These\n should sum to 1 (however, the last element is always assumed to\n account for the remaining probability, as long as\n ``sum(pvals[:-1]) <= 1)``.\n size : tuple of ints\n Given a `size` of ``(M, N, K)``, then ``M*N*K`` samples are drawn,\n and the output shape becomes ``(M, N, K, p)``, since each sample\n has shape ``(p,)``.\n\n Examples\n --------\n Throw a dice 20 times:\n\n >>> np.random.multinomial(20, [1/6.]*6, size=1)\n array([[4, 1, 7, 5, 2, 1]])\n\n It landed 4 times on 1, once on 2, etc.\n\n Now, throw the dice 20 times, and 20 times again:\n\n >>> np.random.multinomial(20, [1/6.]*6, size=2)\n array([[3, 4, 3, 3, 4, 3],\n [2, 4, 3, 4, 0, 7]])\n\n For the first run, we threw 3 times 1, 4 times 2, etc. For the second,\n we threw 2 times 1, 4 times 2, etc.\n\n A loaded dice is more likely to land on number 6:\n\n >>> np.random.multinomial(100, [1/7.]*5)\n array([13, 16, 13, 16, 42])\n\n ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_48multinomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_48multinomial[] = "\n multinomial(n, pvals, size=None)\n\n Draw samples from a multinomial distribution.\n\n The multinomial distribution is a multivariate generalisation of the\n binomial distribution. Take an experiment with one of ``p``\n possible outcomes. An example of such an experiment is throwing a dice,\n where the outcome can be 1 through 6. Each sample drawn from the\n distribution represents `n` such experiments. Its values,\n ``X_i = [X_0, X_1, ..., X_p]``, represent the number of times the outcome\n was ``i``.\n\n Parameters\n ----------\n n : int\n Number of experiments.\n pvals : sequence of floats, length p\n Probabilities of each of the ``p`` different outcomes. These\n should sum to 1 (however, the last element is always assumed to\n account for the remaining probability, as long as\n ``sum(pvals[:-1]) <= 1)``.\n size : tuple of ints\n Given a `size` of ``(M, N, K)``, then ``M*N*K`` samples are drawn,\n and the output shape becomes ``(M, N, K, p)``, since each sample\n has shape ``(p,)``.\n\n Examples\n --------\n Throw a dice 20 times:\n\n >>> np.random.multinomial(20, [1/6.]*6, size=1)\n array([[4, 1, 7, 5, 2, 1]])\n\n It landed 4 times on 1, once on 2, etc.\n\n Now, throw the dice 20 times, and 20 times again:\n\n >>> np.random.multinomial(20, [1/6.]*6, size=2)\n array([[3, 4, 3, 3, 4, 3],\n [2, 4, 3, 4, 0, 7]])\n\n For the first run, we threw 3 times 1, 4 times 2, etc. For the second,\n we threw 2 times 1, 4 times 2, etc.\n\n A loaded dice is more likely to land on number 6:\n\n >>> np.random.multinomial(100, [1/7.]*5)\n array([13, 16, 13, 16, 42])\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_48multinomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
long __pyx_v_n;
PyObject *__pyx_v_pvals = 0;
PyObject *__pyx_v_size = 0;
@@ -17641,18 +17050,18 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_se
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pvals);
if (likely(values[1])) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("multinomial", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4006; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("multinomial", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4015; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[2] = value; kw_args--; }
+ if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "multinomial") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4006; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "multinomial") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4015; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
- __pyx_v_n = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4006; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_n = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4015; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_pvals = values[1];
__pyx_v_size = values[2];
} else {
@@ -17662,51 +17071,49 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_se
__pyx_v_size = PyTuple_GET_ITEM(__pyx_args, 2);
case 2:
__pyx_v_pvals = PyTuple_GET_ITEM(__pyx_args, 1);
- __pyx_v_n = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4006; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_n = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4015; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
break;
default: goto __pyx_L5_argtuple_error;
}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("multinomial", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4006; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("multinomial", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4015; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.multinomial");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_pvals);
- __Pyx_INCREF(__pyx_v_size);
arrayObject_parr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
arrayObject_mnarr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_shape = Py_None; __Pyx_INCREF(Py_None);
__pyx_v_multin = Py_None; __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":4065
+ /* "mtrand.pyx":4074
* cdef double Sum
*
* d = len(pvals) # <<<<<<<<<<<<<<
* parr = <ndarray>PyArray_ContiguousFromObject(pvals, NPY_DOUBLE, 1, 1)
* pix = <double*>parr.data
*/
- __pyx_t_1 = PyObject_Length(__pyx_v_pvals); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Length(__pyx_v_pvals); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_d = __pyx_t_1;
- /* "mtrand.pyx":4066
+ /* "mtrand.pyx":4075
*
* d = len(pvals)
* parr = <ndarray>PyArray_ContiguousFromObject(pvals, NPY_DOUBLE, 1, 1) # <<<<<<<<<<<<<<
* pix = <double*>parr.data
*
*/
- __pyx_t_2 = PyArray_ContiguousFromObject(__pyx_v_pvals, NPY_DOUBLE, 1, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyArray_ContiguousFromObject(__pyx_v_pvals, NPY_DOUBLE, 1, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)arrayObject_parr));
arrayObject_parr = ((PyArrayObject *)__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4067
+ /* "mtrand.pyx":4076
* d = len(pvals)
* parr = <ndarray>PyArray_ContiguousFromObject(pvals, NPY_DOUBLE, 1, 1)
* pix = <double*>parr.data # <<<<<<<<<<<<<<
@@ -17715,39 +17122,33 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_se
*/
__pyx_v_pix = ((double *)arrayObject_parr->data);
- /* "mtrand.pyx":4069
+ /* "mtrand.pyx":4078
* pix = <double*>parr.data
*
* if kahan_sum(pix, d-1) > (1.0 + 1e-12): # <<<<<<<<<<<<<<
* raise ValueError("sum(pvals[:-1]) > 1.0")
*
*/
- __pyx_t_3 = (__pyx_f_6mtrand_kahan_sum(__pyx_v_pix, (__pyx_v_d - 1)) > (1.0 + 9.9999999999999998e-13));
+ __pyx_t_3 = (__pyx_f_6mtrand_kahan_sum(__pyx_v_pix, (__pyx_v_d - 1)) > (1.0 + 1e-12));
if (__pyx_t_3) {
- /* "mtrand.pyx":4070
+ /* "mtrand.pyx":4079
*
* if kahan_sum(pix, d-1) > (1.0 + 1e-12):
* raise ValueError("sum(pvals[:-1]) > 1.0") # <<<<<<<<<<<<<<
*
* if size is None:
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_168), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_58));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_58));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_58));
- __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_Raise(__pyx_t_4, 0, 0);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L6;
}
__pyx_L6:;
- /* "mtrand.pyx":4072
+ /* "mtrand.pyx":4081
* raise ValueError("sum(pvals[:-1]) > 1.0")
*
* if size is None: # <<<<<<<<<<<<<<
@@ -17757,112 +17158,112 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_se
__pyx_t_3 = (__pyx_v_size == Py_None);
if (__pyx_t_3) {
- /* "mtrand.pyx":4073
+ /* "mtrand.pyx":4082
*
* if size is None:
* shape = (d,) # <<<<<<<<<<<<<<
* elif type(size) is int:
* shape = (size, d)
*/
- __pyx_t_4 = PyInt_FromLong(__pyx_v_d); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyInt_FromLong(__pyx_v_d); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_v_shape);
- __pyx_v_shape = __pyx_t_2;
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_v_shape);
+ __pyx_v_shape = ((PyObject *)__pyx_t_4);
+ __pyx_t_4 = 0;
goto __pyx_L7;
}
- /* "mtrand.pyx":4074
+ /* "mtrand.pyx":4083
* if size is None:
* shape = (d,)
* elif type(size) is int: # <<<<<<<<<<<<<<
* shape = (size, d)
* else:
*/
- __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_size)) == ((PyObject *)((PyObject*)&PyInt_Type)));
+ __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_size)) == ((PyObject *)((PyObject*)(&PyInt_Type))));
if (__pyx_t_3) {
- /* "mtrand.pyx":4075
+ /* "mtrand.pyx":4084
* shape = (d,)
* elif type(size) is int:
* shape = (size, d) # <<<<<<<<<<<<<<
* else:
* shape = size + (d,)
*/
- __pyx_t_2 = PyInt_FromLong(__pyx_v_d); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyInt_FromLong(__pyx_v_d); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_size);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_size);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size);
__Pyx_GIVEREF(__pyx_v_size);
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_v_shape);
- __pyx_v_shape = __pyx_t_4;
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_v_shape);
+ __pyx_v_shape = ((PyObject *)__pyx_t_2);
+ __pyx_t_2 = 0;
goto __pyx_L7;
}
/*else*/ {
- /* "mtrand.pyx":4077
+ /* "mtrand.pyx":4086
* shape = (size, d)
* else:
* shape = size + (d,) # <<<<<<<<<<<<<<
*
* multin = np.zeros(shape, int)
*/
- __pyx_t_4 = PyInt_FromLong(__pyx_v_d); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyInt_FromLong(__pyx_v_d); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- __pyx_t_4 = 0;
- __pyx_t_4 = PyNumber_Add(__pyx_v_size, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = PyNumber_Add(__pyx_v_size, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_v_shape);
- __pyx_v_shape = __pyx_t_4;
- __pyx_t_4 = 0;
+ __pyx_v_shape = __pyx_t_2;
+ __pyx_t_2 = 0;
}
__pyx_L7:;
- /* "mtrand.pyx":4079
+ /* "mtrand.pyx":4088
* shape = size + (d,)
*
* multin = np.zeros(shape, int) # <<<<<<<<<<<<<<
* mnarr = <ndarray>multin
* mnix = <long*>mnarr.data
*/
- __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_shape);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_shape);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
__Pyx_GIVEREF(__pyx_v_shape);
- __Pyx_INCREF(((PyObject *)((PyObject*)&PyInt_Type)));
- PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)((PyObject*)&PyInt_Type)));
- __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyInt_Type)));
- __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyInt_Type))));
+ __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_v_multin);
__pyx_v_multin = __pyx_t_5;
__pyx_t_5 = 0;
- /* "mtrand.pyx":4080
+ /* "mtrand.pyx":4089
*
* multin = np.zeros(shape, int)
* mnarr = <ndarray>multin # <<<<<<<<<<<<<<
@@ -17873,7 +17274,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_se
__Pyx_DECREF(((PyObject *)arrayObject_mnarr));
arrayObject_mnarr = ((PyArrayObject *)__pyx_v_multin);
- /* "mtrand.pyx":4081
+ /* "mtrand.pyx":4090
* multin = np.zeros(shape, int)
* mnarr = <ndarray>multin
* mnix = <long*>mnarr.data # <<<<<<<<<<<<<<
@@ -17882,7 +17283,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_se
*/
__pyx_v_mnix = ((long *)arrayObject_mnarr->data);
- /* "mtrand.pyx":4082
+ /* "mtrand.pyx":4091
* mnarr = <ndarray>multin
* mnix = <long*>mnarr.data
* i = 0 # <<<<<<<<<<<<<<
@@ -17891,7 +17292,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_se
*/
__pyx_v_i = 0;
- /* "mtrand.pyx":4083
+ /* "mtrand.pyx":4092
* mnix = <long*>mnarr.data
* i = 0
* while i < PyArray_SIZE(mnarr): # <<<<<<<<<<<<<<
@@ -17902,7 +17303,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_se
__pyx_t_3 = (__pyx_v_i < PyArray_SIZE(arrayObject_mnarr));
if (!__pyx_t_3) break;
- /* "mtrand.pyx":4084
+ /* "mtrand.pyx":4093
* i = 0
* while i < PyArray_SIZE(mnarr):
* Sum = 1.0 # <<<<<<<<<<<<<<
@@ -17911,7 +17312,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_se
*/
__pyx_v_Sum = 1.0;
- /* "mtrand.pyx":4085
+ /* "mtrand.pyx":4094
* while i < PyArray_SIZE(mnarr):
* Sum = 1.0
* dn = n # <<<<<<<<<<<<<<
@@ -17920,7 +17321,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_se
*/
__pyx_v_dn = __pyx_v_n;
- /* "mtrand.pyx":4086
+ /* "mtrand.pyx":4095
* Sum = 1.0
* dn = n
* for j from 0 <= j < d-1: # <<<<<<<<<<<<<<
@@ -17930,7 +17331,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_se
__pyx_t_6 = (__pyx_v_d - 1);
for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_6; __pyx_v_j++) {
- /* "mtrand.pyx":4087
+ /* "mtrand.pyx":4096
* dn = n
* for j from 0 <= j < d-1:
* mnix[i+j] = rk_binomial(self.internal_state, dn, pix[j]/Sum) # <<<<<<<<<<<<<<
@@ -17940,11 +17341,11 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_se
__pyx_t_7 = (__pyx_v_pix[__pyx_v_j]);
if (unlikely(__pyx_v_Sum == 0)) {
PyErr_Format(PyExc_ZeroDivisionError, "float division");
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
(__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));
- /* "mtrand.pyx":4088
+ /* "mtrand.pyx":4097
* for j from 0 <= j < d-1:
* mnix[i+j] = rk_binomial(self.internal_state, dn, pix[j]/Sum)
* dn = dn - mnix[i+j] # <<<<<<<<<<<<<<
@@ -17953,7 +17354,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_se
*/
__pyx_v_dn = (__pyx_v_dn - (__pyx_v_mnix[(__pyx_v_i + __pyx_v_j)]));
- /* "mtrand.pyx":4089
+ /* "mtrand.pyx":4098
* mnix[i+j] = rk_binomial(self.internal_state, dn, pix[j]/Sum)
* dn = dn - mnix[i+j]
* if dn <= 0: # <<<<<<<<<<<<<<
@@ -17963,7 +17364,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_se
__pyx_t_3 = (__pyx_v_dn <= 0);
if (__pyx_t_3) {
- /* "mtrand.pyx":4090
+ /* "mtrand.pyx":4099
* dn = dn - mnix[i+j]
* if dn <= 0:
* break # <<<<<<<<<<<<<<
@@ -17975,7 +17376,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_se
}
__pyx_L12:;
- /* "mtrand.pyx":4091
+ /* "mtrand.pyx":4100
* if dn <= 0:
* break
* Sum = Sum - pix[j] # <<<<<<<<<<<<<<
@@ -17986,7 +17387,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_se
}
__pyx_L11_break:;
- /* "mtrand.pyx":4092
+ /* "mtrand.pyx":4101
* break
* Sum = Sum - pix[j]
* if dn > 0: # <<<<<<<<<<<<<<
@@ -17996,7 +17397,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_se
__pyx_t_3 = (__pyx_v_dn > 0);
if (__pyx_t_3) {
- /* "mtrand.pyx":4093
+ /* "mtrand.pyx":4102
* Sum = Sum - pix[j]
* if dn > 0:
* mnix[i+d-1] = dn # <<<<<<<<<<<<<<
@@ -18008,7 +17409,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_se
}
__pyx_L13:;
- /* "mtrand.pyx":4095
+ /* "mtrand.pyx":4104
* mnix[i+d-1] = dn
*
* i = i + d # <<<<<<<<<<<<<<
@@ -18018,7 +17419,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_se
__pyx_v_i = (__pyx_v_i + __pyx_v_d);
}
- /* "mtrand.pyx":4097
+ /* "mtrand.pyx":4106
* i = i + d
*
* return multin # <<<<<<<<<<<<<<
@@ -18043,15 +17444,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_se
__Pyx_DECREF((PyObject *)arrayObject_mnarr);
__Pyx_DECREF(__pyx_v_shape);
__Pyx_DECREF(__pyx_v_multin);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_pvals);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":4099
+/* "mtrand.pyx":4108
* return multin
*
* def dirichlet(self, object alpha, size=None): # <<<<<<<<<<<<<<
@@ -18059,9 +17457,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_se
* dirichlet(alpha, size=None)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_dirichlet(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_dirichlet[] = "\n"" dirichlet(alpha, size=None)\n""\n"" Draw samples from the Dirichlet distribution.\n""\n"" Draw `size` samples of dimension k from a Dirichlet distribution. A\n"" Dirichlet-distributed random variable can be seen as a multivariate\n"" generalization of a Beta distribution. Dirichlet pdf is the conjugate\n"" prior of a multinomial in Bayesian inference.\n""\n"" Parameters\n"" ----------\n"" alpha : array\n"" Parameter of the distribution (k dimension for sample of\n"" dimension k).\n"" size : array\n"" Number of samples to draw.\n""\n"" Returns\n"" -------\n"" samples : ndarray,\n"" The drawn samples, of shape (alpha.ndim, size).\n""\n"" Notes\n"" -----\n"" .. math:: X \\approx \\prod_{i=1}^{k}{x^{\\alpha_i-1}_i}\n""\n"" Uses the following property for computation: for each dimension,\n"" draw a random sample y_i from a standard gamma generator of shape\n"" `alpha_i`, then\n"" :math:`X = \\frac{1}{\\sum_{i=1}^k{y_i}} (y_1, \\ldots, y_n)` is\n"" Dirichlet distributed.\n""\n"" References\n"" ----------\n"" .. [1] David McKay, \"Information Theory, Inference and Learning\n"" Algorithms,\" chapter 23,\n"" http://www.inference.phy.cam.ac.uk/mackay/\n"" .. [2] Wikipedia, \"Dirichlet distribution\",\n"" http://en.wikipedia.org/wiki/Dirichlet_distribution\n""\n"" Examples\n"" --------\n"" Taking an example cited in Wikipedia, this distribution can be used if\n"" one wanted to cut strings (each of initial length 1.0) into K pieces\n"" with different lengths, where each piece had, on average, a designated\n"" average length, but allowing some variation in the relative sizes of the\n"" pieces.\n""\n"" >>> s = np.random.dirichlet((10, 5, 3), 20).transpose()\n""\n"" >>> plt.barh(range(20), s[0])\n"" >>> plt.barh(range(20), s[1], left=s[0], color='g')\n"" >>> plt.barh(range(20), s[2], left=s[0]+s[1], color='r')\n"" >>> plt.title(\"Lengths of Strings\")\n""\n"" ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_dirichlet(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_49dirichlet(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_49dirichlet[] = "\n dirichlet(alpha, size=None)\n\n Draw samples from the Dirichlet distribution.\n\n Draw `size` samples of dimension k from a Dirichlet distribution. A\n Dirichlet-distributed random variable can be seen as a multivariate\n generalization of a Beta distribution. Dirichlet pdf is the conjugate\n prior of a multinomial in Bayesian inference.\n\n Parameters\n ----------\n alpha : array\n Parameter of the distribution (k dimension for sample of\n dimension k).\n size : array\n Number of samples to draw.\n\n Returns\n -------\n samples : ndarray,\n The drawn samples, of shape (alpha.ndim, size).\n\n Notes\n -----\n .. math:: X \\approx \\prod_{i=1}^{k}{x^{\\alpha_i-1}_i}\n\n Uses the following property for computation: for each dimension,\n draw a random sample y_i from a standard gamma generator of shape\n `alpha_i`, then\n :math:`X = \\frac{1}{\\sum_{i=1}^k{y_i}} (y_1, \\ldots, y_n)` is\n Dirichlet distributed.\n\n References\n ----------\n .. [1] David McKay, \"Information Theory, Inference and Learning\n Algorithms,\" chapter 23,\n http://www.inference.phy.cam.ac.uk/mackay/\n .. [2] Wikipedia, \"Dirichlet distribution\",\n http://en.wikipedia.org/wiki/Dirichlet_distribution\n\n Examples\n --------\n Taking an example cited in Wikipedia, this distribution can be used if\n one wanted to cut strings (each of initial length 1.0) into K pieces\n with different lengths, where each piece had, on average, a designated\n average length, but allowing some variation in the relative sizes of the\n pieces.\n\n >>> s = np.random.dirichlet((10, 5, 3), 20).transpose()\n\n >>> plt.barh(range(20), s[0])\n >>> plt.barh(range(20), s[1], left=s[0], color='g')""\n >>> plt.barh(range(20), s[2], left=s[0]+s[1], color='r')\n >>> plt.title(\"Lengths of Strings\")\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_49dirichlet(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_alpha = 0;
PyObject *__pyx_v_size = 0;
long __pyx_v_k;
@@ -18101,13 +17499,13 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_dirichlet(PyObject *__pyx_v_self
if (likely(values[0])) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
- if (kw_args > 1) {
+ if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
- if (unlikely(value)) { values[1] = value; kw_args--; }
+ if (value) { values[1] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "dirichlet") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4099; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "dirichlet") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4108; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_alpha = values[0];
__pyx_v_size = values[1];
@@ -18122,44 +17520,42 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_dirichlet(PyObject *__pyx_v_self
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("dirichlet", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4099; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("dirichlet", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4108; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("mtrand.RandomState.dirichlet");
+ __Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_alpha);
- __Pyx_INCREF(__pyx_v_size);
__pyx_v_alpha_arr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_val_arr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
__pyx_v_shape = Py_None; __Pyx_INCREF(Py_None);
__pyx_v_diric = Py_None; __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":4185
+ /* "mtrand.pyx":4194
* cdef double acc, invacc
*
* k = len(alpha) # <<<<<<<<<<<<<<
* alpha_arr = <ndarray>PyArray_ContiguousFromObject(alpha, NPY_DOUBLE, 1, 1)
* alpha_data = <double*>alpha_arr.data
*/
- __pyx_t_1 = PyObject_Length(__pyx_v_alpha); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Length(__pyx_v_alpha); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_k = __pyx_t_1;
- /* "mtrand.pyx":4186
+ /* "mtrand.pyx":4195
*
* k = len(alpha)
* alpha_arr = <ndarray>PyArray_ContiguousFromObject(alpha, NPY_DOUBLE, 1, 1) # <<<<<<<<<<<<<<
* alpha_data = <double*>alpha_arr.data
*
*/
- __pyx_t_2 = PyArray_ContiguousFromObject(__pyx_v_alpha, NPY_DOUBLE, 1, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyArray_ContiguousFromObject(__pyx_v_alpha, NPY_DOUBLE, 1, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_2)));
__Pyx_DECREF(((PyObject *)__pyx_v_alpha_arr));
__pyx_v_alpha_arr = ((PyArrayObject *)__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4187
+ /* "mtrand.pyx":4196
* k = len(alpha)
* alpha_arr = <ndarray>PyArray_ContiguousFromObject(alpha, NPY_DOUBLE, 1, 1)
* alpha_data = <double*>alpha_arr.data # <<<<<<<<<<<<<<
@@ -18168,7 +17564,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_dirichlet(PyObject *__pyx_v_self
*/
__pyx_v_alpha_data = ((double *)__pyx_v_alpha_arr->data);
- /* "mtrand.pyx":4189
+ /* "mtrand.pyx":4198
* alpha_data = <double*>alpha_arr.data
*
* if size is None: # <<<<<<<<<<<<<<
@@ -18178,47 +17574,47 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_dirichlet(PyObject *__pyx_v_self
__pyx_t_3 = (__pyx_v_size == Py_None);
if (__pyx_t_3) {
- /* "mtrand.pyx":4190
+ /* "mtrand.pyx":4199
*
* if size is None:
* shape = (k,) # <<<<<<<<<<<<<<
* elif type(size) is int:
* shape = (size, k)
*/
- __pyx_t_2 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_v_shape);
- __pyx_v_shape = __pyx_t_4;
+ __pyx_v_shape = ((PyObject *)__pyx_t_4);
__pyx_t_4 = 0;
goto __pyx_L6;
}
- /* "mtrand.pyx":4191
+ /* "mtrand.pyx":4200
* if size is None:
* shape = (k,)
* elif type(size) is int: # <<<<<<<<<<<<<<
* shape = (size, k)
* else:
*/
- __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_size)) == ((PyObject *)((PyObject*)&PyInt_Type)));
+ __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_size)) == ((PyObject *)((PyObject*)(&PyInt_Type))));
if (__pyx_t_3) {
- /* "mtrand.pyx":4192
+ /* "mtrand.pyx":4201
* shape = (k,)
* elif type(size) is int:
* shape = (size, k) # <<<<<<<<<<<<<<
* else:
* shape = size + (k,)
*/
- __pyx_t_4 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_size);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size);
__Pyx_GIVEREF(__pyx_v_size);
@@ -18226,69 +17622,69 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_dirichlet(PyObject *__pyx_v_self
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
__Pyx_DECREF(__pyx_v_shape);
- __pyx_v_shape = __pyx_t_2;
+ __pyx_v_shape = ((PyObject *)__pyx_t_2);
__pyx_t_2 = 0;
goto __pyx_L6;
}
/*else*/ {
- /* "mtrand.pyx":4194
+ /* "mtrand.pyx":4203
* shape = (size, k)
* else:
* shape = size + (k,) # <<<<<<<<<<<<<<
*
* diric = np.zeros(shape, np.float64)
*/
- __pyx_t_2 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyNumber_Add(__pyx_v_size, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_Add(__pyx_v_size, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_v_shape);
__pyx_v_shape = __pyx_t_2;
__pyx_t_2 = 0;
}
__pyx_L6:;
- /* "mtrand.pyx":4196
+ /* "mtrand.pyx":4205
* shape = size + (k,)
*
* diric = np.zeros(shape, np.float64) # <<<<<<<<<<<<<<
* val_arr = <ndarray>diric
* val_data= <double*>val_arr.data
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_shape);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
__Pyx_GIVEREF(__pyx_v_shape);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_v_diric);
__pyx_v_diric = __pyx_t_5;
__pyx_t_5 = 0;
- /* "mtrand.pyx":4197
+ /* "mtrand.pyx":4206
*
* diric = np.zeros(shape, np.float64)
* val_arr = <ndarray>diric # <<<<<<<<<<<<<<
@@ -18299,7 +17695,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_dirichlet(PyObject *__pyx_v_self
__Pyx_DECREF(((PyObject *)__pyx_v_val_arr));
__pyx_v_val_arr = ((PyArrayObject *)__pyx_v_diric);
- /* "mtrand.pyx":4198
+ /* "mtrand.pyx":4207
* diric = np.zeros(shape, np.float64)
* val_arr = <ndarray>diric
* val_data= <double*>val_arr.data # <<<<<<<<<<<<<<
@@ -18308,7 +17704,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_dirichlet(PyObject *__pyx_v_self
*/
__pyx_v_val_data = ((double *)__pyx_v_val_arr->data);
- /* "mtrand.pyx":4200
+ /* "mtrand.pyx":4209
* val_data= <double*>val_arr.data
*
* i = 0 # <<<<<<<<<<<<<<
@@ -18317,7 +17713,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_dirichlet(PyObject *__pyx_v_self
*/
__pyx_v_i = 0;
- /* "mtrand.pyx":4201
+ /* "mtrand.pyx":4210
*
* i = 0
* totsize = PyArray_SIZE(val_arr) # <<<<<<<<<<<<<<
@@ -18326,7 +17722,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_dirichlet(PyObject *__pyx_v_self
*/
__pyx_v_totsize = PyArray_SIZE(__pyx_v_val_arr);
- /* "mtrand.pyx":4202
+ /* "mtrand.pyx":4211
* i = 0
* totsize = PyArray_SIZE(val_arr)
* while i < totsize: # <<<<<<<<<<<<<<
@@ -18337,7 +17733,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_dirichlet(PyObject *__pyx_v_self
__pyx_t_3 = (__pyx_v_i < __pyx_v_totsize);
if (!__pyx_t_3) break;
- /* "mtrand.pyx":4203
+ /* "mtrand.pyx":4212
* totsize = PyArray_SIZE(val_arr)
* while i < totsize:
* acc = 0.0 # <<<<<<<<<<<<<<
@@ -18346,7 +17742,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_dirichlet(PyObject *__pyx_v_self
*/
__pyx_v_acc = 0.0;
- /* "mtrand.pyx":4204
+ /* "mtrand.pyx":4213
* while i < totsize:
* acc = 0.0
* for j from 0 <= j < k: # <<<<<<<<<<<<<<
@@ -18356,7 +17752,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_dirichlet(PyObject *__pyx_v_self
__pyx_t_6 = __pyx_v_k;
for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_6; __pyx_v_j++) {
- /* "mtrand.pyx":4205
+ /* "mtrand.pyx":4214
* acc = 0.0
* for j from 0 <= j < k:
* val_data[i+j] = rk_standard_gamma(self.internal_state, alpha_data[j]) # <<<<<<<<<<<<<<
@@ -18365,7 +17761,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_dirichlet(PyObject *__pyx_v_self
*/
(__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]));
- /* "mtrand.pyx":4206
+ /* "mtrand.pyx":4215
* 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] # <<<<<<<<<<<<<<
@@ -18375,7 +17771,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_dirichlet(PyObject *__pyx_v_self
__pyx_v_acc = (__pyx_v_acc + (__pyx_v_val_data[(__pyx_v_i + __pyx_v_j)]));
}
- /* "mtrand.pyx":4207
+ /* "mtrand.pyx":4216
* val_data[i+j] = rk_standard_gamma(self.internal_state, alpha_data[j])
* acc = acc + val_data[i+j]
* invacc = 1/acc # <<<<<<<<<<<<<<
@@ -18384,11 +17780,11 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_dirichlet(PyObject *__pyx_v_self
*/
if (unlikely(__pyx_v_acc == 0)) {
PyErr_Format(PyExc_ZeroDivisionError, "float division");
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_v_invacc = (1 / __pyx_v_acc);
+ __pyx_v_invacc = (1.0 / __pyx_v_acc);
- /* "mtrand.pyx":4208
+ /* "mtrand.pyx":4217
* acc = acc + val_data[i+j]
* invacc = 1/acc
* for j from 0 <= j < k: # <<<<<<<<<<<<<<
@@ -18398,7 +17794,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_dirichlet(PyObject *__pyx_v_self
__pyx_t_6 = __pyx_v_k;
for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_6; __pyx_v_j++) {
- /* "mtrand.pyx":4209
+ /* "mtrand.pyx":4218
* invacc = 1/acc
* for j from 0 <= j < k:
* val_data[i+j] = val_data[i+j] * invacc # <<<<<<<<<<<<<<
@@ -18408,7 +17804,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_dirichlet(PyObject *__pyx_v_self
(__pyx_v_val_data[(__pyx_v_i + __pyx_v_j)]) = ((__pyx_v_val_data[(__pyx_v_i + __pyx_v_j)]) * __pyx_v_invacc);
}
- /* "mtrand.pyx":4210
+ /* "mtrand.pyx":4219
* for j from 0 <= j < k:
* val_data[i+j] = val_data[i+j] * invacc
* i = i + k # <<<<<<<<<<<<<<
@@ -18418,7 +17814,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_dirichlet(PyObject *__pyx_v_self
__pyx_v_i = (__pyx_v_i + __pyx_v_k);
}
- /* "mtrand.pyx":4212
+ /* "mtrand.pyx":4221
* i = i + k
*
* return diric # <<<<<<<<<<<<<<
@@ -18443,15 +17839,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_dirichlet(PyObject *__pyx_v_self
__Pyx_DECREF((PyObject *)__pyx_v_val_arr);
__Pyx_DECREF(__pyx_v_shape);
__Pyx_DECREF(__pyx_v_diric);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_alpha);
- __Pyx_DECREF(__pyx_v_size);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":4215
+/* "mtrand.pyx":4224
*
* # Shuffling and permutations:
* def shuffle(self, object x): # <<<<<<<<<<<<<<
@@ -18459,9 +17852,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_dirichlet(PyObject *__pyx_v_self
* shuffle(x)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_shuffle[] = "\n shuffle(x)\n\n Modify a sequence in-place by shuffling its contents.\n\n Parameters\n ----------\n x : array_like\n The array or list to be shuffled.\n\n Returns\n -------\n None\n\n Examples\n --------\n >>> arr = np.arange(10)\n >>> np.random.shuffle(arr)\n >>> arr\n [1 7 5 2 9 4 3 6 0 8]\n\n This function only shuffles the array along the first index of a\n multi-dimensional array:\n\n >>> arr = np.arange(9).reshape((3, 3))\n >>> np.random.shuffle(arr)\n >>> arr\n array([[3, 4, 5],\n [6, 7, 8],\n [0, 1, 2]])\n\n ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_50shuffle(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_50shuffle[] = "\n shuffle(x)\n\n Modify a sequence in-place by shuffling its contents.\n\n Parameters\n ----------\n x : array_like\n The array or list to be shuffled.\n\n Returns\n -------\n None\n\n Examples\n --------\n >>> arr = np.arange(10)\n >>> np.random.shuffle(arr)\n >>> arr\n [1 7 5 2 9 4 3 6 0 8]\n\n This function only shuffles the array along the first index of a\n multi-dimensional array:\n\n >>> arr = np.arange(9).reshape((3, 3))\n >>> np.random.shuffle(arr)\n >>> arr\n array([[3, 4, 5],\n [6, 7, 8],\n [0, 1, 2]])\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_50shuffle(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
long __pyx_v_i;
long __pyx_v_j;
int __pyx_v_copy;
@@ -18471,22 +17864,19 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self,
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
int __pyx_t_5;
- int __pyx_t_6;
__Pyx_RefNannySetupContext("shuffle");
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_x);
- /* "mtrand.pyx":4251
+ /* "mtrand.pyx":4260
* cdef int copy
*
* i = len(x) - 1 # <<<<<<<<<<<<<<
* try:
* j = len(x[0])
*/
- __pyx_t_1 = PyObject_Length(__pyx_v_x); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Length(__pyx_v_x); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_i = (__pyx_t_1 - 1);
- /* "mtrand.pyx":4252
+ /* "mtrand.pyx":4261
*
* i = len(x) - 1
* try: # <<<<<<<<<<<<<<
@@ -18501,16 +17891,16 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self,
__Pyx_XGOTREF(__pyx_save_exc_tb);
/*try:*/ {
- /* "mtrand.pyx":4253
+ /* "mtrand.pyx":4262
* i = len(x) - 1
* try:
* j = len(x[0]) # <<<<<<<<<<<<<<
* except:
* j = 0
*/
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_x, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4253; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_x, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4262; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4253; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4262; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_j = __pyx_t_1;
}
@@ -18521,7 +17911,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self,
__pyx_L5_error:;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4254
+ /* "mtrand.pyx":4263
* try:
* j = len(x[0])
* except: # <<<<<<<<<<<<<<
@@ -18530,12 +17920,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self,
*/
/*except:*/ {
__Pyx_AddTraceback("mtrand.RandomState.shuffle");
- if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4254; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
+ if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4263; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_GOTREF(__pyx_t_3);
__Pyx_GOTREF(__pyx_t_4);
- /* "mtrand.pyx":4255
+ /* "mtrand.pyx":4264
* j = len(x[0])
* except:
* j = 0 # <<<<<<<<<<<<<<
@@ -18562,7 +17952,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self,
__pyx_L12_try_end:;
}
- /* "mtrand.pyx":4257
+ /* "mtrand.pyx":4266
* j = 0
*
* if (j == 0): # <<<<<<<<<<<<<<
@@ -18572,7 +17962,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self,
__pyx_t_5 = (__pyx_v_j == 0);
if (__pyx_t_5) {
- /* "mtrand.pyx":4259
+ /* "mtrand.pyx":4268
* if (j == 0):
* # adaptation of random.shuffle()
* while i > 0: # <<<<<<<<<<<<<<
@@ -18583,7 +17973,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self,
__pyx_t_5 = (__pyx_v_i > 0);
if (!__pyx_t_5) break;
- /* "mtrand.pyx":4260
+ /* "mtrand.pyx":4269
* # adaptation of random.shuffle()
* while i > 0:
* j = rk_interval(i, self.internal_state) # <<<<<<<<<<<<<<
@@ -18592,23 +17982,23 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self,
*/
__pyx_v_j = rk_interval(__pyx_v_i, ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);
- /* "mtrand.pyx":4261
+ /* "mtrand.pyx":4270
* while i > 0:
* j = rk_interval(i, self.internal_state)
* x[i], x[j] = x[j], x[i] # <<<<<<<<<<<<<<
* i = i - 1
* else:
*/
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_x, __pyx_v_j, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_x, __pyx_v_j, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_x, __pyx_v_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_x, __pyx_v_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- if (__Pyx_SetItemInt(__pyx_v_x, __pyx_v_i, __pyx_t_4, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetItemInt(__pyx_v_x, __pyx_v_i, __pyx_t_4, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (__Pyx_SetItemInt(__pyx_v_x, __pyx_v_j, __pyx_t_3, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetItemInt(__pyx_v_x, __pyx_v_j, __pyx_t_3, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "mtrand.pyx":4262
+ /* "mtrand.pyx":4271
* j = rk_interval(i, self.internal_state)
* x[i], x[j] = x[j], x[i]
* i = i - 1 # <<<<<<<<<<<<<<
@@ -18621,30 +18011,29 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self,
}
/*else*/ {
- /* "mtrand.pyx":4265
+ /* "mtrand.pyx":4274
* else:
* # make copies
* copy = hasattr(x[0], 'copy') # <<<<<<<<<<<<<<
* if copy:
* while(i > 0):
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_x, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_x, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyObject_HasAttr(__pyx_t_3, ((PyObject *)__pyx_n_s__copy)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_HasAttr(__pyx_t_3, ((PyObject *)__pyx_n_s__copy)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_copy = __pyx_t_5;
- /* "mtrand.pyx":4266
+ /* "mtrand.pyx":4275
* # make copies
* copy = hasattr(x[0], 'copy')
* if copy: # <<<<<<<<<<<<<<
* while(i > 0):
* j = rk_interval(i, self.internal_state)
*/
- __pyx_t_6 = __pyx_v_copy;
- if (__pyx_t_6) {
+ if (__pyx_v_copy) {
- /* "mtrand.pyx":4267
+ /* "mtrand.pyx":4276
* copy = hasattr(x[0], 'copy')
* if copy:
* while(i > 0): # <<<<<<<<<<<<<<
@@ -18655,7 +18044,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self,
__pyx_t_5 = (__pyx_v_i > 0);
if (!__pyx_t_5) break;
- /* "mtrand.pyx":4268
+ /* "mtrand.pyx":4277
* if copy:
* while(i > 0):
* j = rk_interval(i, self.internal_state) # <<<<<<<<<<<<<<
@@ -18664,35 +18053,35 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self,
*/
__pyx_v_j = rk_interval(__pyx_v_i, ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);
- /* "mtrand.pyx":4269
+ /* "mtrand.pyx":4278
* while(i > 0):
* j = rk_interval(i, self.internal_state)
* x[i], x[j] = x[j].copy(), x[i].copy() # <<<<<<<<<<<<<<
* i = i - 1
* else:
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_x, __pyx_v_j, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_x, __pyx_v_j, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__copy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__copy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_x, __pyx_v_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_x, __pyx_v_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (__Pyx_SetItemInt(__pyx_v_x, __pyx_v_i, __pyx_t_3, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetItemInt(__pyx_v_x, __pyx_v_i, __pyx_t_3, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (__Pyx_SetItemInt(__pyx_v_x, __pyx_v_j, __pyx_t_4, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetItemInt(__pyx_v_x, __pyx_v_j, __pyx_t_4, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "mtrand.pyx":4270
+ /* "mtrand.pyx":4279
* j = rk_interval(i, self.internal_state)
* x[i], x[j] = x[j].copy(), x[i].copy()
* i = i - 1 # <<<<<<<<<<<<<<
@@ -18705,7 +18094,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self,
}
/*else*/ {
- /* "mtrand.pyx":4272
+ /* "mtrand.pyx":4281
* i = i - 1
* else:
* while(i > 0): # <<<<<<<<<<<<<<
@@ -18716,7 +18105,7 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self,
__pyx_t_5 = (__pyx_v_i > 0);
if (!__pyx_t_5) break;
- /* "mtrand.pyx":4273
+ /* "mtrand.pyx":4282
* else:
* while(i > 0):
* j = rk_interval(i, self.internal_state) # <<<<<<<<<<<<<<
@@ -18725,29 +18114,29 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self,
*/
__pyx_v_j = rk_interval(__pyx_v_i, ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);
- /* "mtrand.pyx":4274
+ /* "mtrand.pyx":4283
* while(i > 0):
* j = rk_interval(i, self.internal_state)
* x[i], x[j] = x[j][:], x[i][:] # <<<<<<<<<<<<<<
* i = i - 1
*
*/
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_x, __pyx_v_j, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_x, __pyx_v_j, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PySequence_GetSlice(__pyx_t_4, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PySequence_GetSlice(__pyx_t_4, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_x, __pyx_v_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_x, __pyx_v_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = PySequence_GetSlice(__pyx_t_4, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_t_4, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (__Pyx_SetItemInt(__pyx_v_x, __pyx_v_i, __pyx_t_3, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetItemInt(__pyx_v_x, __pyx_v_i, __pyx_t_3, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (__Pyx_SetItemInt(__pyx_v_x, __pyx_v_j, __pyx_t_2, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetItemInt(__pyx_v_x, __pyx_v_j, __pyx_t_2, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4275
+ /* "mtrand.pyx":4284
* j = rk_interval(i, self.internal_state)
* x[i], x[j] = x[j][:], x[i][:]
* i = i - 1 # <<<<<<<<<<<<<<
@@ -18770,14 +18159,12 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self,
__Pyx_AddTraceback("mtrand.RandomState.shuffle");
__pyx_r = NULL;
__pyx_L0:;
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_x);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "mtrand.pyx":4277
+/* "mtrand.pyx":4286
* i = i - 1
*
* def permutation(self, object x): # <<<<<<<<<<<<<<
@@ -18785,9 +18172,9 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self,
* permutation(x)
*/
-static PyObject *__pyx_pf_6mtrand_11RandomState_permutation(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
-static char __pyx_doc_6mtrand_11RandomState_permutation[] = "\n permutation(x)\n\n Randomly permute a sequence, or return a permuted range.\n\n If `x` is a multi-dimensional array, it is only shuffled along its\n first index.\n\n Parameters\n ----------\n x : int or array_like\n If `x` is an integer, randomly permute ``np.arange(x)``.\n If `x` is an array, make a copy and shuffle the elements\n randomly.\n\n Returns\n -------\n out : ndarray\n Permuted sequence or array range.\n\n Examples\n --------\n >>> np.random.permutation(10)\n array([1, 7, 4, 3, 0, 9, 2, 5, 8, 6])\n\n >>> np.random.permutation([1, 4, 9, 12, 15])\n array([15, 1, 9, 4, 12])\n\n >>> arr = np.arange(9).reshape((3, 3))\n >>> np.random.permutation(arr)\n array([[6, 7, 8],\n [0, 1, 2],\n [3, 4, 5]])\n\n ";
-static PyObject *__pyx_pf_6mtrand_11RandomState_permutation(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
+static PyObject *__pyx_pf_6mtrand_11RandomState_51permutation(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
+static char __pyx_doc_6mtrand_11RandomState_51permutation[] = "\n permutation(x)\n\n Randomly permute a sequence, or return a permuted range.\n\n If `x` is a multi-dimensional array, it is only shuffled along its\n first index.\n\n Parameters\n ----------\n x : int or array_like\n If `x` is an integer, randomly permute ``np.arange(x)``.\n If `x` is an array, make a copy and shuffle the elements\n randomly.\n\n Returns\n -------\n out : ndarray\n Permuted sequence or array range.\n\n Examples\n --------\n >>> np.random.permutation(10)\n array([1, 7, 4, 3, 0, 9, 2, 5, 8, 6])\n\n >>> np.random.permutation([1, 4, 9, 12, 15])\n array([15, 1, 9, 4, 12])\n\n >>> arr = np.arange(9).reshape((3, 3))\n >>> np.random.permutation(arr)\n array([[6, 7, 8],\n [0, 1, 2],\n [3, 4, 5]])\n\n ";
+static PyObject *__pyx_pf_6mtrand_11RandomState_51permutation(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
PyObject *__pyx_v_arr;
PyObject *__pyx_r = NULL;
PyObject *__pyx_t_1 = NULL;
@@ -18795,58 +18182,56 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_permutation(PyObject *__pyx_v_se
int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
__Pyx_RefNannySetupContext("permutation");
- __Pyx_INCREF((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_v_x);
__pyx_v_arr = Py_None; __Pyx_INCREF(Py_None);
- /* "mtrand.pyx":4313
+ /* "mtrand.pyx":4322
*
* """
* if isinstance(x, (int, long, np.integer)): # <<<<<<<<<<<<<<
* arr = np.arange(x)
* else:
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__integer); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__integer); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4322; __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(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4313; __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)));
- __Pyx_INCREF(((PyObject *)((PyObject*)&PyLong_Type)));
- PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)((PyObject*)&PyLong_Type)));
- __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyLong_Type)));
+ __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__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))));
+ __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 = 4313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = PyObject_IsInstance(__pyx_v_x, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
if (__pyx_t_3) {
- /* "mtrand.pyx":4314
+ /* "mtrand.pyx":4323
* """
* if isinstance(x, (int, long, np.integer)):
* arr = np.arange(x) # <<<<<<<<<<<<<<
* else:
* arr = np.array(x)
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__arange); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__arange); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4323; __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(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_1));
__Pyx_INCREF(__pyx_v_x);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x);
__Pyx_GIVEREF(__pyx_v_x);
- __pyx_t_4 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4323; __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_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_v_arr);
__pyx_v_arr = __pyx_t_4;
__pyx_t_4 = 0;
@@ -18854,54 +18239,54 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_permutation(PyObject *__pyx_v_se
}
/*else*/ {
- /* "mtrand.pyx":4316
+ /* "mtrand.pyx":4325
* arr = np.arange(x)
* else:
* arr = np.array(x) # <<<<<<<<<<<<<<
* self.shuffle(arr)
* return arr
*/
- __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
__Pyx_INCREF(__pyx_v_x);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_x);
__Pyx_GIVEREF(__pyx_v_x);
- __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_v_arr);
__pyx_v_arr = __pyx_t_2;
__pyx_t_2 = 0;
}
__pyx_L5:;
- /* "mtrand.pyx":4317
+ /* "mtrand.pyx":4326
* else:
* arr = np.array(x)
* self.shuffle(arr) # <<<<<<<<<<<<<<
* return arr
*
*/
- __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shuffle); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shuffle); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
__Pyx_INCREF(__pyx_v_arr);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_arr);
__Pyx_GIVEREF(__pyx_v_arr);
- __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "mtrand.pyx":4318
+ /* "mtrand.pyx":4327
* arr = np.array(x)
* self.shuffle(arr)
* return arr # <<<<<<<<<<<<<<
@@ -18923,8 +18308,6 @@ static PyObject *__pyx_pf_6mtrand_11RandomState_permutation(PyObject *__pyx_v_se
__pyx_r = NULL;
__pyx_L0:;
__Pyx_DECREF(__pyx_v_arr);
- __Pyx_DECREF((PyObject *)__pyx_v_self);
- __Pyx_DECREF(__pyx_v_x);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
@@ -18941,7 +18324,7 @@ static void __pyx_tp_dealloc_6mtrand_RandomState(PyObject *o) {
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
++Py_REFCNT(o);
- __pyx_pf_6mtrand_11RandomState___dealloc__(o);
+ __pyx_pf_6mtrand_11RandomState_1__dealloc__(o);
if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
--Py_REFCNT(o);
PyErr_Restore(etype, eval, etb);
@@ -18949,57 +18332,57 @@ static void __pyx_tp_dealloc_6mtrand_RandomState(PyObject *o) {
(*Py_TYPE(o)->tp_free)(o);
}
-static struct PyMethodDef __pyx_methods_6mtrand_RandomState[] = {
- {__Pyx_NAMESTR("seed"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_seed, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_seed)},
- {__Pyx_NAMESTR("get_state"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_get_state, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_get_state)},
- {__Pyx_NAMESTR("set_state"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_set_state, METH_O, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_set_state)},
- {__Pyx_NAMESTR("__getstate__"), (PyCFunction)__pyx_pf_6mtrand_11RandomState___getstate__, METH_NOARGS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pf_6mtrand_11RandomState___setstate__, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pf_6mtrand_11RandomState___reduce__, METH_NOARGS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("random_sample"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_random_sample, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_random_sample)},
- {__Pyx_NAMESTR("tomaxint"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_tomaxint, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_tomaxint)},
- {__Pyx_NAMESTR("randint"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_randint, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_randint)},
- {__Pyx_NAMESTR("bytes"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_bytes, METH_O, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_bytes)},
- {__Pyx_NAMESTR("uniform"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_uniform, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_uniform)},
- {__Pyx_NAMESTR("rand"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_rand, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_rand)},
- {__Pyx_NAMESTR("randn"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_randn, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_randn)},
- {__Pyx_NAMESTR("random_integers"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_random_integers, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_random_integers)},
- {__Pyx_NAMESTR("standard_normal"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_standard_normal, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_standard_normal)},
- {__Pyx_NAMESTR("normal"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_normal, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_normal)},
- {__Pyx_NAMESTR("beta"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_beta, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_beta)},
- {__Pyx_NAMESTR("exponential"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_exponential, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_exponential)},
- {__Pyx_NAMESTR("standard_exponential"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_standard_exponential, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_standard_exponential)},
- {__Pyx_NAMESTR("standard_gamma"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_standard_gamma, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_standard_gamma)},
- {__Pyx_NAMESTR("gamma"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_gamma, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_gamma)},
- {__Pyx_NAMESTR("f"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_f, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_f)},
- {__Pyx_NAMESTR("noncentral_f"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_noncentral_f, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_noncentral_f)},
- {__Pyx_NAMESTR("chisquare"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_chisquare, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_chisquare)},
- {__Pyx_NAMESTR("noncentral_chisquare"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_noncentral_chisquare, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_noncentral_chisquare)},
- {__Pyx_NAMESTR("standard_cauchy"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_standard_cauchy, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_standard_cauchy)},
- {__Pyx_NAMESTR("standard_t"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_standard_t, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_standard_t)},
- {__Pyx_NAMESTR("vonmises"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_vonmises, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_vonmises)},
- {__Pyx_NAMESTR("pareto"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_pareto, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_pareto)},
- {__Pyx_NAMESTR("weibull"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_weibull, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_weibull)},
- {__Pyx_NAMESTR("power"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_power, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_power)},
- {__Pyx_NAMESTR("laplace"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_laplace, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_laplace)},
- {__Pyx_NAMESTR("gumbel"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_gumbel, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_gumbel)},
- {__Pyx_NAMESTR("logistic"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_logistic, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_logistic)},
- {__Pyx_NAMESTR("lognormal"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_lognormal, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_lognormal)},
- {__Pyx_NAMESTR("rayleigh"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_rayleigh, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_rayleigh)},
- {__Pyx_NAMESTR("wald"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_wald, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_wald)},
- {__Pyx_NAMESTR("triangular"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_triangular, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_triangular)},
- {__Pyx_NAMESTR("binomial"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_binomial, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_binomial)},
- {__Pyx_NAMESTR("negative_binomial"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_negative_binomial, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_negative_binomial)},
- {__Pyx_NAMESTR("poisson"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_poisson, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_poisson)},
- {__Pyx_NAMESTR("zipf"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_zipf, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_zipf)},
- {__Pyx_NAMESTR("geometric"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_geometric, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_geometric)},
- {__Pyx_NAMESTR("hypergeometric"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_hypergeometric, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_hypergeometric)},
- {__Pyx_NAMESTR("logseries"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_logseries, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_logseries)},
- {__Pyx_NAMESTR("multivariate_normal"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_multivariate_normal, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_multivariate_normal)},
- {__Pyx_NAMESTR("multinomial"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_multinomial, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_multinomial)},
- {__Pyx_NAMESTR("dirichlet"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_dirichlet, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_dirichlet)},
- {__Pyx_NAMESTR("shuffle"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_shuffle, METH_O, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_shuffle)},
- {__Pyx_NAMESTR("permutation"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_permutation, METH_O, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_permutation)},
+static PyMethodDef __pyx_methods_6mtrand_RandomState[] = {
+ {__Pyx_NAMESTR("seed"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_2seed, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_2seed)},
+ {__Pyx_NAMESTR("get_state"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_3get_state, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_3get_state)},
+ {__Pyx_NAMESTR("set_state"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_4set_state, METH_O, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_4set_state)},
+ {__Pyx_NAMESTR("__getstate__"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_5__getstate__, METH_NOARGS, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_6__setstate__, METH_O, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_7__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("random_sample"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_8random_sample, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_8random_sample)},
+ {__Pyx_NAMESTR("tomaxint"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_9tomaxint, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_9tomaxint)},
+ {__Pyx_NAMESTR("randint"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_10randint, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_10randint)},
+ {__Pyx_NAMESTR("bytes"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_11bytes, METH_O, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_11bytes)},
+ {__Pyx_NAMESTR("uniform"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_12uniform, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_12uniform)},
+ {__Pyx_NAMESTR("rand"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_13rand, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_13rand)},
+ {__Pyx_NAMESTR("randn"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_14randn, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_14randn)},
+ {__Pyx_NAMESTR("random_integers"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_15random_integers, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_15random_integers)},
+ {__Pyx_NAMESTR("standard_normal"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_16standard_normal, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_16standard_normal)},
+ {__Pyx_NAMESTR("normal"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_17normal, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_17normal)},
+ {__Pyx_NAMESTR("beta"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_18beta, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_18beta)},
+ {__Pyx_NAMESTR("exponential"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_19exponential, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_19exponential)},
+ {__Pyx_NAMESTR("standard_exponential"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_20standard_exponential, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_20standard_exponential)},
+ {__Pyx_NAMESTR("standard_gamma"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_21standard_gamma, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_21standard_gamma)},
+ {__Pyx_NAMESTR("gamma"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_22gamma, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_22gamma)},
+ {__Pyx_NAMESTR("f"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_23f, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_23f)},
+ {__Pyx_NAMESTR("noncentral_f"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_24noncentral_f, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_24noncentral_f)},
+ {__Pyx_NAMESTR("chisquare"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_25chisquare, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_25chisquare)},
+ {__Pyx_NAMESTR("noncentral_chisquare"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_26noncentral_chisquare, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_26noncentral_chisquare)},
+ {__Pyx_NAMESTR("standard_cauchy"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_27standard_cauchy, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_27standard_cauchy)},
+ {__Pyx_NAMESTR("standard_t"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_28standard_t, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_28standard_t)},
+ {__Pyx_NAMESTR("vonmises"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_29vonmises, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_29vonmises)},
+ {__Pyx_NAMESTR("pareto"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_30pareto, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_30pareto)},
+ {__Pyx_NAMESTR("weibull"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_31weibull, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_31weibull)},
+ {__Pyx_NAMESTR("power"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_32power, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_32power)},
+ {__Pyx_NAMESTR("laplace"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_33laplace, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_33laplace)},
+ {__Pyx_NAMESTR("gumbel"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_34gumbel, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_34gumbel)},
+ {__Pyx_NAMESTR("logistic"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_35logistic, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_35logistic)},
+ {__Pyx_NAMESTR("lognormal"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_36lognormal, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_36lognormal)},
+ {__Pyx_NAMESTR("rayleigh"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_37rayleigh, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_37rayleigh)},
+ {__Pyx_NAMESTR("wald"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_38wald, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_38wald)},
+ {__Pyx_NAMESTR("triangular"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_39triangular, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_39triangular)},
+ {__Pyx_NAMESTR("binomial"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_40binomial, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_40binomial)},
+ {__Pyx_NAMESTR("negative_binomial"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_41negative_binomial, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_41negative_binomial)},
+ {__Pyx_NAMESTR("poisson"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_42poisson, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_42poisson)},
+ {__Pyx_NAMESTR("zipf"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_43zipf, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_43zipf)},
+ {__Pyx_NAMESTR("geometric"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_44geometric, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_44geometric)},
+ {__Pyx_NAMESTR("hypergeometric"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_45hypergeometric, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_45hypergeometric)},
+ {__Pyx_NAMESTR("logseries"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_46logseries, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_46logseries)},
+ {__Pyx_NAMESTR("multivariate_normal"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_47multivariate_normal, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_47multivariate_normal)},
+ {__Pyx_NAMESTR("multinomial"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_48multinomial, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_48multinomial)},
+ {__Pyx_NAMESTR("dirichlet"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_49dirichlet, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_49dirichlet)},
+ {__Pyx_NAMESTR("shuffle"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_50shuffle, METH_O, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_50shuffle)},
+ {__Pyx_NAMESTR("permutation"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_51permutation, METH_O, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_51permutation)},
{0, 0, 0, 0}
};
@@ -19027,10 +18410,10 @@ static PyNumberMethods __pyx_tp_as_number_RandomState = {
0, /*nb_coerce*/
#endif
0, /*nb_int*/
- #if PY_MAJOR_VERSION >= 3
- 0, /*reserved*/
- #else
+ #if PY_MAJOR_VERSION < 3
0, /*nb_long*/
+ #else
+ 0, /*reserved*/
#endif
0, /*nb_float*/
#if PY_MAJOR_VERSION < 3
@@ -19056,7 +18439,7 @@ static PyNumberMethods __pyx_tp_as_number_RandomState = {
0, /*nb_true_divide*/
0, /*nb_inplace_floor_divide*/
0, /*nb_inplace_true_divide*/
- #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX)
+ #if PY_VERSION_HEX >= 0x02050000
0, /*nb_index*/
#endif
};
@@ -19101,7 +18484,7 @@ static PyBufferProcs __pyx_tp_as_buffer_RandomState = {
#endif
};
-PyTypeObject __pyx_type_6mtrand_RandomState = {
+static PyTypeObject __pyx_type_6mtrand_RandomState = {
PyVarObject_HEAD_INIT(0, 0)
__Pyx_NAMESTR("mtrand.RandomState"), /*tp_name*/
sizeof(struct __pyx_obj_6mtrand_RandomState), /*tp_basicsize*/
@@ -19110,7 +18493,11 @@ PyTypeObject __pyx_type_6mtrand_RandomState = {
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
+ #if PY_MAJOR_VERSION < 3
0, /*tp_compare*/
+ #else
+ 0, /*reserved*/
+ #endif
0, /*tp_repr*/
&__pyx_tp_as_number_RandomState, /*tp_as_number*/
&__pyx_tp_as_sequence_RandomState, /*tp_as_sequence*/
@@ -19121,7 +18508,7 @@ 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|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
__Pyx_DOCSTR("\n RandomState(seed=None)\n\n Container for the Mersenne Twister pseudo-random number generator.\n\n `RandomState` exposes a number of methods for generating random numbers\n drawn from a variety of probability distributions. In addition to the\n distribution-specific arguments, each method takes a keyword argument\n `size` that defaults to ``None``. If `size` is ``None``, then a single\n value is generated and returned. If `size` is an integer, then a 1-D\n array filled with generated values is returned. If `size` is a tuple,\n then an array with that shape is filled and returned.\n\n Parameters\n ----------\n seed : int or array_like, optional\n Random seed initializing the pseudo-random number generator.\n Can be an integer, an array (or other sequence) of integers of\n any length, or ``None`` (the default).\n If `seed` is ``None``, then `RandomState` will try to read data from\n ``/dev/urandom`` (or the Windows analogue) if available or seed from\n the clock otherwise.\n\n Notes\n -----\n The Python stdlib module \"random\" also contains a Mersenne Twister\n pseudo-random number generator with a number of methods that are similar\n to the ones available in `RandomState`. `RandomState`, besides being\n NumPy-aware, has the advantage that it provides a much larger number\n of probability distributions to choose from.\n\n "), /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
@@ -19153,12 +18540,10 @@ PyTypeObject __pyx_type_6mtrand_RandomState = {
#endif
};
-static struct PyMethodDef __pyx_methods[] = {
+static PyMethodDef __pyx_methods[] = {
{0, 0, 0, 0}
};
-static void __pyx_init_filenames(void); /*proto*/
-
#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
PyModuleDef_HEAD_INIT,
@@ -19175,98 +18560,136 @@ static struct PyModuleDef __pyx_moduledef = {
static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
- {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0},
- {&__pyx_kp_u_100, __pyx_k_100, sizeof(__pyx_k_100), 0, 1, 0, 0},
- {&__pyx_kp_u_101, __pyx_k_101, sizeof(__pyx_k_101), 0, 1, 0, 0},
- {&__pyx_kp_u_102, __pyx_k_102, sizeof(__pyx_k_102), 0, 1, 0, 0},
- {&__pyx_kp_u_103, __pyx_k_103, sizeof(__pyx_k_103), 0, 1, 0, 0},
- {&__pyx_kp_u_104, __pyx_k_104, sizeof(__pyx_k_104), 0, 1, 0, 0},
- {&__pyx_kp_u_105, __pyx_k_105, sizeof(__pyx_k_105), 0, 1, 0, 0},
- {&__pyx_kp_u_106, __pyx_k_106, sizeof(__pyx_k_106), 0, 1, 0, 0},
- {&__pyx_kp_u_107, __pyx_k_107, sizeof(__pyx_k_107), 0, 1, 0, 0},
+ {&__pyx_kp_s_101, __pyx_k_101, sizeof(__pyx_k_101), 0, 0, 1, 0},
+ {&__pyx_kp_s_103, __pyx_k_103, sizeof(__pyx_k_103), 0, 0, 1, 0},
+ {&__pyx_kp_s_105, __pyx_k_105, sizeof(__pyx_k_105), 0, 0, 1, 0},
{&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
+ {&__pyx_kp_s_110, __pyx_k_110, sizeof(__pyx_k_110), 0, 0, 1, 0},
+ {&__pyx_kp_s_112, __pyx_k_112, sizeof(__pyx_k_112), 0, 0, 1, 0},
+ {&__pyx_kp_s_114, __pyx_k_114, sizeof(__pyx_k_114), 0, 0, 1, 0},
+ {&__pyx_kp_s_126, __pyx_k_126, sizeof(__pyx_k_126), 0, 0, 1, 0},
+ {&__pyx_kp_s_128, __pyx_k_128, sizeof(__pyx_k_128), 0, 0, 1, 0},
{&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
- {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
- {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
- {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
- {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0},
+ {&__pyx_kp_s_131, __pyx_k_131, sizeof(__pyx_k_131), 0, 0, 1, 0},
+ {&__pyx_kp_s_133, __pyx_k_133, sizeof(__pyx_k_133), 0, 0, 1, 0},
+ {&__pyx_kp_s_136, __pyx_k_136, sizeof(__pyx_k_136), 0, 0, 1, 0},
+ {&__pyx_kp_s_138, __pyx_k_138, sizeof(__pyx_k_138), 0, 0, 1, 0},
+ {&__pyx_kp_s_142, __pyx_k_142, sizeof(__pyx_k_142), 0, 0, 1, 0},
+ {&__pyx_kp_s_144, __pyx_k_144, sizeof(__pyx_k_144), 0, 0, 1, 0},
+ {&__pyx_kp_s_146, __pyx_k_146, sizeof(__pyx_k_146), 0, 0, 1, 0},
+ {&__pyx_kp_s_148, __pyx_k_148, sizeof(__pyx_k_148), 0, 0, 1, 0},
+ {&__pyx_kp_s_154, __pyx_k_154, sizeof(__pyx_k_154), 0, 0, 1, 0},
+ {&__pyx_kp_s_156, __pyx_k_156, sizeof(__pyx_k_156), 0, 0, 1, 0},
+ {&__pyx_kp_s_160, __pyx_k_160, sizeof(__pyx_k_160), 0, 0, 1, 0},
+ {&__pyx_kp_s_162, __pyx_k_162, sizeof(__pyx_k_162), 0, 0, 1, 0},
+ {&__pyx_kp_s_164, __pyx_k_164, sizeof(__pyx_k_164), 0, 0, 1, 0},
+ {&__pyx_n_s_166, __pyx_k_166, sizeof(__pyx_k_166), 0, 0, 1, 1},
+ {&__pyx_kp_s_167, __pyx_k_167, sizeof(__pyx_k_167), 0, 0, 1, 0},
+ {&__pyx_n_s_171, __pyx_k_171, sizeof(__pyx_k_171), 0, 0, 1, 1},
+ {&__pyx_n_s_172, __pyx_k_172, sizeof(__pyx_k_172), 0, 0, 1, 1},
+ {&__pyx_kp_u_173, __pyx_k_173, sizeof(__pyx_k_173), 0, 1, 0, 0},
+ {&__pyx_kp_u_174, __pyx_k_174, sizeof(__pyx_k_174), 0, 1, 0, 0},
+ {&__pyx_kp_u_175, __pyx_k_175, sizeof(__pyx_k_175), 0, 1, 0, 0},
+ {&__pyx_kp_u_176, __pyx_k_176, sizeof(__pyx_k_176), 0, 1, 0, 0},
+ {&__pyx_kp_u_177, __pyx_k_177, sizeof(__pyx_k_177), 0, 1, 0, 0},
+ {&__pyx_kp_u_178, __pyx_k_178, sizeof(__pyx_k_178), 0, 1, 0, 0},
+ {&__pyx_kp_u_179, __pyx_k_179, sizeof(__pyx_k_179), 0, 1, 0, 0},
+ {&__pyx_kp_u_180, __pyx_k_180, sizeof(__pyx_k_180), 0, 1, 0, 0},
+ {&__pyx_kp_u_181, __pyx_k_181, sizeof(__pyx_k_181), 0, 1, 0, 0},
+ {&__pyx_kp_u_182, __pyx_k_182, sizeof(__pyx_k_182), 0, 1, 0, 0},
+ {&__pyx_kp_u_183, __pyx_k_183, sizeof(__pyx_k_183), 0, 1, 0, 0},
+ {&__pyx_kp_u_184, __pyx_k_184, sizeof(__pyx_k_184), 0, 1, 0, 0},
+ {&__pyx_kp_u_185, __pyx_k_185, sizeof(__pyx_k_185), 0, 1, 0, 0},
+ {&__pyx_kp_u_186, __pyx_k_186, sizeof(__pyx_k_186), 0, 1, 0, 0},
+ {&__pyx_kp_u_187, __pyx_k_187, sizeof(__pyx_k_187), 0, 1, 0, 0},
+ {&__pyx_kp_u_188, __pyx_k_188, sizeof(__pyx_k_188), 0, 1, 0, 0},
+ {&__pyx_kp_u_189, __pyx_k_189, sizeof(__pyx_k_189), 0, 1, 0, 0},
{&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0},
- {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
- {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0},
- {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0},
+ {&__pyx_kp_u_190, __pyx_k_190, sizeof(__pyx_k_190), 0, 1, 0, 0},
+ {&__pyx_kp_u_191, __pyx_k_191, sizeof(__pyx_k_191), 0, 1, 0, 0},
+ {&__pyx_kp_u_192, __pyx_k_192, sizeof(__pyx_k_192), 0, 1, 0, 0},
+ {&__pyx_kp_u_193, __pyx_k_193, sizeof(__pyx_k_193), 0, 1, 0, 0},
+ {&__pyx_kp_u_194, __pyx_k_194, sizeof(__pyx_k_194), 0, 1, 0, 0},
+ {&__pyx_kp_u_195, __pyx_k_195, sizeof(__pyx_k_195), 0, 1, 0, 0},
+ {&__pyx_kp_u_196, __pyx_k_196, sizeof(__pyx_k_196), 0, 1, 0, 0},
+ {&__pyx_kp_u_197, __pyx_k_197, sizeof(__pyx_k_197), 0, 1, 0, 0},
+ {&__pyx_kp_u_198, __pyx_k_198, sizeof(__pyx_k_198), 0, 1, 0, 0},
+ {&__pyx_kp_u_199, __pyx_k_199, sizeof(__pyx_k_199), 0, 1, 0, 0},
+ {&__pyx_kp_u_200, __pyx_k_200, sizeof(__pyx_k_200), 0, 1, 0, 0},
+ {&__pyx_kp_u_201, __pyx_k_201, sizeof(__pyx_k_201), 0, 1, 0, 0},
+ {&__pyx_kp_u_202, __pyx_k_202, sizeof(__pyx_k_202), 0, 1, 0, 0},
+ {&__pyx_kp_u_203, __pyx_k_203, sizeof(__pyx_k_203), 0, 1, 0, 0},
+ {&__pyx_kp_u_204, __pyx_k_204, sizeof(__pyx_k_204), 0, 1, 0, 0},
+ {&__pyx_kp_u_205, __pyx_k_205, sizeof(__pyx_k_205), 0, 1, 0, 0},
+ {&__pyx_kp_u_206, __pyx_k_206, sizeof(__pyx_k_206), 0, 1, 0, 0},
+ {&__pyx_kp_u_207, __pyx_k_207, sizeof(__pyx_k_207), 0, 1, 0, 0},
+ {&__pyx_kp_u_208, __pyx_k_208, sizeof(__pyx_k_208), 0, 1, 0, 0},
+ {&__pyx_kp_u_209, __pyx_k_209, sizeof(__pyx_k_209), 0, 1, 0, 0},
+ {&__pyx_kp_u_210, __pyx_k_210, sizeof(__pyx_k_210), 0, 1, 0, 0},
+ {&__pyx_kp_u_211, __pyx_k_211, sizeof(__pyx_k_211), 0, 1, 0, 0},
+ {&__pyx_kp_u_212, __pyx_k_212, sizeof(__pyx_k_212), 0, 1, 0, 0},
+ {&__pyx_kp_u_213, __pyx_k_213, sizeof(__pyx_k_213), 0, 1, 0, 0},
+ {&__pyx_kp_u_214, __pyx_k_214, sizeof(__pyx_k_214), 0, 1, 0, 0},
+ {&__pyx_kp_u_215, __pyx_k_215, sizeof(__pyx_k_215), 0, 1, 0, 0},
+ {&__pyx_kp_u_216, __pyx_k_216, sizeof(__pyx_k_216), 0, 1, 0, 0},
+ {&__pyx_kp_u_217, __pyx_k_217, sizeof(__pyx_k_217), 0, 1, 0, 0},
+ {&__pyx_kp_u_218, __pyx_k_218, sizeof(__pyx_k_218), 0, 1, 0, 0},
+ {&__pyx_kp_u_219, __pyx_k_219, sizeof(__pyx_k_219), 0, 1, 0, 0},
{&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
- {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
+ {&__pyx_kp_u_220, __pyx_k_220, sizeof(__pyx_k_220), 0, 1, 0, 0},
+ {&__pyx_kp_u_221, __pyx_k_221, sizeof(__pyx_k_221), 0, 1, 0, 0},
+ {&__pyx_kp_u_222, __pyx_k_222, sizeof(__pyx_k_222), 0, 1, 0, 0},
+ {&__pyx_kp_u_223, __pyx_k_223, sizeof(__pyx_k_223), 0, 1, 0, 0},
+ {&__pyx_kp_u_224, __pyx_k_224, sizeof(__pyx_k_224), 0, 1, 0, 0},
+ {&__pyx_kp_u_225, __pyx_k_225, sizeof(__pyx_k_225), 0, 1, 0, 0},
+ {&__pyx_kp_u_226, __pyx_k_226, sizeof(__pyx_k_226), 0, 1, 0, 0},
+ {&__pyx_kp_u_227, __pyx_k_227, sizeof(__pyx_k_227), 0, 1, 0, 0},
+ {&__pyx_kp_u_228, __pyx_k_228, sizeof(__pyx_k_228), 0, 1, 0, 0},
+ {&__pyx_kp_u_229, __pyx_k_229, sizeof(__pyx_k_229), 0, 1, 0, 0},
+ {&__pyx_kp_u_230, __pyx_k_230, sizeof(__pyx_k_230), 0, 1, 0, 0},
+ {&__pyx_kp_u_231, __pyx_k_231, sizeof(__pyx_k_231), 0, 1, 0, 0},
+ {&__pyx_kp_u_232, __pyx_k_232, sizeof(__pyx_k_232), 0, 1, 0, 0},
+ {&__pyx_kp_u_233, __pyx_k_233, sizeof(__pyx_k_233), 0, 1, 0, 0},
+ {&__pyx_kp_u_234, __pyx_k_234, sizeof(__pyx_k_234), 0, 1, 0, 0},
+ {&__pyx_kp_u_235, __pyx_k_235, sizeof(__pyx_k_235), 0, 1, 0, 0},
+ {&__pyx_kp_u_236, __pyx_k_236, sizeof(__pyx_k_236), 0, 1, 0, 0},
+ {&__pyx_kp_u_237, __pyx_k_237, sizeof(__pyx_k_237), 0, 1, 0, 0},
+ {&__pyx_kp_u_238, __pyx_k_238, sizeof(__pyx_k_238), 0, 1, 0, 0},
+ {&__pyx_kp_u_239, __pyx_k_239, sizeof(__pyx_k_239), 0, 1, 0, 0},
+ {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0},
+ {&__pyx_kp_u_240, __pyx_k_240, sizeof(__pyx_k_240), 0, 1, 0, 0},
+ {&__pyx_kp_u_241, __pyx_k_241, sizeof(__pyx_k_241), 0, 1, 0, 0},
+ {&__pyx_kp_u_242, __pyx_k_242, sizeof(__pyx_k_242), 0, 1, 0, 0},
+ {&__pyx_kp_u_243, __pyx_k_243, sizeof(__pyx_k_243), 0, 1, 0, 0},
+ {&__pyx_kp_u_244, __pyx_k_244, sizeof(__pyx_k_244), 0, 1, 0, 0},
+ {&__pyx_kp_u_245, __pyx_k_245, sizeof(__pyx_k_245), 0, 1, 0, 0},
+ {&__pyx_kp_u_246, __pyx_k_246, sizeof(__pyx_k_246), 0, 1, 0, 0},
+ {&__pyx_kp_u_247, __pyx_k_247, sizeof(__pyx_k_247), 0, 1, 0, 0},
+ {&__pyx_kp_u_248, __pyx_k_248, sizeof(__pyx_k_248), 0, 1, 0, 0},
+ {&__pyx_kp_u_249, __pyx_k_249, sizeof(__pyx_k_249), 0, 1, 0, 0},
+ {&__pyx_kp_u_250, __pyx_k_250, sizeof(__pyx_k_250), 0, 1, 0, 0},
+ {&__pyx_kp_u_251, __pyx_k_251, sizeof(__pyx_k_251), 0, 1, 0, 0},
+ {&__pyx_kp_u_252, __pyx_k_252, sizeof(__pyx_k_252), 0, 1, 0, 0},
+ {&__pyx_kp_u_253, __pyx_k_253, sizeof(__pyx_k_253), 0, 1, 0, 0},
+ {&__pyx_kp_u_254, __pyx_k_254, sizeof(__pyx_k_254), 0, 1, 0, 0},
+ {&__pyx_kp_u_255, __pyx_k_255, sizeof(__pyx_k_255), 0, 1, 0, 0},
+ {&__pyx_kp_u_256, __pyx_k_256, sizeof(__pyx_k_256), 0, 1, 0, 0},
{&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
- {&__pyx_kp_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 0},
- {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0},
- {&__pyx_kp_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 0},
- {&__pyx_kp_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 0},
- {&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0},
- {&__pyx_kp_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 0},
- {&__pyx_kp_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 0},
- {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
- {&__pyx_kp_s_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 1, 0},
{&__pyx_kp_s_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 0, 1, 0},
- {&__pyx_kp_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 0},
- {&__pyx_kp_s_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 1, 0},
+ {&__pyx_kp_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 0},
{&__pyx_kp_s_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 1, 0},
- {&__pyx_kp_s_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 0, 1, 0},
- {&__pyx_kp_s_47, __pyx_k_47, sizeof(__pyx_k_47), 0, 0, 1, 0},
{&__pyx_kp_s_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 1, 0},
- {&__pyx_kp_s_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 0, 1, 0},
- {&__pyx_kp_s_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 1, 0},
- {&__pyx_kp_s_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 0, 1, 0},
- {&__pyx_kp_s_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 1, 0},
{&__pyx_kp_s_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 1, 0},
- {&__pyx_kp_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 0},
- {&__pyx_kp_s_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 1, 0},
- {&__pyx_kp_s_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 1, 0},
- {&__pyx_n_s_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 0, 1, 1},
- {&__pyx_kp_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 0},
- {&__pyx_n_s_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 0, 1, 1},
- {&__pyx_n_s_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 0, 1, 1},
- {&__pyx_kp_u_61, __pyx_k_61, sizeof(__pyx_k_61), 0, 1, 0, 0},
- {&__pyx_kp_u_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 1, 0, 0},
- {&__pyx_kp_u_63, __pyx_k_63, sizeof(__pyx_k_63), 0, 1, 0, 0},
- {&__pyx_kp_u_64, __pyx_k_64, sizeof(__pyx_k_64), 0, 1, 0, 0},
- {&__pyx_kp_u_65, __pyx_k_65, sizeof(__pyx_k_65), 0, 1, 0, 0},
- {&__pyx_kp_u_66, __pyx_k_66, sizeof(__pyx_k_66), 0, 1, 0, 0},
- {&__pyx_kp_u_67, __pyx_k_67, sizeof(__pyx_k_67), 0, 1, 0, 0},
- {&__pyx_kp_u_68, __pyx_k_68, sizeof(__pyx_k_68), 0, 1, 0, 0},
- {&__pyx_kp_u_69, __pyx_k_69, sizeof(__pyx_k_69), 0, 1, 0, 0},
- {&__pyx_kp_u_70, __pyx_k_70, sizeof(__pyx_k_70), 0, 1, 0, 0},
- {&__pyx_kp_u_71, __pyx_k_71, sizeof(__pyx_k_71), 0, 1, 0, 0},
- {&__pyx_kp_u_72, __pyx_k_72, sizeof(__pyx_k_72), 0, 1, 0, 0},
- {&__pyx_kp_u_73, __pyx_k_73, sizeof(__pyx_k_73), 0, 1, 0, 0},
- {&__pyx_kp_u_74, __pyx_k_74, sizeof(__pyx_k_74), 0, 1, 0, 0},
- {&__pyx_kp_u_75, __pyx_k_75, sizeof(__pyx_k_75), 0, 1, 0, 0},
- {&__pyx_kp_u_76, __pyx_k_76, sizeof(__pyx_k_76), 0, 1, 0, 0},
- {&__pyx_kp_u_77, __pyx_k_77, sizeof(__pyx_k_77), 0, 1, 0, 0},
- {&__pyx_kp_u_78, __pyx_k_78, sizeof(__pyx_k_78), 0, 1, 0, 0},
- {&__pyx_kp_u_79, __pyx_k_79, sizeof(__pyx_k_79), 0, 1, 0, 0},
- {&__pyx_kp_u_80, __pyx_k_80, sizeof(__pyx_k_80), 0, 1, 0, 0},
- {&__pyx_kp_u_81, __pyx_k_81, sizeof(__pyx_k_81), 0, 1, 0, 0},
- {&__pyx_kp_u_82, __pyx_k_82, sizeof(__pyx_k_82), 0, 1, 0, 0},
- {&__pyx_kp_u_83, __pyx_k_83, sizeof(__pyx_k_83), 0, 1, 0, 0},
- {&__pyx_kp_u_84, __pyx_k_84, sizeof(__pyx_k_84), 0, 1, 0, 0},
- {&__pyx_kp_u_85, __pyx_k_85, sizeof(__pyx_k_85), 0, 1, 0, 0},
- {&__pyx_kp_u_86, __pyx_k_86, sizeof(__pyx_k_86), 0, 1, 0, 0},
- {&__pyx_kp_u_87, __pyx_k_87, sizeof(__pyx_k_87), 0, 1, 0, 0},
- {&__pyx_kp_u_88, __pyx_k_88, sizeof(__pyx_k_88), 0, 1, 0, 0},
- {&__pyx_kp_u_89, __pyx_k_89, sizeof(__pyx_k_89), 0, 1, 0, 0},
+ {&__pyx_kp_s_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 0, 1, 0},
+ {&__pyx_kp_s_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 0, 1, 0},
+ {&__pyx_kp_s_64, __pyx_k_64, sizeof(__pyx_k_64), 0, 0, 1, 0},
+ {&__pyx_kp_s_87, __pyx_k_87, sizeof(__pyx_k_87), 0, 0, 1, 0},
+ {&__pyx_kp_s_89, __pyx_k_89, sizeof(__pyx_k_89), 0, 0, 1, 0},
{&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
- {&__pyx_kp_u_90, __pyx_k_90, sizeof(__pyx_k_90), 0, 1, 0, 0},
- {&__pyx_kp_u_91, __pyx_k_91, sizeof(__pyx_k_91), 0, 1, 0, 0},
- {&__pyx_kp_u_92, __pyx_k_92, sizeof(__pyx_k_92), 0, 1, 0, 0},
- {&__pyx_kp_u_93, __pyx_k_93, sizeof(__pyx_k_93), 0, 1, 0, 0},
- {&__pyx_kp_u_94, __pyx_k_94, sizeof(__pyx_k_94), 0, 1, 0, 0},
- {&__pyx_kp_u_95, __pyx_k_95, sizeof(__pyx_k_95), 0, 1, 0, 0},
- {&__pyx_kp_u_96, __pyx_k_96, sizeof(__pyx_k_96), 0, 1, 0, 0},
- {&__pyx_kp_u_97, __pyx_k_97, sizeof(__pyx_k_97), 0, 1, 0, 0},
- {&__pyx_kp_u_98, __pyx_k_98, sizeof(__pyx_k_98), 0, 1, 0, 0},
- {&__pyx_kp_u_99, __pyx_k_99, sizeof(__pyx_k_99), 0, 1, 0, 0},
+ {&__pyx_kp_s_93, __pyx_k_93, sizeof(__pyx_k_93), 0, 0, 1, 0},
+ {&__pyx_kp_s_95, __pyx_k_95, sizeof(__pyx_k_95), 0, 0, 1, 0},
+ {&__pyx_kp_s_98, __pyx_k_98, sizeof(__pyx_k_98), 0, 0, 1, 0},
{&__pyx_n_s__MT19937, __pyx_k__MT19937, sizeof(__pyx_k__MT19937), 0, 0, 1, 1},
- {&__pyx_n_s__RandomState, __pyx_k__RandomState, sizeof(__pyx_k__RandomState), 0, 0, 1, 1},
{&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1},
{&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
{&__pyx_n_s____RandomState_ctor, __pyx_k____RandomState_ctor, sizeof(__pyx_k____RandomState_ctor), 0, 0, 1, 1},
@@ -19277,6 +18700,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s__add, __pyx_k__add, sizeof(__pyx_k__add), 0, 0, 1, 1},
{&__pyx_n_s__alpha, __pyx_k__alpha, sizeof(__pyx_k__alpha), 0, 0, 1, 1},
{&__pyx_n_s__any, __pyx_k__any, sizeof(__pyx_k__any), 0, 0, 1, 1},
+ {&__pyx_n_s__append, __pyx_k__append, sizeof(__pyx_k__append), 0, 0, 1, 1},
{&__pyx_n_s__arange, __pyx_k__arange, sizeof(__pyx_k__arange), 0, 0, 1, 1},
{&__pyx_n_s__array, __pyx_k__array, sizeof(__pyx_k__array), 0, 0, 1, 1},
{&__pyx_n_s__asarray, __pyx_k__asarray, sizeof(__pyx_k__asarray), 0, 0, 1, 1},
@@ -19310,10 +18734,12 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s__has_gauss, __pyx_k__has_gauss, sizeof(__pyx_k__has_gauss), 0, 0, 1, 1},
{&__pyx_n_s__high, __pyx_k__high, sizeof(__pyx_k__high), 0, 0, 1, 1},
{&__pyx_n_s__hypergeometric, __pyx_k__hypergeometric, sizeof(__pyx_k__hypergeometric), 0, 0, 1, 1},
+ {&__pyx_n_s__iinfo, __pyx_k__iinfo, sizeof(__pyx_k__iinfo), 0, 0, 1, 1},
{&__pyx_n_s__integer, __pyx_k__integer, sizeof(__pyx_k__integer), 0, 0, 1, 1},
{&__pyx_n_s__internal_state, __pyx_k__internal_state, sizeof(__pyx_k__internal_state), 0, 0, 1, 1},
{&__pyx_n_s__kappa, __pyx_k__kappa, sizeof(__pyx_k__kappa), 0, 0, 1, 1},
{&__pyx_n_s__key, __pyx_k__key, sizeof(__pyx_k__key), 0, 0, 1, 1},
+ {&__pyx_n_s__l, __pyx_k__l, sizeof(__pyx_k__l), 0, 0, 1, 1},
{&__pyx_n_s__lam, __pyx_k__lam, sizeof(__pyx_k__lam), 0, 0, 1, 1},
{&__pyx_n_s__laplace, __pyx_k__laplace, sizeof(__pyx_k__laplace), 0, 0, 1, 1},
{&__pyx_n_s__left, __pyx_k__left, sizeof(__pyx_k__left), 0, 0, 1, 1},
@@ -19324,6 +18750,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s__lognormal, __pyx_k__lognormal, sizeof(__pyx_k__lognormal), 0, 0, 1, 1},
{&__pyx_n_s__logseries, __pyx_k__logseries, sizeof(__pyx_k__logseries), 0, 0, 1, 1},
{&__pyx_n_s__low, __pyx_k__low, sizeof(__pyx_k__low), 0, 0, 1, 1},
+ {&__pyx_n_s__max, __pyx_k__max, sizeof(__pyx_k__max), 0, 0, 1, 1},
{&__pyx_n_s__mean, __pyx_k__mean, sizeof(__pyx_k__mean), 0, 0, 1, 1},
{&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1},
{&__pyx_n_s__mu, __pyx_k__mu, sizeof(__pyx_k__mu), 0, 0, 1, 1},
@@ -19345,6 +18772,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s__pareto, __pyx_k__pareto, sizeof(__pyx_k__pareto), 0, 0, 1, 1},
{&__pyx_n_s__permutation, __pyx_k__permutation, sizeof(__pyx_k__permutation), 0, 0, 1, 1},
{&__pyx_n_s__poisson, __pyx_k__poisson, sizeof(__pyx_k__poisson), 0, 0, 1, 1},
+ {&__pyx_n_s__poisson_lam_max, __pyx_k__poisson_lam_max, sizeof(__pyx_k__poisson_lam_max), 0, 0, 1, 1},
{&__pyx_n_s__pos, __pyx_k__pos, sizeof(__pyx_k__pos), 0, 0, 1, 1},
{&__pyx_n_s__power, __pyx_k__power, sizeof(__pyx_k__power), 0, 0, 1, 1},
{&__pyx_n_s__pvals, __pyx_k__pvals, sizeof(__pyx_k__pvals), 0, 0, 1, 1},
@@ -19371,7 +18799,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s__standard_t, __pyx_k__standard_t, sizeof(__pyx_k__standard_t), 0, 0, 1, 1},
{&__pyx_n_s__subtract, __pyx_k__subtract, sizeof(__pyx_k__subtract), 0, 0, 1, 1},
{&__pyx_n_s__svd, __pyx_k__svd, sizeof(__pyx_k__svd), 0, 0, 1, 1},
- {&__pyx_n_s__tomaxint, __pyx_k__tomaxint, sizeof(__pyx_k__tomaxint), 0, 0, 1, 1},
{&__pyx_n_s__triangular, __pyx_k__triangular, sizeof(__pyx_k__triangular), 0, 0, 1, 1},
{&__pyx_n_s__uint, __pyx_k__uint, sizeof(__pyx_k__uint), 0, 0, 1, 1},
{&__pyx_n_s__uint32, __pyx_k__uint32, sizeof(__pyx_k__uint32), 0, 0, 1, 1},
@@ -19385,9 +18812,1550 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
};
static int __Pyx_InitCachedBuiltins(void) {
__pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ return 0;
+ __pyx_L1_error:;
+ return -1;
+}
+
+static int __Pyx_InitCachedConstants(void) {
+ __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");
+
+ /* "mtrand.pyx":184
+ * <void *>oa)
+ * if (multi.size != PyArray_SIZE(array)):
+ * raise ValueError("size is not compatible with inputs") # <<<<<<<<<<<<<<
+ * for i from 0 <= i < multi.size:
+ * oa_data = <double *>PyArray_MultiIter_DATA(multi, 1)
+ */
+ __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
+ PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_s_1));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
+
+ /* "mtrand.pyx":233
+ * multi = <broadcast>PyArray_MultiIterNew(3, <void*>array, <void *>oa, <void *>ob)
+ * if (multi.size != PyArray_SIZE(array)):
+ * raise ValueError("size is not compatible with inputs") # <<<<<<<<<<<<<<
+ * for i from 0 <= i < multi.size:
+ * oa_data = <double *>PyArray_MultiIter_DATA(multi, 1)
+ */
+ __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_3));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
+ PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_kp_s_1));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3));
+
+ /* "mtrand.pyx":288
+ * <void *>ob, <void *>oc)
+ * if (multi.size != PyArray_SIZE(array)):
+ * raise ValueError("size is not compatible with inputs") # <<<<<<<<<<<<<<
+ * for i from 0 <= i < multi.size:
+ * oa_data = <double *>PyArray_MultiIter_DATA(multi, 1)
+ */
+ __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
+ PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_s_1));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));
+
+ /* "mtrand.pyx":352
+ * multi = <broadcast>PyArray_MultiIterNew(3, <void*>array, <void *>on, <void *>op)
+ * if (multi.size != PyArray_SIZE(array)):
+ * raise ValueError("size is not compatible with inputs") # <<<<<<<<<<<<<<
+ * for i from 0 <= i < multi.size:
+ * on_data = <long *>PyArray_MultiIter_DATA(multi, 1)
+ */
+ __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_5));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
+ PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_s_1));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));
+
+ /* "mtrand.pyx":401
+ * multi = <broadcast>PyArray_MultiIterNew(3, <void*>array, <void *>on, <void *>op)
+ * if (multi.size != PyArray_SIZE(array)):
+ * raise ValueError("size is not compatible with inputs") # <<<<<<<<<<<<<<
+ * for i from 0 <= i < multi.size:
+ * on_data = <double *>PyArray_MultiIter_DATA(multi, 1)
+ */
+ __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
+ PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_s_1));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));
+
+ /* "mtrand.pyx":455
+ * <void *>oN)
+ * if (multi.size != PyArray_SIZE(array)):
+ * raise ValueError("size is not compatible with inputs") # <<<<<<<<<<<<<<
+ * for i from 0 <= i < multi.size:
+ * on_data = <long *>PyArray_MultiIter_DATA(multi, 1)
+ */
+ __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_7));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
+ PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_s_1));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7));
+
+ /* "mtrand.pyx":503
+ * multi = <broadcast>PyArray_MultiIterNew(2, <void *>array, <void *>oa)
+ * if (multi.size != PyArray_SIZE(array)):
+ * raise ValueError("size is not compatible with inputs") # <<<<<<<<<<<<<<
+ * for i from 0 <= i < multi.size:
+ * oa_data = <double *>PyArray_MultiIter_DATA(multi, 1)
+ */
+ __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
+ PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_s_1));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8));
+
+ /* "mtrand.pyx":689
+ * algorithm_name = state[0]
+ * if algorithm_name != 'MT19937':
+ * raise ValueError("algorithm must be 'MT19937'") # <<<<<<<<<<<<<<
+ * key, pos = state[1:3]
+ * if len(state) == 3:
+ */
+ __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
+ PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_s_9));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
+
+ /* "mtrand.pyx":702
+ * obj = <ndarray>PyArray_ContiguousFromObject(key, NPY_LONG, 1, 1)
+ * if obj.dimensions[0] != 624:
+ * raise ValueError("state must be 624 longs") # <<<<<<<<<<<<<<
+ * memcpy(<void*>(self.internal_state.key), <void*>(obj.data), 624*sizeof(long))
+ * self.internal_state.pos = pos
+ */
+ __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
+ PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_s_11));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));
+
+ /* "mtrand.pyx":874
+ *
+ * if lo >= hi :
+ * raise ValueError("low >= high") # <<<<<<<<<<<<<<
+ *
+ * diff = <unsigned long>hi - <unsigned long>lo - 1UL
+ */
+ __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_14));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_13));
+ PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_s_13));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));
+
+ /* "mtrand.pyx":1301
+ * if not PyErr_Occurred():
+ * if fscale <= 0:
+ * raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
+ * return cont2_array_sc(self.internal_state, rk_normal, size, floc, fscale)
+ *
+ */
+ __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_20));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
+ PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20));
+
+ /* "mtrand.pyx":1309
+ * oscale = <ndarray>PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
+ * if np.any(np.less_equal(oscale, 0)):
+ * raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
+ * return cont2_array(self.internal_state, rk_normal, size, oloc, oscale)
+ *
+ */
+ __pyx_k_tuple_21 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_21));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
+ PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21));
+
+ /* "mtrand.pyx":1356
+ * if not PyErr_Occurred():
+ * if fa <= 0:
+ * raise ValueError("a <= 0") # <<<<<<<<<<<<<<
+ * if fb <= 0:
+ * raise ValueError("b <= 0")
+ */
+ __pyx_k_tuple_23 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_23));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_22));
+ PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_kp_s_22));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23));
+
+ /* "mtrand.pyx":1358
+ * raise ValueError("a <= 0")
+ * if fb <= 0:
+ * raise ValueError("b <= 0") # <<<<<<<<<<<<<<
+ * return cont2_array_sc(self.internal_state, rk_beta, size, fa, fb)
+ *
+ */
+ __pyx_k_tuple_25 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_25));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_24));
+ PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, ((PyObject *)__pyx_kp_s_24));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_24));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25));
+
+ /* "mtrand.pyx":1366
+ * ob = <ndarray>PyArray_FROM_OTF(b, NPY_DOUBLE, NPY_ALIGNED)
+ * if np.any(np.less_equal(oa, 0)):
+ * raise ValueError("a <= 0") # <<<<<<<<<<<<<<
+ * if np.any(np.less_equal(ob, 0)):
+ * raise ValueError("b <= 0")
+ */
+ __pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_26));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_22));
+ PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_kp_s_22));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26));
+
+ /* "mtrand.pyx":1368
+ * raise ValueError("a <= 0")
+ * if np.any(np.less_equal(ob, 0)):
+ * raise ValueError("b <= 0") # <<<<<<<<<<<<<<
+ * return cont2_array(self.internal_state, rk_beta, size, oa, ob)
+ *
+ */
+ __pyx_k_tuple_27 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_27));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_24));
+ PyTuple_SET_ITEM(__pyx_k_tuple_27, 0, ((PyObject *)__pyx_kp_s_24));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_24));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27));
+
+ /* "mtrand.pyx":1415
+ * if not PyErr_Occurred():
+ * if fscale <= 0:
+ * raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
+ * return cont1_array_sc(self.internal_state, rk_exponential, size, fscale)
+ *
+ */
+ __pyx_k_tuple_29 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_29));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
+ PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, ((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29));
+
+ /* "mtrand.pyx":1422
+ * oscale = <ndarray> PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
+ * if np.any(np.less_equal(oscale, 0.0)):
+ * raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
+ * return cont1_array(self.internal_state, rk_exponential, size, oscale)
+ *
+ */
+ __pyx_k_tuple_30 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_30));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
+ PyTuple_SET_ITEM(__pyx_k_tuple_30, 0, ((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30));
+
+ /* "mtrand.pyx":1526
+ * if not PyErr_Occurred():
+ * if fshape <= 0:
+ * raise ValueError("shape <= 0") # <<<<<<<<<<<<<<
+ * return cont1_array_sc(self.internal_state, rk_standard_gamma, size, fshape)
+ *
+ */
+ __pyx_k_tuple_32 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_32));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_31));
+ PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, ((PyObject *)__pyx_kp_s_31));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_31));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32));
+
+ /* "mtrand.pyx":1532
+ * oshape = <ndarray> PyArray_FROM_OTF(shape, NPY_DOUBLE, NPY_ALIGNED)
+ * if np.any(np.less_equal(oshape, 0.0)):
+ * raise ValueError("shape <= 0") # <<<<<<<<<<<<<<
+ * return cont1_array(self.internal_state, rk_standard_gamma, size, oshape)
+ *
+ */
+ __pyx_k_tuple_33 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_33));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_31));
+ PyTuple_SET_ITEM(__pyx_k_tuple_33, 0, ((PyObject *)__pyx_kp_s_31));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_31));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33));
+
+ /* "mtrand.pyx":1612
+ * if not PyErr_Occurred():
+ * if fshape <= 0:
+ * raise ValueError("shape <= 0") # <<<<<<<<<<<<<<
+ * if fscale <= 0:
+ * raise ValueError("scale <= 0")
+ */
+ __pyx_k_tuple_35 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_35));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_31));
+ PyTuple_SET_ITEM(__pyx_k_tuple_35, 0, ((PyObject *)__pyx_kp_s_31));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_31));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35));
+
+ /* "mtrand.pyx":1614
+ * raise ValueError("shape <= 0")
+ * if fscale <= 0:
+ * raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
+ * return cont2_array_sc(self.internal_state, rk_gamma, size, fshape, fscale)
+ *
+ */
+ __pyx_k_tuple_36 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_36));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
+ PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, ((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36));
+
+ /* "mtrand.pyx":1621
+ * oscale = <ndarray>PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
+ * if np.any(np.less_equal(oshape, 0.0)):
+ * raise ValueError("shape <= 0") # <<<<<<<<<<<<<<
+ * if np.any(np.less_equal(oscale, 0.0)):
+ * raise ValueError("scale <= 0")
+ */
+ __pyx_k_tuple_37 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_37));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_31));
+ PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, ((PyObject *)__pyx_kp_s_31));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_31));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37));
+
+ /* "mtrand.pyx":1623
+ * raise ValueError("shape <= 0")
+ * if np.any(np.less_equal(oscale, 0.0)):
+ * raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
+ * return cont2_array(self.internal_state, rk_gamma, size, oshape, oscale)
+ *
+ */
+ __pyx_k_tuple_38 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_38));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
+ PyTuple_SET_ITEM(__pyx_k_tuple_38, 0, ((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38));
+
+ /* "mtrand.pyx":1714
+ * if not PyErr_Occurred():
+ * if fdfnum <= 0:
+ * raise ValueError("shape <= 0") # <<<<<<<<<<<<<<
+ * if fdfden <= 0:
+ * raise ValueError("scale <= 0")
+ */
+ __pyx_k_tuple_39 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_39));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_31));
+ PyTuple_SET_ITEM(__pyx_k_tuple_39, 0, ((PyObject *)__pyx_kp_s_31));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_31));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39));
+
+ /* "mtrand.pyx":1716
+ * raise ValueError("shape <= 0")
+ * if fdfden <= 0:
+ * raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
+ * return cont2_array_sc(self.internal_state, rk_f, size, fdfnum, fdfden)
+ *
+ */
+ __pyx_k_tuple_40 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_40));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
+ PyTuple_SET_ITEM(__pyx_k_tuple_40, 0, ((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40));
+
+ /* "mtrand.pyx":1724
+ * odfden = <ndarray>PyArray_FROM_OTF(dfden, NPY_DOUBLE, NPY_ALIGNED)
+ * if np.any(np.less_equal(odfnum, 0.0)):
+ * raise ValueError("dfnum <= 0") # <<<<<<<<<<<<<<
+ * if np.any(np.less_equal(odfden, 0.0)):
+ * raise ValueError("dfden <= 0")
+ */
+ __pyx_k_tuple_42 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_42));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_41));
+ PyTuple_SET_ITEM(__pyx_k_tuple_42, 0, ((PyObject *)__pyx_kp_s_41));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_41));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42));
+
+ /* "mtrand.pyx":1726
+ * raise ValueError("dfnum <= 0")
+ * if np.any(np.less_equal(odfden, 0.0)):
+ * raise ValueError("dfden <= 0") # <<<<<<<<<<<<<<
+ * return cont2_array(self.internal_state, rk_f, size, odfnum, odfden)
+ *
+ */
+ __pyx_k_tuple_44 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_44));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_43));
+ PyTuple_SET_ITEM(__pyx_k_tuple_44, 0, ((PyObject *)__pyx_kp_s_43));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_43));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_44));
+
+ /* "mtrand.pyx":1801
+ * if not PyErr_Occurred():
+ * if fdfnum <= 1:
+ * raise ValueError("dfnum <= 1") # <<<<<<<<<<<<<<
+ * if fdfden <= 0:
+ * raise ValueError("dfden <= 0")
+ */
+ __pyx_k_tuple_46 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_46));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_45));
+ PyTuple_SET_ITEM(__pyx_k_tuple_46, 0, ((PyObject *)__pyx_kp_s_45));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_45));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_46));
+
+ /* "mtrand.pyx":1803
+ * raise ValueError("dfnum <= 1")
+ * if fdfden <= 0:
+ * raise ValueError("dfden <= 0") # <<<<<<<<<<<<<<
+ * if fnonc < 0:
+ * raise ValueError("nonc < 0")
+ */
+ __pyx_k_tuple_47 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_47));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_43));
+ PyTuple_SET_ITEM(__pyx_k_tuple_47, 0, ((PyObject *)__pyx_kp_s_43));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_43));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47));
+
+ /* "mtrand.pyx":1805
+ * raise ValueError("dfden <= 0")
+ * if fnonc < 0:
+ * raise ValueError("nonc < 0") # <<<<<<<<<<<<<<
+ * return cont3_array_sc(self.internal_state, rk_noncentral_f, size,
+ * fdfnum, fdfden, fnonc)
+ */
+ __pyx_k_tuple_49 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_49));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_48));
+ PyTuple_SET_ITEM(__pyx_k_tuple_49, 0, ((PyObject *)__pyx_kp_s_48));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_48));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49));
+
+ /* "mtrand.pyx":1816
+ *
+ * if np.any(np.less_equal(odfnum, 1.0)):
+ * raise ValueError("dfnum <= 1") # <<<<<<<<<<<<<<
+ * if np.any(np.less_equal(odfden, 0.0)):
+ * raise ValueError("dfden <= 0")
+ */
+ __pyx_k_tuple_50 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_50));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_45));
+ PyTuple_SET_ITEM(__pyx_k_tuple_50, 0, ((PyObject *)__pyx_kp_s_45));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_45));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_50));
+
+ /* "mtrand.pyx":1818
+ * raise ValueError("dfnum <= 1")
+ * if np.any(np.less_equal(odfden, 0.0)):
+ * raise ValueError("dfden <= 0") # <<<<<<<<<<<<<<
+ * if np.any(np.less(ononc, 0.0)):
+ * raise ValueError("nonc < 0")
+ */
+ __pyx_k_tuple_51 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_51));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_43));
+ PyTuple_SET_ITEM(__pyx_k_tuple_51, 0, ((PyObject *)__pyx_kp_s_43));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_43));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51));
+
+ /* "mtrand.pyx":1820
+ * raise ValueError("dfden <= 0")
+ * if np.any(np.less(ononc, 0.0)):
+ * raise ValueError("nonc < 0") # <<<<<<<<<<<<<<
+ * return cont3_array(self.internal_state, rk_noncentral_f, size, odfnum,
+ * odfden, ononc)
+ */
+ __pyx_k_tuple_52 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_52));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_48));
+ PyTuple_SET_ITEM(__pyx_k_tuple_52, 0, ((PyObject *)__pyx_kp_s_48));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_48));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52));
+
+ /* "mtrand.pyx":1892
+ * if not PyErr_Occurred():
+ * if fdf <= 0:
+ * raise ValueError("df <= 0") # <<<<<<<<<<<<<<
+ * return cont1_array_sc(self.internal_state, rk_chisquare, size, fdf)
+ *
+ */
+ __pyx_k_tuple_54 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_54));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_53));
+ PyTuple_SET_ITEM(__pyx_k_tuple_54, 0, ((PyObject *)__pyx_kp_s_53));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_53));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_54));
+
+ /* "mtrand.pyx":1899
+ * odf = <ndarray>PyArray_FROM_OTF(df, NPY_DOUBLE, NPY_ALIGNED)
+ * if np.any(np.less_equal(odf, 0.0)):
+ * raise ValueError("df <= 0") # <<<<<<<<<<<<<<
+ * return cont1_array(self.internal_state, rk_chisquare, size, odf)
+ *
+ */
+ __pyx_k_tuple_55 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_55));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_53));
+ PyTuple_SET_ITEM(__pyx_k_tuple_55, 0, ((PyObject *)__pyx_kp_s_53));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_53));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55));
+
+ /* "mtrand.pyx":1977
+ * if not PyErr_Occurred():
+ * if fdf <= 1:
+ * raise ValueError("df <= 0") # <<<<<<<<<<<<<<
+ * if fnonc <= 0:
+ * raise ValueError("nonc <= 0")
+ */
+ __pyx_k_tuple_56 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_56));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_53));
+ PyTuple_SET_ITEM(__pyx_k_tuple_56, 0, ((PyObject *)__pyx_kp_s_53));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_53));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56));
+
+ /* "mtrand.pyx":1979
+ * raise ValueError("df <= 0")
+ * if fnonc <= 0:
+ * raise ValueError("nonc <= 0") # <<<<<<<<<<<<<<
+ * return cont2_array_sc(self.internal_state, rk_noncentral_chisquare,
+ * size, fdf, fnonc)
+ */
+ __pyx_k_tuple_58 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_58));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_57));
+ PyTuple_SET_ITEM(__pyx_k_tuple_58, 0, ((PyObject *)__pyx_kp_s_57));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_57));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_58));
+
+ /* "mtrand.pyx":1988
+ * ononc = <ndarray>PyArray_FROM_OTF(nonc, NPY_DOUBLE, NPY_ALIGNED)
+ * if np.any(np.less_equal(odf, 0.0)):
+ * raise ValueError("df <= 1") # <<<<<<<<<<<<<<
+ * if np.any(np.less_equal(ononc, 0.0)):
+ * raise ValueError("nonc < 0")
+ */
+ __pyx_k_tuple_60 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_60));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_59));
+ PyTuple_SET_ITEM(__pyx_k_tuple_60, 0, ((PyObject *)__pyx_kp_s_59));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_59));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60));
+
+ /* "mtrand.pyx":1990
+ * raise ValueError("df <= 1")
+ * if np.any(np.less_equal(ononc, 0.0)):
+ * raise ValueError("nonc < 0") # <<<<<<<<<<<<<<
+ * return cont2_array(self.internal_state, rk_noncentral_chisquare, size,
+ * odf, ononc)
+ */
+ __pyx_k_tuple_61 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_61));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_48));
+ PyTuple_SET_ITEM(__pyx_k_tuple_61, 0, ((PyObject *)__pyx_kp_s_48));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_48));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61));
+
+ /* "mtrand.pyx":2146
+ * if not PyErr_Occurred():
+ * if fdf <= 0:
+ * raise ValueError("df <= 0") # <<<<<<<<<<<<<<
+ * return cont1_array_sc(self.internal_state, rk_standard_t, size, fdf)
+ *
+ */
+ __pyx_k_tuple_62 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_62));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_53));
+ PyTuple_SET_ITEM(__pyx_k_tuple_62, 0, ((PyObject *)__pyx_kp_s_53));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_53));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62));
+
+ /* "mtrand.pyx":2153
+ * odf = <ndarray> PyArray_FROM_OTF(df, NPY_DOUBLE, NPY_ALIGNED)
+ * if np.any(np.less_equal(odf, 0.0)):
+ * raise ValueError("df <= 0") # <<<<<<<<<<<<<<
+ * return cont1_array(self.internal_state, rk_standard_t, size, odf)
+ *
+ */
+ __pyx_k_tuple_63 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_63));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_53));
+ PyTuple_SET_ITEM(__pyx_k_tuple_63, 0, ((PyObject *)__pyx_kp_s_53));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_53));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63));
+
+ /* "mtrand.pyx":2239
+ * if not PyErr_Occurred():
+ * if fkappa < 0:
+ * raise ValueError("kappa < 0") # <<<<<<<<<<<<<<
+ * return cont2_array_sc(self.internal_state, rk_vonmises, size, fmu, fkappa)
+ *
+ */
+ __pyx_k_tuple_65 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_65));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_64));
+ PyTuple_SET_ITEM(__pyx_k_tuple_65, 0, ((PyObject *)__pyx_kp_s_64));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_64));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_65));
+
+ /* "mtrand.pyx":2247
+ * okappa = <ndarray> PyArray_FROM_OTF(kappa, NPY_DOUBLE, NPY_ALIGNED)
+ * if np.any(np.less(okappa, 0.0)):
+ * raise ValueError("kappa < 0") # <<<<<<<<<<<<<<
+ * return cont2_array(self.internal_state, rk_vonmises, size, omu, okappa)
+ *
+ */
+ __pyx_k_tuple_66 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_66));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_64));
+ PyTuple_SET_ITEM(__pyx_k_tuple_66, 0, ((PyObject *)__pyx_kp_s_64));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_64));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_66));
+
+ /* "mtrand.pyx":2336
+ * if not PyErr_Occurred():
+ * if fa <= 0:
+ * raise ValueError("a <= 0") # <<<<<<<<<<<<<<
+ * return cont1_array_sc(self.internal_state, rk_pareto, size, fa)
+ *
+ */
+ __pyx_k_tuple_67 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_67));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_22));
+ PyTuple_SET_ITEM(__pyx_k_tuple_67, 0, ((PyObject *)__pyx_kp_s_22));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_67));
+
+ /* "mtrand.pyx":2343
+ * oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED)
+ * if np.any(np.less_equal(oa, 0.0)):
+ * raise ValueError("a <= 0") # <<<<<<<<<<<<<<
+ * return cont1_array(self.internal_state, rk_pareto, size, oa)
+ *
+ */
+ __pyx_k_tuple_68 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_68));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_22));
+ PyTuple_SET_ITEM(__pyx_k_tuple_68, 0, ((PyObject *)__pyx_kp_s_22));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_68));
+
+ /* "mtrand.pyx":2436
+ * if not PyErr_Occurred():
+ * if fa <= 0:
+ * raise ValueError("a <= 0") # <<<<<<<<<<<<<<
+ * return cont1_array_sc(self.internal_state, rk_weibull, size, fa)
+ *
+ */
+ __pyx_k_tuple_69 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_69));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_22));
+ PyTuple_SET_ITEM(__pyx_k_tuple_69, 0, ((PyObject *)__pyx_kp_s_22));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_69));
+
+ /* "mtrand.pyx":2443
+ * oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED)
+ * if np.any(np.less_equal(oa, 0.0)):
+ * raise ValueError("a <= 0") # <<<<<<<<<<<<<<
+ * return cont1_array(self.internal_state, rk_weibull, size, oa)
+ *
+ */
+ __pyx_k_tuple_70 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_70));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_22));
+ PyTuple_SET_ITEM(__pyx_k_tuple_70, 0, ((PyObject *)__pyx_kp_s_22));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_70));
+
+ /* "mtrand.pyx":2545
+ * if not PyErr_Occurred():
+ * if fa <= 0:
+ * raise ValueError("a <= 0") # <<<<<<<<<<<<<<
+ * return cont1_array_sc(self.internal_state, rk_power, size, fa)
+ *
+ */
+ __pyx_k_tuple_71 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_71));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_22));
+ PyTuple_SET_ITEM(__pyx_k_tuple_71, 0, ((PyObject *)__pyx_kp_s_22));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_71));
+
+ /* "mtrand.pyx":2552
+ * oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED)
+ * if np.any(np.less_equal(oa, 0.0)):
+ * raise ValueError("a <= 0") # <<<<<<<<<<<<<<
+ * return cont1_array(self.internal_state, rk_power, size, oa)
+ *
+ */
+ __pyx_k_tuple_72 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_72));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_22));
+ PyTuple_SET_ITEM(__pyx_k_tuple_72, 0, ((PyObject *)__pyx_kp_s_22));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_72));
+
+ /* "mtrand.pyx":2635
+ * if not PyErr_Occurred():
+ * if fscale <= 0:
+ * raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
+ * return cont2_array_sc(self.internal_state, rk_laplace, size, floc, fscale)
+ *
+ */
+ __pyx_k_tuple_75 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_75));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
+ PyTuple_SET_ITEM(__pyx_k_tuple_75, 0, ((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75));
+
+ /* "mtrand.pyx":2642
+ * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
+ * if np.any(np.less_equal(oscale, 0.0)):
+ * raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
+ * return cont2_array(self.internal_state, rk_laplace, size, oloc, oscale)
+ *
+ */
+ __pyx_k_tuple_76 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_76));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
+ PyTuple_SET_ITEM(__pyx_k_tuple_76, 0, ((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_76));
+
+ /* "mtrand.pyx":2766
+ * if not PyErr_Occurred():
+ * if fscale <= 0:
+ * raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
+ * return cont2_array_sc(self.internal_state, rk_gumbel, size, floc, fscale)
+ *
+ */
+ __pyx_k_tuple_79 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_79));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
+ PyTuple_SET_ITEM(__pyx_k_tuple_79, 0, ((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_79));
+
+ /* "mtrand.pyx":2773
+ * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
+ * if np.any(np.less_equal(oscale, 0.0)):
+ * raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
+ * return cont2_array(self.internal_state, rk_gumbel, size, oloc, oscale)
+ *
+ */
+ __pyx_k_tuple_80 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_80)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_80));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
+ PyTuple_SET_ITEM(__pyx_k_tuple_80, 0, ((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_80));
+
+ /* "mtrand.pyx":2854
+ * if not PyErr_Occurred():
+ * if fscale <= 0:
+ * raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
+ * return cont2_array_sc(self.internal_state, rk_logistic, size, floc, fscale)
+ *
+ */
+ __pyx_k_tuple_83 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_83)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_83));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
+ PyTuple_SET_ITEM(__pyx_k_tuple_83, 0, ((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_83));
+
+ /* "mtrand.pyx":2861
+ * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
+ * if np.any(np.less_equal(oscale, 0.0)):
+ * raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
+ * return cont2_array(self.internal_state, rk_logistic, size, oloc, oscale)
+ *
+ */
+ __pyx_k_tuple_84 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_84)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_84));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
+ PyTuple_SET_ITEM(__pyx_k_tuple_84, 0, ((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_84));
+
+ /* "mtrand.pyx":2984
+ * if not PyErr_Occurred():
+ * if fsigma <= 0:
+ * raise ValueError("sigma <= 0") # <<<<<<<<<<<<<<
+ * return cont2_array_sc(self.internal_state, rk_lognormal, size, fmean, fsigma)
+ *
+ */
+ __pyx_k_tuple_88 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_88)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_88));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_87));
+ PyTuple_SET_ITEM(__pyx_k_tuple_88, 0, ((PyObject *)__pyx_kp_s_87));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_87));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_88));
+
+ /* "mtrand.pyx":2992
+ * osigma = PyArray_FROM_OTF(sigma, NPY_DOUBLE, NPY_ALIGNED)
+ * 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)
+ *
+ */
+ __pyx_k_tuple_90 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_90)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_90));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_89));
+ PyTuple_SET_ITEM(__pyx_k_tuple_90, 0, ((PyObject *)__pyx_kp_s_89));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_89));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_90));
+
+ /* "mtrand.pyx":3057
+ * if not PyErr_Occurred():
+ * if fscale <= 0:
+ * raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
+ * return cont1_array_sc(self.internal_state, rk_rayleigh, size, fscale)
+ *
+ */
+ __pyx_k_tuple_92 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_92)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_92));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
+ PyTuple_SET_ITEM(__pyx_k_tuple_92, 0, ((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_92));
+
+ /* "mtrand.pyx":3064
+ * oscale = <ndarray>PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
+ * if np.any(np.less_equal(oscale, 0.0)):
+ * raise ValueError("scale <= 0.0") # <<<<<<<<<<<<<<
+ * return cont1_array(self.internal_state, rk_rayleigh, size, oscale)
+ *
+ */
+ __pyx_k_tuple_94 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_94)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_94));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_93));
+ PyTuple_SET_ITEM(__pyx_k_tuple_94, 0, ((PyObject *)__pyx_kp_s_93));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_93));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_94));
+
+ /* "mtrand.pyx":3137
+ * if not PyErr_Occurred():
+ * if fmean <= 0:
+ * raise ValueError("mean <= 0") # <<<<<<<<<<<<<<
+ * if fscale <= 0:
+ * raise ValueError("scale <= 0")
+ */
+ __pyx_k_tuple_96 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_96)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_96));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_95));
+ PyTuple_SET_ITEM(__pyx_k_tuple_96, 0, ((PyObject *)__pyx_kp_s_95));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_95));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_96));
+
+ /* "mtrand.pyx":3139
+ * raise ValueError("mean <= 0")
+ * if fscale <= 0:
+ * raise ValueError("scale <= 0") # <<<<<<<<<<<<<<
+ * return cont2_array_sc(self.internal_state, rk_wald, size, fmean, fscale)
+ *
+ */
+ __pyx_k_tuple_97 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_97)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_97));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
+ PyTuple_SET_ITEM(__pyx_k_tuple_97, 0, ((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_97));
+
+ /* "mtrand.pyx":3146
+ * oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
+ * if np.any(np.less_equal(omean,0.0)):
+ * raise ValueError("mean <= 0.0") # <<<<<<<<<<<<<<
+ * elif np.any(np.less_equal(oscale,0.0)):
+ * raise ValueError("scale <= 0.0")
+ */
+ __pyx_k_tuple_99 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_99)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_99));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_98));
+ PyTuple_SET_ITEM(__pyx_k_tuple_99, 0, ((PyObject *)__pyx_kp_s_98));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_98));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_99));
+
+ /* "mtrand.pyx":3148
+ * raise ValueError("mean <= 0.0")
+ * 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)
+ *
+ */
+ __pyx_k_tuple_100 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_100));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_93));
+ PyTuple_SET_ITEM(__pyx_k_tuple_100, 0, ((PyObject *)__pyx_kp_s_93));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_93));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_100));
+
+ /* "mtrand.pyx":3218
+ * if not PyErr_Occurred():
+ * if fleft > fmode:
+ * raise ValueError("left > mode") # <<<<<<<<<<<<<<
+ * if fmode > fright:
+ * raise ValueError("mode > right")
+ */
+ __pyx_k_tuple_102 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_102)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_102));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_101));
+ PyTuple_SET_ITEM(__pyx_k_tuple_102, 0, ((PyObject *)__pyx_kp_s_101));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_101));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_102));
+
+ /* "mtrand.pyx":3220
+ * raise ValueError("left > mode")
+ * if fmode > fright:
+ * raise ValueError("mode > right") # <<<<<<<<<<<<<<
+ * if fleft == fright:
+ * raise ValueError("left == right")
+ */
+ __pyx_k_tuple_104 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_104)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_104));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_103));
+ PyTuple_SET_ITEM(__pyx_k_tuple_104, 0, ((PyObject *)__pyx_kp_s_103));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_103));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_104));
+
+ /* "mtrand.pyx":3222
+ * raise ValueError("mode > right")
+ * if fleft == fright:
+ * raise ValueError("left == right") # <<<<<<<<<<<<<<
+ * return cont3_array_sc(self.internal_state, rk_triangular, size, fleft,
+ * fmode, fright)
+ */
+ __pyx_k_tuple_106 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_106)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_106));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_105));
+ PyTuple_SET_ITEM(__pyx_k_tuple_106, 0, ((PyObject *)__pyx_kp_s_105));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_105));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_106));
+
+ /* "mtrand.pyx":3232
+ *
+ * if np.any(np.greater(oleft, omode)):
+ * raise ValueError("left > mode") # <<<<<<<<<<<<<<
+ * if np.any(np.greater(omode, oright)):
+ * raise ValueError("mode > right")
+ */
+ __pyx_k_tuple_107 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_107)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_107));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_101));
+ PyTuple_SET_ITEM(__pyx_k_tuple_107, 0, ((PyObject *)__pyx_kp_s_101));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_101));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_107));
+
+ /* "mtrand.pyx":3234
+ * raise ValueError("left > mode")
+ * if np.any(np.greater(omode, oright)):
+ * raise ValueError("mode > right") # <<<<<<<<<<<<<<
+ * if np.any(np.equal(oleft, oright)):
+ * raise ValueError("left == right")
+ */
+ __pyx_k_tuple_108 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_108)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_108));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_103));
+ PyTuple_SET_ITEM(__pyx_k_tuple_108, 0, ((PyObject *)__pyx_kp_s_103));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_103));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_108));
+
+ /* "mtrand.pyx":3236
+ * raise ValueError("mode > right")
+ * if np.any(np.equal(oleft, oright)):
+ * raise ValueError("left == right") # <<<<<<<<<<<<<<
+ * return cont3_array(self.internal_state, rk_triangular, size, oleft,
+ * omode, oright)
+ */
+ __pyx_k_tuple_109 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_109)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_109));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_105));
+ PyTuple_SET_ITEM(__pyx_k_tuple_109, 0, ((PyObject *)__pyx_kp_s_105));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_105));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_109));
+
+ /* "mtrand.pyx":3330
+ * if not PyErr_Occurred():
+ * if ln <= 0:
+ * raise ValueError("n <= 0") # <<<<<<<<<<<<<<
+ * if fp < 0:
+ * raise ValueError("p < 0")
+ */
+ __pyx_k_tuple_111 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_111)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_111));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_110));
+ PyTuple_SET_ITEM(__pyx_k_tuple_111, 0, ((PyObject *)__pyx_kp_s_110));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_110));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_111));
+
+ /* "mtrand.pyx":3332
+ * raise ValueError("n <= 0")
+ * if fp < 0:
+ * raise ValueError("p < 0") # <<<<<<<<<<<<<<
+ * elif fp > 1:
+ * raise ValueError("p > 1")
+ */
+ __pyx_k_tuple_113 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_113)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_113));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_112));
+ PyTuple_SET_ITEM(__pyx_k_tuple_113, 0, ((PyObject *)__pyx_kp_s_112));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_112));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_113));
+
+ /* "mtrand.pyx":3334
+ * raise ValueError("p < 0")
+ * elif fp > 1:
+ * raise ValueError("p > 1") # <<<<<<<<<<<<<<
+ * return discnp_array_sc(self.internal_state, rk_binomial, size, ln, fp)
+ *
+ */
+ __pyx_k_tuple_115 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_115)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_115));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_114));
+ PyTuple_SET_ITEM(__pyx_k_tuple_115, 0, ((PyObject *)__pyx_kp_s_114));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_114));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_115));
+
+ /* "mtrand.pyx":3342
+ * op = <ndarray>PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED)
+ * if np.any(np.less_equal(n, 0)):
+ * raise ValueError("n <= 0") # <<<<<<<<<<<<<<
+ * if np.any(np.less(p, 0)):
+ * raise ValueError("p < 0")
+ */
+ __pyx_k_tuple_116 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_116)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_116));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_110));
+ PyTuple_SET_ITEM(__pyx_k_tuple_116, 0, ((PyObject *)__pyx_kp_s_110));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_110));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_116));
+
+ /* "mtrand.pyx":3344
+ * raise ValueError("n <= 0")
+ * if np.any(np.less(p, 0)):
+ * raise ValueError("p < 0") # <<<<<<<<<<<<<<
+ * if np.any(np.greater(p, 1)):
+ * raise ValueError("p > 1")
+ */
+ __pyx_k_tuple_117 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_117)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_117));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_112));
+ PyTuple_SET_ITEM(__pyx_k_tuple_117, 0, ((PyObject *)__pyx_kp_s_112));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_112));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_117));
+
+ /* "mtrand.pyx":3346
+ * raise ValueError("p < 0")
+ * if np.any(np.greater(p, 1)):
+ * raise ValueError("p > 1") # <<<<<<<<<<<<<<
+ * return discnp_array(self.internal_state, rk_binomial, size, on, op)
+ *
+ */
+ __pyx_k_tuple_118 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_118)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_118));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_114));
+ PyTuple_SET_ITEM(__pyx_k_tuple_118, 0, ((PyObject *)__pyx_kp_s_114));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_114));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_118));
+
+ /* "mtrand.pyx":3423
+ * if not PyErr_Occurred():
+ * if fn <= 0:
+ * raise ValueError("n <= 0") # <<<<<<<<<<<<<<
+ * if fp < 0:
+ * raise ValueError("p < 0")
+ */
+ __pyx_k_tuple_119 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_119)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_119));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_110));
+ PyTuple_SET_ITEM(__pyx_k_tuple_119, 0, ((PyObject *)__pyx_kp_s_110));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_110));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_119));
+
+ /* "mtrand.pyx":3425
+ * raise ValueError("n <= 0")
+ * if fp < 0:
+ * raise ValueError("p < 0") # <<<<<<<<<<<<<<
+ * elif fp > 1:
+ * raise ValueError("p > 1")
+ */
+ __pyx_k_tuple_120 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_120)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_120));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_112));
+ PyTuple_SET_ITEM(__pyx_k_tuple_120, 0, ((PyObject *)__pyx_kp_s_112));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_112));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_120));
+
+ /* "mtrand.pyx":3427
+ * raise ValueError("p < 0")
+ * elif fp > 1:
+ * raise ValueError("p > 1") # <<<<<<<<<<<<<<
+ * return discdd_array_sc(self.internal_state, rk_negative_binomial,
+ * size, fn, fp)
+ */
+ __pyx_k_tuple_121 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_121)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_121));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_114));
+ PyTuple_SET_ITEM(__pyx_k_tuple_121, 0, ((PyObject *)__pyx_kp_s_114));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_114));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_121));
+
+ /* "mtrand.pyx":3436
+ * op = <ndarray>PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED)
+ * if np.any(np.less_equal(n, 0)):
+ * raise ValueError("n <= 0") # <<<<<<<<<<<<<<
+ * if np.any(np.less(p, 0)):
+ * raise ValueError("p < 0")
+ */
+ __pyx_k_tuple_122 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_122)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_122));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_110));
+ PyTuple_SET_ITEM(__pyx_k_tuple_122, 0, ((PyObject *)__pyx_kp_s_110));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_110));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_122));
+
+ /* "mtrand.pyx":3438
+ * raise ValueError("n <= 0")
+ * if np.any(np.less(p, 0)):
+ * raise ValueError("p < 0") # <<<<<<<<<<<<<<
+ * if np.any(np.greater(p, 1)):
+ * raise ValueError("p > 1")
+ */
+ __pyx_k_tuple_123 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_123)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_123));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_112));
+ PyTuple_SET_ITEM(__pyx_k_tuple_123, 0, ((PyObject *)__pyx_kp_s_112));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_112));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_123));
+
+ /* "mtrand.pyx":3440
+ * raise ValueError("p < 0")
+ * if np.any(np.greater(p, 1)):
+ * raise ValueError("p > 1") # <<<<<<<<<<<<<<
+ * return discdd_array(self.internal_state, rk_negative_binomial, size,
+ * on, op)
+ */
+ __pyx_k_tuple_124 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_124)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_124));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_114));
+ PyTuple_SET_ITEM(__pyx_k_tuple_124, 0, ((PyObject *)__pyx_kp_s_114));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_114));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_124));
+
+ /* "mtrand.pyx":3501
+ * if not PyErr_Occurred():
+ * if lam < 0:
+ * raise ValueError("lam < 0") # <<<<<<<<<<<<<<
+ * if lam > self.poisson_lam_max:
+ * raise ValueError("lam value too large")
+ */
+ __pyx_k_tuple_127 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_127)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_127));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_126));
+ PyTuple_SET_ITEM(__pyx_k_tuple_127, 0, ((PyObject *)__pyx_kp_s_126));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_126));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_127));
+
+ /* "mtrand.pyx":3503
+ * raise ValueError("lam < 0")
+ * if lam > self.poisson_lam_max:
+ * raise ValueError("lam value too large") # <<<<<<<<<<<<<<
+ * return discd_array_sc(self.internal_state, rk_poisson, size, flam)
+ *
+ */
+ __pyx_k_tuple_129 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_129)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_129));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_128));
+ PyTuple_SET_ITEM(__pyx_k_tuple_129, 0, ((PyObject *)__pyx_kp_s_128));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_128));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_129));
+
+ /* "mtrand.pyx":3510
+ * olam = <ndarray>PyArray_FROM_OTF(lam, NPY_DOUBLE, NPY_ALIGNED)
+ * if np.any(np.less(olam, 0)):
+ * raise ValueError("lam < 0") # <<<<<<<<<<<<<<
+ * if np.any(np.greater(olam, self.poisson_lam_max)):
+ * raise ValueError("lam value too large.")
+ */
+ __pyx_k_tuple_130 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_130)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_130));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_126));
+ PyTuple_SET_ITEM(__pyx_k_tuple_130, 0, ((PyObject *)__pyx_kp_s_126));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_126));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_130));
+
+ /* "mtrand.pyx":3512
+ * raise ValueError("lam < 0")
+ * if np.any(np.greater(olam, self.poisson_lam_max)):
+ * raise ValueError("lam value too large.") # <<<<<<<<<<<<<<
+ * return discd_array(self.internal_state, rk_poisson, size, olam)
+ *
+ */
+ __pyx_k_tuple_132 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_132)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_132));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_131));
+ PyTuple_SET_ITEM(__pyx_k_tuple_132, 0, ((PyObject *)__pyx_kp_s_131));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_131));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_132));
+
+ /* "mtrand.pyx":3593
+ * if not PyErr_Occurred():
+ * if fa <= 1.0:
+ * raise ValueError("a <= 1.0") # <<<<<<<<<<<<<<
+ * return discd_array_sc(self.internal_state, rk_zipf, size, fa)
+ *
+ */
+ __pyx_k_tuple_134 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_134)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_134));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_133));
+ PyTuple_SET_ITEM(__pyx_k_tuple_134, 0, ((PyObject *)__pyx_kp_s_133));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_133));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_134));
+
+ /* "mtrand.pyx":3600
+ * oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED)
+ * if np.any(np.less_equal(oa, 1.0)):
+ * raise ValueError("a <= 1.0") # <<<<<<<<<<<<<<
+ * return discd_array(self.internal_state, rk_zipf, size, oa)
+ *
+ */
+ __pyx_k_tuple_135 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_135)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_135));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_133));
+ PyTuple_SET_ITEM(__pyx_k_tuple_135, 0, ((PyObject *)__pyx_kp_s_133));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_133));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_135));
+
+ /* "mtrand.pyx":3654
+ * if not PyErr_Occurred():
+ * if fp < 0.0:
+ * raise ValueError("p < 0.0") # <<<<<<<<<<<<<<
+ * if fp > 1.0:
+ * raise ValueError("p > 1.0")
+ */
+ __pyx_k_tuple_137 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_137)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_137));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_136));
+ PyTuple_SET_ITEM(__pyx_k_tuple_137, 0, ((PyObject *)__pyx_kp_s_136));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_136));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_137));
+
+ /* "mtrand.pyx":3656
+ * raise ValueError("p < 0.0")
+ * if fp > 1.0:
+ * raise ValueError("p > 1.0") # <<<<<<<<<<<<<<
+ * return discd_array_sc(self.internal_state, rk_geometric, size, fp)
+ *
+ */
+ __pyx_k_tuple_139 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_139)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_139));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_138));
+ PyTuple_SET_ITEM(__pyx_k_tuple_139, 0, ((PyObject *)__pyx_kp_s_138));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_138));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_139));
+
+ /* "mtrand.pyx":3664
+ * op = <ndarray>PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED)
+ * if np.any(np.less(op, 0.0)):
+ * raise ValueError("p < 0.0") # <<<<<<<<<<<<<<
+ * if np.any(np.greater(op, 1.0)):
+ * raise ValueError("p > 1.0")
+ */
+ __pyx_k_tuple_140 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_140)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_140));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_136));
+ PyTuple_SET_ITEM(__pyx_k_tuple_140, 0, ((PyObject *)__pyx_kp_s_136));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_136));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_140));
+
+ /* "mtrand.pyx":3666
+ * raise ValueError("p < 0.0")
+ * if np.any(np.greater(op, 1.0)):
+ * raise ValueError("p > 1.0") # <<<<<<<<<<<<<<
+ * return discd_array(self.internal_state, rk_geometric, size, op)
+ *
+ */
+ __pyx_k_tuple_141 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_141)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_141));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_138));
+ PyTuple_SET_ITEM(__pyx_k_tuple_141, 0, ((PyObject *)__pyx_kp_s_138));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_138));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_141));
+
+ /* "mtrand.pyx":3761
+ * if not PyErr_Occurred():
+ * if ngood < 1:
+ * raise ValueError("ngood < 1") # <<<<<<<<<<<<<<
+ * if nbad < 1:
+ * raise ValueError("nbad < 1")
+ */
+ __pyx_k_tuple_143 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_143)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_143));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_142));
+ PyTuple_SET_ITEM(__pyx_k_tuple_143, 0, ((PyObject *)__pyx_kp_s_142));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_142));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_143));
+
+ /* "mtrand.pyx":3763
+ * raise ValueError("ngood < 1")
+ * if nbad < 1:
+ * raise ValueError("nbad < 1") # <<<<<<<<<<<<<<
+ * if nsample < 1:
+ * raise ValueError("nsample < 1")
+ */
+ __pyx_k_tuple_145 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_145)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_145));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_144));
+ PyTuple_SET_ITEM(__pyx_k_tuple_145, 0, ((PyObject *)__pyx_kp_s_144));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_144));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_145));
+
+ /* "mtrand.pyx":3765
+ * raise ValueError("nbad < 1")
+ * if nsample < 1:
+ * raise ValueError("nsample < 1") # <<<<<<<<<<<<<<
+ * if ngood + nbad < nsample:
+ * raise ValueError("ngood + nbad < nsample")
+ */
+ __pyx_k_tuple_147 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_147)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_147));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_146));
+ PyTuple_SET_ITEM(__pyx_k_tuple_147, 0, ((PyObject *)__pyx_kp_s_146));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_146));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_147));
+
+ /* "mtrand.pyx":3767
+ * raise ValueError("nsample < 1")
+ * if ngood + nbad < nsample:
+ * raise ValueError("ngood + nbad < nsample") # <<<<<<<<<<<<<<
+ * return discnmN_array_sc(self.internal_state, rk_hypergeometric, size,
+ * lngood, lnbad, lnsample)
+ */
+ __pyx_k_tuple_149 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_149)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_149));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_148));
+ PyTuple_SET_ITEM(__pyx_k_tuple_149, 0, ((PyObject *)__pyx_kp_s_148));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_148));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_149));
+
+ /* "mtrand.pyx":3778
+ * onsample = <ndarray>PyArray_FROM_OTF(nsample, NPY_LONG, NPY_ALIGNED)
+ * if np.any(np.less(ongood, 1)):
+ * raise ValueError("ngood < 1") # <<<<<<<<<<<<<<
+ * if np.any(np.less(onbad, 1)):
+ * raise ValueError("nbad < 1")
+ */
+ __pyx_k_tuple_150 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_150)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_150));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_142));
+ PyTuple_SET_ITEM(__pyx_k_tuple_150, 0, ((PyObject *)__pyx_kp_s_142));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_142));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_150));
+
+ /* "mtrand.pyx":3780
+ * raise ValueError("ngood < 1")
+ * if np.any(np.less(onbad, 1)):
+ * raise ValueError("nbad < 1") # <<<<<<<<<<<<<<
+ * if np.any(np.less(onsample, 1)):
+ * raise ValueError("nsample < 1")
+ */
+ __pyx_k_tuple_151 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_151)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_151));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_144));
+ PyTuple_SET_ITEM(__pyx_k_tuple_151, 0, ((PyObject *)__pyx_kp_s_144));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_144));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_151));
+
+ /* "mtrand.pyx":3782
+ * raise ValueError("nbad < 1")
+ * if np.any(np.less(onsample, 1)):
+ * raise ValueError("nsample < 1") # <<<<<<<<<<<<<<
+ * if np.any(np.less(np.add(ongood, onbad),onsample)):
+ * raise ValueError("ngood + nbad < nsample")
+ */
+ __pyx_k_tuple_152 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_152)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_152));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_146));
+ PyTuple_SET_ITEM(__pyx_k_tuple_152, 0, ((PyObject *)__pyx_kp_s_146));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_146));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_152));
+
+ /* "mtrand.pyx":3784
+ * raise ValueError("nsample < 1")
+ * if np.any(np.less(np.add(ongood, onbad),onsample)):
+ * raise ValueError("ngood + nbad < nsample") # <<<<<<<<<<<<<<
+ * return discnmN_array(self.internal_state, rk_hypergeometric, size,
+ * ongood, onbad, onsample)
+ */
+ __pyx_k_tuple_153 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_153)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_153));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_148));
+ PyTuple_SET_ITEM(__pyx_k_tuple_153, 0, ((PyObject *)__pyx_kp_s_148));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_148));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_153));
+
+ /* "mtrand.pyx":3868
+ * if not PyErr_Occurred():
+ * if fp <= 0.0:
+ * raise ValueError("p <= 0.0") # <<<<<<<<<<<<<<
+ * if fp >= 1.0:
+ * raise ValueError("p >= 1.0")
+ */
+ __pyx_k_tuple_155 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_155)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_155));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_154));
+ PyTuple_SET_ITEM(__pyx_k_tuple_155, 0, ((PyObject *)__pyx_kp_s_154));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_154));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_155));
+
+ /* "mtrand.pyx":3870
+ * raise ValueError("p <= 0.0")
+ * if fp >= 1.0:
+ * raise ValueError("p >= 1.0") # <<<<<<<<<<<<<<
+ * return discd_array_sc(self.internal_state, rk_logseries, size, fp)
+ *
+ */
+ __pyx_k_tuple_157 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_157)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_157));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_156));
+ PyTuple_SET_ITEM(__pyx_k_tuple_157, 0, ((PyObject *)__pyx_kp_s_156));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_156));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_157));
+
+ /* "mtrand.pyx":3877
+ * op = <ndarray>PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED)
+ * if np.any(np.less_equal(op, 0.0)):
+ * raise ValueError("p <= 0.0") # <<<<<<<<<<<<<<
+ * if np.any(np.greater_equal(op, 1.0)):
+ * raise ValueError("p >= 1.0")
+ */
+ __pyx_k_tuple_158 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_158)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_158));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_154));
+ PyTuple_SET_ITEM(__pyx_k_tuple_158, 0, ((PyObject *)__pyx_kp_s_154));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_154));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_158));
+
+ /* "mtrand.pyx":3879
+ * raise ValueError("p <= 0.0")
+ * if np.any(np.greater_equal(op, 1.0)):
+ * raise ValueError("p >= 1.0") # <<<<<<<<<<<<<<
+ * return discd_array(self.internal_state, rk_logseries, size, op)
+ *
+ */
+ __pyx_k_tuple_159 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_159)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_159));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_156));
+ PyTuple_SET_ITEM(__pyx_k_tuple_159, 0, ((PyObject *)__pyx_kp_s_156));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_156));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_159));
+
+ /* "mtrand.pyx":3982
+ * shape = size
+ * if len(mean.shape) != 1:
+ * 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")
+ */
+ __pyx_k_tuple_161 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_161)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_161));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_160));
+ PyTuple_SET_ITEM(__pyx_k_tuple_161, 0, ((PyObject *)__pyx_kp_s_160));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_160));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_161));
+
+ /* "mtrand.pyx":3984
+ * 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") # <<<<<<<<<<<<<<
+ * if mean.shape[0] != cov.shape[0]:
+ * raise ValueError("mean and cov must have same length")
+ */
+ __pyx_k_tuple_163 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_163)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_163));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_162));
+ PyTuple_SET_ITEM(__pyx_k_tuple_163, 0, ((PyObject *)__pyx_kp_s_162));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_162));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_163));
+
+ /* "mtrand.pyx":3986
+ * 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") # <<<<<<<<<<<<<<
+ * # Compute shape of output
+ * if isinstance(shape, int):
+ */
+ __pyx_k_tuple_165 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_165)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_165));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_164));
+ PyTuple_SET_ITEM(__pyx_k_tuple_165, 0, ((PyObject *)__pyx_kp_s_164));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_164));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_165));
+
+ /* "mtrand.pyx":4079
+ *
+ * if kahan_sum(pix, d-1) > (1.0 + 1e-12):
+ * raise ValueError("sum(pvals[:-1]) > 1.0") # <<<<<<<<<<<<<<
+ *
+ * if size is None:
+ */
+ __pyx_k_tuple_168 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_168)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_168));
+ __Pyx_INCREF(((PyObject *)__pyx_kp_s_167));
+ PyTuple_SET_ITEM(__pyx_k_tuple_168, 0, ((PyObject *)__pyx_kp_s_167));
+ __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_167));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_168));
+
+ /* "mtrand.pyx":556
+ * """
+ * cdef rk_state *internal_state
+ * poisson_lam_max = np.iinfo('l').max - np.sqrt(np.iinfo('l').max)*10 # <<<<<<<<<<<<<<
+ *
+ * def __init__(self, seed=None):
+ */
+ __pyx_k_tuple_169 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_169)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_169));
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__l));
+ PyTuple_SET_ITEM(__pyx_k_tuple_169, 0, ((PyObject *)__pyx_n_s__l));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_169));
+ __pyx_k_tuple_170 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_170)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_170));
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__l));
+ PyTuple_SET_ITEM(__pyx_k_tuple_170, 0, ((PyObject *)__pyx_n_s__l));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l));
+ __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_170));
+ __Pyx_RefNannyFinishContext();
return 0;
__pyx_L1_error:;
+ __Pyx_RefNannyFinishContext();
return -1;
}
@@ -19395,6 +20363,7 @@ static int __Pyx_InitGlobals(void) {
if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_624 = PyInt_FromLong(624); if (unlikely(!__pyx_int_624)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
return 0;
__pyx_L1_error:;
@@ -19412,6 +20381,7 @@ PyMODINIT_FUNC PyInit_mtrand(void)
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
#if CYTHON_REFNANNY
void* __pyx_refnanny = NULL;
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
@@ -19423,12 +20393,10 @@ PyMODINIT_FUNC PyInit_mtrand(void)
}
__pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_mtrand(void)", __LINE__, __FILE__);
#endif
- __pyx_init_filenames();
__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #if PY_MAJOR_VERSION < 3
- __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #ifdef __pyx_binding_PyCFunctionType_USED
+ if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
/*--- Library function declarations ---*/
/*--- Threads initialization code ---*/
@@ -19457,6 +20425,8 @@ PyMODINIT_FUNC PyInit_mtrand(void)
}
/*--- Builtin init code ---*/
if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*--- Constants init code ---*/
+ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Global init code ---*/
/*--- Function export code ---*/
/*--- Type init code ---*/
@@ -19492,1349 +20462,976 @@ PyMODINIT_FUNC PyInit_mtrand(void)
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;
- /* "mtrand.pyx":915
+ /* "mtrand.pyx":556
+ * """
+ * cdef rk_state *internal_state
+ * poisson_lam_max = np.iinfo('l').max - np.sqrt(np.iinfo('l').max)*10 # <<<<<<<<<<<<<<
+ *
+ * def __init__(self, seed=None):
+ */
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__iinfo); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_169), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__max); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__iinfo); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_170), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__max); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_int_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = PyNumber_Subtract(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __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_1); __pyx_t_1 = 0;
+ if (PyDict_SetItem((PyObject *)__pyx_ptype_6mtrand_RandomState->tp_dict, __pyx_n_s__poisson_lam_max, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ PyType_Modified(__pyx_ptype_6mtrand_RandomState);
+
+ /* "mtrand.pyx":916
* return bytestring
*
* def uniform(self, low=0.0, high=1.0, size=None): # <<<<<<<<<<<<<<
* """
* uniform(low=0.0, high=1.0, size=1)
*/
- __pyx_t_1 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_k_5 = __pyx_t_1;
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
- __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_k_6 = __pyx_t_1;
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
+ __pyx_t_4 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_k_15 = __pyx_t_4;
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_4 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_k_16 = __pyx_t_4;
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
- /* "mtrand.pyx":1211
+ /* "mtrand.pyx":1212
* return cont0_array(self.internal_state, rk_gauss, size)
*
* def normal(self, loc=0.0, scale=1.0, size=None): # <<<<<<<<<<<<<<
* """
* normal(loc=0.0, scale=1.0, size=None)
*/
- __pyx_t_1 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_k_7 = __pyx_t_1;
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
- __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_k_8 = __pyx_t_1;
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
+ __pyx_t_4 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_k_17 = __pyx_t_4;
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_4 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_k_18 = __pyx_t_4;
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
- /* "mtrand.pyx":1370
+ /* "mtrand.pyx":1371
* return cont2_array(self.internal_state, rk_beta, size, oa, ob)
*
* def exponential(self, scale=1.0, size=None): # <<<<<<<<<<<<<<
* """
* exponential(scale=1.0, size=None)
*/
- __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_k_12 = __pyx_t_1;
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
+ __pyx_t_4 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_k_28 = __pyx_t_4;
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
- /* "mtrand.pyx":1534
+ /* "mtrand.pyx":1535
* return cont1_array(self.internal_state, rk_standard_gamma, size, oshape)
*
* def gamma(self, shape, scale=1.0, size=None): # <<<<<<<<<<<<<<
* """
* gamma(shape, scale=1.0, size=None)
*/
- __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_k_14 = __pyx_t_1;
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
+ __pyx_t_4 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_k_34 = __pyx_t_4;
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
- /* "mtrand.pyx":2554
+ /* "mtrand.pyx":2555
* return cont1_array(self.internal_state, rk_power, size, oa)
*
* def laplace(self, loc=0.0, scale=1.0, size=None): # <<<<<<<<<<<<<<
* """
* laplace(loc=0.0, scale=1.0, size=None)
*/
- __pyx_t_1 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_k_23 = __pyx_t_1;
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
- __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_k_24 = __pyx_t_1;
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
+ __pyx_t_4 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_k_73 = __pyx_t_4;
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_4 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_k_74 = __pyx_t_4;
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
- /* "mtrand.pyx":2644
+ /* "mtrand.pyx":2645
* return cont2_array(self.internal_state, rk_laplace, size, oloc, oscale)
*
* def gumbel(self, loc=0.0, scale=1.0, size=None): # <<<<<<<<<<<<<<
* """
* gumbel(loc=0.0, scale=1.0, size=None)
*/
- __pyx_t_1 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_k_25 = __pyx_t_1;
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
- __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_k_26 = __pyx_t_1;
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
+ __pyx_t_4 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_k_77 = __pyx_t_4;
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_4 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_k_78 = __pyx_t_4;
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
- /* "mtrand.pyx":2775
+ /* "mtrand.pyx":2776
* return cont2_array(self.internal_state, rk_gumbel, size, oloc, oscale)
*
* def logistic(self, loc=0.0, scale=1.0, size=None): # <<<<<<<<<<<<<<
* """
* logistic(loc=0.0, scale=1.0, size=None)
*/
- __pyx_t_1 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_k_27 = __pyx_t_1;
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
- __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_k_28 = __pyx_t_1;
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
+ __pyx_t_4 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_k_81 = __pyx_t_4;
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_4 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_k_82 = __pyx_t_4;
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
- /* "mtrand.pyx":2863
+ /* "mtrand.pyx":2864
* return cont2_array(self.internal_state, rk_logistic, size, oloc, oscale)
*
* def lognormal(self, mean=0.0, sigma=1.0, size=None): # <<<<<<<<<<<<<<
* """
* lognormal(mean=0.0, sigma=1.0, size=None)
*/
- __pyx_t_1 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_k_29 = __pyx_t_1;
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
- __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_k_30 = __pyx_t_1;
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
+ __pyx_t_4 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_k_85 = __pyx_t_4;
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_4 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_k_86 = __pyx_t_4;
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
- /* "mtrand.pyx":2994
+ /* "mtrand.pyx":2995
* return cont2_array(self.internal_state, rk_lognormal, size, omean, osigma)
*
* def rayleigh(self, scale=1.0, size=None): # <<<<<<<<<<<<<<
* """
* rayleigh(scale=1.0, size=None)
*/
- __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_k_33 = __pyx_t_1;
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
+ __pyx_t_4 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_k_91 = __pyx_t_4;
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
- /* "mtrand.pyx":3443
+ /* "mtrand.pyx":3444
* on, op)
*
* def poisson(self, lam=1.0, size=None): # <<<<<<<<<<<<<<
* """
* poisson(lam=1.0, size=None)
*/
- __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_k_43 = __pyx_t_1;
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
+ __pyx_t_4 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_k_125 = __pyx_t_4;
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
- /* "mtrand.pyx":4320
+ /* "mtrand.pyx":4329
* return arr
*
* _rand = RandomState() # <<<<<<<<<<<<<<
* seed = _rand.seed
* get_state = _rand.get_state
*/
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6mtrand_RandomState)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s___rand, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6mtrand_RandomState)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s___rand, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "mtrand.pyx":4321
+ /* "mtrand.pyx":4330
*
* _rand = RandomState()
* seed = _rand.seed # <<<<<<<<<<<<<<
* get_state = _rand.get_state
* set_state = _rand.set_state
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__seed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__seed); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__seed, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__seed, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4322
+ /* "mtrand.pyx":4331
* _rand = RandomState()
* seed = _rand.seed
* get_state = _rand.get_state # <<<<<<<<<<<<<<
* set_state = _rand.set_state
* random_sample = _rand.random_sample
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__get_state); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_state, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__get_state); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_state, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "mtrand.pyx":4323
+ /* "mtrand.pyx":4332
* seed = _rand.seed
* get_state = _rand.get_state
* set_state = _rand.set_state # <<<<<<<<<<<<<<
* random_sample = _rand.random_sample
* randint = _rand.randint
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__set_state); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__set_state); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_state, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_state, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4324
+ /* "mtrand.pyx":4333
* get_state = _rand.get_state
* set_state = _rand.set_state
* random_sample = _rand.random_sample # <<<<<<<<<<<<<<
* randint = _rand.randint
* bytes = _rand.bytes
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__random_sample); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__random_sample, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__random_sample); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__random_sample, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "mtrand.pyx":4325
+ /* "mtrand.pyx":4334
* set_state = _rand.set_state
* random_sample = _rand.random_sample
* randint = _rand.randint # <<<<<<<<<<<<<<
* bytes = _rand.bytes
* uniform = _rand.uniform
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__randint); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__randint); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__randint, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__randint, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4326
+ /* "mtrand.pyx":4335
* random_sample = _rand.random_sample
* randint = _rand.randint
* bytes = _rand.bytes # <<<<<<<<<<<<<<
* uniform = _rand.uniform
* rand = _rand.rand
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__bytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__bytes, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__bytes); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__bytes, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "mtrand.pyx":4327
+ /* "mtrand.pyx":4336
* randint = _rand.randint
* bytes = _rand.bytes
* uniform = _rand.uniform # <<<<<<<<<<<<<<
* rand = _rand.rand
* randn = _rand.randn
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__uniform); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__uniform); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__uniform, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__uniform, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4328
+ /* "mtrand.pyx":4337
* bytes = _rand.bytes
* uniform = _rand.uniform
* rand = _rand.rand # <<<<<<<<<<<<<<
* randn = _rand.randn
* random_integers = _rand.random_integers
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__rand, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__rand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__rand, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "mtrand.pyx":4329
+ /* "mtrand.pyx":4338
* uniform = _rand.uniform
* rand = _rand.rand
* randn = _rand.randn # <<<<<<<<<<<<<<
* random_integers = _rand.random_integers
* standard_normal = _rand.standard_normal
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__randn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__randn); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__randn, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__randn, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4330
+ /* "mtrand.pyx":4339
* rand = _rand.rand
* randn = _rand.randn
* random_integers = _rand.random_integers # <<<<<<<<<<<<<<
* standard_normal = _rand.standard_normal
* normal = _rand.normal
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__random_integers); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__random_integers, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__random_integers); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__random_integers, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "mtrand.pyx":4331
+ /* "mtrand.pyx":4340
* randn = _rand.randn
* random_integers = _rand.random_integers
* standard_normal = _rand.standard_normal # <<<<<<<<<<<<<<
* normal = _rand.normal
* beta = _rand.beta
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__standard_normal); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__standard_normal); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__standard_normal, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__standard_normal, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4332
+ /* "mtrand.pyx":4341
* random_integers = _rand.random_integers
* standard_normal = _rand.standard_normal
* normal = _rand.normal # <<<<<<<<<<<<<<
* beta = _rand.beta
* exponential = _rand.exponential
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__normal); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__normal, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__normal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__normal, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "mtrand.pyx":4333
+ /* "mtrand.pyx":4342
* standard_normal = _rand.standard_normal
* normal = _rand.normal
* beta = _rand.beta # <<<<<<<<<<<<<<
* exponential = _rand.exponential
* standard_exponential = _rand.standard_exponential
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__beta); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__beta); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__beta, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__beta, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4334
+ /* "mtrand.pyx":4343
* normal = _rand.normal
* beta = _rand.beta
* exponential = _rand.exponential # <<<<<<<<<<<<<<
* standard_exponential = _rand.standard_exponential
* standard_gamma = _rand.standard_gamma
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exponential); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__exponential, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__exponential); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__exponential, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "mtrand.pyx":4335
+ /* "mtrand.pyx":4344
* beta = _rand.beta
* exponential = _rand.exponential
* standard_exponential = _rand.standard_exponential # <<<<<<<<<<<<<<
* standard_gamma = _rand.standard_gamma
* gamma = _rand.gamma
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s_171); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s_59); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s_171, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s_59, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4336
+ /* "mtrand.pyx":4345
* exponential = _rand.exponential
* standard_exponential = _rand.standard_exponential
* standard_gamma = _rand.standard_gamma # <<<<<<<<<<<<<<
* gamma = _rand.gamma
* f = _rand.f
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__standard_gamma); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__standard_gamma, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__standard_gamma); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__standard_gamma, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "mtrand.pyx":4337
+ /* "mtrand.pyx":4346
* standard_exponential = _rand.standard_exponential
* standard_gamma = _rand.standard_gamma
* gamma = _rand.gamma # <<<<<<<<<<<<<<
* f = _rand.f
* noncentral_f = _rand.noncentral_f
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__gamma); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__gamma); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gamma, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gamma, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4338
+ /* "mtrand.pyx":4347
* standard_gamma = _rand.standard_gamma
* gamma = _rand.gamma
* f = _rand.f # <<<<<<<<<<<<<<
* noncentral_f = _rand.noncentral_f
* chisquare = _rand.chisquare
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__f, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__f); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__f, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "mtrand.pyx":4339
+ /* "mtrand.pyx":4348
* gamma = _rand.gamma
* f = _rand.f
* noncentral_f = _rand.noncentral_f # <<<<<<<<<<<<<<
* chisquare = _rand.chisquare
* noncentral_chisquare = _rand.noncentral_chisquare
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__noncentral_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__noncentral_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__noncentral_f, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__noncentral_f, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4340
+ /* "mtrand.pyx":4349
* f = _rand.f
* noncentral_f = _rand.noncentral_f
* chisquare = _rand.chisquare # <<<<<<<<<<<<<<
* noncentral_chisquare = _rand.noncentral_chisquare
* standard_cauchy = _rand.standard_cauchy
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__chisquare); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__chisquare, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__chisquare); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__chisquare, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "mtrand.pyx":4341
+ /* "mtrand.pyx":4350
* noncentral_f = _rand.noncentral_f
* chisquare = _rand.chisquare
* noncentral_chisquare = _rand.noncentral_chisquare # <<<<<<<<<<<<<<
* standard_cauchy = _rand.standard_cauchy
* standard_t = _rand.standard_t
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s_172); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s_60); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s_172, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s_60, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4342
+ /* "mtrand.pyx":4351
* chisquare = _rand.chisquare
* noncentral_chisquare = _rand.noncentral_chisquare
* standard_cauchy = _rand.standard_cauchy # <<<<<<<<<<<<<<
* standard_t = _rand.standard_t
* vonmises = _rand.vonmises
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__standard_cauchy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__standard_cauchy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__standard_cauchy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__standard_cauchy, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "mtrand.pyx":4343
+ /* "mtrand.pyx":4352
* noncentral_chisquare = _rand.noncentral_chisquare
* standard_cauchy = _rand.standard_cauchy
* standard_t = _rand.standard_t # <<<<<<<<<<<<<<
* vonmises = _rand.vonmises
* pareto = _rand.pareto
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__standard_t); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__standard_t); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__standard_t, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__standard_t, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4344
+ /* "mtrand.pyx":4353
* standard_cauchy = _rand.standard_cauchy
* standard_t = _rand.standard_t
* vonmises = _rand.vonmises # <<<<<<<<<<<<<<
* pareto = _rand.pareto
* weibull = _rand.weibull
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__vonmises); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__vonmises, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__vonmises); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__vonmises, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "mtrand.pyx":4345
+ /* "mtrand.pyx":4354
* standard_t = _rand.standard_t
* vonmises = _rand.vonmises
* pareto = _rand.pareto # <<<<<<<<<<<<<<
* weibull = _rand.weibull
* power = _rand.power
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__pareto); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__pareto); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pareto, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pareto, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4346
+ /* "mtrand.pyx":4355
* vonmises = _rand.vonmises
* pareto = _rand.pareto
* weibull = _rand.weibull # <<<<<<<<<<<<<<
* power = _rand.power
* laplace = _rand.laplace
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__weibull); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__weibull, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__weibull); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__weibull, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "mtrand.pyx":4347
+ /* "mtrand.pyx":4356
* pareto = _rand.pareto
* weibull = _rand.weibull
* power = _rand.power # <<<<<<<<<<<<<<
* laplace = _rand.laplace
* gumbel = _rand.gumbel
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__power); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__power); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__power, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__power, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4348
+ /* "mtrand.pyx":4357
* weibull = _rand.weibull
* power = _rand.power
* laplace = _rand.laplace # <<<<<<<<<<<<<<
* gumbel = _rand.gumbel
* logistic = _rand.logistic
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__laplace); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__laplace, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__laplace); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__laplace, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "mtrand.pyx":4349
+ /* "mtrand.pyx":4358
* power = _rand.power
* laplace = _rand.laplace
* gumbel = _rand.gumbel # <<<<<<<<<<<<<<
* logistic = _rand.logistic
* lognormal = _rand.lognormal
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__gumbel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__gumbel); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gumbel, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gumbel, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4350
+ /* "mtrand.pyx":4359
* laplace = _rand.laplace
* gumbel = _rand.gumbel
* logistic = _rand.logistic # <<<<<<<<<<<<<<
* lognormal = _rand.lognormal
* rayleigh = _rand.rayleigh
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__logistic); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__logistic, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__logistic); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__logistic, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "mtrand.pyx":4351
+ /* "mtrand.pyx":4360
* gumbel = _rand.gumbel
* logistic = _rand.logistic
* lognormal = _rand.lognormal # <<<<<<<<<<<<<<
* rayleigh = _rand.rayleigh
* wald = _rand.wald
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__lognormal); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__lognormal); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__lognormal, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__lognormal, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4352
+ /* "mtrand.pyx":4361
* logistic = _rand.logistic
* lognormal = _rand.lognormal
* rayleigh = _rand.rayleigh # <<<<<<<<<<<<<<
* wald = _rand.wald
* triangular = _rand.triangular
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__rayleigh); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__rayleigh, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__rayleigh); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__rayleigh, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "mtrand.pyx":4353
+ /* "mtrand.pyx":4362
* lognormal = _rand.lognormal
* rayleigh = _rand.rayleigh
* wald = _rand.wald # <<<<<<<<<<<<<<
* triangular = _rand.triangular
*
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__wald); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__wald); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__wald, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__wald, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4354
+ /* "mtrand.pyx":4363
* rayleigh = _rand.rayleigh
* wald = _rand.wald
* triangular = _rand.triangular # <<<<<<<<<<<<<<
*
* binomial = _rand.binomial
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__triangular); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__triangular, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__triangular); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__triangular, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "mtrand.pyx":4356
+ /* "mtrand.pyx":4365
* triangular = _rand.triangular
*
* binomial = _rand.binomial # <<<<<<<<<<<<<<
* negative_binomial = _rand.negative_binomial
* poisson = _rand.poisson
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__binomial); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__binomial); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__binomial, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__binomial, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4357
+ /* "mtrand.pyx":4366
*
* binomial = _rand.binomial
* negative_binomial = _rand.negative_binomial # <<<<<<<<<<<<<<
* poisson = _rand.poisson
* zipf = _rand.zipf
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__negative_binomial); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__negative_binomial, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__negative_binomial); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__negative_binomial, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "mtrand.pyx":4358
+ /* "mtrand.pyx":4367
* binomial = _rand.binomial
* negative_binomial = _rand.negative_binomial
* poisson = _rand.poisson # <<<<<<<<<<<<<<
* zipf = _rand.zipf
* geometric = _rand.geometric
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__poisson); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__poisson); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__poisson, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__poisson, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4359
+ /* "mtrand.pyx":4368
* negative_binomial = _rand.negative_binomial
* poisson = _rand.poisson
* zipf = _rand.zipf # <<<<<<<<<<<<<<
* geometric = _rand.geometric
* hypergeometric = _rand.hypergeometric
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zipf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__zipf, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zipf); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__zipf, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "mtrand.pyx":4360
+ /* "mtrand.pyx":4369
* poisson = _rand.poisson
* zipf = _rand.zipf
* geometric = _rand.geometric # <<<<<<<<<<<<<<
* hypergeometric = _rand.hypergeometric
* logseries = _rand.logseries
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__geometric); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__geometric); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__geometric, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__geometric, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4361
+ /* "mtrand.pyx":4370
* zipf = _rand.zipf
* geometric = _rand.geometric
* hypergeometric = _rand.hypergeometric # <<<<<<<<<<<<<<
* logseries = _rand.logseries
*
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__hypergeometric); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__hypergeometric, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__hypergeometric); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__hypergeometric, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "mtrand.pyx":4362
+ /* "mtrand.pyx":4371
* geometric = _rand.geometric
* hypergeometric = _rand.hypergeometric
* logseries = _rand.logseries # <<<<<<<<<<<<<<
*
* multivariate_normal = _rand.multivariate_normal
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__logseries); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__logseries); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__logseries, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__logseries, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4364
+ /* "mtrand.pyx":4373
* logseries = _rand.logseries
*
* multivariate_normal = _rand.multivariate_normal # <<<<<<<<<<<<<<
* multinomial = _rand.multinomial
* dirichlet = _rand.dirichlet
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__multivariate_normal); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__multivariate_normal, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__multivariate_normal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__multivariate_normal, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "mtrand.pyx":4365
+ /* "mtrand.pyx":4374
*
* multivariate_normal = _rand.multivariate_normal
* multinomial = _rand.multinomial # <<<<<<<<<<<<<<
* dirichlet = _rand.dirichlet
*
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__multinomial); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__multinomial); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__multinomial, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__multinomial, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4366
+ /* "mtrand.pyx":4375
* multivariate_normal = _rand.multivariate_normal
* multinomial = _rand.multinomial
* dirichlet = _rand.dirichlet # <<<<<<<<<<<<<<
*
* shuffle = _rand.shuffle
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__dirichlet); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__dirichlet, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__dirichlet); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__dirichlet, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "mtrand.pyx":4368
+ /* "mtrand.pyx":4377
* dirichlet = _rand.dirichlet
*
* shuffle = _rand.shuffle # <<<<<<<<<<<<<<
* permutation = _rand.permutation
*/
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__shuffle); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__shuffle); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__shuffle, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__shuffle, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "mtrand.pyx":4369
+ /* "mtrand.pyx":4378
*
* shuffle = _rand.shuffle
* permutation = _rand.permutation # <<<<<<<<<<<<<<
*/
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__permutation); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__permutation, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__permutation); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__permutation, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "mtrand.pyx":1
* # mtrand.pyx -- A Pyrex wrapper of Jean-Sebastien Roy's RandomKit # <<<<<<<<<<<<<<
* #
* # Copyright 2005 Robert Kern (robert.kern@gmail.com)
*/
- __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__seed); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_61), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__get_state); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_62), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__set_state); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_63), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__random_sample); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_64), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__tomaxint); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_65), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__randint); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_66), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__bytes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_67), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__uniform); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_68), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__rand); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_69), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__randn); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_70), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__random_integers); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_71), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__standard_normal); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_72), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__normal); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_73), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__beta); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_74), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exponential); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_75), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s_59); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_76), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__standard_gamma); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_77), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__gamma); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_78), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__f); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_79), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__noncentral_f); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_80), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__chisquare); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_81), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s_60); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_82), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__standard_cauchy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_83), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__standard_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_84), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__vonmises); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_85), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__pareto); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_86), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__weibull); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_87), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__power); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_88), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__laplace); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_89), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__gumbel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_90), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__logistic); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_91), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__lognormal); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_92), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__rayleigh); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_93), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__wald); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_94), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__triangular); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_95), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__binomial); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_96), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__negative_binomial); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_97), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__poisson); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_98), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zipf); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_99), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__geometric); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_100), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__hypergeometric); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_101), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__logseries); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_102), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__multivariate_normal); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_103), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__multinomial); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_104), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__dirichlet); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_105), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__shuffle); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_106), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__permutation); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_107), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_173), ((PyObject *)__pyx_kp_u_174)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_175), ((PyObject *)__pyx_kp_u_176)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_177), ((PyObject *)__pyx_kp_u_178)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_179), ((PyObject *)__pyx_kp_u_180)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_181), ((PyObject *)__pyx_kp_u_182)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_183), ((PyObject *)__pyx_kp_u_184)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_185), ((PyObject *)__pyx_kp_u_186)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_187), ((PyObject *)__pyx_kp_u_188)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_189), ((PyObject *)__pyx_kp_u_190)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_191), ((PyObject *)__pyx_kp_u_192)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_193), ((PyObject *)__pyx_kp_u_194)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_195), ((PyObject *)__pyx_kp_u_196)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_197), ((PyObject *)__pyx_kp_u_198)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_199), ((PyObject *)__pyx_kp_u_200)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_201), ((PyObject *)__pyx_kp_u_202)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_203), ((PyObject *)__pyx_kp_u_204)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_205), ((PyObject *)__pyx_kp_u_206)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_207), ((PyObject *)__pyx_kp_u_208)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_209), ((PyObject *)__pyx_kp_u_210)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_211), ((PyObject *)__pyx_kp_u_212)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_213), ((PyObject *)__pyx_kp_u_214)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_215), ((PyObject *)__pyx_kp_u_216)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_217), ((PyObject *)__pyx_kp_u_218)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_219), ((PyObject *)__pyx_kp_u_220)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_221), ((PyObject *)__pyx_kp_u_222)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_223), ((PyObject *)__pyx_kp_u_224)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_225), ((PyObject *)__pyx_kp_u_226)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_227), ((PyObject *)__pyx_kp_u_228)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_229), ((PyObject *)__pyx_kp_u_230)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_231), ((PyObject *)__pyx_kp_u_232)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_233), ((PyObject *)__pyx_kp_u_234)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_235), ((PyObject *)__pyx_kp_u_236)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_237), ((PyObject *)__pyx_kp_u_238)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_239), ((PyObject *)__pyx_kp_u_240)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_241), ((PyObject *)__pyx_kp_u_242)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_243), ((PyObject *)__pyx_kp_u_244)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_245), ((PyObject *)__pyx_kp_u_246)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_247), ((PyObject *)__pyx_kp_u_248)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_249), ((PyObject *)__pyx_kp_u_250)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_251), ((PyObject *)__pyx_kp_u_252)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_253), ((PyObject *)__pyx_kp_u_254)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_kp_u_255), ((PyObject *)__pyx_kp_u_256)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
if (__pyx_m) {
__Pyx_AddTraceback("init mtrand");
Py_DECREF(__pyx_m); __pyx_m = 0;
@@ -20850,16 +21447,152 @@ PyMODINIT_FUNC PyInit_mtrand(void)
#endif
}
-static const char *__pyx_filenames[] = {
- "mtrand.pyx",
- "numpy.pxi",
-};
-
/* Runtime support code */
-static void __pyx_init_filenames(void) {
- __pyx_f = __pyx_filenames;
+static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
+ PyObject *result;
+ result = PyObject_GetAttr(dict, name);
+ if (!result)
+ PyErr_SetObject(PyExc_NameError, name);
+ return result;
+}
+
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyThreadState *tstate = PyThreadState_GET();
+
+ tmp_type = tstate->curexc_type;
+ tmp_value = tstate->curexc_value;
+ tmp_tb = tstate->curexc_traceback;
+ tstate->curexc_type = type;
+ tstate->curexc_value = value;
+ tstate->curexc_traceback = tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_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;
+ *tb = tstate->curexc_traceback;
+
+ tstate->curexc_type = 0;
+ tstate->curexc_value = 0;
+ tstate->curexc_traceback = 0;
+}
+
+
+#if PY_MAJOR_VERSION < 3
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
+ Py_XINCREF(type);
+ Py_XINCREF(value);
+ Py_XINCREF(tb);
+ /* First, check the traceback argument, replacing None with NULL. */
+ if (tb == Py_None) {
+ Py_DECREF(tb);
+ tb = 0;
+ }
+ else if (tb != NULL && !PyTraceBack_Check(tb)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: arg 3 must be a traceback or None");
+ goto raise_error;
+ }
+ /* Next, replace a missing value with None */
+ if (value == NULL) {
+ value = Py_None;
+ Py_INCREF(value);
+ }
+ #if PY_VERSION_HEX < 0x02050000
+ if (!PyClass_Check(type))
+ #else
+ if (!PyType_Check(type))
+ #endif
+ {
+ /* Raising an instance. The value should be a dummy. */
+ if (value != Py_None) {
+ PyErr_SetString(PyExc_TypeError,
+ "instance exception may not have a separate value");
+ goto raise_error;
+ }
+ /* Normalize to raise <class>, <instance> */
+ Py_DECREF(value);
+ value = type;
+ #if PY_VERSION_HEX < 0x02050000
+ if (PyInstance_Check(type)) {
+ type = (PyObject*) ((PyInstanceObject*)type)->in_class;
+ Py_INCREF(type);
+ }
+ else {
+ type = 0;
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception must be an old-style class or instance");
+ goto raise_error;
+ }
+ #else
+ type = (PyObject*) Py_TYPE(type);
+ Py_INCREF(type);
+ if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception class must be a subclass of BaseException");
+ goto raise_error;
+ }
+ #endif
+ }
+
+ __Pyx_ErrRestore(type, value, tb);
+ return;
+raise_error:
+ Py_XDECREF(value);
+ Py_XDECREF(type);
+ Py_XDECREF(tb);
+ return;
+}
+
+#else /* Python 3+ */
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
+ if (tb == Py_None) {
+ tb = 0;
+ } else if (tb && !PyTraceBack_Check(tb)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: arg 3 must be a traceback or None");
+ goto bad;
+ }
+ if (value == Py_None)
+ value = 0;
+
+ if (PyExceptionInstance_Check(type)) {
+ if (value) {
+ PyErr_SetString(PyExc_TypeError,
+ "instance exception may not have a separate value");
+ goto bad;
+ }
+ value = type;
+ type = (PyObject*) Py_TYPE(value);
+ } else if (!PyExceptionClass_Check(type)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: exception class must be a subclass of BaseException");
+ goto bad;
+ }
+
+ PyErr_SetObject(type, value);
+
+ if (tb) {
+ PyThreadState *tstate = PyThreadState_GET();
+ PyObject* tmp_tb = tstate->curexc_traceback;
+ if (tb != tmp_tb) {
+ Py_INCREF(tb);
+ tstate->curexc_traceback = tb;
+ Py_XDECREF(tmp_tb);
+ }
+ }
+
+bad:
+ return;
}
+#endif
static void __Pyx_RaiseDoubleKeywordsError(
const char* func_name,
@@ -20874,36 +21607,6 @@ static void __Pyx_RaiseDoubleKeywordsError(
#endif
}
-static void __Pyx_RaiseArgtupleInvalid(
- const char* func_name,
- int exact,
- Py_ssize_t num_min,
- Py_ssize_t num_max,
- Py_ssize_t num_found)
-{
- Py_ssize_t num_expected;
- const char *number, *more_or_less;
-
- if (num_found < num_min) {
- num_expected = num_min;
- more_or_less = "at least";
- } else {
- num_expected = num_max;
- more_or_less = "at most";
- }
- if (exact) {
- more_or_less = "exactly";
- }
- number = (num_expected == 1) ? "" : "s";
- PyErr_Format(PyExc_TypeError,
- #if PY_VERSION_HEX < 0x02050000
- "%s() takes %s %d positional argument%s (%d given)",
- #else
- "%s() takes %s %zd positional argument%s (%zd given)",
- #endif
- func_name, more_or_less, num_expected, number, num_found);
-}
-
static int __Pyx_ParseOptionalKeywords(
PyObject *kwds,
PyObject **argnames[],
@@ -20983,6 +21686,36 @@ bad:
return -1;
}
+static void __Pyx_RaiseArgtupleInvalid(
+ const char* func_name,
+ int exact,
+ Py_ssize_t num_min,
+ Py_ssize_t num_max,
+ Py_ssize_t num_found)
+{
+ Py_ssize_t num_expected;
+ const char *number, *more_or_less;
+
+ if (num_found < num_min) {
+ num_expected = num_min;
+ more_or_less = "at least";
+ } else {
+ num_expected = num_max;
+ more_or_less = "at most";
+ }
+ if (exact) {
+ more_or_less = "exactly";
+ }
+ number = (num_expected == 1) ? "" : "s";
+ PyErr_Format(PyExc_TypeError,
+ #if PY_VERSION_HEX < 0x02050000
+ "%s() takes %s %d positional argument%s (%d given)",
+ #else
+ "%s() takes %s %zd positional argument%s (%zd given)",
+ #endif
+ func_name, more_or_less, num_expected, number, num_found);
+}
+
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
PyErr_Format(PyExc_ValueError,
@@ -20994,8 +21727,13 @@ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
(index == 1) ? "" : "s");
}
-static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void) {
- PyErr_SetString(PyExc_ValueError, "too many values to unpack");
+static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
+ PyErr_Format(PyExc_ValueError,
+ #if PY_VERSION_HEX < 0x02050000
+ "too many values to unpack (expected %d)", (int)expected);
+ #else
+ "too many values to unpack (expected %zd)", expected);
+ #endif
}
static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) {
@@ -21008,11 +21746,11 @@ static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) {
return item;
}
-static int __Pyx_EndUnpack(PyObject *iter) {
+static int __Pyx_EndUnpack(PyObject *iter, Py_ssize_t expected) {
PyObject *item;
if ((item = PyIter_Next(iter))) {
Py_DECREF(item);
- __Pyx_RaiseTooManyValuesError();
+ __Pyx_RaiseTooManyValuesError(expected);
return -1;
}
else if (!PyErr_Occurred())
@@ -21139,14 +21877,14 @@ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb)
}
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
- PyObject *__import__ = 0;
+ PyObject *py_import = 0;
PyObject *empty_list = 0;
PyObject *module = 0;
PyObject *global_dict = 0;
PyObject *empty_dict = 0;
PyObject *list;
- __import__ = __Pyx_GetAttrString(__pyx_b, "__import__");
- if (!__import__)
+ py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
+ if (!py_import)
goto bad;
if (from_list)
list = from_list;
@@ -21162,160 +21900,15 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
empty_dict = PyDict_New();
if (!empty_dict)
goto bad;
- module = PyObject_CallFunctionObjArgs(__import__,
+ module = PyObject_CallFunctionObjArgs(py_import,
name, global_dict, empty_dict, list, NULL);
bad:
Py_XDECREF(empty_list);
- Py_XDECREF(__import__);
+ Py_XDECREF(py_import);
Py_XDECREF(empty_dict);
return module;
}
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
- PyObject *result;
- result = PyObject_GetAttr(dict, name);
- if (!result)
- PyErr_SetObject(PyExc_NameError, name);
- return result;
-}
-
-static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
- PyObject *tmp_type, *tmp_value, *tmp_tb;
- PyThreadState *tstate = PyThreadState_GET();
-
- tmp_type = tstate->curexc_type;
- tmp_value = tstate->curexc_value;
- tmp_tb = tstate->curexc_traceback;
- tstate->curexc_type = type;
- tstate->curexc_value = value;
- tstate->curexc_traceback = tb;
- Py_XDECREF(tmp_type);
- Py_XDECREF(tmp_value);
- Py_XDECREF(tmp_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;
- *tb = tstate->curexc_traceback;
-
- tstate->curexc_type = 0;
- tstate->curexc_value = 0;
- tstate->curexc_traceback = 0;
-}
-
-
-#if PY_MAJOR_VERSION < 3
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
- Py_XINCREF(type);
- Py_XINCREF(value);
- Py_XINCREF(tb);
- /* First, check the traceback argument, replacing None with NULL. */
- if (tb == Py_None) {
- Py_DECREF(tb);
- tb = 0;
- }
- else if (tb != NULL && !PyTraceBack_Check(tb)) {
- PyErr_SetString(PyExc_TypeError,
- "raise: arg 3 must be a traceback or None");
- goto raise_error;
- }
- /* Next, replace a missing value with None */
- if (value == NULL) {
- value = Py_None;
- Py_INCREF(value);
- }
- #if PY_VERSION_HEX < 0x02050000
- if (!PyClass_Check(type))
- #else
- if (!PyType_Check(type))
- #endif
- {
- /* Raising an instance. The value should be a dummy. */
- if (value != Py_None) {
- PyErr_SetString(PyExc_TypeError,
- "instance exception may not have a separate value");
- goto raise_error;
- }
- /* Normalize to raise <class>, <instance> */
- Py_DECREF(value);
- value = type;
- #if PY_VERSION_HEX < 0x02050000
- if (PyInstance_Check(type)) {
- type = (PyObject*) ((PyInstanceObject*)type)->in_class;
- Py_INCREF(type);
- }
- else {
- type = 0;
- PyErr_SetString(PyExc_TypeError,
- "raise: exception must be an old-style class or instance");
- goto raise_error;
- }
- #else
- type = (PyObject*) Py_TYPE(type);
- Py_INCREF(type);
- if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
- PyErr_SetString(PyExc_TypeError,
- "raise: exception class must be a subclass of BaseException");
- goto raise_error;
- }
- #endif
- }
-
- __Pyx_ErrRestore(type, value, tb);
- return;
-raise_error:
- Py_XDECREF(value);
- Py_XDECREF(type);
- Py_XDECREF(tb);
- return;
-}
-
-#else /* Python 3+ */
-
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
- if (tb == Py_None) {
- tb = 0;
- } else if (tb && !PyTraceBack_Check(tb)) {
- PyErr_SetString(PyExc_TypeError,
- "raise: arg 3 must be a traceback or None");
- goto bad;
- }
- if (value == Py_None)
- value = 0;
-
- if (PyExceptionInstance_Check(type)) {
- if (value) {
- PyErr_SetString(PyExc_TypeError,
- "instance exception may not have a separate value");
- goto bad;
- }
- value = type;
- type = (PyObject*) Py_TYPE(value);
- } else if (!PyExceptionClass_Check(type)) {
- PyErr_SetString(PyExc_TypeError,
- "raise: exception class must be a subclass of BaseException");
- goto bad;
- }
-
- PyErr_SetObject(type, value);
-
- if (tb) {
- PyThreadState *tstate = PyThreadState_GET();
- PyObject* tmp_tb = tstate->curexc_traceback;
- if (tb != tmp_tb) {
- Py_INCREF(tb);
- tstate->curexc_traceback = tb;
- Py_XDECREF(tmp_tb);
- }
- }
-
-bad:
- return;
-}
-#endif
-
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;
@@ -21487,6 +22080,25 @@ static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
return (signed int)__Pyx_PyInt_AsSignedLong(x);
}
+static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
+ const int neg_one = (int)-1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (sizeof(int) < sizeof(long)) {
+ long val = __Pyx_PyInt_AsLong(x);
+ if (unlikely(val != (long)(int)val)) {
+ if (!unlikely(val == -1 && PyErr_Occurred())) {
+ PyErr_SetString(PyExc_OverflowError,
+ (is_unsigned && unlikely(val < 0)) ?
+ "can't convert negative value to int" :
+ "value too large to convert to int");
+ }
+ return (int)-1;
+ }
+ return (int)val;
+ }
+ return (int)__Pyx_PyInt_AsLong(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;
@@ -21725,19 +22337,23 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
if (!result)
goto bad;
if (!PyType_Check(result)) {
- PyErr_Format(PyExc_TypeError,
+ PyErr_Format(PyExc_TypeError,
"%s.%s is not a type object",
module_name, class_name);
goto bad;
}
if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) {
- PyOS_snprintf(warning, sizeof(warning),
+ PyOS_snprintf(warning, sizeof(warning),
"%s.%s size changed, may indicate binary incompatibility",
module_name, class_name);
+ #if PY_VERSION_HEX < 0x02050000
+ PyErr_Warn(NULL, warning);
+ #else
PyErr_WarnEx(NULL, warning, 0);
+ #endif
}
else if (((PyTypeObject *)result)->tp_basicsize != size) {
- PyErr_Format(PyExc_ValueError,
+ PyErr_Format(PyExc_ValueError,
"%s.%s has the wrong size, try recompiling",
module_name, class_name);
goto bad;
@@ -21875,8 +22491,8 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
/* Type Conversion Functions */
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;
+ int is_true = x == Py_True;
+ if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
else return PyObject_IsTrue(x);
}
diff --git a/numpy/random/mtrand/mtrand.pyx b/numpy/random/mtrand/mtrand.pyx
index 6b5067de5..13c743cd3 100644
--- a/numpy/random/mtrand/mtrand.pyx
+++ b/numpy/random/mtrand/mtrand.pyx
@@ -553,6 +553,7 @@ cdef class RandomState:
"""
cdef rk_state *internal_state
+ poisson_lam_max = np.iinfo('l').max - np.sqrt(np.iinfo('l').max)*10
def __init__(self, seed=None):
self.internal_state = <rk_state*>PyMem_Malloc(sizeof(rk_state))
@@ -3467,6 +3468,10 @@ cdef class RandomState:
distribution :math:`f(k; \\lambda)` describes the probability of
:math:`k` events occurring within the observed interval :math:`\\lambda`.
+ Because the output is limited to the range of the C long type, a
+ ValueError is raised when `lam` is within 10 sigma of the maximum
+ representable value.
+
References
----------
.. [1] Weisstein, Eric W. "Poisson Distribution." From MathWorld--A Wolfram
@@ -3494,6 +3499,8 @@ cdef class RandomState:
if not PyErr_Occurred():
if lam < 0:
raise ValueError("lam < 0")
+ if lam > self.poisson_lam_max:
+ raise ValueError("lam value too large")
return discd_array_sc(self.internal_state, rk_poisson, size, flam)
PyErr_Clear()
@@ -3501,6 +3508,8 @@ cdef class RandomState:
olam = <ndarray>PyArray_FROM_OTF(lam, NPY_DOUBLE, NPY_ALIGNED)
if np.any(np.less(olam, 0)):
raise ValueError("lam < 0")
+ if np.any(np.greater(olam, self.poisson_lam_max)):
+ raise ValueError("lam value too large.")
return discd_array(self.internal_state, rk_poisson, size, olam)
def zipf(self, a, size=None):
diff --git a/numpy/random/tests/test_random.py b/numpy/random/tests/test_random.py
index 82216f135..81e3eee1e 100644
--- a/numpy/random/tests/test_random.py
+++ b/numpy/random/tests/test_random.py
@@ -1,5 +1,7 @@
-from numpy.testing import TestCase, run_module_suite, assert_
+from numpy.testing import TestCase, run_module_suite, assert_,\
+ assert_raises
from numpy import random
+from numpy.compat import asbytes
import numpy as np
@@ -67,6 +69,370 @@ class TestSetState(TestCase):
"""
self.prng.negative_binomial(0.5, 0.5)
+class TestRandomDist(TestCase):
+ """ Make sure the random distrobution return the correct value for a
+ given seed
+ """
+ def setUp(self):
+ self.seed = 1234567890
+
+ def test_rand(self):
+ np.random.seed(self.seed)
+ actual = np.random.rand(3, 2)
+ desired = np.array([[ 0.61879477158567997, 0.59162362775974664],
+ [ 0.88868358904449662, 0.89165480011560816],
+ [ 0.4575674820298663 , 0.7781880808593471 ]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_randn(self):
+ np.random.seed(self.seed)
+ actual = np.random.randn(3, 2)
+ desired = np.array([[ 1.34016345771863121, 1.73759122771936081],
+ [ 1.498988344300628 , -0.2286433324536169 ],
+ [ 2.031033998682787 , 2.17032494605655257]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_randint(self):
+ np.random.seed(self.seed)
+ actual = np.random.randint(-99, 99, size=(3,2))
+ desired = np.array([[ 31, 3],
+ [-52, 41],
+ [-48, -66]])
+ np.testing.assert_array_equal(actual, desired)
+
+ def test_random_integers(self):
+ np.random.seed(self.seed)
+ actual = np.random.random_integers(-99, 99, size=(3,2))
+ desired = np.array([[ 31, 3],
+ [-52, 41],
+ [-48, -66]])
+ np.testing.assert_array_equal(actual, desired)
+
+ def test_random_sample(self):
+ np.random.seed(self.seed)
+ actual = np.random.random_sample((3, 2))
+ desired = np.array([[ 0.61879477158567997, 0.59162362775974664],
+ [ 0.88868358904449662, 0.89165480011560816],
+ [ 0.4575674820298663 , 0.7781880808593471 ]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_bytes(self):
+ np.random.seed(self.seed)
+ actual = np.random.bytes(10)
+ desired = asbytes('\x82Ui\x9e\xff\x97+Wf\xa5')
+ np.testing.assert_equal(actual, desired)
+
+ def test_shuffle(self):
+ np.random.seed(self.seed)
+ alist = [1,2,3,4,5,6,7,8,9,0]
+ np.random.shuffle(alist)
+ actual = alist
+ desired = [0, 1, 9, 6, 2, 4, 5, 8, 7, 3]
+ np.testing.assert_array_equal(actual, desired)
+
+ def test_beta(self):
+ np.random.seed(self.seed)
+ actual = np.random.beta(.1, .9, size=(3, 2))
+ desired = np.array([[ 1.45341850513746058e-02, 5.31297615662868145e-04],
+ [ 1.85366619058432324e-06, 4.19214516800110563e-03],
+ [ 1.58405155108498093e-04, 1.26252891949397652e-04]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_binomial(self):
+ np.random.seed(self.seed)
+ actual = np.random.binomial(100.123, .456, size=(3, 2))
+ desired = np.array([[37, 43],
+ [42, 48],
+ [46, 45]])
+ np.testing.assert_array_equal(actual, desired)
+
+ def test_chisquare(self):
+ np.random.seed(self.seed)
+ actual = np.random.chisquare(50, size=(3, 2))
+ desired = np.array([[ 63.87858175501090585, 68.68407748911370447],
+ [ 65.77116116901505904, 47.09686762438974483],
+ [ 72.3828403199695174 , 74.18408615260374006]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_dirichlet(self):
+ np.random.seed(self.seed)
+ alpha = np.array([51.72840233779265162, 39.74494232180943953])
+ actual = np.random.mtrand.dirichlet(alpha, size=(3, 2))
+ desired = np.array([[[ 0.54539444573611562, 0.45460555426388438],
+ [ 0.62345816822039413, 0.37654183177960598]],
+ [[ 0.55206000085785778, 0.44793999914214233],
+ [ 0.58964023305154301, 0.41035976694845688]],
+ [[ 0.59266909280647828, 0.40733090719352177],
+ [ 0.56974431743975207, 0.43025568256024799]]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_exponential(self):
+ np.random.seed(self.seed)
+ actual = np.random.exponential(1.1234, size=(3, 2))
+ desired = np.array([[ 1.08342649775011624, 1.00607889924557314],
+ [ 2.46628830085216721, 2.49668106809923884],
+ [ 0.68717433461363442, 1.69175666993575979]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_f(self):
+ np.random.seed(self.seed)
+ actual = np.random.f(12, 77, size=(3, 2))
+ desired = np.array([[ 1.21975394418575878, 1.75135759791559775],
+ [ 1.44803115017146489, 1.22108959480396262],
+ [ 1.02176975757740629, 1.34431827623300415]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_gamma(self):
+ np.random.seed(self.seed)
+ actual = np.random.gamma(5, 3, size=(3, 2))
+ desired = np.array([[ 24.60509188649287182, 28.54993563207210627],
+ [ 26.13476110204064184, 12.56988482927716078],
+ [ 31.71863275789960568, 33.30143302795922011]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_geometric(self):
+ np.random.seed(self.seed)
+ actual = np.random.geometric(.123456789, size=(3, 2))
+ desired = np.array([[ 8, 7],
+ [17, 17],
+ [ 5, 12]])
+ np.testing.assert_array_equal(actual, desired)
+
+ def test_gumbel(self):
+ np.random.seed(self.seed)
+ actual = np.random.gumbel(loc = .123456789, scale = 2.0, size = (3, 2))
+ desired = np.array([[ 0.19591898743416816, 0.34405539668096674],
+ [-1.4492522252274278 , -1.47374816298446865],
+ [ 1.10651090478803416, -0.69535848626236174]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_hypergeometric(self):
+ np.random.seed(self.seed)
+ actual = np.random.hypergeometric(10.1, 5.5, 14, size=(3, 2))
+ desired = np.array([[10, 10],
+ [10, 10],
+ [ 9, 9]])
+ np.testing.assert_array_equal(actual, desired)
+
+ def test_laplace(self):
+ np.random.seed(self.seed)
+ actual = np.random.laplace(loc=.123456789, scale=2.0, size=(3, 2))
+ desired = np.array([[ 0.66599721112760157, 0.52829452552221945],
+ [ 3.12791959514407125, 3.18202813572992005],
+ [-0.05391065675859356, 1.74901336242837324]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_logistic(self):
+ np.random.seed(self.seed)
+ actual = np.random.logistic(loc=.123456789, scale=2.0, size=(3, 2))
+ desired = np.array([[ 1.09232835305011444, 0.8648196662399954 ],
+ [ 4.27818590694950185, 4.33897006346929714],
+ [-0.21682183359214885, 2.63373365386060332]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_lognormal(self):
+ np.random.seed(self.seed)
+ actual = np.random.lognormal(mean=.123456789, sigma=2.0, size=(3, 2))
+ desired = np.array([[ 16.50698631688883822, 36.54846706092654784],
+ [ 22.67886599981281748, 0.71617561058995771],
+ [ 65.72798501792723869, 86.84341601437161273]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_logseries(self):
+ np.random.seed(self.seed)
+ actual = np.random.logseries(p=.923456789, size=(3, 2))
+ desired = np.array([[ 2, 2],
+ [ 6, 17],
+ [ 3, 6]])
+ np.testing.assert_array_equal(actual, desired)
+
+ def test_multinomial(self):
+ np.random.seed(self.seed)
+ actual = np.random.multinomial(20, [1/6.]*6, size=(3, 2))
+ desired = np.array([[[4, 3, 5, 4, 2, 2],
+ [5, 2, 8, 2, 2, 1]],
+ [[3, 4, 3, 6, 0, 4],
+ [2, 1, 4, 3, 6, 4]],
+ [[4, 4, 2, 5, 2, 3],
+ [4, 3, 4, 2, 3, 4]]])
+ np.testing.assert_array_equal(actual, desired)
+
+ def test_multivariate_normal(self):
+ np.random.seed(self.seed)
+ mean= (.123456789, 10)
+ cov = [[1,0],[1,0]]
+ size = (3, 2)
+ actual = np.random.multivariate_normal(mean, cov, size)
+ desired = np.array([[[ -1.47027513018564449, 10. ],
+ [ -1.65915081534845532, 10. ]],
+ [[ -2.29186329304599745, 10. ],
+ [ -1.77505606019580053, 10. ]],
+ [[ -0.54970369430044119, 10. ],
+ [ 0.29768848031692957, 10. ]]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_negative_binomial(self):
+ np.random.seed(self.seed)
+ actual = np.random.negative_binomial(n = 100, p = .12345, size = (3, 2))
+ desired = np.array([[848, 841],
+ [892, 611],
+ [779, 647]])
+ np.testing.assert_array_equal(actual, desired)
+
+ def test_noncentral_chisquare(self):
+ np.random.seed(self.seed)
+ actual = np.random.noncentral_chisquare(df = 5, nonc = 5, size = (3, 2))
+ desired = np.array([[ 23.91905354498517511, 13.35324692733826346],
+ [ 31.22452661329736401, 16.60047399466177254],
+ [ 5.03461598262724586, 17.94973089023519464]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_noncentral_f(self):
+ np.random.seed(self.seed)
+ actual = np.random.noncentral_f(dfnum = 5, dfden = 2, nonc = 1,
+ size = (3, 2))
+ desired = np.array([[ 1.40598099674926669, 0.34207973179285761],
+ [ 3.57715069265772545, 7.92632662577829805],
+ [ 0.43741599463544162, 1.1774208752428319 ]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_normal(self):
+ np.random.seed(self.seed)
+ actual = np.random.normal(loc = .123456789, scale = 2.0, size = (3, 2))
+ desired = np.array([[ 2.80378370443726244, 3.59863924443872163],
+ [ 3.121433477601256 , -0.33382987590723379],
+ [ 4.18552478636557357, 4.46410668111310471]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_pareto(self):
+ np.random.seed(self.seed)
+ actual = np.random.pareto(a =.123456789, size = (3, 2))
+ desired = np.array([[ 2.46852460439034849e+03, 1.41286880810518346e+03],
+ [ 5.28287797029485181e+07, 6.57720981047328785e+07],
+ [ 1.40840323350391515e+02, 1.98390255135251704e+05]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_poisson(self):
+ np.random.seed(self.seed)
+ actual = np.random.poisson(lam = .123456789, size=(3, 2))
+ desired = np.array([[0, 0],
+ [1, 0],
+ [0, 0]])
+ np.testing.assert_array_equal(actual, desired)
+
+ def test_poisson_exceptions(self):
+ lambig = np.iinfo('l').max
+ lamneg = -1
+ assert_raises(ValueError, np.random.poisson, lamneg)
+ assert_raises(ValueError, np.random.poisson, [lamneg]*10)
+ assert_raises(ValueError, np.random.poisson, lambig)
+ assert_raises(ValueError, np.random.poisson, [lambig]*10)
+
+ def test_power(self):
+ np.random.seed(self.seed)
+ actual = np.random.power(a =.123456789, size = (3, 2))
+ desired = np.array([[ 0.02048932883240791, 0.01424192241128213],
+ [ 0.38446073748535298, 0.39499689943484395],
+ [ 0.00177699707563439, 0.13115505880863756]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_rayleigh(self):
+ np.random.seed(self.seed)
+ actual = np.random.rayleigh(scale = 10, size = (3, 2))
+ desired = np.array([[ 13.8882496494248393 , 13.383318339044731 ],
+ [ 20.95413364294492098, 21.08285015800712614],
+ [ 11.06066537006854311, 17.35468505778271009]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_standard_cauchy(self):
+ np.random.seed(self.seed)
+ actual = np.random.standard_cauchy(size = (3, 2))
+ desired = np.array([[ 0.77127660196445336, -6.55601161955910605],
+ [ 0.93582023391158309, -2.07479293013759447],
+ [-4.74601644297011926, 0.18338989290760804]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_standard_exponential(self):
+ np.random.seed(self.seed)
+ actual = np.random.standard_exponential(size = (3, 2))
+ desired = np.array([[ 0.96441739162374596, 0.89556604882105506],
+ [ 2.1953785836319808 , 2.22243285392490542],
+ [ 0.6116915921431676 , 1.50592546727413201]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_standard_gamma(self):
+ np.random.seed(self.seed)
+ actual = np.random.standard_gamma(shape = 3, size = (3, 2))
+ desired = np.array([[ 5.50841531318455058, 6.62953470301903103],
+ [ 5.93988484943779227, 2.31044849402133989],
+ [ 7.54838614231317084, 8.012756093271868 ]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_standard_normal(self):
+ np.random.seed(self.seed)
+ actual = np.random.standard_normal(size = (3, 2))
+ desired = np.array([[ 1.34016345771863121, 1.73759122771936081],
+ [ 1.498988344300628 , -0.2286433324536169 ],
+ [ 2.031033998682787 , 2.17032494605655257]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_standard_t(self):
+ np.random.seed(self.seed)
+ actual = np.random.standard_t(df = 10, size = (3, 2))
+ desired = np.array([[ 0.97140611862659965, -0.08830486548450577],
+ [ 1.36311143689505321, -0.55317463909867071],
+ [-0.18473749069684214, 0.61181537341755321]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_triangular(self):
+ np.random.seed(self.seed)
+ actual = np.random.triangular(left = 5.12, mode = 10.23, right = 20.34,
+ size = (3, 2))
+ desired = np.array([[ 12.68117178949215784, 12.4129206149193152 ],
+ [ 16.20131377335158263, 16.25692138747600524],
+ [ 11.20400690911820263, 14.4978144835829923 ]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_uniform(self):
+ np.random.seed(self.seed)
+ actual = np.random.uniform(low = 1.23, high=10.54, size = (3, 2))
+ desired = np.array([[ 6.99097932346268003, 6.73801597444323974],
+ [ 9.50364421400426274, 9.53130618907631089],
+ [ 5.48995325769805476, 8.47493103280052118]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+
+ def test_vonmises(self):
+ np.random.seed(self.seed)
+ actual = np.random.vonmises(mu = 1.23, kappa = 1.54, size = (3, 2))
+ desired = np.array([[ 2.28567572673902042, 2.89163838442285037],
+ [ 0.38198375564286025, 2.57638023113890746],
+ [ 1.19153771588353052, 1.83509849681825354]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_wald(self):
+ np.random.seed(self.seed)
+ actual = np.random.wald(mean = 1.23, scale = 1.54, size = (3, 2))
+ desired = np.array([[ 3.82935265715889983, 5.13125249184285526],
+ [ 0.35045403618358717, 1.50832396872003538],
+ [ 0.24124319895843183, 0.22031101461955038]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_weibull(self):
+ np.random.seed(self.seed)
+ actual = np.random.weibull(a = 1.23, size = (3, 2))
+ desired = np.array([[ 0.97097342648766727, 0.91422896443565516],
+ [ 1.89517770034962929, 1.91414357960479564],
+ [ 0.67057783752390987, 1.39494046635066793]])
+ np.testing.assert_array_almost_equal(actual, desired, decimal=15)
+
+ def test_zipf(self):
+ np.random.seed(self.seed)
+ actual = np.random.zipf(a = 1.23, size = (3, 2))
+ desired = np.array([[66, 29],
+ [ 1, 1],
+ [ 3, 13]])
+ np.testing.assert_array_equal(actual, desired)
if __name__ == "__main__":
run_module_suite()
diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py
index 9798a25be..067782dc0 100644
--- a/numpy/testing/tests/test_utils.py
+++ b/numpy/testing/tests/test_utils.py
@@ -189,6 +189,13 @@ class TestArrayAlmostEqual(_GenericTest, unittest.TestCase):
self.assertRaises(AssertionError,
lambda : self._assert_func(ainf, anan))
+ def test_inf(self):
+ a = np.array([[1., 2.], [3., 4.]])
+ b = a.copy()
+ a[0,0] = np.inf
+ self.assertRaises(AssertionError,
+ lambda : self._assert_func(a, b))
+
class TestAlmostEqual(_GenericTest, unittest.TestCase):
def setUp(self):
self._assert_func = assert_almost_equal
@@ -205,6 +212,8 @@ class TestAlmostEqual(_GenericTest, unittest.TestCase):
def test_inf_item(self):
self._assert_func(np.inf, np.inf)
self._assert_func(-np.inf, -np.inf)
+ self.assertRaises(AssertionError,
+ lambda : self._assert_func(np.inf, 1))
def test_simple_item(self):
self._test_not_equal(1, 2)
diff --git a/numpy/testing/utils.py b/numpy/testing/utils.py
index e4ef9d3cb..01ce31c4a 100644
--- a/numpy/testing/utils.py
+++ b/numpy/testing/utils.py
@@ -205,25 +205,25 @@ def assert_equal(actual,desired,err_msg='',verbose=True):
"""
Raise an assertion if two objects are not equal.
- Given two objects (lists, tuples, dictionaries or numpy arrays), check
- that all elements of these objects are equal. An exception is raised at
- the first conflicting values.
+ Given two objects (scalars, lists, tuples, dictionaries or numpy arrays),
+ check that all elements of these objects are equal. An exception is raised
+ at the first conflicting values.
Parameters
----------
- actual : list, tuple, dict or ndarray
- The object to check.
- desired : list, tuple, dict or ndarray
- The expected object.
- 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.
+ actual : array_like
+ The object to check.
+ desired : array_like
+ The expected object.
+ err_msg : str, optional
+ The error message to be printed in case of failure.
+ verbose : bool, optional
+ If True, the conflicting values are appended to the error message.
Raises
------
AssertionError
- If actual and desired are not equal.
+ If actual and desired are not equal.
Examples
--------
@@ -357,7 +357,12 @@ def assert_almost_equal(actual,desired,decimal=7,err_msg='',verbose=True):
"""
Raise an assertion if two items are not equal up to desired precision.
- The test is equivalent to abs(desired-actual) < 0.5 * 10**(-decimal)
+ .. note:: It is recommended to use one of `assert_allclose`,
+ `assert_array_almost_equal_nulp` or `assert_array_max_ulp`
+ instead of this function for more consistent floating point
+ comparisons.
+
+ The test is equivalent to ``abs(desired-actual) < 0.5 * 10**(-decimal)``.
Given two objects (numbers or ndarrays), check that all elements of these
objects are almost equal. An exception is raised at conflicting values.
@@ -365,16 +370,16 @@ def assert_almost_equal(actual,desired,decimal=7,err_msg='',verbose=True):
Parameters
----------
- actual : number or ndarray
- The object to check.
- desired : number or ndarray
- The expected object.
- decimal : integer (decimal=7)
- desired precision
- 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.
+ actual : array_like
+ The object to check.
+ desired : array_like
+ The expected object.
+ decimal : int, optional
+ Desired precision, default is 7.
+ err_msg : str, optional
+ The error message to be printed in case of failure.
+ verbose : bool, optional
+ If True, the conflicting values are appended to the error message.
Raises
------
@@ -383,9 +388,9 @@ def assert_almost_equal(actual,desired,decimal=7,err_msg='',verbose=True):
See Also
--------
- assert_array_almost_equal: compares array_like objects
- assert_equal: tests objects for equality
-
+ assert_allclose: Compare two array_like objects for equality with desired
+ relative and/or absolute precision.
+ assert_array_almost_equal_nulp, assert_array_max_ulp, assert_equal
Examples
--------
@@ -399,7 +404,7 @@ def assert_almost_equal(actual,desired,decimal=7,err_msg='',verbose=True):
DESIRED: 2.3333333399999998
>>> npt.assert_almost_equal(np.array([1.0,2.3333333333333]),
- \t\t\tnp.array([1.0,2.33333334]), decimal=9)
+ ... np.array([1.0,2.33333334]), decimal=9)
...
<type 'exceptions.AssertionError'>:
Arrays are not almost equal
@@ -467,22 +472,27 @@ def assert_approx_equal(actual,desired,significant=7,err_msg='',verbose=True):
"""
Raise an assertion if two items are not equal up to significant digits.
+ .. note:: It is recommended to use one of `assert_allclose`,
+ `assert_array_almost_equal_nulp` or `assert_array_max_ulp`
+ instead of this function for more consistent floating point
+ comparisons.
+
Given two numbers, check that they are approximately equal.
Approximately equal is defined as the number of significant digits
that agree.
Parameters
----------
- actual : number
- The object to check.
- desired : number
- The expected object.
- significant : integer (significant=7)
- desired precision
- 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.
+ actual : scalar
+ The object to check.
+ desired : scalar
+ The expected object.
+ significant : int, optional
+ Desired precision, default is 7.
+ err_msg : str, optional
+ The error message to be printed in case of failure.
+ verbose : bool, optional
+ If True, the conflicting values are appended to the error message.
Raises
------
@@ -491,10 +501,9 @@ def assert_approx_equal(actual,desired,significant=7,err_msg='',verbose=True):
See Also
--------
- assert_almost_equal: compares objects by decimals
- assert_array_almost_equal: compares array_like objects by decimals
- assert_equal: tests objects for equality
-
+ assert_allclose: Compare two array_like objects for equality with desired
+ relative and/or absolute precision.
+ assert_array_almost_equal_nulp, assert_array_max_ulp, assert_equal
Examples
--------
@@ -559,13 +568,25 @@ def assert_approx_equal(actual,desired,significant=7,err_msg='',verbose=True):
def assert_array_compare(comparison, x, y, err_msg='', verbose=True,
header=''):
- from numpy.core import array, isnan, any
+ from numpy.core import array, isnan, isinf, any
x = array(x, copy=False, subok=True)
y = array(y, copy=False, subok=True)
def isnumber(x):
return x.dtype.char in '?bhilqpBHILQPfdgFDG'
+ def chk_same_position(x_id, y_id, hasval='nan'):
+ """Handling nan/inf: check that x and y have the nan/inf at the same
+ locations."""
+ try:
+ assert_array_equal(x_id, y_id)
+ except AssertionError:
+ msg = build_err_msg([x, y],
+ err_msg + '\nx and y %s location mismatch:' \
+ % (hasval), verbose=verbose, header=header,
+ names=('x', 'y'))
+ raise AssertionError(msg)
+
try:
cond = (x.shape==() or y.shape==()) or x.shape == y.shape
if not cond:
@@ -579,27 +600,24 @@ def assert_array_compare(comparison, x, y, err_msg='', verbose=True,
raise AssertionError(msg)
if (isnumber(x) and isnumber(y)) and (any(isnan(x)) or any(isnan(y))):
- # Handling nan: we first check that x and y have the nan at the
- # same locations, and then we mask the nan and do the comparison as
- # usual.
- xnanid = isnan(x)
- ynanid = isnan(y)
- try:
- assert_array_equal(xnanid, ynanid)
- except AssertionError:
- msg = build_err_msg([x, y],
- err_msg
- + '\n(x and y nan location mismatch %s, ' \
- '%s mismatch)' % (xnanid, ynanid),
- verbose=verbose, header=header,
- names=('x', 'y'))
- raise AssertionError(msg)
+ x_id = isnan(x)
+ y_id = isnan(y)
+ chk_same_position(x_id, y_id, hasval='nan')
# If only one item, it was a nan, so just return
if x.size == y.size == 1:
return
- val = comparison(x[~xnanid], y[~ynanid])
+ val = comparison(x[~x_id], y[~y_id])
+ elif (isnumber(x) and isnumber(y)) and (any(isinf(x)) or any(isinf(y))):
+ x_id = isinf(x)
+ y_id = isinf(y)
+ chk_same_position(x_id, y_id, hasval='inf')
+ # If only one item, it was a inf, so just return
+ if x.size == y.size == 1:
+ return
+ val = comparison(x[~x_id], y[~y_id])
else:
val = comparison(x,y)
+
if isinstance(val, bool):
cond = val
reduced = [0]
@@ -638,36 +656,36 @@ def assert_array_equal(x, y, err_msg='', verbose=True):
Parameters
----------
x : array_like
- The actual object to check.
+ The actual object to check.
y : array_like
- The desired, expected object.
- err_msg : string
- The error message to be printed in case of failure.
- verbose : bool
+ The desired, expected object.
+ err_msg : str, optional
+ The error message to be printed in case of failure.
+ verbose : bool, optional
If True, the conflicting values are appended to the error message.
Raises
------
AssertionError
- If actual and desired objects are not equal.
+ If actual and desired objects are not equal.
See Also
--------
- assert_array_almost_equal: test objects for equality up to precision
- assert_equal: tests objects for equality
-
+ assert_allclose: Compare two array_like objects for equality with desired
+ relative and/or absolute precision.
+ assert_array_almost_equal_nulp, assert_array_max_ulp, assert_equal
Examples
--------
- the first assert does not raise an exception
+ The first assert does not raise an exception:
>>> np.testing.assert_array_equal([1.0,2.33333,np.nan],
- \t\t\t[np.exp(0),2.33333, np.nan])
+ ... [np.exp(0),2.33333, np.nan])
- assert fails with numerical inprecision with floats
+ Assert fails with numerical inprecision with floats:
>>> np.testing.assert_array_equal([1.0,np.pi,np.nan],
- \t\t\t[1, np.sqrt(np.pi)**2, np.nan])
+ ... [1, np.sqrt(np.pi)**2, np.nan])
...
<type 'exceptions.ValueError'>:
AssertionError:
@@ -677,10 +695,12 @@ def assert_array_equal(x, y, err_msg='', verbose=True):
x: array([ 1. , 3.14159265, NaN])
y: array([ 1. , 3.14159265, NaN])
- use assert_array_almost_equal for these cases instead
+ Use `assert_allclose` or one of the nulp (number of floating point values)
+ functions for these cases instead:
- >>> np.testing.assert_array_almost_equal([1.0,np.pi,np.nan],
- \t\t\t[1, np.sqrt(np.pi)**2, np.nan], decimal=15)
+ >>> np.testing.assert_allclose([1.0,np.pi,np.nan],
+ ... [1, np.sqrt(np.pi)**2, np.nan],
+ ... rtol=1e-10, atol=0)
"""
assert_array_compare(operator.__eq__, x, y, err_msg=err_msg,
@@ -690,8 +710,13 @@ def assert_array_almost_equal(x, y, decimal=6, err_msg='', verbose=True):
"""
Raise an assertion if two objects are not equal up to desired precision.
+ .. note:: It is recommended to use one of `assert_allclose`,
+ `assert_array_almost_equal_nulp` or `assert_array_max_ulp`
+ instead of this function for more consistent floating point
+ comparisons.
+
The test verifies identical shapes and verifies values with
- abs(desired-actual) < 0.5 * 10**(-decimal)
+ ``abs(desired-actual) < 0.5 * 10**(-decimal)``.
Given two array_like objects, check that the shape is equal and all
elements of these objects are almost equal. An exception is raised at
@@ -702,26 +727,26 @@ def assert_array_almost_equal(x, y, decimal=6, err_msg='', verbose=True):
Parameters
----------
x : array_like
- The actual object to check.
+ The actual object to check.
y : array_like
- The desired, expected object.
- decimal : integer (decimal=6)
- desired precision
- err_msg : string
+ The desired, expected object.
+ decimal : int, optional
+ Desired precision, default is 6.
+ err_msg : str, optional
The error message to be printed in case of failure.
- verbose : bool
+ verbose : bool, optional
If True, the conflicting values are appended to the error message.
Raises
------
AssertionError
- If actual and desired are not equal up to specified precision.
+ If actual and desired are not equal up to specified precision.
See Also
--------
- assert_almost_equal: simple version for comparing numbers
- assert_array_equal: tests objects for equality
-
+ assert_allclose: Compare two array_like objects for equality with desired
+ relative and/or absolute precision.
+ assert_array_almost_equal_nulp, assert_array_max_ulp, assert_equal
Examples
--------
@@ -731,7 +756,7 @@ def assert_array_almost_equal(x, y, decimal=6, err_msg='', verbose=True):
[1.0,2.333,np.nan])
>>> np.testing.assert_array_almost_equal([1.0,2.33333,np.nan],
- \t\t\t[1.0,2.33339,np.nan], decimal=5)
+ ... [1.0,2.33339,np.nan], decimal=5)
...
<type 'exceptions.AssertionError'>:
AssertionError:
@@ -742,7 +767,7 @@ def assert_array_almost_equal(x, y, decimal=6, err_msg='', verbose=True):
y: array([ 1. , 2.33339, NaN])
>>> np.testing.assert_array_almost_equal([1.0,2.33333,np.nan],
- \t\t\t[1.0,2.33333, 5], decimal=5)
+ ... [1.0,2.33333, 5], decimal=5)
<type 'exceptions.ValueError'>:
ValueError:
Arrays are not almost equal
@@ -1099,21 +1124,23 @@ def assert_allclose(actual, desired, rtol=1e-7, atol=0,
"""
Raise an assertion if two objects are not equal up to desired tolerance.
- The test is equivalent to ``allclose(actual, desired, rtol, atol)``
+ The test is equivalent to ``allclose(actual, desired, rtol, atol)``.
+ It compares the difference between `actual` and `desired` to
+ ``atol + rtol * abs(desired)``.
Parameters
----------
actual : array_like
Array obtained.
desired : array_like
- Array desired
+ Array desired.
rtol : float, optional
- Relative tolerance
+ Relative tolerance.
atol : float, optional
- Absolute tolerance
- err_msg : string
+ Absolute tolerance.
+ err_msg : str, optional
The error message to be printed in case of failure.
- verbose : bool
+ verbose : bool, optional
If True, the conflicting values are appended to the error message.
Raises
@@ -1121,6 +1148,16 @@ def assert_allclose(actual, desired, rtol=1e-7, atol=0,
AssertionError
If actual and desired are not equal up to specified precision.
+ See Also
+ --------
+ assert_array_almost_equal_nulp, assert_array_max_ulp
+
+ Examples
+ --------
+ >>> x = [1e-5, 1e-3, 1e-1]
+ >>> y = np.arccos(np.cos(x))
+ >>> assert_allclose(x, y, rtol=1e-5, atol=0)
+
"""
import numpy as np
def compare(x, y):
@@ -1236,7 +1273,7 @@ def assert_array_max_ulp(a, b, maxulp=1, dtype=None):
return ret
def nulp_diff(x, y, dtype=None):
- """For each item in x and y, eeturn the number of representable floating
+ """For each item in x and y, return the number of representable floating
points between them.
Parameters