| 1 | --- numpy/random/mtrand/mtrand.old.c 2012-05-19 08:41:41.000000000 -0500 |
| 2 | +++ numpy/random/mtrand/mtrand.c 2012-12-06 15:02:43.000000000 -0600 |
| 3 | @@ -1,16 +1,16 @@ |
| 4 | -/* Generated by Cython 0.15.1 on Tue May 1 15:44:50 2012 */ |
| 5 | +/* Generated by Cython 0.17.1 on Thu Dec 6 15:02:42 2012 */ |
| 6 | |
| 7 | #define PY_SSIZE_T_CLEAN |
| 8 | #include "Python.h" |
| 9 | #ifndef Py_PYTHON_H |
| 10 | #error Python headers needed to compile C extensions, please install development version of Python. |
| 11 | +#elif PY_VERSION_HEX < 0x02040000 |
| 12 | + #error Cython requires Python 2.4+. |
| 13 | #else |
| 14 | - |
| 15 | #include <stddef.h> /* For offsetof */ |
| 16 | #ifndef offsetof |
| 17 | #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) |
| 18 | #endif |
| 19 | - |
| 20 | #if !defined(WIN32) && !defined(MS_WINDOWS) |
| 21 | #ifndef __stdcall |
| 22 | #define __stdcall |
| 23 | @@ -22,36 +22,44 @@ |
| 24 | #define __fastcall |
| 25 | #endif |
| 26 | #endif |
| 27 | - |
| 28 | #ifndef DL_IMPORT |
| 29 | #define DL_IMPORT(t) t |
| 30 | #endif |
| 31 | #ifndef DL_EXPORT |
| 32 | #define DL_EXPORT(t) t |
| 33 | #endif |
| 34 | - |
| 35 | #ifndef PY_LONG_LONG |
| 36 | #define PY_LONG_LONG LONG_LONG |
| 37 | #endif |
| 38 | - |
| 39 | -#if PY_VERSION_HEX < 0x02040000 |
| 40 | - #define METH_COEXIST 0 |
| 41 | - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) |
| 42 | - #define PyDict_Contains(d,o) PySequence_Contains(d,o) |
| 43 | +#ifndef Py_HUGE_VAL |
| 44 | + #define Py_HUGE_VAL HUGE_VAL |
| 45 | +#endif |
| 46 | +#ifdef PYPY_VERSION |
| 47 | +#define CYTHON_COMPILING_IN_PYPY 1 |
| 48 | +#define CYTHON_COMPILING_IN_CPYTHON 0 |
| 49 | +#else |
| 50 | +#define CYTHON_COMPILING_IN_PYPY 0 |
| 51 | +#define CYTHON_COMPILING_IN_CPYTHON 1 |
| 52 | #endif |
| 53 | - |
| 54 | #if PY_VERSION_HEX < 0x02050000 |
| 55 | typedef int Py_ssize_t; |
| 56 | #define PY_SSIZE_T_MAX INT_MAX |
| 57 | #define PY_SSIZE_T_MIN INT_MIN |
| 58 | #define PY_FORMAT_SIZE_T "" |
| 59 | + #define CYTHON_FORMAT_SSIZE_T "" |
| 60 | #define PyInt_FromSsize_t(z) PyInt_FromLong(z) |
| 61 | #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) |
| 62 | - #define PyNumber_Index(o) PyNumber_Int(o) |
| 63 | - #define PyIndex_Check(o) PyNumber_Check(o) |
| 64 | + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ |
| 65 | + (PyErr_Format(PyExc_TypeError, \ |
| 66 | + "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ |
| 67 | + (PyObject*)0)) |
| 68 | + #define PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o)) |
| 69 | #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) |
| 70 | + #define __PYX_BUILD_PY_SSIZE_T "i" |
| 71 | +#else |
| 72 | + #define __PYX_BUILD_PY_SSIZE_T "n" |
| 73 | + #define CYTHON_FORMAT_SSIZE_T "z" |
| 74 | #endif |
| 75 | - |
| 76 | #if PY_VERSION_HEX < 0x02060000 |
| 77 | #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) |
| 78 | #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) |
| 79 | @@ -59,7 +67,6 @@ |
| 80 | #define PyVarObject_HEAD_INIT(type, size) \ |
| 81 | PyObject_HEAD_INIT(type) size, |
| 82 | #define PyType_Modified(t) |
| 83 | - |
| 84 | typedef struct { |
| 85 | void *buf; |
| 86 | PyObject *obj; |
| 87 | @@ -73,7 +80,6 @@ |
| 88 | Py_ssize_t *suboffsets; |
| 89 | void *internal; |
| 90 | } Py_buffer; |
| 91 | - |
| 92 | #define PyBUF_SIMPLE 0 |
| 93 | #define PyBUF_WRITABLE 0x0001 |
| 94 | #define PyBUF_FORMAT 0x0004 |
| 95 | @@ -83,24 +89,44 @@ |
| 96 | #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) |
| 97 | #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) |
| 98 | #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) |
| 99 | - |
| 100 | + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) |
| 101 | + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) |
| 102 | + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); |
| 103 | + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); |
| 104 | #endif |
| 105 | - |
| 106 | #if PY_MAJOR_VERSION < 3 |
| 107 | #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" |
| 108 | + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ |
| 109 | + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) |
| 110 | #else |
| 111 | #define __Pyx_BUILTIN_MODULE_NAME "builtins" |
| 112 | + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ |
| 113 | + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) |
| 114 | +#endif |
| 115 | +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 |
| 116 | + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") |
| 117 | #endif |
| 118 | - |
| 119 | #if PY_MAJOR_VERSION >= 3 |
| 120 | #define Py_TPFLAGS_CHECKTYPES 0 |
| 121 | #define Py_TPFLAGS_HAVE_INDEX 0 |
| 122 | #endif |
| 123 | - |
| 124 | #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) |
| 125 | #define Py_TPFLAGS_HAVE_NEWBUFFER 0 |
| 126 | #endif |
| 127 | - |
| 128 | +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) |
| 129 | + #define CYTHON_PEP393_ENABLED 1 |
| 130 | + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ |
| 131 | + 0 : _PyUnicode_Ready((PyObject *)(op))) |
| 132 | + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) |
| 133 | + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) |
| 134 | + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) |
| 135 | +#else |
| 136 | + #define CYTHON_PEP393_ENABLED 0 |
| 137 | + #define __Pyx_PyUnicode_READY(op) (0) |
| 138 | + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) |
| 139 | + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) |
| 140 | + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) |
| 141 | +#endif |
| 142 | #if PY_MAJOR_VERSION >= 3 |
| 143 | #define PyBaseString_Type PyUnicode_Type |
| 144 | #define PyStringObject PyUnicodeObject |
| 145 | @@ -108,7 +134,6 @@ |
| 146 | #define PyString_Check PyUnicode_Check |
| 147 | #define PyString_CheckExact PyUnicode_CheckExact |
| 148 | #endif |
| 149 | - |
| 150 | #if PY_VERSION_HEX < 0x02060000 |
| 151 | #define PyBytesObject PyStringObject |
| 152 | #define PyBytes_Type PyString_Type |
| 153 | @@ -127,7 +152,6 @@ |
| 154 | #define PyBytes_Concat PyString_Concat |
| 155 | #define PyBytes_ConcatAndDel PyString_ConcatAndDel |
| 156 | #endif |
| 157 | - |
| 158 | #if PY_VERSION_HEX < 0x02060000 |
| 159 | #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) |
| 160 | #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) |
| 161 | @@ -135,9 +159,7 @@ |
| 162 | #ifndef PySet_CheckExact |
| 163 | #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) |
| 164 | #endif |
| 165 | - |
| 166 | #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) |
| 167 | - |
| 168 | #if PY_MAJOR_VERSION >= 3 |
| 169 | #define PyIntObject PyLongObject |
| 170 | #define PyInt_Type PyLong_Type |
| 171 | @@ -154,11 +176,9 @@ |
| 172 | #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask |
| 173 | #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask |
| 174 | #endif |
| 175 | - |
| 176 | #if PY_MAJOR_VERSION >= 3 |
| 177 | #define PyBoolObject PyLongObject |
| 178 | #endif |
| 179 | - |
| 180 | #if PY_VERSION_HEX < 0x03020000 |
| 181 | typedef long Py_hash_t; |
| 182 | #define __Pyx_PyInt_FromHash_t PyInt_FromLong |
| 183 | @@ -167,16 +187,6 @@ |
| 184 | #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t |
| 185 | #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t |
| 186 | #endif |
| 187 | - |
| 188 | - |
| 189 | -#if PY_MAJOR_VERSION >= 3 |
| 190 | - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) |
| 191 | - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) |
| 192 | -#else |
| 193 | - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) |
| 194 | - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) |
| 195 | -#endif |
| 196 | - |
| 197 | #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) |
| 198 | #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) |
| 199 | #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) |
| 200 | @@ -195,11 +205,9 @@ |
| 201 | (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ |
| 202 | (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) |
| 203 | #endif |
| 204 | - |
| 205 | #if PY_MAJOR_VERSION >= 3 |
| 206 | #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) |
| 207 | #endif |
| 208 | - |
| 209 | #if PY_VERSION_HEX < 0x02050000 |
| 210 | #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) |
| 211 | #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) |
| 212 | @@ -209,7 +217,6 @@ |
| 213 | #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) |
| 214 | #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) |
| 215 | #endif |
| 216 | - |
| 217 | #if PY_VERSION_HEX < 0x02050000 |
| 218 | #define __Pyx_NAMESTR(n) ((char *)(n)) |
| 219 | #define __Pyx_DOCSTR(n) ((char *)(n)) |
| 220 | @@ -218,6 +225,15 @@ |
| 221 | #define __Pyx_DOCSTR(n) (n) |
| 222 | #endif |
| 223 | |
| 224 | + |
| 225 | +#if PY_MAJOR_VERSION >= 3 |
| 226 | + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) |
| 227 | + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) |
| 228 | +#else |
| 229 | + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) |
| 230 | + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) |
| 231 | +#endif |
| 232 | + |
| 233 | #ifndef __PYX_EXTERN_C |
| 234 | #ifdef __cplusplus |
| 235 | #define __PYX_EXTERN_C extern "C" |
| 236 | @@ -269,7 +285,7 @@ |
| 237 | # else |
| 238 | # define CYTHON_UNUSED |
| 239 | # endif |
| 240 | -# elif defined(__ICC) || defined(__INTEL_COMPILER) |
| 241 | +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) |
| 242 | # define CYTHON_UNUSED __attribute__ ((__unused__)) |
| 243 | # else |
| 244 | # define CYTHON_UNUSED |
| 245 | @@ -293,8 +309,12 @@ |
| 246 | static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); |
| 247 | static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); |
| 248 | |
| 249 | +#if CYTHON_COMPILING_IN_CPYTHON |
| 250 | #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) |
| 251 | - |
| 252 | +#else |
| 253 | +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) |
| 254 | +#endif |
| 255 | +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) |
| 256 | |
| 257 | #ifdef __GNUC__ |
| 258 | /* Test for GCC > 2.95 */ |
| 259 | @@ -421,11 +441,9 @@ |
| 260 | rk_state *internal_state; |
| 261 | }; |
| 262 | |
| 263 | - |
| 264 | #ifndef CYTHON_REFNANNY |
| 265 | #define CYTHON_REFNANNY 0 |
| 266 | #endif |
| 267 | - |
| 268 | #if CYTHON_REFNANNY |
| 269 | typedef struct { |
| 270 | void (*INCREF)(void*, PyObject*, int); |
| 271 | @@ -438,8 +456,21 @@ |
| 272 | static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; |
| 273 | static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ |
| 274 | #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; |
| 275 | - #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) |
| 276 | - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) |
| 277 | +#ifdef WITH_THREAD |
| 278 | + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ |
| 279 | + if (acquire_gil) { \ |
| 280 | + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ |
| 281 | + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ |
| 282 | + PyGILState_Release(__pyx_gilstate_save); \ |
| 283 | + } else { \ |
| 284 | + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ |
| 285 | + } |
| 286 | +#else |
| 287 | + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ |
| 288 | + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) |
| 289 | +#endif |
| 290 | + #define __Pyx_RefNannyFinishContext() \ |
| 291 | + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) |
| 292 | #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) |
| 293 | #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) |
| 294 | #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) |
| 295 | @@ -450,7 +481,7 @@ |
| 296 | #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) |
| 297 | #else |
| 298 | #define __Pyx_RefNannyDeclarations |
| 299 | - #define __Pyx_RefNannySetupContext(name) |
| 300 | + #define __Pyx_RefNannySetupContext(name, acquire_gil) |
| 301 | #define __Pyx_RefNannyFinishContext() |
| 302 | #define __Pyx_INCREF(r) Py_INCREF(r) |
| 303 | #define __Pyx_DECREF(r) Py_DECREF(r) |
| 304 | @@ -461,6 +492,8 @@ |
| 305 | #define __Pyx_XGOTREF(r) |
| 306 | #define __Pyx_XGIVEREF(r) |
| 307 | #endif /* CYTHON_REFNANNY */ |
| 308 | +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) |
| 309 | +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) |
| 310 | |
| 311 | static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ |
| 312 | |
| 313 | @@ -469,15 +502,15 @@ |
| 314 | |
| 315 | static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ |
| 316 | |
| 317 | -static void __Pyx_RaiseDoubleKeywordsError( |
| 318 | - const char* func_name, PyObject* kw_name); /*proto*/ |
| 319 | +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ |
| 320 | |
| 321 | -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ |
| 322 | +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ |
| 323 | + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ |
| 324 | + const char* function_name); /*proto*/ |
| 325 | |
| 326 | static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, |
| 327 | Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ |
| 328 | |
| 329 | - |
| 330 | static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { |
| 331 | PyObject *r; |
| 332 | if (!j) return NULL; |
| 333 | @@ -485,89 +518,102 @@ |
| 334 | Py_DECREF(j); |
| 335 | return r; |
| 336 | } |
| 337 | - |
| 338 | - |
| 339 | #define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ |
| 340 | __Pyx_GetItemInt_List_Fast(o, i) : \ |
| 341 | __Pyx_GetItemInt_Generic(o, to_py_func(i))) |
| 342 | - |
| 343 | static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { |
| 344 | - if (likely(o != Py_None)) { |
| 345 | - if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { |
| 346 | - PyObject *r = PyList_GET_ITEM(o, i); |
| 347 | - Py_INCREF(r); |
| 348 | - return r; |
| 349 | - } |
| 350 | - else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { |
| 351 | - PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); |
| 352 | - Py_INCREF(r); |
| 353 | - return r; |
| 354 | - } |
| 355 | +#if CYTHON_COMPILING_IN_CPYTHON |
| 356 | + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { |
| 357 | + PyObject *r = PyList_GET_ITEM(o, i); |
| 358 | + Py_INCREF(r); |
| 359 | + return r; |
| 360 | + } |
| 361 | + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { |
| 362 | + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); |
| 363 | + Py_INCREF(r); |
| 364 | + return r; |
| 365 | } |
| 366 | return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); |
| 367 | +#else |
| 368 | + return PySequence_GetItem(o, i); |
| 369 | +#endif |
| 370 | } |
| 371 | - |
| 372 | #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ |
| 373 | __Pyx_GetItemInt_Tuple_Fast(o, i) : \ |
| 374 | __Pyx_GetItemInt_Generic(o, to_py_func(i))) |
| 375 | - |
| 376 | static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { |
| 377 | - if (likely(o != Py_None)) { |
| 378 | - if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { |
| 379 | - PyObject *r = PyTuple_GET_ITEM(o, i); |
| 380 | - Py_INCREF(r); |
| 381 | - return r; |
| 382 | - } |
| 383 | - else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { |
| 384 | - PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); |
| 385 | - Py_INCREF(r); |
| 386 | - return r; |
| 387 | - } |
| 388 | +#if CYTHON_COMPILING_IN_CPYTHON |
| 389 | + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { |
| 390 | + PyObject *r = PyTuple_GET_ITEM(o, i); |
| 391 | + Py_INCREF(r); |
| 392 | + return r; |
| 393 | + } |
| 394 | + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { |
| 395 | + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); |
| 396 | + Py_INCREF(r); |
| 397 | + return r; |
| 398 | } |
| 399 | return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); |
| 400 | +#else |
| 401 | + return PySequence_GetItem(o, i); |
| 402 | +#endif |
| 403 | } |
| 404 | - |
| 405 | - |
| 406 | #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ |
| 407 | __Pyx_GetItemInt_Fast(o, i) : \ |
| 408 | __Pyx_GetItemInt_Generic(o, to_py_func(i))) |
| 409 | - |
| 410 | static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { |
| 411 | - PyObject *r; |
| 412 | - if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { |
| 413 | - r = PyList_GET_ITEM(o, i); |
| 414 | - Py_INCREF(r); |
| 415 | - } |
| 416 | - else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { |
| 417 | - r = PyTuple_GET_ITEM(o, i); |
| 418 | - Py_INCREF(r); |
| 419 | +#if CYTHON_COMPILING_IN_CPYTHON |
| 420 | + if (PyList_CheckExact(o)) { |
| 421 | + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); |
| 422 | + if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { |
| 423 | + PyObject *r = PyList_GET_ITEM(o, n); |
| 424 | + Py_INCREF(r); |
| 425 | + return r; |
| 426 | + } |
| 427 | } |
| 428 | - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { |
| 429 | - r = PySequence_GetItem(o, i); |
| 430 | + else if (PyTuple_CheckExact(o)) { |
| 431 | + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); |
| 432 | + if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { |
| 433 | + PyObject *r = PyTuple_GET_ITEM(o, n); |
| 434 | + Py_INCREF(r); |
| 435 | + return r; |
| 436 | + } |
| 437 | + } else { /* inlined PySequence_GetItem() */ |
| 438 | + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; |
| 439 | + if (likely(m && m->sq_item)) { |
| 440 | + if (unlikely(i < 0) && likely(m->sq_length)) { |
| 441 | + Py_ssize_t l = m->sq_length(o); |
| 442 | + if (unlikely(l < 0)) return NULL; |
| 443 | + i += l; |
| 444 | + } |
| 445 | + return m->sq_item(o, i); |
| 446 | + } |
| 447 | } |
| 448 | - else { |
| 449 | - r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); |
| 450 | +#else |
| 451 | + if (PySequence_Check(o)) { |
| 452 | + return PySequence_GetItem(o, i); |
| 453 | } |
| 454 | - return r; |
| 455 | +#endif |
| 456 | + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); |
| 457 | } |
| 458 | |
| 459 | +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); |
| 460 | + |
| 461 | static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); |
| 462 | |
| 463 | -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); |
| 464 | +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ |
| 465 | |
| 466 | static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ |
| 467 | |
| 468 | static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ |
| 469 | |
| 470 | -static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, |
| 471 | - const char* function_name, int kw_allowed); /*proto*/ |
| 472 | +static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/ |
| 473 | |
| 474 | static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ |
| 475 | |
| 476 | #define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ |
| 477 | __Pyx_SetItemInt_Fast(o, i, v) : \ |
| 478 | __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) |
| 479 | - |
| 480 | static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { |
| 481 | int r; |
| 482 | if (!j) return -1; |
| 483 | @@ -575,20 +621,38 @@ |
| 484 | Py_DECREF(j); |
| 485 | return r; |
| 486 | } |
| 487 | - |
| 488 | static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) { |
| 489 | - if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { |
| 490 | - Py_INCREF(v); |
| 491 | - Py_DECREF(PyList_GET_ITEM(o, i)); |
| 492 | - PyList_SET_ITEM(o, i, v); |
| 493 | - return 1; |
| 494 | +#if CYTHON_COMPILING_IN_CPYTHON |
| 495 | + if (PyList_CheckExact(o)) { |
| 496 | + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); |
| 497 | + if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { |
| 498 | + PyObject* old = PyList_GET_ITEM(o, n); |
| 499 | + Py_INCREF(v); |
| 500 | + PyList_SET_ITEM(o, n, v); |
| 501 | + Py_DECREF(old); |
| 502 | + return 1; |
| 503 | + } |
| 504 | + } else { /* inlined PySequence_SetItem() */ |
| 505 | + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; |
| 506 | + if (likely(m && m->sq_ass_item)) { |
| 507 | + if (unlikely(i < 0) && likely(m->sq_length)) { |
| 508 | + Py_ssize_t l = m->sq_length(o); |
| 509 | + if (unlikely(l < 0)) return -1; |
| 510 | + i += l; |
| 511 | + } |
| 512 | + return m->sq_ass_item(o, i, v); |
| 513 | + } |
| 514 | } |
| 515 | - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0))) |
| 516 | +#else |
| 517 | +#if CYTHON_COMPILING_IN_PYPY |
| 518 | + if (PySequence_Check(o) && !PyDict_Check(o)) { |
| 519 | +#else |
| 520 | + if (PySequence_Check(o)) { |
| 521 | +#endif |
| 522 | return PySequence_SetItem(o, i, v); |
| 523 | - else { |
| 524 | - PyObject *j = PyInt_FromSsize_t(i); |
| 525 | - return __Pyx_SetItemInt_Generic(o, j, v); |
| 526 | } |
| 527 | +#endif |
| 528 | + return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); |
| 529 | } |
| 530 | |
| 531 | static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ |
| 532 | @@ -596,17 +660,9 @@ |
| 533 | |
| 534 | static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ |
| 535 | |
| 536 | -#include <string.h> |
| 537 | - |
| 538 | -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ |
| 539 | - |
| 540 | -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ |
| 541 | +static CYTHON_INLINE npy_intp __Pyx_PyInt_from_py_npy_intp(PyObject *); |
| 542 | |
| 543 | -#if PY_MAJOR_VERSION >= 3 |
| 544 | -#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals |
| 545 | -#else |
| 546 | -#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals |
| 547 | -#endif |
| 548 | +static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name); |
| 549 | |
| 550 | static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); |
| 551 | |
| 552 | @@ -642,19 +698,40 @@ |
| 553 | |
| 554 | static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); |
| 555 | |
| 556 | -static CYTHON_INLINE npy_intp __Pyx_PyInt_from_py_npy_intp(PyObject *); |
| 557 | - |
| 558 | static int __Pyx_check_binary_version(void); |
| 559 | |
| 560 | -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ |
| 561 | +#if !defined(__Pyx_PyIdentifier_FromString) |
| 562 | +#if PY_MAJOR_VERSION < 3 |
| 563 | + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) |
| 564 | +#else |
| 565 | + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) |
| 566 | +#endif |
| 567 | +#endif |
| 568 | |
| 569 | static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ |
| 570 | |
| 571 | -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, |
| 572 | - int __pyx_lineno, const char *__pyx_filename); /*proto*/ |
| 573 | +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ |
| 574 | + |
| 575 | +typedef struct { |
| 576 | + int code_line; |
| 577 | + PyCodeObject* code_object; |
| 578 | +} __Pyx_CodeObjectCacheEntry; |
| 579 | +struct __Pyx_CodeObjectCache { |
| 580 | + int count; |
| 581 | + int max_count; |
| 582 | + __Pyx_CodeObjectCacheEntry* entries; |
| 583 | +}; |
| 584 | +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; |
| 585 | +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); |
| 586 | +static PyCodeObject *__pyx_find_code_object(int code_line); |
| 587 | +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); |
| 588 | + |
| 589 | +static void __Pyx_AddTraceback(const char *funcname, int c_line, |
| 590 | + int py_line, const char *filename); /*proto*/ |
| 591 | |
| 592 | static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ |
| 593 | |
| 594 | + |
| 595 | /* Module declarations from 'numpy' */ |
| 596 | |
| 597 | /* Module declarations from 'mtrand' */ |
| 598 | @@ -686,6 +763,58 @@ |
| 599 | /* Implementation of 'mtrand' */ |
| 600 | static PyObject *__pyx_builtin_ValueError; |
| 601 | static PyObject *__pyx_builtin_TypeError; |
| 602 | +static int __pyx_pf_6mtrand_11RandomState___init__(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_seed); /* proto */ |
| 603 | +static void __pyx_pf_6mtrand_11RandomState_2__dealloc__(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self); /* proto */ |
| 604 | +static PyObject *__pyx_pf_6mtrand_11RandomState_4seed(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_seed); /* proto */ |
| 605 | +static PyObject *__pyx_pf_6mtrand_11RandomState_6get_state(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self); /* proto */ |
| 606 | +static PyObject *__pyx_pf_6mtrand_11RandomState_8set_state(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ |
| 607 | +static PyObject *__pyx_pf_6mtrand_11RandomState_10__getstate__(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self); /* proto */ |
| 608 | +static PyObject *__pyx_pf_6mtrand_11RandomState_12__setstate__(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ |
| 609 | +static PyObject *__pyx_pf_6mtrand_11RandomState_14__reduce__(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self); /* proto */ |
| 610 | +static PyObject *__pyx_pf_6mtrand_11RandomState_16random_sample(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_size); /* proto */ |
| 611 | +static PyObject *__pyx_pf_6mtrand_11RandomState_18tomaxint(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_size); /* proto */ |
| 612 | +static PyObject *__pyx_pf_6mtrand_11RandomState_20randint(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_low, PyObject *__pyx_v_high, PyObject *__pyx_v_size); /* proto */ |
| 613 | +static PyObject *__pyx_pf_6mtrand_11RandomState_22bytes(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, npy_intp __pyx_v_length); /* proto */ |
| 614 | +static PyObject *__pyx_pf_6mtrand_11RandomState_24uniform(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_low, PyObject *__pyx_v_high, PyObject *__pyx_v_size); /* proto */ |
| 615 | +static PyObject *__pyx_pf_6mtrand_11RandomState_26rand(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ |
| 616 | +static PyObject *__pyx_pf_6mtrand_11RandomState_28randn(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ |
| 617 | +static PyObject *__pyx_pf_6mtrand_11RandomState_30random_integers(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_low, PyObject *__pyx_v_high, PyObject *__pyx_v_size); /* proto */ |
| 618 | +static PyObject *__pyx_pf_6mtrand_11RandomState_32standard_normal(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_size); /* proto */ |
| 619 | +static PyObject *__pyx_pf_6mtrand_11RandomState_34normal(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_loc, PyObject *__pyx_v_scale, PyObject *__pyx_v_size); /* proto */ |
| 620 | +static PyObject *__pyx_pf_6mtrand_11RandomState_36beta(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_size); /* proto */ |
| 621 | +static PyObject *__pyx_pf_6mtrand_11RandomState_38exponential(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_scale, PyObject *__pyx_v_size); /* proto */ |
| 622 | +static PyObject *__pyx_pf_6mtrand_11RandomState_40standard_exponential(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_size); /* proto */ |
| 623 | +static PyObject *__pyx_pf_6mtrand_11RandomState_42standard_gamma(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_shape, PyObject *__pyx_v_size); /* proto */ |
| 624 | +static PyObject *__pyx_pf_6mtrand_11RandomState_44gamma(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_shape, PyObject *__pyx_v_scale, PyObject *__pyx_v_size); /* proto */ |
| 625 | +static PyObject *__pyx_pf_6mtrand_11RandomState_46f(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_dfnum, PyObject *__pyx_v_dfden, PyObject *__pyx_v_size); /* proto */ |
| 626 | +static PyObject *__pyx_pf_6mtrand_11RandomState_48noncentral_f(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_dfnum, PyObject *__pyx_v_dfden, PyObject *__pyx_v_nonc, PyObject *__pyx_v_size); /* proto */ |
| 627 | +static PyObject *__pyx_pf_6mtrand_11RandomState_50chisquare(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_df, PyObject *__pyx_v_size); /* proto */ |
| 628 | +static PyObject *__pyx_pf_6mtrand_11RandomState_52noncentral_chisquare(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_df, PyObject *__pyx_v_nonc, PyObject *__pyx_v_size); /* proto */ |
| 629 | +static PyObject *__pyx_pf_6mtrand_11RandomState_54standard_cauchy(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_size); /* proto */ |
| 630 | +static PyObject *__pyx_pf_6mtrand_11RandomState_56standard_t(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_df, PyObject *__pyx_v_size); /* proto */ |
| 631 | +static PyObject *__pyx_pf_6mtrand_11RandomState_58vonmises(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_mu, PyObject *__pyx_v_kappa, PyObject *__pyx_v_size); /* proto */ |
| 632 | +static PyObject *__pyx_pf_6mtrand_11RandomState_60pareto(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_size); /* proto */ |
| 633 | +static PyObject *__pyx_pf_6mtrand_11RandomState_62weibull(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_size); /* proto */ |
| 634 | +static PyObject *__pyx_pf_6mtrand_11RandomState_64power(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_size); /* proto */ |
| 635 | +static PyObject *__pyx_pf_6mtrand_11RandomState_66laplace(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_loc, PyObject *__pyx_v_scale, PyObject *__pyx_v_size); /* proto */ |
| 636 | +static PyObject *__pyx_pf_6mtrand_11RandomState_68gumbel(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_loc, PyObject *__pyx_v_scale, PyObject *__pyx_v_size); /* proto */ |
| 637 | +static PyObject *__pyx_pf_6mtrand_11RandomState_70logistic(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_loc, PyObject *__pyx_v_scale, PyObject *__pyx_v_size); /* proto */ |
| 638 | +static PyObject *__pyx_pf_6mtrand_11RandomState_72lognormal(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_mean, PyObject *__pyx_v_sigma, PyObject *__pyx_v_size); /* proto */ |
| 639 | +static PyObject *__pyx_pf_6mtrand_11RandomState_74rayleigh(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_scale, PyObject *__pyx_v_size); /* proto */ |
| 640 | +static PyObject *__pyx_pf_6mtrand_11RandomState_76wald(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_mean, PyObject *__pyx_v_scale, PyObject *__pyx_v_size); /* proto */ |
| 641 | +static PyObject *__pyx_pf_6mtrand_11RandomState_78triangular(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_left, PyObject *__pyx_v_mode, PyObject *__pyx_v_right, PyObject *__pyx_v_size); /* proto */ |
| 642 | +static PyObject *__pyx_pf_6mtrand_11RandomState_80binomial(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_p, PyObject *__pyx_v_size); /* proto */ |
| 643 | +static PyObject *__pyx_pf_6mtrand_11RandomState_82negative_binomial(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_p, PyObject *__pyx_v_size); /* proto */ |
| 644 | +static PyObject *__pyx_pf_6mtrand_11RandomState_84poisson(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_lam, PyObject *__pyx_v_size); /* proto */ |
| 645 | +static PyObject *__pyx_pf_6mtrand_11RandomState_86zipf(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_size); /* proto */ |
| 646 | +static PyObject *__pyx_pf_6mtrand_11RandomState_88geometric(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_p, PyObject *__pyx_v_size); /* proto */ |
| 647 | +static PyObject *__pyx_pf_6mtrand_11RandomState_90hypergeometric(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_ngood, PyObject *__pyx_v_nbad, PyObject *__pyx_v_nsample, PyObject *__pyx_v_size); /* proto */ |
| 648 | +static PyObject *__pyx_pf_6mtrand_11RandomState_92logseries(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_p, PyObject *__pyx_v_size); /* proto */ |
| 649 | +static PyObject *__pyx_pf_6mtrand_11RandomState_94multivariate_normal(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_mean, PyObject *__pyx_v_cov, PyObject *__pyx_v_size); /* proto */ |
| 650 | +static PyObject *__pyx_pf_6mtrand_11RandomState_96multinomial(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, npy_intp __pyx_v_n, PyObject *__pyx_v_pvals, PyObject *__pyx_v_size); /* proto */ |
| 651 | +static PyObject *__pyx_pf_6mtrand_11RandomState_98dirichlet(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_alpha, PyObject *__pyx_v_size); /* proto */ |
| 652 | +static PyObject *__pyx_pf_6mtrand_11RandomState_100shuffle(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_x); /* proto */ |
| 653 | +static PyObject *__pyx_pf_6mtrand_11RandomState_102permutation(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_x); /* proto */ |
| 654 | static char __pyx_k_1[] = "size is not compatible with inputs"; |
| 655 | static char __pyx_k_9[] = "algorithm must be 'MT19937'"; |
| 656 | static char __pyx_k_11[] = "state must be 624 longs"; |
| 657 | @@ -1318,7 +1447,7 @@ |
| 658 | int __pyx_lineno = 0; |
| 659 | const char *__pyx_filename = NULL; |
| 660 | int __pyx_clineno = 0; |
| 661 | - __Pyx_RefNannySetupContext("cont0_array"); |
| 662 | + __Pyx_RefNannySetupContext("cont0_array", 0); |
| 663 | |
| 664 | /* "mtrand.pyx":134 |
| 665 | * cdef npy_intp i |
| 666 | @@ -1365,7 +1494,7 @@ |
| 667 | __Pyx_GOTREF(__pyx_t_4); |
| 668 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 669 | __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;} |
| 670 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 671 | + __Pyx_GOTREF(__pyx_t_2); |
| 672 | __Pyx_INCREF(__pyx_v_size); |
| 673 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size); |
| 674 | __Pyx_GIVEREF(__pyx_v_size); |
| 675 | @@ -1470,7 +1599,7 @@ |
| 676 | int __pyx_lineno = 0; |
| 677 | const char *__pyx_filename = NULL; |
| 678 | int __pyx_clineno = 0; |
| 679 | - __Pyx_RefNannySetupContext("cont1_array_sc"); |
| 680 | + __Pyx_RefNannySetupContext("cont1_array_sc", 0); |
| 681 | |
| 682 | /* "mtrand.pyx":151 |
| 683 | * cdef npy_intp i |
| 684 | @@ -1517,7 +1646,7 @@ |
| 685 | __Pyx_GOTREF(__pyx_t_4); |
| 686 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 687 | __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;} |
| 688 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 689 | + __Pyx_GOTREF(__pyx_t_2); |
| 690 | __Pyx_INCREF(__pyx_v_size); |
| 691 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size); |
| 692 | __Pyx_GIVEREF(__pyx_v_size); |
| 693 | @@ -1625,7 +1754,7 @@ |
| 694 | int __pyx_lineno = 0; |
| 695 | const char *__pyx_filename = NULL; |
| 696 | int __pyx_clineno = 0; |
| 697 | - __Pyx_RefNannySetupContext("cont1_array"); |
| 698 | + __Pyx_RefNannySetupContext("cont1_array", 0); |
| 699 | |
| 700 | /* "mtrand.pyx":170 |
| 701 | * cdef broadcast multi |
| 702 | @@ -1731,7 +1860,7 @@ |
| 703 | __Pyx_GOTREF(__pyx_t_5); |
| 704 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 705 | __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;} |
| 706 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 707 | + __Pyx_GOTREF(__pyx_t_2); |
| 708 | __Pyx_INCREF(__pyx_v_size); |
| 709 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size); |
| 710 | __Pyx_GIVEREF(__pyx_v_size); |
| 711 | @@ -1886,7 +2015,7 @@ |
| 712 | int __pyx_lineno = 0; |
| 713 | const char *__pyx_filename = NULL; |
| 714 | int __pyx_clineno = 0; |
| 715 | - __Pyx_RefNannySetupContext("cont2_array_sc"); |
| 716 | + __Pyx_RefNannySetupContext("cont2_array_sc", 0); |
| 717 | |
| 718 | /* "mtrand.pyx":198 |
| 719 | * cdef npy_intp i |
| 720 | @@ -1933,7 +2062,7 @@ |
| 721 | __Pyx_GOTREF(__pyx_t_4); |
| 722 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 723 | __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;} |
| 724 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 725 | + __Pyx_GOTREF(__pyx_t_2); |
| 726 | __Pyx_INCREF(__pyx_v_size); |
| 727 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size); |
| 728 | __Pyx_GIVEREF(__pyx_v_size); |
| 729 | @@ -2040,7 +2169,7 @@ |
| 730 | int __pyx_lineno = 0; |
| 731 | const char *__pyx_filename = NULL; |
| 732 | int __pyx_clineno = 0; |
| 733 | - __Pyx_RefNannySetupContext("cont2_array"); |
| 734 | + __Pyx_RefNannySetupContext("cont2_array", 0); |
| 735 | |
| 736 | /* "mtrand.pyx":219 |
| 737 | * cdef broadcast multi |
| 738 | @@ -2155,7 +2284,7 @@ |
| 739 | __Pyx_GOTREF(__pyx_t_5); |
| 740 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 741 | __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;} |
| 742 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 743 | + __Pyx_GOTREF(__pyx_t_2); |
| 744 | __Pyx_INCREF(__pyx_v_size); |
| 745 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size); |
| 746 | __Pyx_GIVEREF(__pyx_v_size); |
| 747 | @@ -2327,7 +2456,7 @@ |
| 748 | int __pyx_lineno = 0; |
| 749 | const char *__pyx_filename = NULL; |
| 750 | int __pyx_clineno = 0; |
| 751 | - __Pyx_RefNannySetupContext("cont3_array_sc"); |
| 752 | + __Pyx_RefNannySetupContext("cont3_array_sc", 0); |
| 753 | |
| 754 | /* "mtrand.pyx":250 |
| 755 | * cdef npy_intp i |
| 756 | @@ -2374,7 +2503,7 @@ |
| 757 | __Pyx_GOTREF(__pyx_t_4); |
| 758 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 759 | __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;} |
| 760 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 761 | + __Pyx_GOTREF(__pyx_t_2); |
| 762 | __Pyx_INCREF(__pyx_v_size); |
| 763 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size); |
| 764 | __Pyx_GIVEREF(__pyx_v_size); |
| 765 | @@ -2482,7 +2611,7 @@ |
| 766 | int __pyx_lineno = 0; |
| 767 | const char *__pyx_filename = NULL; |
| 768 | int __pyx_clineno = 0; |
| 769 | - __Pyx_RefNannySetupContext("cont3_array"); |
| 770 | + __Pyx_RefNannySetupContext("cont3_array", 0); |
| 771 | |
| 772 | /* "mtrand.pyx":272 |
| 773 | * cdef broadcast multi |
| 774 | @@ -2606,7 +2735,7 @@ |
| 775 | __Pyx_GOTREF(__pyx_t_5); |
| 776 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 777 | __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;} |
| 778 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 779 | + __Pyx_GOTREF(__pyx_t_2); |
| 780 | __Pyx_INCREF(__pyx_v_size); |
| 781 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size); |
| 782 | __Pyx_GIVEREF(__pyx_v_size); |
| 783 | @@ -2778,7 +2907,7 @@ |
| 784 | int __pyx_lineno = 0; |
| 785 | const char *__pyx_filename = NULL; |
| 786 | int __pyx_clineno = 0; |
| 787 | - __Pyx_RefNannySetupContext("disc0_array"); |
| 788 | + __Pyx_RefNannySetupContext("disc0_array", 0); |
| 789 | |
| 790 | /* "mtrand.pyx":303 |
| 791 | * cdef npy_intp i |
| 792 | @@ -2820,7 +2949,7 @@ |
| 793 | __Pyx_GOTREF(__pyx_t_3); |
| 794 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 795 | __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;} |
| 796 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 797 | + __Pyx_GOTREF(__pyx_t_2); |
| 798 | __Pyx_INCREF(__pyx_v_size); |
| 799 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size); |
| 800 | __Pyx_GIVEREF(__pyx_v_size); |
| 801 | @@ -2925,7 +3054,7 @@ |
| 802 | int __pyx_lineno = 0; |
| 803 | const char *__pyx_filename = NULL; |
| 804 | int __pyx_clineno = 0; |
| 805 | - __Pyx_RefNannySetupContext("discnp_array_sc"); |
| 806 | + __Pyx_RefNannySetupContext("discnp_array_sc", 0); |
| 807 | |
| 808 | /* "mtrand.pyx":319 |
| 809 | * cdef npy_intp i |
| 810 | @@ -2967,7 +3096,7 @@ |
| 811 | __Pyx_GOTREF(__pyx_t_3); |
| 812 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 813 | __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;} |
| 814 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 815 | + __Pyx_GOTREF(__pyx_t_2); |
| 816 | __Pyx_INCREF(__pyx_v_size); |
| 817 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size); |
| 818 | __Pyx_GIVEREF(__pyx_v_size); |
| 819 | @@ -3074,7 +3203,7 @@ |
| 820 | int __pyx_lineno = 0; |
| 821 | const char *__pyx_filename = NULL; |
| 822 | int __pyx_clineno = 0; |
| 823 | - __Pyx_RefNannySetupContext("discnp_array"); |
| 824 | + __Pyx_RefNannySetupContext("discnp_array", 0); |
| 825 | |
| 826 | /* "mtrand.pyx":338 |
| 827 | * cdef broadcast multi |
| 828 | @@ -3184,7 +3313,7 @@ |
| 829 | __Pyx_GOTREF(__pyx_t_4); |
| 830 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 831 | __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;} |
| 832 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 833 | + __Pyx_GOTREF(__pyx_t_2); |
| 834 | __Pyx_INCREF(__pyx_v_size); |
| 835 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size); |
| 836 | __Pyx_GIVEREF(__pyx_v_size); |
| 837 | @@ -3356,7 +3485,7 @@ |
| 838 | int __pyx_lineno = 0; |
| 839 | const char *__pyx_filename = NULL; |
| 840 | int __pyx_clineno = 0; |
| 841 | - __Pyx_RefNannySetupContext("discdd_array_sc"); |
| 842 | + __Pyx_RefNannySetupContext("discdd_array_sc", 0); |
| 843 | |
| 844 | /* "mtrand.pyx":368 |
| 845 | * cdef npy_intp i |
| 846 | @@ -3398,7 +3527,7 @@ |
| 847 | __Pyx_GOTREF(__pyx_t_3); |
| 848 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 849 | __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;} |
| 850 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 851 | + __Pyx_GOTREF(__pyx_t_2); |
| 852 | __Pyx_INCREF(__pyx_v_size); |
| 853 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size); |
| 854 | __Pyx_GIVEREF(__pyx_v_size); |
| 855 | @@ -3505,7 +3634,7 @@ |
| 856 | int __pyx_lineno = 0; |
| 857 | const char *__pyx_filename = NULL; |
| 858 | int __pyx_clineno = 0; |
| 859 | - __Pyx_RefNannySetupContext("discdd_array"); |
| 860 | + __Pyx_RefNannySetupContext("discdd_array", 0); |
| 861 | |
| 862 | /* "mtrand.pyx":387 |
| 863 | * cdef broadcast multi |
| 864 | @@ -3615,7 +3744,7 @@ |
| 865 | __Pyx_GOTREF(__pyx_t_4); |
| 866 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 867 | __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;} |
| 868 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 869 | + __Pyx_GOTREF(__pyx_t_2); |
| 870 | __Pyx_INCREF(__pyx_v_size); |
| 871 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size); |
| 872 | __Pyx_GIVEREF(__pyx_v_size); |
| 873 | @@ -3787,7 +3916,7 @@ |
| 874 | int __pyx_lineno = 0; |
| 875 | const char *__pyx_filename = NULL; |
| 876 | int __pyx_clineno = 0; |
| 877 | - __Pyx_RefNannySetupContext("discnmN_array_sc"); |
| 878 | + __Pyx_RefNannySetupContext("discnmN_array_sc", 0); |
| 879 | |
| 880 | /* "mtrand.pyx":418 |
| 881 | * cdef npy_intp i |
| 882 | @@ -3829,7 +3958,7 @@ |
| 883 | __Pyx_GOTREF(__pyx_t_3); |
| 884 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 885 | __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;} |
| 886 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 887 | + __Pyx_GOTREF(__pyx_t_2); |
| 888 | __Pyx_INCREF(__pyx_v_size); |
| 889 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size); |
| 890 | __Pyx_GIVEREF(__pyx_v_size); |
| 891 | @@ -3937,7 +4066,7 @@ |
| 892 | int __pyx_lineno = 0; |
| 893 | const char *__pyx_filename = NULL; |
| 894 | int __pyx_clineno = 0; |
| 895 | - __Pyx_RefNannySetupContext("discnmN_array"); |
| 896 | + __Pyx_RefNannySetupContext("discnmN_array", 0); |
| 897 | |
| 898 | /* "mtrand.pyx":439 |
| 899 | * cdef broadcast multi |
| 900 | @@ -4056,7 +4185,7 @@ |
| 901 | __Pyx_GOTREF(__pyx_t_4); |
| 902 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 903 | __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;} |
| 904 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 905 | + __Pyx_GOTREF(__pyx_t_2); |
| 906 | __Pyx_INCREF(__pyx_v_size); |
| 907 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size); |
| 908 | __Pyx_GIVEREF(__pyx_v_size); |
| 909 | @@ -4228,7 +4357,7 @@ |
| 910 | int __pyx_lineno = 0; |
| 911 | const char *__pyx_filename = NULL; |
| 912 | int __pyx_clineno = 0; |
| 913 | - __Pyx_RefNannySetupContext("discd_array_sc"); |
| 914 | + __Pyx_RefNannySetupContext("discd_array_sc", 0); |
| 915 | |
| 916 | /* "mtrand.pyx":471 |
| 917 | * cdef npy_intp i |
| 918 | @@ -4270,7 +4399,7 @@ |
| 919 | __Pyx_GOTREF(__pyx_t_3); |
| 920 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 921 | __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;} |
| 922 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 923 | + __Pyx_GOTREF(__pyx_t_2); |
| 924 | __Pyx_INCREF(__pyx_v_size); |
| 925 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size); |
| 926 | __Pyx_GIVEREF(__pyx_v_size); |
| 927 | @@ -4378,7 +4507,7 @@ |
| 928 | int __pyx_lineno = 0; |
| 929 | const char *__pyx_filename = NULL; |
| 930 | int __pyx_clineno = 0; |
| 931 | - __Pyx_RefNannySetupContext("discd_array"); |
| 932 | + __Pyx_RefNannySetupContext("discd_array", 0); |
| 933 | |
| 934 | /* "mtrand.pyx":490 |
| 935 | * cdef flatiter itera |
| 936 | @@ -4479,7 +4608,7 @@ |
| 937 | __Pyx_GOTREF(__pyx_t_4); |
| 938 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 939 | __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;} |
| 940 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 941 | + __Pyx_GOTREF(__pyx_t_2); |
| 942 | __Pyx_INCREF(__pyx_v_size); |
| 943 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size); |
| 944 | __Pyx_GIVEREF(__pyx_v_size); |
| 945 | @@ -4628,7 +4757,7 @@ |
| 946 | double __pyx_r; |
| 947 | __Pyx_RefNannyDeclarations |
| 948 | npy_intp __pyx_t_1; |
| 949 | - __Pyx_RefNannySetupContext("kahan_sum"); |
| 950 | + __Pyx_RefNannySetupContext("kahan_sum", 0); |
| 951 | |
| 952 | /* "mtrand.pyx":513 |
| 953 | * cdef double c, y, t, sum |
| 954 | @@ -4711,39 +4840,35 @@ |
| 955 | return __pyx_r; |
| 956 | } |
| 957 | |
| 958 | -/* "mtrand.pyx":558 |
| 959 | +/* Python wrapper */ |
| 960 | +static int __pyx_pw_6mtrand_11RandomState_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 961 | +static int __pyx_pw_6mtrand_11RandomState_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 962 | + PyObject *__pyx_v_seed = 0; |
| 963 | + int __pyx_r; |
| 964 | + __Pyx_RefNannyDeclarations |
| 965 | + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); |
| 966 | + { |
| 967 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__seed,0}; |
| 968 | + PyObject* values[1] = {0}; |
| 969 | + |
| 970 | + /* "mtrand.pyx":558 |
| 971 | * poisson_lam_max = np.iinfo('l').max - np.sqrt(np.iinfo('l').max)*10 |
| 972 | * |
| 973 | * def __init__(self, seed=None): # <<<<<<<<<<<<<< |
| 974 | * self.internal_state = <rk_state*>PyMem_Malloc(sizeof(rk_state)) |
| 975 | * |
| 976 | */ |
| 977 | - |
| 978 | -static int __pyx_pf_6mtrand_11RandomState___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 979 | -static int __pyx_pf_6mtrand_11RandomState___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 980 | - PyObject *__pyx_v_seed = 0; |
| 981 | - int __pyx_r; |
| 982 | - __Pyx_RefNannyDeclarations |
| 983 | - PyObject *__pyx_t_1 = NULL; |
| 984 | - PyObject *__pyx_t_2 = NULL; |
| 985 | - PyObject *__pyx_t_3 = NULL; |
| 986 | - int __pyx_lineno = 0; |
| 987 | - const char *__pyx_filename = NULL; |
| 988 | - int __pyx_clineno = 0; |
| 989 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__seed,0}; |
| 990 | - __Pyx_RefNannySetupContext("__init__"); |
| 991 | - { |
| 992 | - PyObject* values[1] = {0}; |
| 993 | values[0] = ((PyObject *)Py_None); |
| 994 | if (unlikely(__pyx_kwds)) { |
| 995 | Py_ssize_t kw_args; |
| 996 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 997 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 998 | + switch (pos_args) { |
| 999 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 1000 | case 0: break; |
| 1001 | default: goto __pyx_L5_argtuple_error; |
| 1002 | } |
| 1003 | kw_args = PyDict_Size(__pyx_kwds); |
| 1004 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 1005 | + switch (pos_args) { |
| 1006 | case 0: |
| 1007 | if (kw_args > 0) { |
| 1008 | PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seed); |
| 1009 | @@ -4751,7 +4876,7 @@ |
| 1010 | } |
| 1011 | } |
| 1012 | if (unlikely(kw_args > 0)) { |
| 1013 | - 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;} |
| 1014 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 1015 | } |
| 1016 | } else { |
| 1017 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 1018 | @@ -4770,6 +4895,21 @@ |
| 1019 | __Pyx_RefNannyFinishContext(); |
| 1020 | return -1; |
| 1021 | __pyx_L4_argument_unpacking_done:; |
| 1022 | + __pyx_r = __pyx_pf_6mtrand_11RandomState___init__(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_seed); |
| 1023 | + __Pyx_RefNannyFinishContext(); |
| 1024 | + return __pyx_r; |
| 1025 | +} |
| 1026 | + |
| 1027 | +static int __pyx_pf_6mtrand_11RandomState___init__(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_seed) { |
| 1028 | + int __pyx_r; |
| 1029 | + __Pyx_RefNannyDeclarations |
| 1030 | + PyObject *__pyx_t_1 = NULL; |
| 1031 | + PyObject *__pyx_t_2 = NULL; |
| 1032 | + PyObject *__pyx_t_3 = NULL; |
| 1033 | + int __pyx_lineno = 0; |
| 1034 | + const char *__pyx_filename = NULL; |
| 1035 | + int __pyx_clineno = 0; |
| 1036 | + __Pyx_RefNannySetupContext("__init__", 0); |
| 1037 | |
| 1038 | /* "mtrand.pyx":559 |
| 1039 | * |
| 1040 | @@ -4778,7 +4918,7 @@ |
| 1041 | * |
| 1042 | * self.seed(seed) |
| 1043 | */ |
| 1044 | - ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state = ((rk_state *)PyMem_Malloc((sizeof(rk_state)))); |
| 1045 | + __pyx_v_self->internal_state = ((rk_state *)PyMem_Malloc((sizeof(rk_state)))); |
| 1046 | |
| 1047 | /* "mtrand.pyx":561 |
| 1048 | * self.internal_state = <rk_state*>PyMem_Malloc(sizeof(rk_state)) |
| 1049 | @@ -4787,10 +4927,10 @@ |
| 1050 | * |
| 1051 | * def __dealloc__(self): |
| 1052 | */ |
| 1053 | - __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;} |
| 1054 | + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__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;} |
| 1055 | __Pyx_GOTREF(__pyx_t_1); |
| 1056 | __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;} |
| 1057 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 1058 | + __Pyx_GOTREF(__pyx_t_2); |
| 1059 | __Pyx_INCREF(__pyx_v_seed); |
| 1060 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_seed); |
| 1061 | __Pyx_GIVEREF(__pyx_v_seed); |
| 1062 | @@ -4813,6 +4953,15 @@ |
| 1063 | return __pyx_r; |
| 1064 | } |
| 1065 | |
| 1066 | +/* Python wrapper */ |
| 1067 | +static void __pyx_pw_6mtrand_11RandomState_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ |
| 1068 | +static void __pyx_pw_6mtrand_11RandomState_3__dealloc__(PyObject *__pyx_v_self) { |
| 1069 | + __Pyx_RefNannyDeclarations |
| 1070 | + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); |
| 1071 | + __pyx_pf_6mtrand_11RandomState_2__dealloc__(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)); |
| 1072 | + __Pyx_RefNannyFinishContext(); |
| 1073 | +} |
| 1074 | + |
| 1075 | /* "mtrand.pyx":563 |
| 1076 | * self.seed(seed) |
| 1077 | * |
| 1078 | @@ -4821,11 +4970,10 @@ |
| 1079 | * PyMem_Free(self.internal_state) |
| 1080 | */ |
| 1081 | |
| 1082 | -static void __pyx_pf_6mtrand_11RandomState_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ |
| 1083 | -static void __pyx_pf_6mtrand_11RandomState_1__dealloc__(PyObject *__pyx_v_self) { |
| 1084 | +static void __pyx_pf_6mtrand_11RandomState_2__dealloc__(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self) { |
| 1085 | __Pyx_RefNannyDeclarations |
| 1086 | int __pyx_t_1; |
| 1087 | - __Pyx_RefNannySetupContext("__dealloc__"); |
| 1088 | + __Pyx_RefNannySetupContext("__dealloc__", 0); |
| 1089 | |
| 1090 | /* "mtrand.pyx":564 |
| 1091 | * |
| 1092 | @@ -4834,7 +4982,7 @@ |
| 1093 | * PyMem_Free(self.internal_state) |
| 1094 | * self.internal_state = NULL |
| 1095 | */ |
| 1096 | - __pyx_t_1 = (((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state != NULL); |
| 1097 | + __pyx_t_1 = (__pyx_v_self->internal_state != NULL); |
| 1098 | if (__pyx_t_1) { |
| 1099 | |
| 1100 | /* "mtrand.pyx":565 |
| 1101 | @@ -4844,7 +4992,7 @@ |
| 1102 | * self.internal_state = NULL |
| 1103 | * |
| 1104 | */ |
| 1105 | - PyMem_Free(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); |
| 1106 | + PyMem_Free(__pyx_v_self->internal_state); |
| 1107 | |
| 1108 | /* "mtrand.pyx":566 |
| 1109 | * if self.internal_state != NULL: |
| 1110 | @@ -4853,52 +5001,44 @@ |
| 1111 | * |
| 1112 | * def seed(self, seed=None): |
| 1113 | */ |
| 1114 | - ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state = NULL; |
| 1115 | - goto __pyx_L5; |
| 1116 | + __pyx_v_self->internal_state = NULL; |
| 1117 | + goto __pyx_L3; |
| 1118 | } |
| 1119 | - __pyx_L5:; |
| 1120 | + __pyx_L3:; |
| 1121 | |
| 1122 | __Pyx_RefNannyFinishContext(); |
| 1123 | } |
| 1124 | |
| 1125 | -/* "mtrand.pyx":568 |
| 1126 | +/* Python wrapper */ |
| 1127 | +static PyObject *__pyx_pw_6mtrand_11RandomState_5seed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 1128 | +static char __pyx_doc_6mtrand_11RandomState_4seed[] = "\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 "; |
| 1129 | +static PyObject *__pyx_pw_6mtrand_11RandomState_5seed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 1130 | + PyObject *__pyx_v_seed = 0; |
| 1131 | + PyObject *__pyx_r = 0; |
| 1132 | + __Pyx_RefNannyDeclarations |
| 1133 | + __Pyx_RefNannySetupContext("seed (wrapper)", 0); |
| 1134 | + { |
| 1135 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__seed,0}; |
| 1136 | + PyObject* values[1] = {0}; |
| 1137 | + |
| 1138 | + /* "mtrand.pyx":568 |
| 1139 | * self.internal_state = NULL |
| 1140 | * |
| 1141 | * def seed(self, seed=None): # <<<<<<<<<<<<<< |
| 1142 | * """ |
| 1143 | * seed(seed=None) |
| 1144 | */ |
| 1145 | - |
| 1146 | -static PyObject *__pyx_pf_6mtrand_11RandomState_2seed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 1147 | -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 "; |
| 1148 | -static PyObject *__pyx_pf_6mtrand_11RandomState_2seed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 1149 | - PyObject *__pyx_v_seed = 0; |
| 1150 | - rk_error __pyx_v_errcode; |
| 1151 | - PyArrayObject *arrayObject_obj = 0; |
| 1152 | - PyObject *__pyx_v_iseed = NULL; |
| 1153 | - PyObject *__pyx_r = NULL; |
| 1154 | - __Pyx_RefNannyDeclarations |
| 1155 | - int __pyx_t_1; |
| 1156 | - unsigned long __pyx_t_2; |
| 1157 | - PyObject *__pyx_t_3 = NULL; |
| 1158 | - PyObject *__pyx_t_4 = NULL; |
| 1159 | - int __pyx_lineno = 0; |
| 1160 | - const char *__pyx_filename = NULL; |
| 1161 | - int __pyx_clineno = 0; |
| 1162 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__seed,0}; |
| 1163 | - __Pyx_RefNannySetupContext("seed"); |
| 1164 | - { |
| 1165 | - PyObject* values[1] = {0}; |
| 1166 | values[0] = ((PyObject *)Py_None); |
| 1167 | if (unlikely(__pyx_kwds)) { |
| 1168 | Py_ssize_t kw_args; |
| 1169 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 1170 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 1171 | + switch (pos_args) { |
| 1172 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 1173 | case 0: break; |
| 1174 | default: goto __pyx_L5_argtuple_error; |
| 1175 | } |
| 1176 | kw_args = PyDict_Size(__pyx_kwds); |
| 1177 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 1178 | + switch (pos_args) { |
| 1179 | case 0: |
| 1180 | if (kw_args > 0) { |
| 1181 | PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seed); |
| 1182 | @@ -4906,7 +5046,7 @@ |
| 1183 | } |
| 1184 | } |
| 1185 | if (unlikely(kw_args > 0)) { |
| 1186 | - 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;} |
| 1187 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "seed") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 1188 | } |
| 1189 | } else { |
| 1190 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 1191 | @@ -4925,6 +5065,25 @@ |
| 1192 | __Pyx_RefNannyFinishContext(); |
| 1193 | return NULL; |
| 1194 | __pyx_L4_argument_unpacking_done:; |
| 1195 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_4seed(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_seed); |
| 1196 | + __Pyx_RefNannyFinishContext(); |
| 1197 | + return __pyx_r; |
| 1198 | +} |
| 1199 | + |
| 1200 | +static PyObject *__pyx_pf_6mtrand_11RandomState_4seed(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_seed) { |
| 1201 | + CYTHON_UNUSED rk_error __pyx_v_errcode; |
| 1202 | + PyArrayObject *arrayObject_obj = 0; |
| 1203 | + PyObject *__pyx_v_iseed = NULL; |
| 1204 | + PyObject *__pyx_r = NULL; |
| 1205 | + __Pyx_RefNannyDeclarations |
| 1206 | + int __pyx_t_1; |
| 1207 | + unsigned long __pyx_t_2; |
| 1208 | + PyObject *__pyx_t_3 = NULL; |
| 1209 | + PyObject *__pyx_t_4 = NULL; |
| 1210 | + int __pyx_lineno = 0; |
| 1211 | + const char *__pyx_filename = NULL; |
| 1212 | + int __pyx_clineno = 0; |
| 1213 | + __Pyx_RefNannySetupContext("seed", 0); |
| 1214 | |
| 1215 | /* "mtrand.pyx":589 |
| 1216 | * cdef rk_error errcode |
| 1217 | @@ -4943,8 +5102,8 @@ |
| 1218 | * elif type(seed) is int: |
| 1219 | * rk_seed(seed, self.internal_state) |
| 1220 | */ |
| 1221 | - __pyx_v_errcode = rk_randomseed(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); |
| 1222 | - goto __pyx_L6; |
| 1223 | + __pyx_v_errcode = rk_randomseed(__pyx_v_self->internal_state); |
| 1224 | + goto __pyx_L3; |
| 1225 | } |
| 1226 | |
| 1227 | /* "mtrand.pyx":591 |
| 1228 | @@ -4965,8 +5124,8 @@ |
| 1229 | * iseed = int(seed) |
| 1230 | */ |
| 1231 | __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;} |
| 1232 | - rk_seed(__pyx_t_2, ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); |
| 1233 | - goto __pyx_L6; |
| 1234 | + rk_seed(__pyx_t_2, __pyx_v_self->internal_state); |
| 1235 | + goto __pyx_L3; |
| 1236 | } |
| 1237 | |
| 1238 | /* "mtrand.pyx":593 |
| 1239 | @@ -4993,7 +5152,7 @@ |
| 1240 | * else: |
| 1241 | */ |
| 1242 | __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;} |
| 1243 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 1244 | + __Pyx_GOTREF(__pyx_t_4); |
| 1245 | __Pyx_INCREF(__pyx_v_seed); |
| 1246 | PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_seed); |
| 1247 | __Pyx_GIVEREF(__pyx_v_seed); |
| 1248 | @@ -5011,8 +5170,8 @@ |
| 1249 | * obj = <ndarray>PyArray_ContiguousFromObject(seed, NPY_LONG, 1, 1) |
| 1250 | */ |
| 1251 | __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;} |
| 1252 | - rk_seed(__pyx_t_2, ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); |
| 1253 | - goto __pyx_L6; |
| 1254 | + rk_seed(__pyx_t_2, __pyx_v_self->internal_state); |
| 1255 | + goto __pyx_L3; |
| 1256 | } |
| 1257 | /*else*/ { |
| 1258 | |
| 1259 | @@ -5036,9 +5195,9 @@ |
| 1260 | * |
| 1261 | * def get_state(self): |
| 1262 | */ |
| 1263 | - init_by_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state, ((unsigned long *)arrayObject_obj->data), (arrayObject_obj->dimensions[0])); |
| 1264 | + init_by_array(__pyx_v_self->internal_state, ((unsigned long *)arrayObject_obj->data), (arrayObject_obj->dimensions[0])); |
| 1265 | } |
| 1266 | - __pyx_L6:; |
| 1267 | + __pyx_L3:; |
| 1268 | |
| 1269 | __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| 1270 | goto __pyx_L0; |
| 1271 | @@ -5055,6 +5214,18 @@ |
| 1272 | return __pyx_r; |
| 1273 | } |
| 1274 | |
| 1275 | +/* Python wrapper */ |
| 1276 | +static PyObject *__pyx_pw_6mtrand_11RandomState_7get_state(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| 1277 | +static char __pyx_doc_6mtrand_11RandomState_6get_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 "; |
| 1278 | +static PyObject *__pyx_pw_6mtrand_11RandomState_7get_state(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { |
| 1279 | + PyObject *__pyx_r = 0; |
| 1280 | + __Pyx_RefNannyDeclarations |
| 1281 | + __Pyx_RefNannySetupContext("get_state (wrapper)", 0); |
| 1282 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_6get_state(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)); |
| 1283 | + __Pyx_RefNannyFinishContext(); |
| 1284 | + return __pyx_r; |
| 1285 | +} |
| 1286 | + |
| 1287 | /* "mtrand.pyx":601 |
| 1288 | * obj.dimensions[0]) |
| 1289 | * |
| 1290 | @@ -5063,9 +5234,7 @@ |
| 1291 | * get_state() |
| 1292 | */ |
| 1293 | |
| 1294 | -static PyObject *__pyx_pf_6mtrand_11RandomState_3get_state(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| 1295 | -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 "; |
| 1296 | -static PyObject *__pyx_pf_6mtrand_11RandomState_3get_state(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { |
| 1297 | +static PyObject *__pyx_pf_6mtrand_11RandomState_6get_state(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self) { |
| 1298 | PyArrayObject *arrayObject_state = 0; |
| 1299 | PyObject *__pyx_r = NULL; |
| 1300 | __Pyx_RefNannyDeclarations |
| 1301 | @@ -5076,7 +5245,7 @@ |
| 1302 | int __pyx_lineno = 0; |
| 1303 | const char *__pyx_filename = NULL; |
| 1304 | int __pyx_clineno = 0; |
| 1305 | - __Pyx_RefNannySetupContext("get_state"); |
| 1306 | + __Pyx_RefNannySetupContext("get_state", 0); |
| 1307 | |
| 1308 | /* "mtrand.pyx":632 |
| 1309 | * """ |
| 1310 | @@ -5096,7 +5265,7 @@ |
| 1311 | __Pyx_GOTREF(__pyx_t_3); |
| 1312 | __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| 1313 | __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;} |
| 1314 | - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); |
| 1315 | + __Pyx_GOTREF(__pyx_t_1); |
| 1316 | __Pyx_INCREF(__pyx_int_624); |
| 1317 | PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_624); |
| 1318 | __Pyx_GIVEREF(__pyx_int_624); |
| 1319 | @@ -5118,7 +5287,7 @@ |
| 1320 | * state = <ndarray>np.asarray(state, np.uint32) |
| 1321 | * return ('MT19937', state, self.internal_state.pos, |
| 1322 | */ |
| 1323 | - memcpy(((void *)arrayObject_state->data), ((void *)((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->key), (624 * (sizeof(long)))); |
| 1324 | + memcpy(((void *)arrayObject_state->data), ((void *)__pyx_v_self->internal_state->key), (624 * (sizeof(long)))); |
| 1325 | |
| 1326 | /* "mtrand.pyx":634 |
| 1327 | * state = <ndarray>np.empty(624, np.uint) |
| 1328 | @@ -5138,7 +5307,7 @@ |
| 1329 | __Pyx_GOTREF(__pyx_t_2); |
| 1330 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 1331 | __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;} |
| 1332 | - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| 1333 | + __Pyx_GOTREF(__pyx_t_3); |
| 1334 | __Pyx_INCREF(((PyObject *)arrayObject_state)); |
| 1335 | PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)arrayObject_state)); |
| 1336 | __Pyx_GIVEREF(((PyObject *)arrayObject_state)); |
| 1337 | @@ -5162,7 +5331,7 @@ |
| 1338 | * |
| 1339 | */ |
| 1340 | __Pyx_XDECREF(__pyx_r); |
| 1341 | - __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;} |
| 1342 | + __pyx_t_2 = PyInt_FromLong(__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;} |
| 1343 | __Pyx_GOTREF(__pyx_t_2); |
| 1344 | |
| 1345 | /* "mtrand.pyx":636 |
| 1346 | @@ -5172,12 +5341,12 @@ |
| 1347 | * |
| 1348 | * def set_state(self, state): |
| 1349 | */ |
| 1350 | - __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;} |
| 1351 | + __pyx_t_3 = PyInt_FromLong(__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;} |
| 1352 | __Pyx_GOTREF(__pyx_t_3); |
| 1353 | - __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;} |
| 1354 | + __pyx_t_1 = PyFloat_FromDouble(__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;} |
| 1355 | __Pyx_GOTREF(__pyx_t_1); |
| 1356 | __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;} |
| 1357 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 1358 | + __Pyx_GOTREF(__pyx_t_4); |
| 1359 | __Pyx_INCREF(((PyObject *)__pyx_n_s__MT19937)); |
| 1360 | PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_n_s__MT19937)); |
| 1361 | __Pyx_GIVEREF(((PyObject *)__pyx_n_s__MT19937)); |
| 1362 | @@ -5213,6 +5382,18 @@ |
| 1363 | return __pyx_r; |
| 1364 | } |
| 1365 | |
| 1366 | +/* Python wrapper */ |
| 1367 | +static PyObject *__pyx_pw_6mtrand_11RandomState_9set_state(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ |
| 1368 | +static char __pyx_doc_6mtrand_11RandomState_8set_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 "; |
| 1369 | +static PyObject *__pyx_pw_6mtrand_11RandomState_9set_state(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { |
| 1370 | + PyObject *__pyx_r = 0; |
| 1371 | + __Pyx_RefNannyDeclarations |
| 1372 | + __Pyx_RefNannySetupContext("set_state (wrapper)", 0); |
| 1373 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_8set_state(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), ((PyObject *)__pyx_v_state)); |
| 1374 | + __Pyx_RefNannyFinishContext(); |
| 1375 | + return __pyx_r; |
| 1376 | +} |
| 1377 | + |
| 1378 | /* "mtrand.pyx":638 |
| 1379 | * self.internal_state.has_gauss, self.internal_state.gauss) |
| 1380 | * |
| 1381 | @@ -5221,9 +5402,7 @@ |
| 1382 | * set_state(state) |
| 1383 | */ |
| 1384 | |
| 1385 | -static PyObject *__pyx_pf_6mtrand_11RandomState_4set_state(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ |
| 1386 | -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 "; |
| 1387 | -static PyObject *__pyx_pf_6mtrand_11RandomState_4set_state(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { |
| 1388 | +static PyObject *__pyx_pf_6mtrand_11RandomState_8set_state(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_state) { |
| 1389 | PyArrayObject *arrayObject_obj = 0; |
| 1390 | int __pyx_v_pos; |
| 1391 | PyObject *__pyx_v_algorithm_name = NULL; |
| 1392 | @@ -5247,7 +5426,7 @@ |
| 1393 | int __pyx_lineno = 0; |
| 1394 | const char *__pyx_filename = NULL; |
| 1395 | int __pyx_clineno = 0; |
| 1396 | - __Pyx_RefNannySetupContext("set_state"); |
| 1397 | + __Pyx_RefNannySetupContext("set_state", 0); |
| 1398 | |
| 1399 | /* "mtrand.pyx":687 |
| 1400 | * cdef ndarray obj "arrayObject_obj" |
| 1401 | @@ -5268,7 +5447,9 @@ |
| 1402 | * raise ValueError("algorithm must be 'MT19937'") |
| 1403 | * key, pos = state[1:3] |
| 1404 | */ |
| 1405 | - __pyx_t_2 = __Pyx_PyString_Equals(__pyx_v_algorithm_name, ((PyObject *)__pyx_n_s__MT19937), Py_NE); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 1406 | + __pyx_t_1 = PyObject_RichCompare(__pyx_v_algorithm_name, ((PyObject *)__pyx_n_s__MT19937), Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 1407 | + __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;} |
| 1408 | + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| 1409 | if (__pyx_t_2) { |
| 1410 | |
| 1411 | /* "mtrand.pyx":689 |
| 1412 | @@ -5283,9 +5464,9 @@ |
| 1413 | __Pyx_Raise(__pyx_t_1, 0, 0, 0); |
| 1414 | __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| 1415 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 1416 | - goto __pyx_L5; |
| 1417 | + goto __pyx_L3; |
| 1418 | } |
| 1419 | - __pyx_L5:; |
| 1420 | + __pyx_L3:; |
| 1421 | |
| 1422 | /* "mtrand.pyx":690 |
| 1423 | * if algorithm_name != 'MT19937': |
| 1424 | @@ -5298,45 +5479,52 @@ |
| 1425 | __Pyx_GOTREF(__pyx_t_1); |
| 1426 | if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { |
| 1427 | PyObject* sequence = __pyx_t_1; |
| 1428 | + #if CYTHON_COMPILING_IN_CPYTHON |
| 1429 | + Py_ssize_t size = Py_SIZE(sequence); |
| 1430 | + #else |
| 1431 | + Py_ssize_t size = PySequence_Size(sequence); |
| 1432 | + #endif |
| 1433 | + if (unlikely(size != 2)) { |
| 1434 | + if (size > 2) __Pyx_RaiseTooManyValuesError(2); |
| 1435 | + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); |
| 1436 | + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 1437 | + } |
| 1438 | + #if CYTHON_COMPILING_IN_CPYTHON |
| 1439 | if (likely(PyTuple_CheckExact(sequence))) { |
| 1440 | - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { |
| 1441 | - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); |
| 1442 | - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); |
| 1443 | - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 1444 | - } |
| 1445 | __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); |
| 1446 | __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); |
| 1447 | } else { |
| 1448 | - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { |
| 1449 | - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); |
| 1450 | - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); |
| 1451 | - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 1452 | - } |
| 1453 | __pyx_t_3 = PyList_GET_ITEM(sequence, 0); |
| 1454 | __pyx_t_4 = PyList_GET_ITEM(sequence, 1); |
| 1455 | } |
| 1456 | __Pyx_INCREF(__pyx_t_3); |
| 1457 | __Pyx_INCREF(__pyx_t_4); |
| 1458 | + #else |
| 1459 | + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 1460 | + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 1461 | + #endif |
| 1462 | __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| 1463 | - } else { |
| 1464 | + } else |
| 1465 | + { |
| 1466 | Py_ssize_t index = -1; |
| 1467 | __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 1468 | __Pyx_GOTREF(__pyx_t_5); |
| 1469 | __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| 1470 | __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; |
| 1471 | - index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed; |
| 1472 | + index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed; |
| 1473 | __Pyx_GOTREF(__pyx_t_3); |
| 1474 | - index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed; |
| 1475 | + index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed; |
| 1476 | __Pyx_GOTREF(__pyx_t_4); |
| 1477 | if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 1478 | + __pyx_t_6 = NULL; |
| 1479 | __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| 1480 | - goto __pyx_L7_unpacking_done; |
| 1481 | - __pyx_L6_unpacking_failed:; |
| 1482 | + goto __pyx_L5_unpacking_done; |
| 1483 | + __pyx_L4_unpacking_failed:; |
| 1484 | __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| 1485 | - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); |
| 1486 | - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); |
| 1487 | + __pyx_t_6 = NULL; |
| 1488 | + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); |
| 1489 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 1490 | - __pyx_L7_unpacking_done:; |
| 1491 | + __pyx_L5_unpacking_done:; |
| 1492 | } |
| 1493 | __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 1494 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 1495 | @@ -5376,7 +5564,7 @@ |
| 1496 | __Pyx_GOTREF(__pyx_t_1); |
| 1497 | __pyx_v_cached_gaussian = __pyx_t_1; |
| 1498 | __pyx_t_1 = 0; |
| 1499 | - goto __pyx_L8; |
| 1500 | + goto __pyx_L6; |
| 1501 | } |
| 1502 | /*else*/ { |
| 1503 | |
| 1504 | @@ -5391,52 +5579,59 @@ |
| 1505 | __Pyx_GOTREF(__pyx_t_1); |
| 1506 | if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { |
| 1507 | PyObject* sequence = __pyx_t_1; |
| 1508 | + #if CYTHON_COMPILING_IN_CPYTHON |
| 1509 | + Py_ssize_t size = Py_SIZE(sequence); |
| 1510 | + #else |
| 1511 | + Py_ssize_t size = PySequence_Size(sequence); |
| 1512 | + #endif |
| 1513 | + if (unlikely(size != 2)) { |
| 1514 | + if (size > 2) __Pyx_RaiseTooManyValuesError(2); |
| 1515 | + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); |
| 1516 | + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 1517 | + } |
| 1518 | + #if CYTHON_COMPILING_IN_CPYTHON |
| 1519 | if (likely(PyTuple_CheckExact(sequence))) { |
| 1520 | - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { |
| 1521 | - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); |
| 1522 | - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); |
| 1523 | - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 1524 | - } |
| 1525 | __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); |
| 1526 | __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); |
| 1527 | } else { |
| 1528 | - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { |
| 1529 | - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); |
| 1530 | - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); |
| 1531 | - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 1532 | - } |
| 1533 | __pyx_t_4 = PyList_GET_ITEM(sequence, 0); |
| 1534 | __pyx_t_3 = PyList_GET_ITEM(sequence, 1); |
| 1535 | } |
| 1536 | __Pyx_INCREF(__pyx_t_4); |
| 1537 | __Pyx_INCREF(__pyx_t_3); |
| 1538 | + #else |
| 1539 | + __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 1540 | + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 1541 | + #endif |
| 1542 | __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| 1543 | - } else { |
| 1544 | + } else |
| 1545 | + { |
| 1546 | Py_ssize_t index = -1; |
| 1547 | __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 1548 | __Pyx_GOTREF(__pyx_t_5); |
| 1549 | __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| 1550 | __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; |
| 1551 | - index = 0; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L9_unpacking_failed; |
| 1552 | + index = 0; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L7_unpacking_failed; |
| 1553 | __Pyx_GOTREF(__pyx_t_4); |
| 1554 | - index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L9_unpacking_failed; |
| 1555 | + index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L7_unpacking_failed; |
| 1556 | __Pyx_GOTREF(__pyx_t_3); |
| 1557 | if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 1558 | + __pyx_t_6 = NULL; |
| 1559 | __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| 1560 | - goto __pyx_L10_unpacking_done; |
| 1561 | - __pyx_L9_unpacking_failed:; |
| 1562 | + goto __pyx_L8_unpacking_done; |
| 1563 | + __pyx_L7_unpacking_failed:; |
| 1564 | __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| 1565 | - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); |
| 1566 | - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); |
| 1567 | + __pyx_t_6 = NULL; |
| 1568 | + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); |
| 1569 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 1570 | - __pyx_L10_unpacking_done:; |
| 1571 | + __pyx_L8_unpacking_done:; |
| 1572 | } |
| 1573 | __pyx_v_has_gauss = __pyx_t_4; |
| 1574 | __pyx_t_4 = 0; |
| 1575 | __pyx_v_cached_gaussian = __pyx_t_3; |
| 1576 | __pyx_t_3 = 0; |
| 1577 | } |
| 1578 | - __pyx_L8:; |
| 1579 | + __pyx_L6:; |
| 1580 | |
| 1581 | /* "mtrand.pyx":696 |
| 1582 | * else: |
| 1583 | @@ -5459,7 +5654,7 @@ |
| 1584 | * except TypeError: |
| 1585 | * # compatibility -- could be an older pickle |
| 1586 | */ |
| 1587 | - __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_L11_error;} |
| 1588 | + __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_L9_error;} |
| 1589 | __Pyx_GOTREF(__pyx_t_1); |
| 1590 | __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_1))); |
| 1591 | arrayObject_obj = ((PyArrayObject *)__pyx_t_1); |
| 1592 | @@ -5468,8 +5663,8 @@ |
| 1593 | __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; |
| 1594 | __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; |
| 1595 | __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; |
| 1596 | - goto __pyx_L18_try_end; |
| 1597 | - __pyx_L11_error:; |
| 1598 | + goto __pyx_L16_try_end; |
| 1599 | + __pyx_L9_error:; |
| 1600 | __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; |
| 1601 | __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 1602 | __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 1603 | @@ -5485,7 +5680,7 @@ |
| 1604 | __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_TypeError); |
| 1605 | if (__pyx_t_7) { |
| 1606 | __Pyx_AddTraceback("mtrand.RandomState.set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); |
| 1607 | - 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_L13_except_error;} |
| 1608 | + 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_L11_except_error;} |
| 1609 | __Pyx_GOTREF(__pyx_t_1); |
| 1610 | __Pyx_GOTREF(__pyx_t_3); |
| 1611 | __Pyx_GOTREF(__pyx_t_4); |
| 1612 | @@ -5497,7 +5692,7 @@ |
| 1613 | * if obj.dimensions[0] != 624: |
| 1614 | * raise ValueError("state must be 624 longs") |
| 1615 | */ |
| 1616 | - __pyx_t_5 = PyArray_ContiguousFromObject(__pyx_v_key, NPY_LONG, 1, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;} |
| 1617 | + __pyx_t_5 = PyArray_ContiguousFromObject(__pyx_v_key, NPY_LONG, 1, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;} |
| 1618 | __Pyx_GOTREF(__pyx_t_5); |
| 1619 | __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_5))); |
| 1620 | __Pyx_XDECREF(((PyObject *)arrayObject_obj)); |
| 1621 | @@ -5506,20 +5701,20 @@ |
| 1622 | __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| 1623 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 1624 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 1625 | - goto __pyx_L12_exception_handled; |
| 1626 | + goto __pyx_L10_exception_handled; |
| 1627 | } |
| 1628 | - __pyx_L13_except_error:; |
| 1629 | + __pyx_L11_except_error:; |
| 1630 | __Pyx_XGIVEREF(__pyx_t_9); |
| 1631 | __Pyx_XGIVEREF(__pyx_t_10); |
| 1632 | __Pyx_XGIVEREF(__pyx_t_11); |
| 1633 | __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); |
| 1634 | goto __pyx_L1_error; |
| 1635 | - __pyx_L12_exception_handled:; |
| 1636 | + __pyx_L10_exception_handled:; |
| 1637 | __Pyx_XGIVEREF(__pyx_t_9); |
| 1638 | __Pyx_XGIVEREF(__pyx_t_10); |
| 1639 | __Pyx_XGIVEREF(__pyx_t_11); |
| 1640 | __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); |
| 1641 | - __pyx_L18_try_end:; |
| 1642 | + __pyx_L16_try_end:; |
| 1643 | } |
| 1644 | |
| 1645 | /* "mtrand.pyx":701 |
| 1646 | @@ -5544,9 +5739,9 @@ |
| 1647 | __Pyx_Raise(__pyx_t_4, 0, 0, 0); |
| 1648 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 1649 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 1650 | - goto __pyx_L21; |
| 1651 | + goto __pyx_L19; |
| 1652 | } |
| 1653 | - __pyx_L21:; |
| 1654 | + __pyx_L19:; |
| 1655 | |
| 1656 | /* "mtrand.pyx":703 |
| 1657 | * if obj.dimensions[0] != 624: |
| 1658 | @@ -5555,7 +5750,7 @@ |
| 1659 | * self.internal_state.pos = pos |
| 1660 | * self.internal_state.has_gauss = has_gauss |
| 1661 | */ |
| 1662 | - memcpy(((void *)((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->key), ((void *)arrayObject_obj->data), (624 * (sizeof(long)))); |
| 1663 | + memcpy(((void *)__pyx_v_self->internal_state->key), ((void *)arrayObject_obj->data), (624 * (sizeof(long)))); |
| 1664 | |
| 1665 | /* "mtrand.pyx":704 |
| 1666 | * raise ValueError("state must be 624 longs") |
| 1667 | @@ -5564,7 +5759,7 @@ |
| 1668 | * self.internal_state.has_gauss = has_gauss |
| 1669 | * self.internal_state.gauss = cached_gaussian |
| 1670 | */ |
| 1671 | - ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos = __pyx_v_pos; |
| 1672 | + __pyx_v_self->internal_state->pos = __pyx_v_pos; |
| 1673 | |
| 1674 | /* "mtrand.pyx":705 |
| 1675 | * memcpy(<void*>(self.internal_state.key), <void*>(obj.data), 624*sizeof(long)) |
| 1676 | @@ -5574,7 +5769,7 @@ |
| 1677 | * |
| 1678 | */ |
| 1679 | __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_v_has_gauss); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 1680 | - ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->has_gauss = __pyx_t_7; |
| 1681 | + __pyx_v_self->internal_state->has_gauss = __pyx_t_7; |
| 1682 | |
| 1683 | /* "mtrand.pyx":706 |
| 1684 | * self.internal_state.pos = pos |
| 1685 | @@ -5584,7 +5779,7 @@ |
| 1686 | * # Pickling support: |
| 1687 | */ |
| 1688 | __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_cached_gaussian); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 1689 | - ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->gauss = __pyx_t_12; |
| 1690 | + __pyx_v_self->internal_state->gauss = __pyx_t_12; |
| 1691 | |
| 1692 | __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| 1693 | goto __pyx_L0; |
| 1694 | @@ -5606,6 +5801,17 @@ |
| 1695 | return __pyx_r; |
| 1696 | } |
| 1697 | |
| 1698 | +/* Python wrapper */ |
| 1699 | +static PyObject *__pyx_pw_6mtrand_11RandomState_11__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| 1700 | +static PyObject *__pyx_pw_6mtrand_11RandomState_11__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { |
| 1701 | + PyObject *__pyx_r = 0; |
| 1702 | + __Pyx_RefNannyDeclarations |
| 1703 | + __Pyx_RefNannySetupContext("__getstate__ (wrapper)", 0); |
| 1704 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_10__getstate__(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)); |
| 1705 | + __Pyx_RefNannyFinishContext(); |
| 1706 | + return __pyx_r; |
| 1707 | +} |
| 1708 | + |
| 1709 | /* "mtrand.pyx":709 |
| 1710 | * |
| 1711 | * # Pickling support: |
| 1712 | @@ -5614,8 +5820,7 @@ |
| 1713 | * |
| 1714 | */ |
| 1715 | |
| 1716 | -static PyObject *__pyx_pf_6mtrand_11RandomState_5__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| 1717 | -static PyObject *__pyx_pf_6mtrand_11RandomState_5__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { |
| 1718 | +static PyObject *__pyx_pf_6mtrand_11RandomState_10__getstate__(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self) { |
| 1719 | PyObject *__pyx_r = NULL; |
| 1720 | __Pyx_RefNannyDeclarations |
| 1721 | PyObject *__pyx_t_1 = NULL; |
| 1722 | @@ -5623,7 +5828,7 @@ |
| 1723 | int __pyx_lineno = 0; |
| 1724 | const char *__pyx_filename = NULL; |
| 1725 | int __pyx_clineno = 0; |
| 1726 | - __Pyx_RefNannySetupContext("__getstate__"); |
| 1727 | + __Pyx_RefNannySetupContext("__getstate__", 0); |
| 1728 | |
| 1729 | /* "mtrand.pyx":710 |
| 1730 | * # Pickling support: |
| 1731 | @@ -5633,7 +5838,7 @@ |
| 1732 | * def __setstate__(self, state): |
| 1733 | */ |
| 1734 | __Pyx_XDECREF(__pyx_r); |
| 1735 | - __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;} |
| 1736 | + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__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;} |
| 1737 | __Pyx_GOTREF(__pyx_t_1); |
| 1738 | __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;} |
| 1739 | __Pyx_GOTREF(__pyx_t_2); |
| 1740 | @@ -5655,6 +5860,17 @@ |
| 1741 | return __pyx_r; |
| 1742 | } |
| 1743 | |
| 1744 | +/* Python wrapper */ |
| 1745 | +static PyObject *__pyx_pw_6mtrand_11RandomState_13__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ |
| 1746 | +static PyObject *__pyx_pw_6mtrand_11RandomState_13__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { |
| 1747 | + PyObject *__pyx_r = 0; |
| 1748 | + __Pyx_RefNannyDeclarations |
| 1749 | + __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); |
| 1750 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_12__setstate__(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), ((PyObject *)__pyx_v_state)); |
| 1751 | + __Pyx_RefNannyFinishContext(); |
| 1752 | + return __pyx_r; |
| 1753 | +} |
| 1754 | + |
| 1755 | /* "mtrand.pyx":712 |
| 1756 | * return self.get_state() |
| 1757 | * |
| 1758 | @@ -5663,8 +5879,7 @@ |
| 1759 | * |
| 1760 | */ |
| 1761 | |
| 1762 | -static PyObject *__pyx_pf_6mtrand_11RandomState_6__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ |
| 1763 | -static PyObject *__pyx_pf_6mtrand_11RandomState_6__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { |
| 1764 | +static PyObject *__pyx_pf_6mtrand_11RandomState_12__setstate__(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_state) { |
| 1765 | PyObject *__pyx_r = NULL; |
| 1766 | __Pyx_RefNannyDeclarations |
| 1767 | PyObject *__pyx_t_1 = NULL; |
| 1768 | @@ -5673,7 +5888,7 @@ |
| 1769 | int __pyx_lineno = 0; |
| 1770 | const char *__pyx_filename = NULL; |
| 1771 | int __pyx_clineno = 0; |
| 1772 | - __Pyx_RefNannySetupContext("__setstate__"); |
| 1773 | + __Pyx_RefNannySetupContext("__setstate__", 0); |
| 1774 | |
| 1775 | /* "mtrand.pyx":713 |
| 1776 | * |
| 1777 | @@ -5682,10 +5897,10 @@ |
| 1778 | * |
| 1779 | * def __reduce__(self): |
| 1780 | */ |
| 1781 | - __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;} |
| 1782 | + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__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;} |
| 1783 | __Pyx_GOTREF(__pyx_t_1); |
| 1784 | __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;} |
| 1785 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 1786 | + __Pyx_GOTREF(__pyx_t_2); |
| 1787 | __Pyx_INCREF(__pyx_v_state); |
| 1788 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_state); |
| 1789 | __Pyx_GIVEREF(__pyx_v_state); |
| 1790 | @@ -5709,6 +5924,17 @@ |
| 1791 | return __pyx_r; |
| 1792 | } |
| 1793 | |
| 1794 | +/* Python wrapper */ |
| 1795 | +static PyObject *__pyx_pw_6mtrand_11RandomState_15__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| 1796 | +static PyObject *__pyx_pw_6mtrand_11RandomState_15__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { |
| 1797 | + PyObject *__pyx_r = 0; |
| 1798 | + __Pyx_RefNannyDeclarations |
| 1799 | + __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); |
| 1800 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_14__reduce__(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)); |
| 1801 | + __Pyx_RefNannyFinishContext(); |
| 1802 | + return __pyx_r; |
| 1803 | +} |
| 1804 | + |
| 1805 | /* "mtrand.pyx":715 |
| 1806 | * self.set_state(state) |
| 1807 | * |
| 1808 | @@ -5717,8 +5943,7 @@ |
| 1809 | * |
| 1810 | */ |
| 1811 | |
| 1812 | -static PyObject *__pyx_pf_6mtrand_11RandomState_7__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ |
| 1813 | -static PyObject *__pyx_pf_6mtrand_11RandomState_7__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { |
| 1814 | +static PyObject *__pyx_pf_6mtrand_11RandomState_14__reduce__(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self) { |
| 1815 | PyObject *__pyx_r = NULL; |
| 1816 | __Pyx_RefNannyDeclarations |
| 1817 | PyObject *__pyx_t_1 = NULL; |
| 1818 | @@ -5727,7 +5952,7 @@ |
| 1819 | int __pyx_lineno = 0; |
| 1820 | const char *__pyx_filename = NULL; |
| 1821 | int __pyx_clineno = 0; |
| 1822 | - __Pyx_RefNannySetupContext("__reduce__"); |
| 1823 | + __Pyx_RefNannySetupContext("__reduce__", 0); |
| 1824 | |
| 1825 | /* "mtrand.pyx":716 |
| 1826 | * |
| 1827 | @@ -5745,13 +5970,13 @@ |
| 1828 | __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;} |
| 1829 | __Pyx_GOTREF(__pyx_t_1); |
| 1830 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 1831 | - __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;} |
| 1832 | + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__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;} |
| 1833 | __Pyx_GOTREF(__pyx_t_2); |
| 1834 | __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;} |
| 1835 | __Pyx_GOTREF(__pyx_t_3); |
| 1836 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 1837 | __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;} |
| 1838 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 1839 | + __Pyx_GOTREF(__pyx_t_2); |
| 1840 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); |
| 1841 | __Pyx_GIVEREF(__pyx_t_1); |
| 1842 | __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); |
| 1843 | @@ -5779,38 +6004,36 @@ |
| 1844 | return __pyx_r; |
| 1845 | } |
| 1846 | |
| 1847 | -/* "mtrand.pyx":719 |
| 1848 | +/* Python wrapper */ |
| 1849 | +static PyObject *__pyx_pw_6mtrand_11RandomState_17random_sample(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 1850 | +static char __pyx_doc_6mtrand_11RandomState_16random_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 "; |
| 1851 | +static PyObject *__pyx_pw_6mtrand_11RandomState_17random_sample(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 1852 | + PyObject *__pyx_v_size = 0; |
| 1853 | + PyObject *__pyx_r = 0; |
| 1854 | + __Pyx_RefNannyDeclarations |
| 1855 | + __Pyx_RefNannySetupContext("random_sample (wrapper)", 0); |
| 1856 | + { |
| 1857 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,0}; |
| 1858 | + PyObject* values[1] = {0}; |
| 1859 | + |
| 1860 | + /* "mtrand.pyx":719 |
| 1861 | * |
| 1862 | * # Basic distributions: |
| 1863 | * def random_sample(self, size=None): # <<<<<<<<<<<<<< |
| 1864 | * """ |
| 1865 | * random_sample(size=None) |
| 1866 | */ |
| 1867 | - |
| 1868 | -static PyObject *__pyx_pf_6mtrand_11RandomState_8random_sample(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 1869 | -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 "; |
| 1870 | -static PyObject *__pyx_pf_6mtrand_11RandomState_8random_sample(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 1871 | - PyObject *__pyx_v_size = 0; |
| 1872 | - PyObject *__pyx_r = NULL; |
| 1873 | - __Pyx_RefNannyDeclarations |
| 1874 | - PyObject *__pyx_t_1 = NULL; |
| 1875 | - int __pyx_lineno = 0; |
| 1876 | - const char *__pyx_filename = NULL; |
| 1877 | - int __pyx_clineno = 0; |
| 1878 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,0}; |
| 1879 | - __Pyx_RefNannySetupContext("random_sample"); |
| 1880 | - { |
| 1881 | - PyObject* values[1] = {0}; |
| 1882 | values[0] = ((PyObject *)Py_None); |
| 1883 | if (unlikely(__pyx_kwds)) { |
| 1884 | Py_ssize_t kw_args; |
| 1885 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 1886 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 1887 | + switch (pos_args) { |
| 1888 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 1889 | case 0: break; |
| 1890 | default: goto __pyx_L5_argtuple_error; |
| 1891 | } |
| 1892 | kw_args = PyDict_Size(__pyx_kwds); |
| 1893 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 1894 | + switch (pos_args) { |
| 1895 | case 0: |
| 1896 | if (kw_args > 0) { |
| 1897 | PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size); |
| 1898 | @@ -5818,7 +6041,7 @@ |
| 1899 | } |
| 1900 | } |
| 1901 | if (unlikely(kw_args > 0)) { |
| 1902 | - 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;} |
| 1903 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "random_sample") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 1904 | } |
| 1905 | } else { |
| 1906 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 1907 | @@ -5837,6 +6060,19 @@ |
| 1908 | __Pyx_RefNannyFinishContext(); |
| 1909 | return NULL; |
| 1910 | __pyx_L4_argument_unpacking_done:; |
| 1911 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_16random_sample(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_size); |
| 1912 | + __Pyx_RefNannyFinishContext(); |
| 1913 | + return __pyx_r; |
| 1914 | +} |
| 1915 | + |
| 1916 | +static PyObject *__pyx_pf_6mtrand_11RandomState_16random_sample(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_size) { |
| 1917 | + PyObject *__pyx_r = NULL; |
| 1918 | + __Pyx_RefNannyDeclarations |
| 1919 | + PyObject *__pyx_t_1 = NULL; |
| 1920 | + int __pyx_lineno = 0; |
| 1921 | + const char *__pyx_filename = NULL; |
| 1922 | + int __pyx_clineno = 0; |
| 1923 | + __Pyx_RefNannySetupContext("random_sample", 0); |
| 1924 | |
| 1925 | /* "mtrand.pyx":760 |
| 1926 | * |
| 1927 | @@ -5846,7 +6082,7 @@ |
| 1928 | * def tomaxint(self, size=None): |
| 1929 | */ |
| 1930 | __Pyx_XDECREF(__pyx_r); |
| 1931 | - __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;} |
| 1932 | + __pyx_t_1 = __pyx_f_6mtrand_cont0_array(__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;} |
| 1933 | __Pyx_GOTREF(__pyx_t_1); |
| 1934 | __pyx_r = __pyx_t_1; |
| 1935 | __pyx_t_1 = 0; |
| 1936 | @@ -5864,38 +6100,36 @@ |
| 1937 | return __pyx_r; |
| 1938 | } |
| 1939 | |
| 1940 | -/* "mtrand.pyx":762 |
| 1941 | +/* Python wrapper */ |
| 1942 | +static PyObject *__pyx_pw_6mtrand_11RandomState_19tomaxint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 1943 | +static char __pyx_doc_6mtrand_11RandomState_18tomaxint[] = "\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 "; |
| 1944 | +static PyObject *__pyx_pw_6mtrand_11RandomState_19tomaxint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 1945 | + PyObject *__pyx_v_size = 0; |
| 1946 | + PyObject *__pyx_r = 0; |
| 1947 | + __Pyx_RefNannyDeclarations |
| 1948 | + __Pyx_RefNannySetupContext("tomaxint (wrapper)", 0); |
| 1949 | + { |
| 1950 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,0}; |
| 1951 | + PyObject* values[1] = {0}; |
| 1952 | + |
| 1953 | + /* "mtrand.pyx":762 |
| 1954 | * return cont0_array(self.internal_state, rk_double, size) |
| 1955 | * |
| 1956 | * def tomaxint(self, size=None): # <<<<<<<<<<<<<< |
| 1957 | * """ |
| 1958 | * tomaxint(size=None) |
| 1959 | */ |
| 1960 | - |
| 1961 | -static PyObject *__pyx_pf_6mtrand_11RandomState_9tomaxint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 1962 | -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 "; |
| 1963 | -static PyObject *__pyx_pf_6mtrand_11RandomState_9tomaxint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 1964 | - PyObject *__pyx_v_size = 0; |
| 1965 | - PyObject *__pyx_r = NULL; |
| 1966 | - __Pyx_RefNannyDeclarations |
| 1967 | - PyObject *__pyx_t_1 = NULL; |
| 1968 | - int __pyx_lineno = 0; |
| 1969 | - const char *__pyx_filename = NULL; |
| 1970 | - int __pyx_clineno = 0; |
| 1971 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,0}; |
| 1972 | - __Pyx_RefNannySetupContext("tomaxint"); |
| 1973 | - { |
| 1974 | - PyObject* values[1] = {0}; |
| 1975 | values[0] = ((PyObject *)Py_None); |
| 1976 | if (unlikely(__pyx_kwds)) { |
| 1977 | Py_ssize_t kw_args; |
| 1978 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 1979 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 1980 | + switch (pos_args) { |
| 1981 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 1982 | case 0: break; |
| 1983 | default: goto __pyx_L5_argtuple_error; |
| 1984 | } |
| 1985 | kw_args = PyDict_Size(__pyx_kwds); |
| 1986 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 1987 | + switch (pos_args) { |
| 1988 | case 0: |
| 1989 | if (kw_args > 0) { |
| 1990 | PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size); |
| 1991 | @@ -5903,7 +6137,7 @@ |
| 1992 | } |
| 1993 | } |
| 1994 | if (unlikely(kw_args > 0)) { |
| 1995 | - 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;} |
| 1996 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tomaxint") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 1997 | } |
| 1998 | } else { |
| 1999 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 2000 | @@ -5922,6 +6156,19 @@ |
| 2001 | __Pyx_RefNannyFinishContext(); |
| 2002 | return NULL; |
| 2003 | __pyx_L4_argument_unpacking_done:; |
| 2004 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_18tomaxint(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_size); |
| 2005 | + __Pyx_RefNannyFinishContext(); |
| 2006 | + return __pyx_r; |
| 2007 | +} |
| 2008 | + |
| 2009 | +static PyObject *__pyx_pf_6mtrand_11RandomState_18tomaxint(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_size) { |
| 2010 | + PyObject *__pyx_r = NULL; |
| 2011 | + __Pyx_RefNannyDeclarations |
| 2012 | + PyObject *__pyx_t_1 = NULL; |
| 2013 | + int __pyx_lineno = 0; |
| 2014 | + const char *__pyx_filename = NULL; |
| 2015 | + int __pyx_clineno = 0; |
| 2016 | + __Pyx_RefNannySetupContext("tomaxint", 0); |
| 2017 | |
| 2018 | /* "mtrand.pyx":807 |
| 2019 | * |
| 2020 | @@ -5931,7 +6178,7 @@ |
| 2021 | * def randint(self, low, high=None, size=None): |
| 2022 | */ |
| 2023 | __Pyx_XDECREF(__pyx_r); |
| 2024 | - __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;} |
| 2025 | + __pyx_t_1 = __pyx_f_6mtrand_disc0_array(__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;} |
| 2026 | __Pyx_GOTREF(__pyx_t_1); |
| 2027 | __pyx_r = __pyx_t_1; |
| 2028 | __pyx_t_1 = 0; |
| 2029 | @@ -5949,48 +6196,33 @@ |
| 2030 | return __pyx_r; |
| 2031 | } |
| 2032 | |
| 2033 | -/* "mtrand.pyx":809 |
| 2034 | - * return disc0_array(self.internal_state, rk_long, size) |
| 2035 | - * |
| 2036 | - * def randint(self, low, high=None, size=None): # <<<<<<<<<<<<<< |
| 2037 | - * """ |
| 2038 | - * randint(low, high=None, size=None) |
| 2039 | - */ |
| 2040 | - |
| 2041 | -static PyObject *__pyx_pf_6mtrand_11RandomState_10randint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 2042 | -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 "; |
| 2043 | -static PyObject *__pyx_pf_6mtrand_11RandomState_10randint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 2044 | +/* Python wrapper */ |
| 2045 | +static PyObject *__pyx_pw_6mtrand_11RandomState_21randint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 2046 | +static char __pyx_doc_6mtrand_11RandomState_20randint[] = "\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 "; |
| 2047 | +static PyObject *__pyx_pw_6mtrand_11RandomState_21randint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 2048 | PyObject *__pyx_v_low = 0; |
| 2049 | PyObject *__pyx_v_high = 0; |
| 2050 | PyObject *__pyx_v_size = 0; |
| 2051 | - long __pyx_v_lo; |
| 2052 | - long __pyx_v_hi; |
| 2053 | - long __pyx_v_rv; |
| 2054 | - unsigned long __pyx_v_diff; |
| 2055 | - long *__pyx_v_array_data; |
| 2056 | - PyArrayObject *arrayObject = 0; |
| 2057 | - npy_intp __pyx_v_length; |
| 2058 | - npy_intp __pyx_v_i; |
| 2059 | - PyObject *__pyx_r = NULL; |
| 2060 | + PyObject *__pyx_r = 0; |
| 2061 | __Pyx_RefNannyDeclarations |
| 2062 | - int __pyx_t_1; |
| 2063 | - long __pyx_t_2; |
| 2064 | - PyObject *__pyx_t_3 = NULL; |
| 2065 | - PyObject *__pyx_t_4 = NULL; |
| 2066 | - PyObject *__pyx_t_5 = NULL; |
| 2067 | - npy_intp __pyx_t_6; |
| 2068 | - int __pyx_lineno = 0; |
| 2069 | - const char *__pyx_filename = NULL; |
| 2070 | - int __pyx_clineno = 0; |
| 2071 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__low,&__pyx_n_s__high,&__pyx_n_s__size,0}; |
| 2072 | - __Pyx_RefNannySetupContext("randint"); |
| 2073 | + __Pyx_RefNannySetupContext("randint (wrapper)", 0); |
| 2074 | { |
| 2075 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__low,&__pyx_n_s__high,&__pyx_n_s__size,0}; |
| 2076 | PyObject* values[3] = {0,0,0}; |
| 2077 | + |
| 2078 | + /* "mtrand.pyx":809 |
| 2079 | + * return disc0_array(self.internal_state, rk_long, size) |
| 2080 | + * |
| 2081 | + * def randint(self, low, high=None, size=None): # <<<<<<<<<<<<<< |
| 2082 | + * """ |
| 2083 | + * randint(low, high=None, size=None) |
| 2084 | + */ |
| 2085 | values[1] = ((PyObject *)Py_None); |
| 2086 | values[2] = ((PyObject *)Py_None); |
| 2087 | if (unlikely(__pyx_kwds)) { |
| 2088 | Py_ssize_t kw_args; |
| 2089 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 2090 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 2091 | + switch (pos_args) { |
| 2092 | case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); |
| 2093 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 2094 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 2095 | @@ -5998,10 +6230,9 @@ |
| 2096 | default: goto __pyx_L5_argtuple_error; |
| 2097 | } |
| 2098 | kw_args = PyDict_Size(__pyx_kwds); |
| 2099 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 2100 | + switch (pos_args) { |
| 2101 | case 0: |
| 2102 | - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__low); |
| 2103 | - if (likely(values[0])) kw_args--; |
| 2104 | + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__low)) != 0)) kw_args--; |
| 2105 | else goto __pyx_L5_argtuple_error; |
| 2106 | case 1: |
| 2107 | if (kw_args > 0) { |
| 2108 | @@ -6015,7 +6246,7 @@ |
| 2109 | } |
| 2110 | } |
| 2111 | if (unlikely(kw_args > 0)) { |
| 2112 | - 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;} |
| 2113 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "randint") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 2114 | } |
| 2115 | } else { |
| 2116 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 2117 | @@ -6038,6 +6269,32 @@ |
| 2118 | __Pyx_RefNannyFinishContext(); |
| 2119 | return NULL; |
| 2120 | __pyx_L4_argument_unpacking_done:; |
| 2121 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_20randint(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_low, __pyx_v_high, __pyx_v_size); |
| 2122 | + __Pyx_RefNannyFinishContext(); |
| 2123 | + return __pyx_r; |
| 2124 | +} |
| 2125 | + |
| 2126 | +static PyObject *__pyx_pf_6mtrand_11RandomState_20randint(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_low, PyObject *__pyx_v_high, PyObject *__pyx_v_size) { |
| 2127 | + long __pyx_v_lo; |
| 2128 | + long __pyx_v_hi; |
| 2129 | + long __pyx_v_rv; |
| 2130 | + unsigned long __pyx_v_diff; |
| 2131 | + long *__pyx_v_array_data; |
| 2132 | + PyArrayObject *arrayObject = 0; |
| 2133 | + npy_intp __pyx_v_length; |
| 2134 | + npy_intp __pyx_v_i; |
| 2135 | + PyObject *__pyx_r = NULL; |
| 2136 | + __Pyx_RefNannyDeclarations |
| 2137 | + int __pyx_t_1; |
| 2138 | + long __pyx_t_2; |
| 2139 | + PyObject *__pyx_t_3 = NULL; |
| 2140 | + PyObject *__pyx_t_4 = NULL; |
| 2141 | + PyObject *__pyx_t_5 = NULL; |
| 2142 | + npy_intp __pyx_t_6; |
| 2143 | + int __pyx_lineno = 0; |
| 2144 | + const char *__pyx_filename = NULL; |
| 2145 | + int __pyx_clineno = 0; |
| 2146 | + __Pyx_RefNannySetupContext("randint", 0); |
| 2147 | |
| 2148 | /* "mtrand.pyx":866 |
| 2149 | * cdef npy_intp i |
| 2150 | @@ -6067,7 +6324,7 @@ |
| 2151 | */ |
| 2152 | __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;} |
| 2153 | __pyx_v_hi = __pyx_t_2; |
| 2154 | - goto __pyx_L6; |
| 2155 | + goto __pyx_L3; |
| 2156 | } |
| 2157 | /*else*/ { |
| 2158 | |
| 2159 | @@ -6091,7 +6348,7 @@ |
| 2160 | __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;} |
| 2161 | __pyx_v_hi = __pyx_t_2; |
| 2162 | } |
| 2163 | - __pyx_L6:; |
| 2164 | + __pyx_L3:; |
| 2165 | |
| 2166 | /* "mtrand.pyx":873 |
| 2167 | * hi = high |
| 2168 | @@ -6115,9 +6372,9 @@ |
| 2169 | __Pyx_Raise(__pyx_t_3, 0, 0, 0); |
| 2170 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 2171 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 2172 | - goto __pyx_L7; |
| 2173 | + goto __pyx_L4; |
| 2174 | } |
| 2175 | - __pyx_L7:; |
| 2176 | + __pyx_L4:; |
| 2177 | |
| 2178 | /* "mtrand.pyx":876 |
| 2179 | * raise ValueError("low >= high") |
| 2180 | @@ -6145,7 +6402,7 @@ |
| 2181 | * return rv |
| 2182 | * else: |
| 2183 | */ |
| 2184 | - __pyx_v_rv = (__pyx_v_lo + ((long)rk_interval(__pyx_v_diff, ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state))); |
| 2185 | + __pyx_v_rv = (__pyx_v_lo + ((long)rk_interval(__pyx_v_diff, __pyx_v_self->internal_state))); |
| 2186 | |
| 2187 | /* "mtrand.pyx":879 |
| 2188 | * if size is None: |
| 2189 | @@ -6160,7 +6417,7 @@ |
| 2190 | __pyx_r = __pyx_t_3; |
| 2191 | __pyx_t_3 = 0; |
| 2192 | goto __pyx_L0; |
| 2193 | - goto __pyx_L8; |
| 2194 | + goto __pyx_L5; |
| 2195 | } |
| 2196 | /*else*/ { |
| 2197 | |
| 2198 | @@ -6177,7 +6434,7 @@ |
| 2199 | __Pyx_GOTREF(__pyx_t_4); |
| 2200 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 2201 | __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;} |
| 2202 | - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| 2203 | + __Pyx_GOTREF(__pyx_t_3); |
| 2204 | __Pyx_INCREF(__pyx_v_size); |
| 2205 | PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_size); |
| 2206 | __Pyx_GIVEREF(__pyx_v_size); |
| 2207 | @@ -6227,7 +6484,7 @@ |
| 2208 | * array_data[i] = rv |
| 2209 | * return array |
| 2210 | */ |
| 2211 | - __pyx_v_rv = (__pyx_v_lo + ((long)rk_interval(__pyx_v_diff, ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state))); |
| 2212 | + __pyx_v_rv = (__pyx_v_lo + ((long)rk_interval(__pyx_v_diff, __pyx_v_self->internal_state))); |
| 2213 | |
| 2214 | /* "mtrand.pyx":886 |
| 2215 | * for i from 0 <= i < length: |
| 2216 | @@ -6251,7 +6508,7 @@ |
| 2217 | __pyx_r = ((PyObject *)arrayObject); |
| 2218 | goto __pyx_L0; |
| 2219 | } |
| 2220 | - __pyx_L8:; |
| 2221 | + __pyx_L5:; |
| 2222 | |
| 2223 | __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| 2224 | goto __pyx_L0; |
| 2225 | @@ -6268,6 +6525,28 @@ |
| 2226 | return __pyx_r; |
| 2227 | } |
| 2228 | |
| 2229 | +/* Python wrapper */ |
| 2230 | +static PyObject *__pyx_pw_6mtrand_11RandomState_23bytes(PyObject *__pyx_v_self, PyObject *__pyx_arg_length); /*proto*/ |
| 2231 | +static char __pyx_doc_6mtrand_11RandomState_22bytes[] = "\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 "; |
| 2232 | +static PyObject *__pyx_pw_6mtrand_11RandomState_23bytes(PyObject *__pyx_v_self, PyObject *__pyx_arg_length) { |
| 2233 | + npy_intp __pyx_v_length; |
| 2234 | + PyObject *__pyx_r = 0; |
| 2235 | + __Pyx_RefNannyDeclarations |
| 2236 | + __Pyx_RefNannySetupContext("bytes (wrapper)", 0); |
| 2237 | + assert(__pyx_arg_length); { |
| 2238 | + __pyx_v_length = __Pyx_PyInt_from_py_npy_intp(__pyx_arg_length); if (unlikely((__pyx_v_length == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 2239 | + } |
| 2240 | + goto __pyx_L4_argument_unpacking_done; |
| 2241 | + __pyx_L3_error:; |
| 2242 | + __Pyx_AddTraceback("mtrand.RandomState.bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); |
| 2243 | + __Pyx_RefNannyFinishContext(); |
| 2244 | + return NULL; |
| 2245 | + __pyx_L4_argument_unpacking_done:; |
| 2246 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_22bytes(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), ((npy_intp)__pyx_v_length)); |
| 2247 | + __Pyx_RefNannyFinishContext(); |
| 2248 | + return __pyx_r; |
| 2249 | +} |
| 2250 | + |
| 2251 | /* "mtrand.pyx":889 |
| 2252 | * return array |
| 2253 | * |
| 2254 | @@ -6276,10 +6555,7 @@ |
| 2255 | * bytes(length) |
| 2256 | */ |
| 2257 | |
| 2258 | -static PyObject *__pyx_pf_6mtrand_11RandomState_11bytes(PyObject *__pyx_v_self, PyObject *__pyx_arg_length); /*proto*/ |
| 2259 | -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 "; |
| 2260 | -static PyObject *__pyx_pf_6mtrand_11RandomState_11bytes(PyObject *__pyx_v_self, PyObject *__pyx_arg_length) { |
| 2261 | - npy_intp __pyx_v_length; |
| 2262 | +static PyObject *__pyx_pf_6mtrand_11RandomState_22bytes(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, npy_intp __pyx_v_length) { |
| 2263 | void *__pyx_v_bytes; |
| 2264 | PyObject *__pyx_v_bytestring = NULL; |
| 2265 | PyObject *__pyx_r = NULL; |
| 2266 | @@ -6288,16 +6564,7 @@ |
| 2267 | int __pyx_lineno = 0; |
| 2268 | const char *__pyx_filename = NULL; |
| 2269 | int __pyx_clineno = 0; |
| 2270 | - __Pyx_RefNannySetupContext("bytes"); |
| 2271 | - assert(__pyx_arg_length); { |
| 2272 | - __pyx_v_length = __Pyx_PyInt_from_py_npy_intp(__pyx_arg_length); if (unlikely((__pyx_v_length == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 2273 | - } |
| 2274 | - goto __pyx_L4_argument_unpacking_done; |
| 2275 | - __pyx_L3_error:; |
| 2276 | - __Pyx_AddTraceback("mtrand.RandomState.bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); |
| 2277 | - __Pyx_RefNannyFinishContext(); |
| 2278 | - return NULL; |
| 2279 | - __pyx_L4_argument_unpacking_done:; |
| 2280 | + __Pyx_RefNannySetupContext("bytes", 0); |
| 2281 | |
| 2282 | /* "mtrand.pyx":912 |
| 2283 | * """ |
| 2284 | @@ -6318,7 +6585,7 @@ |
| 2285 | * return bytestring |
| 2286 | * |
| 2287 | */ |
| 2288 | - rk_fill(__pyx_v_bytes, __pyx_v_length, ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); |
| 2289 | + rk_fill(__pyx_v_bytes, __pyx_v_length, __pyx_v_self->internal_state); |
| 2290 | |
| 2291 | /* "mtrand.pyx":914 |
| 2292 | * bytestring = empty_py_bytes(length, &bytes) |
| 2293 | @@ -6345,45 +6612,34 @@ |
| 2294 | return __pyx_r; |
| 2295 | } |
| 2296 | |
| 2297 | -/* "mtrand.pyx":916 |
| 2298 | - * return bytestring |
| 2299 | - * |
| 2300 | - * def uniform(self, low=0.0, high=1.0, size=None): # <<<<<<<<<<<<<< |
| 2301 | - * """ |
| 2302 | - * uniform(low=0.0, high=1.0, size=1) |
| 2303 | - */ |
| 2304 | - |
| 2305 | -static PyObject *__pyx_pf_6mtrand_11RandomState_12uniform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 2306 | -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 "; |
| 2307 | -static PyObject *__pyx_pf_6mtrand_11RandomState_12uniform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 2308 | +/* Python wrapper */ |
| 2309 | +static PyObject *__pyx_pw_6mtrand_11RandomState_25uniform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 2310 | +static char __pyx_doc_6mtrand_11RandomState_24uniform[] = "\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 "; |
| 2311 | +static PyObject *__pyx_pw_6mtrand_11RandomState_25uniform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 2312 | PyObject *__pyx_v_low = 0; |
| 2313 | PyObject *__pyx_v_high = 0; |
| 2314 | PyObject *__pyx_v_size = 0; |
| 2315 | - PyArrayObject *__pyx_v_olow = 0; |
| 2316 | - PyArrayObject *__pyx_v_ohigh = 0; |
| 2317 | - PyArrayObject *__pyx_v_odiff = 0; |
| 2318 | - double __pyx_v_flow; |
| 2319 | - double __pyx_v_fhigh; |
| 2320 | - PyObject *__pyx_v_temp = 0; |
| 2321 | - PyObject *__pyx_r = NULL; |
| 2322 | + PyObject *__pyx_r = 0; |
| 2323 | __Pyx_RefNannyDeclarations |
| 2324 | - int __pyx_t_1; |
| 2325 | - PyObject *__pyx_t_2 = NULL; |
| 2326 | - PyObject *__pyx_t_3 = NULL; |
| 2327 | - PyObject *__pyx_t_4 = NULL; |
| 2328 | - int __pyx_lineno = 0; |
| 2329 | - const char *__pyx_filename = NULL; |
| 2330 | - int __pyx_clineno = 0; |
| 2331 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__low,&__pyx_n_s__high,&__pyx_n_s__size,0}; |
| 2332 | - __Pyx_RefNannySetupContext("uniform"); |
| 2333 | + __Pyx_RefNannySetupContext("uniform (wrapper)", 0); |
| 2334 | { |
| 2335 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__low,&__pyx_n_s__high,&__pyx_n_s__size,0}; |
| 2336 | PyObject* values[3] = {0,0,0}; |
| 2337 | values[0] = __pyx_k_15; |
| 2338 | values[1] = __pyx_k_16; |
| 2339 | + |
| 2340 | + /* "mtrand.pyx":916 |
| 2341 | + * return bytestring |
| 2342 | + * |
| 2343 | + * def uniform(self, low=0.0, high=1.0, size=None): # <<<<<<<<<<<<<< |
| 2344 | + * """ |
| 2345 | + * uniform(low=0.0, high=1.0, size=1) |
| 2346 | + */ |
| 2347 | values[2] = ((PyObject *)Py_None); |
| 2348 | if (unlikely(__pyx_kwds)) { |
| 2349 | Py_ssize_t kw_args; |
| 2350 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 2351 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 2352 | + switch (pos_args) { |
| 2353 | case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); |
| 2354 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 2355 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 2356 | @@ -6391,7 +6647,7 @@ |
| 2357 | default: goto __pyx_L5_argtuple_error; |
| 2358 | } |
| 2359 | kw_args = PyDict_Size(__pyx_kwds); |
| 2360 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 2361 | + switch (pos_args) { |
| 2362 | case 0: |
| 2363 | if (kw_args > 0) { |
| 2364 | PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__low); |
| 2365 | @@ -6409,7 +6665,7 @@ |
| 2366 | } |
| 2367 | } |
| 2368 | if (unlikely(kw_args > 0)) { |
| 2369 | - 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;} |
| 2370 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "uniform") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 2371 | } |
| 2372 | } else { |
| 2373 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 2374 | @@ -6432,6 +6688,28 @@ |
| 2375 | __Pyx_RefNannyFinishContext(); |
| 2376 | return NULL; |
| 2377 | __pyx_L4_argument_unpacking_done:; |
| 2378 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_24uniform(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_low, __pyx_v_high, __pyx_v_size); |
| 2379 | + __Pyx_RefNannyFinishContext(); |
| 2380 | + return __pyx_r; |
| 2381 | +} |
| 2382 | + |
| 2383 | +static PyObject *__pyx_pf_6mtrand_11RandomState_24uniform(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_low, PyObject *__pyx_v_high, PyObject *__pyx_v_size) { |
| 2384 | + PyArrayObject *__pyx_v_olow = 0; |
| 2385 | + PyArrayObject *__pyx_v_ohigh = 0; |
| 2386 | + PyArrayObject *__pyx_v_odiff = 0; |
| 2387 | + double __pyx_v_flow; |
| 2388 | + double __pyx_v_fhigh; |
| 2389 | + PyObject *__pyx_v_temp = 0; |
| 2390 | + PyObject *__pyx_r = NULL; |
| 2391 | + __Pyx_RefNannyDeclarations |
| 2392 | + int __pyx_t_1; |
| 2393 | + PyObject *__pyx_t_2 = NULL; |
| 2394 | + PyObject *__pyx_t_3 = NULL; |
| 2395 | + PyObject *__pyx_t_4 = NULL; |
| 2396 | + int __pyx_lineno = 0; |
| 2397 | + const char *__pyx_filename = NULL; |
| 2398 | + int __pyx_clineno = 0; |
| 2399 | + __Pyx_RefNannySetupContext("uniform", 0); |
| 2400 | |
| 2401 | /* "mtrand.pyx":990 |
| 2402 | * cdef object temp |
| 2403 | @@ -6469,14 +6747,14 @@ |
| 2404 | * olow = <ndarray>PyArray_FROM_OTF(low, NPY_DOUBLE, NPY_ALIGNED) |
| 2405 | */ |
| 2406 | __Pyx_XDECREF(__pyx_r); |
| 2407 | - __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;} |
| 2408 | + __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(__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;} |
| 2409 | __Pyx_GOTREF(__pyx_t_2); |
| 2410 | __pyx_r = __pyx_t_2; |
| 2411 | __pyx_t_2 = 0; |
| 2412 | goto __pyx_L0; |
| 2413 | - goto __pyx_L6; |
| 2414 | + goto __pyx_L3; |
| 2415 | } |
| 2416 | - __pyx_L6:; |
| 2417 | + __pyx_L3:; |
| 2418 | |
| 2419 | /* "mtrand.pyx":994 |
| 2420 | * if not PyErr_Occurred(): |
| 2421 | @@ -6526,7 +6804,7 @@ |
| 2422 | __Pyx_GOTREF(__pyx_t_3); |
| 2423 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 2424 | __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;} |
| 2425 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 2426 | + __Pyx_GOTREF(__pyx_t_2); |
| 2427 | __Pyx_INCREF(((PyObject *)__pyx_v_ohigh)); |
| 2428 | PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_ohigh)); |
| 2429 | __Pyx_GIVEREF(((PyObject *)__pyx_v_ohigh)); |
| 2430 | @@ -6570,7 +6848,7 @@ |
| 2431 | * def rand(self, *args): |
| 2432 | */ |
| 2433 | __Pyx_XDECREF(__pyx_r); |
| 2434 | - __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;} |
| 2435 | + __pyx_t_4 = __pyx_f_6mtrand_cont2_array(__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;} |
| 2436 | __Pyx_GOTREF(__pyx_t_4); |
| 2437 | __pyx_r = __pyx_t_4; |
| 2438 | __pyx_t_4 = 0; |
| 2439 | @@ -6594,6 +6872,23 @@ |
| 2440 | return __pyx_r; |
| 2441 | } |
| 2442 | |
| 2443 | +/* Python wrapper */ |
| 2444 | +static PyObject *__pyx_pw_6mtrand_11RandomState_27rand(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 2445 | +static char __pyx_doc_6mtrand_11RandomState_26rand[] = "\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 "; |
| 2446 | +static PyObject *__pyx_pw_6mtrand_11RandomState_27rand(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 2447 | + PyObject *__pyx_v_args = 0; |
| 2448 | + PyObject *__pyx_r = 0; |
| 2449 | + __Pyx_RefNannyDeclarations |
| 2450 | + __Pyx_RefNannySetupContext("rand (wrapper)", 0); |
| 2451 | + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "rand", 0))) return NULL; |
| 2452 | + __Pyx_INCREF(__pyx_args); |
| 2453 | + __pyx_v_args = __pyx_args; |
| 2454 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_26rand(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_args); |
| 2455 | + __Pyx_XDECREF(__pyx_v_args); |
| 2456 | + __Pyx_RefNannyFinishContext(); |
| 2457 | + return __pyx_r; |
| 2458 | +} |
| 2459 | + |
| 2460 | /* "mtrand.pyx":1003 |
| 2461 | * return cont2_array(self.internal_state, rk_uniform, size, olow, odiff) |
| 2462 | * |
| 2463 | @@ -6602,10 +6897,7 @@ |
| 2464 | * rand(d0, d1, ..., dn) |
| 2465 | */ |
| 2466 | |
| 2467 | -static PyObject *__pyx_pf_6mtrand_11RandomState_13rand(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 2468 | -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 "; |
| 2469 | -static PyObject *__pyx_pf_6mtrand_11RandomState_13rand(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 2470 | - PyObject *__pyx_v_args = 0; |
| 2471 | +static PyObject *__pyx_pf_6mtrand_11RandomState_26rand(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_args) { |
| 2472 | PyObject *__pyx_r = NULL; |
| 2473 | __Pyx_RefNannyDeclarations |
| 2474 | Py_ssize_t __pyx_t_1; |
| 2475 | @@ -6616,10 +6908,7 @@ |
| 2476 | int __pyx_lineno = 0; |
| 2477 | const char *__pyx_filename = NULL; |
| 2478 | int __pyx_clineno = 0; |
| 2479 | - __Pyx_RefNannySetupContext("rand"); |
| 2480 | - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "rand", 0))) return NULL; |
| 2481 | - __Pyx_INCREF(__pyx_args); |
| 2482 | - __pyx_v_args = __pyx_args; |
| 2483 | + __Pyx_RefNannySetupContext("rand", 0); |
| 2484 | |
| 2485 | /* "mtrand.pyx":1041 |
| 2486 | * |
| 2487 | @@ -6628,10 +6917,7 @@ |
| 2488 | * return self.random_sample() |
| 2489 | * else: |
| 2490 | */ |
| 2491 | - if (unlikely(((PyObject *)__pyx_v_args) == Py_None)) { |
| 2492 | - 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;} |
| 2493 | - } |
| 2494 | - __pyx_t_1 = PyTuple_GET_SIZE(((PyObject *)__pyx_v_args)); |
| 2495 | + __pyx_t_1 = PyTuple_GET_SIZE(((PyObject *)__pyx_v_args)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 2496 | __pyx_t_2 = (__pyx_t_1 == 0); |
| 2497 | if (__pyx_t_2) { |
| 2498 | |
| 2499 | @@ -6643,7 +6929,7 @@ |
| 2500 | * return self.random_sample(size=args) |
| 2501 | */ |
| 2502 | __Pyx_XDECREF(__pyx_r); |
| 2503 | - __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;} |
| 2504 | + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__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;} |
| 2505 | __Pyx_GOTREF(__pyx_t_3); |
| 2506 | __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;} |
| 2507 | __Pyx_GOTREF(__pyx_t_4); |
| 2508 | @@ -6651,7 +6937,7 @@ |
| 2509 | __pyx_r = __pyx_t_4; |
| 2510 | __pyx_t_4 = 0; |
| 2511 | goto __pyx_L0; |
| 2512 | - goto __pyx_L5; |
| 2513 | + goto __pyx_L3; |
| 2514 | } |
| 2515 | /*else*/ { |
| 2516 | |
| 2517 | @@ -6663,12 +6949,12 @@ |
| 2518 | * def randn(self, *args): |
| 2519 | */ |
| 2520 | __Pyx_XDECREF(__pyx_r); |
| 2521 | - __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;} |
| 2522 | + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__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;} |
| 2523 | __Pyx_GOTREF(__pyx_t_4); |
| 2524 | __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;} |
| 2525 | __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| 2526 | 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;} |
| 2527 | - __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;} |
| 2528 | + __pyx_t_5 = PyObject_Call(__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;} |
| 2529 | __Pyx_GOTREF(__pyx_t_5); |
| 2530 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 2531 | __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; |
| 2532 | @@ -6676,7 +6962,7 @@ |
| 2533 | __pyx_t_5 = 0; |
| 2534 | goto __pyx_L0; |
| 2535 | } |
| 2536 | - __pyx_L5:; |
| 2537 | + __pyx_L3:; |
| 2538 | |
| 2539 | __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| 2540 | goto __pyx_L0; |
| 2541 | @@ -6687,12 +6973,28 @@ |
| 2542 | __Pyx_AddTraceback("mtrand.RandomState.rand", __pyx_clineno, __pyx_lineno, __pyx_filename); |
| 2543 | __pyx_r = NULL; |
| 2544 | __pyx_L0:; |
| 2545 | - __Pyx_XDECREF(__pyx_v_args); |
| 2546 | __Pyx_XGIVEREF(__pyx_r); |
| 2547 | __Pyx_RefNannyFinishContext(); |
| 2548 | return __pyx_r; |
| 2549 | } |
| 2550 | |
| 2551 | +/* Python wrapper */ |
| 2552 | +static PyObject *__pyx_pw_6mtrand_11RandomState_29randn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 2553 | +static char __pyx_doc_6mtrand_11RandomState_28randn[] = "\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 "; |
| 2554 | +static PyObject *__pyx_pw_6mtrand_11RandomState_29randn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 2555 | + PyObject *__pyx_v_args = 0; |
| 2556 | + PyObject *__pyx_r = 0; |
| 2557 | + __Pyx_RefNannyDeclarations |
| 2558 | + __Pyx_RefNannySetupContext("randn (wrapper)", 0); |
| 2559 | + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "randn", 0))) return NULL; |
| 2560 | + __Pyx_INCREF(__pyx_args); |
| 2561 | + __pyx_v_args = __pyx_args; |
| 2562 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_28randn(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_args); |
| 2563 | + __Pyx_XDECREF(__pyx_v_args); |
| 2564 | + __Pyx_RefNannyFinishContext(); |
| 2565 | + return __pyx_r; |
| 2566 | +} |
| 2567 | + |
| 2568 | /* "mtrand.pyx":1046 |
| 2569 | * return self.random_sample(size=args) |
| 2570 | * |
| 2571 | @@ -6701,10 +7003,7 @@ |
| 2572 | * randn([d1, ..., dn]) |
| 2573 | */ |
| 2574 | |
| 2575 | -static PyObject *__pyx_pf_6mtrand_11RandomState_14randn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 2576 | -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 "; |
| 2577 | -static PyObject *__pyx_pf_6mtrand_11RandomState_14randn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 2578 | - PyObject *__pyx_v_args = 0; |
| 2579 | +static PyObject *__pyx_pf_6mtrand_11RandomState_28randn(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_args) { |
| 2580 | PyObject *__pyx_r = NULL; |
| 2581 | __Pyx_RefNannyDeclarations |
| 2582 | Py_ssize_t __pyx_t_1; |
| 2583 | @@ -6715,10 +7014,7 @@ |
| 2584 | int __pyx_lineno = 0; |
| 2585 | const char *__pyx_filename = NULL; |
| 2586 | int __pyx_clineno = 0; |
| 2587 | - __Pyx_RefNannySetupContext("randn"); |
| 2588 | - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "randn", 0))) return NULL; |
| 2589 | - __Pyx_INCREF(__pyx_args); |
| 2590 | - __pyx_v_args = __pyx_args; |
| 2591 | + __Pyx_RefNannySetupContext("randn", 0); |
| 2592 | |
| 2593 | /* "mtrand.pyx":1097 |
| 2594 | * |
| 2595 | @@ -6727,10 +7023,7 @@ |
| 2596 | * return self.standard_normal() |
| 2597 | * else: |
| 2598 | */ |
| 2599 | - if (unlikely(((PyObject *)__pyx_v_args) == Py_None)) { |
| 2600 | - 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;} |
| 2601 | - } |
| 2602 | - __pyx_t_1 = PyTuple_GET_SIZE(((PyObject *)__pyx_v_args)); |
| 2603 | + __pyx_t_1 = PyTuple_GET_SIZE(((PyObject *)__pyx_v_args)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 2604 | __pyx_t_2 = (__pyx_t_1 == 0); |
| 2605 | if (__pyx_t_2) { |
| 2606 | |
| 2607 | @@ -6742,7 +7035,7 @@ |
| 2608 | * return self.standard_normal(args) |
| 2609 | */ |
| 2610 | __Pyx_XDECREF(__pyx_r); |
| 2611 | - __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;} |
| 2612 | + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__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;} |
| 2613 | __Pyx_GOTREF(__pyx_t_3); |
| 2614 | __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;} |
| 2615 | __Pyx_GOTREF(__pyx_t_4); |
| 2616 | @@ -6750,7 +7043,7 @@ |
| 2617 | __pyx_r = __pyx_t_4; |
| 2618 | __pyx_t_4 = 0; |
| 2619 | goto __pyx_L0; |
| 2620 | - goto __pyx_L5; |
| 2621 | + goto __pyx_L3; |
| 2622 | } |
| 2623 | /*else*/ { |
| 2624 | |
| 2625 | @@ -6762,10 +7055,10 @@ |
| 2626 | * def random_integers(self, low, high=None, size=None): |
| 2627 | */ |
| 2628 | __Pyx_XDECREF(__pyx_r); |
| 2629 | - __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;} |
| 2630 | + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__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;} |
| 2631 | __Pyx_GOTREF(__pyx_t_4); |
| 2632 | __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;} |
| 2633 | - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| 2634 | + __Pyx_GOTREF(__pyx_t_3); |
| 2635 | __Pyx_INCREF(((PyObject *)__pyx_v_args)); |
| 2636 | PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_args)); |
| 2637 | __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); |
| 2638 | @@ -6777,7 +7070,7 @@ |
| 2639 | __pyx_t_5 = 0; |
| 2640 | goto __pyx_L0; |
| 2641 | } |
| 2642 | - __pyx_L5:; |
| 2643 | + __pyx_L3:; |
| 2644 | |
| 2645 | __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| 2646 | goto __pyx_L0; |
| 2647 | @@ -6788,44 +7081,38 @@ |
| 2648 | __Pyx_AddTraceback("mtrand.RandomState.randn", __pyx_clineno, __pyx_lineno, __pyx_filename); |
| 2649 | __pyx_r = NULL; |
| 2650 | __pyx_L0:; |
| 2651 | - __Pyx_XDECREF(__pyx_v_args); |
| 2652 | __Pyx_XGIVEREF(__pyx_r); |
| 2653 | __Pyx_RefNannyFinishContext(); |
| 2654 | return __pyx_r; |
| 2655 | } |
| 2656 | |
| 2657 | -/* "mtrand.pyx":1102 |
| 2658 | - * return self.standard_normal(args) |
| 2659 | - * |
| 2660 | - * def random_integers(self, low, high=None, size=None): # <<<<<<<<<<<<<< |
| 2661 | - * """ |
| 2662 | - * random_integers(low, high=None, size=None) |
| 2663 | - */ |
| 2664 | - |
| 2665 | -static PyObject *__pyx_pf_6mtrand_11RandomState_15random_integers(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 2666 | -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 "; |
| 2667 | -static PyObject *__pyx_pf_6mtrand_11RandomState_15random_integers(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 2668 | +/* Python wrapper */ |
| 2669 | +static PyObject *__pyx_pw_6mtrand_11RandomState_31random_integers(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 2670 | +static char __pyx_doc_6mtrand_11RandomState_30random_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 "; |
| 2671 | +static PyObject *__pyx_pw_6mtrand_11RandomState_31random_integers(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 2672 | PyObject *__pyx_v_low = 0; |
| 2673 | PyObject *__pyx_v_high = 0; |
| 2674 | PyObject *__pyx_v_size = 0; |
| 2675 | - PyObject *__pyx_r = NULL; |
| 2676 | + PyObject *__pyx_r = 0; |
| 2677 | __Pyx_RefNannyDeclarations |
| 2678 | - int __pyx_t_1; |
| 2679 | - PyObject *__pyx_t_2 = NULL; |
| 2680 | - PyObject *__pyx_t_3 = NULL; |
| 2681 | - PyObject *__pyx_t_4 = NULL; |
| 2682 | - int __pyx_lineno = 0; |
| 2683 | - const char *__pyx_filename = NULL; |
| 2684 | - int __pyx_clineno = 0; |
| 2685 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__low,&__pyx_n_s__high,&__pyx_n_s__size,0}; |
| 2686 | - __Pyx_RefNannySetupContext("random_integers"); |
| 2687 | + __Pyx_RefNannySetupContext("random_integers (wrapper)", 0); |
| 2688 | { |
| 2689 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__low,&__pyx_n_s__high,&__pyx_n_s__size,0}; |
| 2690 | PyObject* values[3] = {0,0,0}; |
| 2691 | + |
| 2692 | + /* "mtrand.pyx":1102 |
| 2693 | + * return self.standard_normal(args) |
| 2694 | + * |
| 2695 | + * def random_integers(self, low, high=None, size=None): # <<<<<<<<<<<<<< |
| 2696 | + * """ |
| 2697 | + * random_integers(low, high=None, size=None) |
| 2698 | + */ |
| 2699 | values[1] = ((PyObject *)Py_None); |
| 2700 | values[2] = ((PyObject *)Py_None); |
| 2701 | if (unlikely(__pyx_kwds)) { |
| 2702 | Py_ssize_t kw_args; |
| 2703 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 2704 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 2705 | + switch (pos_args) { |
| 2706 | case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); |
| 2707 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 2708 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 2709 | @@ -6833,10 +7120,9 @@ |
| 2710 | default: goto __pyx_L5_argtuple_error; |
| 2711 | } |
| 2712 | kw_args = PyDict_Size(__pyx_kwds); |
| 2713 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 2714 | + switch (pos_args) { |
| 2715 | case 0: |
| 2716 | - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__low); |
| 2717 | - if (likely(values[0])) kw_args--; |
| 2718 | + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__low)) != 0)) kw_args--; |
| 2719 | else goto __pyx_L5_argtuple_error; |
| 2720 | case 1: |
| 2721 | if (kw_args > 0) { |
| 2722 | @@ -6850,7 +7136,7 @@ |
| 2723 | } |
| 2724 | } |
| 2725 | if (unlikely(kw_args > 0)) { |
| 2726 | - 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;} |
| 2727 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "random_integers") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 2728 | } |
| 2729 | } else { |
| 2730 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 2731 | @@ -6873,6 +7159,22 @@ |
| 2732 | __Pyx_RefNannyFinishContext(); |
| 2733 | return NULL; |
| 2734 | __pyx_L4_argument_unpacking_done:; |
| 2735 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_30random_integers(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_low, __pyx_v_high, __pyx_v_size); |
| 2736 | + __Pyx_RefNannyFinishContext(); |
| 2737 | + return __pyx_r; |
| 2738 | +} |
| 2739 | + |
| 2740 | +static PyObject *__pyx_pf_6mtrand_11RandomState_30random_integers(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_low, PyObject *__pyx_v_high, PyObject *__pyx_v_size) { |
| 2741 | + PyObject *__pyx_r = NULL; |
| 2742 | + __Pyx_RefNannyDeclarations |
| 2743 | + int __pyx_t_1; |
| 2744 | + PyObject *__pyx_t_2 = NULL; |
| 2745 | + PyObject *__pyx_t_3 = NULL; |
| 2746 | + PyObject *__pyx_t_4 = NULL; |
| 2747 | + int __pyx_lineno = 0; |
| 2748 | + const char *__pyx_filename = NULL; |
| 2749 | + int __pyx_clineno = 0; |
| 2750 | + __Pyx_RefNannySetupContext("random_integers", 0); |
| 2751 | __Pyx_INCREF(__pyx_v_low); |
| 2752 | __Pyx_INCREF(__pyx_v_high); |
| 2753 | |
| 2754 | @@ -6907,9 +7209,9 @@ |
| 2755 | __Pyx_INCREF(__pyx_int_1); |
| 2756 | __Pyx_DECREF(__pyx_v_low); |
| 2757 | __pyx_v_low = __pyx_int_1; |
| 2758 | - goto __pyx_L6; |
| 2759 | + goto __pyx_L3; |
| 2760 | } |
| 2761 | - __pyx_L6:; |
| 2762 | + __pyx_L3:; |
| 2763 | |
| 2764 | /* "mtrand.pyx":1177 |
| 2765 | * high = low |
| 2766 | @@ -6919,12 +7221,12 @@ |
| 2767 | * # Complicated, continuous distributions: |
| 2768 | */ |
| 2769 | __Pyx_XDECREF(__pyx_r); |
| 2770 | - __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;} |
| 2771 | + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__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;} |
| 2772 | __Pyx_GOTREF(__pyx_t_2); |
| 2773 | __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;} |
| 2774 | __Pyx_GOTREF(__pyx_t_3); |
| 2775 | __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;} |
| 2776 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 2777 | + __Pyx_GOTREF(__pyx_t_4); |
| 2778 | __Pyx_INCREF(__pyx_v_low); |
| 2779 | PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_low); |
| 2780 | __Pyx_GIVEREF(__pyx_v_low); |
| 2781 | @@ -6958,38 +7260,36 @@ |
| 2782 | return __pyx_r; |
| 2783 | } |
| 2784 | |
| 2785 | -/* "mtrand.pyx":1180 |
| 2786 | +/* Python wrapper */ |
| 2787 | +static PyObject *__pyx_pw_6mtrand_11RandomState_33standard_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 2788 | +static char __pyx_doc_6mtrand_11RandomState_32standard_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 "; |
| 2789 | +static PyObject *__pyx_pw_6mtrand_11RandomState_33standard_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 2790 | + PyObject *__pyx_v_size = 0; |
| 2791 | + PyObject *__pyx_r = 0; |
| 2792 | + __Pyx_RefNannyDeclarations |
| 2793 | + __Pyx_RefNannySetupContext("standard_normal (wrapper)", 0); |
| 2794 | + { |
| 2795 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,0}; |
| 2796 | + PyObject* values[1] = {0}; |
| 2797 | + |
| 2798 | + /* "mtrand.pyx":1180 |
| 2799 | * |
| 2800 | * # Complicated, continuous distributions: |
| 2801 | * def standard_normal(self, size=None): # <<<<<<<<<<<<<< |
| 2802 | * """ |
| 2803 | * standard_normal(size=None) |
| 2804 | */ |
| 2805 | - |
| 2806 | -static PyObject *__pyx_pf_6mtrand_11RandomState_16standard_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 2807 | -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 "; |
| 2808 | -static PyObject *__pyx_pf_6mtrand_11RandomState_16standard_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 2809 | - PyObject *__pyx_v_size = 0; |
| 2810 | - PyObject *__pyx_r = NULL; |
| 2811 | - __Pyx_RefNannyDeclarations |
| 2812 | - PyObject *__pyx_t_1 = NULL; |
| 2813 | - int __pyx_lineno = 0; |
| 2814 | - const char *__pyx_filename = NULL; |
| 2815 | - int __pyx_clineno = 0; |
| 2816 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,0}; |
| 2817 | - __Pyx_RefNannySetupContext("standard_normal"); |
| 2818 | - { |
| 2819 | - PyObject* values[1] = {0}; |
| 2820 | values[0] = ((PyObject *)Py_None); |
| 2821 | if (unlikely(__pyx_kwds)) { |
| 2822 | Py_ssize_t kw_args; |
| 2823 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 2824 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 2825 | + switch (pos_args) { |
| 2826 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 2827 | case 0: break; |
| 2828 | default: goto __pyx_L5_argtuple_error; |
| 2829 | } |
| 2830 | kw_args = PyDict_Size(__pyx_kwds); |
| 2831 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 2832 | + switch (pos_args) { |
| 2833 | case 0: |
| 2834 | if (kw_args > 0) { |
| 2835 | PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size); |
| 2836 | @@ -6997,7 +7297,7 @@ |
| 2837 | } |
| 2838 | } |
| 2839 | if (unlikely(kw_args > 0)) { |
| 2840 | - 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;} |
| 2841 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "standard_normal") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 2842 | } |
| 2843 | } else { |
| 2844 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 2845 | @@ -7016,6 +7316,19 @@ |
| 2846 | __Pyx_RefNannyFinishContext(); |
| 2847 | return NULL; |
| 2848 | __pyx_L4_argument_unpacking_done:; |
| 2849 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_32standard_normal(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_size); |
| 2850 | + __Pyx_RefNannyFinishContext(); |
| 2851 | + return __pyx_r; |
| 2852 | +} |
| 2853 | + |
| 2854 | +static PyObject *__pyx_pf_6mtrand_11RandomState_32standard_normal(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_size) { |
| 2855 | + PyObject *__pyx_r = NULL; |
| 2856 | + __Pyx_RefNannyDeclarations |
| 2857 | + PyObject *__pyx_t_1 = NULL; |
| 2858 | + int __pyx_lineno = 0; |
| 2859 | + const char *__pyx_filename = NULL; |
| 2860 | + int __pyx_clineno = 0; |
| 2861 | + __Pyx_RefNannySetupContext("standard_normal", 0); |
| 2862 | |
| 2863 | /* "mtrand.pyx":1210 |
| 2864 | * |
| 2865 | @@ -7025,7 +7338,7 @@ |
| 2866 | * def normal(self, loc=0.0, scale=1.0, size=None): |
| 2867 | */ |
| 2868 | __Pyx_XDECREF(__pyx_r); |
| 2869 | - __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;} |
| 2870 | + __pyx_t_1 = __pyx_f_6mtrand_cont0_array(__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;} |
| 2871 | __Pyx_GOTREF(__pyx_t_1); |
| 2872 | __pyx_r = __pyx_t_1; |
| 2873 | __pyx_t_1 = 0; |
| 2874 | @@ -7043,44 +7356,34 @@ |
| 2875 | return __pyx_r; |
| 2876 | } |
| 2877 | |
| 2878 | -/* "mtrand.pyx":1212 |
| 2879 | - * return cont0_array(self.internal_state, rk_gauss, size) |
| 2880 | - * |
| 2881 | - * def normal(self, loc=0.0, scale=1.0, size=None): # <<<<<<<<<<<<<< |
| 2882 | - * """ |
| 2883 | - * normal(loc=0.0, scale=1.0, size=None) |
| 2884 | - */ |
| 2885 | - |
| 2886 | -static PyObject *__pyx_pf_6mtrand_11RandomState_17normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 2887 | -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 "; |
| 2888 | -static PyObject *__pyx_pf_6mtrand_11RandomState_17normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 2889 | +/* Python wrapper */ |
| 2890 | +static PyObject *__pyx_pw_6mtrand_11RandomState_35normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 2891 | +static char __pyx_doc_6mtrand_11RandomState_34normal[] = "\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 "; |
| 2892 | +static PyObject *__pyx_pw_6mtrand_11RandomState_35normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 2893 | PyObject *__pyx_v_loc = 0; |
| 2894 | PyObject *__pyx_v_scale = 0; |
| 2895 | PyObject *__pyx_v_size = 0; |
| 2896 | - PyArrayObject *__pyx_v_oloc = 0; |
| 2897 | - PyArrayObject *__pyx_v_oscale = 0; |
| 2898 | - double __pyx_v_floc; |
| 2899 | - double __pyx_v_fscale; |
| 2900 | - PyObject *__pyx_r = NULL; |
| 2901 | + PyObject *__pyx_r = 0; |
| 2902 | __Pyx_RefNannyDeclarations |
| 2903 | - int __pyx_t_1; |
| 2904 | - PyObject *__pyx_t_2 = NULL; |
| 2905 | - PyObject *__pyx_t_3 = NULL; |
| 2906 | - PyObject *__pyx_t_4 = NULL; |
| 2907 | - PyObject *__pyx_t_5 = NULL; |
| 2908 | - int __pyx_lineno = 0; |
| 2909 | - const char *__pyx_filename = NULL; |
| 2910 | - int __pyx_clineno = 0; |
| 2911 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__loc,&__pyx_n_s__scale,&__pyx_n_s__size,0}; |
| 2912 | - __Pyx_RefNannySetupContext("normal"); |
| 2913 | + __Pyx_RefNannySetupContext("normal (wrapper)", 0); |
| 2914 | { |
| 2915 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__loc,&__pyx_n_s__scale,&__pyx_n_s__size,0}; |
| 2916 | PyObject* values[3] = {0,0,0}; |
| 2917 | values[0] = __pyx_k_17; |
| 2918 | values[1] = __pyx_k_18; |
| 2919 | + |
| 2920 | + /* "mtrand.pyx":1212 |
| 2921 | + * return cont0_array(self.internal_state, rk_gauss, size) |
| 2922 | + * |
| 2923 | + * def normal(self, loc=0.0, scale=1.0, size=None): # <<<<<<<<<<<<<< |
| 2924 | + * """ |
| 2925 | + * normal(loc=0.0, scale=1.0, size=None) |
| 2926 | + */ |
| 2927 | values[2] = ((PyObject *)Py_None); |
| 2928 | if (unlikely(__pyx_kwds)) { |
| 2929 | Py_ssize_t kw_args; |
| 2930 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 2931 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 2932 | + switch (pos_args) { |
| 2933 | case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); |
| 2934 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 2935 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 2936 | @@ -7088,7 +7391,7 @@ |
| 2937 | default: goto __pyx_L5_argtuple_error; |
| 2938 | } |
| 2939 | kw_args = PyDict_Size(__pyx_kwds); |
| 2940 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 2941 | + switch (pos_args) { |
| 2942 | case 0: |
| 2943 | if (kw_args > 0) { |
| 2944 | PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__loc); |
| 2945 | @@ -7106,7 +7409,7 @@ |
| 2946 | } |
| 2947 | } |
| 2948 | if (unlikely(kw_args > 0)) { |
| 2949 | - 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;} |
| 2950 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "normal") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 2951 | } |
| 2952 | } else { |
| 2953 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 2954 | @@ -7129,6 +7432,27 @@ |
| 2955 | __Pyx_RefNannyFinishContext(); |
| 2956 | return NULL; |
| 2957 | __pyx_L4_argument_unpacking_done:; |
| 2958 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_34normal(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_loc, __pyx_v_scale, __pyx_v_size); |
| 2959 | + __Pyx_RefNannyFinishContext(); |
| 2960 | + return __pyx_r; |
| 2961 | +} |
| 2962 | + |
| 2963 | +static PyObject *__pyx_pf_6mtrand_11RandomState_34normal(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_loc, PyObject *__pyx_v_scale, PyObject *__pyx_v_size) { |
| 2964 | + PyArrayObject *__pyx_v_oloc = 0; |
| 2965 | + PyArrayObject *__pyx_v_oscale = 0; |
| 2966 | + double __pyx_v_floc; |
| 2967 | + double __pyx_v_fscale; |
| 2968 | + PyObject *__pyx_r = NULL; |
| 2969 | + __Pyx_RefNannyDeclarations |
| 2970 | + int __pyx_t_1; |
| 2971 | + PyObject *__pyx_t_2 = NULL; |
| 2972 | + PyObject *__pyx_t_3 = NULL; |
| 2973 | + PyObject *__pyx_t_4 = NULL; |
| 2974 | + PyObject *__pyx_t_5 = NULL; |
| 2975 | + int __pyx_lineno = 0; |
| 2976 | + const char *__pyx_filename = NULL; |
| 2977 | + int __pyx_clineno = 0; |
| 2978 | + __Pyx_RefNannySetupContext("normal", 0); |
| 2979 | |
| 2980 | /* "mtrand.pyx":1297 |
| 2981 | * cdef double floc, fscale |
| 2982 | @@ -7180,9 +7504,9 @@ |
| 2983 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 2984 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 2985 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 2986 | - goto __pyx_L7; |
| 2987 | + goto __pyx_L4; |
| 2988 | } |
| 2989 | - __pyx_L7:; |
| 2990 | + __pyx_L4:; |
| 2991 | |
| 2992 | /* "mtrand.pyx":1302 |
| 2993 | * if fscale <= 0: |
| 2994 | @@ -7192,14 +7516,14 @@ |
| 2995 | * PyErr_Clear() |
| 2996 | */ |
| 2997 | __Pyx_XDECREF(__pyx_r); |
| 2998 | - __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;} |
| 2999 | + __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(__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;} |
| 3000 | __Pyx_GOTREF(__pyx_t_2); |
| 3001 | __pyx_r = __pyx_t_2; |
| 3002 | __pyx_t_2 = 0; |
| 3003 | goto __pyx_L0; |
| 3004 | - goto __pyx_L6; |
| 3005 | + goto __pyx_L3; |
| 3006 | } |
| 3007 | - __pyx_L6:; |
| 3008 | + __pyx_L3:; |
| 3009 | |
| 3010 | /* "mtrand.pyx":1304 |
| 3011 | * return cont2_array_sc(self.internal_state, rk_normal, size, floc, fscale) |
| 3012 | @@ -7254,7 +7578,7 @@ |
| 3013 | __Pyx_GOTREF(__pyx_t_4); |
| 3014 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 3015 | __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;} |
| 3016 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 3017 | + __Pyx_GOTREF(__pyx_t_2); |
| 3018 | __Pyx_INCREF(((PyObject *)__pyx_v_oscale)); |
| 3019 | PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_oscale)); |
| 3020 | __Pyx_GIVEREF(((PyObject *)__pyx_v_oscale)); |
| 3021 | @@ -7266,7 +7590,7 @@ |
| 3022 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 3023 | __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; |
| 3024 | __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;} |
| 3025 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 3026 | + __Pyx_GOTREF(__pyx_t_2); |
| 3027 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); |
| 3028 | __Pyx_GIVEREF(__pyx_t_5); |
| 3029 | __pyx_t_5 = 0; |
| 3030 | @@ -7290,9 +7614,9 @@ |
| 3031 | __Pyx_Raise(__pyx_t_5, 0, 0, 0); |
| 3032 | __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| 3033 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 3034 | - goto __pyx_L8; |
| 3035 | + goto __pyx_L5; |
| 3036 | } |
| 3037 | - __pyx_L8:; |
| 3038 | + __pyx_L5:; |
| 3039 | |
| 3040 | /* "mtrand.pyx":1310 |
| 3041 | * if np.any(np.less_equal(oscale, 0)): |
| 3042 | @@ -7302,7 +7626,7 @@ |
| 3043 | * def beta(self, a, b, size=None): |
| 3044 | */ |
| 3045 | __Pyx_XDECREF(__pyx_r); |
| 3046 | - __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;} |
| 3047 | + __pyx_t_5 = __pyx_f_6mtrand_cont2_array(__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;} |
| 3048 | __Pyx_GOTREF(__pyx_t_5); |
| 3049 | __pyx_r = __pyx_t_5; |
| 3050 | __pyx_t_5 = 0; |
| 3051 | @@ -7325,42 +7649,32 @@ |
| 3052 | return __pyx_r; |
| 3053 | } |
| 3054 | |
| 3055 | -/* "mtrand.pyx":1312 |
| 3056 | - * return cont2_array(self.internal_state, rk_normal, size, oloc, oscale) |
| 3057 | - * |
| 3058 | - * def beta(self, a, b, size=None): # <<<<<<<<<<<<<< |
| 3059 | - * """ |
| 3060 | - * beta(a, b, size=None) |
| 3061 | - */ |
| 3062 | - |
| 3063 | -static PyObject *__pyx_pf_6mtrand_11RandomState_18beta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 3064 | -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 "; |
| 3065 | -static PyObject *__pyx_pf_6mtrand_11RandomState_18beta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 3066 | +/* Python wrapper */ |
| 3067 | +static PyObject *__pyx_pw_6mtrand_11RandomState_37beta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 3068 | +static char __pyx_doc_6mtrand_11RandomState_36beta[] = "\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 "; |
| 3069 | +static PyObject *__pyx_pw_6mtrand_11RandomState_37beta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 3070 | PyObject *__pyx_v_a = 0; |
| 3071 | PyObject *__pyx_v_b = 0; |
| 3072 | PyObject *__pyx_v_size = 0; |
| 3073 | - PyArrayObject *__pyx_v_oa = 0; |
| 3074 | - PyArrayObject *__pyx_v_ob = 0; |
| 3075 | - double __pyx_v_fa; |
| 3076 | - double __pyx_v_fb; |
| 3077 | - PyObject *__pyx_r = NULL; |
| 3078 | + PyObject *__pyx_r = 0; |
| 3079 | __Pyx_RefNannyDeclarations |
| 3080 | - int __pyx_t_1; |
| 3081 | - PyObject *__pyx_t_2 = NULL; |
| 3082 | - PyObject *__pyx_t_3 = NULL; |
| 3083 | - PyObject *__pyx_t_4 = NULL; |
| 3084 | - PyObject *__pyx_t_5 = NULL; |
| 3085 | - int __pyx_lineno = 0; |
| 3086 | - const char *__pyx_filename = NULL; |
| 3087 | - int __pyx_clineno = 0; |
| 3088 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__a,&__pyx_n_s__b,&__pyx_n_s__size,0}; |
| 3089 | - __Pyx_RefNannySetupContext("beta"); |
| 3090 | + __Pyx_RefNannySetupContext("beta (wrapper)", 0); |
| 3091 | { |
| 3092 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__a,&__pyx_n_s__b,&__pyx_n_s__size,0}; |
| 3093 | PyObject* values[3] = {0,0,0}; |
| 3094 | + |
| 3095 | + /* "mtrand.pyx":1312 |
| 3096 | + * return cont2_array(self.internal_state, rk_normal, size, oloc, oscale) |
| 3097 | + * |
| 3098 | + * def beta(self, a, b, size=None): # <<<<<<<<<<<<<< |
| 3099 | + * """ |
| 3100 | + * beta(a, b, size=None) |
| 3101 | + */ |
| 3102 | values[2] = ((PyObject *)Py_None); |
| 3103 | if (unlikely(__pyx_kwds)) { |
| 3104 | Py_ssize_t kw_args; |
| 3105 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 3106 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 3107 | + switch (pos_args) { |
| 3108 | case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); |
| 3109 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 3110 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 3111 | @@ -7368,14 +7682,12 @@ |
| 3112 | default: goto __pyx_L5_argtuple_error; |
| 3113 | } |
| 3114 | kw_args = PyDict_Size(__pyx_kwds); |
| 3115 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 3116 | + switch (pos_args) { |
| 3117 | case 0: |
| 3118 | - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a); |
| 3119 | - if (likely(values[0])) kw_args--; |
| 3120 | + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a)) != 0)) kw_args--; |
| 3121 | else goto __pyx_L5_argtuple_error; |
| 3122 | case 1: |
| 3123 | - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__b); |
| 3124 | - if (likely(values[1])) kw_args--; |
| 3125 | + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__b)) != 0)) kw_args--; |
| 3126 | else { |
| 3127 | __Pyx_RaiseArgtupleInvalid("beta", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1312; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 3128 | } |
| 3129 | @@ -7386,7 +7698,7 @@ |
| 3130 | } |
| 3131 | } |
| 3132 | if (unlikely(kw_args > 0)) { |
| 3133 | - 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;} |
| 3134 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "beta") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1312; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 3135 | } |
| 3136 | } else { |
| 3137 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 3138 | @@ -7409,6 +7721,27 @@ |
| 3139 | __Pyx_RefNannyFinishContext(); |
| 3140 | return NULL; |
| 3141 | __pyx_L4_argument_unpacking_done:; |
| 3142 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_36beta(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_a, __pyx_v_b, __pyx_v_size); |
| 3143 | + __Pyx_RefNannyFinishContext(); |
| 3144 | + return __pyx_r; |
| 3145 | +} |
| 3146 | + |
| 3147 | +static PyObject *__pyx_pf_6mtrand_11RandomState_36beta(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_size) { |
| 3148 | + PyArrayObject *__pyx_v_oa = 0; |
| 3149 | + PyArrayObject *__pyx_v_ob = 0; |
| 3150 | + double __pyx_v_fa; |
| 3151 | + double __pyx_v_fb; |
| 3152 | + PyObject *__pyx_r = NULL; |
| 3153 | + __Pyx_RefNannyDeclarations |
| 3154 | + int __pyx_t_1; |
| 3155 | + PyObject *__pyx_t_2 = NULL; |
| 3156 | + PyObject *__pyx_t_3 = NULL; |
| 3157 | + PyObject *__pyx_t_4 = NULL; |
| 3158 | + PyObject *__pyx_t_5 = NULL; |
| 3159 | + int __pyx_lineno = 0; |
| 3160 | + const char *__pyx_filename = NULL; |
| 3161 | + int __pyx_clineno = 0; |
| 3162 | + __Pyx_RefNannySetupContext("beta", 0); |
| 3163 | |
| 3164 | /* "mtrand.pyx":1352 |
| 3165 | * cdef double fa, fb |
| 3166 | @@ -7460,9 +7793,9 @@ |
| 3167 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 3168 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 3169 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 3170 | - goto __pyx_L7; |
| 3171 | + goto __pyx_L4; |
| 3172 | } |
| 3173 | - __pyx_L7:; |
| 3174 | + __pyx_L4:; |
| 3175 | |
| 3176 | /* "mtrand.pyx":1357 |
| 3177 | * if fa <= 0: |
| 3178 | @@ -7486,9 +7819,9 @@ |
| 3179 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 3180 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 3181 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 3182 | - goto __pyx_L8; |
| 3183 | + goto __pyx_L5; |
| 3184 | } |
| 3185 | - __pyx_L8:; |
| 3186 | + __pyx_L5:; |
| 3187 | |
| 3188 | /* "mtrand.pyx":1359 |
| 3189 | * if fb <= 0: |
| 3190 | @@ -7498,14 +7831,14 @@ |
| 3191 | * PyErr_Clear() |
| 3192 | */ |
| 3193 | __Pyx_XDECREF(__pyx_r); |
| 3194 | - __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;} |
| 3195 | + __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(__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;} |
| 3196 | __Pyx_GOTREF(__pyx_t_2); |
| 3197 | __pyx_r = __pyx_t_2; |
| 3198 | __pyx_t_2 = 0; |
| 3199 | goto __pyx_L0; |
| 3200 | - goto __pyx_L6; |
| 3201 | + goto __pyx_L3; |
| 3202 | } |
| 3203 | - __pyx_L6:; |
| 3204 | + __pyx_L3:; |
| 3205 | |
| 3206 | /* "mtrand.pyx":1361 |
| 3207 | * return cont2_array_sc(self.internal_state, rk_beta, size, fa, fb) |
| 3208 | @@ -7560,7 +7893,7 @@ |
| 3209 | __Pyx_GOTREF(__pyx_t_4); |
| 3210 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 3211 | __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;} |
| 3212 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 3213 | + __Pyx_GOTREF(__pyx_t_2); |
| 3214 | __Pyx_INCREF(((PyObject *)__pyx_v_oa)); |
| 3215 | PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_oa)); |
| 3216 | __Pyx_GIVEREF(((PyObject *)__pyx_v_oa)); |
| 3217 | @@ -7572,7 +7905,7 @@ |
| 3218 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 3219 | __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; |
| 3220 | __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;} |
| 3221 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 3222 | + __Pyx_GOTREF(__pyx_t_2); |
| 3223 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); |
| 3224 | __Pyx_GIVEREF(__pyx_t_5); |
| 3225 | __pyx_t_5 = 0; |
| 3226 | @@ -7596,9 +7929,9 @@ |
| 3227 | __Pyx_Raise(__pyx_t_5, 0, 0, 0); |
| 3228 | __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| 3229 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 3230 | - goto __pyx_L9; |
| 3231 | + goto __pyx_L6; |
| 3232 | } |
| 3233 | - __pyx_L9:; |
| 3234 | + __pyx_L6:; |
| 3235 | |
| 3236 | /* "mtrand.pyx":1367 |
| 3237 | * if np.any(np.less_equal(oa, 0)): |
| 3238 | @@ -7618,7 +7951,7 @@ |
| 3239 | __Pyx_GOTREF(__pyx_t_3); |
| 3240 | __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| 3241 | __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;} |
| 3242 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 3243 | + __Pyx_GOTREF(__pyx_t_5); |
| 3244 | __Pyx_INCREF(((PyObject *)__pyx_v_ob)); |
| 3245 | PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_ob)); |
| 3246 | __Pyx_GIVEREF(((PyObject *)__pyx_v_ob)); |
| 3247 | @@ -7630,7 +7963,7 @@ |
| 3248 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 3249 | __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| 3250 | __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;} |
| 3251 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 3252 | + __Pyx_GOTREF(__pyx_t_5); |
| 3253 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); |
| 3254 | __Pyx_GIVEREF(__pyx_t_4); |
| 3255 | __pyx_t_4 = 0; |
| 3256 | @@ -7654,9 +7987,9 @@ |
| 3257 | __Pyx_Raise(__pyx_t_4, 0, 0, 0); |
| 3258 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 3259 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 3260 | - goto __pyx_L10; |
| 3261 | + goto __pyx_L7; |
| 3262 | } |
| 3263 | - __pyx_L10:; |
| 3264 | + __pyx_L7:; |
| 3265 | |
| 3266 | /* "mtrand.pyx":1369 |
| 3267 | * if np.any(np.less_equal(ob, 0)): |
| 3268 | @@ -7666,7 +7999,7 @@ |
| 3269 | * def exponential(self, scale=1.0, size=None): |
| 3270 | */ |
| 3271 | __Pyx_XDECREF(__pyx_r); |
| 3272 | - __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;} |
| 3273 | + __pyx_t_4 = __pyx_f_6mtrand_cont2_array(__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;} |
| 3274 | __Pyx_GOTREF(__pyx_t_4); |
| 3275 | __pyx_r = __pyx_t_4; |
| 3276 | __pyx_t_4 = 0; |
| 3277 | @@ -7689,47 +8022,39 @@ |
| 3278 | return __pyx_r; |
| 3279 | } |
| 3280 | |
| 3281 | -/* "mtrand.pyx":1371 |
| 3282 | - * return cont2_array(self.internal_state, rk_beta, size, oa, ob) |
| 3283 | - * |
| 3284 | - * def exponential(self, scale=1.0, size=None): # <<<<<<<<<<<<<< |
| 3285 | - * """ |
| 3286 | - * exponential(scale=1.0, size=None) |
| 3287 | - */ |
| 3288 | - |
| 3289 | -static PyObject *__pyx_pf_6mtrand_11RandomState_19exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 3290 | -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 "; |
| 3291 | -static PyObject *__pyx_pf_6mtrand_11RandomState_19exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 3292 | +/* Python wrapper */ |
| 3293 | +static PyObject *__pyx_pw_6mtrand_11RandomState_39exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 3294 | +static char __pyx_doc_6mtrand_11RandomState_38exponential[] = "\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 "; |
| 3295 | +static PyObject *__pyx_pw_6mtrand_11RandomState_39exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 3296 | PyObject *__pyx_v_scale = 0; |
| 3297 | PyObject *__pyx_v_size = 0; |
| 3298 | - PyArrayObject *__pyx_v_oscale = 0; |
| 3299 | - double __pyx_v_fscale; |
| 3300 | - PyObject *__pyx_r = NULL; |
| 3301 | + PyObject *__pyx_r = 0; |
| 3302 | __Pyx_RefNannyDeclarations |
| 3303 | - int __pyx_t_1; |
| 3304 | - PyObject *__pyx_t_2 = NULL; |
| 3305 | - PyObject *__pyx_t_3 = NULL; |
| 3306 | - PyObject *__pyx_t_4 = NULL; |
| 3307 | - PyObject *__pyx_t_5 = NULL; |
| 3308 | - int __pyx_lineno = 0; |
| 3309 | - const char *__pyx_filename = NULL; |
| 3310 | - int __pyx_clineno = 0; |
| 3311 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__scale,&__pyx_n_s__size,0}; |
| 3312 | - __Pyx_RefNannySetupContext("exponential"); |
| 3313 | + __Pyx_RefNannySetupContext("exponential (wrapper)", 0); |
| 3314 | { |
| 3315 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__scale,&__pyx_n_s__size,0}; |
| 3316 | PyObject* values[2] = {0,0}; |
| 3317 | values[0] = __pyx_k_28; |
| 3318 | + |
| 3319 | + /* "mtrand.pyx":1371 |
| 3320 | + * return cont2_array(self.internal_state, rk_beta, size, oa, ob) |
| 3321 | + * |
| 3322 | + * def exponential(self, scale=1.0, size=None): # <<<<<<<<<<<<<< |
| 3323 | + * """ |
| 3324 | + * exponential(scale=1.0, size=None) |
| 3325 | + */ |
| 3326 | values[1] = ((PyObject *)Py_None); |
| 3327 | if (unlikely(__pyx_kwds)) { |
| 3328 | Py_ssize_t kw_args; |
| 3329 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 3330 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 3331 | + switch (pos_args) { |
| 3332 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 3333 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 3334 | case 0: break; |
| 3335 | default: goto __pyx_L5_argtuple_error; |
| 3336 | } |
| 3337 | kw_args = PyDict_Size(__pyx_kwds); |
| 3338 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 3339 | + switch (pos_args) { |
| 3340 | case 0: |
| 3341 | if (kw_args > 0) { |
| 3342 | PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scale); |
| 3343 | @@ -7742,7 +8067,7 @@ |
| 3344 | } |
| 3345 | } |
| 3346 | if (unlikely(kw_args > 0)) { |
| 3347 | - 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;} |
| 3348 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "exponential") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 3349 | } |
| 3350 | } else { |
| 3351 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 3352 | @@ -7763,7 +8088,26 @@ |
| 3353 | __Pyx_RefNannyFinishContext(); |
| 3354 | return NULL; |
| 3355 | __pyx_L4_argument_unpacking_done:; |
| 3356 | - |
| 3357 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_38exponential(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_scale, __pyx_v_size); |
| 3358 | + __Pyx_RefNannyFinishContext(); |
| 3359 | + return __pyx_r; |
| 3360 | +} |
| 3361 | + |
| 3362 | +static PyObject *__pyx_pf_6mtrand_11RandomState_38exponential(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_scale, PyObject *__pyx_v_size) { |
| 3363 | + PyArrayObject *__pyx_v_oscale = 0; |
| 3364 | + double __pyx_v_fscale; |
| 3365 | + PyObject *__pyx_r = NULL; |
| 3366 | + __Pyx_RefNannyDeclarations |
| 3367 | + int __pyx_t_1; |
| 3368 | + PyObject *__pyx_t_2 = NULL; |
| 3369 | + PyObject *__pyx_t_3 = NULL; |
| 3370 | + PyObject *__pyx_t_4 = NULL; |
| 3371 | + PyObject *__pyx_t_5 = NULL; |
| 3372 | + int __pyx_lineno = 0; |
| 3373 | + const char *__pyx_filename = NULL; |
| 3374 | + int __pyx_clineno = 0; |
| 3375 | + __Pyx_RefNannySetupContext("exponential", 0); |
| 3376 | + |
| 3377 | /* "mtrand.pyx":1412 |
| 3378 | * cdef double fscale |
| 3379 | * |
| 3380 | @@ -7805,9 +8149,9 @@ |
| 3381 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 3382 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 3383 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 3384 | - goto __pyx_L7; |
| 3385 | + goto __pyx_L4; |
| 3386 | } |
| 3387 | - __pyx_L7:; |
| 3388 | + __pyx_L4:; |
| 3389 | |
| 3390 | /* "mtrand.pyx":1416 |
| 3391 | * if fscale <= 0: |
| 3392 | @@ -7817,14 +8161,14 @@ |
| 3393 | * PyErr_Clear() |
| 3394 | */ |
| 3395 | __Pyx_XDECREF(__pyx_r); |
| 3396 | - __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;} |
| 3397 | + __pyx_t_2 = __pyx_f_6mtrand_cont1_array_sc(__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;} |
| 3398 | __Pyx_GOTREF(__pyx_t_2); |
| 3399 | __pyx_r = __pyx_t_2; |
| 3400 | __pyx_t_2 = 0; |
| 3401 | goto __pyx_L0; |
| 3402 | - goto __pyx_L6; |
| 3403 | + goto __pyx_L3; |
| 3404 | } |
| 3405 | - __pyx_L6:; |
| 3406 | + __pyx_L3:; |
| 3407 | |
| 3408 | /* "mtrand.pyx":1418 |
| 3409 | * return cont1_array_sc(self.internal_state, rk_exponential, size, fscale) |
| 3410 | @@ -7868,7 +8212,7 @@ |
| 3411 | __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;} |
| 3412 | __Pyx_GOTREF(__pyx_t_2); |
| 3413 | __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;} |
| 3414 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 3415 | + __Pyx_GOTREF(__pyx_t_5); |
| 3416 | __Pyx_INCREF(((PyObject *)__pyx_v_oscale)); |
| 3417 | PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_oscale)); |
| 3418 | __Pyx_GIVEREF(((PyObject *)__pyx_v_oscale)); |
| 3419 | @@ -7880,7 +8224,7 @@ |
| 3420 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 3421 | __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| 3422 | __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;} |
| 3423 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 3424 | + __Pyx_GOTREF(__pyx_t_5); |
| 3425 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); |
| 3426 | __Pyx_GIVEREF(__pyx_t_2); |
| 3427 | __pyx_t_2 = 0; |
| 3428 | @@ -7904,9 +8248,9 @@ |
| 3429 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 3430 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 3431 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 3432 | - goto __pyx_L8; |
| 3433 | + goto __pyx_L5; |
| 3434 | } |
| 3435 | - __pyx_L8:; |
| 3436 | + __pyx_L5:; |
| 3437 | |
| 3438 | /* "mtrand.pyx":1423 |
| 3439 | * if np.any(np.less_equal(oscale, 0.0)): |
| 3440 | @@ -7916,7 +8260,7 @@ |
| 3441 | * def standard_exponential(self, size=None): |
| 3442 | */ |
| 3443 | __Pyx_XDECREF(__pyx_r); |
| 3444 | - __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;} |
| 3445 | + __pyx_t_2 = __pyx_f_6mtrand_cont1_array(__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;} |
| 3446 | __Pyx_GOTREF(__pyx_t_2); |
| 3447 | __pyx_r = __pyx_t_2; |
| 3448 | __pyx_t_2 = 0; |
| 3449 | @@ -7938,38 +8282,36 @@ |
| 3450 | return __pyx_r; |
| 3451 | } |
| 3452 | |
| 3453 | -/* "mtrand.pyx":1425 |
| 3454 | +/* Python wrapper */ |
| 3455 | +static PyObject *__pyx_pw_6mtrand_11RandomState_41standard_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 3456 | +static char __pyx_doc_6mtrand_11RandomState_40standard_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 "; |
| 3457 | +static PyObject *__pyx_pw_6mtrand_11RandomState_41standard_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 3458 | + PyObject *__pyx_v_size = 0; |
| 3459 | + PyObject *__pyx_r = 0; |
| 3460 | + __Pyx_RefNannyDeclarations |
| 3461 | + __Pyx_RefNannySetupContext("standard_exponential (wrapper)", 0); |
| 3462 | + { |
| 3463 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,0}; |
| 3464 | + PyObject* values[1] = {0}; |
| 3465 | + |
| 3466 | + /* "mtrand.pyx":1425 |
| 3467 | * return cont1_array(self.internal_state, rk_exponential, size, oscale) |
| 3468 | * |
| 3469 | * def standard_exponential(self, size=None): # <<<<<<<<<<<<<< |
| 3470 | * """ |
| 3471 | * standard_exponential(size=None) |
| 3472 | */ |
| 3473 | - |
| 3474 | -static PyObject *__pyx_pf_6mtrand_11RandomState_20standard_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 3475 | -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 "; |
| 3476 | -static PyObject *__pyx_pf_6mtrand_11RandomState_20standard_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 3477 | - PyObject *__pyx_v_size = 0; |
| 3478 | - PyObject *__pyx_r = NULL; |
| 3479 | - __Pyx_RefNannyDeclarations |
| 3480 | - PyObject *__pyx_t_1 = NULL; |
| 3481 | - int __pyx_lineno = 0; |
| 3482 | - const char *__pyx_filename = NULL; |
| 3483 | - int __pyx_clineno = 0; |
| 3484 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,0}; |
| 3485 | - __Pyx_RefNannySetupContext("standard_exponential"); |
| 3486 | - { |
| 3487 | - PyObject* values[1] = {0}; |
| 3488 | values[0] = ((PyObject *)Py_None); |
| 3489 | if (unlikely(__pyx_kwds)) { |
| 3490 | Py_ssize_t kw_args; |
| 3491 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 3492 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 3493 | + switch (pos_args) { |
| 3494 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 3495 | case 0: break; |
| 3496 | default: goto __pyx_L5_argtuple_error; |
| 3497 | } |
| 3498 | kw_args = PyDict_Size(__pyx_kwds); |
| 3499 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 3500 | + switch (pos_args) { |
| 3501 | case 0: |
| 3502 | if (kw_args > 0) { |
| 3503 | PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size); |
| 3504 | @@ -7977,7 +8319,7 @@ |
| 3505 | } |
| 3506 | } |
| 3507 | if (unlikely(kw_args > 0)) { |
| 3508 | - 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;} |
| 3509 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "standard_exponential") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1425; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 3510 | } |
| 3511 | } else { |
| 3512 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 3513 | @@ -7996,6 +8338,19 @@ |
| 3514 | __Pyx_RefNannyFinishContext(); |
| 3515 | return NULL; |
| 3516 | __pyx_L4_argument_unpacking_done:; |
| 3517 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_40standard_exponential(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_size); |
| 3518 | + __Pyx_RefNannyFinishContext(); |
| 3519 | + return __pyx_r; |
| 3520 | +} |
| 3521 | + |
| 3522 | +static PyObject *__pyx_pf_6mtrand_11RandomState_40standard_exponential(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_size) { |
| 3523 | + PyObject *__pyx_r = NULL; |
| 3524 | + __Pyx_RefNannyDeclarations |
| 3525 | + PyObject *__pyx_t_1 = NULL; |
| 3526 | + int __pyx_lineno = 0; |
| 3527 | + const char *__pyx_filename = NULL; |
| 3528 | + int __pyx_clineno = 0; |
| 3529 | + __Pyx_RefNannySetupContext("standard_exponential", 0); |
| 3530 | |
| 3531 | /* "mtrand.pyx":1451 |
| 3532 | * |
| 3533 | @@ -8005,7 +8360,7 @@ |
| 3534 | * def standard_gamma(self, shape, size=None): |
| 3535 | */ |
| 3536 | __Pyx_XDECREF(__pyx_r); |
| 3537 | - __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;} |
| 3538 | + __pyx_t_1 = __pyx_f_6mtrand_cont0_array(__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;} |
| 3539 | __Pyx_GOTREF(__pyx_t_1); |
| 3540 | __pyx_r = __pyx_t_1; |
| 3541 | __pyx_t_1 = 0; |
| 3542 | @@ -8023,49 +8378,40 @@ |
| 3543 | return __pyx_r; |
| 3544 | } |
| 3545 | |
| 3546 | -/* "mtrand.pyx":1453 |
| 3547 | +/* Python wrapper */ |
| 3548 | +static PyObject *__pyx_pw_6mtrand_11RandomState_43standard_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 3549 | +static char __pyx_doc_6mtrand_11RandomState_42standard_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 "; |
| 3550 | +static PyObject *__pyx_pw_6mtrand_11RandomState_43standard_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 3551 | + PyObject *__pyx_v_shape = 0; |
| 3552 | + PyObject *__pyx_v_size = 0; |
| 3553 | + PyObject *__pyx_r = 0; |
| 3554 | + __Pyx_RefNannyDeclarations |
| 3555 | + __Pyx_RefNannySetupContext("standard_gamma (wrapper)", 0); |
| 3556 | + { |
| 3557 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__shape,&__pyx_n_s__size,0}; |
| 3558 | + PyObject* values[2] = {0,0}; |
| 3559 | + |
| 3560 | + /* "mtrand.pyx":1453 |
| 3561 | * return cont0_array(self.internal_state, rk_standard_exponential, size) |
| 3562 | * |
| 3563 | * def standard_gamma(self, shape, size=None): # <<<<<<<<<<<<<< |
| 3564 | * """ |
| 3565 | * standard_gamma(shape, size=None) |
| 3566 | */ |
| 3567 | - |
| 3568 | -static PyObject *__pyx_pf_6mtrand_11RandomState_21standard_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 3569 | -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 "; |
| 3570 | -static PyObject *__pyx_pf_6mtrand_11RandomState_21standard_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 3571 | - PyObject *__pyx_v_shape = 0; |
| 3572 | - PyObject *__pyx_v_size = 0; |
| 3573 | - PyArrayObject *__pyx_v_oshape = 0; |
| 3574 | - double __pyx_v_fshape; |
| 3575 | - PyObject *__pyx_r = NULL; |
| 3576 | - __Pyx_RefNannyDeclarations |
| 3577 | - int __pyx_t_1; |
| 3578 | - PyObject *__pyx_t_2 = NULL; |
| 3579 | - PyObject *__pyx_t_3 = NULL; |
| 3580 | - PyObject *__pyx_t_4 = NULL; |
| 3581 | - PyObject *__pyx_t_5 = NULL; |
| 3582 | - int __pyx_lineno = 0; |
| 3583 | - const char *__pyx_filename = NULL; |
| 3584 | - int __pyx_clineno = 0; |
| 3585 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__shape,&__pyx_n_s__size,0}; |
| 3586 | - __Pyx_RefNannySetupContext("standard_gamma"); |
| 3587 | - { |
| 3588 | - PyObject* values[2] = {0,0}; |
| 3589 | values[1] = ((PyObject *)Py_None); |
| 3590 | if (unlikely(__pyx_kwds)) { |
| 3591 | Py_ssize_t kw_args; |
| 3592 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 3593 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 3594 | + switch (pos_args) { |
| 3595 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 3596 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 3597 | case 0: break; |
| 3598 | default: goto __pyx_L5_argtuple_error; |
| 3599 | } |
| 3600 | kw_args = PyDict_Size(__pyx_kwds); |
| 3601 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 3602 | + switch (pos_args) { |
| 3603 | case 0: |
| 3604 | - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__shape); |
| 3605 | - if (likely(values[0])) kw_args--; |
| 3606 | + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__shape)) != 0)) kw_args--; |
| 3607 | else goto __pyx_L5_argtuple_error; |
| 3608 | case 1: |
| 3609 | if (kw_args > 0) { |
| 3610 | @@ -8074,7 +8420,7 @@ |
| 3611 | } |
| 3612 | } |
| 3613 | if (unlikely(kw_args > 0)) { |
| 3614 | - 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;} |
| 3615 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "standard_gamma") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1453; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 3616 | } |
| 3617 | } else { |
| 3618 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 3619 | @@ -8095,6 +8441,25 @@ |
| 3620 | __Pyx_RefNannyFinishContext(); |
| 3621 | return NULL; |
| 3622 | __pyx_L4_argument_unpacking_done:; |
| 3623 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_42standard_gamma(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_shape, __pyx_v_size); |
| 3624 | + __Pyx_RefNannyFinishContext(); |
| 3625 | + return __pyx_r; |
| 3626 | +} |
| 3627 | + |
| 3628 | +static PyObject *__pyx_pf_6mtrand_11RandomState_42standard_gamma(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_shape, PyObject *__pyx_v_size) { |
| 3629 | + PyArrayObject *__pyx_v_oshape = 0; |
| 3630 | + double __pyx_v_fshape; |
| 3631 | + PyObject *__pyx_r = NULL; |
| 3632 | + __Pyx_RefNannyDeclarations |
| 3633 | + int __pyx_t_1; |
| 3634 | + PyObject *__pyx_t_2 = NULL; |
| 3635 | + PyObject *__pyx_t_3 = NULL; |
| 3636 | + PyObject *__pyx_t_4 = NULL; |
| 3637 | + PyObject *__pyx_t_5 = NULL; |
| 3638 | + int __pyx_lineno = 0; |
| 3639 | + const char *__pyx_filename = NULL; |
| 3640 | + int __pyx_clineno = 0; |
| 3641 | + __Pyx_RefNannySetupContext("standard_gamma", 0); |
| 3642 | |
| 3643 | /* "mtrand.pyx":1523 |
| 3644 | * cdef double fshape |
| 3645 | @@ -8137,9 +8502,9 @@ |
| 3646 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 3647 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 3648 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 3649 | - goto __pyx_L7; |
| 3650 | + goto __pyx_L4; |
| 3651 | } |
| 3652 | - __pyx_L7:; |
| 3653 | + __pyx_L4:; |
| 3654 | |
| 3655 | /* "mtrand.pyx":1527 |
| 3656 | * if fshape <= 0: |
| 3657 | @@ -8149,14 +8514,14 @@ |
| 3658 | * PyErr_Clear() |
| 3659 | */ |
| 3660 | __Pyx_XDECREF(__pyx_r); |
| 3661 | - __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;} |
| 3662 | + __pyx_t_2 = __pyx_f_6mtrand_cont1_array_sc(__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;} |
| 3663 | __Pyx_GOTREF(__pyx_t_2); |
| 3664 | __pyx_r = __pyx_t_2; |
| 3665 | __pyx_t_2 = 0; |
| 3666 | goto __pyx_L0; |
| 3667 | - goto __pyx_L6; |
| 3668 | + goto __pyx_L3; |
| 3669 | } |
| 3670 | - __pyx_L6:; |
| 3671 | + __pyx_L3:; |
| 3672 | |
| 3673 | /* "mtrand.pyx":1529 |
| 3674 | * return cont1_array_sc(self.internal_state, rk_standard_gamma, size, fshape) |
| 3675 | @@ -8200,7 +8565,7 @@ |
| 3676 | __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;} |
| 3677 | __Pyx_GOTREF(__pyx_t_2); |
| 3678 | __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;} |
| 3679 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 3680 | + __Pyx_GOTREF(__pyx_t_5); |
| 3681 | __Pyx_INCREF(((PyObject *)__pyx_v_oshape)); |
| 3682 | PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_oshape)); |
| 3683 | __Pyx_GIVEREF(((PyObject *)__pyx_v_oshape)); |
| 3684 | @@ -8212,7 +8577,7 @@ |
| 3685 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 3686 | __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| 3687 | __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;} |
| 3688 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 3689 | + __Pyx_GOTREF(__pyx_t_5); |
| 3690 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); |
| 3691 | __Pyx_GIVEREF(__pyx_t_2); |
| 3692 | __pyx_t_2 = 0; |
| 3693 | @@ -8236,9 +8601,9 @@ |
| 3694 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 3695 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 3696 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 3697 | - goto __pyx_L8; |
| 3698 | + goto __pyx_L5; |
| 3699 | } |
| 3700 | - __pyx_L8:; |
| 3701 | + __pyx_L5:; |
| 3702 | |
| 3703 | /* "mtrand.pyx":1533 |
| 3704 | * if np.any(np.less_equal(oshape, 0.0)): |
| 3705 | @@ -8248,7 +8613,7 @@ |
| 3706 | * def gamma(self, shape, scale=1.0, size=None): |
| 3707 | */ |
| 3708 | __Pyx_XDECREF(__pyx_r); |
| 3709 | - __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;} |
| 3710 | + __pyx_t_2 = __pyx_f_6mtrand_cont1_array(__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;} |
| 3711 | __Pyx_GOTREF(__pyx_t_2); |
| 3712 | __pyx_r = __pyx_t_2; |
| 3713 | __pyx_t_2 = 0; |
| 3714 | @@ -8270,43 +8635,33 @@ |
| 3715 | return __pyx_r; |
| 3716 | } |
| 3717 | |
| 3718 | -/* "mtrand.pyx":1535 |
| 3719 | - * return cont1_array(self.internal_state, rk_standard_gamma, size, oshape) |
| 3720 | - * |
| 3721 | - * def gamma(self, shape, scale=1.0, size=None): # <<<<<<<<<<<<<< |
| 3722 | - * """ |
| 3723 | - * gamma(shape, scale=1.0, size=None) |
| 3724 | - */ |
| 3725 | - |
| 3726 | -static PyObject *__pyx_pf_6mtrand_11RandomState_22gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 3727 | -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 "; |
| 3728 | -static PyObject *__pyx_pf_6mtrand_11RandomState_22gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 3729 | +/* Python wrapper */ |
| 3730 | +static PyObject *__pyx_pw_6mtrand_11RandomState_45gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 3731 | +static char __pyx_doc_6mtrand_11RandomState_44gamma[] = "\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 "; |
| 3732 | +static PyObject *__pyx_pw_6mtrand_11RandomState_45gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 3733 | PyObject *__pyx_v_shape = 0; |
| 3734 | PyObject *__pyx_v_scale = 0; |
| 3735 | PyObject *__pyx_v_size = 0; |
| 3736 | - PyArrayObject *__pyx_v_oshape = 0; |
| 3737 | - PyArrayObject *__pyx_v_oscale = 0; |
| 3738 | - double __pyx_v_fshape; |
| 3739 | - double __pyx_v_fscale; |
| 3740 | - PyObject *__pyx_r = NULL; |
| 3741 | + PyObject *__pyx_r = 0; |
| 3742 | __Pyx_RefNannyDeclarations |
| 3743 | - int __pyx_t_1; |
| 3744 | - PyObject *__pyx_t_2 = NULL; |
| 3745 | - PyObject *__pyx_t_3 = NULL; |
| 3746 | - PyObject *__pyx_t_4 = NULL; |
| 3747 | - PyObject *__pyx_t_5 = NULL; |
| 3748 | - int __pyx_lineno = 0; |
| 3749 | - const char *__pyx_filename = NULL; |
| 3750 | - int __pyx_clineno = 0; |
| 3751 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__shape,&__pyx_n_s__scale,&__pyx_n_s__size,0}; |
| 3752 | - __Pyx_RefNannySetupContext("gamma"); |
| 3753 | + __Pyx_RefNannySetupContext("gamma (wrapper)", 0); |
| 3754 | { |
| 3755 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__shape,&__pyx_n_s__scale,&__pyx_n_s__size,0}; |
| 3756 | PyObject* values[3] = {0,0,0}; |
| 3757 | values[1] = __pyx_k_34; |
| 3758 | + |
| 3759 | + /* "mtrand.pyx":1535 |
| 3760 | + * return cont1_array(self.internal_state, rk_standard_gamma, size, oshape) |
| 3761 | + * |
| 3762 | + * def gamma(self, shape, scale=1.0, size=None): # <<<<<<<<<<<<<< |
| 3763 | + * """ |
| 3764 | + * gamma(shape, scale=1.0, size=None) |
| 3765 | + */ |
| 3766 | values[2] = ((PyObject *)Py_None); |
| 3767 | if (unlikely(__pyx_kwds)) { |
| 3768 | Py_ssize_t kw_args; |
| 3769 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 3770 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 3771 | + switch (pos_args) { |
| 3772 | case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); |
| 3773 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 3774 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 3775 | @@ -8314,10 +8669,9 @@ |
| 3776 | default: goto __pyx_L5_argtuple_error; |
| 3777 | } |
| 3778 | kw_args = PyDict_Size(__pyx_kwds); |
| 3779 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 3780 | + switch (pos_args) { |
| 3781 | case 0: |
| 3782 | - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__shape); |
| 3783 | - if (likely(values[0])) kw_args--; |
| 3784 | + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__shape)) != 0)) kw_args--; |
| 3785 | else goto __pyx_L5_argtuple_error; |
| 3786 | case 1: |
| 3787 | if (kw_args > 0) { |
| 3788 | @@ -8331,7 +8685,7 @@ |
| 3789 | } |
| 3790 | } |
| 3791 | if (unlikely(kw_args > 0)) { |
| 3792 | - 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;} |
| 3793 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gamma") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1535; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 3794 | } |
| 3795 | } else { |
| 3796 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 3797 | @@ -8354,6 +8708,27 @@ |
| 3798 | __Pyx_RefNannyFinishContext(); |
| 3799 | return NULL; |
| 3800 | __pyx_L4_argument_unpacking_done:; |
| 3801 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_44gamma(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_shape, __pyx_v_scale, __pyx_v_size); |
| 3802 | + __Pyx_RefNannyFinishContext(); |
| 3803 | + return __pyx_r; |
| 3804 | +} |
| 3805 | + |
| 3806 | +static PyObject *__pyx_pf_6mtrand_11RandomState_44gamma(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_shape, PyObject *__pyx_v_scale, PyObject *__pyx_v_size) { |
| 3807 | + PyArrayObject *__pyx_v_oshape = 0; |
| 3808 | + PyArrayObject *__pyx_v_oscale = 0; |
| 3809 | + double __pyx_v_fshape; |
| 3810 | + double __pyx_v_fscale; |
| 3811 | + PyObject *__pyx_r = NULL; |
| 3812 | + __Pyx_RefNannyDeclarations |
| 3813 | + int __pyx_t_1; |
| 3814 | + PyObject *__pyx_t_2 = NULL; |
| 3815 | + PyObject *__pyx_t_3 = NULL; |
| 3816 | + PyObject *__pyx_t_4 = NULL; |
| 3817 | + PyObject *__pyx_t_5 = NULL; |
| 3818 | + int __pyx_lineno = 0; |
| 3819 | + const char *__pyx_filename = NULL; |
| 3820 | + int __pyx_clineno = 0; |
| 3821 | + __Pyx_RefNannySetupContext("gamma", 0); |
| 3822 | |
| 3823 | /* "mtrand.pyx":1608 |
| 3824 | * cdef double fshape, fscale |
| 3825 | @@ -8405,9 +8780,9 @@ |
| 3826 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 3827 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 3828 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 3829 | - goto __pyx_L7; |
| 3830 | + goto __pyx_L4; |
| 3831 | } |
| 3832 | - __pyx_L7:; |
| 3833 | + __pyx_L4:; |
| 3834 | |
| 3835 | /* "mtrand.pyx":1613 |
| 3836 | * if fshape <= 0: |
| 3837 | @@ -8431,9 +8806,9 @@ |
| 3838 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 3839 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 3840 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 3841 | - goto __pyx_L8; |
| 3842 | + goto __pyx_L5; |
| 3843 | } |
| 3844 | - __pyx_L8:; |
| 3845 | + __pyx_L5:; |
| 3846 | |
| 3847 | /* "mtrand.pyx":1615 |
| 3848 | * if fscale <= 0: |
| 3849 | @@ -8443,14 +8818,14 @@ |
| 3850 | * PyErr_Clear() |
| 3851 | */ |
| 3852 | __Pyx_XDECREF(__pyx_r); |
| 3853 | - __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;} |
| 3854 | + __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(__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;} |
| 3855 | __Pyx_GOTREF(__pyx_t_2); |
| 3856 | __pyx_r = __pyx_t_2; |
| 3857 | __pyx_t_2 = 0; |
| 3858 | goto __pyx_L0; |
| 3859 | - goto __pyx_L6; |
| 3860 | + goto __pyx_L3; |
| 3861 | } |
| 3862 | - __pyx_L6:; |
| 3863 | + __pyx_L3:; |
| 3864 | |
| 3865 | /* "mtrand.pyx":1617 |
| 3866 | * return cont2_array_sc(self.internal_state, rk_gamma, size, fshape, fscale) |
| 3867 | @@ -8507,7 +8882,7 @@ |
| 3868 | __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;} |
| 3869 | __Pyx_GOTREF(__pyx_t_2); |
| 3870 | __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;} |
| 3871 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 3872 | + __Pyx_GOTREF(__pyx_t_5); |
| 3873 | __Pyx_INCREF(((PyObject *)__pyx_v_oshape)); |
| 3874 | PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_oshape)); |
| 3875 | __Pyx_GIVEREF(((PyObject *)__pyx_v_oshape)); |
| 3876 | @@ -8519,7 +8894,7 @@ |
| 3877 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 3878 | __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| 3879 | __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;} |
| 3880 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 3881 | + __Pyx_GOTREF(__pyx_t_5); |
| 3882 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); |
| 3883 | __Pyx_GIVEREF(__pyx_t_2); |
| 3884 | __pyx_t_2 = 0; |
| 3885 | @@ -8543,9 +8918,9 @@ |
| 3886 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 3887 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 3888 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 3889 | - goto __pyx_L9; |
| 3890 | + goto __pyx_L6; |
| 3891 | } |
| 3892 | - __pyx_L9:; |
| 3893 | + __pyx_L6:; |
| 3894 | |
| 3895 | /* "mtrand.pyx":1622 |
| 3896 | * if np.any(np.less_equal(oshape, 0.0)): |
| 3897 | @@ -8567,7 +8942,7 @@ |
| 3898 | __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;} |
| 3899 | __Pyx_GOTREF(__pyx_t_2); |
| 3900 | __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;} |
| 3901 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 3902 | + __Pyx_GOTREF(__pyx_t_4); |
| 3903 | __Pyx_INCREF(((PyObject *)__pyx_v_oscale)); |
| 3904 | PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_oscale)); |
| 3905 | __Pyx_GIVEREF(((PyObject *)__pyx_v_oscale)); |
| 3906 | @@ -8579,7 +8954,7 @@ |
| 3907 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 3908 | __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; |
| 3909 | __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;} |
| 3910 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 3911 | + __Pyx_GOTREF(__pyx_t_4); |
| 3912 | PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); |
| 3913 | __Pyx_GIVEREF(__pyx_t_2); |
| 3914 | __pyx_t_2 = 0; |
| 3915 | @@ -8603,9 +8978,9 @@ |
| 3916 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 3917 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 3918 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 3919 | - goto __pyx_L10; |
| 3920 | + goto __pyx_L7; |
| 3921 | } |
| 3922 | - __pyx_L10:; |
| 3923 | + __pyx_L7:; |
| 3924 | |
| 3925 | /* "mtrand.pyx":1624 |
| 3926 | * if np.any(np.less_equal(oscale, 0.0)): |
| 3927 | @@ -8615,7 +8990,7 @@ |
| 3928 | * def f(self, dfnum, dfden, size=None): |
| 3929 | */ |
| 3930 | __Pyx_XDECREF(__pyx_r); |
| 3931 | - __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;} |
| 3932 | + __pyx_t_2 = __pyx_f_6mtrand_cont2_array(__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;} |
| 3933 | __Pyx_GOTREF(__pyx_t_2); |
| 3934 | __pyx_r = __pyx_t_2; |
| 3935 | __pyx_t_2 = 0; |
| 3936 | @@ -8638,42 +9013,32 @@ |
| 3937 | return __pyx_r; |
| 3938 | } |
| 3939 | |
| 3940 | -/* "mtrand.pyx":1626 |
| 3941 | - * return cont2_array(self.internal_state, rk_gamma, size, oshape, oscale) |
| 3942 | - * |
| 3943 | - * def f(self, dfnum, dfden, size=None): # <<<<<<<<<<<<<< |
| 3944 | - * """ |
| 3945 | - * f(dfnum, dfden, size=None) |
| 3946 | - */ |
| 3947 | - |
| 3948 | -static PyObject *__pyx_pf_6mtrand_11RandomState_23f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 3949 | -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 "; |
| 3950 | -static PyObject *__pyx_pf_6mtrand_11RandomState_23f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 3951 | +/* Python wrapper */ |
| 3952 | +static PyObject *__pyx_pw_6mtrand_11RandomState_47f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 3953 | +static char __pyx_doc_6mtrand_11RandomState_46f[] = "\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 "; |
| 3954 | +static PyObject *__pyx_pw_6mtrand_11RandomState_47f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 3955 | PyObject *__pyx_v_dfnum = 0; |
| 3956 | PyObject *__pyx_v_dfden = 0; |
| 3957 | PyObject *__pyx_v_size = 0; |
| 3958 | - PyArrayObject *__pyx_v_odfnum = 0; |
| 3959 | - PyArrayObject *__pyx_v_odfden = 0; |
| 3960 | - double __pyx_v_fdfnum; |
| 3961 | - double __pyx_v_fdfden; |
| 3962 | - PyObject *__pyx_r = NULL; |
| 3963 | + PyObject *__pyx_r = 0; |
| 3964 | __Pyx_RefNannyDeclarations |
| 3965 | - int __pyx_t_1; |
| 3966 | - PyObject *__pyx_t_2 = NULL; |
| 3967 | - PyObject *__pyx_t_3 = NULL; |
| 3968 | - PyObject *__pyx_t_4 = NULL; |
| 3969 | - PyObject *__pyx_t_5 = NULL; |
| 3970 | - int __pyx_lineno = 0; |
| 3971 | - const char *__pyx_filename = NULL; |
| 3972 | - int __pyx_clineno = 0; |
| 3973 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dfnum,&__pyx_n_s__dfden,&__pyx_n_s__size,0}; |
| 3974 | - __Pyx_RefNannySetupContext("f"); |
| 3975 | + __Pyx_RefNannySetupContext("f (wrapper)", 0); |
| 3976 | { |
| 3977 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dfnum,&__pyx_n_s__dfden,&__pyx_n_s__size,0}; |
| 3978 | PyObject* values[3] = {0,0,0}; |
| 3979 | + |
| 3980 | + /* "mtrand.pyx":1626 |
| 3981 | + * return cont2_array(self.internal_state, rk_gamma, size, oshape, oscale) |
| 3982 | + * |
| 3983 | + * def f(self, dfnum, dfden, size=None): # <<<<<<<<<<<<<< |
| 3984 | + * """ |
| 3985 | + * f(dfnum, dfden, size=None) |
| 3986 | + */ |
| 3987 | values[2] = ((PyObject *)Py_None); |
| 3988 | if (unlikely(__pyx_kwds)) { |
| 3989 | Py_ssize_t kw_args; |
| 3990 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 3991 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 3992 | + switch (pos_args) { |
| 3993 | case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); |
| 3994 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 3995 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 3996 | @@ -8681,14 +9046,12 @@ |
| 3997 | default: goto __pyx_L5_argtuple_error; |
| 3998 | } |
| 3999 | kw_args = PyDict_Size(__pyx_kwds); |
| 4000 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 4001 | + switch (pos_args) { |
| 4002 | case 0: |
| 4003 | - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dfnum); |
| 4004 | - if (likely(values[0])) kw_args--; |
| 4005 | + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dfnum)) != 0)) kw_args--; |
| 4006 | else goto __pyx_L5_argtuple_error; |
| 4007 | case 1: |
| 4008 | - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dfden); |
| 4009 | - if (likely(values[1])) kw_args--; |
| 4010 | + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dfden)) != 0)) kw_args--; |
| 4011 | else { |
| 4012 | __Pyx_RaiseArgtupleInvalid("f", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1626; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 4013 | } |
| 4014 | @@ -8699,7 +9062,7 @@ |
| 4015 | } |
| 4016 | } |
| 4017 | if (unlikely(kw_args > 0)) { |
| 4018 | - 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;} |
| 4019 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "f") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1626; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 4020 | } |
| 4021 | } else { |
| 4022 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 4023 | @@ -8722,6 +9085,27 @@ |
| 4024 | __Pyx_RefNannyFinishContext(); |
| 4025 | return NULL; |
| 4026 | __pyx_L4_argument_unpacking_done:; |
| 4027 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_46f(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_dfnum, __pyx_v_dfden, __pyx_v_size); |
| 4028 | + __Pyx_RefNannyFinishContext(); |
| 4029 | + return __pyx_r; |
| 4030 | +} |
| 4031 | + |
| 4032 | +static PyObject *__pyx_pf_6mtrand_11RandomState_46f(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_dfnum, PyObject *__pyx_v_dfden, PyObject *__pyx_v_size) { |
| 4033 | + PyArrayObject *__pyx_v_odfnum = 0; |
| 4034 | + PyArrayObject *__pyx_v_odfden = 0; |
| 4035 | + double __pyx_v_fdfnum; |
| 4036 | + double __pyx_v_fdfden; |
| 4037 | + PyObject *__pyx_r = NULL; |
| 4038 | + __Pyx_RefNannyDeclarations |
| 4039 | + int __pyx_t_1; |
| 4040 | + PyObject *__pyx_t_2 = NULL; |
| 4041 | + PyObject *__pyx_t_3 = NULL; |
| 4042 | + PyObject *__pyx_t_4 = NULL; |
| 4043 | + PyObject *__pyx_t_5 = NULL; |
| 4044 | + int __pyx_lineno = 0; |
| 4045 | + const char *__pyx_filename = NULL; |
| 4046 | + int __pyx_clineno = 0; |
| 4047 | + __Pyx_RefNannySetupContext("f", 0); |
| 4048 | |
| 4049 | /* "mtrand.pyx":1710 |
| 4050 | * cdef double fdfnum, fdfden |
| 4051 | @@ -8773,9 +9157,9 @@ |
| 4052 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 4053 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 4054 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 4055 | - goto __pyx_L7; |
| 4056 | + goto __pyx_L4; |
| 4057 | } |
| 4058 | - __pyx_L7:; |
| 4059 | + __pyx_L4:; |
| 4060 | |
| 4061 | /* "mtrand.pyx":1715 |
| 4062 | * if fdfnum <= 0: |
| 4063 | @@ -8799,9 +9183,9 @@ |
| 4064 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 4065 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 4066 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1716; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 4067 | - goto __pyx_L8; |
| 4068 | + goto __pyx_L5; |
| 4069 | } |
| 4070 | - __pyx_L8:; |
| 4071 | + __pyx_L5:; |
| 4072 | |
| 4073 | /* "mtrand.pyx":1717 |
| 4074 | * if fdfden <= 0: |
| 4075 | @@ -8811,14 +9195,14 @@ |
| 4076 | * PyErr_Clear() |
| 4077 | */ |
| 4078 | __Pyx_XDECREF(__pyx_r); |
| 4079 | - __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;} |
| 4080 | + __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(__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;} |
| 4081 | __Pyx_GOTREF(__pyx_t_2); |
| 4082 | __pyx_r = __pyx_t_2; |
| 4083 | __pyx_t_2 = 0; |
| 4084 | goto __pyx_L0; |
| 4085 | - goto __pyx_L6; |
| 4086 | + goto __pyx_L3; |
| 4087 | } |
| 4088 | - __pyx_L6:; |
| 4089 | + __pyx_L3:; |
| 4090 | |
| 4091 | /* "mtrand.pyx":1719 |
| 4092 | * return cont2_array_sc(self.internal_state, rk_f, size, fdfnum, fdfden) |
| 4093 | @@ -8875,7 +9259,7 @@ |
| 4094 | __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;} |
| 4095 | __Pyx_GOTREF(__pyx_t_2); |
| 4096 | __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;} |
| 4097 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 4098 | + __Pyx_GOTREF(__pyx_t_5); |
| 4099 | __Pyx_INCREF(((PyObject *)__pyx_v_odfnum)); |
| 4100 | PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_odfnum)); |
| 4101 | __Pyx_GIVEREF(((PyObject *)__pyx_v_odfnum)); |
| 4102 | @@ -8887,7 +9271,7 @@ |
| 4103 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 4104 | __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| 4105 | __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;} |
| 4106 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 4107 | + __Pyx_GOTREF(__pyx_t_5); |
| 4108 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); |
| 4109 | __Pyx_GIVEREF(__pyx_t_2); |
| 4110 | __pyx_t_2 = 0; |
| 4111 | @@ -8911,9 +9295,9 @@ |
| 4112 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 4113 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 4114 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 4115 | - goto __pyx_L9; |
| 4116 | + goto __pyx_L6; |
| 4117 | } |
| 4118 | - __pyx_L9:; |
| 4119 | + __pyx_L6:; |
| 4120 | |
| 4121 | /* "mtrand.pyx":1725 |
| 4122 | * if np.any(np.less_equal(odfnum, 0.0)): |
| 4123 | @@ -8935,7 +9319,7 @@ |
| 4124 | __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;} |
| 4125 | __Pyx_GOTREF(__pyx_t_2); |
| 4126 | __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;} |
| 4127 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 4128 | + __Pyx_GOTREF(__pyx_t_4); |
| 4129 | __Pyx_INCREF(((PyObject *)__pyx_v_odfden)); |
| 4130 | PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_odfden)); |
| 4131 | __Pyx_GIVEREF(((PyObject *)__pyx_v_odfden)); |
| 4132 | @@ -8947,7 +9331,7 @@ |
| 4133 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 4134 | __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; |
| 4135 | __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;} |
| 4136 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 4137 | + __Pyx_GOTREF(__pyx_t_4); |
| 4138 | PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); |
| 4139 | __Pyx_GIVEREF(__pyx_t_2); |
| 4140 | __pyx_t_2 = 0; |
| 4141 | @@ -8971,9 +9355,9 @@ |
| 4142 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 4143 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 4144 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1726; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 4145 | - goto __pyx_L10; |
| 4146 | + goto __pyx_L7; |
| 4147 | } |
| 4148 | - __pyx_L10:; |
| 4149 | + __pyx_L7:; |
| 4150 | |
| 4151 | /* "mtrand.pyx":1727 |
| 4152 | * if np.any(np.less_equal(odfden, 0.0)): |
| 4153 | @@ -8983,7 +9367,7 @@ |
| 4154 | * def noncentral_f(self, dfnum, dfden, nonc, size=None): |
| 4155 | */ |
| 4156 | __Pyx_XDECREF(__pyx_r); |
| 4157 | - __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;} |
| 4158 | + __pyx_t_2 = __pyx_f_6mtrand_cont2_array(__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;} |
| 4159 | __Pyx_GOTREF(__pyx_t_2); |
| 4160 | __pyx_r = __pyx_t_2; |
| 4161 | __pyx_t_2 = 0; |
| 4162 | @@ -9006,45 +9390,33 @@ |
| 4163 | return __pyx_r; |
| 4164 | } |
| 4165 | |
| 4166 | -/* "mtrand.pyx":1729 |
| 4167 | +/* Python wrapper */ |
| 4168 | +static PyObject *__pyx_pw_6mtrand_11RandomState_49noncentral_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 4169 | +static char __pyx_doc_6mtrand_11RandomState_48noncentral_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 "; |
| 4170 | +static PyObject *__pyx_pw_6mtrand_11RandomState_49noncentral_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 4171 | + PyObject *__pyx_v_dfnum = 0; |
| 4172 | + PyObject *__pyx_v_dfden = 0; |
| 4173 | + PyObject *__pyx_v_nonc = 0; |
| 4174 | + PyObject *__pyx_v_size = 0; |
| 4175 | + PyObject *__pyx_r = 0; |
| 4176 | + __Pyx_RefNannyDeclarations |
| 4177 | + __Pyx_RefNannySetupContext("noncentral_f (wrapper)", 0); |
| 4178 | + { |
| 4179 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dfnum,&__pyx_n_s__dfden,&__pyx_n_s__nonc,&__pyx_n_s__size,0}; |
| 4180 | + PyObject* values[4] = {0,0,0,0}; |
| 4181 | + |
| 4182 | + /* "mtrand.pyx":1729 |
| 4183 | * return cont2_array(self.internal_state, rk_f, size, odfnum, odfden) |
| 4184 | * |
| 4185 | * def noncentral_f(self, dfnum, dfden, nonc, size=None): # <<<<<<<<<<<<<< |
| 4186 | * """ |
| 4187 | * noncentral_f(dfnum, dfden, nonc, size=None) |
| 4188 | */ |
| 4189 | - |
| 4190 | -static PyObject *__pyx_pf_6mtrand_11RandomState_24noncentral_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 4191 | -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 "; |
| 4192 | -static PyObject *__pyx_pf_6mtrand_11RandomState_24noncentral_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 4193 | - PyObject *__pyx_v_dfnum = 0; |
| 4194 | - PyObject *__pyx_v_dfden = 0; |
| 4195 | - PyObject *__pyx_v_nonc = 0; |
| 4196 | - PyObject *__pyx_v_size = 0; |
| 4197 | - PyArrayObject *__pyx_v_odfnum = 0; |
| 4198 | - PyArrayObject *__pyx_v_odfden = 0; |
| 4199 | - PyArrayObject *__pyx_v_ononc = 0; |
| 4200 | - double __pyx_v_fdfnum; |
| 4201 | - double __pyx_v_fdfden; |
| 4202 | - double __pyx_v_fnonc; |
| 4203 | - PyObject *__pyx_r = NULL; |
| 4204 | - __Pyx_RefNannyDeclarations |
| 4205 | - int __pyx_t_1; |
| 4206 | - PyObject *__pyx_t_2 = NULL; |
| 4207 | - PyObject *__pyx_t_3 = NULL; |
| 4208 | - PyObject *__pyx_t_4 = NULL; |
| 4209 | - PyObject *__pyx_t_5 = NULL; |
| 4210 | - int __pyx_lineno = 0; |
| 4211 | - const char *__pyx_filename = NULL; |
| 4212 | - int __pyx_clineno = 0; |
| 4213 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dfnum,&__pyx_n_s__dfden,&__pyx_n_s__nonc,&__pyx_n_s__size,0}; |
| 4214 | - __Pyx_RefNannySetupContext("noncentral_f"); |
| 4215 | - { |
| 4216 | - PyObject* values[4] = {0,0,0,0}; |
| 4217 | values[3] = ((PyObject *)Py_None); |
| 4218 | if (unlikely(__pyx_kwds)) { |
| 4219 | Py_ssize_t kw_args; |
| 4220 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 4221 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 4222 | + switch (pos_args) { |
| 4223 | case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); |
| 4224 | case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); |
| 4225 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 4226 | @@ -9053,20 +9425,17 @@ |
| 4227 | default: goto __pyx_L5_argtuple_error; |
| 4228 | } |
| 4229 | kw_args = PyDict_Size(__pyx_kwds); |
| 4230 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 4231 | + switch (pos_args) { |
| 4232 | case 0: |
| 4233 | - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dfnum); |
| 4234 | - if (likely(values[0])) kw_args--; |
| 4235 | + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dfnum)) != 0)) kw_args--; |
| 4236 | else goto __pyx_L5_argtuple_error; |
| 4237 | case 1: |
| 4238 | - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dfden); |
| 4239 | - if (likely(values[1])) kw_args--; |
| 4240 | + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dfden)) != 0)) kw_args--; |
| 4241 | else { |
| 4242 | __Pyx_RaiseArgtupleInvalid("noncentral_f", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1729; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 4243 | } |
| 4244 | case 2: |
| 4245 | - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nonc); |
| 4246 | - if (likely(values[2])) kw_args--; |
| 4247 | + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nonc)) != 0)) kw_args--; |
| 4248 | else { |
| 4249 | __Pyx_RaiseArgtupleInvalid("noncentral_f", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1729; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 4250 | } |
| 4251 | @@ -9077,7 +9446,7 @@ |
| 4252 | } |
| 4253 | } |
| 4254 | if (unlikely(kw_args > 0)) { |
| 4255 | - 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;} |
| 4256 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "noncentral_f") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1729; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 4257 | } |
| 4258 | } else { |
| 4259 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 4260 | @@ -9102,6 +9471,29 @@ |
| 4261 | __Pyx_RefNannyFinishContext(); |
| 4262 | return NULL; |
| 4263 | __pyx_L4_argument_unpacking_done:; |
| 4264 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_48noncentral_f(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_dfnum, __pyx_v_dfden, __pyx_v_nonc, __pyx_v_size); |
| 4265 | + __Pyx_RefNannyFinishContext(); |
| 4266 | + return __pyx_r; |
| 4267 | +} |
| 4268 | + |
| 4269 | +static PyObject *__pyx_pf_6mtrand_11RandomState_48noncentral_f(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_dfnum, PyObject *__pyx_v_dfden, PyObject *__pyx_v_nonc, PyObject *__pyx_v_size) { |
| 4270 | + PyArrayObject *__pyx_v_odfnum = 0; |
| 4271 | + PyArrayObject *__pyx_v_odfden = 0; |
| 4272 | + PyArrayObject *__pyx_v_ononc = 0; |
| 4273 | + double __pyx_v_fdfnum; |
| 4274 | + double __pyx_v_fdfden; |
| 4275 | + double __pyx_v_fnonc; |
| 4276 | + PyObject *__pyx_r = NULL; |
| 4277 | + __Pyx_RefNannyDeclarations |
| 4278 | + int __pyx_t_1; |
| 4279 | + PyObject *__pyx_t_2 = NULL; |
| 4280 | + PyObject *__pyx_t_3 = NULL; |
| 4281 | + PyObject *__pyx_t_4 = NULL; |
| 4282 | + PyObject *__pyx_t_5 = NULL; |
| 4283 | + int __pyx_lineno = 0; |
| 4284 | + const char *__pyx_filename = NULL; |
| 4285 | + int __pyx_clineno = 0; |
| 4286 | + __Pyx_RefNannySetupContext("noncentral_f", 0); |
| 4287 | |
| 4288 | /* "mtrand.pyx":1796 |
| 4289 | * cdef double fdfnum, fdfden, fnonc |
| 4290 | @@ -9162,9 +9554,9 @@ |
| 4291 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 4292 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 4293 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 4294 | - goto __pyx_L7; |
| 4295 | + goto __pyx_L4; |
| 4296 | } |
| 4297 | - __pyx_L7:; |
| 4298 | + __pyx_L4:; |
| 4299 | |
| 4300 | /* "mtrand.pyx":1802 |
| 4301 | * if fdfnum <= 1: |
| 4302 | @@ -9188,9 +9580,9 @@ |
| 4303 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 4304 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 4305 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 4306 | - goto __pyx_L8; |
| 4307 | + goto __pyx_L5; |
| 4308 | } |
| 4309 | - __pyx_L8:; |
| 4310 | + __pyx_L5:; |
| 4311 | |
| 4312 | /* "mtrand.pyx":1804 |
| 4313 | * if fdfden <= 0: |
| 4314 | @@ -9214,9 +9606,9 @@ |
| 4315 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 4316 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 4317 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1805; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 4318 | - goto __pyx_L9; |
| 4319 | + goto __pyx_L6; |
| 4320 | } |
| 4321 | - __pyx_L9:; |
| 4322 | + __pyx_L6:; |
| 4323 | |
| 4324 | /* "mtrand.pyx":1806 |
| 4325 | * if fnonc < 0: |
| 4326 | @@ -9234,14 +9626,14 @@ |
| 4327 | * |
| 4328 | * PyErr_Clear() |
| 4329 | */ |
| 4330 | - __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;} |
| 4331 | + __pyx_t_2 = __pyx_f_6mtrand_cont3_array_sc(__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;} |
| 4332 | __Pyx_GOTREF(__pyx_t_2); |
| 4333 | __pyx_r = __pyx_t_2; |
| 4334 | __pyx_t_2 = 0; |
| 4335 | goto __pyx_L0; |
| 4336 | - goto __pyx_L6; |
| 4337 | + goto __pyx_L3; |
| 4338 | } |
| 4339 | - __pyx_L6:; |
| 4340 | + __pyx_L3:; |
| 4341 | |
| 4342 | /* "mtrand.pyx":1809 |
| 4343 | * fdfnum, fdfden, fnonc) |
| 4344 | @@ -9311,7 +9703,7 @@ |
| 4345 | __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;} |
| 4346 | __Pyx_GOTREF(__pyx_t_2); |
| 4347 | __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;} |
| 4348 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 4349 | + __Pyx_GOTREF(__pyx_t_5); |
| 4350 | __Pyx_INCREF(((PyObject *)__pyx_v_odfnum)); |
| 4351 | PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_odfnum)); |
| 4352 | __Pyx_GIVEREF(((PyObject *)__pyx_v_odfnum)); |
| 4353 | @@ -9323,7 +9715,7 @@ |
| 4354 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 4355 | __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| 4356 | __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;} |
| 4357 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 4358 | + __Pyx_GOTREF(__pyx_t_5); |
| 4359 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); |
| 4360 | __Pyx_GIVEREF(__pyx_t_2); |
| 4361 | __pyx_t_2 = 0; |
| 4362 | @@ -9347,9 +9739,9 @@ |
| 4363 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 4364 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 4365 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 4366 | - goto __pyx_L10; |
| 4367 | + goto __pyx_L7; |
| 4368 | } |
| 4369 | - __pyx_L10:; |
| 4370 | + __pyx_L7:; |
| 4371 | |
| 4372 | /* "mtrand.pyx":1817 |
| 4373 | * if np.any(np.less_equal(odfnum, 1.0)): |
| 4374 | @@ -9371,7 +9763,7 @@ |
| 4375 | __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;} |
| 4376 | __Pyx_GOTREF(__pyx_t_2); |
| 4377 | __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;} |
| 4378 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 4379 | + __Pyx_GOTREF(__pyx_t_4); |
| 4380 | __Pyx_INCREF(((PyObject *)__pyx_v_odfden)); |
| 4381 | PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_odfden)); |
| 4382 | __Pyx_GIVEREF(((PyObject *)__pyx_v_odfden)); |
| 4383 | @@ -9383,7 +9775,7 @@ |
| 4384 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 4385 | __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; |
| 4386 | __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;} |
| 4387 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 4388 | + __Pyx_GOTREF(__pyx_t_4); |
| 4389 | PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); |
| 4390 | __Pyx_GIVEREF(__pyx_t_2); |
| 4391 | __pyx_t_2 = 0; |
| 4392 | @@ -9407,9 +9799,9 @@ |
| 4393 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 4394 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 4395 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 4396 | - goto __pyx_L11; |
| 4397 | + goto __pyx_L8; |
| 4398 | } |
| 4399 | - __pyx_L11:; |
| 4400 | + __pyx_L8:; |
| 4401 | |
| 4402 | /* "mtrand.pyx":1819 |
| 4403 | * if np.any(np.less_equal(odfden, 0.0)): |
| 4404 | @@ -9431,7 +9823,7 @@ |
| 4405 | __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;} |
| 4406 | __Pyx_GOTREF(__pyx_t_2); |
| 4407 | __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;} |
| 4408 | - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| 4409 | + __Pyx_GOTREF(__pyx_t_3); |
| 4410 | __Pyx_INCREF(((PyObject *)__pyx_v_ononc)); |
| 4411 | PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_ononc)); |
| 4412 | __Pyx_GIVEREF(((PyObject *)__pyx_v_ononc)); |
| 4413 | @@ -9443,7 +9835,7 @@ |
| 4414 | __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| 4415 | __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; |
| 4416 | __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;} |
| 4417 | - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| 4418 | + __Pyx_GOTREF(__pyx_t_3); |
| 4419 | PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); |
| 4420 | __Pyx_GIVEREF(__pyx_t_2); |
| 4421 | __pyx_t_2 = 0; |
| 4422 | @@ -9467,9 +9859,9 @@ |
| 4423 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 4424 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 4425 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 4426 | - goto __pyx_L12; |
| 4427 | + goto __pyx_L9; |
| 4428 | } |
| 4429 | - __pyx_L12:; |
| 4430 | + __pyx_L9:; |
| 4431 | |
| 4432 | /* "mtrand.pyx":1821 |
| 4433 | * if np.any(np.less(ononc, 0.0)): |
| 4434 | @@ -9487,7 +9879,7 @@ |
| 4435 | * |
| 4436 | * def chisquare(self, df, size=None): |
| 4437 | */ |
| 4438 | - __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;} |
| 4439 | + __pyx_t_2 = __pyx_f_6mtrand_cont3_array(__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;} |
| 4440 | __Pyx_GOTREF(__pyx_t_2); |
| 4441 | __pyx_r = __pyx_t_2; |
| 4442 | __pyx_t_2 = 0; |
| 4443 | @@ -9511,49 +9903,40 @@ |
| 4444 | return __pyx_r; |
| 4445 | } |
| 4446 | |
| 4447 | -/* "mtrand.pyx":1824 |
| 4448 | +/* Python wrapper */ |
| 4449 | +static PyObject *__pyx_pw_6mtrand_11RandomState_51chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 4450 | +static char __pyx_doc_6mtrand_11RandomState_50chisquare[] = "\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 "; |
| 4451 | +static PyObject *__pyx_pw_6mtrand_11RandomState_51chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 4452 | + PyObject *__pyx_v_df = 0; |
| 4453 | + PyObject *__pyx_v_size = 0; |
| 4454 | + PyObject *__pyx_r = 0; |
| 4455 | + __Pyx_RefNannyDeclarations |
| 4456 | + __Pyx_RefNannySetupContext("chisquare (wrapper)", 0); |
| 4457 | + { |
| 4458 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__df,&__pyx_n_s__size,0}; |
| 4459 | + PyObject* values[2] = {0,0}; |
| 4460 | + |
| 4461 | + /* "mtrand.pyx":1824 |
| 4462 | * odfden, ononc) |
| 4463 | * |
| 4464 | * def chisquare(self, df, size=None): # <<<<<<<<<<<<<< |
| 4465 | * """ |
| 4466 | * chisquare(df, size=None) |
| 4467 | */ |
| 4468 | - |
| 4469 | -static PyObject *__pyx_pf_6mtrand_11RandomState_25chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 4470 | -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 "; |
| 4471 | -static PyObject *__pyx_pf_6mtrand_11RandomState_25chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 4472 | - PyObject *__pyx_v_df = 0; |
| 4473 | - PyObject *__pyx_v_size = 0; |
| 4474 | - PyArrayObject *__pyx_v_odf = 0; |
| 4475 | - double __pyx_v_fdf; |
| 4476 | - PyObject *__pyx_r = NULL; |
| 4477 | - __Pyx_RefNannyDeclarations |
| 4478 | - int __pyx_t_1; |
| 4479 | - PyObject *__pyx_t_2 = NULL; |
| 4480 | - PyObject *__pyx_t_3 = NULL; |
| 4481 | - PyObject *__pyx_t_4 = NULL; |
| 4482 | - PyObject *__pyx_t_5 = NULL; |
| 4483 | - int __pyx_lineno = 0; |
| 4484 | - const char *__pyx_filename = NULL; |
| 4485 | - int __pyx_clineno = 0; |
| 4486 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__df,&__pyx_n_s__size,0}; |
| 4487 | - __Pyx_RefNannySetupContext("chisquare"); |
| 4488 | - { |
| 4489 | - PyObject* values[2] = {0,0}; |
| 4490 | values[1] = ((PyObject *)Py_None); |
| 4491 | if (unlikely(__pyx_kwds)) { |
| 4492 | Py_ssize_t kw_args; |
| 4493 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 4494 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 4495 | + switch (pos_args) { |
| 4496 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 4497 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 4498 | case 0: break; |
| 4499 | default: goto __pyx_L5_argtuple_error; |
| 4500 | } |
| 4501 | kw_args = PyDict_Size(__pyx_kwds); |
| 4502 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 4503 | + switch (pos_args) { |
| 4504 | case 0: |
| 4505 | - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__df); |
| 4506 | - if (likely(values[0])) kw_args--; |
| 4507 | + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__df)) != 0)) kw_args--; |
| 4508 | else goto __pyx_L5_argtuple_error; |
| 4509 | case 1: |
| 4510 | if (kw_args > 0) { |
| 4511 | @@ -9562,7 +9945,7 @@ |
| 4512 | } |
| 4513 | } |
| 4514 | if (unlikely(kw_args > 0)) { |
| 4515 | - 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;} |
| 4516 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "chisquare") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1824; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 4517 | } |
| 4518 | } else { |
| 4519 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 4520 | @@ -9583,6 +9966,25 @@ |
| 4521 | __Pyx_RefNannyFinishContext(); |
| 4522 | return NULL; |
| 4523 | __pyx_L4_argument_unpacking_done:; |
| 4524 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_50chisquare(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_df, __pyx_v_size); |
| 4525 | + __Pyx_RefNannyFinishContext(); |
| 4526 | + return __pyx_r; |
| 4527 | +} |
| 4528 | + |
| 4529 | +static PyObject *__pyx_pf_6mtrand_11RandomState_50chisquare(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_df, PyObject *__pyx_v_size) { |
| 4530 | + PyArrayObject *__pyx_v_odf = 0; |
| 4531 | + double __pyx_v_fdf; |
| 4532 | + PyObject *__pyx_r = NULL; |
| 4533 | + __Pyx_RefNannyDeclarations |
| 4534 | + int __pyx_t_1; |
| 4535 | + PyObject *__pyx_t_2 = NULL; |
| 4536 | + PyObject *__pyx_t_3 = NULL; |
| 4537 | + PyObject *__pyx_t_4 = NULL; |
| 4538 | + PyObject *__pyx_t_5 = NULL; |
| 4539 | + int __pyx_lineno = 0; |
| 4540 | + const char *__pyx_filename = NULL; |
| 4541 | + int __pyx_clineno = 0; |
| 4542 | + __Pyx_RefNannySetupContext("chisquare", 0); |
| 4543 | |
| 4544 | /* "mtrand.pyx":1889 |
| 4545 | * cdef double fdf |
| 4546 | @@ -9625,9 +10027,9 @@ |
| 4547 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 4548 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 4549 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 4550 | - goto __pyx_L7; |
| 4551 | + goto __pyx_L4; |
| 4552 | } |
| 4553 | - __pyx_L7:; |
| 4554 | + __pyx_L4:; |
| 4555 | |
| 4556 | /* "mtrand.pyx":1893 |
| 4557 | * if fdf <= 0: |
| 4558 | @@ -9637,14 +10039,14 @@ |
| 4559 | * PyErr_Clear() |
| 4560 | */ |
| 4561 | __Pyx_XDECREF(__pyx_r); |
| 4562 | - __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;} |
| 4563 | + __pyx_t_2 = __pyx_f_6mtrand_cont1_array_sc(__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;} |
| 4564 | __Pyx_GOTREF(__pyx_t_2); |
| 4565 | __pyx_r = __pyx_t_2; |
| 4566 | __pyx_t_2 = 0; |
| 4567 | goto __pyx_L0; |
| 4568 | - goto __pyx_L6; |
| 4569 | + goto __pyx_L3; |
| 4570 | } |
| 4571 | - __pyx_L6:; |
| 4572 | + __pyx_L3:; |
| 4573 | |
| 4574 | /* "mtrand.pyx":1895 |
| 4575 | * return cont1_array_sc(self.internal_state, rk_chisquare, size, fdf) |
| 4576 | @@ -9688,7 +10090,7 @@ |
| 4577 | __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;} |
| 4578 | __Pyx_GOTREF(__pyx_t_2); |
| 4579 | __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;} |
| 4580 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 4581 | + __Pyx_GOTREF(__pyx_t_5); |
| 4582 | __Pyx_INCREF(((PyObject *)__pyx_v_odf)); |
| 4583 | PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_odf)); |
| 4584 | __Pyx_GIVEREF(((PyObject *)__pyx_v_odf)); |
| 4585 | @@ -9700,7 +10102,7 @@ |
| 4586 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 4587 | __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| 4588 | __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;} |
| 4589 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 4590 | + __Pyx_GOTREF(__pyx_t_5); |
| 4591 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); |
| 4592 | __Pyx_GIVEREF(__pyx_t_2); |
| 4593 | __pyx_t_2 = 0; |
| 4594 | @@ -9724,9 +10126,9 @@ |
| 4595 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 4596 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 4597 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1899; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 4598 | - goto __pyx_L8; |
| 4599 | + goto __pyx_L5; |
| 4600 | } |
| 4601 | - __pyx_L8:; |
| 4602 | + __pyx_L5:; |
| 4603 | |
| 4604 | /* "mtrand.pyx":1900 |
| 4605 | * if np.any(np.less_equal(odf, 0.0)): |
| 4606 | @@ -9736,7 +10138,7 @@ |
| 4607 | * def noncentral_chisquare(self, df, nonc, size=None): |
| 4608 | */ |
| 4609 | __Pyx_XDECREF(__pyx_r); |
| 4610 | - __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;} |
| 4611 | + __pyx_t_2 = __pyx_f_6mtrand_cont1_array(__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;} |
| 4612 | __Pyx_GOTREF(__pyx_t_2); |
| 4613 | __pyx_r = __pyx_t_2; |
| 4614 | __pyx_t_2 = 0; |
| 4615 | @@ -9758,42 +10160,32 @@ |
| 4616 | return __pyx_r; |
| 4617 | } |
| 4618 | |
| 4619 | -/* "mtrand.pyx":1902 |
| 4620 | - * return cont1_array(self.internal_state, rk_chisquare, size, odf) |
| 4621 | - * |
| 4622 | - * def noncentral_chisquare(self, df, nonc, size=None): # <<<<<<<<<<<<<< |
| 4623 | - * """ |
| 4624 | - * noncentral_chisquare(df, nonc, size=None) |
| 4625 | - */ |
| 4626 | - |
| 4627 | -static PyObject *__pyx_pf_6mtrand_11RandomState_26noncentral_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 4628 | -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 "; |
| 4629 | -static PyObject *__pyx_pf_6mtrand_11RandomState_26noncentral_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 4630 | +/* Python wrapper */ |
| 4631 | +static PyObject *__pyx_pw_6mtrand_11RandomState_53noncentral_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 4632 | +static char __pyx_doc_6mtrand_11RandomState_52noncentral_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 "; |
| 4633 | +static PyObject *__pyx_pw_6mtrand_11RandomState_53noncentral_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 4634 | PyObject *__pyx_v_df = 0; |
| 4635 | PyObject *__pyx_v_nonc = 0; |
| 4636 | PyObject *__pyx_v_size = 0; |
| 4637 | - PyArrayObject *__pyx_v_odf = 0; |
| 4638 | - PyArrayObject *__pyx_v_ononc = 0; |
| 4639 | - double __pyx_v_fdf; |
| 4640 | - double __pyx_v_fnonc; |
| 4641 | - PyObject *__pyx_r = NULL; |
| 4642 | + PyObject *__pyx_r = 0; |
| 4643 | __Pyx_RefNannyDeclarations |
| 4644 | - int __pyx_t_1; |
| 4645 | - PyObject *__pyx_t_2 = NULL; |
| 4646 | - PyObject *__pyx_t_3 = NULL; |
| 4647 | - PyObject *__pyx_t_4 = NULL; |
| 4648 | - PyObject *__pyx_t_5 = NULL; |
| 4649 | - int __pyx_lineno = 0; |
| 4650 | - const char *__pyx_filename = NULL; |
| 4651 | - int __pyx_clineno = 0; |
| 4652 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__df,&__pyx_n_s__nonc,&__pyx_n_s__size,0}; |
| 4653 | - __Pyx_RefNannySetupContext("noncentral_chisquare"); |
| 4654 | + __Pyx_RefNannySetupContext("noncentral_chisquare (wrapper)", 0); |
| 4655 | { |
| 4656 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__df,&__pyx_n_s__nonc,&__pyx_n_s__size,0}; |
| 4657 | PyObject* values[3] = {0,0,0}; |
| 4658 | + |
| 4659 | + /* "mtrand.pyx":1902 |
| 4660 | + * return cont1_array(self.internal_state, rk_chisquare, size, odf) |
| 4661 | + * |
| 4662 | + * def noncentral_chisquare(self, df, nonc, size=None): # <<<<<<<<<<<<<< |
| 4663 | + * """ |
| 4664 | + * noncentral_chisquare(df, nonc, size=None) |
| 4665 | + */ |
| 4666 | values[2] = ((PyObject *)Py_None); |
| 4667 | if (unlikely(__pyx_kwds)) { |
| 4668 | Py_ssize_t kw_args; |
| 4669 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 4670 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 4671 | + switch (pos_args) { |
| 4672 | case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); |
| 4673 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 4674 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 4675 | @@ -9801,14 +10193,12 @@ |
| 4676 | default: goto __pyx_L5_argtuple_error; |
| 4677 | } |
| 4678 | kw_args = PyDict_Size(__pyx_kwds); |
| 4679 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 4680 | + switch (pos_args) { |
| 4681 | case 0: |
| 4682 | - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__df); |
| 4683 | - if (likely(values[0])) kw_args--; |
| 4684 | + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__df)) != 0)) kw_args--; |
| 4685 | else goto __pyx_L5_argtuple_error; |
| 4686 | case 1: |
| 4687 | - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nonc); |
| 4688 | - if (likely(values[1])) kw_args--; |
| 4689 | + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nonc)) != 0)) kw_args--; |
| 4690 | else { |
| 4691 | __Pyx_RaiseArgtupleInvalid("noncentral_chisquare", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1902; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 4692 | } |
| 4693 | @@ -9819,7 +10209,7 @@ |
| 4694 | } |
| 4695 | } |
| 4696 | if (unlikely(kw_args > 0)) { |
| 4697 | - 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;} |
| 4698 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "noncentral_chisquare") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1902; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 4699 | } |
| 4700 | } else { |
| 4701 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 4702 | @@ -9842,6 +10232,27 @@ |
| 4703 | __Pyx_RefNannyFinishContext(); |
| 4704 | return NULL; |
| 4705 | __pyx_L4_argument_unpacking_done:; |
| 4706 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_52noncentral_chisquare(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_df, __pyx_v_nonc, __pyx_v_size); |
| 4707 | + __Pyx_RefNannyFinishContext(); |
| 4708 | + return __pyx_r; |
| 4709 | +} |
| 4710 | + |
| 4711 | +static PyObject *__pyx_pf_6mtrand_11RandomState_52noncentral_chisquare(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_df, PyObject *__pyx_v_nonc, PyObject *__pyx_v_size) { |
| 4712 | + PyArrayObject *__pyx_v_odf = 0; |
| 4713 | + PyArrayObject *__pyx_v_ononc = 0; |
| 4714 | + double __pyx_v_fdf; |
| 4715 | + double __pyx_v_fnonc; |
| 4716 | + PyObject *__pyx_r = NULL; |
| 4717 | + __Pyx_RefNannyDeclarations |
| 4718 | + int __pyx_t_1; |
| 4719 | + PyObject *__pyx_t_2 = NULL; |
| 4720 | + PyObject *__pyx_t_3 = NULL; |
| 4721 | + PyObject *__pyx_t_4 = NULL; |
| 4722 | + PyObject *__pyx_t_5 = NULL; |
| 4723 | + int __pyx_lineno = 0; |
| 4724 | + const char *__pyx_filename = NULL; |
| 4725 | + int __pyx_clineno = 0; |
| 4726 | + __Pyx_RefNannySetupContext("noncentral_chisquare", 0); |
| 4727 | |
| 4728 | /* "mtrand.pyx":1973 |
| 4729 | * cdef ndarray odf, ononc |
| 4730 | @@ -9893,9 +10304,9 @@ |
| 4731 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 4732 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 4733 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 4734 | - goto __pyx_L7; |
| 4735 | + goto __pyx_L4; |
| 4736 | } |
| 4737 | - __pyx_L7:; |
| 4738 | + __pyx_L4:; |
| 4739 | |
| 4740 | /* "mtrand.pyx":1978 |
| 4741 | * if fdf <= 1: |
| 4742 | @@ -9919,9 +10330,9 @@ |
| 4743 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 4744 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 4745 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 4746 | - goto __pyx_L8; |
| 4747 | + goto __pyx_L5; |
| 4748 | } |
| 4749 | - __pyx_L8:; |
| 4750 | + __pyx_L5:; |
| 4751 | |
| 4752 | /* "mtrand.pyx":1980 |
| 4753 | * if fnonc <= 0: |
| 4754 | @@ -9939,14 +10350,14 @@ |
| 4755 | * |
| 4756 | * PyErr_Clear() |
| 4757 | */ |
| 4758 | - __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;} |
| 4759 | + __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(__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;} |
| 4760 | __Pyx_GOTREF(__pyx_t_2); |
| 4761 | __pyx_r = __pyx_t_2; |
| 4762 | __pyx_t_2 = 0; |
| 4763 | goto __pyx_L0; |
| 4764 | - goto __pyx_L6; |
| 4765 | + goto __pyx_L3; |
| 4766 | } |
| 4767 | - __pyx_L6:; |
| 4768 | + __pyx_L3:; |
| 4769 | |
| 4770 | /* "mtrand.pyx":1983 |
| 4771 | * size, fdf, fnonc) |
| 4772 | @@ -10003,7 +10414,7 @@ |
| 4773 | __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;} |
| 4774 | __Pyx_GOTREF(__pyx_t_2); |
| 4775 | __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;} |
| 4776 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 4777 | + __Pyx_GOTREF(__pyx_t_5); |
| 4778 | __Pyx_INCREF(((PyObject *)__pyx_v_odf)); |
| 4779 | PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_odf)); |
| 4780 | __Pyx_GIVEREF(((PyObject *)__pyx_v_odf)); |
| 4781 | @@ -10015,7 +10426,7 @@ |
| 4782 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 4783 | __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| 4784 | __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;} |
| 4785 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 4786 | + __Pyx_GOTREF(__pyx_t_5); |
| 4787 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); |
| 4788 | __Pyx_GIVEREF(__pyx_t_2); |
| 4789 | __pyx_t_2 = 0; |
| 4790 | @@ -10039,9 +10450,9 @@ |
| 4791 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 4792 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 4793 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 4794 | - goto __pyx_L9; |
| 4795 | + goto __pyx_L6; |
| 4796 | } |
| 4797 | - __pyx_L9:; |
| 4798 | + __pyx_L6:; |
| 4799 | |
| 4800 | /* "mtrand.pyx":1989 |
| 4801 | * if np.any(np.less_equal(odf, 0.0)): |
| 4802 | @@ -10063,7 +10474,7 @@ |
| 4803 | __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;} |
| 4804 | __Pyx_GOTREF(__pyx_t_2); |
| 4805 | __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;} |
| 4806 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 4807 | + __Pyx_GOTREF(__pyx_t_4); |
| 4808 | __Pyx_INCREF(((PyObject *)__pyx_v_ononc)); |
| 4809 | PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_ononc)); |
| 4810 | __Pyx_GIVEREF(((PyObject *)__pyx_v_ononc)); |
| 4811 | @@ -10075,7 +10486,7 @@ |
| 4812 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 4813 | __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; |
| 4814 | __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;} |
| 4815 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 4816 | + __Pyx_GOTREF(__pyx_t_4); |
| 4817 | PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); |
| 4818 | __Pyx_GIVEREF(__pyx_t_2); |
| 4819 | __pyx_t_2 = 0; |
| 4820 | @@ -10099,9 +10510,9 @@ |
| 4821 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 4822 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 4823 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 4824 | - goto __pyx_L10; |
| 4825 | + goto __pyx_L7; |
| 4826 | } |
| 4827 | - __pyx_L10:; |
| 4828 | + __pyx_L7:; |
| 4829 | |
| 4830 | /* "mtrand.pyx":1991 |
| 4831 | * if np.any(np.less_equal(ononc, 0.0)): |
| 4832 | @@ -10119,7 +10530,7 @@ |
| 4833 | * |
| 4834 | * def standard_cauchy(self, size=None): |
| 4835 | */ |
| 4836 | - __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;} |
| 4837 | + __pyx_t_2 = __pyx_f_6mtrand_cont2_array(__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;} |
| 4838 | __Pyx_GOTREF(__pyx_t_2); |
| 4839 | __pyx_r = __pyx_t_2; |
| 4840 | __pyx_t_2 = 0; |
| 4841 | @@ -10142,38 +10553,36 @@ |
| 4842 | return __pyx_r; |
| 4843 | } |
| 4844 | |
| 4845 | -/* "mtrand.pyx":1994 |
| 4846 | +/* Python wrapper */ |
| 4847 | +static PyObject *__pyx_pw_6mtrand_11RandomState_55standard_cauchy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 4848 | +static char __pyx_doc_6mtrand_11RandomState_54standard_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 "; |
| 4849 | +static PyObject *__pyx_pw_6mtrand_11RandomState_55standard_cauchy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 4850 | + PyObject *__pyx_v_size = 0; |
| 4851 | + PyObject *__pyx_r = 0; |
| 4852 | + __Pyx_RefNannyDeclarations |
| 4853 | + __Pyx_RefNannySetupContext("standard_cauchy (wrapper)", 0); |
| 4854 | + { |
| 4855 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,0}; |
| 4856 | + PyObject* values[1] = {0}; |
| 4857 | + |
| 4858 | + /* "mtrand.pyx":1994 |
| 4859 | * odf, ononc) |
| 4860 | * |
| 4861 | * def standard_cauchy(self, size=None): # <<<<<<<<<<<<<< |
| 4862 | * """ |
| 4863 | * standard_cauchy(size=None) |
| 4864 | */ |
| 4865 | - |
| 4866 | -static PyObject *__pyx_pf_6mtrand_11RandomState_27standard_cauchy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 4867 | -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 "; |
| 4868 | -static PyObject *__pyx_pf_6mtrand_11RandomState_27standard_cauchy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 4869 | - PyObject *__pyx_v_size = 0; |
| 4870 | - PyObject *__pyx_r = NULL; |
| 4871 | - __Pyx_RefNannyDeclarations |
| 4872 | - PyObject *__pyx_t_1 = NULL; |
| 4873 | - int __pyx_lineno = 0; |
| 4874 | - const char *__pyx_filename = NULL; |
| 4875 | - int __pyx_clineno = 0; |
| 4876 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,0}; |
| 4877 | - __Pyx_RefNannySetupContext("standard_cauchy"); |
| 4878 | - { |
| 4879 | - PyObject* values[1] = {0}; |
| 4880 | values[0] = ((PyObject *)Py_None); |
| 4881 | if (unlikely(__pyx_kwds)) { |
| 4882 | Py_ssize_t kw_args; |
| 4883 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 4884 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 4885 | + switch (pos_args) { |
| 4886 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 4887 | case 0: break; |
| 4888 | default: goto __pyx_L5_argtuple_error; |
| 4889 | } |
| 4890 | kw_args = PyDict_Size(__pyx_kwds); |
| 4891 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 4892 | + switch (pos_args) { |
| 4893 | case 0: |
| 4894 | if (kw_args > 0) { |
| 4895 | PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size); |
| 4896 | @@ -10181,7 +10590,7 @@ |
| 4897 | } |
| 4898 | } |
| 4899 | if (unlikely(kw_args > 0)) { |
| 4900 | - 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;} |
| 4901 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "standard_cauchy") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 4902 | } |
| 4903 | } else { |
| 4904 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 4905 | @@ -10200,6 +10609,19 @@ |
| 4906 | __Pyx_RefNannyFinishContext(); |
| 4907 | return NULL; |
| 4908 | __pyx_L4_argument_unpacking_done:; |
| 4909 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_54standard_cauchy(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_size); |
| 4910 | + __Pyx_RefNannyFinishContext(); |
| 4911 | + return __pyx_r; |
| 4912 | +} |
| 4913 | + |
| 4914 | +static PyObject *__pyx_pf_6mtrand_11RandomState_54standard_cauchy(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_size) { |
| 4915 | + PyObject *__pyx_r = NULL; |
| 4916 | + __Pyx_RefNannyDeclarations |
| 4917 | + PyObject *__pyx_t_1 = NULL; |
| 4918 | + int __pyx_lineno = 0; |
| 4919 | + const char *__pyx_filename = NULL; |
| 4920 | + int __pyx_clineno = 0; |
| 4921 | + __Pyx_RefNannySetupContext("standard_cauchy", 0); |
| 4922 | |
| 4923 | /* "mtrand.pyx":2053 |
| 4924 | * |
| 4925 | @@ -10209,7 +10631,7 @@ |
| 4926 | * def standard_t(self, df, size=None): |
| 4927 | */ |
| 4928 | __Pyx_XDECREF(__pyx_r); |
| 4929 | - __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;} |
| 4930 | + __pyx_t_1 = __pyx_f_6mtrand_cont0_array(__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;} |
| 4931 | __Pyx_GOTREF(__pyx_t_1); |
| 4932 | __pyx_r = __pyx_t_1; |
| 4933 | __pyx_t_1 = 0; |
| 4934 | @@ -10227,49 +10649,40 @@ |
| 4935 | return __pyx_r; |
| 4936 | } |
| 4937 | |
| 4938 | -/* "mtrand.pyx":2055 |
| 4939 | +/* Python wrapper */ |
| 4940 | +static PyObject *__pyx_pw_6mtrand_11RandomState_57standard_t(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 4941 | +static char __pyx_doc_6mtrand_11RandomState_56standard_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 "; |
| 4942 | +static PyObject *__pyx_pw_6mtrand_11RandomState_57standard_t(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 4943 | + PyObject *__pyx_v_df = 0; |
| 4944 | + PyObject *__pyx_v_size = 0; |
| 4945 | + PyObject *__pyx_r = 0; |
| 4946 | + __Pyx_RefNannyDeclarations |
| 4947 | + __Pyx_RefNannySetupContext("standard_t (wrapper)", 0); |
| 4948 | + { |
| 4949 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__df,&__pyx_n_s__size,0}; |
| 4950 | + PyObject* values[2] = {0,0}; |
| 4951 | + |
| 4952 | + /* "mtrand.pyx":2055 |
| 4953 | * return cont0_array(self.internal_state, rk_standard_cauchy, size) |
| 4954 | * |
| 4955 | * def standard_t(self, df, size=None): # <<<<<<<<<<<<<< |
| 4956 | * """ |
| 4957 | * standard_t(df, size=None) |
| 4958 | */ |
| 4959 | - |
| 4960 | -static PyObject *__pyx_pf_6mtrand_11RandomState_28standard_t(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 4961 | -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 "; |
| 4962 | -static PyObject *__pyx_pf_6mtrand_11RandomState_28standard_t(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 4963 | - PyObject *__pyx_v_df = 0; |
| 4964 | - PyObject *__pyx_v_size = 0; |
| 4965 | - PyArrayObject *__pyx_v_odf = 0; |
| 4966 | - double __pyx_v_fdf; |
| 4967 | - PyObject *__pyx_r = NULL; |
| 4968 | - __Pyx_RefNannyDeclarations |
| 4969 | - int __pyx_t_1; |
| 4970 | - PyObject *__pyx_t_2 = NULL; |
| 4971 | - PyObject *__pyx_t_3 = NULL; |
| 4972 | - PyObject *__pyx_t_4 = NULL; |
| 4973 | - PyObject *__pyx_t_5 = NULL; |
| 4974 | - int __pyx_lineno = 0; |
| 4975 | - const char *__pyx_filename = NULL; |
| 4976 | - int __pyx_clineno = 0; |
| 4977 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__df,&__pyx_n_s__size,0}; |
| 4978 | - __Pyx_RefNannySetupContext("standard_t"); |
| 4979 | - { |
| 4980 | - PyObject* values[2] = {0,0}; |
| 4981 | values[1] = ((PyObject *)Py_None); |
| 4982 | if (unlikely(__pyx_kwds)) { |
| 4983 | Py_ssize_t kw_args; |
| 4984 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 4985 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 4986 | + switch (pos_args) { |
| 4987 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 4988 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 4989 | case 0: break; |
| 4990 | default: goto __pyx_L5_argtuple_error; |
| 4991 | } |
| 4992 | kw_args = PyDict_Size(__pyx_kwds); |
| 4993 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 4994 | + switch (pos_args) { |
| 4995 | case 0: |
| 4996 | - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__df); |
| 4997 | - if (likely(values[0])) kw_args--; |
| 4998 | + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__df)) != 0)) kw_args--; |
| 4999 | else goto __pyx_L5_argtuple_error; |
| 5000 | case 1: |
| 5001 | if (kw_args > 0) { |
| 5002 | @@ -10278,7 +10691,7 @@ |
| 5003 | } |
| 5004 | } |
| 5005 | if (unlikely(kw_args > 0)) { |
| 5006 | - 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;} |
| 5007 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "standard_t") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 5008 | } |
| 5009 | } else { |
| 5010 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 5011 | @@ -10299,6 +10712,25 @@ |
| 5012 | __Pyx_RefNannyFinishContext(); |
| 5013 | return NULL; |
| 5014 | __pyx_L4_argument_unpacking_done:; |
| 5015 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_56standard_t(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_df, __pyx_v_size); |
| 5016 | + __Pyx_RefNannyFinishContext(); |
| 5017 | + return __pyx_r; |
| 5018 | +} |
| 5019 | + |
| 5020 | +static PyObject *__pyx_pf_6mtrand_11RandomState_56standard_t(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_df, PyObject *__pyx_v_size) { |
| 5021 | + PyArrayObject *__pyx_v_odf = 0; |
| 5022 | + double __pyx_v_fdf; |
| 5023 | + PyObject *__pyx_r = NULL; |
| 5024 | + __Pyx_RefNannyDeclarations |
| 5025 | + int __pyx_t_1; |
| 5026 | + PyObject *__pyx_t_2 = NULL; |
| 5027 | + PyObject *__pyx_t_3 = NULL; |
| 5028 | + PyObject *__pyx_t_4 = NULL; |
| 5029 | + PyObject *__pyx_t_5 = NULL; |
| 5030 | + int __pyx_lineno = 0; |
| 5031 | + const char *__pyx_filename = NULL; |
| 5032 | + int __pyx_clineno = 0; |
| 5033 | + __Pyx_RefNannySetupContext("standard_t", 0); |
| 5034 | |
| 5035 | /* "mtrand.pyx":2143 |
| 5036 | * cdef double fdf |
| 5037 | @@ -10341,9 +10773,9 @@ |
| 5038 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 5039 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 5040 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 5041 | - goto __pyx_L7; |
| 5042 | + goto __pyx_L4; |
| 5043 | } |
| 5044 | - __pyx_L7:; |
| 5045 | + __pyx_L4:; |
| 5046 | |
| 5047 | /* "mtrand.pyx":2147 |
| 5048 | * if fdf <= 0: |
| 5049 | @@ -10353,14 +10785,14 @@ |
| 5050 | * PyErr_Clear() |
| 5051 | */ |
| 5052 | __Pyx_XDECREF(__pyx_r); |
| 5053 | - __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;} |
| 5054 | + __pyx_t_2 = __pyx_f_6mtrand_cont1_array_sc(__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;} |
| 5055 | __Pyx_GOTREF(__pyx_t_2); |
| 5056 | __pyx_r = __pyx_t_2; |
| 5057 | __pyx_t_2 = 0; |
| 5058 | goto __pyx_L0; |
| 5059 | - goto __pyx_L6; |
| 5060 | + goto __pyx_L3; |
| 5061 | } |
| 5062 | - __pyx_L6:; |
| 5063 | + __pyx_L3:; |
| 5064 | |
| 5065 | /* "mtrand.pyx":2149 |
| 5066 | * return cont1_array_sc(self.internal_state, rk_standard_t, size, fdf) |
| 5067 | @@ -10404,7 +10836,7 @@ |
| 5068 | __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;} |
| 5069 | __Pyx_GOTREF(__pyx_t_2); |
| 5070 | __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;} |
| 5071 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 5072 | + __Pyx_GOTREF(__pyx_t_5); |
| 5073 | __Pyx_INCREF(((PyObject *)__pyx_v_odf)); |
| 5074 | PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_odf)); |
| 5075 | __Pyx_GIVEREF(((PyObject *)__pyx_v_odf)); |
| 5076 | @@ -10416,7 +10848,7 @@ |
| 5077 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 5078 | __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| 5079 | __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;} |
| 5080 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 5081 | + __Pyx_GOTREF(__pyx_t_5); |
| 5082 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); |
| 5083 | __Pyx_GIVEREF(__pyx_t_2); |
| 5084 | __pyx_t_2 = 0; |
| 5085 | @@ -10440,9 +10872,9 @@ |
| 5086 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 5087 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 5088 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 5089 | - goto __pyx_L8; |
| 5090 | + goto __pyx_L5; |
| 5091 | } |
| 5092 | - __pyx_L8:; |
| 5093 | + __pyx_L5:; |
| 5094 | |
| 5095 | /* "mtrand.pyx":2154 |
| 5096 | * if np.any(np.less_equal(odf, 0.0)): |
| 5097 | @@ -10452,7 +10884,7 @@ |
| 5098 | * def vonmises(self, mu, kappa, size=None): |
| 5099 | */ |
| 5100 | __Pyx_XDECREF(__pyx_r); |
| 5101 | - __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;} |
| 5102 | + __pyx_t_2 = __pyx_f_6mtrand_cont1_array(__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;} |
| 5103 | __Pyx_GOTREF(__pyx_t_2); |
| 5104 | __pyx_r = __pyx_t_2; |
| 5105 | __pyx_t_2 = 0; |
| 5106 | @@ -10474,42 +10906,32 @@ |
| 5107 | return __pyx_r; |
| 5108 | } |
| 5109 | |
| 5110 | -/* "mtrand.pyx":2156 |
| 5111 | - * return cont1_array(self.internal_state, rk_standard_t, size, odf) |
| 5112 | - * |
| 5113 | - * def vonmises(self, mu, kappa, size=None): # <<<<<<<<<<<<<< |
| 5114 | - * """ |
| 5115 | - * vonmises(mu, kappa, size=None) |
| 5116 | - */ |
| 5117 | - |
| 5118 | -static PyObject *__pyx_pf_6mtrand_11RandomState_29vonmises(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 5119 | -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 "; |
| 5120 | -static PyObject *__pyx_pf_6mtrand_11RandomState_29vonmises(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 5121 | +/* Python wrapper */ |
| 5122 | +static PyObject *__pyx_pw_6mtrand_11RandomState_59vonmises(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 5123 | +static char __pyx_doc_6mtrand_11RandomState_58vonmises[] = "\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 "; |
| 5124 | +static PyObject *__pyx_pw_6mtrand_11RandomState_59vonmises(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 5125 | PyObject *__pyx_v_mu = 0; |
| 5126 | PyObject *__pyx_v_kappa = 0; |
| 5127 | PyObject *__pyx_v_size = 0; |
| 5128 | - PyArrayObject *__pyx_v_omu = 0; |
| 5129 | - PyArrayObject *__pyx_v_okappa = 0; |
| 5130 | - double __pyx_v_fmu; |
| 5131 | - double __pyx_v_fkappa; |
| 5132 | - PyObject *__pyx_r = NULL; |
| 5133 | + PyObject *__pyx_r = 0; |
| 5134 | __Pyx_RefNannyDeclarations |
| 5135 | - int __pyx_t_1; |
| 5136 | - PyObject *__pyx_t_2 = NULL; |
| 5137 | - PyObject *__pyx_t_3 = NULL; |
| 5138 | - PyObject *__pyx_t_4 = NULL; |
| 5139 | - PyObject *__pyx_t_5 = NULL; |
| 5140 | - int __pyx_lineno = 0; |
| 5141 | - const char *__pyx_filename = NULL; |
| 5142 | - int __pyx_clineno = 0; |
| 5143 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__mu,&__pyx_n_s__kappa,&__pyx_n_s__size,0}; |
| 5144 | - __Pyx_RefNannySetupContext("vonmises"); |
| 5145 | + __Pyx_RefNannySetupContext("vonmises (wrapper)", 0); |
| 5146 | { |
| 5147 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__mu,&__pyx_n_s__kappa,&__pyx_n_s__size,0}; |
| 5148 | PyObject* values[3] = {0,0,0}; |
| 5149 | + |
| 5150 | + /* "mtrand.pyx":2156 |
| 5151 | + * return cont1_array(self.internal_state, rk_standard_t, size, odf) |
| 5152 | + * |
| 5153 | + * def vonmises(self, mu, kappa, size=None): # <<<<<<<<<<<<<< |
| 5154 | + * """ |
| 5155 | + * vonmises(mu, kappa, size=None) |
| 5156 | + */ |
| 5157 | values[2] = ((PyObject *)Py_None); |
| 5158 | if (unlikely(__pyx_kwds)) { |
| 5159 | Py_ssize_t kw_args; |
| 5160 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 5161 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 5162 | + switch (pos_args) { |
| 5163 | case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); |
| 5164 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 5165 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 5166 | @@ -10517,14 +10939,12 @@ |
| 5167 | default: goto __pyx_L5_argtuple_error; |
| 5168 | } |
| 5169 | kw_args = PyDict_Size(__pyx_kwds); |
| 5170 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 5171 | + switch (pos_args) { |
| 5172 | case 0: |
| 5173 | - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mu); |
| 5174 | - if (likely(values[0])) kw_args--; |
| 5175 | + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mu)) != 0)) kw_args--; |
| 5176 | else goto __pyx_L5_argtuple_error; |
| 5177 | case 1: |
| 5178 | - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__kappa); |
| 5179 | - if (likely(values[1])) kw_args--; |
| 5180 | + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__kappa)) != 0)) kw_args--; |
| 5181 | else { |
| 5182 | __Pyx_RaiseArgtupleInvalid("vonmises", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 5183 | } |
| 5184 | @@ -10535,7 +10955,7 @@ |
| 5185 | } |
| 5186 | } |
| 5187 | if (unlikely(kw_args > 0)) { |
| 5188 | - 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;} |
| 5189 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vonmises") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 5190 | } |
| 5191 | } else { |
| 5192 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 5193 | @@ -10558,6 +10978,27 @@ |
| 5194 | __Pyx_RefNannyFinishContext(); |
| 5195 | return NULL; |
| 5196 | __pyx_L4_argument_unpacking_done:; |
| 5197 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_58vonmises(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_mu, __pyx_v_kappa, __pyx_v_size); |
| 5198 | + __Pyx_RefNannyFinishContext(); |
| 5199 | + return __pyx_r; |
| 5200 | +} |
| 5201 | + |
| 5202 | +static PyObject *__pyx_pf_6mtrand_11RandomState_58vonmises(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_mu, PyObject *__pyx_v_kappa, PyObject *__pyx_v_size) { |
| 5203 | + PyArrayObject *__pyx_v_omu = 0; |
| 5204 | + PyArrayObject *__pyx_v_okappa = 0; |
| 5205 | + double __pyx_v_fmu; |
| 5206 | + double __pyx_v_fkappa; |
| 5207 | + PyObject *__pyx_r = NULL; |
| 5208 | + __Pyx_RefNannyDeclarations |
| 5209 | + int __pyx_t_1; |
| 5210 | + PyObject *__pyx_t_2 = NULL; |
| 5211 | + PyObject *__pyx_t_3 = NULL; |
| 5212 | + PyObject *__pyx_t_4 = NULL; |
| 5213 | + PyObject *__pyx_t_5 = NULL; |
| 5214 | + int __pyx_lineno = 0; |
| 5215 | + const char *__pyx_filename = NULL; |
| 5216 | + int __pyx_clineno = 0; |
| 5217 | + __Pyx_RefNannySetupContext("vonmises", 0); |
| 5218 | |
| 5219 | /* "mtrand.pyx":2235 |
| 5220 | * cdef double fmu, fkappa |
| 5221 | @@ -10609,9 +11050,9 @@ |
| 5222 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 5223 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 5224 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 5225 | - goto __pyx_L7; |
| 5226 | + goto __pyx_L4; |
| 5227 | } |
| 5228 | - __pyx_L7:; |
| 5229 | + __pyx_L4:; |
| 5230 | |
| 5231 | /* "mtrand.pyx":2240 |
| 5232 | * if fkappa < 0: |
| 5233 | @@ -10621,14 +11062,14 @@ |
| 5234 | * PyErr_Clear() |
| 5235 | */ |
| 5236 | __Pyx_XDECREF(__pyx_r); |
| 5237 | - __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;} |
| 5238 | + __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(__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;} |
| 5239 | __Pyx_GOTREF(__pyx_t_2); |
| 5240 | __pyx_r = __pyx_t_2; |
| 5241 | __pyx_t_2 = 0; |
| 5242 | goto __pyx_L0; |
| 5243 | - goto __pyx_L6; |
| 5244 | + goto __pyx_L3; |
| 5245 | } |
| 5246 | - __pyx_L6:; |
| 5247 | + __pyx_L3:; |
| 5248 | |
| 5249 | /* "mtrand.pyx":2242 |
| 5250 | * return cont2_array_sc(self.internal_state, rk_vonmises, size, fmu, fkappa) |
| 5251 | @@ -10685,7 +11126,7 @@ |
| 5252 | __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;} |
| 5253 | __Pyx_GOTREF(__pyx_t_2); |
| 5254 | __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;} |
| 5255 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 5256 | + __Pyx_GOTREF(__pyx_t_5); |
| 5257 | __Pyx_INCREF(((PyObject *)__pyx_v_okappa)); |
| 5258 | PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_okappa)); |
| 5259 | __Pyx_GIVEREF(((PyObject *)__pyx_v_okappa)); |
| 5260 | @@ -10697,7 +11138,7 @@ |
| 5261 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 5262 | __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| 5263 | __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;} |
| 5264 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 5265 | + __Pyx_GOTREF(__pyx_t_5); |
| 5266 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); |
| 5267 | __Pyx_GIVEREF(__pyx_t_2); |
| 5268 | __pyx_t_2 = 0; |
| 5269 | @@ -10721,9 +11162,9 @@ |
| 5270 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 5271 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 5272 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 5273 | - goto __pyx_L8; |
| 5274 | + goto __pyx_L5; |
| 5275 | } |
| 5276 | - __pyx_L8:; |
| 5277 | + __pyx_L5:; |
| 5278 | |
| 5279 | /* "mtrand.pyx":2248 |
| 5280 | * if np.any(np.less(okappa, 0.0)): |
| 5281 | @@ -10733,7 +11174,7 @@ |
| 5282 | * def pareto(self, a, size=None): |
| 5283 | */ |
| 5284 | __Pyx_XDECREF(__pyx_r); |
| 5285 | - __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;} |
| 5286 | + __pyx_t_2 = __pyx_f_6mtrand_cont2_array(__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;} |
| 5287 | __Pyx_GOTREF(__pyx_t_2); |
| 5288 | __pyx_r = __pyx_t_2; |
| 5289 | __pyx_t_2 = 0; |
| 5290 | @@ -10756,49 +11197,40 @@ |
| 5291 | return __pyx_r; |
| 5292 | } |
| 5293 | |
| 5294 | -/* "mtrand.pyx":2250 |
| 5295 | +/* Python wrapper */ |
| 5296 | +static PyObject *__pyx_pw_6mtrand_11RandomState_61pareto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 5297 | +static char __pyx_doc_6mtrand_11RandomState_60pareto[] = "\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 "; |
| 5298 | +static PyObject *__pyx_pw_6mtrand_11RandomState_61pareto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 5299 | + PyObject *__pyx_v_a = 0; |
| 5300 | + PyObject *__pyx_v_size = 0; |
| 5301 | + PyObject *__pyx_r = 0; |
| 5302 | + __Pyx_RefNannyDeclarations |
| 5303 | + __Pyx_RefNannySetupContext("pareto (wrapper)", 0); |
| 5304 | + { |
| 5305 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__a,&__pyx_n_s__size,0}; |
| 5306 | + PyObject* values[2] = {0,0}; |
| 5307 | + |
| 5308 | + /* "mtrand.pyx":2250 |
| 5309 | * return cont2_array(self.internal_state, rk_vonmises, size, omu, okappa) |
| 5310 | * |
| 5311 | * def pareto(self, a, size=None): # <<<<<<<<<<<<<< |
| 5312 | * """ |
| 5313 | * pareto(a, size=None) |
| 5314 | */ |
| 5315 | - |
| 5316 | -static PyObject *__pyx_pf_6mtrand_11RandomState_30pareto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 5317 | -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 "; |
| 5318 | -static PyObject *__pyx_pf_6mtrand_11RandomState_30pareto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 5319 | - PyObject *__pyx_v_a = 0; |
| 5320 | - PyObject *__pyx_v_size = 0; |
| 5321 | - PyArrayObject *__pyx_v_oa = 0; |
| 5322 | - double __pyx_v_fa; |
| 5323 | - PyObject *__pyx_r = NULL; |
| 5324 | - __Pyx_RefNannyDeclarations |
| 5325 | - int __pyx_t_1; |
| 5326 | - PyObject *__pyx_t_2 = NULL; |
| 5327 | - PyObject *__pyx_t_3 = NULL; |
| 5328 | - PyObject *__pyx_t_4 = NULL; |
| 5329 | - PyObject *__pyx_t_5 = NULL; |
| 5330 | - int __pyx_lineno = 0; |
| 5331 | - const char *__pyx_filename = NULL; |
| 5332 | - int __pyx_clineno = 0; |
| 5333 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__a,&__pyx_n_s__size,0}; |
| 5334 | - __Pyx_RefNannySetupContext("pareto"); |
| 5335 | - { |
| 5336 | - PyObject* values[2] = {0,0}; |
| 5337 | values[1] = ((PyObject *)Py_None); |
| 5338 | if (unlikely(__pyx_kwds)) { |
| 5339 | Py_ssize_t kw_args; |
| 5340 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 5341 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 5342 | + switch (pos_args) { |
| 5343 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 5344 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 5345 | case 0: break; |
| 5346 | default: goto __pyx_L5_argtuple_error; |
| 5347 | } |
| 5348 | kw_args = PyDict_Size(__pyx_kwds); |
| 5349 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 5350 | + switch (pos_args) { |
| 5351 | case 0: |
| 5352 | - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a); |
| 5353 | - if (likely(values[0])) kw_args--; |
| 5354 | + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a)) != 0)) kw_args--; |
| 5355 | else goto __pyx_L5_argtuple_error; |
| 5356 | case 1: |
| 5357 | if (kw_args > 0) { |
| 5358 | @@ -10807,7 +11239,7 @@ |
| 5359 | } |
| 5360 | } |
| 5361 | if (unlikely(kw_args > 0)) { |
| 5362 | - 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;} |
| 5363 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pareto") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2250; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 5364 | } |
| 5365 | } else { |
| 5366 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 5367 | @@ -10828,6 +11260,25 @@ |
| 5368 | __Pyx_RefNannyFinishContext(); |
| 5369 | return NULL; |
| 5370 | __pyx_L4_argument_unpacking_done:; |
| 5371 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_60pareto(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_a, __pyx_v_size); |
| 5372 | + __Pyx_RefNannyFinishContext(); |
| 5373 | + return __pyx_r; |
| 5374 | +} |
| 5375 | + |
| 5376 | +static PyObject *__pyx_pf_6mtrand_11RandomState_60pareto(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_size) { |
| 5377 | + PyArrayObject *__pyx_v_oa = 0; |
| 5378 | + double __pyx_v_fa; |
| 5379 | + PyObject *__pyx_r = NULL; |
| 5380 | + __Pyx_RefNannyDeclarations |
| 5381 | + int __pyx_t_1; |
| 5382 | + PyObject *__pyx_t_2 = NULL; |
| 5383 | + PyObject *__pyx_t_3 = NULL; |
| 5384 | + PyObject *__pyx_t_4 = NULL; |
| 5385 | + PyObject *__pyx_t_5 = NULL; |
| 5386 | + int __pyx_lineno = 0; |
| 5387 | + const char *__pyx_filename = NULL; |
| 5388 | + int __pyx_clineno = 0; |
| 5389 | + __Pyx_RefNannySetupContext("pareto", 0); |
| 5390 | |
| 5391 | /* "mtrand.pyx":2333 |
| 5392 | * cdef double fa |
| 5393 | @@ -10870,9 +11321,9 @@ |
| 5394 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 5395 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 5396 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 5397 | - goto __pyx_L7; |
| 5398 | + goto __pyx_L4; |
| 5399 | } |
| 5400 | - __pyx_L7:; |
| 5401 | + __pyx_L4:; |
| 5402 | |
| 5403 | /* "mtrand.pyx":2337 |
| 5404 | * if fa <= 0: |
| 5405 | @@ -10882,14 +11333,14 @@ |
| 5406 | * PyErr_Clear() |
| 5407 | */ |
| 5408 | __Pyx_XDECREF(__pyx_r); |
| 5409 | - __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;} |
| 5410 | + __pyx_t_2 = __pyx_f_6mtrand_cont1_array_sc(__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;} |
| 5411 | __Pyx_GOTREF(__pyx_t_2); |
| 5412 | __pyx_r = __pyx_t_2; |
| 5413 | __pyx_t_2 = 0; |
| 5414 | goto __pyx_L0; |
| 5415 | - goto __pyx_L6; |
| 5416 | + goto __pyx_L3; |
| 5417 | } |
| 5418 | - __pyx_L6:; |
| 5419 | + __pyx_L3:; |
| 5420 | |
| 5421 | /* "mtrand.pyx":2339 |
| 5422 | * return cont1_array_sc(self.internal_state, rk_pareto, size, fa) |
| 5423 | @@ -10933,7 +11384,7 @@ |
| 5424 | __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;} |
| 5425 | __Pyx_GOTREF(__pyx_t_2); |
| 5426 | __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;} |
| 5427 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 5428 | + __Pyx_GOTREF(__pyx_t_5); |
| 5429 | __Pyx_INCREF(((PyObject *)__pyx_v_oa)); |
| 5430 | PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_oa)); |
| 5431 | __Pyx_GIVEREF(((PyObject *)__pyx_v_oa)); |
| 5432 | @@ -10945,7 +11396,7 @@ |
| 5433 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 5434 | __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| 5435 | __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;} |
| 5436 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 5437 | + __Pyx_GOTREF(__pyx_t_5); |
| 5438 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); |
| 5439 | __Pyx_GIVEREF(__pyx_t_2); |
| 5440 | __pyx_t_2 = 0; |
| 5441 | @@ -10969,9 +11420,9 @@ |
| 5442 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 5443 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 5444 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 5445 | - goto __pyx_L8; |
| 5446 | + goto __pyx_L5; |
| 5447 | } |
| 5448 | - __pyx_L8:; |
| 5449 | + __pyx_L5:; |
| 5450 | |
| 5451 | /* "mtrand.pyx":2344 |
| 5452 | * if np.any(np.less_equal(oa, 0.0)): |
| 5453 | @@ -10981,7 +11432,7 @@ |
| 5454 | * def weibull(self, a, size=None): |
| 5455 | */ |
| 5456 | __Pyx_XDECREF(__pyx_r); |
| 5457 | - __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;} |
| 5458 | + __pyx_t_2 = __pyx_f_6mtrand_cont1_array(__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;} |
| 5459 | __Pyx_GOTREF(__pyx_t_2); |
| 5460 | __pyx_r = __pyx_t_2; |
| 5461 | __pyx_t_2 = 0; |
| 5462 | @@ -11003,49 +11454,40 @@ |
| 5463 | return __pyx_r; |
| 5464 | } |
| 5465 | |
| 5466 | -/* "mtrand.pyx":2346 |
| 5467 | +/* Python wrapper */ |
| 5468 | +static PyObject *__pyx_pw_6mtrand_11RandomState_63weibull(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 5469 | +static char __pyx_doc_6mtrand_11RandomState_62weibull[] = "\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 "; |
| 5470 | +static PyObject *__pyx_pw_6mtrand_11RandomState_63weibull(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 5471 | + PyObject *__pyx_v_a = 0; |
| 5472 | + PyObject *__pyx_v_size = 0; |
| 5473 | + PyObject *__pyx_r = 0; |
| 5474 | + __Pyx_RefNannyDeclarations |
| 5475 | + __Pyx_RefNannySetupContext("weibull (wrapper)", 0); |
| 5476 | + { |
| 5477 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__a,&__pyx_n_s__size,0}; |
| 5478 | + PyObject* values[2] = {0,0}; |
| 5479 | + |
| 5480 | + /* "mtrand.pyx":2346 |
| 5481 | * return cont1_array(self.internal_state, rk_pareto, size, oa) |
| 5482 | * |
| 5483 | * def weibull(self, a, size=None): # <<<<<<<<<<<<<< |
| 5484 | * """ |
| 5485 | * weibull(a, size=None) |
| 5486 | */ |
| 5487 | - |
| 5488 | -static PyObject *__pyx_pf_6mtrand_11RandomState_31weibull(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 5489 | -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 "; |
| 5490 | -static PyObject *__pyx_pf_6mtrand_11RandomState_31weibull(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 5491 | - PyObject *__pyx_v_a = 0; |
| 5492 | - PyObject *__pyx_v_size = 0; |
| 5493 | - PyArrayObject *__pyx_v_oa = 0; |
| 5494 | - double __pyx_v_fa; |
| 5495 | - PyObject *__pyx_r = NULL; |
| 5496 | - __Pyx_RefNannyDeclarations |
| 5497 | - int __pyx_t_1; |
| 5498 | - PyObject *__pyx_t_2 = NULL; |
| 5499 | - PyObject *__pyx_t_3 = NULL; |
| 5500 | - PyObject *__pyx_t_4 = NULL; |
| 5501 | - PyObject *__pyx_t_5 = NULL; |
| 5502 | - int __pyx_lineno = 0; |
| 5503 | - const char *__pyx_filename = NULL; |
| 5504 | - int __pyx_clineno = 0; |
| 5505 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__a,&__pyx_n_s__size,0}; |
| 5506 | - __Pyx_RefNannySetupContext("weibull"); |
| 5507 | - { |
| 5508 | - PyObject* values[2] = {0,0}; |
| 5509 | values[1] = ((PyObject *)Py_None); |
| 5510 | if (unlikely(__pyx_kwds)) { |
| 5511 | Py_ssize_t kw_args; |
| 5512 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 5513 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 5514 | + switch (pos_args) { |
| 5515 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 5516 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 5517 | case 0: break; |
| 5518 | default: goto __pyx_L5_argtuple_error; |
| 5519 | } |
| 5520 | kw_args = PyDict_Size(__pyx_kwds); |
| 5521 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 5522 | + switch (pos_args) { |
| 5523 | case 0: |
| 5524 | - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a); |
| 5525 | - if (likely(values[0])) kw_args--; |
| 5526 | + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a)) != 0)) kw_args--; |
| 5527 | else goto __pyx_L5_argtuple_error; |
| 5528 | case 1: |
| 5529 | if (kw_args > 0) { |
| 5530 | @@ -11054,7 +11496,7 @@ |
| 5531 | } |
| 5532 | } |
| 5533 | if (unlikely(kw_args > 0)) { |
| 5534 | - 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;} |
| 5535 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "weibull") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2346; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 5536 | } |
| 5537 | } else { |
| 5538 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 5539 | @@ -11075,6 +11517,25 @@ |
| 5540 | __Pyx_RefNannyFinishContext(); |
| 5541 | return NULL; |
| 5542 | __pyx_L4_argument_unpacking_done:; |
| 5543 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_62weibull(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_a, __pyx_v_size); |
| 5544 | + __Pyx_RefNannyFinishContext(); |
| 5545 | + return __pyx_r; |
| 5546 | +} |
| 5547 | + |
| 5548 | +static PyObject *__pyx_pf_6mtrand_11RandomState_62weibull(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_size) { |
| 5549 | + PyArrayObject *__pyx_v_oa = 0; |
| 5550 | + double __pyx_v_fa; |
| 5551 | + PyObject *__pyx_r = NULL; |
| 5552 | + __Pyx_RefNannyDeclarations |
| 5553 | + int __pyx_t_1; |
| 5554 | + PyObject *__pyx_t_2 = NULL; |
| 5555 | + PyObject *__pyx_t_3 = NULL; |
| 5556 | + PyObject *__pyx_t_4 = NULL; |
| 5557 | + PyObject *__pyx_t_5 = NULL; |
| 5558 | + int __pyx_lineno = 0; |
| 5559 | + const char *__pyx_filename = NULL; |
| 5560 | + int __pyx_clineno = 0; |
| 5561 | + __Pyx_RefNannySetupContext("weibull", 0); |
| 5562 | |
| 5563 | /* "mtrand.pyx":2433 |
| 5564 | * cdef double fa |
| 5565 | @@ -11117,9 +11578,9 @@ |
| 5566 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 5567 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 5568 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 5569 | - goto __pyx_L7; |
| 5570 | + goto __pyx_L4; |
| 5571 | } |
| 5572 | - __pyx_L7:; |
| 5573 | + __pyx_L4:; |
| 5574 | |
| 5575 | /* "mtrand.pyx":2437 |
| 5576 | * if fa <= 0: |
| 5577 | @@ -11129,14 +11590,14 @@ |
| 5578 | * PyErr_Clear() |
| 5579 | */ |
| 5580 | __Pyx_XDECREF(__pyx_r); |
| 5581 | - __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;} |
| 5582 | + __pyx_t_2 = __pyx_f_6mtrand_cont1_array_sc(__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;} |
| 5583 | __Pyx_GOTREF(__pyx_t_2); |
| 5584 | __pyx_r = __pyx_t_2; |
| 5585 | __pyx_t_2 = 0; |
| 5586 | goto __pyx_L0; |
| 5587 | - goto __pyx_L6; |
| 5588 | + goto __pyx_L3; |
| 5589 | } |
| 5590 | - __pyx_L6:; |
| 5591 | + __pyx_L3:; |
| 5592 | |
| 5593 | /* "mtrand.pyx":2439 |
| 5594 | * return cont1_array_sc(self.internal_state, rk_weibull, size, fa) |
| 5595 | @@ -11180,7 +11641,7 @@ |
| 5596 | __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;} |
| 5597 | __Pyx_GOTREF(__pyx_t_2); |
| 5598 | __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;} |
| 5599 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 5600 | + __Pyx_GOTREF(__pyx_t_5); |
| 5601 | __Pyx_INCREF(((PyObject *)__pyx_v_oa)); |
| 5602 | PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_oa)); |
| 5603 | __Pyx_GIVEREF(((PyObject *)__pyx_v_oa)); |
| 5604 | @@ -11192,7 +11653,7 @@ |
| 5605 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 5606 | __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| 5607 | __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;} |
| 5608 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 5609 | + __Pyx_GOTREF(__pyx_t_5); |
| 5610 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); |
| 5611 | __Pyx_GIVEREF(__pyx_t_2); |
| 5612 | __pyx_t_2 = 0; |
| 5613 | @@ -11216,9 +11677,9 @@ |
| 5614 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 5615 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 5616 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 5617 | - goto __pyx_L8; |
| 5618 | + goto __pyx_L5; |
| 5619 | } |
| 5620 | - __pyx_L8:; |
| 5621 | + __pyx_L5:; |
| 5622 | |
| 5623 | /* "mtrand.pyx":2444 |
| 5624 | * if np.any(np.less_equal(oa, 0.0)): |
| 5625 | @@ -11228,7 +11689,7 @@ |
| 5626 | * def power(self, a, size=None): |
| 5627 | */ |
| 5628 | __Pyx_XDECREF(__pyx_r); |
| 5629 | - __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;} |
| 5630 | + __pyx_t_2 = __pyx_f_6mtrand_cont1_array(__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;} |
| 5631 | __Pyx_GOTREF(__pyx_t_2); |
| 5632 | __pyx_r = __pyx_t_2; |
| 5633 | __pyx_t_2 = 0; |
| 5634 | @@ -11250,49 +11711,40 @@ |
| 5635 | return __pyx_r; |
| 5636 | } |
| 5637 | |
| 5638 | -/* "mtrand.pyx":2446 |
| 5639 | +/* Python wrapper */ |
| 5640 | +static PyObject *__pyx_pw_6mtrand_11RandomState_65power(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 5641 | +static char __pyx_doc_6mtrand_11RandomState_64power[] = "\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 "; |
| 5642 | +static PyObject *__pyx_pw_6mtrand_11RandomState_65power(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 5643 | + PyObject *__pyx_v_a = 0; |
| 5644 | + PyObject *__pyx_v_size = 0; |
| 5645 | + PyObject *__pyx_r = 0; |
| 5646 | + __Pyx_RefNannyDeclarations |
| 5647 | + __Pyx_RefNannySetupContext("power (wrapper)", 0); |
| 5648 | + { |
| 5649 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__a,&__pyx_n_s__size,0}; |
| 5650 | + PyObject* values[2] = {0,0}; |
| 5651 | + |
| 5652 | + /* "mtrand.pyx":2446 |
| 5653 | * return cont1_array(self.internal_state, rk_weibull, size, oa) |
| 5654 | * |
| 5655 | * def power(self, a, size=None): # <<<<<<<<<<<<<< |
| 5656 | * """ |
| 5657 | * power(a, size=None) |
| 5658 | */ |
| 5659 | - |
| 5660 | -static PyObject *__pyx_pf_6mtrand_11RandomState_32power(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 5661 | -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 "; |
| 5662 | -static PyObject *__pyx_pf_6mtrand_11RandomState_32power(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 5663 | - PyObject *__pyx_v_a = 0; |
| 5664 | - PyObject *__pyx_v_size = 0; |
| 5665 | - PyArrayObject *__pyx_v_oa = 0; |
| 5666 | - double __pyx_v_fa; |
| 5667 | - PyObject *__pyx_r = NULL; |
| 5668 | - __Pyx_RefNannyDeclarations |
| 5669 | - int __pyx_t_1; |
| 5670 | - PyObject *__pyx_t_2 = NULL; |
| 5671 | - PyObject *__pyx_t_3 = NULL; |
| 5672 | - PyObject *__pyx_t_4 = NULL; |
| 5673 | - PyObject *__pyx_t_5 = NULL; |
| 5674 | - int __pyx_lineno = 0; |
| 5675 | - const char *__pyx_filename = NULL; |
| 5676 | - int __pyx_clineno = 0; |
| 5677 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__a,&__pyx_n_s__size,0}; |
| 5678 | - __Pyx_RefNannySetupContext("power"); |
| 5679 | - { |
| 5680 | - PyObject* values[2] = {0,0}; |
| 5681 | values[1] = ((PyObject *)Py_None); |
| 5682 | if (unlikely(__pyx_kwds)) { |
| 5683 | Py_ssize_t kw_args; |
| 5684 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 5685 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 5686 | + switch (pos_args) { |
| 5687 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 5688 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 5689 | case 0: break; |
| 5690 | default: goto __pyx_L5_argtuple_error; |
| 5691 | } |
| 5692 | kw_args = PyDict_Size(__pyx_kwds); |
| 5693 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 5694 | + switch (pos_args) { |
| 5695 | case 0: |
| 5696 | - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a); |
| 5697 | - if (likely(values[0])) kw_args--; |
| 5698 | + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a)) != 0)) kw_args--; |
| 5699 | else goto __pyx_L5_argtuple_error; |
| 5700 | case 1: |
| 5701 | if (kw_args > 0) { |
| 5702 | @@ -11301,7 +11753,7 @@ |
| 5703 | } |
| 5704 | } |
| 5705 | if (unlikely(kw_args > 0)) { |
| 5706 | - 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;} |
| 5707 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "power") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 5708 | } |
| 5709 | } else { |
| 5710 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 5711 | @@ -11322,6 +11774,25 @@ |
| 5712 | __Pyx_RefNannyFinishContext(); |
| 5713 | return NULL; |
| 5714 | __pyx_L4_argument_unpacking_done:; |
| 5715 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_64power(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_a, __pyx_v_size); |
| 5716 | + __Pyx_RefNannyFinishContext(); |
| 5717 | + return __pyx_r; |
| 5718 | +} |
| 5719 | + |
| 5720 | +static PyObject *__pyx_pf_6mtrand_11RandomState_64power(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_size) { |
| 5721 | + PyArrayObject *__pyx_v_oa = 0; |
| 5722 | + double __pyx_v_fa; |
| 5723 | + PyObject *__pyx_r = NULL; |
| 5724 | + __Pyx_RefNannyDeclarations |
| 5725 | + int __pyx_t_1; |
| 5726 | + PyObject *__pyx_t_2 = NULL; |
| 5727 | + PyObject *__pyx_t_3 = NULL; |
| 5728 | + PyObject *__pyx_t_4 = NULL; |
| 5729 | + PyObject *__pyx_t_5 = NULL; |
| 5730 | + int __pyx_lineno = 0; |
| 5731 | + const char *__pyx_filename = NULL; |
| 5732 | + int __pyx_clineno = 0; |
| 5733 | + __Pyx_RefNannySetupContext("power", 0); |
| 5734 | |
| 5735 | /* "mtrand.pyx":2542 |
| 5736 | * cdef double fa |
| 5737 | @@ -11364,9 +11835,9 @@ |
| 5738 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 5739 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 5740 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 5741 | - goto __pyx_L7; |
| 5742 | + goto __pyx_L4; |
| 5743 | } |
| 5744 | - __pyx_L7:; |
| 5745 | + __pyx_L4:; |
| 5746 | |
| 5747 | /* "mtrand.pyx":2546 |
| 5748 | * if fa <= 0: |
| 5749 | @@ -11376,14 +11847,14 @@ |
| 5750 | * PyErr_Clear() |
| 5751 | */ |
| 5752 | __Pyx_XDECREF(__pyx_r); |
| 5753 | - __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;} |
| 5754 | + __pyx_t_2 = __pyx_f_6mtrand_cont1_array_sc(__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;} |
| 5755 | __Pyx_GOTREF(__pyx_t_2); |
| 5756 | __pyx_r = __pyx_t_2; |
| 5757 | __pyx_t_2 = 0; |
| 5758 | goto __pyx_L0; |
| 5759 | - goto __pyx_L6; |
| 5760 | + goto __pyx_L3; |
| 5761 | } |
| 5762 | - __pyx_L6:; |
| 5763 | + __pyx_L3:; |
| 5764 | |
| 5765 | /* "mtrand.pyx":2548 |
| 5766 | * return cont1_array_sc(self.internal_state, rk_power, size, fa) |
| 5767 | @@ -11427,7 +11898,7 @@ |
| 5768 | __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;} |
| 5769 | __Pyx_GOTREF(__pyx_t_2); |
| 5770 | __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;} |
| 5771 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 5772 | + __Pyx_GOTREF(__pyx_t_5); |
| 5773 | __Pyx_INCREF(((PyObject *)__pyx_v_oa)); |
| 5774 | PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_oa)); |
| 5775 | __Pyx_GIVEREF(((PyObject *)__pyx_v_oa)); |
| 5776 | @@ -11439,7 +11910,7 @@ |
| 5777 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 5778 | __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| 5779 | __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;} |
| 5780 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 5781 | + __Pyx_GOTREF(__pyx_t_5); |
| 5782 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); |
| 5783 | __Pyx_GIVEREF(__pyx_t_2); |
| 5784 | __pyx_t_2 = 0; |
| 5785 | @@ -11463,9 +11934,9 @@ |
| 5786 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 5787 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 5788 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 5789 | - goto __pyx_L8; |
| 5790 | + goto __pyx_L5; |
| 5791 | } |
| 5792 | - __pyx_L8:; |
| 5793 | + __pyx_L5:; |
| 5794 | |
| 5795 | /* "mtrand.pyx":2553 |
| 5796 | * if np.any(np.less_equal(oa, 0.0)): |
| 5797 | @@ -11475,7 +11946,7 @@ |
| 5798 | * def laplace(self, loc=0.0, scale=1.0, size=None): |
| 5799 | */ |
| 5800 | __Pyx_XDECREF(__pyx_r); |
| 5801 | - __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;} |
| 5802 | + __pyx_t_2 = __pyx_f_6mtrand_cont1_array(__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;} |
| 5803 | __Pyx_GOTREF(__pyx_t_2); |
| 5804 | __pyx_r = __pyx_t_2; |
| 5805 | __pyx_t_2 = 0; |
| 5806 | @@ -11497,44 +11968,34 @@ |
| 5807 | return __pyx_r; |
| 5808 | } |
| 5809 | |
| 5810 | -/* "mtrand.pyx":2555 |
| 5811 | - * return cont1_array(self.internal_state, rk_power, size, oa) |
| 5812 | - * |
| 5813 | - * def laplace(self, loc=0.0, scale=1.0, size=None): # <<<<<<<<<<<<<< |
| 5814 | - * """ |
| 5815 | - * laplace(loc=0.0, scale=1.0, size=None) |
| 5816 | - */ |
| 5817 | - |
| 5818 | -static PyObject *__pyx_pf_6mtrand_11RandomState_33laplace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 5819 | -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 "; |
| 5820 | -static PyObject *__pyx_pf_6mtrand_11RandomState_33laplace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 5821 | +/* Python wrapper */ |
| 5822 | +static PyObject *__pyx_pw_6mtrand_11RandomState_67laplace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 5823 | +static char __pyx_doc_6mtrand_11RandomState_66laplace[] = "\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 "; |
| 5824 | +static PyObject *__pyx_pw_6mtrand_11RandomState_67laplace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 5825 | PyObject *__pyx_v_loc = 0; |
| 5826 | PyObject *__pyx_v_scale = 0; |
| 5827 | PyObject *__pyx_v_size = 0; |
| 5828 | - PyArrayObject *__pyx_v_oloc = 0; |
| 5829 | - PyArrayObject *__pyx_v_oscale = 0; |
| 5830 | - double __pyx_v_floc; |
| 5831 | - double __pyx_v_fscale; |
| 5832 | - PyObject *__pyx_r = NULL; |
| 5833 | + PyObject *__pyx_r = 0; |
| 5834 | __Pyx_RefNannyDeclarations |
| 5835 | - int __pyx_t_1; |
| 5836 | - PyObject *__pyx_t_2 = NULL; |
| 5837 | - PyObject *__pyx_t_3 = NULL; |
| 5838 | - PyObject *__pyx_t_4 = NULL; |
| 5839 | - PyObject *__pyx_t_5 = NULL; |
| 5840 | - int __pyx_lineno = 0; |
| 5841 | - const char *__pyx_filename = NULL; |
| 5842 | - int __pyx_clineno = 0; |
| 5843 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__loc,&__pyx_n_s__scale,&__pyx_n_s__size,0}; |
| 5844 | - __Pyx_RefNannySetupContext("laplace"); |
| 5845 | + __Pyx_RefNannySetupContext("laplace (wrapper)", 0); |
| 5846 | { |
| 5847 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__loc,&__pyx_n_s__scale,&__pyx_n_s__size,0}; |
| 5848 | PyObject* values[3] = {0,0,0}; |
| 5849 | values[0] = __pyx_k_73; |
| 5850 | values[1] = __pyx_k_74; |
| 5851 | + |
| 5852 | + /* "mtrand.pyx":2555 |
| 5853 | + * return cont1_array(self.internal_state, rk_power, size, oa) |
| 5854 | + * |
| 5855 | + * def laplace(self, loc=0.0, scale=1.0, size=None): # <<<<<<<<<<<<<< |
| 5856 | + * """ |
| 5857 | + * laplace(loc=0.0, scale=1.0, size=None) |
| 5858 | + */ |
| 5859 | values[2] = ((PyObject *)Py_None); |
| 5860 | if (unlikely(__pyx_kwds)) { |
| 5861 | Py_ssize_t kw_args; |
| 5862 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 5863 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 5864 | + switch (pos_args) { |
| 5865 | case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); |
| 5866 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 5867 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 5868 | @@ -11542,7 +12003,7 @@ |
| 5869 | default: goto __pyx_L5_argtuple_error; |
| 5870 | } |
| 5871 | kw_args = PyDict_Size(__pyx_kwds); |
| 5872 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 5873 | + switch (pos_args) { |
| 5874 | case 0: |
| 5875 | if (kw_args > 0) { |
| 5876 | PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__loc); |
| 5877 | @@ -11560,7 +12021,7 @@ |
| 5878 | } |
| 5879 | } |
| 5880 | if (unlikely(kw_args > 0)) { |
| 5881 | - 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;} |
| 5882 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "laplace") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2555; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 5883 | } |
| 5884 | } else { |
| 5885 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 5886 | @@ -11583,6 +12044,27 @@ |
| 5887 | __Pyx_RefNannyFinishContext(); |
| 5888 | return NULL; |
| 5889 | __pyx_L4_argument_unpacking_done:; |
| 5890 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_66laplace(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_loc, __pyx_v_scale, __pyx_v_size); |
| 5891 | + __Pyx_RefNannyFinishContext(); |
| 5892 | + return __pyx_r; |
| 5893 | +} |
| 5894 | + |
| 5895 | +static PyObject *__pyx_pf_6mtrand_11RandomState_66laplace(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_loc, PyObject *__pyx_v_scale, PyObject *__pyx_v_size) { |
| 5896 | + PyArrayObject *__pyx_v_oloc = 0; |
| 5897 | + PyArrayObject *__pyx_v_oscale = 0; |
| 5898 | + double __pyx_v_floc; |
| 5899 | + double __pyx_v_fscale; |
| 5900 | + PyObject *__pyx_r = NULL; |
| 5901 | + __Pyx_RefNannyDeclarations |
| 5902 | + int __pyx_t_1; |
| 5903 | + PyObject *__pyx_t_2 = NULL; |
| 5904 | + PyObject *__pyx_t_3 = NULL; |
| 5905 | + PyObject *__pyx_t_4 = NULL; |
| 5906 | + PyObject *__pyx_t_5 = NULL; |
| 5907 | + int __pyx_lineno = 0; |
| 5908 | + const char *__pyx_filename = NULL; |
| 5909 | + int __pyx_clineno = 0; |
| 5910 | + __Pyx_RefNannySetupContext("laplace", 0); |
| 5911 | |
| 5912 | /* "mtrand.pyx":2631 |
| 5913 | * cdef double floc, fscale |
| 5914 | @@ -11634,9 +12116,9 @@ |
| 5915 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 5916 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 5917 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2635; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 5918 | - goto __pyx_L7; |
| 5919 | + goto __pyx_L4; |
| 5920 | } |
| 5921 | - __pyx_L7:; |
| 5922 | + __pyx_L4:; |
| 5923 | |
| 5924 | /* "mtrand.pyx":2636 |
| 5925 | * if fscale <= 0: |
| 5926 | @@ -11646,14 +12128,14 @@ |
| 5927 | * PyErr_Clear() |
| 5928 | */ |
| 5929 | __Pyx_XDECREF(__pyx_r); |
| 5930 | - __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;} |
| 5931 | + __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(__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;} |
| 5932 | __Pyx_GOTREF(__pyx_t_2); |
| 5933 | __pyx_r = __pyx_t_2; |
| 5934 | __pyx_t_2 = 0; |
| 5935 | goto __pyx_L0; |
| 5936 | - goto __pyx_L6; |
| 5937 | + goto __pyx_L3; |
| 5938 | } |
| 5939 | - __pyx_L6:; |
| 5940 | + __pyx_L3:; |
| 5941 | |
| 5942 | /* "mtrand.pyx":2638 |
| 5943 | * return cont2_array_sc(self.internal_state, rk_laplace, size, floc, fscale) |
| 5944 | @@ -11710,7 +12192,7 @@ |
| 5945 | __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;} |
| 5946 | __Pyx_GOTREF(__pyx_t_2); |
| 5947 | __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;} |
| 5948 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 5949 | + __Pyx_GOTREF(__pyx_t_5); |
| 5950 | __Pyx_INCREF(((PyObject *)__pyx_v_oscale)); |
| 5951 | PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_oscale)); |
| 5952 | __Pyx_GIVEREF(((PyObject *)__pyx_v_oscale)); |
| 5953 | @@ -11722,7 +12204,7 @@ |
| 5954 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 5955 | __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| 5956 | __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;} |
| 5957 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 5958 | + __Pyx_GOTREF(__pyx_t_5); |
| 5959 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); |
| 5960 | __Pyx_GIVEREF(__pyx_t_2); |
| 5961 | __pyx_t_2 = 0; |
| 5962 | @@ -11746,9 +12228,9 @@ |
| 5963 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 5964 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 5965 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 5966 | - goto __pyx_L8; |
| 5967 | + goto __pyx_L5; |
| 5968 | } |
| 5969 | - __pyx_L8:; |
| 5970 | + __pyx_L5:; |
| 5971 | |
| 5972 | /* "mtrand.pyx":2643 |
| 5973 | * if np.any(np.less_equal(oscale, 0.0)): |
| 5974 | @@ -11758,7 +12240,7 @@ |
| 5975 | * def gumbel(self, loc=0.0, scale=1.0, size=None): |
| 5976 | */ |
| 5977 | __Pyx_XDECREF(__pyx_r); |
| 5978 | - __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;} |
| 5979 | + __pyx_t_2 = __pyx_f_6mtrand_cont2_array(__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;} |
| 5980 | __Pyx_GOTREF(__pyx_t_2); |
| 5981 | __pyx_r = __pyx_t_2; |
| 5982 | __pyx_t_2 = 0; |
| 5983 | @@ -11781,44 +12263,34 @@ |
| 5984 | return __pyx_r; |
| 5985 | } |
| 5986 | |
| 5987 | -/* "mtrand.pyx":2645 |
| 5988 | - * return cont2_array(self.internal_state, rk_laplace, size, oloc, oscale) |
| 5989 | - * |
| 5990 | - * def gumbel(self, loc=0.0, scale=1.0, size=None): # <<<<<<<<<<<<<< |
| 5991 | - * """ |
| 5992 | - * gumbel(loc=0.0, scale=1.0, size=None) |
| 5993 | - */ |
| 5994 | - |
| 5995 | -static PyObject *__pyx_pf_6mtrand_11RandomState_34gumbel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 5996 | -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 "; |
| 5997 | -static PyObject *__pyx_pf_6mtrand_11RandomState_34gumbel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 5998 | +/* Python wrapper */ |
| 5999 | +static PyObject *__pyx_pw_6mtrand_11RandomState_69gumbel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 6000 | +static char __pyx_doc_6mtrand_11RandomState_68gumbel[] = "\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 "; |
| 6001 | +static PyObject *__pyx_pw_6mtrand_11RandomState_69gumbel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 6002 | PyObject *__pyx_v_loc = 0; |
| 6003 | PyObject *__pyx_v_scale = 0; |
| 6004 | PyObject *__pyx_v_size = 0; |
| 6005 | - PyArrayObject *__pyx_v_oloc = 0; |
| 6006 | - PyArrayObject *__pyx_v_oscale = 0; |
| 6007 | - double __pyx_v_floc; |
| 6008 | - double __pyx_v_fscale; |
| 6009 | - PyObject *__pyx_r = NULL; |
| 6010 | + PyObject *__pyx_r = 0; |
| 6011 | __Pyx_RefNannyDeclarations |
| 6012 | - int __pyx_t_1; |
| 6013 | - PyObject *__pyx_t_2 = NULL; |
| 6014 | - PyObject *__pyx_t_3 = NULL; |
| 6015 | - PyObject *__pyx_t_4 = NULL; |
| 6016 | - PyObject *__pyx_t_5 = NULL; |
| 6017 | - int __pyx_lineno = 0; |
| 6018 | - const char *__pyx_filename = NULL; |
| 6019 | - int __pyx_clineno = 0; |
| 6020 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__loc,&__pyx_n_s__scale,&__pyx_n_s__size,0}; |
| 6021 | - __Pyx_RefNannySetupContext("gumbel"); |
| 6022 | + __Pyx_RefNannySetupContext("gumbel (wrapper)", 0); |
| 6023 | { |
| 6024 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__loc,&__pyx_n_s__scale,&__pyx_n_s__size,0}; |
| 6025 | PyObject* values[3] = {0,0,0}; |
| 6026 | values[0] = __pyx_k_77; |
| 6027 | values[1] = __pyx_k_78; |
| 6028 | + |
| 6029 | + /* "mtrand.pyx":2645 |
| 6030 | + * return cont2_array(self.internal_state, rk_laplace, size, oloc, oscale) |
| 6031 | + * |
| 6032 | + * def gumbel(self, loc=0.0, scale=1.0, size=None): # <<<<<<<<<<<<<< |
| 6033 | + * """ |
| 6034 | + * gumbel(loc=0.0, scale=1.0, size=None) |
| 6035 | + */ |
| 6036 | values[2] = ((PyObject *)Py_None); |
| 6037 | if (unlikely(__pyx_kwds)) { |
| 6038 | Py_ssize_t kw_args; |
| 6039 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 6040 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 6041 | + switch (pos_args) { |
| 6042 | case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); |
| 6043 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 6044 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 6045 | @@ -11826,7 +12298,7 @@ |
| 6046 | default: goto __pyx_L5_argtuple_error; |
| 6047 | } |
| 6048 | kw_args = PyDict_Size(__pyx_kwds); |
| 6049 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 6050 | + switch (pos_args) { |
| 6051 | case 0: |
| 6052 | if (kw_args > 0) { |
| 6053 | PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__loc); |
| 6054 | @@ -11844,7 +12316,7 @@ |
| 6055 | } |
| 6056 | } |
| 6057 | if (unlikely(kw_args > 0)) { |
| 6058 | - 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;} |
| 6059 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gumbel") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2645; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 6060 | } |
| 6061 | } else { |
| 6062 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 6063 | @@ -11867,6 +12339,27 @@ |
| 6064 | __Pyx_RefNannyFinishContext(); |
| 6065 | return NULL; |
| 6066 | __pyx_L4_argument_unpacking_done:; |
| 6067 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_68gumbel(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_loc, __pyx_v_scale, __pyx_v_size); |
| 6068 | + __Pyx_RefNannyFinishContext(); |
| 6069 | + return __pyx_r; |
| 6070 | +} |
| 6071 | + |
| 6072 | +static PyObject *__pyx_pf_6mtrand_11RandomState_68gumbel(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_loc, PyObject *__pyx_v_scale, PyObject *__pyx_v_size) { |
| 6073 | + PyArrayObject *__pyx_v_oloc = 0; |
| 6074 | + PyArrayObject *__pyx_v_oscale = 0; |
| 6075 | + double __pyx_v_floc; |
| 6076 | + double __pyx_v_fscale; |
| 6077 | + PyObject *__pyx_r = NULL; |
| 6078 | + __Pyx_RefNannyDeclarations |
| 6079 | + int __pyx_t_1; |
| 6080 | + PyObject *__pyx_t_2 = NULL; |
| 6081 | + PyObject *__pyx_t_3 = NULL; |
| 6082 | + PyObject *__pyx_t_4 = NULL; |
| 6083 | + PyObject *__pyx_t_5 = NULL; |
| 6084 | + int __pyx_lineno = 0; |
| 6085 | + const char *__pyx_filename = NULL; |
| 6086 | + int __pyx_clineno = 0; |
| 6087 | + __Pyx_RefNannySetupContext("gumbel", 0); |
| 6088 | |
| 6089 | /* "mtrand.pyx":2762 |
| 6090 | * cdef double floc, fscale |
| 6091 | @@ -11918,9 +12411,9 @@ |
| 6092 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 6093 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 6094 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 6095 | - goto __pyx_L7; |
| 6096 | + goto __pyx_L4; |
| 6097 | } |
| 6098 | - __pyx_L7:; |
| 6099 | + __pyx_L4:; |
| 6100 | |
| 6101 | /* "mtrand.pyx":2767 |
| 6102 | * if fscale <= 0: |
| 6103 | @@ -11930,14 +12423,14 @@ |
| 6104 | * PyErr_Clear() |
| 6105 | */ |
| 6106 | __Pyx_XDECREF(__pyx_r); |
| 6107 | - __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;} |
| 6108 | + __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(__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;} |
| 6109 | __Pyx_GOTREF(__pyx_t_2); |
| 6110 | __pyx_r = __pyx_t_2; |
| 6111 | __pyx_t_2 = 0; |
| 6112 | goto __pyx_L0; |
| 6113 | - goto __pyx_L6; |
| 6114 | + goto __pyx_L3; |
| 6115 | } |
| 6116 | - __pyx_L6:; |
| 6117 | + __pyx_L3:; |
| 6118 | |
| 6119 | /* "mtrand.pyx":2769 |
| 6120 | * return cont2_array_sc(self.internal_state, rk_gumbel, size, floc, fscale) |
| 6121 | @@ -11994,7 +12487,7 @@ |
| 6122 | __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;} |
| 6123 | __Pyx_GOTREF(__pyx_t_2); |
| 6124 | __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;} |
| 6125 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 6126 | + __Pyx_GOTREF(__pyx_t_5); |
| 6127 | __Pyx_INCREF(((PyObject *)__pyx_v_oscale)); |
| 6128 | PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_oscale)); |
| 6129 | __Pyx_GIVEREF(((PyObject *)__pyx_v_oscale)); |
| 6130 | @@ -12006,7 +12499,7 @@ |
| 6131 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 6132 | __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| 6133 | __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;} |
| 6134 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 6135 | + __Pyx_GOTREF(__pyx_t_5); |
| 6136 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); |
| 6137 | __Pyx_GIVEREF(__pyx_t_2); |
| 6138 | __pyx_t_2 = 0; |
| 6139 | @@ -12030,9 +12523,9 @@ |
| 6140 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 6141 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 6142 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2773; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 6143 | - goto __pyx_L8; |
| 6144 | + goto __pyx_L5; |
| 6145 | } |
| 6146 | - __pyx_L8:; |
| 6147 | + __pyx_L5:; |
| 6148 | |
| 6149 | /* "mtrand.pyx":2774 |
| 6150 | * if np.any(np.less_equal(oscale, 0.0)): |
| 6151 | @@ -12042,7 +12535,7 @@ |
| 6152 | * def logistic(self, loc=0.0, scale=1.0, size=None): |
| 6153 | */ |
| 6154 | __Pyx_XDECREF(__pyx_r); |
| 6155 | - __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;} |
| 6156 | + __pyx_t_2 = __pyx_f_6mtrand_cont2_array(__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;} |
| 6157 | __Pyx_GOTREF(__pyx_t_2); |
| 6158 | __pyx_r = __pyx_t_2; |
| 6159 | __pyx_t_2 = 0; |
| 6160 | @@ -12065,44 +12558,34 @@ |
| 6161 | return __pyx_r; |
| 6162 | } |
| 6163 | |
| 6164 | -/* "mtrand.pyx":2776 |
| 6165 | - * return cont2_array(self.internal_state, rk_gumbel, size, oloc, oscale) |
| 6166 | - * |
| 6167 | - * def logistic(self, loc=0.0, scale=1.0, size=None): # <<<<<<<<<<<<<< |
| 6168 | - * """ |
| 6169 | - * logistic(loc=0.0, scale=1.0, size=None) |
| 6170 | - */ |
| 6171 | - |
| 6172 | -static PyObject *__pyx_pf_6mtrand_11RandomState_35logistic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 6173 | -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 "; |
| 6174 | -static PyObject *__pyx_pf_6mtrand_11RandomState_35logistic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 6175 | +/* Python wrapper */ |
| 6176 | +static PyObject *__pyx_pw_6mtrand_11RandomState_71logistic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 6177 | +static char __pyx_doc_6mtrand_11RandomState_70logistic[] = "\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 "; |
| 6178 | +static PyObject *__pyx_pw_6mtrand_11RandomState_71logistic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 6179 | PyObject *__pyx_v_loc = 0; |
| 6180 | PyObject *__pyx_v_scale = 0; |
| 6181 | PyObject *__pyx_v_size = 0; |
| 6182 | - PyArrayObject *__pyx_v_oloc = 0; |
| 6183 | - PyArrayObject *__pyx_v_oscale = 0; |
| 6184 | - double __pyx_v_floc; |
| 6185 | - double __pyx_v_fscale; |
| 6186 | - PyObject *__pyx_r = NULL; |
| 6187 | + PyObject *__pyx_r = 0; |
| 6188 | __Pyx_RefNannyDeclarations |
| 6189 | - int __pyx_t_1; |
| 6190 | - PyObject *__pyx_t_2 = NULL; |
| 6191 | - PyObject *__pyx_t_3 = NULL; |
| 6192 | - PyObject *__pyx_t_4 = NULL; |
| 6193 | - PyObject *__pyx_t_5 = NULL; |
| 6194 | - int __pyx_lineno = 0; |
| 6195 | - const char *__pyx_filename = NULL; |
| 6196 | - int __pyx_clineno = 0; |
| 6197 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__loc,&__pyx_n_s__scale,&__pyx_n_s__size,0}; |
| 6198 | - __Pyx_RefNannySetupContext("logistic"); |
| 6199 | + __Pyx_RefNannySetupContext("logistic (wrapper)", 0); |
| 6200 | { |
| 6201 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__loc,&__pyx_n_s__scale,&__pyx_n_s__size,0}; |
| 6202 | PyObject* values[3] = {0,0,0}; |
| 6203 | values[0] = __pyx_k_81; |
| 6204 | values[1] = __pyx_k_82; |
| 6205 | + |
| 6206 | + /* "mtrand.pyx":2776 |
| 6207 | + * return cont2_array(self.internal_state, rk_gumbel, size, oloc, oscale) |
| 6208 | + * |
| 6209 | + * def logistic(self, loc=0.0, scale=1.0, size=None): # <<<<<<<<<<<<<< |
| 6210 | + * """ |
| 6211 | + * logistic(loc=0.0, scale=1.0, size=None) |
| 6212 | + */ |
| 6213 | values[2] = ((PyObject *)Py_None); |
| 6214 | if (unlikely(__pyx_kwds)) { |
| 6215 | Py_ssize_t kw_args; |
| 6216 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 6217 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 6218 | + switch (pos_args) { |
| 6219 | case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); |
| 6220 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 6221 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 6222 | @@ -12110,7 +12593,7 @@ |
| 6223 | default: goto __pyx_L5_argtuple_error; |
| 6224 | } |
| 6225 | kw_args = PyDict_Size(__pyx_kwds); |
| 6226 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 6227 | + switch (pos_args) { |
| 6228 | case 0: |
| 6229 | if (kw_args > 0) { |
| 6230 | PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__loc); |
| 6231 | @@ -12128,7 +12611,7 @@ |
| 6232 | } |
| 6233 | } |
| 6234 | if (unlikely(kw_args > 0)) { |
| 6235 | - 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;} |
| 6236 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "logistic") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2776; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 6237 | } |
| 6238 | } else { |
| 6239 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 6240 | @@ -12151,6 +12634,27 @@ |
| 6241 | __Pyx_RefNannyFinishContext(); |
| 6242 | return NULL; |
| 6243 | __pyx_L4_argument_unpacking_done:; |
| 6244 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_70logistic(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_loc, __pyx_v_scale, __pyx_v_size); |
| 6245 | + __Pyx_RefNannyFinishContext(); |
| 6246 | + return __pyx_r; |
| 6247 | +} |
| 6248 | + |
| 6249 | +static PyObject *__pyx_pf_6mtrand_11RandomState_70logistic(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_loc, PyObject *__pyx_v_scale, PyObject *__pyx_v_size) { |
| 6250 | + PyArrayObject *__pyx_v_oloc = 0; |
| 6251 | + PyArrayObject *__pyx_v_oscale = 0; |
| 6252 | + double __pyx_v_floc; |
| 6253 | + double __pyx_v_fscale; |
| 6254 | + PyObject *__pyx_r = NULL; |
| 6255 | + __Pyx_RefNannyDeclarations |
| 6256 | + int __pyx_t_1; |
| 6257 | + PyObject *__pyx_t_2 = NULL; |
| 6258 | + PyObject *__pyx_t_3 = NULL; |
| 6259 | + PyObject *__pyx_t_4 = NULL; |
| 6260 | + PyObject *__pyx_t_5 = NULL; |
| 6261 | + int __pyx_lineno = 0; |
| 6262 | + const char *__pyx_filename = NULL; |
| 6263 | + int __pyx_clineno = 0; |
| 6264 | + __Pyx_RefNannySetupContext("logistic", 0); |
| 6265 | |
| 6266 | /* "mtrand.pyx":2850 |
| 6267 | * cdef double floc, fscale |
| 6268 | @@ -12202,9 +12706,9 @@ |
| 6269 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 6270 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 6271 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 6272 | - goto __pyx_L7; |
| 6273 | + goto __pyx_L4; |
| 6274 | } |
| 6275 | - __pyx_L7:; |
| 6276 | + __pyx_L4:; |
| 6277 | |
| 6278 | /* "mtrand.pyx":2855 |
| 6279 | * if fscale <= 0: |
| 6280 | @@ -12214,14 +12718,14 @@ |
| 6281 | * PyErr_Clear() |
| 6282 | */ |
| 6283 | __Pyx_XDECREF(__pyx_r); |
| 6284 | - __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;} |
| 6285 | + __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(__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;} |
| 6286 | __Pyx_GOTREF(__pyx_t_2); |
| 6287 | __pyx_r = __pyx_t_2; |
| 6288 | __pyx_t_2 = 0; |
| 6289 | goto __pyx_L0; |
| 6290 | - goto __pyx_L6; |
| 6291 | + goto __pyx_L3; |
| 6292 | } |
| 6293 | - __pyx_L6:; |
| 6294 | + __pyx_L3:; |
| 6295 | |
| 6296 | /* "mtrand.pyx":2857 |
| 6297 | * return cont2_array_sc(self.internal_state, rk_logistic, size, floc, fscale) |
| 6298 | @@ -12278,7 +12782,7 @@ |
| 6299 | __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;} |
| 6300 | __Pyx_GOTREF(__pyx_t_2); |
| 6301 | __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;} |
| 6302 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 6303 | + __Pyx_GOTREF(__pyx_t_5); |
| 6304 | __Pyx_INCREF(((PyObject *)__pyx_v_oscale)); |
| 6305 | PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_oscale)); |
| 6306 | __Pyx_GIVEREF(((PyObject *)__pyx_v_oscale)); |
| 6307 | @@ -12290,7 +12794,7 @@ |
| 6308 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 6309 | __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| 6310 | __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;} |
| 6311 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 6312 | + __Pyx_GOTREF(__pyx_t_5); |
| 6313 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); |
| 6314 | __Pyx_GIVEREF(__pyx_t_2); |
| 6315 | __pyx_t_2 = 0; |
| 6316 | @@ -12314,9 +12818,9 @@ |
| 6317 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 6318 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 6319 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 6320 | - goto __pyx_L8; |
| 6321 | + goto __pyx_L5; |
| 6322 | } |
| 6323 | - __pyx_L8:; |
| 6324 | + __pyx_L5:; |
| 6325 | |
| 6326 | /* "mtrand.pyx":2862 |
| 6327 | * if np.any(np.less_equal(oscale, 0.0)): |
| 6328 | @@ -12326,7 +12830,7 @@ |
| 6329 | * def lognormal(self, mean=0.0, sigma=1.0, size=None): |
| 6330 | */ |
| 6331 | __Pyx_XDECREF(__pyx_r); |
| 6332 | - __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;} |
| 6333 | + __pyx_t_2 = __pyx_f_6mtrand_cont2_array(__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;} |
| 6334 | __Pyx_GOTREF(__pyx_t_2); |
| 6335 | __pyx_r = __pyx_t_2; |
| 6336 | __pyx_t_2 = 0; |
| 6337 | @@ -12349,44 +12853,34 @@ |
| 6338 | return __pyx_r; |
| 6339 | } |
| 6340 | |
| 6341 | -/* "mtrand.pyx":2864 |
| 6342 | - * return cont2_array(self.internal_state, rk_logistic, size, oloc, oscale) |
| 6343 | - * |
| 6344 | - * def lognormal(self, mean=0.0, sigma=1.0, size=None): # <<<<<<<<<<<<<< |
| 6345 | - * """ |
| 6346 | - * lognormal(mean=0.0, sigma=1.0, size=None) |
| 6347 | - */ |
| 6348 | - |
| 6349 | -static PyObject *__pyx_pf_6mtrand_11RandomState_36lognormal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 6350 | -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 "; |
| 6351 | -static PyObject *__pyx_pf_6mtrand_11RandomState_36lognormal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 6352 | +/* Python wrapper */ |
| 6353 | +static PyObject *__pyx_pw_6mtrand_11RandomState_73lognormal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 6354 | +static char __pyx_doc_6mtrand_11RandomState_72lognormal[] = "\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 "; |
| 6355 | +static PyObject *__pyx_pw_6mtrand_11RandomState_73lognormal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 6356 | PyObject *__pyx_v_mean = 0; |
| 6357 | PyObject *__pyx_v_sigma = 0; |
| 6358 | PyObject *__pyx_v_size = 0; |
| 6359 | - PyArrayObject *__pyx_v_omean = 0; |
| 6360 | - PyArrayObject *__pyx_v_osigma = 0; |
| 6361 | - double __pyx_v_fmean; |
| 6362 | - double __pyx_v_fsigma; |
| 6363 | - PyObject *__pyx_r = NULL; |
| 6364 | + PyObject *__pyx_r = 0; |
| 6365 | __Pyx_RefNannyDeclarations |
| 6366 | - int __pyx_t_1; |
| 6367 | - PyObject *__pyx_t_2 = NULL; |
| 6368 | - PyObject *__pyx_t_3 = NULL; |
| 6369 | - PyObject *__pyx_t_4 = NULL; |
| 6370 | - PyObject *__pyx_t_5 = NULL; |
| 6371 | - int __pyx_lineno = 0; |
| 6372 | - const char *__pyx_filename = NULL; |
| 6373 | - int __pyx_clineno = 0; |
| 6374 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__mean,&__pyx_n_s__sigma,&__pyx_n_s__size,0}; |
| 6375 | - __Pyx_RefNannySetupContext("lognormal"); |
| 6376 | + __Pyx_RefNannySetupContext("lognormal (wrapper)", 0); |
| 6377 | { |
| 6378 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__mean,&__pyx_n_s__sigma,&__pyx_n_s__size,0}; |
| 6379 | PyObject* values[3] = {0,0,0}; |
| 6380 | values[0] = __pyx_k_85; |
| 6381 | values[1] = __pyx_k_86; |
| 6382 | + |
| 6383 | + /* "mtrand.pyx":2864 |
| 6384 | + * return cont2_array(self.internal_state, rk_logistic, size, oloc, oscale) |
| 6385 | + * |
| 6386 | + * def lognormal(self, mean=0.0, sigma=1.0, size=None): # <<<<<<<<<<<<<< |
| 6387 | + * """ |
| 6388 | + * lognormal(mean=0.0, sigma=1.0, size=None) |
| 6389 | + */ |
| 6390 | values[2] = ((PyObject *)Py_None); |
| 6391 | if (unlikely(__pyx_kwds)) { |
| 6392 | Py_ssize_t kw_args; |
| 6393 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 6394 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 6395 | + switch (pos_args) { |
| 6396 | case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); |
| 6397 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 6398 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 6399 | @@ -12394,7 +12888,7 @@ |
| 6400 | default: goto __pyx_L5_argtuple_error; |
| 6401 | } |
| 6402 | kw_args = PyDict_Size(__pyx_kwds); |
| 6403 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 6404 | + switch (pos_args) { |
| 6405 | case 0: |
| 6406 | if (kw_args > 0) { |
| 6407 | PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mean); |
| 6408 | @@ -12412,7 +12906,7 @@ |
| 6409 | } |
| 6410 | } |
| 6411 | if (unlikely(kw_args > 0)) { |
| 6412 | - 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;} |
| 6413 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lognormal") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2864; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 6414 | } |
| 6415 | } else { |
| 6416 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 6417 | @@ -12435,6 +12929,27 @@ |
| 6418 | __Pyx_RefNannyFinishContext(); |
| 6419 | return NULL; |
| 6420 | __pyx_L4_argument_unpacking_done:; |
| 6421 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_72lognormal(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_mean, __pyx_v_sigma, __pyx_v_size); |
| 6422 | + __Pyx_RefNannyFinishContext(); |
| 6423 | + return __pyx_r; |
| 6424 | +} |
| 6425 | + |
| 6426 | +static PyObject *__pyx_pf_6mtrand_11RandomState_72lognormal(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_mean, PyObject *__pyx_v_sigma, PyObject *__pyx_v_size) { |
| 6427 | + PyArrayObject *__pyx_v_omean = 0; |
| 6428 | + PyArrayObject *__pyx_v_osigma = 0; |
| 6429 | + double __pyx_v_fmean; |
| 6430 | + double __pyx_v_fsigma; |
| 6431 | + PyObject *__pyx_r = NULL; |
| 6432 | + __Pyx_RefNannyDeclarations |
| 6433 | + int __pyx_t_1; |
| 6434 | + PyObject *__pyx_t_2 = NULL; |
| 6435 | + PyObject *__pyx_t_3 = NULL; |
| 6436 | + PyObject *__pyx_t_4 = NULL; |
| 6437 | + PyObject *__pyx_t_5 = NULL; |
| 6438 | + int __pyx_lineno = 0; |
| 6439 | + const char *__pyx_filename = NULL; |
| 6440 | + int __pyx_clineno = 0; |
| 6441 | + __Pyx_RefNannySetupContext("lognormal", 0); |
| 6442 | |
| 6443 | /* "mtrand.pyx":2979 |
| 6444 | * cdef double fmean, fsigma |
| 6445 | @@ -12486,9 +13001,9 @@ |
| 6446 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 6447 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 6448 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 6449 | - goto __pyx_L7; |
| 6450 | + goto __pyx_L4; |
| 6451 | } |
| 6452 | - __pyx_L7:; |
| 6453 | + __pyx_L4:; |
| 6454 | |
| 6455 | /* "mtrand.pyx":2985 |
| 6456 | * if fsigma <= 0: |
| 6457 | @@ -12498,14 +13013,14 @@ |
| 6458 | * PyErr_Clear() |
| 6459 | */ |
| 6460 | __Pyx_XDECREF(__pyx_r); |
| 6461 | - __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;} |
| 6462 | + __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(__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;} |
| 6463 | __Pyx_GOTREF(__pyx_t_2); |
| 6464 | __pyx_r = __pyx_t_2; |
| 6465 | __pyx_t_2 = 0; |
| 6466 | goto __pyx_L0; |
| 6467 | - goto __pyx_L6; |
| 6468 | + goto __pyx_L3; |
| 6469 | } |
| 6470 | - __pyx_L6:; |
| 6471 | + __pyx_L3:; |
| 6472 | |
| 6473 | /* "mtrand.pyx":2987 |
| 6474 | * return cont2_array_sc(self.internal_state, rk_lognormal, size, fmean, fsigma) |
| 6475 | @@ -12562,7 +13077,7 @@ |
| 6476 | __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;} |
| 6477 | __Pyx_GOTREF(__pyx_t_2); |
| 6478 | __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;} |
| 6479 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 6480 | + __Pyx_GOTREF(__pyx_t_5); |
| 6481 | __Pyx_INCREF(((PyObject *)__pyx_v_osigma)); |
| 6482 | PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_osigma)); |
| 6483 | __Pyx_GIVEREF(((PyObject *)__pyx_v_osigma)); |
| 6484 | @@ -12574,7 +13089,7 @@ |
| 6485 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 6486 | __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| 6487 | __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;} |
| 6488 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 6489 | + __Pyx_GOTREF(__pyx_t_5); |
| 6490 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); |
| 6491 | __Pyx_GIVEREF(__pyx_t_2); |
| 6492 | __pyx_t_2 = 0; |
| 6493 | @@ -12598,9 +13113,9 @@ |
| 6494 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 6495 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 6496 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 6497 | - goto __pyx_L8; |
| 6498 | + goto __pyx_L5; |
| 6499 | } |
| 6500 | - __pyx_L8:; |
| 6501 | + __pyx_L5:; |
| 6502 | |
| 6503 | /* "mtrand.pyx":2993 |
| 6504 | * if np.any(np.less_equal(osigma, 0.0)): |
| 6505 | @@ -12610,7 +13125,7 @@ |
| 6506 | * def rayleigh(self, scale=1.0, size=None): |
| 6507 | */ |
| 6508 | __Pyx_XDECREF(__pyx_r); |
| 6509 | - __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;} |
| 6510 | + __pyx_t_2 = __pyx_f_6mtrand_cont2_array(__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;} |
| 6511 | __Pyx_GOTREF(__pyx_t_2); |
| 6512 | __pyx_r = __pyx_t_2; |
| 6513 | __pyx_t_2 = 0; |
| 6514 | @@ -12633,47 +13148,39 @@ |
| 6515 | return __pyx_r; |
| 6516 | } |
| 6517 | |
| 6518 | -/* "mtrand.pyx":2995 |
| 6519 | - * return cont2_array(self.internal_state, rk_lognormal, size, omean, osigma) |
| 6520 | - * |
| 6521 | - * def rayleigh(self, scale=1.0, size=None): # <<<<<<<<<<<<<< |
| 6522 | - * """ |
| 6523 | - * rayleigh(scale=1.0, size=None) |
| 6524 | - */ |
| 6525 | - |
| 6526 | -static PyObject *__pyx_pf_6mtrand_11RandomState_37rayleigh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 6527 | -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 "; |
| 6528 | -static PyObject *__pyx_pf_6mtrand_11RandomState_37rayleigh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 6529 | +/* Python wrapper */ |
| 6530 | +static PyObject *__pyx_pw_6mtrand_11RandomState_75rayleigh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 6531 | +static char __pyx_doc_6mtrand_11RandomState_74rayleigh[] = "\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 "; |
| 6532 | +static PyObject *__pyx_pw_6mtrand_11RandomState_75rayleigh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 6533 | PyObject *__pyx_v_scale = 0; |
| 6534 | PyObject *__pyx_v_size = 0; |
| 6535 | - PyArrayObject *__pyx_v_oscale = 0; |
| 6536 | - double __pyx_v_fscale; |
| 6537 | - PyObject *__pyx_r = NULL; |
| 6538 | + PyObject *__pyx_r = 0; |
| 6539 | __Pyx_RefNannyDeclarations |
| 6540 | - int __pyx_t_1; |
| 6541 | - PyObject *__pyx_t_2 = NULL; |
| 6542 | - PyObject *__pyx_t_3 = NULL; |
| 6543 | - PyObject *__pyx_t_4 = NULL; |
| 6544 | - PyObject *__pyx_t_5 = NULL; |
| 6545 | - int __pyx_lineno = 0; |
| 6546 | - const char *__pyx_filename = NULL; |
| 6547 | - int __pyx_clineno = 0; |
| 6548 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__scale,&__pyx_n_s__size,0}; |
| 6549 | - __Pyx_RefNannySetupContext("rayleigh"); |
| 6550 | + __Pyx_RefNannySetupContext("rayleigh (wrapper)", 0); |
| 6551 | { |
| 6552 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__scale,&__pyx_n_s__size,0}; |
| 6553 | PyObject* values[2] = {0,0}; |
| 6554 | values[0] = __pyx_k_91; |
| 6555 | + |
| 6556 | + /* "mtrand.pyx":2995 |
| 6557 | + * return cont2_array(self.internal_state, rk_lognormal, size, omean, osigma) |
| 6558 | + * |
| 6559 | + * def rayleigh(self, scale=1.0, size=None): # <<<<<<<<<<<<<< |
| 6560 | + * """ |
| 6561 | + * rayleigh(scale=1.0, size=None) |
| 6562 | + */ |
| 6563 | values[1] = ((PyObject *)Py_None); |
| 6564 | if (unlikely(__pyx_kwds)) { |
| 6565 | Py_ssize_t kw_args; |
| 6566 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 6567 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 6568 | + switch (pos_args) { |
| 6569 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 6570 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 6571 | case 0: break; |
| 6572 | default: goto __pyx_L5_argtuple_error; |
| 6573 | } |
| 6574 | kw_args = PyDict_Size(__pyx_kwds); |
| 6575 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 6576 | + switch (pos_args) { |
| 6577 | case 0: |
| 6578 | if (kw_args > 0) { |
| 6579 | PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scale); |
| 6580 | @@ -12686,7 +13193,7 @@ |
| 6581 | } |
| 6582 | } |
| 6583 | if (unlikely(kw_args > 0)) { |
| 6584 | - 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;} |
| 6585 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rayleigh") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2995; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 6586 | } |
| 6587 | } else { |
| 6588 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 6589 | @@ -12707,6 +13214,25 @@ |
| 6590 | __Pyx_RefNannyFinishContext(); |
| 6591 | return NULL; |
| 6592 | __pyx_L4_argument_unpacking_done:; |
| 6593 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_74rayleigh(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_scale, __pyx_v_size); |
| 6594 | + __Pyx_RefNannyFinishContext(); |
| 6595 | + return __pyx_r; |
| 6596 | +} |
| 6597 | + |
| 6598 | +static PyObject *__pyx_pf_6mtrand_11RandomState_74rayleigh(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_scale, PyObject *__pyx_v_size) { |
| 6599 | + PyArrayObject *__pyx_v_oscale = 0; |
| 6600 | + double __pyx_v_fscale; |
| 6601 | + PyObject *__pyx_r = NULL; |
| 6602 | + __Pyx_RefNannyDeclarations |
| 6603 | + int __pyx_t_1; |
| 6604 | + PyObject *__pyx_t_2 = NULL; |
| 6605 | + PyObject *__pyx_t_3 = NULL; |
| 6606 | + PyObject *__pyx_t_4 = NULL; |
| 6607 | + PyObject *__pyx_t_5 = NULL; |
| 6608 | + int __pyx_lineno = 0; |
| 6609 | + const char *__pyx_filename = NULL; |
| 6610 | + int __pyx_clineno = 0; |
| 6611 | + __Pyx_RefNannySetupContext("rayleigh", 0); |
| 6612 | |
| 6613 | /* "mtrand.pyx":3053 |
| 6614 | * cdef double fscale |
| 6615 | @@ -12749,9 +13275,9 @@ |
| 6616 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 6617 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 6618 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3057; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 6619 | - goto __pyx_L7; |
| 6620 | + goto __pyx_L4; |
| 6621 | } |
| 6622 | - __pyx_L7:; |
| 6623 | + __pyx_L4:; |
| 6624 | |
| 6625 | /* "mtrand.pyx":3058 |
| 6626 | * if fscale <= 0: |
| 6627 | @@ -12761,14 +13287,14 @@ |
| 6628 | * PyErr_Clear() |
| 6629 | */ |
| 6630 | __Pyx_XDECREF(__pyx_r); |
| 6631 | - __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;} |
| 6632 | + __pyx_t_2 = __pyx_f_6mtrand_cont1_array_sc(__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;} |
| 6633 | __Pyx_GOTREF(__pyx_t_2); |
| 6634 | __pyx_r = __pyx_t_2; |
| 6635 | __pyx_t_2 = 0; |
| 6636 | goto __pyx_L0; |
| 6637 | - goto __pyx_L6; |
| 6638 | + goto __pyx_L3; |
| 6639 | } |
| 6640 | - __pyx_L6:; |
| 6641 | + __pyx_L3:; |
| 6642 | |
| 6643 | /* "mtrand.pyx":3060 |
| 6644 | * return cont1_array_sc(self.internal_state, rk_rayleigh, size, fscale) |
| 6645 | @@ -12812,7 +13338,7 @@ |
| 6646 | __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;} |
| 6647 | __Pyx_GOTREF(__pyx_t_2); |
| 6648 | __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;} |
| 6649 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 6650 | + __Pyx_GOTREF(__pyx_t_5); |
| 6651 | __Pyx_INCREF(((PyObject *)__pyx_v_oscale)); |
| 6652 | PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_oscale)); |
| 6653 | __Pyx_GIVEREF(((PyObject *)__pyx_v_oscale)); |
| 6654 | @@ -12824,7 +13350,7 @@ |
| 6655 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 6656 | __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| 6657 | __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;} |
| 6658 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 6659 | + __Pyx_GOTREF(__pyx_t_5); |
| 6660 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); |
| 6661 | __Pyx_GIVEREF(__pyx_t_2); |
| 6662 | __pyx_t_2 = 0; |
| 6663 | @@ -12848,9 +13374,9 @@ |
| 6664 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 6665 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 6666 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 6667 | - goto __pyx_L8; |
| 6668 | + goto __pyx_L5; |
| 6669 | } |
| 6670 | - __pyx_L8:; |
| 6671 | + __pyx_L5:; |
| 6672 | |
| 6673 | /* "mtrand.pyx":3065 |
| 6674 | * if np.any(np.less_equal(oscale, 0.0)): |
| 6675 | @@ -12860,7 +13386,7 @@ |
| 6676 | * def wald(self, mean, scale, size=None): |
| 6677 | */ |
| 6678 | __Pyx_XDECREF(__pyx_r); |
| 6679 | - __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;} |
| 6680 | + __pyx_t_2 = __pyx_f_6mtrand_cont1_array(__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;} |
| 6681 | __Pyx_GOTREF(__pyx_t_2); |
| 6682 | __pyx_r = __pyx_t_2; |
| 6683 | __pyx_t_2 = 0; |
| 6684 | @@ -12882,42 +13408,32 @@ |
| 6685 | return __pyx_r; |
| 6686 | } |
| 6687 | |
| 6688 | -/* "mtrand.pyx":3067 |
| 6689 | - * return cont1_array(self.internal_state, rk_rayleigh, size, oscale) |
| 6690 | - * |
| 6691 | - * def wald(self, mean, scale, size=None): # <<<<<<<<<<<<<< |
| 6692 | - * """ |
| 6693 | - * wald(mean, scale, size=None) |
| 6694 | - */ |
| 6695 | - |
| 6696 | -static PyObject *__pyx_pf_6mtrand_11RandomState_38wald(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 6697 | -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 "; |
| 6698 | -static PyObject *__pyx_pf_6mtrand_11RandomState_38wald(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 6699 | +/* Python wrapper */ |
| 6700 | +static PyObject *__pyx_pw_6mtrand_11RandomState_77wald(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 6701 | +static char __pyx_doc_6mtrand_11RandomState_76wald[] = "\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 "; |
| 6702 | +static PyObject *__pyx_pw_6mtrand_11RandomState_77wald(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 6703 | PyObject *__pyx_v_mean = 0; |
| 6704 | PyObject *__pyx_v_scale = 0; |
| 6705 | PyObject *__pyx_v_size = 0; |
| 6706 | - PyArrayObject *__pyx_v_omean = 0; |
| 6707 | - PyArrayObject *__pyx_v_oscale = 0; |
| 6708 | - double __pyx_v_fmean; |
| 6709 | - double __pyx_v_fscale; |
| 6710 | - PyObject *__pyx_r = NULL; |
| 6711 | + PyObject *__pyx_r = 0; |
| 6712 | __Pyx_RefNannyDeclarations |
| 6713 | - int __pyx_t_1; |
| 6714 | - PyObject *__pyx_t_2 = NULL; |
| 6715 | - PyObject *__pyx_t_3 = NULL; |
| 6716 | - PyObject *__pyx_t_4 = NULL; |
| 6717 | - PyObject *__pyx_t_5 = NULL; |
| 6718 | - int __pyx_lineno = 0; |
| 6719 | - const char *__pyx_filename = NULL; |
| 6720 | - int __pyx_clineno = 0; |
| 6721 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__mean,&__pyx_n_s__scale,&__pyx_n_s__size,0}; |
| 6722 | - __Pyx_RefNannySetupContext("wald"); |
| 6723 | + __Pyx_RefNannySetupContext("wald (wrapper)", 0); |
| 6724 | { |
| 6725 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__mean,&__pyx_n_s__scale,&__pyx_n_s__size,0}; |
| 6726 | PyObject* values[3] = {0,0,0}; |
| 6727 | + |
| 6728 | + /* "mtrand.pyx":3067 |
| 6729 | + * return cont1_array(self.internal_state, rk_rayleigh, size, oscale) |
| 6730 | + * |
| 6731 | + * def wald(self, mean, scale, size=None): # <<<<<<<<<<<<<< |
| 6732 | + * """ |
| 6733 | + * wald(mean, scale, size=None) |
| 6734 | + */ |
| 6735 | values[2] = ((PyObject *)Py_None); |
| 6736 | if (unlikely(__pyx_kwds)) { |
| 6737 | Py_ssize_t kw_args; |
| 6738 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 6739 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 6740 | + switch (pos_args) { |
| 6741 | case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); |
| 6742 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 6743 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 6744 | @@ -12925,14 +13441,12 @@ |
| 6745 | default: goto __pyx_L5_argtuple_error; |
| 6746 | } |
| 6747 | kw_args = PyDict_Size(__pyx_kwds); |
| 6748 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 6749 | + switch (pos_args) { |
| 6750 | case 0: |
| 6751 | - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mean); |
| 6752 | - if (likely(values[0])) kw_args--; |
| 6753 | + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mean)) != 0)) kw_args--; |
| 6754 | else goto __pyx_L5_argtuple_error; |
| 6755 | case 1: |
| 6756 | - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scale); |
| 6757 | - if (likely(values[1])) kw_args--; |
| 6758 | + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scale)) != 0)) kw_args--; |
| 6759 | else { |
| 6760 | __Pyx_RaiseArgtupleInvalid("wald", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3067; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 6761 | } |
| 6762 | @@ -12943,7 +13457,7 @@ |
| 6763 | } |
| 6764 | } |
| 6765 | if (unlikely(kw_args > 0)) { |
| 6766 | - 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;} |
| 6767 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "wald") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3067; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 6768 | } |
| 6769 | } else { |
| 6770 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 6771 | @@ -12966,6 +13480,27 @@ |
| 6772 | __Pyx_RefNannyFinishContext(); |
| 6773 | return NULL; |
| 6774 | __pyx_L4_argument_unpacking_done:; |
| 6775 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_76wald(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_mean, __pyx_v_scale, __pyx_v_size); |
| 6776 | + __Pyx_RefNannyFinishContext(); |
| 6777 | + return __pyx_r; |
| 6778 | +} |
| 6779 | + |
| 6780 | +static PyObject *__pyx_pf_6mtrand_11RandomState_76wald(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_mean, PyObject *__pyx_v_scale, PyObject *__pyx_v_size) { |
| 6781 | + PyArrayObject *__pyx_v_omean = 0; |
| 6782 | + PyArrayObject *__pyx_v_oscale = 0; |
| 6783 | + double __pyx_v_fmean; |
| 6784 | + double __pyx_v_fscale; |
| 6785 | + PyObject *__pyx_r = NULL; |
| 6786 | + __Pyx_RefNannyDeclarations |
| 6787 | + int __pyx_t_1; |
| 6788 | + PyObject *__pyx_t_2 = NULL; |
| 6789 | + PyObject *__pyx_t_3 = NULL; |
| 6790 | + PyObject *__pyx_t_4 = NULL; |
| 6791 | + PyObject *__pyx_t_5 = NULL; |
| 6792 | + int __pyx_lineno = 0; |
| 6793 | + const char *__pyx_filename = NULL; |
| 6794 | + int __pyx_clineno = 0; |
| 6795 | + __Pyx_RefNannySetupContext("wald", 0); |
| 6796 | |
| 6797 | /* "mtrand.pyx":3133 |
| 6798 | * cdef double fmean, fscale |
| 6799 | @@ -13017,9 +13552,9 @@ |
| 6800 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 6801 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 6802 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 6803 | - goto __pyx_L7; |
| 6804 | + goto __pyx_L4; |
| 6805 | } |
| 6806 | - __pyx_L7:; |
| 6807 | + __pyx_L4:; |
| 6808 | |
| 6809 | /* "mtrand.pyx":3138 |
| 6810 | * if fmean <= 0: |
| 6811 | @@ -13043,9 +13578,9 @@ |
| 6812 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 6813 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 6814 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 6815 | - goto __pyx_L8; |
| 6816 | + goto __pyx_L5; |
| 6817 | } |
| 6818 | - __pyx_L8:; |
| 6819 | + __pyx_L5:; |
| 6820 | |
| 6821 | /* "mtrand.pyx":3140 |
| 6822 | * if fscale <= 0: |
| 6823 | @@ -13055,14 +13590,14 @@ |
| 6824 | * PyErr_Clear() |
| 6825 | */ |
| 6826 | __Pyx_XDECREF(__pyx_r); |
| 6827 | - __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;} |
| 6828 | + __pyx_t_2 = __pyx_f_6mtrand_cont2_array_sc(__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;} |
| 6829 | __Pyx_GOTREF(__pyx_t_2); |
| 6830 | __pyx_r = __pyx_t_2; |
| 6831 | __pyx_t_2 = 0; |
| 6832 | goto __pyx_L0; |
| 6833 | - goto __pyx_L6; |
| 6834 | + goto __pyx_L3; |
| 6835 | } |
| 6836 | - __pyx_L6:; |
| 6837 | + __pyx_L3:; |
| 6838 | |
| 6839 | /* "mtrand.pyx":3142 |
| 6840 | * return cont2_array_sc(self.internal_state, rk_wald, size, fmean, fscale) |
| 6841 | @@ -13119,7 +13654,7 @@ |
| 6842 | __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;} |
| 6843 | __Pyx_GOTREF(__pyx_t_2); |
| 6844 | __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;} |
| 6845 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 6846 | + __Pyx_GOTREF(__pyx_t_5); |
| 6847 | __Pyx_INCREF(((PyObject *)__pyx_v_omean)); |
| 6848 | PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_omean)); |
| 6849 | __Pyx_GIVEREF(((PyObject *)__pyx_v_omean)); |
| 6850 | @@ -13131,7 +13666,7 @@ |
| 6851 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 6852 | __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| 6853 | __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;} |
| 6854 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 6855 | + __Pyx_GOTREF(__pyx_t_5); |
| 6856 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); |
| 6857 | __Pyx_GIVEREF(__pyx_t_2); |
| 6858 | __pyx_t_2 = 0; |
| 6859 | @@ -13155,7 +13690,7 @@ |
| 6860 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 6861 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 6862 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 6863 | - goto __pyx_L9; |
| 6864 | + goto __pyx_L6; |
| 6865 | } |
| 6866 | |
| 6867 | /* "mtrand.pyx":3147 |
| 6868 | @@ -13178,7 +13713,7 @@ |
| 6869 | __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;} |
| 6870 | __Pyx_GOTREF(__pyx_t_2); |
| 6871 | __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;} |
| 6872 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 6873 | + __Pyx_GOTREF(__pyx_t_4); |
| 6874 | __Pyx_INCREF(((PyObject *)__pyx_v_oscale)); |
| 6875 | PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_oscale)); |
| 6876 | __Pyx_GIVEREF(((PyObject *)__pyx_v_oscale)); |
| 6877 | @@ -13190,7 +13725,7 @@ |
| 6878 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 6879 | __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; |
| 6880 | __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;} |
| 6881 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 6882 | + __Pyx_GOTREF(__pyx_t_4); |
| 6883 | PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); |
| 6884 | __Pyx_GIVEREF(__pyx_t_2); |
| 6885 | __pyx_t_2 = 0; |
| 6886 | @@ -13214,9 +13749,9 @@ |
| 6887 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 6888 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 6889 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 6890 | - goto __pyx_L9; |
| 6891 | + goto __pyx_L6; |
| 6892 | } |
| 6893 | - __pyx_L9:; |
| 6894 | + __pyx_L6:; |
| 6895 | |
| 6896 | /* "mtrand.pyx":3149 |
| 6897 | * elif np.any(np.less_equal(oscale,0.0)): |
| 6898 | @@ -13226,7 +13761,7 @@ |
| 6899 | * |
| 6900 | */ |
| 6901 | __Pyx_XDECREF(__pyx_r); |
| 6902 | - __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;} |
| 6903 | + __pyx_t_2 = __pyx_f_6mtrand_cont2_array(__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;} |
| 6904 | __Pyx_GOTREF(__pyx_t_2); |
| 6905 | __pyx_r = __pyx_t_2; |
| 6906 | __pyx_t_2 = 0; |
| 6907 | @@ -13249,45 +13784,33 @@ |
| 6908 | return __pyx_r; |
| 6909 | } |
| 6910 | |
| 6911 | -/* "mtrand.pyx":3153 |
| 6912 | - * |
| 6913 | - * |
| 6914 | - * def triangular(self, left, mode, right, size=None): # <<<<<<<<<<<<<< |
| 6915 | - * """ |
| 6916 | - * triangular(left, mode, right, size=None) |
| 6917 | - */ |
| 6918 | - |
| 6919 | -static PyObject *__pyx_pf_6mtrand_11RandomState_39triangular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 6920 | -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 "; |
| 6921 | -static PyObject *__pyx_pf_6mtrand_11RandomState_39triangular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 6922 | +/* Python wrapper */ |
| 6923 | +static PyObject *__pyx_pw_6mtrand_11RandomState_79triangular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 6924 | +static char __pyx_doc_6mtrand_11RandomState_78triangular[] = "\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 "; |
| 6925 | +static PyObject *__pyx_pw_6mtrand_11RandomState_79triangular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 6926 | PyObject *__pyx_v_left = 0; |
| 6927 | PyObject *__pyx_v_mode = 0; |
| 6928 | PyObject *__pyx_v_right = 0; |
| 6929 | PyObject *__pyx_v_size = 0; |
| 6930 | - PyArrayObject *__pyx_v_oleft = 0; |
| 6931 | - PyArrayObject *__pyx_v_omode = 0; |
| 6932 | - PyArrayObject *__pyx_v_oright = 0; |
| 6933 | - double __pyx_v_fleft; |
| 6934 | - double __pyx_v_fmode; |
| 6935 | - double __pyx_v_fright; |
| 6936 | - PyObject *__pyx_r = NULL; |
| 6937 | + PyObject *__pyx_r = 0; |
| 6938 | __Pyx_RefNannyDeclarations |
| 6939 | - int __pyx_t_1; |
| 6940 | - PyObject *__pyx_t_2 = NULL; |
| 6941 | - PyObject *__pyx_t_3 = NULL; |
| 6942 | - PyObject *__pyx_t_4 = NULL; |
| 6943 | - PyObject *__pyx_t_5 = NULL; |
| 6944 | - int __pyx_lineno = 0; |
| 6945 | - const char *__pyx_filename = NULL; |
| 6946 | - int __pyx_clineno = 0; |
| 6947 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left,&__pyx_n_s__mode,&__pyx_n_s__right,&__pyx_n_s__size,0}; |
| 6948 | - __Pyx_RefNannySetupContext("triangular"); |
| 6949 | + __Pyx_RefNannySetupContext("triangular (wrapper)", 0); |
| 6950 | { |
| 6951 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left,&__pyx_n_s__mode,&__pyx_n_s__right,&__pyx_n_s__size,0}; |
| 6952 | PyObject* values[4] = {0,0,0,0}; |
| 6953 | + |
| 6954 | + /* "mtrand.pyx":3153 |
| 6955 | + * |
| 6956 | + * |
| 6957 | + * def triangular(self, left, mode, right, size=None): # <<<<<<<<<<<<<< |
| 6958 | + * """ |
| 6959 | + * triangular(left, mode, right, size=None) |
| 6960 | + */ |
| 6961 | values[3] = ((PyObject *)Py_None); |
| 6962 | if (unlikely(__pyx_kwds)) { |
| 6963 | Py_ssize_t kw_args; |
| 6964 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 6965 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 6966 | + switch (pos_args) { |
| 6967 | case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); |
| 6968 | case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); |
| 6969 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 6970 | @@ -13296,20 +13819,17 @@ |
| 6971 | default: goto __pyx_L5_argtuple_error; |
| 6972 | } |
| 6973 | kw_args = PyDict_Size(__pyx_kwds); |
| 6974 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 6975 | + switch (pos_args) { |
| 6976 | case 0: |
| 6977 | - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left); |
| 6978 | - if (likely(values[0])) kw_args--; |
| 6979 | + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left)) != 0)) kw_args--; |
| 6980 | else goto __pyx_L5_argtuple_error; |
| 6981 | case 1: |
| 6982 | - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mode); |
| 6983 | - if (likely(values[1])) kw_args--; |
| 6984 | + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mode)) != 0)) kw_args--; |
| 6985 | else { |
| 6986 | __Pyx_RaiseArgtupleInvalid("triangular", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 6987 | } |
| 6988 | case 2: |
| 6989 | - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right); |
| 6990 | - if (likely(values[2])) kw_args--; |
| 6991 | + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right)) != 0)) kw_args--; |
| 6992 | else { |
| 6993 | __Pyx_RaiseArgtupleInvalid("triangular", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 6994 | } |
| 6995 | @@ -13320,7 +13840,7 @@ |
| 6996 | } |
| 6997 | } |
| 6998 | if (unlikely(kw_args > 0)) { |
| 6999 | - 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;} |
| 7000 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "triangular") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 7001 | } |
| 7002 | } else { |
| 7003 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 7004 | @@ -13345,6 +13865,29 @@ |
| 7005 | __Pyx_RefNannyFinishContext(); |
| 7006 | return NULL; |
| 7007 | __pyx_L4_argument_unpacking_done:; |
| 7008 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_78triangular(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_left, __pyx_v_mode, __pyx_v_right, __pyx_v_size); |
| 7009 | + __Pyx_RefNannyFinishContext(); |
| 7010 | + return __pyx_r; |
| 7011 | +} |
| 7012 | + |
| 7013 | +static PyObject *__pyx_pf_6mtrand_11RandomState_78triangular(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_left, PyObject *__pyx_v_mode, PyObject *__pyx_v_right, PyObject *__pyx_v_size) { |
| 7014 | + PyArrayObject *__pyx_v_oleft = 0; |
| 7015 | + PyArrayObject *__pyx_v_omode = 0; |
| 7016 | + PyArrayObject *__pyx_v_oright = 0; |
| 7017 | + double __pyx_v_fleft; |
| 7018 | + double __pyx_v_fmode; |
| 7019 | + double __pyx_v_fright; |
| 7020 | + PyObject *__pyx_r = NULL; |
| 7021 | + __Pyx_RefNannyDeclarations |
| 7022 | + int __pyx_t_1; |
| 7023 | + PyObject *__pyx_t_2 = NULL; |
| 7024 | + PyObject *__pyx_t_3 = NULL; |
| 7025 | + PyObject *__pyx_t_4 = NULL; |
| 7026 | + PyObject *__pyx_t_5 = NULL; |
| 7027 | + int __pyx_lineno = 0; |
| 7028 | + const char *__pyx_filename = NULL; |
| 7029 | + int __pyx_clineno = 0; |
| 7030 | + __Pyx_RefNannySetupContext("triangular", 0); |
| 7031 | |
| 7032 | /* "mtrand.pyx":3213 |
| 7033 | * cdef double fleft, fmode, fright |
| 7034 | @@ -13405,9 +13948,9 @@ |
| 7035 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 7036 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 7037 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 7038 | - goto __pyx_L7; |
| 7039 | + goto __pyx_L4; |
| 7040 | } |
| 7041 | - __pyx_L7:; |
| 7042 | + __pyx_L4:; |
| 7043 | |
| 7044 | /* "mtrand.pyx":3219 |
| 7045 | * if fleft > fmode: |
| 7046 | @@ -13431,9 +13974,9 @@ |
| 7047 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 7048 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 7049 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 7050 | - goto __pyx_L8; |
| 7051 | + goto __pyx_L5; |
| 7052 | } |
| 7053 | - __pyx_L8:; |
| 7054 | + __pyx_L5:; |
| 7055 | |
| 7056 | /* "mtrand.pyx":3221 |
| 7057 | * if fmode > fright: |
| 7058 | @@ -13457,9 +14000,9 @@ |
| 7059 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 7060 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 7061 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 7062 | - goto __pyx_L9; |
| 7063 | + goto __pyx_L6; |
| 7064 | } |
| 7065 | - __pyx_L9:; |
| 7066 | + __pyx_L6:; |
| 7067 | |
| 7068 | /* "mtrand.pyx":3223 |
| 7069 | * if fleft == fright: |
| 7070 | @@ -13477,14 +14020,14 @@ |
| 7071 | * |
| 7072 | * PyErr_Clear() |
| 7073 | */ |
| 7074 | - __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;} |
| 7075 | + __pyx_t_2 = __pyx_f_6mtrand_cont3_array_sc(__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;} |
| 7076 | __Pyx_GOTREF(__pyx_t_2); |
| 7077 | __pyx_r = __pyx_t_2; |
| 7078 | __pyx_t_2 = 0; |
| 7079 | goto __pyx_L0; |
| 7080 | - goto __pyx_L6; |
| 7081 | + goto __pyx_L3; |
| 7082 | } |
| 7083 | - __pyx_L6:; |
| 7084 | + __pyx_L3:; |
| 7085 | |
| 7086 | /* "mtrand.pyx":3226 |
| 7087 | * fmode, fright) |
| 7088 | @@ -13552,7 +14095,7 @@ |
| 7089 | __Pyx_GOTREF(__pyx_t_4); |
| 7090 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 7091 | __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;} |
| 7092 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 7093 | + __Pyx_GOTREF(__pyx_t_2); |
| 7094 | __Pyx_INCREF(((PyObject *)__pyx_v_oleft)); |
| 7095 | PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_oleft)); |
| 7096 | __Pyx_GIVEREF(((PyObject *)__pyx_v_oleft)); |
| 7097 | @@ -13564,7 +14107,7 @@ |
| 7098 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 7099 | __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; |
| 7100 | __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;} |
| 7101 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 7102 | + __Pyx_GOTREF(__pyx_t_2); |
| 7103 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); |
| 7104 | __Pyx_GIVEREF(__pyx_t_5); |
| 7105 | __pyx_t_5 = 0; |
| 7106 | @@ -13588,9 +14131,9 @@ |
| 7107 | __Pyx_Raise(__pyx_t_5, 0, 0, 0); |
| 7108 | __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| 7109 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 7110 | - goto __pyx_L10; |
| 7111 | + goto __pyx_L7; |
| 7112 | } |
| 7113 | - __pyx_L10:; |
| 7114 | + __pyx_L7:; |
| 7115 | |
| 7116 | /* "mtrand.pyx":3233 |
| 7117 | * if np.any(np.greater(oleft, omode)): |
| 7118 | @@ -13610,7 +14153,7 @@ |
| 7119 | __Pyx_GOTREF(__pyx_t_3); |
| 7120 | __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| 7121 | __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;} |
| 7122 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 7123 | + __Pyx_GOTREF(__pyx_t_5); |
| 7124 | __Pyx_INCREF(((PyObject *)__pyx_v_omode)); |
| 7125 | PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_omode)); |
| 7126 | __Pyx_GIVEREF(((PyObject *)__pyx_v_omode)); |
| 7127 | @@ -13622,7 +14165,7 @@ |
| 7128 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 7129 | __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| 7130 | __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;} |
| 7131 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 7132 | + __Pyx_GOTREF(__pyx_t_5); |
| 7133 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); |
| 7134 | __Pyx_GIVEREF(__pyx_t_4); |
| 7135 | __pyx_t_4 = 0; |
| 7136 | @@ -13646,9 +14189,9 @@ |
| 7137 | __Pyx_Raise(__pyx_t_4, 0, 0, 0); |
| 7138 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 7139 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 7140 | - goto __pyx_L11; |
| 7141 | + goto __pyx_L8; |
| 7142 | } |
| 7143 | - __pyx_L11:; |
| 7144 | + __pyx_L8:; |
| 7145 | |
| 7146 | /* "mtrand.pyx":3235 |
| 7147 | * if np.any(np.greater(omode, oright)): |
| 7148 | @@ -13668,7 +14211,7 @@ |
| 7149 | __Pyx_GOTREF(__pyx_t_2); |
| 7150 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 7151 | __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;} |
| 7152 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 7153 | + __Pyx_GOTREF(__pyx_t_4); |
| 7154 | __Pyx_INCREF(((PyObject *)__pyx_v_oleft)); |
| 7155 | PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_oleft)); |
| 7156 | __Pyx_GIVEREF(((PyObject *)__pyx_v_oleft)); |
| 7157 | @@ -13680,7 +14223,7 @@ |
| 7158 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 7159 | __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; |
| 7160 | __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;} |
| 7161 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 7162 | + __Pyx_GOTREF(__pyx_t_4); |
| 7163 | PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); |
| 7164 | __Pyx_GIVEREF(__pyx_t_3); |
| 7165 | __pyx_t_3 = 0; |
| 7166 | @@ -13704,9 +14247,9 @@ |
| 7167 | __Pyx_Raise(__pyx_t_3, 0, 0, 0); |
| 7168 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 7169 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 7170 | - goto __pyx_L12; |
| 7171 | + goto __pyx_L9; |
| 7172 | } |
| 7173 | - __pyx_L12:; |
| 7174 | + __pyx_L9:; |
| 7175 | |
| 7176 | /* "mtrand.pyx":3237 |
| 7177 | * if np.any(np.equal(oleft, oright)): |
| 7178 | @@ -13724,7 +14267,7 @@ |
| 7179 | * |
| 7180 | * # Complicated, discrete distributions: |
| 7181 | */ |
| 7182 | - __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;} |
| 7183 | + __pyx_t_3 = __pyx_f_6mtrand_cont3_array(__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;} |
| 7184 | __Pyx_GOTREF(__pyx_t_3); |
| 7185 | __pyx_r = __pyx_t_3; |
| 7186 | __pyx_t_3 = 0; |
| 7187 | @@ -13748,42 +14291,32 @@ |
| 7188 | return __pyx_r; |
| 7189 | } |
| 7190 | |
| 7191 | -/* "mtrand.pyx":3241 |
| 7192 | - * |
| 7193 | - * # Complicated, discrete distributions: |
| 7194 | - * def binomial(self, n, p, size=None): # <<<<<<<<<<<<<< |
| 7195 | - * """ |
| 7196 | - * binomial(n, p, size=None) |
| 7197 | - */ |
| 7198 | - |
| 7199 | -static PyObject *__pyx_pf_6mtrand_11RandomState_40binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 7200 | -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 "; |
| 7201 | -static PyObject *__pyx_pf_6mtrand_11RandomState_40binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 7202 | +/* Python wrapper */ |
| 7203 | +static PyObject *__pyx_pw_6mtrand_11RandomState_81binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 7204 | +static char __pyx_doc_6mtrand_11RandomState_80binomial[] = "\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 "; |
| 7205 | +static PyObject *__pyx_pw_6mtrand_11RandomState_81binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 7206 | PyObject *__pyx_v_n = 0; |
| 7207 | PyObject *__pyx_v_p = 0; |
| 7208 | PyObject *__pyx_v_size = 0; |
| 7209 | - PyArrayObject *__pyx_v_on = 0; |
| 7210 | - PyArrayObject *__pyx_v_op = 0; |
| 7211 | - long __pyx_v_ln; |
| 7212 | - double __pyx_v_fp; |
| 7213 | - PyObject *__pyx_r = NULL; |
| 7214 | + PyObject *__pyx_r = 0; |
| 7215 | __Pyx_RefNannyDeclarations |
| 7216 | - int __pyx_t_1; |
| 7217 | - PyObject *__pyx_t_2 = NULL; |
| 7218 | - PyObject *__pyx_t_3 = NULL; |
| 7219 | - PyObject *__pyx_t_4 = NULL; |
| 7220 | - PyObject *__pyx_t_5 = NULL; |
| 7221 | - int __pyx_lineno = 0; |
| 7222 | - const char *__pyx_filename = NULL; |
| 7223 | - int __pyx_clineno = 0; |
| 7224 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n,&__pyx_n_s__p,&__pyx_n_s__size,0}; |
| 7225 | - __Pyx_RefNannySetupContext("binomial"); |
| 7226 | + __Pyx_RefNannySetupContext("binomial (wrapper)", 0); |
| 7227 | { |
| 7228 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n,&__pyx_n_s__p,&__pyx_n_s__size,0}; |
| 7229 | PyObject* values[3] = {0,0,0}; |
| 7230 | + |
| 7231 | + /* "mtrand.pyx":3241 |
| 7232 | + * |
| 7233 | + * # Complicated, discrete distributions: |
| 7234 | + * def binomial(self, n, p, size=None): # <<<<<<<<<<<<<< |
| 7235 | + * """ |
| 7236 | + * binomial(n, p, size=None) |
| 7237 | + */ |
| 7238 | values[2] = ((PyObject *)Py_None); |
| 7239 | if (unlikely(__pyx_kwds)) { |
| 7240 | Py_ssize_t kw_args; |
| 7241 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 7242 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 7243 | + switch (pos_args) { |
| 7244 | case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); |
| 7245 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 7246 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 7247 | @@ -13791,14 +14324,12 @@ |
| 7248 | default: goto __pyx_L5_argtuple_error; |
| 7249 | } |
| 7250 | kw_args = PyDict_Size(__pyx_kwds); |
| 7251 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 7252 | + switch (pos_args) { |
| 7253 | case 0: |
| 7254 | - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); |
| 7255 | - if (likely(values[0])) kw_args--; |
| 7256 | + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n)) != 0)) kw_args--; |
| 7257 | else goto __pyx_L5_argtuple_error; |
| 7258 | case 1: |
| 7259 | - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); |
| 7260 | - if (likely(values[1])) kw_args--; |
| 7261 | + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; |
| 7262 | else { |
| 7263 | __Pyx_RaiseArgtupleInvalid("binomial", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3241; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 7264 | } |
| 7265 | @@ -13809,7 +14340,7 @@ |
| 7266 | } |
| 7267 | } |
| 7268 | if (unlikely(kw_args > 0)) { |
| 7269 | - 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;} |
| 7270 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "binomial") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3241; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 7271 | } |
| 7272 | } else { |
| 7273 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 7274 | @@ -13832,6 +14363,27 @@ |
| 7275 | __Pyx_RefNannyFinishContext(); |
| 7276 | return NULL; |
| 7277 | __pyx_L4_argument_unpacking_done:; |
| 7278 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_80binomial(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_n, __pyx_v_p, __pyx_v_size); |
| 7279 | + __Pyx_RefNannyFinishContext(); |
| 7280 | + return __pyx_r; |
| 7281 | +} |
| 7282 | + |
| 7283 | +static PyObject *__pyx_pf_6mtrand_11RandomState_80binomial(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_p, PyObject *__pyx_v_size) { |
| 7284 | + PyArrayObject *__pyx_v_on = 0; |
| 7285 | + PyArrayObject *__pyx_v_op = 0; |
| 7286 | + long __pyx_v_ln; |
| 7287 | + double __pyx_v_fp; |
| 7288 | + PyObject *__pyx_r = NULL; |
| 7289 | + __Pyx_RefNannyDeclarations |
| 7290 | + int __pyx_t_1; |
| 7291 | + PyObject *__pyx_t_2 = NULL; |
| 7292 | + PyObject *__pyx_t_3 = NULL; |
| 7293 | + PyObject *__pyx_t_4 = NULL; |
| 7294 | + PyObject *__pyx_t_5 = NULL; |
| 7295 | + int __pyx_lineno = 0; |
| 7296 | + const char *__pyx_filename = NULL; |
| 7297 | + int __pyx_clineno = 0; |
| 7298 | + __Pyx_RefNannySetupContext("binomial", 0); |
| 7299 | |
| 7300 | /* "mtrand.pyx":3326 |
| 7301 | * cdef double fp |
| 7302 | @@ -13883,9 +14435,9 @@ |
| 7303 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 7304 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 7305 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 7306 | - goto __pyx_L7; |
| 7307 | + goto __pyx_L4; |
| 7308 | } |
| 7309 | - __pyx_L7:; |
| 7310 | + __pyx_L4:; |
| 7311 | |
| 7312 | /* "mtrand.pyx":3331 |
| 7313 | * if ln <= 0: |
| 7314 | @@ -13909,7 +14461,7 @@ |
| 7315 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 7316 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 7317 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 7318 | - goto __pyx_L8; |
| 7319 | + goto __pyx_L5; |
| 7320 | } |
| 7321 | |
| 7322 | /* "mtrand.pyx":3333 |
| 7323 | @@ -13934,9 +14486,9 @@ |
| 7324 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 7325 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 7326 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 7327 | - goto __pyx_L8; |
| 7328 | + goto __pyx_L5; |
| 7329 | } |
| 7330 | - __pyx_L8:; |
| 7331 | + __pyx_L5:; |
| 7332 | |
| 7333 | /* "mtrand.pyx":3335 |
| 7334 | * elif fp > 1: |
| 7335 | @@ -13946,14 +14498,14 @@ |
| 7336 | * PyErr_Clear() |
| 7337 | */ |
| 7338 | __Pyx_XDECREF(__pyx_r); |
| 7339 | - __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;} |
| 7340 | + __pyx_t_2 = __pyx_f_6mtrand_discnp_array_sc(__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;} |
| 7341 | __Pyx_GOTREF(__pyx_t_2); |
| 7342 | __pyx_r = __pyx_t_2; |
| 7343 | __pyx_t_2 = 0; |
| 7344 | goto __pyx_L0; |
| 7345 | - goto __pyx_L6; |
| 7346 | + goto __pyx_L3; |
| 7347 | } |
| 7348 | - __pyx_L6:; |
| 7349 | + __pyx_L3:; |
| 7350 | |
| 7351 | /* "mtrand.pyx":3337 |
| 7352 | * return discnp_array_sc(self.internal_state, rk_binomial, size, ln, fp) |
| 7353 | @@ -14008,7 +14560,7 @@ |
| 7354 | __Pyx_GOTREF(__pyx_t_4); |
| 7355 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 7356 | __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;} |
| 7357 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 7358 | + __Pyx_GOTREF(__pyx_t_2); |
| 7359 | __Pyx_INCREF(__pyx_v_n); |
| 7360 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_n); |
| 7361 | __Pyx_GIVEREF(__pyx_v_n); |
| 7362 | @@ -14020,7 +14572,7 @@ |
| 7363 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 7364 | __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; |
| 7365 | __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;} |
| 7366 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 7367 | + __Pyx_GOTREF(__pyx_t_2); |
| 7368 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); |
| 7369 | __Pyx_GIVEREF(__pyx_t_5); |
| 7370 | __pyx_t_5 = 0; |
| 7371 | @@ -14044,9 +14596,9 @@ |
| 7372 | __Pyx_Raise(__pyx_t_5, 0, 0, 0); |
| 7373 | __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| 7374 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 7375 | - goto __pyx_L9; |
| 7376 | + goto __pyx_L6; |
| 7377 | } |
| 7378 | - __pyx_L9:; |
| 7379 | + __pyx_L6:; |
| 7380 | |
| 7381 | /* "mtrand.pyx":3343 |
| 7382 | * if np.any(np.less_equal(n, 0)): |
| 7383 | @@ -14066,7 +14618,7 @@ |
| 7384 | __Pyx_GOTREF(__pyx_t_3); |
| 7385 | __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| 7386 | __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;} |
| 7387 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 7388 | + __Pyx_GOTREF(__pyx_t_5); |
| 7389 | __Pyx_INCREF(__pyx_v_p); |
| 7390 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_p); |
| 7391 | __Pyx_GIVEREF(__pyx_v_p); |
| 7392 | @@ -14078,7 +14630,7 @@ |
| 7393 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 7394 | __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| 7395 | __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;} |
| 7396 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 7397 | + __Pyx_GOTREF(__pyx_t_5); |
| 7398 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); |
| 7399 | __Pyx_GIVEREF(__pyx_t_4); |
| 7400 | __pyx_t_4 = 0; |
| 7401 | @@ -14102,9 +14654,9 @@ |
| 7402 | __Pyx_Raise(__pyx_t_4, 0, 0, 0); |
| 7403 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 7404 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 7405 | - goto __pyx_L10; |
| 7406 | + goto __pyx_L7; |
| 7407 | } |
| 7408 | - __pyx_L10:; |
| 7409 | + __pyx_L7:; |
| 7410 | |
| 7411 | /* "mtrand.pyx":3345 |
| 7412 | * if np.any(np.less(p, 0)): |
| 7413 | @@ -14124,7 +14676,7 @@ |
| 7414 | __Pyx_GOTREF(__pyx_t_2); |
| 7415 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 7416 | __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;} |
| 7417 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 7418 | + __Pyx_GOTREF(__pyx_t_4); |
| 7419 | __Pyx_INCREF(__pyx_v_p); |
| 7420 | PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_p); |
| 7421 | __Pyx_GIVEREF(__pyx_v_p); |
| 7422 | @@ -14136,7 +14688,7 @@ |
| 7423 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 7424 | __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; |
| 7425 | __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;} |
| 7426 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 7427 | + __Pyx_GOTREF(__pyx_t_4); |
| 7428 | PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); |
| 7429 | __Pyx_GIVEREF(__pyx_t_3); |
| 7430 | __pyx_t_3 = 0; |
| 7431 | @@ -14160,9 +14712,9 @@ |
| 7432 | __Pyx_Raise(__pyx_t_3, 0, 0, 0); |
| 7433 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 7434 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 7435 | - goto __pyx_L11; |
| 7436 | + goto __pyx_L8; |
| 7437 | } |
| 7438 | - __pyx_L11:; |
| 7439 | + __pyx_L8:; |
| 7440 | |
| 7441 | /* "mtrand.pyx":3347 |
| 7442 | * if np.any(np.greater(p, 1)): |
| 7443 | @@ -14172,7 +14724,7 @@ |
| 7444 | * def negative_binomial(self, n, p, size=None): |
| 7445 | */ |
| 7446 | __Pyx_XDECREF(__pyx_r); |
| 7447 | - __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;} |
| 7448 | + __pyx_t_3 = __pyx_f_6mtrand_discnp_array(__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;} |
| 7449 | __Pyx_GOTREF(__pyx_t_3); |
| 7450 | __pyx_r = __pyx_t_3; |
| 7451 | __pyx_t_3 = 0; |
| 7452 | @@ -14195,42 +14747,32 @@ |
| 7453 | return __pyx_r; |
| 7454 | } |
| 7455 | |
| 7456 | -/* "mtrand.pyx":3349 |
| 7457 | - * return discnp_array(self.internal_state, rk_binomial, size, on, op) |
| 7458 | - * |
| 7459 | - * def negative_binomial(self, n, p, size=None): # <<<<<<<<<<<<<< |
| 7460 | - * """ |
| 7461 | - * negative_binomial(n, p, size=None) |
| 7462 | - */ |
| 7463 | - |
| 7464 | -static PyObject *__pyx_pf_6mtrand_11RandomState_41negative_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 7465 | -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 "; |
| 7466 | -static PyObject *__pyx_pf_6mtrand_11RandomState_41negative_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 7467 | +/* Python wrapper */ |
| 7468 | +static PyObject *__pyx_pw_6mtrand_11RandomState_83negative_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 7469 | +static char __pyx_doc_6mtrand_11RandomState_82negative_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 "; |
| 7470 | +static PyObject *__pyx_pw_6mtrand_11RandomState_83negative_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 7471 | PyObject *__pyx_v_n = 0; |
| 7472 | PyObject *__pyx_v_p = 0; |
| 7473 | PyObject *__pyx_v_size = 0; |
| 7474 | - PyArrayObject *__pyx_v_on = 0; |
| 7475 | - PyArrayObject *__pyx_v_op = 0; |
| 7476 | - double __pyx_v_fn; |
| 7477 | - double __pyx_v_fp; |
| 7478 | - PyObject *__pyx_r = NULL; |
| 7479 | + PyObject *__pyx_r = 0; |
| 7480 | __Pyx_RefNannyDeclarations |
| 7481 | - int __pyx_t_1; |
| 7482 | - PyObject *__pyx_t_2 = NULL; |
| 7483 | - PyObject *__pyx_t_3 = NULL; |
| 7484 | - PyObject *__pyx_t_4 = NULL; |
| 7485 | - PyObject *__pyx_t_5 = NULL; |
| 7486 | - int __pyx_lineno = 0; |
| 7487 | - const char *__pyx_filename = NULL; |
| 7488 | - int __pyx_clineno = 0; |
| 7489 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n,&__pyx_n_s__p,&__pyx_n_s__size,0}; |
| 7490 | - __Pyx_RefNannySetupContext("negative_binomial"); |
| 7491 | + __Pyx_RefNannySetupContext("negative_binomial (wrapper)", 0); |
| 7492 | { |
| 7493 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n,&__pyx_n_s__p,&__pyx_n_s__size,0}; |
| 7494 | PyObject* values[3] = {0,0,0}; |
| 7495 | + |
| 7496 | + /* "mtrand.pyx":3349 |
| 7497 | + * return discnp_array(self.internal_state, rk_binomial, size, on, op) |
| 7498 | + * |
| 7499 | + * def negative_binomial(self, n, p, size=None): # <<<<<<<<<<<<<< |
| 7500 | + * """ |
| 7501 | + * negative_binomial(n, p, size=None) |
| 7502 | + */ |
| 7503 | values[2] = ((PyObject *)Py_None); |
| 7504 | if (unlikely(__pyx_kwds)) { |
| 7505 | Py_ssize_t kw_args; |
| 7506 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 7507 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 7508 | + switch (pos_args) { |
| 7509 | case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); |
| 7510 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 7511 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 7512 | @@ -14238,14 +14780,12 @@ |
| 7513 | default: goto __pyx_L5_argtuple_error; |
| 7514 | } |
| 7515 | kw_args = PyDict_Size(__pyx_kwds); |
| 7516 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 7517 | + switch (pos_args) { |
| 7518 | case 0: |
| 7519 | - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); |
| 7520 | - if (likely(values[0])) kw_args--; |
| 7521 | + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n)) != 0)) kw_args--; |
| 7522 | else goto __pyx_L5_argtuple_error; |
| 7523 | case 1: |
| 7524 | - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); |
| 7525 | - if (likely(values[1])) kw_args--; |
| 7526 | + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; |
| 7527 | else { |
| 7528 | __Pyx_RaiseArgtupleInvalid("negative_binomial", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3349; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 7529 | } |
| 7530 | @@ -14256,7 +14796,7 @@ |
| 7531 | } |
| 7532 | } |
| 7533 | if (unlikely(kw_args > 0)) { |
| 7534 | - 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;} |
| 7535 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "negative_binomial") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3349; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 7536 | } |
| 7537 | } else { |
| 7538 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 7539 | @@ -14279,7 +14819,28 @@ |
| 7540 | __Pyx_RefNannyFinishContext(); |
| 7541 | return NULL; |
| 7542 | __pyx_L4_argument_unpacking_done:; |
| 7543 | - |
| 7544 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_82negative_binomial(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_n, __pyx_v_p, __pyx_v_size); |
| 7545 | + __Pyx_RefNannyFinishContext(); |
| 7546 | + return __pyx_r; |
| 7547 | +} |
| 7548 | + |
| 7549 | +static PyObject *__pyx_pf_6mtrand_11RandomState_82negative_binomial(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_p, PyObject *__pyx_v_size) { |
| 7550 | + PyArrayObject *__pyx_v_on = 0; |
| 7551 | + PyArrayObject *__pyx_v_op = 0; |
| 7552 | + double __pyx_v_fn; |
| 7553 | + double __pyx_v_fp; |
| 7554 | + PyObject *__pyx_r = NULL; |
| 7555 | + __Pyx_RefNannyDeclarations |
| 7556 | + int __pyx_t_1; |
| 7557 | + PyObject *__pyx_t_2 = NULL; |
| 7558 | + PyObject *__pyx_t_3 = NULL; |
| 7559 | + PyObject *__pyx_t_4 = NULL; |
| 7560 | + PyObject *__pyx_t_5 = NULL; |
| 7561 | + int __pyx_lineno = 0; |
| 7562 | + const char *__pyx_filename = NULL; |
| 7563 | + int __pyx_clineno = 0; |
| 7564 | + __Pyx_RefNannySetupContext("negative_binomial", 0); |
| 7565 | + |
| 7566 | /* "mtrand.pyx":3419 |
| 7567 | * cdef double fp |
| 7568 | * |
| 7569 | @@ -14330,9 +14891,9 @@ |
| 7570 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 7571 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 7572 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 7573 | - goto __pyx_L7; |
| 7574 | + goto __pyx_L4; |
| 7575 | } |
| 7576 | - __pyx_L7:; |
| 7577 | + __pyx_L4:; |
| 7578 | |
| 7579 | /* "mtrand.pyx":3424 |
| 7580 | * if fn <= 0: |
| 7581 | @@ -14356,7 +14917,7 @@ |
| 7582 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 7583 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 7584 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 7585 | - goto __pyx_L8; |
| 7586 | + goto __pyx_L5; |
| 7587 | } |
| 7588 | |
| 7589 | /* "mtrand.pyx":3426 |
| 7590 | @@ -14381,9 +14942,9 @@ |
| 7591 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 7592 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 7593 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 7594 | - goto __pyx_L8; |
| 7595 | + goto __pyx_L5; |
| 7596 | } |
| 7597 | - __pyx_L8:; |
| 7598 | + __pyx_L5:; |
| 7599 | |
| 7600 | /* "mtrand.pyx":3428 |
| 7601 | * elif fp > 1: |
| 7602 | @@ -14401,14 +14962,14 @@ |
| 7603 | * |
| 7604 | * PyErr_Clear() |
| 7605 | */ |
| 7606 | - __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;} |
| 7607 | + __pyx_t_2 = __pyx_f_6mtrand_discdd_array_sc(__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;} |
| 7608 | __Pyx_GOTREF(__pyx_t_2); |
| 7609 | __pyx_r = __pyx_t_2; |
| 7610 | __pyx_t_2 = 0; |
| 7611 | goto __pyx_L0; |
| 7612 | - goto __pyx_L6; |
| 7613 | + goto __pyx_L3; |
| 7614 | } |
| 7615 | - __pyx_L6:; |
| 7616 | + __pyx_L3:; |
| 7617 | |
| 7618 | /* "mtrand.pyx":3431 |
| 7619 | * size, fn, fp) |
| 7620 | @@ -14463,7 +15024,7 @@ |
| 7621 | __Pyx_GOTREF(__pyx_t_4); |
| 7622 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 7623 | __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;} |
| 7624 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 7625 | + __Pyx_GOTREF(__pyx_t_2); |
| 7626 | __Pyx_INCREF(__pyx_v_n); |
| 7627 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_n); |
| 7628 | __Pyx_GIVEREF(__pyx_v_n); |
| 7629 | @@ -14475,7 +15036,7 @@ |
| 7630 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 7631 | __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; |
| 7632 | __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;} |
| 7633 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 7634 | + __Pyx_GOTREF(__pyx_t_2); |
| 7635 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); |
| 7636 | __Pyx_GIVEREF(__pyx_t_5); |
| 7637 | __pyx_t_5 = 0; |
| 7638 | @@ -14499,9 +15060,9 @@ |
| 7639 | __Pyx_Raise(__pyx_t_5, 0, 0, 0); |
| 7640 | __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| 7641 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 7642 | - goto __pyx_L9; |
| 7643 | + goto __pyx_L6; |
| 7644 | } |
| 7645 | - __pyx_L9:; |
| 7646 | + __pyx_L6:; |
| 7647 | |
| 7648 | /* "mtrand.pyx":3437 |
| 7649 | * if np.any(np.less_equal(n, 0)): |
| 7650 | @@ -14521,7 +15082,7 @@ |
| 7651 | __Pyx_GOTREF(__pyx_t_3); |
| 7652 | __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| 7653 | __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;} |
| 7654 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 7655 | + __Pyx_GOTREF(__pyx_t_5); |
| 7656 | __Pyx_INCREF(__pyx_v_p); |
| 7657 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_p); |
| 7658 | __Pyx_GIVEREF(__pyx_v_p); |
| 7659 | @@ -14533,7 +15094,7 @@ |
| 7660 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 7661 | __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| 7662 | __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;} |
| 7663 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 7664 | + __Pyx_GOTREF(__pyx_t_5); |
| 7665 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); |
| 7666 | __Pyx_GIVEREF(__pyx_t_4); |
| 7667 | __pyx_t_4 = 0; |
| 7668 | @@ -14557,9 +15118,9 @@ |
| 7669 | __Pyx_Raise(__pyx_t_4, 0, 0, 0); |
| 7670 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 7671 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 7672 | - goto __pyx_L10; |
| 7673 | + goto __pyx_L7; |
| 7674 | } |
| 7675 | - __pyx_L10:; |
| 7676 | + __pyx_L7:; |
| 7677 | |
| 7678 | /* "mtrand.pyx":3439 |
| 7679 | * if np.any(np.less(p, 0)): |
| 7680 | @@ -14579,7 +15140,7 @@ |
| 7681 | __Pyx_GOTREF(__pyx_t_2); |
| 7682 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 7683 | __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;} |
| 7684 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 7685 | + __Pyx_GOTREF(__pyx_t_4); |
| 7686 | __Pyx_INCREF(__pyx_v_p); |
| 7687 | PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_p); |
| 7688 | __Pyx_GIVEREF(__pyx_v_p); |
| 7689 | @@ -14591,7 +15152,7 @@ |
| 7690 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 7691 | __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; |
| 7692 | __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;} |
| 7693 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 7694 | + __Pyx_GOTREF(__pyx_t_4); |
| 7695 | PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); |
| 7696 | __Pyx_GIVEREF(__pyx_t_3); |
| 7697 | __pyx_t_3 = 0; |
| 7698 | @@ -14615,9 +15176,9 @@ |
| 7699 | __Pyx_Raise(__pyx_t_3, 0, 0, 0); |
| 7700 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 7701 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 7702 | - goto __pyx_L11; |
| 7703 | + goto __pyx_L8; |
| 7704 | } |
| 7705 | - __pyx_L11:; |
| 7706 | + __pyx_L8:; |
| 7707 | |
| 7708 | /* "mtrand.pyx":3441 |
| 7709 | * if np.any(np.greater(p, 1)): |
| 7710 | @@ -14635,7 +15196,7 @@ |
| 7711 | * |
| 7712 | * def poisson(self, lam=1.0, size=None): |
| 7713 | */ |
| 7714 | - __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;} |
| 7715 | + __pyx_t_3 = __pyx_f_6mtrand_discdd_array(__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;} |
| 7716 | __Pyx_GOTREF(__pyx_t_3); |
| 7717 | __pyx_r = __pyx_t_3; |
| 7718 | __pyx_t_3 = 0; |
| 7719 | @@ -14658,47 +15219,39 @@ |
| 7720 | return __pyx_r; |
| 7721 | } |
| 7722 | |
| 7723 | -/* "mtrand.pyx":3444 |
| 7724 | - * on, op) |
| 7725 | - * |
| 7726 | - * def poisson(self, lam=1.0, size=None): # <<<<<<<<<<<<<< |
| 7727 | - * """ |
| 7728 | - * poisson(lam=1.0, size=None) |
| 7729 | - */ |
| 7730 | - |
| 7731 | -static PyObject *__pyx_pf_6mtrand_11RandomState_42poisson(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 7732 | -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 "; |
| 7733 | -static PyObject *__pyx_pf_6mtrand_11RandomState_42poisson(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 7734 | +/* Python wrapper */ |
| 7735 | +static PyObject *__pyx_pw_6mtrand_11RandomState_85poisson(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 7736 | +static char __pyx_doc_6mtrand_11RandomState_84poisson[] = "\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 "; |
| 7737 | +static PyObject *__pyx_pw_6mtrand_11RandomState_85poisson(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 7738 | PyObject *__pyx_v_lam = 0; |
| 7739 | PyObject *__pyx_v_size = 0; |
| 7740 | - PyArrayObject *__pyx_v_olam = 0; |
| 7741 | - double __pyx_v_flam; |
| 7742 | - PyObject *__pyx_r = NULL; |
| 7743 | + PyObject *__pyx_r = 0; |
| 7744 | __Pyx_RefNannyDeclarations |
| 7745 | - int __pyx_t_1; |
| 7746 | - PyObject *__pyx_t_2 = NULL; |
| 7747 | - PyObject *__pyx_t_3 = NULL; |
| 7748 | - PyObject *__pyx_t_4 = NULL; |
| 7749 | - PyObject *__pyx_t_5 = NULL; |
| 7750 | - int __pyx_lineno = 0; |
| 7751 | - const char *__pyx_filename = NULL; |
| 7752 | - int __pyx_clineno = 0; |
| 7753 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lam,&__pyx_n_s__size,0}; |
| 7754 | - __Pyx_RefNannySetupContext("poisson"); |
| 7755 | + __Pyx_RefNannySetupContext("poisson (wrapper)", 0); |
| 7756 | { |
| 7757 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lam,&__pyx_n_s__size,0}; |
| 7758 | PyObject* values[2] = {0,0}; |
| 7759 | values[0] = __pyx_k_125; |
| 7760 | + |
| 7761 | + /* "mtrand.pyx":3444 |
| 7762 | + * on, op) |
| 7763 | + * |
| 7764 | + * def poisson(self, lam=1.0, size=None): # <<<<<<<<<<<<<< |
| 7765 | + * """ |
| 7766 | + * poisson(lam=1.0, size=None) |
| 7767 | + */ |
| 7768 | values[1] = ((PyObject *)Py_None); |
| 7769 | if (unlikely(__pyx_kwds)) { |
| 7770 | Py_ssize_t kw_args; |
| 7771 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 7772 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 7773 | + switch (pos_args) { |
| 7774 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 7775 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 7776 | case 0: break; |
| 7777 | default: goto __pyx_L5_argtuple_error; |
| 7778 | } |
| 7779 | kw_args = PyDict_Size(__pyx_kwds); |
| 7780 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 7781 | + switch (pos_args) { |
| 7782 | case 0: |
| 7783 | if (kw_args > 0) { |
| 7784 | PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lam); |
| 7785 | @@ -14711,7 +15264,7 @@ |
| 7786 | } |
| 7787 | } |
| 7788 | if (unlikely(kw_args > 0)) { |
| 7789 | - 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;} |
| 7790 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "poisson") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3444; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 7791 | } |
| 7792 | } else { |
| 7793 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 7794 | @@ -14732,6 +15285,25 @@ |
| 7795 | __Pyx_RefNannyFinishContext(); |
| 7796 | return NULL; |
| 7797 | __pyx_L4_argument_unpacking_done:; |
| 7798 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_84poisson(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_lam, __pyx_v_size); |
| 7799 | + __Pyx_RefNannyFinishContext(); |
| 7800 | + return __pyx_r; |
| 7801 | +} |
| 7802 | + |
| 7803 | +static PyObject *__pyx_pf_6mtrand_11RandomState_84poisson(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_lam, PyObject *__pyx_v_size) { |
| 7804 | + PyArrayObject *__pyx_v_olam = 0; |
| 7805 | + double __pyx_v_flam; |
| 7806 | + PyObject *__pyx_r = NULL; |
| 7807 | + __Pyx_RefNannyDeclarations |
| 7808 | + int __pyx_t_1; |
| 7809 | + PyObject *__pyx_t_2 = NULL; |
| 7810 | + PyObject *__pyx_t_3 = NULL; |
| 7811 | + PyObject *__pyx_t_4 = NULL; |
| 7812 | + PyObject *__pyx_t_5 = NULL; |
| 7813 | + int __pyx_lineno = 0; |
| 7814 | + const char *__pyx_filename = NULL; |
| 7815 | + int __pyx_clineno = 0; |
| 7816 | + __Pyx_RefNannySetupContext("poisson", 0); |
| 7817 | |
| 7818 | /* "mtrand.pyx":3498 |
| 7819 | * cdef ndarray olam |
| 7820 | @@ -14759,8 +15331,7 @@ |
| 7821 | * raise ValueError("lam < 0") |
| 7822 | * if lam > self.poisson_lam_max: |
| 7823 | */ |
| 7824 | - __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;} |
| 7825 | - __Pyx_GOTREF(__pyx_t_2); |
| 7826 | + __pyx_t_2 = PyObject_RichCompare(__pyx_v_lam, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 7827 | __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;} |
| 7828 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 7829 | if (__pyx_t_1) { |
| 7830 | @@ -14777,9 +15348,9 @@ |
| 7831 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 7832 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 7833 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 7834 | - goto __pyx_L7; |
| 7835 | + goto __pyx_L4; |
| 7836 | } |
| 7837 | - __pyx_L7:; |
| 7838 | + __pyx_L4:; |
| 7839 | |
| 7840 | /* "mtrand.pyx":3502 |
| 7841 | * if lam < 0: |
| 7842 | @@ -14788,10 +15359,9 @@ |
| 7843 | * raise ValueError("lam value too large") |
| 7844 | * return discd_array_sc(self.internal_state, rk_poisson, size, flam) |
| 7845 | */ |
| 7846 | - __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;} |
| 7847 | + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__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;} |
| 7848 | __Pyx_GOTREF(__pyx_t_2); |
| 7849 | - __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;} |
| 7850 | - __Pyx_GOTREF(__pyx_t_3); |
| 7851 | + __pyx_t_3 = PyObject_RichCompare(__pyx_v_lam, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 7852 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 7853 | __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;} |
| 7854 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 7855 | @@ -14809,9 +15379,9 @@ |
| 7856 | __Pyx_Raise(__pyx_t_3, 0, 0, 0); |
| 7857 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 7858 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 7859 | - goto __pyx_L8; |
| 7860 | + goto __pyx_L5; |
| 7861 | } |
| 7862 | - __pyx_L8:; |
| 7863 | + __pyx_L5:; |
| 7864 | |
| 7865 | /* "mtrand.pyx":3504 |
| 7866 | * if lam > self.poisson_lam_max: |
| 7867 | @@ -14821,14 +15391,14 @@ |
| 7868 | * PyErr_Clear() |
| 7869 | */ |
| 7870 | __Pyx_XDECREF(__pyx_r); |
| 7871 | - __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;} |
| 7872 | + __pyx_t_3 = __pyx_f_6mtrand_discd_array_sc(__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;} |
| 7873 | __Pyx_GOTREF(__pyx_t_3); |
| 7874 | __pyx_r = __pyx_t_3; |
| 7875 | __pyx_t_3 = 0; |
| 7876 | goto __pyx_L0; |
| 7877 | - goto __pyx_L6; |
| 7878 | + goto __pyx_L3; |
| 7879 | } |
| 7880 | - __pyx_L6:; |
| 7881 | + __pyx_L3:; |
| 7882 | |
| 7883 | /* "mtrand.pyx":3506 |
| 7884 | * return discd_array_sc(self.internal_state, rk_poisson, size, flam) |
| 7885 | @@ -14870,7 +15440,7 @@ |
| 7886 | __Pyx_GOTREF(__pyx_t_4); |
| 7887 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 7888 | __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;} |
| 7889 | - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| 7890 | + __Pyx_GOTREF(__pyx_t_3); |
| 7891 | __Pyx_INCREF(((PyObject *)__pyx_v_olam)); |
| 7892 | PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_olam)); |
| 7893 | __Pyx_GIVEREF(((PyObject *)__pyx_v_olam)); |
| 7894 | @@ -14882,7 +15452,7 @@ |
| 7895 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 7896 | __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; |
| 7897 | __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;} |
| 7898 | - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| 7899 | + __Pyx_GOTREF(__pyx_t_3); |
| 7900 | PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); |
| 7901 | __Pyx_GIVEREF(__pyx_t_5); |
| 7902 | __pyx_t_5 = 0; |
| 7903 | @@ -14906,9 +15476,9 @@ |
| 7904 | __Pyx_Raise(__pyx_t_5, 0, 0, 0); |
| 7905 | __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| 7906 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 7907 | - goto __pyx_L9; |
| 7908 | + goto __pyx_L6; |
| 7909 | } |
| 7910 | - __pyx_L9:; |
| 7911 | + __pyx_L6:; |
| 7912 | |
| 7913 | /* "mtrand.pyx":3511 |
| 7914 | * if np.any(np.less(olam, 0)): |
| 7915 | @@ -14927,10 +15497,10 @@ |
| 7916 | __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;} |
| 7917 | __Pyx_GOTREF(__pyx_t_2); |
| 7918 | __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| 7919 | - __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;} |
| 7920 | + __pyx_t_5 = PyObject_GetAttr(((PyObject *)__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;} |
| 7921 | __Pyx_GOTREF(__pyx_t_5); |
| 7922 | __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;} |
| 7923 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 7924 | + __Pyx_GOTREF(__pyx_t_4); |
| 7925 | __Pyx_INCREF(((PyObject *)__pyx_v_olam)); |
| 7926 | PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_olam)); |
| 7927 | __Pyx_GIVEREF(((PyObject *)__pyx_v_olam)); |
| 7928 | @@ -14942,7 +15512,7 @@ |
| 7929 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 7930 | __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; |
| 7931 | __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;} |
| 7932 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 7933 | + __Pyx_GOTREF(__pyx_t_4); |
| 7934 | PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); |
| 7935 | __Pyx_GIVEREF(__pyx_t_5); |
| 7936 | __pyx_t_5 = 0; |
| 7937 | @@ -14966,9 +15536,9 @@ |
| 7938 | __Pyx_Raise(__pyx_t_5, 0, 0, 0); |
| 7939 | __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| 7940 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 7941 | - goto __pyx_L10; |
| 7942 | + goto __pyx_L7; |
| 7943 | } |
| 7944 | - __pyx_L10:; |
| 7945 | + __pyx_L7:; |
| 7946 | |
| 7947 | /* "mtrand.pyx":3513 |
| 7948 | * if np.any(np.greater(olam, self.poisson_lam_max)): |
| 7949 | @@ -14978,7 +15548,7 @@ |
| 7950 | * def zipf(self, a, size=None): |
| 7951 | */ |
| 7952 | __Pyx_XDECREF(__pyx_r); |
| 7953 | - __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;} |
| 7954 | + __pyx_t_5 = __pyx_f_6mtrand_discd_array(__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;} |
| 7955 | __Pyx_GOTREF(__pyx_t_5); |
| 7956 | __pyx_r = __pyx_t_5; |
| 7957 | __pyx_t_5 = 0; |
| 7958 | @@ -15000,49 +15570,40 @@ |
| 7959 | return __pyx_r; |
| 7960 | } |
| 7961 | |
| 7962 | -/* "mtrand.pyx":3515 |
| 7963 | +/* Python wrapper */ |
| 7964 | +static PyObject *__pyx_pw_6mtrand_11RandomState_87zipf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 7965 | +static char __pyx_doc_6mtrand_11RandomState_86zipf[] = "\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 "; |
| 7966 | +static PyObject *__pyx_pw_6mtrand_11RandomState_87zipf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 7967 | + PyObject *__pyx_v_a = 0; |
| 7968 | + PyObject *__pyx_v_size = 0; |
| 7969 | + PyObject *__pyx_r = 0; |
| 7970 | + __Pyx_RefNannyDeclarations |
| 7971 | + __Pyx_RefNannySetupContext("zipf (wrapper)", 0); |
| 7972 | + { |
| 7973 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__a,&__pyx_n_s__size,0}; |
| 7974 | + PyObject* values[2] = {0,0}; |
| 7975 | + |
| 7976 | + /* "mtrand.pyx":3515 |
| 7977 | * return discd_array(self.internal_state, rk_poisson, size, olam) |
| 7978 | * |
| 7979 | * def zipf(self, a, size=None): # <<<<<<<<<<<<<< |
| 7980 | * """ |
| 7981 | * zipf(a, size=None) |
| 7982 | */ |
| 7983 | - |
| 7984 | -static PyObject *__pyx_pf_6mtrand_11RandomState_43zipf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 7985 | -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 "; |
| 7986 | -static PyObject *__pyx_pf_6mtrand_11RandomState_43zipf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 7987 | - PyObject *__pyx_v_a = 0; |
| 7988 | - PyObject *__pyx_v_size = 0; |
| 7989 | - PyArrayObject *__pyx_v_oa = 0; |
| 7990 | - double __pyx_v_fa; |
| 7991 | - PyObject *__pyx_r = NULL; |
| 7992 | - __Pyx_RefNannyDeclarations |
| 7993 | - int __pyx_t_1; |
| 7994 | - PyObject *__pyx_t_2 = NULL; |
| 7995 | - PyObject *__pyx_t_3 = NULL; |
| 7996 | - PyObject *__pyx_t_4 = NULL; |
| 7997 | - PyObject *__pyx_t_5 = NULL; |
| 7998 | - int __pyx_lineno = 0; |
| 7999 | - const char *__pyx_filename = NULL; |
| 8000 | - int __pyx_clineno = 0; |
| 8001 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__a,&__pyx_n_s__size,0}; |
| 8002 | - __Pyx_RefNannySetupContext("zipf"); |
| 8003 | - { |
| 8004 | - PyObject* values[2] = {0,0}; |
| 8005 | values[1] = ((PyObject *)Py_None); |
| 8006 | if (unlikely(__pyx_kwds)) { |
| 8007 | Py_ssize_t kw_args; |
| 8008 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 8009 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 8010 | + switch (pos_args) { |
| 8011 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 8012 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 8013 | case 0: break; |
| 8014 | default: goto __pyx_L5_argtuple_error; |
| 8015 | } |
| 8016 | kw_args = PyDict_Size(__pyx_kwds); |
| 8017 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 8018 | + switch (pos_args) { |
| 8019 | case 0: |
| 8020 | - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a); |
| 8021 | - if (likely(values[0])) kw_args--; |
| 8022 | + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a)) != 0)) kw_args--; |
| 8023 | else goto __pyx_L5_argtuple_error; |
| 8024 | case 1: |
| 8025 | if (kw_args > 0) { |
| 8026 | @@ -15051,7 +15612,7 @@ |
| 8027 | } |
| 8028 | } |
| 8029 | if (unlikely(kw_args > 0)) { |
| 8030 | - 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;} |
| 8031 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zipf") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3515; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 8032 | } |
| 8033 | } else { |
| 8034 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 8035 | @@ -15072,6 +15633,25 @@ |
| 8036 | __Pyx_RefNannyFinishContext(); |
| 8037 | return NULL; |
| 8038 | __pyx_L4_argument_unpacking_done:; |
| 8039 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_86zipf(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_a, __pyx_v_size); |
| 8040 | + __Pyx_RefNannyFinishContext(); |
| 8041 | + return __pyx_r; |
| 8042 | +} |
| 8043 | + |
| 8044 | +static PyObject *__pyx_pf_6mtrand_11RandomState_86zipf(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_size) { |
| 8045 | + PyArrayObject *__pyx_v_oa = 0; |
| 8046 | + double __pyx_v_fa; |
| 8047 | + PyObject *__pyx_r = NULL; |
| 8048 | + __Pyx_RefNannyDeclarations |
| 8049 | + int __pyx_t_1; |
| 8050 | + PyObject *__pyx_t_2 = NULL; |
| 8051 | + PyObject *__pyx_t_3 = NULL; |
| 8052 | + PyObject *__pyx_t_4 = NULL; |
| 8053 | + PyObject *__pyx_t_5 = NULL; |
| 8054 | + int __pyx_lineno = 0; |
| 8055 | + const char *__pyx_filename = NULL; |
| 8056 | + int __pyx_clineno = 0; |
| 8057 | + __Pyx_RefNannySetupContext("zipf", 0); |
| 8058 | |
| 8059 | /* "mtrand.pyx":3590 |
| 8060 | * cdef double fa |
| 8061 | @@ -15114,9 +15694,9 @@ |
| 8062 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 8063 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 8064 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 8065 | - goto __pyx_L7; |
| 8066 | + goto __pyx_L4; |
| 8067 | } |
| 8068 | - __pyx_L7:; |
| 8069 | + __pyx_L4:; |
| 8070 | |
| 8071 | /* "mtrand.pyx":3594 |
| 8072 | * if fa <= 1.0: |
| 8073 | @@ -15126,14 +15706,14 @@ |
| 8074 | * PyErr_Clear() |
| 8075 | */ |
| 8076 | __Pyx_XDECREF(__pyx_r); |
| 8077 | - __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;} |
| 8078 | + __pyx_t_2 = __pyx_f_6mtrand_discd_array_sc(__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;} |
| 8079 | __Pyx_GOTREF(__pyx_t_2); |
| 8080 | __pyx_r = __pyx_t_2; |
| 8081 | __pyx_t_2 = 0; |
| 8082 | goto __pyx_L0; |
| 8083 | - goto __pyx_L6; |
| 8084 | + goto __pyx_L3; |
| 8085 | } |
| 8086 | - __pyx_L6:; |
| 8087 | + __pyx_L3:; |
| 8088 | |
| 8089 | /* "mtrand.pyx":3596 |
| 8090 | * return discd_array_sc(self.internal_state, rk_zipf, size, fa) |
| 8091 | @@ -15177,7 +15757,7 @@ |
| 8092 | __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;} |
| 8093 | __Pyx_GOTREF(__pyx_t_2); |
| 8094 | __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;} |
| 8095 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 8096 | + __Pyx_GOTREF(__pyx_t_5); |
| 8097 | __Pyx_INCREF(((PyObject *)__pyx_v_oa)); |
| 8098 | PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_oa)); |
| 8099 | __Pyx_GIVEREF(((PyObject *)__pyx_v_oa)); |
| 8100 | @@ -15189,7 +15769,7 @@ |
| 8101 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 8102 | __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| 8103 | __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;} |
| 8104 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 8105 | + __Pyx_GOTREF(__pyx_t_5); |
| 8106 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); |
| 8107 | __Pyx_GIVEREF(__pyx_t_2); |
| 8108 | __pyx_t_2 = 0; |
| 8109 | @@ -15213,9 +15793,9 @@ |
| 8110 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 8111 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 8112 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3600; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 8113 | - goto __pyx_L8; |
| 8114 | + goto __pyx_L5; |
| 8115 | } |
| 8116 | - __pyx_L8:; |
| 8117 | + __pyx_L5:; |
| 8118 | |
| 8119 | /* "mtrand.pyx":3601 |
| 8120 | * if np.any(np.less_equal(oa, 1.0)): |
| 8121 | @@ -15225,7 +15805,7 @@ |
| 8122 | * def geometric(self, p, size=None): |
| 8123 | */ |
| 8124 | __Pyx_XDECREF(__pyx_r); |
| 8125 | - __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;} |
| 8126 | + __pyx_t_2 = __pyx_f_6mtrand_discd_array(__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;} |
| 8127 | __Pyx_GOTREF(__pyx_t_2); |
| 8128 | __pyx_r = __pyx_t_2; |
| 8129 | __pyx_t_2 = 0; |
| 8130 | @@ -15247,49 +15827,40 @@ |
| 8131 | return __pyx_r; |
| 8132 | } |
| 8133 | |
| 8134 | -/* "mtrand.pyx":3603 |
| 8135 | +/* Python wrapper */ |
| 8136 | +static PyObject *__pyx_pw_6mtrand_11RandomState_89geometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 8137 | +static char __pyx_doc_6mtrand_11RandomState_88geometric[] = "\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 "; |
| 8138 | +static PyObject *__pyx_pw_6mtrand_11RandomState_89geometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 8139 | + PyObject *__pyx_v_p = 0; |
| 8140 | + PyObject *__pyx_v_size = 0; |
| 8141 | + PyObject *__pyx_r = 0; |
| 8142 | + __Pyx_RefNannyDeclarations |
| 8143 | + __Pyx_RefNannySetupContext("geometric (wrapper)", 0); |
| 8144 | + { |
| 8145 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__size,0}; |
| 8146 | + PyObject* values[2] = {0,0}; |
| 8147 | + |
| 8148 | + /* "mtrand.pyx":3603 |
| 8149 | * return discd_array(self.internal_state, rk_zipf, size, oa) |
| 8150 | * |
| 8151 | * def geometric(self, p, size=None): # <<<<<<<<<<<<<< |
| 8152 | * """ |
| 8153 | * geometric(p, size=None) |
| 8154 | */ |
| 8155 | - |
| 8156 | -static PyObject *__pyx_pf_6mtrand_11RandomState_44geometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 8157 | -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 "; |
| 8158 | -static PyObject *__pyx_pf_6mtrand_11RandomState_44geometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 8159 | - PyObject *__pyx_v_p = 0; |
| 8160 | - PyObject *__pyx_v_size = 0; |
| 8161 | - PyArrayObject *__pyx_v_op = 0; |
| 8162 | - double __pyx_v_fp; |
| 8163 | - PyObject *__pyx_r = NULL; |
| 8164 | - __Pyx_RefNannyDeclarations |
| 8165 | - int __pyx_t_1; |
| 8166 | - PyObject *__pyx_t_2 = NULL; |
| 8167 | - PyObject *__pyx_t_3 = NULL; |
| 8168 | - PyObject *__pyx_t_4 = NULL; |
| 8169 | - PyObject *__pyx_t_5 = NULL; |
| 8170 | - int __pyx_lineno = 0; |
| 8171 | - const char *__pyx_filename = NULL; |
| 8172 | - int __pyx_clineno = 0; |
| 8173 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__size,0}; |
| 8174 | - __Pyx_RefNannySetupContext("geometric"); |
| 8175 | - { |
| 8176 | - PyObject* values[2] = {0,0}; |
| 8177 | values[1] = ((PyObject *)Py_None); |
| 8178 | if (unlikely(__pyx_kwds)) { |
| 8179 | Py_ssize_t kw_args; |
| 8180 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 8181 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 8182 | + switch (pos_args) { |
| 8183 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 8184 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 8185 | case 0: break; |
| 8186 | default: goto __pyx_L5_argtuple_error; |
| 8187 | } |
| 8188 | kw_args = PyDict_Size(__pyx_kwds); |
| 8189 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 8190 | + switch (pos_args) { |
| 8191 | case 0: |
| 8192 | - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); |
| 8193 | - if (likely(values[0])) kw_args--; |
| 8194 | + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; |
| 8195 | else goto __pyx_L5_argtuple_error; |
| 8196 | case 1: |
| 8197 | if (kw_args > 0) { |
| 8198 | @@ -15298,7 +15869,7 @@ |
| 8199 | } |
| 8200 | } |
| 8201 | if (unlikely(kw_args > 0)) { |
| 8202 | - 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;} |
| 8203 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "geometric") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3603; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 8204 | } |
| 8205 | } else { |
| 8206 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 8207 | @@ -15319,6 +15890,25 @@ |
| 8208 | __Pyx_RefNannyFinishContext(); |
| 8209 | return NULL; |
| 8210 | __pyx_L4_argument_unpacking_done:; |
| 8211 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_88geometric(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_p, __pyx_v_size); |
| 8212 | + __Pyx_RefNannyFinishContext(); |
| 8213 | + return __pyx_r; |
| 8214 | +} |
| 8215 | + |
| 8216 | +static PyObject *__pyx_pf_6mtrand_11RandomState_88geometric(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_p, PyObject *__pyx_v_size) { |
| 8217 | + PyArrayObject *__pyx_v_op = 0; |
| 8218 | + double __pyx_v_fp; |
| 8219 | + PyObject *__pyx_r = NULL; |
| 8220 | + __Pyx_RefNannyDeclarations |
| 8221 | + int __pyx_t_1; |
| 8222 | + PyObject *__pyx_t_2 = NULL; |
| 8223 | + PyObject *__pyx_t_3 = NULL; |
| 8224 | + PyObject *__pyx_t_4 = NULL; |
| 8225 | + PyObject *__pyx_t_5 = NULL; |
| 8226 | + int __pyx_lineno = 0; |
| 8227 | + const char *__pyx_filename = NULL; |
| 8228 | + int __pyx_clineno = 0; |
| 8229 | + __Pyx_RefNannySetupContext("geometric", 0); |
| 8230 | |
| 8231 | /* "mtrand.pyx":3651 |
| 8232 | * cdef double fp |
| 8233 | @@ -15361,9 +15951,9 @@ |
| 8234 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 8235 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 8236 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 8237 | - goto __pyx_L7; |
| 8238 | + goto __pyx_L4; |
| 8239 | } |
| 8240 | - __pyx_L7:; |
| 8241 | + __pyx_L4:; |
| 8242 | |
| 8243 | /* "mtrand.pyx":3655 |
| 8244 | * if fp < 0.0: |
| 8245 | @@ -15387,9 +15977,9 @@ |
| 8246 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 8247 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 8248 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 8249 | - goto __pyx_L8; |
| 8250 | + goto __pyx_L5; |
| 8251 | } |
| 8252 | - __pyx_L8:; |
| 8253 | + __pyx_L5:; |
| 8254 | |
| 8255 | /* "mtrand.pyx":3657 |
| 8256 | * if fp > 1.0: |
| 8257 | @@ -15399,14 +15989,14 @@ |
| 8258 | * PyErr_Clear() |
| 8259 | */ |
| 8260 | __Pyx_XDECREF(__pyx_r); |
| 8261 | - __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;} |
| 8262 | + __pyx_t_2 = __pyx_f_6mtrand_discd_array_sc(__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;} |
| 8263 | __Pyx_GOTREF(__pyx_t_2); |
| 8264 | __pyx_r = __pyx_t_2; |
| 8265 | __pyx_t_2 = 0; |
| 8266 | goto __pyx_L0; |
| 8267 | - goto __pyx_L6; |
| 8268 | + goto __pyx_L3; |
| 8269 | } |
| 8270 | - __pyx_L6:; |
| 8271 | + __pyx_L3:; |
| 8272 | |
| 8273 | /* "mtrand.pyx":3659 |
| 8274 | * return discd_array_sc(self.internal_state, rk_geometric, size, fp) |
| 8275 | @@ -15450,7 +16040,7 @@ |
| 8276 | __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;} |
| 8277 | __Pyx_GOTREF(__pyx_t_2); |
| 8278 | __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;} |
| 8279 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 8280 | + __Pyx_GOTREF(__pyx_t_5); |
| 8281 | __Pyx_INCREF(((PyObject *)__pyx_v_op)); |
| 8282 | PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_op)); |
| 8283 | __Pyx_GIVEREF(((PyObject *)__pyx_v_op)); |
| 8284 | @@ -15462,7 +16052,7 @@ |
| 8285 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 8286 | __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| 8287 | __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;} |
| 8288 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 8289 | + __Pyx_GOTREF(__pyx_t_5); |
| 8290 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); |
| 8291 | __Pyx_GIVEREF(__pyx_t_2); |
| 8292 | __pyx_t_2 = 0; |
| 8293 | @@ -15486,9 +16076,9 @@ |
| 8294 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 8295 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 8296 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3664; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 8297 | - goto __pyx_L9; |
| 8298 | + goto __pyx_L6; |
| 8299 | } |
| 8300 | - __pyx_L9:; |
| 8301 | + __pyx_L6:; |
| 8302 | |
| 8303 | /* "mtrand.pyx":3665 |
| 8304 | * if np.any(np.less(op, 0.0)): |
| 8305 | @@ -15510,7 +16100,7 @@ |
| 8306 | __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;} |
| 8307 | __Pyx_GOTREF(__pyx_t_2); |
| 8308 | __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;} |
| 8309 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 8310 | + __Pyx_GOTREF(__pyx_t_4); |
| 8311 | __Pyx_INCREF(((PyObject *)__pyx_v_op)); |
| 8312 | PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_op)); |
| 8313 | __Pyx_GIVEREF(((PyObject *)__pyx_v_op)); |
| 8314 | @@ -15522,7 +16112,7 @@ |
| 8315 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 8316 | __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; |
| 8317 | __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;} |
| 8318 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 8319 | + __Pyx_GOTREF(__pyx_t_4); |
| 8320 | PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); |
| 8321 | __Pyx_GIVEREF(__pyx_t_2); |
| 8322 | __pyx_t_2 = 0; |
| 8323 | @@ -15546,9 +16136,9 @@ |
| 8324 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 8325 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 8326 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3666; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 8327 | - goto __pyx_L10; |
| 8328 | + goto __pyx_L7; |
| 8329 | } |
| 8330 | - __pyx_L10:; |
| 8331 | + __pyx_L7:; |
| 8332 | |
| 8333 | /* "mtrand.pyx":3667 |
| 8334 | * if np.any(np.greater(op, 1.0)): |
| 8335 | @@ -15558,7 +16148,7 @@ |
| 8336 | * def hypergeometric(self, ngood, nbad, nsample, size=None): |
| 8337 | */ |
| 8338 | __Pyx_XDECREF(__pyx_r); |
| 8339 | - __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;} |
| 8340 | + __pyx_t_2 = __pyx_f_6mtrand_discd_array(__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;} |
| 8341 | __Pyx_GOTREF(__pyx_t_2); |
| 8342 | __pyx_r = __pyx_t_2; |
| 8343 | __pyx_t_2 = 0; |
| 8344 | @@ -15580,46 +16170,33 @@ |
| 8345 | return __pyx_r; |
| 8346 | } |
| 8347 | |
| 8348 | -/* "mtrand.pyx":3669 |
| 8349 | - * return discd_array(self.internal_state, rk_geometric, size, op) |
| 8350 | - * |
| 8351 | - * def hypergeometric(self, ngood, nbad, nsample, size=None): # <<<<<<<<<<<<<< |
| 8352 | - * """ |
| 8353 | - * hypergeometric(ngood, nbad, nsample, size=None) |
| 8354 | - */ |
| 8355 | - |
| 8356 | -static PyObject *__pyx_pf_6mtrand_11RandomState_45hypergeometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 8357 | -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 "; |
| 8358 | -static PyObject *__pyx_pf_6mtrand_11RandomState_45hypergeometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 8359 | +/* Python wrapper */ |
| 8360 | +static PyObject *__pyx_pw_6mtrand_11RandomState_91hypergeometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 8361 | +static char __pyx_doc_6mtrand_11RandomState_90hypergeometric[] = "\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 "; |
| 8362 | +static PyObject *__pyx_pw_6mtrand_11RandomState_91hypergeometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 8363 | PyObject *__pyx_v_ngood = 0; |
| 8364 | PyObject *__pyx_v_nbad = 0; |
| 8365 | PyObject *__pyx_v_nsample = 0; |
| 8366 | PyObject *__pyx_v_size = 0; |
| 8367 | - PyArrayObject *__pyx_v_ongood = 0; |
| 8368 | - PyArrayObject *__pyx_v_onbad = 0; |
| 8369 | - PyArrayObject *__pyx_v_onsample = 0; |
| 8370 | - long __pyx_v_lngood; |
| 8371 | - long __pyx_v_lnbad; |
| 8372 | - long __pyx_v_lnsample; |
| 8373 | - PyObject *__pyx_r = NULL; |
| 8374 | + PyObject *__pyx_r = 0; |
| 8375 | __Pyx_RefNannyDeclarations |
| 8376 | - int __pyx_t_1; |
| 8377 | - PyObject *__pyx_t_2 = NULL; |
| 8378 | - PyObject *__pyx_t_3 = NULL; |
| 8379 | - PyObject *__pyx_t_4 = NULL; |
| 8380 | - PyObject *__pyx_t_5 = NULL; |
| 8381 | - PyObject *__pyx_t_6 = NULL; |
| 8382 | - int __pyx_lineno = 0; |
| 8383 | - const char *__pyx_filename = NULL; |
| 8384 | - int __pyx_clineno = 0; |
| 8385 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ngood,&__pyx_n_s__nbad,&__pyx_n_s__nsample,&__pyx_n_s__size,0}; |
| 8386 | - __Pyx_RefNannySetupContext("hypergeometric"); |
| 8387 | + __Pyx_RefNannySetupContext("hypergeometric (wrapper)", 0); |
| 8388 | { |
| 8389 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ngood,&__pyx_n_s__nbad,&__pyx_n_s__nsample,&__pyx_n_s__size,0}; |
| 8390 | PyObject* values[4] = {0,0,0,0}; |
| 8391 | + |
| 8392 | + /* "mtrand.pyx":3669 |
| 8393 | + * return discd_array(self.internal_state, rk_geometric, size, op) |
| 8394 | + * |
| 8395 | + * def hypergeometric(self, ngood, nbad, nsample, size=None): # <<<<<<<<<<<<<< |
| 8396 | + * """ |
| 8397 | + * hypergeometric(ngood, nbad, nsample, size=None) |
| 8398 | + */ |
| 8399 | values[3] = ((PyObject *)Py_None); |
| 8400 | if (unlikely(__pyx_kwds)) { |
| 8401 | Py_ssize_t kw_args; |
| 8402 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 8403 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 8404 | + switch (pos_args) { |
| 8405 | case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); |
| 8406 | case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); |
| 8407 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 8408 | @@ -15628,20 +16205,17 @@ |
| 8409 | default: goto __pyx_L5_argtuple_error; |
| 8410 | } |
| 8411 | kw_args = PyDict_Size(__pyx_kwds); |
| 8412 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 8413 | + switch (pos_args) { |
| 8414 | case 0: |
| 8415 | - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ngood); |
| 8416 | - if (likely(values[0])) kw_args--; |
| 8417 | + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ngood)) != 0)) kw_args--; |
| 8418 | else goto __pyx_L5_argtuple_error; |
| 8419 | case 1: |
| 8420 | - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nbad); |
| 8421 | - if (likely(values[1])) kw_args--; |
| 8422 | + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nbad)) != 0)) kw_args--; |
| 8423 | else { |
| 8424 | __Pyx_RaiseArgtupleInvalid("hypergeometric", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3669; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 8425 | } |
| 8426 | case 2: |
| 8427 | - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nsample); |
| 8428 | - if (likely(values[2])) kw_args--; |
| 8429 | + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nsample)) != 0)) kw_args--; |
| 8430 | else { |
| 8431 | __Pyx_RaiseArgtupleInvalid("hypergeometric", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3669; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 8432 | } |
| 8433 | @@ -15652,7 +16226,7 @@ |
| 8434 | } |
| 8435 | } |
| 8436 | if (unlikely(kw_args > 0)) { |
| 8437 | - 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;} |
| 8438 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hypergeometric") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3669; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 8439 | } |
| 8440 | } else { |
| 8441 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 8442 | @@ -15677,6 +16251,30 @@ |
| 8443 | __Pyx_RefNannyFinishContext(); |
| 8444 | return NULL; |
| 8445 | __pyx_L4_argument_unpacking_done:; |
| 8446 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_90hypergeometric(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_ngood, __pyx_v_nbad, __pyx_v_nsample, __pyx_v_size); |
| 8447 | + __Pyx_RefNannyFinishContext(); |
| 8448 | + return __pyx_r; |
| 8449 | +} |
| 8450 | + |
| 8451 | +static PyObject *__pyx_pf_6mtrand_11RandomState_90hypergeometric(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_ngood, PyObject *__pyx_v_nbad, PyObject *__pyx_v_nsample, PyObject *__pyx_v_size) { |
| 8452 | + PyArrayObject *__pyx_v_ongood = 0; |
| 8453 | + PyArrayObject *__pyx_v_onbad = 0; |
| 8454 | + PyArrayObject *__pyx_v_onsample = 0; |
| 8455 | + long __pyx_v_lngood; |
| 8456 | + long __pyx_v_lnbad; |
| 8457 | + long __pyx_v_lnsample; |
| 8458 | + PyObject *__pyx_r = NULL; |
| 8459 | + __Pyx_RefNannyDeclarations |
| 8460 | + int __pyx_t_1; |
| 8461 | + PyObject *__pyx_t_2 = NULL; |
| 8462 | + PyObject *__pyx_t_3 = NULL; |
| 8463 | + PyObject *__pyx_t_4 = NULL; |
| 8464 | + PyObject *__pyx_t_5 = NULL; |
| 8465 | + PyObject *__pyx_t_6 = NULL; |
| 8466 | + int __pyx_lineno = 0; |
| 8467 | + const char *__pyx_filename = NULL; |
| 8468 | + int __pyx_clineno = 0; |
| 8469 | + __Pyx_RefNannySetupContext("hypergeometric", 0); |
| 8470 | |
| 8471 | /* "mtrand.pyx":3756 |
| 8472 | * cdef long lngood, lnbad, lnsample |
| 8473 | @@ -15722,8 +16320,7 @@ |
| 8474 | * raise ValueError("ngood < 1") |
| 8475 | * if nbad < 1: |
| 8476 | */ |
| 8477 | - __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;} |
| 8478 | - __Pyx_GOTREF(__pyx_t_2); |
| 8479 | + __pyx_t_2 = PyObject_RichCompare(__pyx_v_ngood, __pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 8480 | __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;} |
| 8481 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 8482 | if (__pyx_t_1) { |
| 8483 | @@ -15740,9 +16337,9 @@ |
| 8484 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 8485 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 8486 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3761; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 8487 | - goto __pyx_L7; |
| 8488 | + goto __pyx_L4; |
| 8489 | } |
| 8490 | - __pyx_L7:; |
| 8491 | + __pyx_L4:; |
| 8492 | |
| 8493 | /* "mtrand.pyx":3762 |
| 8494 | * if ngood < 1: |
| 8495 | @@ -15751,8 +16348,7 @@ |
| 8496 | * raise ValueError("nbad < 1") |
| 8497 | * if nsample < 1: |
| 8498 | */ |
| 8499 | - __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;} |
| 8500 | - __Pyx_GOTREF(__pyx_t_2); |
| 8501 | + __pyx_t_2 = PyObject_RichCompare(__pyx_v_nbad, __pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 8502 | __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;} |
| 8503 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 8504 | if (__pyx_t_1) { |
| 8505 | @@ -15769,9 +16365,9 @@ |
| 8506 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 8507 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 8508 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3763; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 8509 | - goto __pyx_L8; |
| 8510 | + goto __pyx_L5; |
| 8511 | } |
| 8512 | - __pyx_L8:; |
| 8513 | + __pyx_L5:; |
| 8514 | |
| 8515 | /* "mtrand.pyx":3764 |
| 8516 | * if nbad < 1: |
| 8517 | @@ -15780,8 +16376,7 @@ |
| 8518 | * raise ValueError("nsample < 1") |
| 8519 | * if ngood + nbad < nsample: |
| 8520 | */ |
| 8521 | - __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;} |
| 8522 | - __Pyx_GOTREF(__pyx_t_2); |
| 8523 | + __pyx_t_2 = PyObject_RichCompare(__pyx_v_nsample, __pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3764; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 8524 | __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;} |
| 8525 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 8526 | if (__pyx_t_1) { |
| 8527 | @@ -15798,9 +16393,9 @@ |
| 8528 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 8529 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 8530 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 8531 | - goto __pyx_L9; |
| 8532 | + goto __pyx_L6; |
| 8533 | } |
| 8534 | - __pyx_L9:; |
| 8535 | + __pyx_L6:; |
| 8536 | |
| 8537 | /* "mtrand.pyx":3766 |
| 8538 | * if nsample < 1: |
| 8539 | @@ -15811,8 +16406,7 @@ |
| 8540 | */ |
| 8541 | __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;} |
| 8542 | __Pyx_GOTREF(__pyx_t_2); |
| 8543 | - __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;} |
| 8544 | - __Pyx_GOTREF(__pyx_t_3); |
| 8545 | + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_v_nsample, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 8546 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 8547 | __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;} |
| 8548 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 8549 | @@ -15830,9 +16424,9 @@ |
| 8550 | __Pyx_Raise(__pyx_t_3, 0, 0, 0); |
| 8551 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 8552 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 8553 | - goto __pyx_L10; |
| 8554 | + goto __pyx_L7; |
| 8555 | } |
| 8556 | - __pyx_L10:; |
| 8557 | + __pyx_L7:; |
| 8558 | |
| 8559 | /* "mtrand.pyx":3768 |
| 8560 | * if ngood + nbad < nsample: |
| 8561 | @@ -15850,14 +16444,14 @@ |
| 8562 | * |
| 8563 | * |
| 8564 | */ |
| 8565 | - __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;} |
| 8566 | + __pyx_t_3 = __pyx_f_6mtrand_discnmN_array_sc(__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;} |
| 8567 | __Pyx_GOTREF(__pyx_t_3); |
| 8568 | __pyx_r = __pyx_t_3; |
| 8569 | __pyx_t_3 = 0; |
| 8570 | goto __pyx_L0; |
| 8571 | - goto __pyx_L6; |
| 8572 | + goto __pyx_L3; |
| 8573 | } |
| 8574 | - __pyx_L6:; |
| 8575 | + __pyx_L3:; |
| 8576 | |
| 8577 | /* "mtrand.pyx":3772 |
| 8578 | * |
| 8579 | @@ -15925,7 +16519,7 @@ |
| 8580 | __Pyx_GOTREF(__pyx_t_4); |
| 8581 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 8582 | __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;} |
| 8583 | - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| 8584 | + __Pyx_GOTREF(__pyx_t_3); |
| 8585 | __Pyx_INCREF(((PyObject *)__pyx_v_ongood)); |
| 8586 | PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_ongood)); |
| 8587 | __Pyx_GIVEREF(((PyObject *)__pyx_v_ongood)); |
| 8588 | @@ -15937,7 +16531,7 @@ |
| 8589 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 8590 | __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; |
| 8591 | __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;} |
| 8592 | - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| 8593 | + __Pyx_GOTREF(__pyx_t_3); |
| 8594 | PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); |
| 8595 | __Pyx_GIVEREF(__pyx_t_5); |
| 8596 | __pyx_t_5 = 0; |
| 8597 | @@ -15961,9 +16555,9 @@ |
| 8598 | __Pyx_Raise(__pyx_t_5, 0, 0, 0); |
| 8599 | __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| 8600 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 8601 | - goto __pyx_L11; |
| 8602 | + goto __pyx_L8; |
| 8603 | } |
| 8604 | - __pyx_L11:; |
| 8605 | + __pyx_L8:; |
| 8606 | |
| 8607 | /* "mtrand.pyx":3779 |
| 8608 | * if np.any(np.less(ongood, 1)): |
| 8609 | @@ -15983,7 +16577,7 @@ |
| 8610 | __Pyx_GOTREF(__pyx_t_2); |
| 8611 | __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| 8612 | __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;} |
| 8613 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 8614 | + __Pyx_GOTREF(__pyx_t_5); |
| 8615 | __Pyx_INCREF(((PyObject *)__pyx_v_onbad)); |
| 8616 | PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_onbad)); |
| 8617 | __Pyx_GIVEREF(((PyObject *)__pyx_v_onbad)); |
| 8618 | @@ -15995,7 +16589,7 @@ |
| 8619 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 8620 | __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| 8621 | __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;} |
| 8622 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 8623 | + __Pyx_GOTREF(__pyx_t_5); |
| 8624 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); |
| 8625 | __Pyx_GIVEREF(__pyx_t_4); |
| 8626 | __pyx_t_4 = 0; |
| 8627 | @@ -16019,9 +16613,9 @@ |
| 8628 | __Pyx_Raise(__pyx_t_4, 0, 0, 0); |
| 8629 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 8630 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 8631 | - goto __pyx_L12; |
| 8632 | + goto __pyx_L9; |
| 8633 | } |
| 8634 | - __pyx_L12:; |
| 8635 | + __pyx_L9:; |
| 8636 | |
| 8637 | /* "mtrand.pyx":3781 |
| 8638 | * if np.any(np.less(onbad, 1)): |
| 8639 | @@ -16041,7 +16635,7 @@ |
| 8640 | __Pyx_GOTREF(__pyx_t_3); |
| 8641 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 8642 | __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;} |
| 8643 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 8644 | + __Pyx_GOTREF(__pyx_t_4); |
| 8645 | __Pyx_INCREF(((PyObject *)__pyx_v_onsample)); |
| 8646 | PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_onsample)); |
| 8647 | __Pyx_GIVEREF(((PyObject *)__pyx_v_onsample)); |
| 8648 | @@ -16053,7 +16647,7 @@ |
| 8649 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 8650 | __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; |
| 8651 | __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;} |
| 8652 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 8653 | + __Pyx_GOTREF(__pyx_t_4); |
| 8654 | PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); |
| 8655 | __Pyx_GIVEREF(__pyx_t_2); |
| 8656 | __pyx_t_2 = 0; |
| 8657 | @@ -16077,9 +16671,9 @@ |
| 8658 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 8659 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 8660 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 8661 | - goto __pyx_L13; |
| 8662 | + goto __pyx_L10; |
| 8663 | } |
| 8664 | - __pyx_L13:; |
| 8665 | + __pyx_L10:; |
| 8666 | |
| 8667 | /* "mtrand.pyx":3783 |
| 8668 | * if np.any(np.less(onsample, 1)): |
| 8669 | @@ -16104,7 +16698,7 @@ |
| 8670 | __Pyx_GOTREF(__pyx_t_3); |
| 8671 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 8672 | __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;} |
| 8673 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 8674 | + __Pyx_GOTREF(__pyx_t_2); |
| 8675 | __Pyx_INCREF(((PyObject *)__pyx_v_ongood)); |
| 8676 | PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_ongood)); |
| 8677 | __Pyx_GIVEREF(((PyObject *)__pyx_v_ongood)); |
| 8678 | @@ -16116,7 +16710,7 @@ |
| 8679 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 8680 | __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; |
| 8681 | __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;} |
| 8682 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 8683 | + __Pyx_GOTREF(__pyx_t_2); |
| 8684 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); |
| 8685 | __Pyx_GIVEREF(__pyx_t_6); |
| 8686 | __Pyx_INCREF(((PyObject *)__pyx_v_onsample)); |
| 8687 | @@ -16128,7 +16722,7 @@ |
| 8688 | __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| 8689 | __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; |
| 8690 | __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;} |
| 8691 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 8692 | + __Pyx_GOTREF(__pyx_t_2); |
| 8693 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); |
| 8694 | __Pyx_GIVEREF(__pyx_t_6); |
| 8695 | __pyx_t_6 = 0; |
| 8696 | @@ -16152,9 +16746,9 @@ |
| 8697 | __Pyx_Raise(__pyx_t_6, 0, 0, 0); |
| 8698 | __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; |
| 8699 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 8700 | - goto __pyx_L14; |
| 8701 | + goto __pyx_L11; |
| 8702 | } |
| 8703 | - __pyx_L14:; |
| 8704 | + __pyx_L11:; |
| 8705 | |
| 8706 | /* "mtrand.pyx":3785 |
| 8707 | * if np.any(np.less(np.add(ongood, onbad),onsample)): |
| 8708 | @@ -16172,7 +16766,7 @@ |
| 8709 | * |
| 8710 | * def logseries(self, p, size=None): |
| 8711 | */ |
| 8712 | - __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;} |
| 8713 | + __pyx_t_6 = __pyx_f_6mtrand_discnmN_array(__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;} |
| 8714 | __Pyx_GOTREF(__pyx_t_6); |
| 8715 | __pyx_r = __pyx_t_6; |
| 8716 | __pyx_t_6 = 0; |
| 8717 | @@ -16197,49 +16791,40 @@ |
| 8718 | return __pyx_r; |
| 8719 | } |
| 8720 | |
| 8721 | -/* "mtrand.pyx":3788 |
| 8722 | +/* Python wrapper */ |
| 8723 | +static PyObject *__pyx_pw_6mtrand_11RandomState_93logseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 8724 | +static char __pyx_doc_6mtrand_11RandomState_92logseries[] = "\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 "; |
| 8725 | +static PyObject *__pyx_pw_6mtrand_11RandomState_93logseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 8726 | + PyObject *__pyx_v_p = 0; |
| 8727 | + PyObject *__pyx_v_size = 0; |
| 8728 | + PyObject *__pyx_r = 0; |
| 8729 | + __Pyx_RefNannyDeclarations |
| 8730 | + __Pyx_RefNannySetupContext("logseries (wrapper)", 0); |
| 8731 | + { |
| 8732 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__size,0}; |
| 8733 | + PyObject* values[2] = {0,0}; |
| 8734 | + |
| 8735 | + /* "mtrand.pyx":3788 |
| 8736 | * ongood, onbad, onsample) |
| 8737 | * |
| 8738 | * def logseries(self, p, size=None): # <<<<<<<<<<<<<< |
| 8739 | * """ |
| 8740 | * logseries(p, size=None) |
| 8741 | */ |
| 8742 | - |
| 8743 | -static PyObject *__pyx_pf_6mtrand_11RandomState_46logseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 8744 | -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 "; |
| 8745 | -static PyObject *__pyx_pf_6mtrand_11RandomState_46logseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 8746 | - PyObject *__pyx_v_p = 0; |
| 8747 | - PyObject *__pyx_v_size = 0; |
| 8748 | - PyArrayObject *__pyx_v_op = 0; |
| 8749 | - double __pyx_v_fp; |
| 8750 | - PyObject *__pyx_r = NULL; |
| 8751 | - __Pyx_RefNannyDeclarations |
| 8752 | - int __pyx_t_1; |
| 8753 | - PyObject *__pyx_t_2 = NULL; |
| 8754 | - PyObject *__pyx_t_3 = NULL; |
| 8755 | - PyObject *__pyx_t_4 = NULL; |
| 8756 | - PyObject *__pyx_t_5 = NULL; |
| 8757 | - int __pyx_lineno = 0; |
| 8758 | - const char *__pyx_filename = NULL; |
| 8759 | - int __pyx_clineno = 0; |
| 8760 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__size,0}; |
| 8761 | - __Pyx_RefNannySetupContext("logseries"); |
| 8762 | - { |
| 8763 | - PyObject* values[2] = {0,0}; |
| 8764 | values[1] = ((PyObject *)Py_None); |
| 8765 | if (unlikely(__pyx_kwds)) { |
| 8766 | Py_ssize_t kw_args; |
| 8767 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 8768 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 8769 | + switch (pos_args) { |
| 8770 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 8771 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 8772 | case 0: break; |
| 8773 | default: goto __pyx_L5_argtuple_error; |
| 8774 | } |
| 8775 | kw_args = PyDict_Size(__pyx_kwds); |
| 8776 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 8777 | + switch (pos_args) { |
| 8778 | case 0: |
| 8779 | - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); |
| 8780 | - if (likely(values[0])) kw_args--; |
| 8781 | + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; |
| 8782 | else goto __pyx_L5_argtuple_error; |
| 8783 | case 1: |
| 8784 | if (kw_args > 0) { |
| 8785 | @@ -16248,7 +16833,7 @@ |
| 8786 | } |
| 8787 | } |
| 8788 | if (unlikely(kw_args > 0)) { |
| 8789 | - 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;} |
| 8790 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "logseries") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3788; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 8791 | } |
| 8792 | } else { |
| 8793 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 8794 | @@ -16269,6 +16854,25 @@ |
| 8795 | __Pyx_RefNannyFinishContext(); |
| 8796 | return NULL; |
| 8797 | __pyx_L4_argument_unpacking_done:; |
| 8798 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_92logseries(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_p, __pyx_v_size); |
| 8799 | + __Pyx_RefNannyFinishContext(); |
| 8800 | + return __pyx_r; |
| 8801 | +} |
| 8802 | + |
| 8803 | +static PyObject *__pyx_pf_6mtrand_11RandomState_92logseries(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_p, PyObject *__pyx_v_size) { |
| 8804 | + PyArrayObject *__pyx_v_op = 0; |
| 8805 | + double __pyx_v_fp; |
| 8806 | + PyObject *__pyx_r = NULL; |
| 8807 | + __Pyx_RefNannyDeclarations |
| 8808 | + int __pyx_t_1; |
| 8809 | + PyObject *__pyx_t_2 = NULL; |
| 8810 | + PyObject *__pyx_t_3 = NULL; |
| 8811 | + PyObject *__pyx_t_4 = NULL; |
| 8812 | + PyObject *__pyx_t_5 = NULL; |
| 8813 | + int __pyx_lineno = 0; |
| 8814 | + const char *__pyx_filename = NULL; |
| 8815 | + int __pyx_clineno = 0; |
| 8816 | + __Pyx_RefNannySetupContext("logseries", 0); |
| 8817 | |
| 8818 | /* "mtrand.pyx":3865 |
| 8819 | * cdef double fp |
| 8820 | @@ -16311,9 +16915,9 @@ |
| 8821 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 8822 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 8823 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3868; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 8824 | - goto __pyx_L7; |
| 8825 | + goto __pyx_L4; |
| 8826 | } |
| 8827 | - __pyx_L7:; |
| 8828 | + __pyx_L4:; |
| 8829 | |
| 8830 | /* "mtrand.pyx":3869 |
| 8831 | * if fp <= 0.0: |
| 8832 | @@ -16337,9 +16941,9 @@ |
| 8833 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 8834 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 8835 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3870; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 8836 | - goto __pyx_L8; |
| 8837 | + goto __pyx_L5; |
| 8838 | } |
| 8839 | - __pyx_L8:; |
| 8840 | + __pyx_L5:; |
| 8841 | |
| 8842 | /* "mtrand.pyx":3871 |
| 8843 | * if fp >= 1.0: |
| 8844 | @@ -16349,14 +16953,14 @@ |
| 8845 | * PyErr_Clear() |
| 8846 | */ |
| 8847 | __Pyx_XDECREF(__pyx_r); |
| 8848 | - __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;} |
| 8849 | + __pyx_t_2 = __pyx_f_6mtrand_discd_array_sc(__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;} |
| 8850 | __Pyx_GOTREF(__pyx_t_2); |
| 8851 | __pyx_r = __pyx_t_2; |
| 8852 | __pyx_t_2 = 0; |
| 8853 | goto __pyx_L0; |
| 8854 | - goto __pyx_L6; |
| 8855 | + goto __pyx_L3; |
| 8856 | } |
| 8857 | - __pyx_L6:; |
| 8858 | + __pyx_L3:; |
| 8859 | |
| 8860 | /* "mtrand.pyx":3873 |
| 8861 | * return discd_array_sc(self.internal_state, rk_logseries, size, fp) |
| 8862 | @@ -16400,7 +17004,7 @@ |
| 8863 | __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;} |
| 8864 | __Pyx_GOTREF(__pyx_t_2); |
| 8865 | __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;} |
| 8866 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 8867 | + __Pyx_GOTREF(__pyx_t_5); |
| 8868 | __Pyx_INCREF(((PyObject *)__pyx_v_op)); |
| 8869 | PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_op)); |
| 8870 | __Pyx_GIVEREF(((PyObject *)__pyx_v_op)); |
| 8871 | @@ -16412,7 +17016,7 @@ |
| 8872 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 8873 | __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; |
| 8874 | __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;} |
| 8875 | - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); |
| 8876 | + __Pyx_GOTREF(__pyx_t_5); |
| 8877 | PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); |
| 8878 | __Pyx_GIVEREF(__pyx_t_2); |
| 8879 | __pyx_t_2 = 0; |
| 8880 | @@ -16436,9 +17040,9 @@ |
| 8881 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 8882 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 8883 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 8884 | - goto __pyx_L9; |
| 8885 | + goto __pyx_L6; |
| 8886 | } |
| 8887 | - __pyx_L9:; |
| 8888 | + __pyx_L6:; |
| 8889 | |
| 8890 | /* "mtrand.pyx":3878 |
| 8891 | * if np.any(np.less_equal(op, 0.0)): |
| 8892 | @@ -16460,7 +17064,7 @@ |
| 8893 | __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;} |
| 8894 | __Pyx_GOTREF(__pyx_t_2); |
| 8895 | __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;} |
| 8896 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 8897 | + __Pyx_GOTREF(__pyx_t_4); |
| 8898 | __Pyx_INCREF(((PyObject *)__pyx_v_op)); |
| 8899 | PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_op)); |
| 8900 | __Pyx_GIVEREF(((PyObject *)__pyx_v_op)); |
| 8901 | @@ -16472,7 +17076,7 @@ |
| 8902 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 8903 | __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; |
| 8904 | __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;} |
| 8905 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 8906 | + __Pyx_GOTREF(__pyx_t_4); |
| 8907 | PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); |
| 8908 | __Pyx_GIVEREF(__pyx_t_2); |
| 8909 | __pyx_t_2 = 0; |
| 8910 | @@ -16496,9 +17100,9 @@ |
| 8911 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 8912 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 8913 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 8914 | - goto __pyx_L10; |
| 8915 | + goto __pyx_L7; |
| 8916 | } |
| 8917 | - __pyx_L10:; |
| 8918 | + __pyx_L7:; |
| 8919 | |
| 8920 | /* "mtrand.pyx":3880 |
| 8921 | * if np.any(np.greater_equal(op, 1.0)): |
| 8922 | @@ -16508,7 +17112,7 @@ |
| 8923 | * # Multivariate distributions: |
| 8924 | */ |
| 8925 | __Pyx_XDECREF(__pyx_r); |
| 8926 | - __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;} |
| 8927 | + __pyx_t_2 = __pyx_f_6mtrand_discd_array(__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;} |
| 8928 | __Pyx_GOTREF(__pyx_t_2); |
| 8929 | __pyx_r = __pyx_t_2; |
| 8930 | __pyx_t_2 = 0; |
| 8931 | @@ -16530,51 +17134,32 @@ |
| 8932 | return __pyx_r; |
| 8933 | } |
| 8934 | |
| 8935 | -/* "mtrand.pyx":3883 |
| 8936 | - * |
| 8937 | - * # Multivariate distributions: |
| 8938 | - * def multivariate_normal(self, mean, cov, size=None): # <<<<<<<<<<<<<< |
| 8939 | - * """ |
| 8940 | - * multivariate_normal(mean, cov[, size]) |
| 8941 | - */ |
| 8942 | - |
| 8943 | -static PyObject *__pyx_pf_6mtrand_11RandomState_47multivariate_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 8944 | -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 "; |
| 8945 | -static PyObject *__pyx_pf_6mtrand_11RandomState_47multivariate_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 8946 | +/* Python wrapper */ |
| 8947 | +static PyObject *__pyx_pw_6mtrand_11RandomState_95multivariate_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 8948 | +static char __pyx_doc_6mtrand_11RandomState_94multivariate_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 "; |
| 8949 | +static PyObject *__pyx_pw_6mtrand_11RandomState_95multivariate_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 8950 | PyObject *__pyx_v_mean = 0; |
| 8951 | PyObject *__pyx_v_cov = 0; |
| 8952 | PyObject *__pyx_v_size = 0; |
| 8953 | - PyObject *__pyx_v_shape = NULL; |
| 8954 | - PyObject *__pyx_v_final_shape = NULL; |
| 8955 | - PyObject *__pyx_v_x = NULL; |
| 8956 | - PyObject *__pyx_v_svd = NULL; |
| 8957 | - PyObject *__pyx_v_u = NULL; |
| 8958 | - PyObject *__pyx_v_s = NULL; |
| 8959 | - PyObject *__pyx_v_v = NULL; |
| 8960 | - PyObject *__pyx_r = NULL; |
| 8961 | + PyObject *__pyx_r = 0; |
| 8962 | __Pyx_RefNannyDeclarations |
| 8963 | - PyObject *__pyx_t_1 = NULL; |
| 8964 | - PyObject *__pyx_t_2 = NULL; |
| 8965 | - PyObject *__pyx_t_3 = NULL; |
| 8966 | - int __pyx_t_4; |
| 8967 | - Py_ssize_t __pyx_t_5; |
| 8968 | - int __pyx_t_6; |
| 8969 | - int __pyx_t_7; |
| 8970 | - int __pyx_t_8; |
| 8971 | - PyObject *__pyx_t_9 = NULL; |
| 8972 | - PyObject *__pyx_t_10 = NULL; |
| 8973 | - PyObject *(*__pyx_t_11)(PyObject *); |
| 8974 | - int __pyx_lineno = 0; |
| 8975 | - const char *__pyx_filename = NULL; |
| 8976 | - int __pyx_clineno = 0; |
| 8977 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__mean,&__pyx_n_s__cov,&__pyx_n_s__size,0}; |
| 8978 | - __Pyx_RefNannySetupContext("multivariate_normal"); |
| 8979 | + __Pyx_RefNannySetupContext("multivariate_normal (wrapper)", 0); |
| 8980 | { |
| 8981 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__mean,&__pyx_n_s__cov,&__pyx_n_s__size,0}; |
| 8982 | PyObject* values[3] = {0,0,0}; |
| 8983 | + |
| 8984 | + /* "mtrand.pyx":3883 |
| 8985 | + * |
| 8986 | + * # Multivariate distributions: |
| 8987 | + * def multivariate_normal(self, mean, cov, size=None): # <<<<<<<<<<<<<< |
| 8988 | + * """ |
| 8989 | + * multivariate_normal(mean, cov[, size]) |
| 8990 | + */ |
| 8991 | values[2] = ((PyObject *)Py_None); |
| 8992 | if (unlikely(__pyx_kwds)) { |
| 8993 | Py_ssize_t kw_args; |
| 8994 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 8995 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 8996 | + switch (pos_args) { |
| 8997 | case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); |
| 8998 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 8999 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 9000 | @@ -16582,14 +17167,12 @@ |
| 9001 | default: goto __pyx_L5_argtuple_error; |
| 9002 | } |
| 9003 | kw_args = PyDict_Size(__pyx_kwds); |
| 9004 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 9005 | + switch (pos_args) { |
| 9006 | case 0: |
| 9007 | - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mean); |
| 9008 | - if (likely(values[0])) kw_args--; |
| 9009 | + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mean)) != 0)) kw_args--; |
| 9010 | else goto __pyx_L5_argtuple_error; |
| 9011 | case 1: |
| 9012 | - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cov); |
| 9013 | - if (likely(values[1])) kw_args--; |
| 9014 | + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cov)) != 0)) kw_args--; |
| 9015 | else { |
| 9016 | __Pyx_RaiseArgtupleInvalid("multivariate_normal", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3883; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 9017 | } |
| 9018 | @@ -16600,7 +17183,7 @@ |
| 9019 | } |
| 9020 | } |
| 9021 | if (unlikely(kw_args > 0)) { |
| 9022 | - 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;} |
| 9023 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "multivariate_normal") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3883; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 9024 | } |
| 9025 | } else { |
| 9026 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 9027 | @@ -16623,6 +17206,36 @@ |
| 9028 | __Pyx_RefNannyFinishContext(); |
| 9029 | return NULL; |
| 9030 | __pyx_L4_argument_unpacking_done:; |
| 9031 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_94multivariate_normal(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_mean, __pyx_v_cov, __pyx_v_size); |
| 9032 | + __Pyx_RefNannyFinishContext(); |
| 9033 | + return __pyx_r; |
| 9034 | +} |
| 9035 | + |
| 9036 | +static PyObject *__pyx_pf_6mtrand_11RandomState_94multivariate_normal(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_mean, PyObject *__pyx_v_cov, PyObject *__pyx_v_size) { |
| 9037 | + PyObject *__pyx_v_shape = NULL; |
| 9038 | + PyObject *__pyx_v_final_shape = NULL; |
| 9039 | + PyObject *__pyx_v_x = NULL; |
| 9040 | + PyObject *__pyx_v_svd = NULL; |
| 9041 | + CYTHON_UNUSED PyObject *__pyx_v_u = NULL; |
| 9042 | + PyObject *__pyx_v_s = NULL; |
| 9043 | + PyObject *__pyx_v_v = NULL; |
| 9044 | + PyObject *__pyx_r = NULL; |
| 9045 | + __Pyx_RefNannyDeclarations |
| 9046 | + PyObject *__pyx_t_1 = NULL; |
| 9047 | + PyObject *__pyx_t_2 = NULL; |
| 9048 | + PyObject *__pyx_t_3 = NULL; |
| 9049 | + int __pyx_t_4; |
| 9050 | + Py_ssize_t __pyx_t_5; |
| 9051 | + int __pyx_t_6; |
| 9052 | + int __pyx_t_7; |
| 9053 | + int __pyx_t_8; |
| 9054 | + PyObject *__pyx_t_9 = NULL; |
| 9055 | + PyObject *__pyx_t_10 = NULL; |
| 9056 | + PyObject *(*__pyx_t_11)(PyObject *); |
| 9057 | + int __pyx_lineno = 0; |
| 9058 | + const char *__pyx_filename = NULL; |
| 9059 | + int __pyx_clineno = 0; |
| 9060 | + __Pyx_RefNannySetupContext("multivariate_normal", 0); |
| 9061 | __Pyx_INCREF(__pyx_v_mean); |
| 9062 | __Pyx_INCREF(__pyx_v_cov); |
| 9063 | |
| 9064 | @@ -16639,7 +17252,7 @@ |
| 9065 | __Pyx_GOTREF(__pyx_t_2); |
| 9066 | __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| 9067 | __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;} |
| 9068 | - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); |
| 9069 | + __Pyx_GOTREF(__pyx_t_1); |
| 9070 | __Pyx_INCREF(__pyx_v_mean); |
| 9071 | PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_mean); |
| 9072 | __Pyx_GIVEREF(__pyx_v_mean); |
| 9073 | @@ -16664,7 +17277,7 @@ |
| 9074 | __Pyx_GOTREF(__pyx_t_1); |
| 9075 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 9076 | __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;} |
| 9077 | - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| 9078 | + __Pyx_GOTREF(__pyx_t_3); |
| 9079 | __Pyx_INCREF(__pyx_v_cov); |
| 9080 | PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_cov); |
| 9081 | __Pyx_GIVEREF(__pyx_v_cov); |
| 9082 | @@ -16694,10 +17307,10 @@ |
| 9083 | * shape = size |
| 9084 | */ |
| 9085 | __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;} |
| 9086 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 9087 | + __Pyx_GOTREF(__pyx_t_2); |
| 9088 | __pyx_v_shape = ((PyObject *)__pyx_t_2); |
| 9089 | __pyx_t_2 = 0; |
| 9090 | - goto __pyx_L6; |
| 9091 | + goto __pyx_L3; |
| 9092 | } |
| 9093 | /*else*/ { |
| 9094 | |
| 9095 | @@ -16711,7 +17324,7 @@ |
| 9096 | __Pyx_INCREF(__pyx_v_size); |
| 9097 | __pyx_v_shape = __pyx_v_size; |
| 9098 | } |
| 9099 | - __pyx_L6:; |
| 9100 | + __pyx_L3:; |
| 9101 | |
| 9102 | /* "mtrand.pyx":3981 |
| 9103 | * else: |
| 9104 | @@ -16739,9 +17352,9 @@ |
| 9105 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 9106 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 9107 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3982; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 9108 | - goto __pyx_L7; |
| 9109 | + goto __pyx_L4; |
| 9110 | } |
| 9111 | - __pyx_L7:; |
| 9112 | + __pyx_L4:; |
| 9113 | |
| 9114 | /* "mtrand.pyx":3983 |
| 9115 | * if len(mean.shape) != 1: |
| 9116 | @@ -16766,8 +17379,7 @@ |
| 9117 | __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;} |
| 9118 | __Pyx_GOTREF(__pyx_t_1); |
| 9119 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 9120 | - __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;} |
| 9121 | - __Pyx_GOTREF(__pyx_t_2); |
| 9122 | + __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 9123 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 9124 | __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| 9125 | __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;} |
| 9126 | @@ -16790,9 +17402,9 @@ |
| 9127 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 9128 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 9129 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 9130 | - goto __pyx_L8; |
| 9131 | + goto __pyx_L5; |
| 9132 | } |
| 9133 | - __pyx_L8:; |
| 9134 | + __pyx_L5:; |
| 9135 | |
| 9136 | /* "mtrand.pyx":3985 |
| 9137 | * if (len(cov.shape) != 2) or (cov.shape[0] != cov.shape[1]): |
| 9138 | @@ -16811,8 +17423,7 @@ |
| 9139 | __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;} |
| 9140 | __Pyx_GOTREF(__pyx_t_3); |
| 9141 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 9142 | - __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;} |
| 9143 | - __Pyx_GOTREF(__pyx_t_2); |
| 9144 | + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3985; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 9145 | __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| 9146 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 9147 | __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;} |
| 9148 | @@ -16831,9 +17442,9 @@ |
| 9149 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 9150 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 9151 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3986; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 9152 | - goto __pyx_L9; |
| 9153 | + goto __pyx_L6; |
| 9154 | } |
| 9155 | - __pyx_L9:; |
| 9156 | + __pyx_L6:; |
| 9157 | |
| 9158 | /* "mtrand.pyx":3988 |
| 9159 | * raise ValueError("mean and cov must have same length") |
| 9160 | @@ -16856,16 +17467,16 @@ |
| 9161 | * final_shape.append(mean.shape[0]) |
| 9162 | */ |
| 9163 | __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;} |
| 9164 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 9165 | + __Pyx_GOTREF(__pyx_t_2); |
| 9166 | __Pyx_INCREF(__pyx_v_shape); |
| 9167 | PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape); |
| 9168 | __Pyx_GIVEREF(__pyx_v_shape); |
| 9169 | __Pyx_DECREF(__pyx_v_shape); |
| 9170 | __pyx_v_shape = ((PyObject *)__pyx_t_2); |
| 9171 | __pyx_t_2 = 0; |
| 9172 | - goto __pyx_L10; |
| 9173 | + goto __pyx_L7; |
| 9174 | } |
| 9175 | - __pyx_L10:; |
| 9176 | + __pyx_L7:; |
| 9177 | |
| 9178 | /* "mtrand.pyx":3990 |
| 9179 | * if isinstance(shape, int): |
| 9180 | @@ -16877,7 +17488,7 @@ |
| 9181 | __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;} |
| 9182 | __Pyx_GOTREF(__pyx_t_2); |
| 9183 | __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;} |
| 9184 | - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| 9185 | + __Pyx_GOTREF(__pyx_t_3); |
| 9186 | PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); |
| 9187 | __Pyx_GIVEREF(__pyx_t_2); |
| 9188 | __pyx_t_2 = 0; |
| 9189 | @@ -16894,9 +17505,6 @@ |
| 9190 | * # Create a matrix of independent standard normally distributed random |
| 9191 | * # numbers. The matrix has rows with the same length as mean and as |
| 9192 | */ |
| 9193 | - if (unlikely(((PyObject *)__pyx_v_final_shape) == Py_None)) { |
| 9194 | - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 9195 | - } |
| 9196 | __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;} |
| 9197 | __Pyx_GOTREF(__pyx_t_2); |
| 9198 | __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;} |
| 9199 | @@ -16912,7 +17520,7 @@ |
| 9200 | * x.shape = (np.multiply.reduce(final_shape[0:len(final_shape)-1]), |
| 9201 | * mean.shape[0]) |
| 9202 | */ |
| 9203 | - __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;} |
| 9204 | + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__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;} |
| 9205 | __Pyx_GOTREF(__pyx_t_3); |
| 9206 | __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;} |
| 9207 | __Pyx_GOTREF(__pyx_t_2); |
| 9208 | @@ -16923,7 +17531,7 @@ |
| 9209 | __Pyx_GOTREF(__pyx_t_2); |
| 9210 | __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| 9211 | __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;} |
| 9212 | - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); |
| 9213 | + __Pyx_GOTREF(__pyx_t_1); |
| 9214 | __Pyx_INCREF(((PyObject *)__pyx_v_final_shape)); |
| 9215 | PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_final_shape)); |
| 9216 | __Pyx_GIVEREF(((PyObject *)__pyx_v_final_shape)); |
| 9217 | @@ -16932,7 +17540,7 @@ |
| 9218 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 9219 | __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; |
| 9220 | __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;} |
| 9221 | - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); |
| 9222 | + __Pyx_GOTREF(__pyx_t_1); |
| 9223 | PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); |
| 9224 | __Pyx_GIVEREF(__pyx_t_9); |
| 9225 | __pyx_t_9 = 0; |
| 9226 | @@ -16958,14 +17566,11 @@ |
| 9227 | __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;} |
| 9228 | __Pyx_GOTREF(__pyx_t_9); |
| 9229 | __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| 9230 | - if (unlikely(((PyObject *)__pyx_v_final_shape) == Py_None)) { |
| 9231 | - 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;} |
| 9232 | - } |
| 9233 | - __pyx_t_5 = PyList_GET_SIZE(((PyObject *)__pyx_v_final_shape)); |
| 9234 | + __pyx_t_5 = PyList_GET_SIZE(((PyObject *)__pyx_v_final_shape)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3996; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 9235 | __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;} |
| 9236 | __Pyx_GOTREF(((PyObject *)__pyx_t_1)); |
| 9237 | __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;} |
| 9238 | - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| 9239 | + __Pyx_GOTREF(__pyx_t_3); |
| 9240 | PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); |
| 9241 | __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); |
| 9242 | __pyx_t_1 = 0; |
| 9243 | @@ -16987,7 +17592,7 @@ |
| 9244 | __Pyx_GOTREF(__pyx_t_9); |
| 9245 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 9246 | __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;} |
| 9247 | - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| 9248 | + __Pyx_GOTREF(__pyx_t_3); |
| 9249 | PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); |
| 9250 | __Pyx_GIVEREF(__pyx_t_1); |
| 9251 | PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_9); |
| 9252 | @@ -17013,14 +17618,18 @@ |
| 9253 | * (u,s,v) = svd(cov) |
| 9254 | */ |
| 9255 | __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;} |
| 9256 | - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| 9257 | + __Pyx_GOTREF(__pyx_t_3); |
| 9258 | __Pyx_INCREF(((PyObject *)__pyx_n_s__svd)); |
| 9259 | PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s__svd)); |
| 9260 | __Pyx_GIVEREF(((PyObject *)__pyx_n_s__svd)); |
| 9261 | __pyx_t_9 = __Pyx_Import(((PyObject *)__pyx_n_s_166), ((PyObject *)__pyx_t_3), -1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 9262 | __Pyx_GOTREF(__pyx_t_9); |
| 9263 | __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; |
| 9264 | - __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;} |
| 9265 | + __pyx_t_3 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__svd); |
| 9266 | + if (__pyx_t_3 == NULL) { |
| 9267 | + if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__svd); |
| 9268 | + if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 9269 | + } |
| 9270 | __Pyx_GOTREF(__pyx_t_3); |
| 9271 | __Pyx_INCREF(__pyx_t_3); |
| 9272 | __pyx_v_svd = __pyx_t_3; |
| 9273 | @@ -17035,7 +17644,7 @@ |
| 9274 | * # The rows of x now have the correct covariance but mean 0. Add |
| 9275 | */ |
| 9276 | __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;} |
| 9277 | - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); |
| 9278 | + __Pyx_GOTREF(__pyx_t_9); |
| 9279 | __Pyx_INCREF(__pyx_v_cov); |
| 9280 | PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_cov); |
| 9281 | __Pyx_GIVEREF(__pyx_v_cov); |
| 9282 | @@ -17044,21 +17653,22 @@ |
| 9283 | __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; |
| 9284 | if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { |
| 9285 | PyObject* sequence = __pyx_t_3; |
| 9286 | + #if CYTHON_COMPILING_IN_CPYTHON |
| 9287 | + Py_ssize_t size = Py_SIZE(sequence); |
| 9288 | + #else |
| 9289 | + Py_ssize_t size = PySequence_Size(sequence); |
| 9290 | + #endif |
| 9291 | + if (unlikely(size != 3)) { |
| 9292 | + if (size > 3) __Pyx_RaiseTooManyValuesError(3); |
| 9293 | + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); |
| 9294 | + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 9295 | + } |
| 9296 | + #if CYTHON_COMPILING_IN_CPYTHON |
| 9297 | if (likely(PyTuple_CheckExact(sequence))) { |
| 9298 | - if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) { |
| 9299 | - if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3); |
| 9300 | - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); |
| 9301 | - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 9302 | - } |
| 9303 | __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); |
| 9304 | __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); |
| 9305 | __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2); |
| 9306 | } else { |
| 9307 | - if (unlikely(PyList_GET_SIZE(sequence) != 3)) { |
| 9308 | - if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3); |
| 9309 | - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); |
| 9310 | - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 9311 | - } |
| 9312 | __pyx_t_9 = PyList_GET_ITEM(sequence, 0); |
| 9313 | __pyx_t_1 = PyList_GET_ITEM(sequence, 1); |
| 9314 | __pyx_t_2 = PyList_GET_ITEM(sequence, 2); |
| 9315 | @@ -17066,28 +17676,35 @@ |
| 9316 | __Pyx_INCREF(__pyx_t_9); |
| 9317 | __Pyx_INCREF(__pyx_t_1); |
| 9318 | __Pyx_INCREF(__pyx_t_2); |
| 9319 | + #else |
| 9320 | + __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 9321 | + __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 9322 | + __pyx_t_2 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 9323 | + #endif |
| 9324 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 9325 | - } else { |
| 9326 | + } else |
| 9327 | + { |
| 9328 | Py_ssize_t index = -1; |
| 9329 | __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;} |
| 9330 | __Pyx_GOTREF(__pyx_t_10); |
| 9331 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 9332 | __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext; |
| 9333 | - index = 0; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L11_unpacking_failed; |
| 9334 | + index = 0; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L8_unpacking_failed; |
| 9335 | __Pyx_GOTREF(__pyx_t_9); |
| 9336 | - index = 1; __pyx_t_1 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_1)) goto __pyx_L11_unpacking_failed; |
| 9337 | + index = 1; __pyx_t_1 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_1)) goto __pyx_L8_unpacking_failed; |
| 9338 | __Pyx_GOTREF(__pyx_t_1); |
| 9339 | - index = 2; __pyx_t_2 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_2)) goto __pyx_L11_unpacking_failed; |
| 9340 | + index = 2; __pyx_t_2 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_2)) goto __pyx_L8_unpacking_failed; |
| 9341 | __Pyx_GOTREF(__pyx_t_2); |
| 9342 | if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 9343 | + __pyx_t_11 = NULL; |
| 9344 | __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; |
| 9345 | - goto __pyx_L12_unpacking_done; |
| 9346 | - __pyx_L11_unpacking_failed:; |
| 9347 | + goto __pyx_L9_unpacking_done; |
| 9348 | + __pyx_L8_unpacking_failed:; |
| 9349 | __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; |
| 9350 | - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); |
| 9351 | - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); |
| 9352 | + __pyx_t_11 = NULL; |
| 9353 | + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); |
| 9354 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 9355 | - __pyx_L12_unpacking_done:; |
| 9356 | + __pyx_L9_unpacking_done:; |
| 9357 | } |
| 9358 | __pyx_v_u = __pyx_t_9; |
| 9359 | __pyx_t_9 = 0; |
| 9360 | @@ -17114,7 +17731,7 @@ |
| 9361 | __Pyx_GOTREF(__pyx_t_1); |
| 9362 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 9363 | __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;} |
| 9364 | - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| 9365 | + __Pyx_GOTREF(__pyx_t_3); |
| 9366 | __Pyx_INCREF(__pyx_v_s); |
| 9367 | PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_s); |
| 9368 | __Pyx_GIVEREF(__pyx_v_s); |
| 9369 | @@ -17126,7 +17743,7 @@ |
| 9370 | __Pyx_GOTREF(__pyx_t_3); |
| 9371 | __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; |
| 9372 | __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;} |
| 9373 | - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); |
| 9374 | + __Pyx_GOTREF(__pyx_t_9); |
| 9375 | PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3); |
| 9376 | __Pyx_GIVEREF(__pyx_t_3); |
| 9377 | __Pyx_INCREF(__pyx_v_v); |
| 9378 | @@ -17154,7 +17771,7 @@ |
| 9379 | __Pyx_GOTREF(__pyx_t_9); |
| 9380 | __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 9381 | __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;} |
| 9382 | - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); |
| 9383 | + __Pyx_GOTREF(__pyx_t_3); |
| 9384 | __Pyx_INCREF(__pyx_v_mean); |
| 9385 | PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_mean); |
| 9386 | __Pyx_GIVEREF(__pyx_v_mean); |
| 9387 | @@ -17177,9 +17794,6 @@ |
| 9388 | * return x |
| 9389 | * |
| 9390 | */ |
| 9391 | - if (unlikely(((PyObject *)__pyx_v_final_shape) == Py_None)) { |
| 9392 | - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 9393 | - } |
| 9394 | __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;} |
| 9395 | __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 9396 | 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;} |
| 9397 | @@ -17222,50 +17836,32 @@ |
| 9398 | return __pyx_r; |
| 9399 | } |
| 9400 | |
| 9401 | -/* "mtrand.pyx":4015 |
| 9402 | +/* Python wrapper */ |
| 9403 | +static PyObject *__pyx_pw_6mtrand_11RandomState_97multinomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 9404 | +static char __pyx_doc_6mtrand_11RandomState_96multinomial[] = "\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 "; |
| 9405 | +static PyObject *__pyx_pw_6mtrand_11RandomState_97multinomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 9406 | + npy_intp __pyx_v_n; |
| 9407 | + PyObject *__pyx_v_pvals = 0; |
| 9408 | + PyObject *__pyx_v_size = 0; |
| 9409 | + PyObject *__pyx_r = 0; |
| 9410 | + __Pyx_RefNannyDeclarations |
| 9411 | + __Pyx_RefNannySetupContext("multinomial (wrapper)", 0); |
| 9412 | + { |
| 9413 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n,&__pyx_n_s__pvals,&__pyx_n_s__size,0}; |
| 9414 | + PyObject* values[3] = {0,0,0}; |
| 9415 | + |
| 9416 | + /* "mtrand.pyx":4015 |
| 9417 | * return x |
| 9418 | * |
| 9419 | * def multinomial(self, npy_intp n, object pvals, size=None): # <<<<<<<<<<<<<< |
| 9420 | * """ |
| 9421 | * multinomial(n, pvals, size=None) |
| 9422 | */ |
| 9423 | - |
| 9424 | -static PyObject *__pyx_pf_6mtrand_11RandomState_48multinomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 9425 | -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 "; |
| 9426 | -static PyObject *__pyx_pf_6mtrand_11RandomState_48multinomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 9427 | - npy_intp __pyx_v_n; |
| 9428 | - PyObject *__pyx_v_pvals = 0; |
| 9429 | - PyObject *__pyx_v_size = 0; |
| 9430 | - npy_intp __pyx_v_d; |
| 9431 | - PyArrayObject *arrayObject_parr = 0; |
| 9432 | - PyArrayObject *arrayObject_mnarr = 0; |
| 9433 | - double *__pyx_v_pix; |
| 9434 | - long *__pyx_v_mnix; |
| 9435 | - npy_intp __pyx_v_i; |
| 9436 | - npy_intp __pyx_v_j; |
| 9437 | - npy_intp __pyx_v_dn; |
| 9438 | - double __pyx_v_Sum; |
| 9439 | - PyObject *__pyx_v_shape = NULL; |
| 9440 | - PyObject *__pyx_v_multin = NULL; |
| 9441 | - PyObject *__pyx_r = NULL; |
| 9442 | - __Pyx_RefNannyDeclarations |
| 9443 | - Py_ssize_t __pyx_t_1; |
| 9444 | - PyObject *__pyx_t_2 = NULL; |
| 9445 | - int __pyx_t_3; |
| 9446 | - PyObject *__pyx_t_4 = NULL; |
| 9447 | - PyObject *__pyx_t_5 = NULL; |
| 9448 | - long __pyx_t_6; |
| 9449 | - int __pyx_lineno = 0; |
| 9450 | - const char *__pyx_filename = NULL; |
| 9451 | - int __pyx_clineno = 0; |
| 9452 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n,&__pyx_n_s__pvals,&__pyx_n_s__size,0}; |
| 9453 | - __Pyx_RefNannySetupContext("multinomial"); |
| 9454 | - { |
| 9455 | - PyObject* values[3] = {0,0,0}; |
| 9456 | values[2] = ((PyObject *)Py_None); |
| 9457 | if (unlikely(__pyx_kwds)) { |
| 9458 | Py_ssize_t kw_args; |
| 9459 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 9460 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 9461 | + switch (pos_args) { |
| 9462 | case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); |
| 9463 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 9464 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 9465 | @@ -17273,14 +17869,12 @@ |
| 9466 | default: goto __pyx_L5_argtuple_error; |
| 9467 | } |
| 9468 | kw_args = PyDict_Size(__pyx_kwds); |
| 9469 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 9470 | + switch (pos_args) { |
| 9471 | case 0: |
| 9472 | - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); |
| 9473 | - if (likely(values[0])) kw_args--; |
| 9474 | + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n)) != 0)) kw_args--; |
| 9475 | else goto __pyx_L5_argtuple_error; |
| 9476 | case 1: |
| 9477 | - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pvals); |
| 9478 | - if (likely(values[1])) kw_args--; |
| 9479 | + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pvals)) != 0)) kw_args--; |
| 9480 | else { |
| 9481 | __Pyx_RaiseArgtupleInvalid("multinomial", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4015; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 9482 | } |
| 9483 | @@ -17291,7 +17885,7 @@ |
| 9484 | } |
| 9485 | } |
| 9486 | if (unlikely(kw_args > 0)) { |
| 9487 | - 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;} |
| 9488 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "multinomial") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4015; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 9489 | } |
| 9490 | } else { |
| 9491 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 9492 | @@ -17314,6 +17908,35 @@ |
| 9493 | __Pyx_RefNannyFinishContext(); |
| 9494 | return NULL; |
| 9495 | __pyx_L4_argument_unpacking_done:; |
| 9496 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_96multinomial(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_n, __pyx_v_pvals, __pyx_v_size); |
| 9497 | + __Pyx_RefNannyFinishContext(); |
| 9498 | + return __pyx_r; |
| 9499 | +} |
| 9500 | + |
| 9501 | +static PyObject *__pyx_pf_6mtrand_11RandomState_96multinomial(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, npy_intp __pyx_v_n, PyObject *__pyx_v_pvals, PyObject *__pyx_v_size) { |
| 9502 | + npy_intp __pyx_v_d; |
| 9503 | + PyArrayObject *arrayObject_parr = 0; |
| 9504 | + PyArrayObject *arrayObject_mnarr = 0; |
| 9505 | + double *__pyx_v_pix; |
| 9506 | + long *__pyx_v_mnix; |
| 9507 | + npy_intp __pyx_v_i; |
| 9508 | + npy_intp __pyx_v_j; |
| 9509 | + npy_intp __pyx_v_dn; |
| 9510 | + double __pyx_v_Sum; |
| 9511 | + PyObject *__pyx_v_shape = NULL; |
| 9512 | + PyObject *__pyx_v_multin = NULL; |
| 9513 | + PyObject *__pyx_r = NULL; |
| 9514 | + __Pyx_RefNannyDeclarations |
| 9515 | + Py_ssize_t __pyx_t_1; |
| 9516 | + PyObject *__pyx_t_2 = NULL; |
| 9517 | + int __pyx_t_3; |
| 9518 | + PyObject *__pyx_t_4 = NULL; |
| 9519 | + PyObject *__pyx_t_5 = NULL; |
| 9520 | + long __pyx_t_6; |
| 9521 | + int __pyx_lineno = 0; |
| 9522 | + const char *__pyx_filename = NULL; |
| 9523 | + int __pyx_clineno = 0; |
| 9524 | + __Pyx_RefNannySetupContext("multinomial", 0); |
| 9525 | |
| 9526 | /* "mtrand.pyx":4074 |
| 9527 | * cdef double Sum |
| 9528 | @@ -17369,9 +17992,9 @@ |
| 9529 | __Pyx_Raise(__pyx_t_2, 0, 0, 0); |
| 9530 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 9531 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 9532 | - goto __pyx_L6; |
| 9533 | + goto __pyx_L3; |
| 9534 | } |
| 9535 | - __pyx_L6:; |
| 9536 | + __pyx_L3:; |
| 9537 | |
| 9538 | /* "mtrand.pyx":4081 |
| 9539 | * raise ValueError("sum(pvals[:-1]) > 1.0") |
| 9540 | @@ -17393,13 +18016,13 @@ |
| 9541 | __pyx_t_2 = __Pyx_PyInt_to_py_npy_intp(__pyx_v_d); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 9542 | __Pyx_GOTREF(__pyx_t_2); |
| 9543 | __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;} |
| 9544 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 9545 | + __Pyx_GOTREF(__pyx_t_4); |
| 9546 | PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); |
| 9547 | __Pyx_GIVEREF(__pyx_t_2); |
| 9548 | __pyx_t_2 = 0; |
| 9549 | __pyx_v_shape = ((PyObject *)__pyx_t_4); |
| 9550 | __pyx_t_4 = 0; |
| 9551 | - goto __pyx_L7; |
| 9552 | + goto __pyx_L4; |
| 9553 | } |
| 9554 | |
| 9555 | /* "mtrand.pyx":4083 |
| 9556 | @@ -17422,7 +18045,7 @@ |
| 9557 | __pyx_t_4 = __Pyx_PyInt_to_py_npy_intp(__pyx_v_d); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 9558 | __Pyx_GOTREF(__pyx_t_4); |
| 9559 | __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;} |
| 9560 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 9561 | + __Pyx_GOTREF(__pyx_t_2); |
| 9562 | __Pyx_INCREF(__pyx_v_size); |
| 9563 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size); |
| 9564 | __Pyx_GIVEREF(__pyx_v_size); |
| 9565 | @@ -17431,7 +18054,7 @@ |
| 9566 | __pyx_t_4 = 0; |
| 9567 | __pyx_v_shape = ((PyObject *)__pyx_t_2); |
| 9568 | __pyx_t_2 = 0; |
| 9569 | - goto __pyx_L7; |
| 9570 | + goto __pyx_L4; |
| 9571 | } |
| 9572 | /*else*/ { |
| 9573 | |
| 9574 | @@ -17445,7 +18068,7 @@ |
| 9575 | __pyx_t_2 = __Pyx_PyInt_to_py_npy_intp(__pyx_v_d); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 9576 | __Pyx_GOTREF(__pyx_t_2); |
| 9577 | __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;} |
| 9578 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 9579 | + __Pyx_GOTREF(__pyx_t_4); |
| 9580 | PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); |
| 9581 | __Pyx_GIVEREF(__pyx_t_2); |
| 9582 | __pyx_t_2 = 0; |
| 9583 | @@ -17455,7 +18078,7 @@ |
| 9584 | __pyx_v_shape = __pyx_t_2; |
| 9585 | __pyx_t_2 = 0; |
| 9586 | } |
| 9587 | - __pyx_L7:; |
| 9588 | + __pyx_L4:; |
| 9589 | |
| 9590 | /* "mtrand.pyx":4088 |
| 9591 | * shape = size + (d,) |
| 9592 | @@ -17470,7 +18093,7 @@ |
| 9593 | __Pyx_GOTREF(__pyx_t_4); |
| 9594 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 9595 | __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;} |
| 9596 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 9597 | + __Pyx_GOTREF(__pyx_t_2); |
| 9598 | __Pyx_INCREF(__pyx_v_shape); |
| 9599 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape); |
| 9600 | __Pyx_GIVEREF(__pyx_v_shape); |
| 9601 | @@ -17562,7 +18185,7 @@ |
| 9602 | PyErr_Format(PyExc_ZeroDivisionError, "float division"); |
| 9603 | {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4096; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 9604 | } |
| 9605 | - (__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_v_pix[__pyx_v_j]) / __pyx_v_Sum)); |
| 9606 | + (__pyx_v_mnix[(__pyx_v_i + __pyx_v_j)]) = rk_binomial(__pyx_v_self->internal_state, __pyx_v_dn, ((__pyx_v_pix[__pyx_v_j]) / __pyx_v_Sum)); |
| 9607 | |
| 9608 | /* "mtrand.pyx":4097 |
| 9609 | * for j from 0 <= j < d-1: |
| 9610 | @@ -17590,10 +18213,10 @@ |
| 9611 | * Sum = Sum - pix[j] |
| 9612 | * if dn > 0: |
| 9613 | */ |
| 9614 | - goto __pyx_L11_break; |
| 9615 | - goto __pyx_L12; |
| 9616 | + goto __pyx_L8_break; |
| 9617 | + goto __pyx_L9; |
| 9618 | } |
| 9619 | - __pyx_L12:; |
| 9620 | + __pyx_L9:; |
| 9621 | |
| 9622 | /* "mtrand.pyx":4100 |
| 9623 | * if dn <= 0: |
| 9624 | @@ -17604,7 +18227,7 @@ |
| 9625 | */ |
| 9626 | __pyx_v_Sum = (__pyx_v_Sum - (__pyx_v_pix[__pyx_v_j])); |
| 9627 | } |
| 9628 | - __pyx_L11_break:; |
| 9629 | + __pyx_L8_break:; |
| 9630 | |
| 9631 | /* "mtrand.pyx":4101 |
| 9632 | * break |
| 9633 | @@ -17624,9 +18247,9 @@ |
| 9634 | * i = i + d |
| 9635 | */ |
| 9636 | (__pyx_v_mnix[((__pyx_v_i + __pyx_v_d) - 1)]) = __pyx_v_dn; |
| 9637 | - goto __pyx_L13; |
| 9638 | + goto __pyx_L10; |
| 9639 | } |
| 9640 | - __pyx_L13:; |
| 9641 | + __pyx_L10:; |
| 9642 | |
| 9643 | /* "mtrand.pyx":4104 |
| 9644 | * mnix[i+d-1] = dn |
| 9645 | @@ -17668,60 +18291,40 @@ |
| 9646 | return __pyx_r; |
| 9647 | } |
| 9648 | |
| 9649 | -/* "mtrand.pyx":4108 |
| 9650 | +/* Python wrapper */ |
| 9651 | +static PyObject *__pyx_pw_6mtrand_11RandomState_99dirichlet(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 9652 | +static char __pyx_doc_6mtrand_11RandomState_98dirichlet[] = "\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 "; |
| 9653 | +static PyObject *__pyx_pw_6mtrand_11RandomState_99dirichlet(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 9654 | + PyObject *__pyx_v_alpha = 0; |
| 9655 | + PyObject *__pyx_v_size = 0; |
| 9656 | + PyObject *__pyx_r = 0; |
| 9657 | + __Pyx_RefNannyDeclarations |
| 9658 | + __Pyx_RefNannySetupContext("dirichlet (wrapper)", 0); |
| 9659 | + { |
| 9660 | + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__alpha,&__pyx_n_s__size,0}; |
| 9661 | + PyObject* values[2] = {0,0}; |
| 9662 | + |
| 9663 | + /* "mtrand.pyx":4108 |
| 9664 | * return multin |
| 9665 | * |
| 9666 | * def dirichlet(self, object alpha, size=None): # <<<<<<<<<<<<<< |
| 9667 | * """ |
| 9668 | * dirichlet(alpha, size=None) |
| 9669 | */ |
| 9670 | - |
| 9671 | -static PyObject *__pyx_pf_6mtrand_11RandomState_49dirichlet(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ |
| 9672 | -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 "; |
| 9673 | -static PyObject *__pyx_pf_6mtrand_11RandomState_49dirichlet(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { |
| 9674 | - PyObject *__pyx_v_alpha = 0; |
| 9675 | - PyObject *__pyx_v_size = 0; |
| 9676 | - npy_intp __pyx_v_k; |
| 9677 | - npy_intp __pyx_v_totsize; |
| 9678 | - PyArrayObject *__pyx_v_alpha_arr = 0; |
| 9679 | - PyArrayObject *__pyx_v_val_arr = 0; |
| 9680 | - double *__pyx_v_alpha_data; |
| 9681 | - double *__pyx_v_val_data; |
| 9682 | - npy_intp __pyx_v_i; |
| 9683 | - npy_intp __pyx_v_j; |
| 9684 | - double __pyx_v_acc; |
| 9685 | - double __pyx_v_invacc; |
| 9686 | - PyObject *__pyx_v_shape = NULL; |
| 9687 | - PyObject *__pyx_v_diric = NULL; |
| 9688 | - PyObject *__pyx_r = NULL; |
| 9689 | - __Pyx_RefNannyDeclarations |
| 9690 | - Py_ssize_t __pyx_t_1; |
| 9691 | - PyObject *__pyx_t_2 = NULL; |
| 9692 | - int __pyx_t_3; |
| 9693 | - PyObject *__pyx_t_4 = NULL; |
| 9694 | - PyObject *__pyx_t_5 = NULL; |
| 9695 | - npy_intp __pyx_t_6; |
| 9696 | - int __pyx_lineno = 0; |
| 9697 | - const char *__pyx_filename = NULL; |
| 9698 | - int __pyx_clineno = 0; |
| 9699 | - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__alpha,&__pyx_n_s__size,0}; |
| 9700 | - __Pyx_RefNannySetupContext("dirichlet"); |
| 9701 | - { |
| 9702 | - PyObject* values[2] = {0,0}; |
| 9703 | values[1] = ((PyObject *)Py_None); |
| 9704 | if (unlikely(__pyx_kwds)) { |
| 9705 | Py_ssize_t kw_args; |
| 9706 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 9707 | + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); |
| 9708 | + switch (pos_args) { |
| 9709 | case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); |
| 9710 | case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); |
| 9711 | case 0: break; |
| 9712 | default: goto __pyx_L5_argtuple_error; |
| 9713 | } |
| 9714 | kw_args = PyDict_Size(__pyx_kwds); |
| 9715 | - switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 9716 | + switch (pos_args) { |
| 9717 | case 0: |
| 9718 | - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha); |
| 9719 | - if (likely(values[0])) kw_args--; |
| 9720 | + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha)) != 0)) kw_args--; |
| 9721 | else goto __pyx_L5_argtuple_error; |
| 9722 | case 1: |
| 9723 | if (kw_args > 0) { |
| 9724 | @@ -17730,7 +18333,7 @@ |
| 9725 | } |
| 9726 | } |
| 9727 | if (unlikely(kw_args > 0)) { |
| 9728 | - 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;} |
| 9729 | + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dirichlet") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4108; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 9730 | } |
| 9731 | } else { |
| 9732 | switch (PyTuple_GET_SIZE(__pyx_args)) { |
| 9733 | @@ -17751,6 +18354,36 @@ |
| 9734 | __Pyx_RefNannyFinishContext(); |
| 9735 | return NULL; |
| 9736 | __pyx_L4_argument_unpacking_done:; |
| 9737 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_98dirichlet(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), __pyx_v_alpha, __pyx_v_size); |
| 9738 | + __Pyx_RefNannyFinishContext(); |
| 9739 | + return __pyx_r; |
| 9740 | +} |
| 9741 | + |
| 9742 | +static PyObject *__pyx_pf_6mtrand_11RandomState_98dirichlet(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_alpha, PyObject *__pyx_v_size) { |
| 9743 | + npy_intp __pyx_v_k; |
| 9744 | + npy_intp __pyx_v_totsize; |
| 9745 | + PyArrayObject *__pyx_v_alpha_arr = 0; |
| 9746 | + PyArrayObject *__pyx_v_val_arr = 0; |
| 9747 | + double *__pyx_v_alpha_data; |
| 9748 | + double *__pyx_v_val_data; |
| 9749 | + npy_intp __pyx_v_i; |
| 9750 | + npy_intp __pyx_v_j; |
| 9751 | + double __pyx_v_acc; |
| 9752 | + double __pyx_v_invacc; |
| 9753 | + PyObject *__pyx_v_shape = NULL; |
| 9754 | + PyObject *__pyx_v_diric = NULL; |
| 9755 | + PyObject *__pyx_r = NULL; |
| 9756 | + __Pyx_RefNannyDeclarations |
| 9757 | + Py_ssize_t __pyx_t_1; |
| 9758 | + PyObject *__pyx_t_2 = NULL; |
| 9759 | + int __pyx_t_3; |
| 9760 | + PyObject *__pyx_t_4 = NULL; |
| 9761 | + PyObject *__pyx_t_5 = NULL; |
| 9762 | + npy_intp __pyx_t_6; |
| 9763 | + int __pyx_lineno = 0; |
| 9764 | + const char *__pyx_filename = NULL; |
| 9765 | + int __pyx_clineno = 0; |
| 9766 | + __Pyx_RefNannySetupContext("dirichlet", 0); |
| 9767 | |
| 9768 | /* "mtrand.pyx":4194 |
| 9769 | * cdef double acc, invacc |
| 9770 | @@ -17804,13 +18437,13 @@ |
| 9771 | __pyx_t_2 = __Pyx_PyInt_to_py_npy_intp(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 9772 | __Pyx_GOTREF(__pyx_t_2); |
| 9773 | __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;} |
| 9774 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 9775 | + __Pyx_GOTREF(__pyx_t_4); |
| 9776 | PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); |
| 9777 | __Pyx_GIVEREF(__pyx_t_2); |
| 9778 | __pyx_t_2 = 0; |
| 9779 | __pyx_v_shape = ((PyObject *)__pyx_t_4); |
| 9780 | __pyx_t_4 = 0; |
| 9781 | - goto __pyx_L6; |
| 9782 | + goto __pyx_L3; |
| 9783 | } |
| 9784 | |
| 9785 | /* "mtrand.pyx":4200 |
| 9786 | @@ -17833,7 +18466,7 @@ |
| 9787 | __pyx_t_4 = __Pyx_PyInt_to_py_npy_intp(__pyx_v_k); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 9788 | __Pyx_GOTREF(__pyx_t_4); |
| 9789 | __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;} |
| 9790 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 9791 | + __Pyx_GOTREF(__pyx_t_2); |
| 9792 | __Pyx_INCREF(__pyx_v_size); |
| 9793 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size); |
| 9794 | __Pyx_GIVEREF(__pyx_v_size); |
| 9795 | @@ -17842,7 +18475,7 @@ |
| 9796 | __pyx_t_4 = 0; |
| 9797 | __pyx_v_shape = ((PyObject *)__pyx_t_2); |
| 9798 | __pyx_t_2 = 0; |
| 9799 | - goto __pyx_L6; |
| 9800 | + goto __pyx_L3; |
| 9801 | } |
| 9802 | /*else*/ { |
| 9803 | |
| 9804 | @@ -17856,7 +18489,7 @@ |
| 9805 | __pyx_t_2 = __Pyx_PyInt_to_py_npy_intp(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 9806 | __Pyx_GOTREF(__pyx_t_2); |
| 9807 | __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;} |
| 9808 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 9809 | + __Pyx_GOTREF(__pyx_t_4); |
| 9810 | PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); |
| 9811 | __Pyx_GIVEREF(__pyx_t_2); |
| 9812 | __pyx_t_2 = 0; |
| 9813 | @@ -17866,7 +18499,7 @@ |
| 9814 | __pyx_v_shape = __pyx_t_2; |
| 9815 | __pyx_t_2 = 0; |
| 9816 | } |
| 9817 | - __pyx_L6:; |
| 9818 | + __pyx_L3:; |
| 9819 | |
| 9820 | /* "mtrand.pyx":4205 |
| 9821 | * shape = size + (k,) |
| 9822 | @@ -17886,7 +18519,7 @@ |
| 9823 | __Pyx_GOTREF(__pyx_t_5); |
| 9824 | __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 9825 | __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;} |
| 9826 | - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); |
| 9827 | + __Pyx_GOTREF(__pyx_t_2); |
| 9828 | __Pyx_INCREF(__pyx_v_shape); |
| 9829 | PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape); |
| 9830 | __Pyx_GIVEREF(__pyx_v_shape); |
| 9831 | @@ -17974,7 +18607,7 @@ |
| 9832 | * acc = acc + val_data[i+j] |
| 9833 | * invacc = 1/acc |
| 9834 | */ |
| 9835 | - (__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])); |
| 9836 | + (__pyx_v_val_data[(__pyx_v_i + __pyx_v_j)]) = rk_standard_gamma(__pyx_v_self->internal_state, (__pyx_v_alpha_data[__pyx_v_j])); |
| 9837 | |
| 9838 | /* "mtrand.pyx":4215 |
| 9839 | * for j from 0 <= j < k: |
| 9840 | @@ -18059,6 +18692,18 @@ |
| 9841 | return __pyx_r; |
| 9842 | } |
| 9843 | |
| 9844 | +/* Python wrapper */ |
| 9845 | +static PyObject *__pyx_pw_6mtrand_11RandomState_101shuffle(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/ |
| 9846 | +static char __pyx_doc_6mtrand_11RandomState_100shuffle[] = "\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 "; |
| 9847 | +static PyObject *__pyx_pw_6mtrand_11RandomState_101shuffle(PyObject *__pyx_v_self, PyObject *__pyx_v_x) { |
| 9848 | + PyObject *__pyx_r = 0; |
| 9849 | + __Pyx_RefNannyDeclarations |
| 9850 | + __Pyx_RefNannySetupContext("shuffle (wrapper)", 0); |
| 9851 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_100shuffle(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), ((PyObject *)__pyx_v_x)); |
| 9852 | + __Pyx_RefNannyFinishContext(); |
| 9853 | + return __pyx_r; |
| 9854 | +} |
| 9855 | + |
| 9856 | /* "mtrand.pyx":4224 |
| 9857 | * |
| 9858 | * # Shuffling and permutations: |
| 9859 | @@ -18067,9 +18712,7 @@ |
| 9860 | * shuffle(x) |
| 9861 | */ |
| 9862 | |
| 9863 | -static PyObject *__pyx_pf_6mtrand_11RandomState_50shuffle(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/ |
| 9864 | -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 "; |
| 9865 | -static PyObject *__pyx_pf_6mtrand_11RandomState_50shuffle(PyObject *__pyx_v_self, PyObject *__pyx_v_x) { |
| 9866 | +static PyObject *__pyx_pf_6mtrand_11RandomState_100shuffle(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_x) { |
| 9867 | npy_intp __pyx_v_i; |
| 9868 | npy_intp __pyx_v_j; |
| 9869 | int __pyx_v_copy; |
| 9870 | @@ -18086,7 +18729,7 @@ |
| 9871 | int __pyx_lineno = 0; |
| 9872 | const char *__pyx_filename = NULL; |
| 9873 | int __pyx_clineno = 0; |
| 9874 | - __Pyx_RefNannySetupContext("shuffle"); |
| 9875 | + __Pyx_RefNannySetupContext("shuffle", 0); |
| 9876 | |
| 9877 | /* "mtrand.pyx":4260 |
| 9878 | * cdef int copy |
| 9879 | @@ -18119,17 +18762,17 @@ |
| 9880 | * except: |
| 9881 | * j = 0 |
| 9882 | */ |
| 9883 | - __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_x, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4262; __pyx_clineno = __LINE__; goto __pyx_L5_error;} |
| 9884 | + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_x, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4262; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 9885 | __Pyx_GOTREF(__pyx_t_5); |
| 9886 | - __pyx_t_1 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4262; __pyx_clineno = __LINE__; goto __pyx_L5_error;} |
| 9887 | + __pyx_t_1 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4262; __pyx_clineno = __LINE__; goto __pyx_L3_error;} |
| 9888 | __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| 9889 | __pyx_v_j = __pyx_t_1; |
| 9890 | } |
| 9891 | __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 9892 | __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 9893 | __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 9894 | - goto __pyx_L12_try_end; |
| 9895 | - __pyx_L5_error:; |
| 9896 | + goto __pyx_L10_try_end; |
| 9897 | + __pyx_L3_error:; |
| 9898 | __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; |
| 9899 | |
| 9900 | /* "mtrand.pyx":4263 |
| 9901 | @@ -18141,7 +18784,7 @@ |
| 9902 | */ |
| 9903 | /*except:*/ { |
| 9904 | __Pyx_AddTraceback("mtrand.RandomState.shuffle", __pyx_clineno, __pyx_lineno, __pyx_filename); |
| 9905 | - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4263; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} |
| 9906 | + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4263; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} |
| 9907 | __Pyx_GOTREF(__pyx_t_5); |
| 9908 | __Pyx_GOTREF(__pyx_t_6); |
| 9909 | __Pyx_GOTREF(__pyx_t_7); |
| 9910 | @@ -18157,20 +18800,20 @@ |
| 9911 | __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; |
| 9912 | __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; |
| 9913 | __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; |
| 9914 | - goto __pyx_L6_exception_handled; |
| 9915 | + goto __pyx_L4_exception_handled; |
| 9916 | } |
| 9917 | - __pyx_L7_except_error:; |
| 9918 | + __pyx_L5_except_error:; |
| 9919 | __Pyx_XGIVEREF(__pyx_t_2); |
| 9920 | __Pyx_XGIVEREF(__pyx_t_3); |
| 9921 | __Pyx_XGIVEREF(__pyx_t_4); |
| 9922 | __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); |
| 9923 | goto __pyx_L1_error; |
| 9924 | - __pyx_L6_exception_handled:; |
| 9925 | + __pyx_L4_exception_handled:; |
| 9926 | __Pyx_XGIVEREF(__pyx_t_2); |
| 9927 | __Pyx_XGIVEREF(__pyx_t_3); |
| 9928 | __Pyx_XGIVEREF(__pyx_t_4); |
| 9929 | __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); |
| 9930 | - __pyx_L12_try_end:; |
| 9931 | + __pyx_L10_try_end:; |
| 9932 | } |
| 9933 | |
| 9934 | /* "mtrand.pyx":4266 |
| 9935 | @@ -18201,7 +18844,7 @@ |
| 9936 | * x[i], x[j] = x[j], x[i] |
| 9937 | * i = i - 1 |
| 9938 | */ |
| 9939 | - __pyx_v_j = rk_interval(__pyx_v_i, ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); |
| 9940 | + __pyx_v_j = rk_interval(__pyx_v_i, __pyx_v_self->internal_state); |
| 9941 | |
| 9942 | /* "mtrand.pyx":4270 |
| 9943 | * while i > 0: |
| 9944 | @@ -18228,7 +18871,7 @@ |
| 9945 | */ |
| 9946 | __pyx_v_i = (__pyx_v_i - 1); |
| 9947 | } |
| 9948 | - goto __pyx_L15; |
| 9949 | + goto __pyx_L13; |
| 9950 | } |
| 9951 | /*else*/ { |
| 9952 | |
| 9953 | @@ -18275,7 +18918,7 @@ |
| 9954 | * x[i], x[j] = x[j].copy(), x[i].copy() |
| 9955 | * i = i - 1 |
| 9956 | */ |
| 9957 | - __pyx_v_j = rk_interval(__pyx_v_i, ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); |
| 9958 | + __pyx_v_j = rk_interval(__pyx_v_i, __pyx_v_self->internal_state); |
| 9959 | |
| 9960 | /* "mtrand.pyx":4278 |
| 9961 | * while(i > 0): |
| 9962 | @@ -18314,7 +18957,7 @@ |
| 9963 | */ |
| 9964 | __pyx_v_i = (__pyx_v_i - 1); |
| 9965 | } |
| 9966 | - goto __pyx_L18; |
| 9967 | + goto __pyx_L16; |
| 9968 | } |
| 9969 | /*else*/ { |
| 9970 | |
| 9971 | @@ -18336,7 +18979,7 @@ |
| 9972 | * x[i], x[j] = x[j][:], x[i][:] |
| 9973 | * i = i - 1 |
| 9974 | */ |
| 9975 | - __pyx_v_j = rk_interval(__pyx_v_i, ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); |
| 9976 | + __pyx_v_j = rk_interval(__pyx_v_i, __pyx_v_self->internal_state); |
| 9977 | |
| 9978 | /* "mtrand.pyx":4283 |
| 9979 | * while(i > 0): |
| 9980 | @@ -18370,9 +19013,9 @@ |
| 9981 | __pyx_v_i = (__pyx_v_i - 1); |
| 9982 | } |
| 9983 | } |
| 9984 | - __pyx_L18:; |
| 9985 | + __pyx_L16:; |
| 9986 | } |
| 9987 | - __pyx_L15:; |
| 9988 | + __pyx_L13:; |
| 9989 | |
| 9990 | __pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| 9991 | goto __pyx_L0; |
| 9992 | @@ -18388,6 +19031,18 @@ |
| 9993 | return __pyx_r; |
| 9994 | } |
| 9995 | |
| 9996 | +/* Python wrapper */ |
| 9997 | +static PyObject *__pyx_pw_6mtrand_11RandomState_103permutation(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/ |
| 9998 | +static char __pyx_doc_6mtrand_11RandomState_102permutation[] = "\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 "; |
| 9999 | +static PyObject *__pyx_pw_6mtrand_11RandomState_103permutation(PyObject *__pyx_v_self, PyObject *__pyx_v_x) { |
| 10000 | + PyObject *__pyx_r = 0; |
| 10001 | + __Pyx_RefNannyDeclarations |
| 10002 | + __Pyx_RefNannySetupContext("permutation (wrapper)", 0); |
| 10003 | + __pyx_r = __pyx_pf_6mtrand_11RandomState_102permutation(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self), ((PyObject *)__pyx_v_x)); |
| 10004 | + __Pyx_RefNannyFinishContext(); |
| 10005 | + return __pyx_r; |
| 10006 | +} |
| 10007 | + |
| 10008 | /* "mtrand.pyx":4286 |
| 10009 | * i = i - 1 |
| 10010 | * |
| 10011 | @@ -18396,9 +19051,7 @@ |
| 10012 | * permutation(x) |
| 10013 | */ |
| 10014 | |
| 10015 | -static PyObject *__pyx_pf_6mtrand_11RandomState_51permutation(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/ |
| 10016 | -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 "; |
| 10017 | -static PyObject *__pyx_pf_6mtrand_11RandomState_51permutation(PyObject *__pyx_v_self, PyObject *__pyx_v_x) { |
| 10018 | +static PyObject *__pyx_pf_6mtrand_11RandomState_102permutation(struct __pyx_obj_6mtrand_RandomState *__pyx_v_self, PyObject *__pyx_v_x) { |
| 10019 | PyObject *__pyx_v_arr = NULL; |
| 10020 | PyObject *__pyx_r = NULL; |
| 10021 | __Pyx_RefNannyDeclarations |
| 10022 | @@ -18409,7 +19062,7 @@ |
| 10023 | int __pyx_lineno = 0; |
| 10024 | const char *__pyx_filename = NULL; |
| 10025 | int __pyx_clineno = 0; |
| 10026 | - __Pyx_RefNannySetupContext("permutation"); |
| 10027 | + __Pyx_RefNannySetupContext("permutation", 0); |
| 10028 | |
| 10029 | /* "mtrand.pyx":4322 |
| 10030 | * |
| 10031 | @@ -18424,7 +19077,7 @@ |
| 10032 | __Pyx_GOTREF(__pyx_t_2); |
| 10033 | __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| 10034 | __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;} |
| 10035 | - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); |
| 10036 | + __Pyx_GOTREF(__pyx_t_1); |
| 10037 | __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type)))); |
| 10038 | PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)(&PyInt_Type)))); |
| 10039 | __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type)))); |
| 10040 | @@ -18451,7 +19104,7 @@ |
| 10041 | __Pyx_GOTREF(__pyx_t_2); |
| 10042 | __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| 10043 | __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;} |
| 10044 | - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); |
| 10045 | + __Pyx_GOTREF(__pyx_t_1); |
| 10046 | __Pyx_INCREF(__pyx_v_x); |
| 10047 | PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x); |
| 10048 | __Pyx_GIVEREF(__pyx_v_x); |
| 10049 | @@ -18461,7 +19114,7 @@ |
| 10050 | __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; |
| 10051 | __pyx_v_arr = __pyx_t_4; |
| 10052 | __pyx_t_4 = 0; |
| 10053 | - goto __pyx_L5; |
| 10054 | + goto __pyx_L3; |
| 10055 | } |
| 10056 | /*else*/ { |
| 10057 | |
| 10058 | @@ -18478,7 +19131,7 @@ |
| 10059 | __Pyx_GOTREF(__pyx_t_1); |
| 10060 | __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; |
| 10061 | __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;} |
| 10062 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 10063 | + __Pyx_GOTREF(__pyx_t_4); |
| 10064 | __Pyx_INCREF(__pyx_v_x); |
| 10065 | PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_x); |
| 10066 | __Pyx_GIVEREF(__pyx_v_x); |
| 10067 | @@ -18489,7 +19142,7 @@ |
| 10068 | __pyx_v_arr = __pyx_t_2; |
| 10069 | __pyx_t_2 = 0; |
| 10070 | } |
| 10071 | - __pyx_L5:; |
| 10072 | + __pyx_L3:; |
| 10073 | |
| 10074 | /* "mtrand.pyx":4326 |
| 10075 | * else: |
| 10076 | @@ -18498,10 +19151,10 @@ |
| 10077 | * return arr |
| 10078 | * |
| 10079 | */ |
| 10080 | - __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;} |
| 10081 | + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__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;} |
| 10082 | __Pyx_GOTREF(__pyx_t_2); |
| 10083 | __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;} |
| 10084 | - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); |
| 10085 | + __Pyx_GOTREF(__pyx_t_4); |
| 10086 | __Pyx_INCREF(__pyx_v_arr); |
| 10087 | PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_arr); |
| 10088 | __Pyx_GIVEREF(__pyx_v_arr); |
| 10089 | @@ -18538,7 +19191,7 @@ |
| 10090 | return __pyx_r; |
| 10091 | } |
| 10092 | |
| 10093 | -static PyObject *__pyx_tp_new_6mtrand_RandomState(PyTypeObject *t, PyObject *a, PyObject *k) { |
| 10094 | +static PyObject *__pyx_tp_new_6mtrand_RandomState(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { |
| 10095 | PyObject *o = (*t->tp_alloc)(t, 0); |
| 10096 | if (!o) return 0; |
| 10097 | return o; |
| 10098 | @@ -18549,7 +19202,7 @@ |
| 10099 | PyObject *etype, *eval, *etb; |
| 10100 | PyErr_Fetch(&etype, &eval, &etb); |
| 10101 | ++Py_REFCNT(o); |
| 10102 | - __pyx_pf_6mtrand_11RandomState_1__dealloc__(o); |
| 10103 | + __pyx_pw_6mtrand_11RandomState_3__dealloc__(o); |
| 10104 | if (PyErr_Occurred()) PyErr_WriteUnraisable(o); |
| 10105 | --Py_REFCNT(o); |
| 10106 | PyErr_Restore(etype, eval, etb); |
| 10107 | @@ -18558,56 +19211,56 @@ |
| 10108 | } |
| 10109 | |
| 10110 | static PyMethodDef __pyx_methods_6mtrand_RandomState[] = { |
| 10111 | - {__Pyx_NAMESTR("seed"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_2seed, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_2seed)}, |
| 10112 | - {__Pyx_NAMESTR("get_state"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_3get_state, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_3get_state)}, |
| 10113 | - {__Pyx_NAMESTR("set_state"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_4set_state, METH_O, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_4set_state)}, |
| 10114 | - {__Pyx_NAMESTR("__getstate__"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_5__getstate__, METH_NOARGS, __Pyx_DOCSTR(0)}, |
| 10115 | - {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_6__setstate__, METH_O, __Pyx_DOCSTR(0)}, |
| 10116 | - {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_7__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, |
| 10117 | - {__Pyx_NAMESTR("random_sample"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_8random_sample, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_8random_sample)}, |
| 10118 | - {__Pyx_NAMESTR("tomaxint"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_9tomaxint, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_9tomaxint)}, |
| 10119 | - {__Pyx_NAMESTR("randint"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_10randint, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_10randint)}, |
| 10120 | - {__Pyx_NAMESTR("bytes"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_11bytes, METH_O, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_11bytes)}, |
| 10121 | - {__Pyx_NAMESTR("uniform"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_12uniform, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_12uniform)}, |
| 10122 | - {__Pyx_NAMESTR("rand"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_13rand, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_13rand)}, |
| 10123 | - {__Pyx_NAMESTR("randn"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_14randn, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_14randn)}, |
| 10124 | - {__Pyx_NAMESTR("random_integers"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_15random_integers, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_15random_integers)}, |
| 10125 | - {__Pyx_NAMESTR("standard_normal"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_16standard_normal, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_16standard_normal)}, |
| 10126 | - {__Pyx_NAMESTR("normal"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_17normal, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_17normal)}, |
| 10127 | - {__Pyx_NAMESTR("beta"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_18beta, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_18beta)}, |
| 10128 | - {__Pyx_NAMESTR("exponential"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_19exponential, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_19exponential)}, |
| 10129 | - {__Pyx_NAMESTR("standard_exponential"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_20standard_exponential, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_20standard_exponential)}, |
| 10130 | - {__Pyx_NAMESTR("standard_gamma"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_21standard_gamma, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_21standard_gamma)}, |
| 10131 | - {__Pyx_NAMESTR("gamma"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_22gamma, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_22gamma)}, |
| 10132 | - {__Pyx_NAMESTR("f"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_23f, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_23f)}, |
| 10133 | - {__Pyx_NAMESTR("noncentral_f"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_24noncentral_f, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_24noncentral_f)}, |
| 10134 | - {__Pyx_NAMESTR("chisquare"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_25chisquare, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_25chisquare)}, |
| 10135 | - {__Pyx_NAMESTR("noncentral_chisquare"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_26noncentral_chisquare, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_26noncentral_chisquare)}, |
| 10136 | - {__Pyx_NAMESTR("standard_cauchy"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_27standard_cauchy, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_27standard_cauchy)}, |
| 10137 | - {__Pyx_NAMESTR("standard_t"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_28standard_t, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_28standard_t)}, |
| 10138 | - {__Pyx_NAMESTR("vonmises"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_29vonmises, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_29vonmises)}, |
| 10139 | - {__Pyx_NAMESTR("pareto"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_30pareto, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_30pareto)}, |
| 10140 | - {__Pyx_NAMESTR("weibull"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_31weibull, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_31weibull)}, |
| 10141 | - {__Pyx_NAMESTR("power"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_32power, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_32power)}, |
| 10142 | - {__Pyx_NAMESTR("laplace"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_33laplace, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_33laplace)}, |
| 10143 | - {__Pyx_NAMESTR("gumbel"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_34gumbel, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_34gumbel)}, |
| 10144 | - {__Pyx_NAMESTR("logistic"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_35logistic, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_35logistic)}, |
| 10145 | - {__Pyx_NAMESTR("lognormal"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_36lognormal, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_36lognormal)}, |
| 10146 | - {__Pyx_NAMESTR("rayleigh"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_37rayleigh, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_37rayleigh)}, |
| 10147 | - {__Pyx_NAMESTR("wald"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_38wald, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_38wald)}, |
| 10148 | - {__Pyx_NAMESTR("triangular"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_39triangular, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_39triangular)}, |
| 10149 | - {__Pyx_NAMESTR("binomial"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_40binomial, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_40binomial)}, |
| 10150 | - {__Pyx_NAMESTR("negative_binomial"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_41negative_binomial, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_41negative_binomial)}, |
| 10151 | - {__Pyx_NAMESTR("poisson"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_42poisson, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_42poisson)}, |
| 10152 | - {__Pyx_NAMESTR("zipf"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_43zipf, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_43zipf)}, |
| 10153 | - {__Pyx_NAMESTR("geometric"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_44geometric, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_44geometric)}, |
| 10154 | - {__Pyx_NAMESTR("hypergeometric"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_45hypergeometric, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_45hypergeometric)}, |
| 10155 | - {__Pyx_NAMESTR("logseries"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_46logseries, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_46logseries)}, |
| 10156 | - {__Pyx_NAMESTR("multivariate_normal"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_47multivariate_normal, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_47multivariate_normal)}, |
| 10157 | - {__Pyx_NAMESTR("multinomial"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_48multinomial, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_48multinomial)}, |
| 10158 | - {__Pyx_NAMESTR("dirichlet"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_49dirichlet, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_49dirichlet)}, |
| 10159 | - {__Pyx_NAMESTR("shuffle"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_50shuffle, METH_O, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_50shuffle)}, |
| 10160 | - {__Pyx_NAMESTR("permutation"), (PyCFunction)__pyx_pf_6mtrand_11RandomState_51permutation, METH_O, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_51permutation)}, |
| 10161 | + {__Pyx_NAMESTR("seed"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_5seed, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_4seed)}, |
| 10162 | + {__Pyx_NAMESTR("get_state"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_7get_state, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_6get_state)}, |
| 10163 | + {__Pyx_NAMESTR("set_state"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_9set_state, METH_O, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_8set_state)}, |
| 10164 | + {__Pyx_NAMESTR("__getstate__"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_11__getstate__, METH_NOARGS, __Pyx_DOCSTR(0)}, |
| 10165 | + {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_13__setstate__, METH_O, __Pyx_DOCSTR(0)}, |
| 10166 | + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_15__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, |
| 10167 | + {__Pyx_NAMESTR("random_sample"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_17random_sample, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_16random_sample)}, |
| 10168 | + {__Pyx_NAMESTR("tomaxint"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_19tomaxint, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_18tomaxint)}, |
| 10169 | + {__Pyx_NAMESTR("randint"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_21randint, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_20randint)}, |
| 10170 | + {__Pyx_NAMESTR("bytes"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_23bytes, METH_O, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_22bytes)}, |
| 10171 | + {__Pyx_NAMESTR("uniform"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_25uniform, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_24uniform)}, |
| 10172 | + {__Pyx_NAMESTR("rand"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_27rand, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_26rand)}, |
| 10173 | + {__Pyx_NAMESTR("randn"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_29randn, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_28randn)}, |
| 10174 | + {__Pyx_NAMESTR("random_integers"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_31random_integers, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_30random_integers)}, |
| 10175 | + {__Pyx_NAMESTR("standard_normal"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_33standard_normal, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_32standard_normal)}, |
| 10176 | + {__Pyx_NAMESTR("normal"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_35normal, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_34normal)}, |
| 10177 | + {__Pyx_NAMESTR("beta"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_37beta, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_36beta)}, |
| 10178 | + {__Pyx_NAMESTR("exponential"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_39exponential, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_38exponential)}, |
| 10179 | + {__Pyx_NAMESTR("standard_exponential"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_41standard_exponential, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_40standard_exponential)}, |
| 10180 | + {__Pyx_NAMESTR("standard_gamma"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_43standard_gamma, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_42standard_gamma)}, |
| 10181 | + {__Pyx_NAMESTR("gamma"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_45gamma, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_44gamma)}, |
| 10182 | + {__Pyx_NAMESTR("f"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_47f, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_46f)}, |
| 10183 | + {__Pyx_NAMESTR("noncentral_f"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_49noncentral_f, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_48noncentral_f)}, |
| 10184 | + {__Pyx_NAMESTR("chisquare"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_51chisquare, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_50chisquare)}, |
| 10185 | + {__Pyx_NAMESTR("noncentral_chisquare"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_53noncentral_chisquare, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_52noncentral_chisquare)}, |
| 10186 | + {__Pyx_NAMESTR("standard_cauchy"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_55standard_cauchy, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_54standard_cauchy)}, |
| 10187 | + {__Pyx_NAMESTR("standard_t"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_57standard_t, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_56standard_t)}, |
| 10188 | + {__Pyx_NAMESTR("vonmises"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_59vonmises, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_58vonmises)}, |
| 10189 | + {__Pyx_NAMESTR("pareto"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_61pareto, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_60pareto)}, |
| 10190 | + {__Pyx_NAMESTR("weibull"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_63weibull, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_62weibull)}, |
| 10191 | + {__Pyx_NAMESTR("power"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_65power, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_64power)}, |
| 10192 | + {__Pyx_NAMESTR("laplace"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_67laplace, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_66laplace)}, |
| 10193 | + {__Pyx_NAMESTR("gumbel"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_69gumbel, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_68gumbel)}, |
| 10194 | + {__Pyx_NAMESTR("logistic"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_71logistic, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_70logistic)}, |
| 10195 | + {__Pyx_NAMESTR("lognormal"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_73lognormal, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_72lognormal)}, |
| 10196 | + {__Pyx_NAMESTR("rayleigh"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_75rayleigh, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_74rayleigh)}, |
| 10197 | + {__Pyx_NAMESTR("wald"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_77wald, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_76wald)}, |
| 10198 | + {__Pyx_NAMESTR("triangular"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_79triangular, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_78triangular)}, |
| 10199 | + {__Pyx_NAMESTR("binomial"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_81binomial, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_80binomial)}, |
| 10200 | + {__Pyx_NAMESTR("negative_binomial"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_83negative_binomial, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_82negative_binomial)}, |
| 10201 | + {__Pyx_NAMESTR("poisson"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_85poisson, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_84poisson)}, |
| 10202 | + {__Pyx_NAMESTR("zipf"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_87zipf, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_86zipf)}, |
| 10203 | + {__Pyx_NAMESTR("geometric"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_89geometric, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_88geometric)}, |
| 10204 | + {__Pyx_NAMESTR("hypergeometric"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_91hypergeometric, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_90hypergeometric)}, |
| 10205 | + {__Pyx_NAMESTR("logseries"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_93logseries, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_92logseries)}, |
| 10206 | + {__Pyx_NAMESTR("multivariate_normal"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_95multivariate_normal, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_94multivariate_normal)}, |
| 10207 | + {__Pyx_NAMESTR("multinomial"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_97multinomial, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_96multinomial)}, |
| 10208 | + {__Pyx_NAMESTR("dirichlet"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_99dirichlet, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_98dirichlet)}, |
| 10209 | + {__Pyx_NAMESTR("shuffle"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_101shuffle, METH_O, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_100shuffle)}, |
| 10210 | + {__Pyx_NAMESTR("permutation"), (PyCFunction)__pyx_pw_6mtrand_11RandomState_103permutation, METH_O, __Pyx_DOCSTR(__pyx_doc_6mtrand_11RandomState_102permutation)}, |
| 10211 | {0, 0, 0, 0} |
| 10212 | }; |
| 10213 | |
| 10214 | @@ -18749,7 +19402,7 @@ |
| 10215 | 0, /*tp_descr_get*/ |
| 10216 | 0, /*tp_descr_set*/ |
| 10217 | 0, /*tp_dictoffset*/ |
| 10218 | - __pyx_pf_6mtrand_11RandomState___init__, /*tp_init*/ |
| 10219 | + __pyx_pw_6mtrand_11RandomState_1__init__, /*tp_init*/ |
| 10220 | 0, /*tp_alloc*/ |
| 10221 | __pyx_tp_new_6mtrand_RandomState, /*tp_new*/ |
| 10222 | 0, /*tp_free*/ |
| 10223 | @@ -19035,7 +19688,7 @@ |
| 10224 | |
| 10225 | static int __Pyx_InitCachedConstants(void) { |
| 10226 | __Pyx_RefNannyDeclarations |
| 10227 | - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); |
| 10228 | + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); |
| 10229 | |
| 10230 | /* "mtrand.pyx":184 |
| 10231 | * <void *>oa) |
| 10232 | @@ -19045,7 +19698,7 @@ |
| 10233 | * oa_data = <double *>PyArray_MultiIter_DATA(multi, 1) |
| 10234 | */ |
| 10235 | __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;} |
| 10236 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2)); |
| 10237 | + __Pyx_GOTREF(__pyx_k_tuple_2); |
| 10238 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); |
| 10239 | PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_s_1)); |
| 10240 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); |
| 10241 | @@ -19059,7 +19712,7 @@ |
| 10242 | * oa_data = <double *>PyArray_MultiIter_DATA(multi, 1) |
| 10243 | */ |
| 10244 | __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;} |
| 10245 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_3)); |
| 10246 | + __Pyx_GOTREF(__pyx_k_tuple_3); |
| 10247 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); |
| 10248 | PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_kp_s_1)); |
| 10249 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); |
| 10250 | @@ -19073,7 +19726,7 @@ |
| 10251 | * oa_data = <double *>PyArray_MultiIter_DATA(multi, 1) |
| 10252 | */ |
| 10253 | __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;} |
| 10254 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4)); |
| 10255 | + __Pyx_GOTREF(__pyx_k_tuple_4); |
| 10256 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); |
| 10257 | PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_s_1)); |
| 10258 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); |
| 10259 | @@ -19087,7 +19740,7 @@ |
| 10260 | * on_data = <long *>PyArray_MultiIter_DATA(multi, 1) |
| 10261 | */ |
| 10262 | __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;} |
| 10263 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_5)); |
| 10264 | + __Pyx_GOTREF(__pyx_k_tuple_5); |
| 10265 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); |
| 10266 | PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_s_1)); |
| 10267 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); |
| 10268 | @@ -19101,7 +19754,7 @@ |
| 10269 | * on_data = <double *>PyArray_MultiIter_DATA(multi, 1) |
| 10270 | */ |
| 10271 | __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;} |
| 10272 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6)); |
| 10273 | + __Pyx_GOTREF(__pyx_k_tuple_6); |
| 10274 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); |
| 10275 | PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_s_1)); |
| 10276 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); |
| 10277 | @@ -19115,7 +19768,7 @@ |
| 10278 | * on_data = <long *>PyArray_MultiIter_DATA(multi, 1) |
| 10279 | */ |
| 10280 | __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;} |
| 10281 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_7)); |
| 10282 | + __Pyx_GOTREF(__pyx_k_tuple_7); |
| 10283 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); |
| 10284 | PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_s_1)); |
| 10285 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); |
| 10286 | @@ -19129,7 +19782,7 @@ |
| 10287 | * oa_data = <double *>PyArray_MultiIter_DATA(multi, 1) |
| 10288 | */ |
| 10289 | __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;} |
| 10290 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8)); |
| 10291 | + __Pyx_GOTREF(__pyx_k_tuple_8); |
| 10292 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); |
| 10293 | PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_s_1)); |
| 10294 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); |
| 10295 | @@ -19143,7 +19796,7 @@ |
| 10296 | * if len(state) == 3: |
| 10297 | */ |
| 10298 | __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;} |
| 10299 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10)); |
| 10300 | + __Pyx_GOTREF(__pyx_k_tuple_10); |
| 10301 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); |
| 10302 | PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_s_9)); |
| 10303 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9)); |
| 10304 | @@ -19157,7 +19810,7 @@ |
| 10305 | * self.internal_state.pos = pos |
| 10306 | */ |
| 10307 | __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;} |
| 10308 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12)); |
| 10309 | + __Pyx_GOTREF(__pyx_k_tuple_12); |
| 10310 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_11)); |
| 10311 | PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_s_11)); |
| 10312 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11)); |
| 10313 | @@ -19171,7 +19824,7 @@ |
| 10314 | * diff = <unsigned long>hi - <unsigned long>lo - 1UL |
| 10315 | */ |
| 10316 | __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;} |
| 10317 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_14)); |
| 10318 | + __Pyx_GOTREF(__pyx_k_tuple_14); |
| 10319 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_13)); |
| 10320 | PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_s_13)); |
| 10321 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13)); |
| 10322 | @@ -19185,7 +19838,7 @@ |
| 10323 | * |
| 10324 | */ |
| 10325 | __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;} |
| 10326 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_20)); |
| 10327 | + __Pyx_GOTREF(__pyx_k_tuple_20); |
| 10328 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_19)); |
| 10329 | PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_kp_s_19)); |
| 10330 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19)); |
| 10331 | @@ -19199,7 +19852,7 @@ |
| 10332 | * |
| 10333 | */ |
| 10334 | __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;} |
| 10335 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_21)); |
| 10336 | + __Pyx_GOTREF(__pyx_k_tuple_21); |
| 10337 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_19)); |
| 10338 | PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_kp_s_19)); |
| 10339 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19)); |
| 10340 | @@ -19213,7 +19866,7 @@ |
| 10341 | * raise ValueError("b <= 0") |
| 10342 | */ |
| 10343 | __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;} |
| 10344 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_23)); |
| 10345 | + __Pyx_GOTREF(__pyx_k_tuple_23); |
| 10346 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_22)); |
| 10347 | PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_kp_s_22)); |
| 10348 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22)); |
| 10349 | @@ -19227,7 +19880,7 @@ |
| 10350 | * |
| 10351 | */ |
| 10352 | __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;} |
| 10353 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_25)); |
| 10354 | + __Pyx_GOTREF(__pyx_k_tuple_25); |
| 10355 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_24)); |
| 10356 | PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, ((PyObject *)__pyx_kp_s_24)); |
| 10357 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_24)); |
| 10358 | @@ -19241,7 +19894,7 @@ |
| 10359 | * raise ValueError("b <= 0") |
| 10360 | */ |
| 10361 | __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;} |
| 10362 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_26)); |
| 10363 | + __Pyx_GOTREF(__pyx_k_tuple_26); |
| 10364 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_22)); |
| 10365 | PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_kp_s_22)); |
| 10366 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22)); |
| 10367 | @@ -19255,7 +19908,7 @@ |
| 10368 | * |
| 10369 | */ |
| 10370 | __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;} |
| 10371 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_27)); |
| 10372 | + __Pyx_GOTREF(__pyx_k_tuple_27); |
| 10373 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_24)); |
| 10374 | PyTuple_SET_ITEM(__pyx_k_tuple_27, 0, ((PyObject *)__pyx_kp_s_24)); |
| 10375 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_24)); |
| 10376 | @@ -19269,7 +19922,7 @@ |
| 10377 | * |
| 10378 | */ |
| 10379 | __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;} |
| 10380 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_29)); |
| 10381 | + __Pyx_GOTREF(__pyx_k_tuple_29); |
| 10382 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_19)); |
| 10383 | PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, ((PyObject *)__pyx_kp_s_19)); |
| 10384 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19)); |
| 10385 | @@ -19283,7 +19936,7 @@ |
| 10386 | * |
| 10387 | */ |
| 10388 | __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;} |
| 10389 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_30)); |
| 10390 | + __Pyx_GOTREF(__pyx_k_tuple_30); |
| 10391 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_19)); |
| 10392 | PyTuple_SET_ITEM(__pyx_k_tuple_30, 0, ((PyObject *)__pyx_kp_s_19)); |
| 10393 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19)); |
| 10394 | @@ -19297,7 +19950,7 @@ |
| 10395 | * |
| 10396 | */ |
| 10397 | __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;} |
| 10398 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_32)); |
| 10399 | + __Pyx_GOTREF(__pyx_k_tuple_32); |
| 10400 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_31)); |
| 10401 | PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, ((PyObject *)__pyx_kp_s_31)); |
| 10402 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_31)); |
| 10403 | @@ -19311,7 +19964,7 @@ |
| 10404 | * |
| 10405 | */ |
| 10406 | __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;} |
| 10407 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_33)); |
| 10408 | + __Pyx_GOTREF(__pyx_k_tuple_33); |
| 10409 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_31)); |
| 10410 | PyTuple_SET_ITEM(__pyx_k_tuple_33, 0, ((PyObject *)__pyx_kp_s_31)); |
| 10411 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_31)); |
| 10412 | @@ -19325,7 +19978,7 @@ |
| 10413 | * raise ValueError("scale <= 0") |
| 10414 | */ |
| 10415 | __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;} |
| 10416 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_35)); |
| 10417 | + __Pyx_GOTREF(__pyx_k_tuple_35); |
| 10418 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_31)); |
| 10419 | PyTuple_SET_ITEM(__pyx_k_tuple_35, 0, ((PyObject *)__pyx_kp_s_31)); |
| 10420 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_31)); |
| 10421 | @@ -19339,7 +19992,7 @@ |
| 10422 | * |
| 10423 | */ |
| 10424 | __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;} |
| 10425 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_36)); |
| 10426 | + __Pyx_GOTREF(__pyx_k_tuple_36); |
| 10427 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_19)); |
| 10428 | PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, ((PyObject *)__pyx_kp_s_19)); |
| 10429 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19)); |
| 10430 | @@ -19353,7 +20006,7 @@ |
| 10431 | * raise ValueError("scale <= 0") |
| 10432 | */ |
| 10433 | __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;} |
| 10434 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_37)); |
| 10435 | + __Pyx_GOTREF(__pyx_k_tuple_37); |
| 10436 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_31)); |
| 10437 | PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, ((PyObject *)__pyx_kp_s_31)); |
| 10438 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_31)); |
| 10439 | @@ -19367,7 +20020,7 @@ |
| 10440 | * |
| 10441 | */ |
| 10442 | __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;} |
| 10443 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_38)); |
| 10444 | + __Pyx_GOTREF(__pyx_k_tuple_38); |
| 10445 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_19)); |
| 10446 | PyTuple_SET_ITEM(__pyx_k_tuple_38, 0, ((PyObject *)__pyx_kp_s_19)); |
| 10447 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19)); |
| 10448 | @@ -19381,7 +20034,7 @@ |
| 10449 | * raise ValueError("scale <= 0") |
| 10450 | */ |
| 10451 | __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;} |
| 10452 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_39)); |
| 10453 | + __Pyx_GOTREF(__pyx_k_tuple_39); |
| 10454 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_31)); |
| 10455 | PyTuple_SET_ITEM(__pyx_k_tuple_39, 0, ((PyObject *)__pyx_kp_s_31)); |
| 10456 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_31)); |
| 10457 | @@ -19395,7 +20048,7 @@ |
| 10458 | * |
| 10459 | */ |
| 10460 | __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;} |
| 10461 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_40)); |
| 10462 | + __Pyx_GOTREF(__pyx_k_tuple_40); |
| 10463 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_19)); |
| 10464 | PyTuple_SET_ITEM(__pyx_k_tuple_40, 0, ((PyObject *)__pyx_kp_s_19)); |
| 10465 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19)); |
| 10466 | @@ -19409,7 +20062,7 @@ |
| 10467 | * raise ValueError("dfden <= 0") |
| 10468 | */ |
| 10469 | __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;} |
| 10470 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_42)); |
| 10471 | + __Pyx_GOTREF(__pyx_k_tuple_42); |
| 10472 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_41)); |
| 10473 | PyTuple_SET_ITEM(__pyx_k_tuple_42, 0, ((PyObject *)__pyx_kp_s_41)); |
| 10474 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_41)); |
| 10475 | @@ -19423,7 +20076,7 @@ |
| 10476 | * |
| 10477 | */ |
| 10478 | __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;} |
| 10479 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_44)); |
| 10480 | + __Pyx_GOTREF(__pyx_k_tuple_44); |
| 10481 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_43)); |
| 10482 | PyTuple_SET_ITEM(__pyx_k_tuple_44, 0, ((PyObject *)__pyx_kp_s_43)); |
| 10483 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_43)); |
| 10484 | @@ -19437,7 +20090,7 @@ |
| 10485 | * raise ValueError("dfden <= 0") |
| 10486 | */ |
| 10487 | __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;} |
| 10488 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_46)); |
| 10489 | + __Pyx_GOTREF(__pyx_k_tuple_46); |
| 10490 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_45)); |
| 10491 | PyTuple_SET_ITEM(__pyx_k_tuple_46, 0, ((PyObject *)__pyx_kp_s_45)); |
| 10492 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_45)); |
| 10493 | @@ -19451,7 +20104,7 @@ |
| 10494 | * raise ValueError("nonc < 0") |
| 10495 | */ |
| 10496 | __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;} |
| 10497 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_47)); |
| 10498 | + __Pyx_GOTREF(__pyx_k_tuple_47); |
| 10499 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_43)); |
| 10500 | PyTuple_SET_ITEM(__pyx_k_tuple_47, 0, ((PyObject *)__pyx_kp_s_43)); |
| 10501 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_43)); |
| 10502 | @@ -19465,7 +20118,7 @@ |
| 10503 | * fdfnum, fdfden, fnonc) |
| 10504 | */ |
| 10505 | __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;} |
| 10506 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_49)); |
| 10507 | + __Pyx_GOTREF(__pyx_k_tuple_49); |
| 10508 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_48)); |
| 10509 | PyTuple_SET_ITEM(__pyx_k_tuple_49, 0, ((PyObject *)__pyx_kp_s_48)); |
| 10510 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_48)); |
| 10511 | @@ -19479,7 +20132,7 @@ |
| 10512 | * raise ValueError("dfden <= 0") |
| 10513 | */ |
| 10514 | __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;} |
| 10515 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_50)); |
| 10516 | + __Pyx_GOTREF(__pyx_k_tuple_50); |
| 10517 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_45)); |
| 10518 | PyTuple_SET_ITEM(__pyx_k_tuple_50, 0, ((PyObject *)__pyx_kp_s_45)); |
| 10519 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_45)); |
| 10520 | @@ -19493,7 +20146,7 @@ |
| 10521 | * raise ValueError("nonc < 0") |
| 10522 | */ |
| 10523 | __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;} |
| 10524 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_51)); |
| 10525 | + __Pyx_GOTREF(__pyx_k_tuple_51); |
| 10526 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_43)); |
| 10527 | PyTuple_SET_ITEM(__pyx_k_tuple_51, 0, ((PyObject *)__pyx_kp_s_43)); |
| 10528 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_43)); |
| 10529 | @@ -19507,7 +20160,7 @@ |
| 10530 | * odfden, ononc) |
| 10531 | */ |
| 10532 | __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;} |
| 10533 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_52)); |
| 10534 | + __Pyx_GOTREF(__pyx_k_tuple_52); |
| 10535 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_48)); |
| 10536 | PyTuple_SET_ITEM(__pyx_k_tuple_52, 0, ((PyObject *)__pyx_kp_s_48)); |
| 10537 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_48)); |
| 10538 | @@ -19521,7 +20174,7 @@ |
| 10539 | * |
| 10540 | */ |
| 10541 | __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;} |
| 10542 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_54)); |
| 10543 | + __Pyx_GOTREF(__pyx_k_tuple_54); |
| 10544 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_53)); |
| 10545 | PyTuple_SET_ITEM(__pyx_k_tuple_54, 0, ((PyObject *)__pyx_kp_s_53)); |
| 10546 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_53)); |
| 10547 | @@ -19535,7 +20188,7 @@ |
| 10548 | * |
| 10549 | */ |
| 10550 | __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;} |
| 10551 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_55)); |
| 10552 | + __Pyx_GOTREF(__pyx_k_tuple_55); |
| 10553 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_53)); |
| 10554 | PyTuple_SET_ITEM(__pyx_k_tuple_55, 0, ((PyObject *)__pyx_kp_s_53)); |
| 10555 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_53)); |
| 10556 | @@ -19549,7 +20202,7 @@ |
| 10557 | * raise ValueError("nonc <= 0") |
| 10558 | */ |
| 10559 | __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;} |
| 10560 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_56)); |
| 10561 | + __Pyx_GOTREF(__pyx_k_tuple_56); |
| 10562 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_53)); |
| 10563 | PyTuple_SET_ITEM(__pyx_k_tuple_56, 0, ((PyObject *)__pyx_kp_s_53)); |
| 10564 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_53)); |
| 10565 | @@ -19563,7 +20216,7 @@ |
| 10566 | * size, fdf, fnonc) |
| 10567 | */ |
| 10568 | __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;} |
| 10569 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_58)); |
| 10570 | + __Pyx_GOTREF(__pyx_k_tuple_58); |
| 10571 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_57)); |
| 10572 | PyTuple_SET_ITEM(__pyx_k_tuple_58, 0, ((PyObject *)__pyx_kp_s_57)); |
| 10573 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_57)); |
| 10574 | @@ -19577,7 +20230,7 @@ |
| 10575 | * raise ValueError("nonc < 0") |
| 10576 | */ |
| 10577 | __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;} |
| 10578 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_60)); |
| 10579 | + __Pyx_GOTREF(__pyx_k_tuple_60); |
| 10580 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_59)); |
| 10581 | PyTuple_SET_ITEM(__pyx_k_tuple_60, 0, ((PyObject *)__pyx_kp_s_59)); |
| 10582 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_59)); |
| 10583 | @@ -19591,7 +20244,7 @@ |
| 10584 | * odf, ononc) |
| 10585 | */ |
| 10586 | __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;} |
| 10587 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_61)); |
| 10588 | + __Pyx_GOTREF(__pyx_k_tuple_61); |
| 10589 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_48)); |
| 10590 | PyTuple_SET_ITEM(__pyx_k_tuple_61, 0, ((PyObject *)__pyx_kp_s_48)); |
| 10591 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_48)); |
| 10592 | @@ -19605,7 +20258,7 @@ |
| 10593 | * |
| 10594 | */ |
| 10595 | __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;} |
| 10596 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_62)); |
| 10597 | + __Pyx_GOTREF(__pyx_k_tuple_62); |
| 10598 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_53)); |
| 10599 | PyTuple_SET_ITEM(__pyx_k_tuple_62, 0, ((PyObject *)__pyx_kp_s_53)); |
| 10600 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_53)); |
| 10601 | @@ -19619,7 +20272,7 @@ |
| 10602 | * |
| 10603 | */ |
| 10604 | __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;} |
| 10605 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_63)); |
| 10606 | + __Pyx_GOTREF(__pyx_k_tuple_63); |
| 10607 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_53)); |
| 10608 | PyTuple_SET_ITEM(__pyx_k_tuple_63, 0, ((PyObject *)__pyx_kp_s_53)); |
| 10609 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_53)); |
| 10610 | @@ -19633,7 +20286,7 @@ |
| 10611 | * |
| 10612 | */ |
| 10613 | __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;} |
| 10614 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_65)); |
| 10615 | + __Pyx_GOTREF(__pyx_k_tuple_65); |
| 10616 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_64)); |
| 10617 | PyTuple_SET_ITEM(__pyx_k_tuple_65, 0, ((PyObject *)__pyx_kp_s_64)); |
| 10618 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_64)); |
| 10619 | @@ -19647,7 +20300,7 @@ |
| 10620 | * |
| 10621 | */ |
| 10622 | __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;} |
| 10623 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_66)); |
| 10624 | + __Pyx_GOTREF(__pyx_k_tuple_66); |
| 10625 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_64)); |
| 10626 | PyTuple_SET_ITEM(__pyx_k_tuple_66, 0, ((PyObject *)__pyx_kp_s_64)); |
| 10627 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_64)); |
| 10628 | @@ -19661,7 +20314,7 @@ |
| 10629 | * |
| 10630 | */ |
| 10631 | __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;} |
| 10632 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_67)); |
| 10633 | + __Pyx_GOTREF(__pyx_k_tuple_67); |
| 10634 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_22)); |
| 10635 | PyTuple_SET_ITEM(__pyx_k_tuple_67, 0, ((PyObject *)__pyx_kp_s_22)); |
| 10636 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22)); |
| 10637 | @@ -19675,7 +20328,7 @@ |
| 10638 | * |
| 10639 | */ |
| 10640 | __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;} |
| 10641 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_68)); |
| 10642 | + __Pyx_GOTREF(__pyx_k_tuple_68); |
| 10643 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_22)); |
| 10644 | PyTuple_SET_ITEM(__pyx_k_tuple_68, 0, ((PyObject *)__pyx_kp_s_22)); |
| 10645 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22)); |
| 10646 | @@ -19689,7 +20342,7 @@ |
| 10647 | * |
| 10648 | */ |
| 10649 | __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;} |
| 10650 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_69)); |
| 10651 | + __Pyx_GOTREF(__pyx_k_tuple_69); |
| 10652 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_22)); |
| 10653 | PyTuple_SET_ITEM(__pyx_k_tuple_69, 0, ((PyObject *)__pyx_kp_s_22)); |
| 10654 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22)); |
| 10655 | @@ -19703,7 +20356,7 @@ |
| 10656 | * |
| 10657 | */ |
| 10658 | __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;} |
| 10659 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_70)); |
| 10660 | + __Pyx_GOTREF(__pyx_k_tuple_70); |
| 10661 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_22)); |
| 10662 | PyTuple_SET_ITEM(__pyx_k_tuple_70, 0, ((PyObject *)__pyx_kp_s_22)); |
| 10663 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22)); |
| 10664 | @@ -19717,7 +20370,7 @@ |
| 10665 | * |
| 10666 | */ |
| 10667 | __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;} |
| 10668 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_71)); |
| 10669 | + __Pyx_GOTREF(__pyx_k_tuple_71); |
| 10670 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_22)); |
| 10671 | PyTuple_SET_ITEM(__pyx_k_tuple_71, 0, ((PyObject *)__pyx_kp_s_22)); |
| 10672 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22)); |
| 10673 | @@ -19731,7 +20384,7 @@ |
| 10674 | * |
| 10675 | */ |
| 10676 | __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;} |
| 10677 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_72)); |
| 10678 | + __Pyx_GOTREF(__pyx_k_tuple_72); |
| 10679 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_22)); |
| 10680 | PyTuple_SET_ITEM(__pyx_k_tuple_72, 0, ((PyObject *)__pyx_kp_s_22)); |
| 10681 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22)); |
| 10682 | @@ -19745,7 +20398,7 @@ |
| 10683 | * |
| 10684 | */ |
| 10685 | __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;} |
| 10686 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_75)); |
| 10687 | + __Pyx_GOTREF(__pyx_k_tuple_75); |
| 10688 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_19)); |
| 10689 | PyTuple_SET_ITEM(__pyx_k_tuple_75, 0, ((PyObject *)__pyx_kp_s_19)); |
| 10690 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19)); |
| 10691 | @@ -19759,7 +20412,7 @@ |
| 10692 | * |
| 10693 | */ |
| 10694 | __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;} |
| 10695 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_76)); |
| 10696 | + __Pyx_GOTREF(__pyx_k_tuple_76); |
| 10697 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_19)); |
| 10698 | PyTuple_SET_ITEM(__pyx_k_tuple_76, 0, ((PyObject *)__pyx_kp_s_19)); |
| 10699 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19)); |
| 10700 | @@ -19773,7 +20426,7 @@ |
| 10701 | * |
| 10702 | */ |
| 10703 | __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;} |
| 10704 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_79)); |
| 10705 | + __Pyx_GOTREF(__pyx_k_tuple_79); |
| 10706 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_19)); |
| 10707 | PyTuple_SET_ITEM(__pyx_k_tuple_79, 0, ((PyObject *)__pyx_kp_s_19)); |
| 10708 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19)); |
| 10709 | @@ -19787,7 +20440,7 @@ |
| 10710 | * |
| 10711 | */ |
| 10712 | __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;} |
| 10713 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_80)); |
| 10714 | + __Pyx_GOTREF(__pyx_k_tuple_80); |
| 10715 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_19)); |
| 10716 | PyTuple_SET_ITEM(__pyx_k_tuple_80, 0, ((PyObject *)__pyx_kp_s_19)); |
| 10717 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19)); |
| 10718 | @@ -19801,7 +20454,7 @@ |
| 10719 | * |
| 10720 | */ |
| 10721 | __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;} |
| 10722 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_83)); |
| 10723 | + __Pyx_GOTREF(__pyx_k_tuple_83); |
| 10724 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_19)); |
| 10725 | PyTuple_SET_ITEM(__pyx_k_tuple_83, 0, ((PyObject *)__pyx_kp_s_19)); |
| 10726 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19)); |
| 10727 | @@ -19815,7 +20468,7 @@ |
| 10728 | * |
| 10729 | */ |
| 10730 | __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;} |
| 10731 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_84)); |
| 10732 | + __Pyx_GOTREF(__pyx_k_tuple_84); |
| 10733 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_19)); |
| 10734 | PyTuple_SET_ITEM(__pyx_k_tuple_84, 0, ((PyObject *)__pyx_kp_s_19)); |
| 10735 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19)); |
| 10736 | @@ -19829,7 +20482,7 @@ |
| 10737 | * |
| 10738 | */ |
| 10739 | __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;} |
| 10740 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_88)); |
| 10741 | + __Pyx_GOTREF(__pyx_k_tuple_88); |
| 10742 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_87)); |
| 10743 | PyTuple_SET_ITEM(__pyx_k_tuple_88, 0, ((PyObject *)__pyx_kp_s_87)); |
| 10744 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_87)); |
| 10745 | @@ -19843,7 +20496,7 @@ |
| 10746 | * |
| 10747 | */ |
| 10748 | __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;} |
| 10749 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_90)); |
| 10750 | + __Pyx_GOTREF(__pyx_k_tuple_90); |
| 10751 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_89)); |
| 10752 | PyTuple_SET_ITEM(__pyx_k_tuple_90, 0, ((PyObject *)__pyx_kp_s_89)); |
| 10753 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_89)); |
| 10754 | @@ -19857,7 +20510,7 @@ |
| 10755 | * |
| 10756 | */ |
| 10757 | __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;} |
| 10758 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_92)); |
| 10759 | + __Pyx_GOTREF(__pyx_k_tuple_92); |
| 10760 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_19)); |
| 10761 | PyTuple_SET_ITEM(__pyx_k_tuple_92, 0, ((PyObject *)__pyx_kp_s_19)); |
| 10762 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19)); |
| 10763 | @@ -19871,7 +20524,7 @@ |
| 10764 | * |
| 10765 | */ |
| 10766 | __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;} |
| 10767 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_94)); |
| 10768 | + __Pyx_GOTREF(__pyx_k_tuple_94); |
| 10769 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_93)); |
| 10770 | PyTuple_SET_ITEM(__pyx_k_tuple_94, 0, ((PyObject *)__pyx_kp_s_93)); |
| 10771 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_93)); |
| 10772 | @@ -19885,7 +20538,7 @@ |
| 10773 | * raise ValueError("scale <= 0") |
| 10774 | */ |
| 10775 | __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;} |
| 10776 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_96)); |
| 10777 | + __Pyx_GOTREF(__pyx_k_tuple_96); |
| 10778 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_95)); |
| 10779 | PyTuple_SET_ITEM(__pyx_k_tuple_96, 0, ((PyObject *)__pyx_kp_s_95)); |
| 10780 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_95)); |
| 10781 | @@ -19899,7 +20552,7 @@ |
| 10782 | * |
| 10783 | */ |
| 10784 | __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;} |
| 10785 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_97)); |
| 10786 | + __Pyx_GOTREF(__pyx_k_tuple_97); |
| 10787 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_19)); |
| 10788 | PyTuple_SET_ITEM(__pyx_k_tuple_97, 0, ((PyObject *)__pyx_kp_s_19)); |
| 10789 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19)); |
| 10790 | @@ -19913,7 +20566,7 @@ |
| 10791 | * raise ValueError("scale <= 0.0") |
| 10792 | */ |
| 10793 | __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;} |
| 10794 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_99)); |
| 10795 | + __Pyx_GOTREF(__pyx_k_tuple_99); |
| 10796 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_98)); |
| 10797 | PyTuple_SET_ITEM(__pyx_k_tuple_99, 0, ((PyObject *)__pyx_kp_s_98)); |
| 10798 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_98)); |
| 10799 | @@ -19927,7 +20580,7 @@ |
| 10800 | * |
| 10801 | */ |
| 10802 | __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;} |
| 10803 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_100)); |
| 10804 | + __Pyx_GOTREF(__pyx_k_tuple_100); |
| 10805 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_93)); |
| 10806 | PyTuple_SET_ITEM(__pyx_k_tuple_100, 0, ((PyObject *)__pyx_kp_s_93)); |
| 10807 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_93)); |
| 10808 | @@ -19941,7 +20594,7 @@ |
| 10809 | * raise ValueError("mode > right") |
| 10810 | */ |
| 10811 | __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;} |
| 10812 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_102)); |
| 10813 | + __Pyx_GOTREF(__pyx_k_tuple_102); |
| 10814 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_101)); |
| 10815 | PyTuple_SET_ITEM(__pyx_k_tuple_102, 0, ((PyObject *)__pyx_kp_s_101)); |
| 10816 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_101)); |
| 10817 | @@ -19955,7 +20608,7 @@ |
| 10818 | * raise ValueError("left == right") |
| 10819 | */ |
| 10820 | __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;} |
| 10821 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_104)); |
| 10822 | + __Pyx_GOTREF(__pyx_k_tuple_104); |
| 10823 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_103)); |
| 10824 | PyTuple_SET_ITEM(__pyx_k_tuple_104, 0, ((PyObject *)__pyx_kp_s_103)); |
| 10825 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_103)); |
| 10826 | @@ -19969,7 +20622,7 @@ |
| 10827 | * fmode, fright) |
| 10828 | */ |
| 10829 | __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;} |
| 10830 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_106)); |
| 10831 | + __Pyx_GOTREF(__pyx_k_tuple_106); |
| 10832 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_105)); |
| 10833 | PyTuple_SET_ITEM(__pyx_k_tuple_106, 0, ((PyObject *)__pyx_kp_s_105)); |
| 10834 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_105)); |
| 10835 | @@ -19983,7 +20636,7 @@ |
| 10836 | * raise ValueError("mode > right") |
| 10837 | */ |
| 10838 | __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;} |
| 10839 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_107)); |
| 10840 | + __Pyx_GOTREF(__pyx_k_tuple_107); |
| 10841 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_101)); |
| 10842 | PyTuple_SET_ITEM(__pyx_k_tuple_107, 0, ((PyObject *)__pyx_kp_s_101)); |
| 10843 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_101)); |
| 10844 | @@ -19997,7 +20650,7 @@ |
| 10845 | * raise ValueError("left == right") |
| 10846 | */ |
| 10847 | __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;} |
| 10848 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_108)); |
| 10849 | + __Pyx_GOTREF(__pyx_k_tuple_108); |
| 10850 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_103)); |
| 10851 | PyTuple_SET_ITEM(__pyx_k_tuple_108, 0, ((PyObject *)__pyx_kp_s_103)); |
| 10852 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_103)); |
| 10853 | @@ -20011,7 +20664,7 @@ |
| 10854 | * omode, oright) |
| 10855 | */ |
| 10856 | __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;} |
| 10857 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_109)); |
| 10858 | + __Pyx_GOTREF(__pyx_k_tuple_109); |
| 10859 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_105)); |
| 10860 | PyTuple_SET_ITEM(__pyx_k_tuple_109, 0, ((PyObject *)__pyx_kp_s_105)); |
| 10861 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_105)); |
| 10862 | @@ -20025,7 +20678,7 @@ |
| 10863 | * raise ValueError("p < 0") |
| 10864 | */ |
| 10865 | __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;} |
| 10866 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_111)); |
| 10867 | + __Pyx_GOTREF(__pyx_k_tuple_111); |
| 10868 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_110)); |
| 10869 | PyTuple_SET_ITEM(__pyx_k_tuple_111, 0, ((PyObject *)__pyx_kp_s_110)); |
| 10870 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_110)); |
| 10871 | @@ -20039,7 +20692,7 @@ |
| 10872 | * raise ValueError("p > 1") |
| 10873 | */ |
| 10874 | __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;} |
| 10875 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_113)); |
| 10876 | + __Pyx_GOTREF(__pyx_k_tuple_113); |
| 10877 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_112)); |
| 10878 | PyTuple_SET_ITEM(__pyx_k_tuple_113, 0, ((PyObject *)__pyx_kp_s_112)); |
| 10879 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_112)); |
| 10880 | @@ -20053,7 +20706,7 @@ |
| 10881 | * |
| 10882 | */ |
| 10883 | __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;} |
| 10884 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_115)); |
| 10885 | + __Pyx_GOTREF(__pyx_k_tuple_115); |
| 10886 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_114)); |
| 10887 | PyTuple_SET_ITEM(__pyx_k_tuple_115, 0, ((PyObject *)__pyx_kp_s_114)); |
| 10888 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_114)); |
| 10889 | @@ -20067,7 +20720,7 @@ |
| 10890 | * raise ValueError("p < 0") |
| 10891 | */ |
| 10892 | __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;} |
| 10893 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_116)); |
| 10894 | + __Pyx_GOTREF(__pyx_k_tuple_116); |
| 10895 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_110)); |
| 10896 | PyTuple_SET_ITEM(__pyx_k_tuple_116, 0, ((PyObject *)__pyx_kp_s_110)); |
| 10897 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_110)); |
| 10898 | @@ -20081,7 +20734,7 @@ |
| 10899 | * raise ValueError("p > 1") |
| 10900 | */ |
| 10901 | __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;} |
| 10902 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_117)); |
| 10903 | + __Pyx_GOTREF(__pyx_k_tuple_117); |
| 10904 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_112)); |
| 10905 | PyTuple_SET_ITEM(__pyx_k_tuple_117, 0, ((PyObject *)__pyx_kp_s_112)); |
| 10906 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_112)); |
| 10907 | @@ -20095,7 +20748,7 @@ |
| 10908 | * |
| 10909 | */ |
| 10910 | __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;} |
| 10911 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_118)); |
| 10912 | + __Pyx_GOTREF(__pyx_k_tuple_118); |
| 10913 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_114)); |
| 10914 | PyTuple_SET_ITEM(__pyx_k_tuple_118, 0, ((PyObject *)__pyx_kp_s_114)); |
| 10915 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_114)); |
| 10916 | @@ -20109,7 +20762,7 @@ |
| 10917 | * raise ValueError("p < 0") |
| 10918 | */ |
| 10919 | __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;} |
| 10920 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_119)); |
| 10921 | + __Pyx_GOTREF(__pyx_k_tuple_119); |
| 10922 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_110)); |
| 10923 | PyTuple_SET_ITEM(__pyx_k_tuple_119, 0, ((PyObject *)__pyx_kp_s_110)); |
| 10924 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_110)); |
| 10925 | @@ -20123,7 +20776,7 @@ |
| 10926 | * raise ValueError("p > 1") |
| 10927 | */ |
| 10928 | __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;} |
| 10929 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_120)); |
| 10930 | + __Pyx_GOTREF(__pyx_k_tuple_120); |
| 10931 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_112)); |
| 10932 | PyTuple_SET_ITEM(__pyx_k_tuple_120, 0, ((PyObject *)__pyx_kp_s_112)); |
| 10933 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_112)); |
| 10934 | @@ -20137,7 +20790,7 @@ |
| 10935 | * size, fn, fp) |
| 10936 | */ |
| 10937 | __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;} |
| 10938 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_121)); |
| 10939 | + __Pyx_GOTREF(__pyx_k_tuple_121); |
| 10940 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_114)); |
| 10941 | PyTuple_SET_ITEM(__pyx_k_tuple_121, 0, ((PyObject *)__pyx_kp_s_114)); |
| 10942 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_114)); |
| 10943 | @@ -20151,7 +20804,7 @@ |
| 10944 | * raise ValueError("p < 0") |
| 10945 | */ |
| 10946 | __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;} |
| 10947 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_122)); |
| 10948 | + __Pyx_GOTREF(__pyx_k_tuple_122); |
| 10949 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_110)); |
| 10950 | PyTuple_SET_ITEM(__pyx_k_tuple_122, 0, ((PyObject *)__pyx_kp_s_110)); |
| 10951 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_110)); |
| 10952 | @@ -20165,7 +20818,7 @@ |
| 10953 | * raise ValueError("p > 1") |
| 10954 | */ |
| 10955 | __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;} |
| 10956 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_123)); |
| 10957 | + __Pyx_GOTREF(__pyx_k_tuple_123); |
| 10958 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_112)); |
| 10959 | PyTuple_SET_ITEM(__pyx_k_tuple_123, 0, ((PyObject *)__pyx_kp_s_112)); |
| 10960 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_112)); |
| 10961 | @@ -20179,7 +20832,7 @@ |
| 10962 | * on, op) |
| 10963 | */ |
| 10964 | __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;} |
| 10965 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_124)); |
| 10966 | + __Pyx_GOTREF(__pyx_k_tuple_124); |
| 10967 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_114)); |
| 10968 | PyTuple_SET_ITEM(__pyx_k_tuple_124, 0, ((PyObject *)__pyx_kp_s_114)); |
| 10969 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_114)); |
| 10970 | @@ -20193,7 +20846,7 @@ |
| 10971 | * raise ValueError("lam value too large") |
| 10972 | */ |
| 10973 | __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;} |
| 10974 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_127)); |
| 10975 | + __Pyx_GOTREF(__pyx_k_tuple_127); |
| 10976 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_126)); |
| 10977 | PyTuple_SET_ITEM(__pyx_k_tuple_127, 0, ((PyObject *)__pyx_kp_s_126)); |
| 10978 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_126)); |
| 10979 | @@ -20207,7 +20860,7 @@ |
| 10980 | * |
| 10981 | */ |
| 10982 | __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;} |
| 10983 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_129)); |
| 10984 | + __Pyx_GOTREF(__pyx_k_tuple_129); |
| 10985 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_128)); |
| 10986 | PyTuple_SET_ITEM(__pyx_k_tuple_129, 0, ((PyObject *)__pyx_kp_s_128)); |
| 10987 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_128)); |
| 10988 | @@ -20221,7 +20874,7 @@ |
| 10989 | * raise ValueError("lam value too large.") |
| 10990 | */ |
| 10991 | __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;} |
| 10992 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_130)); |
| 10993 | + __Pyx_GOTREF(__pyx_k_tuple_130); |
| 10994 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_126)); |
| 10995 | PyTuple_SET_ITEM(__pyx_k_tuple_130, 0, ((PyObject *)__pyx_kp_s_126)); |
| 10996 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_126)); |
| 10997 | @@ -20235,7 +20888,7 @@ |
| 10998 | * |
| 10999 | */ |
| 11000 | __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;} |
| 11001 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_132)); |
| 11002 | + __Pyx_GOTREF(__pyx_k_tuple_132); |
| 11003 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_131)); |
| 11004 | PyTuple_SET_ITEM(__pyx_k_tuple_132, 0, ((PyObject *)__pyx_kp_s_131)); |
| 11005 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_131)); |
| 11006 | @@ -20249,7 +20902,7 @@ |
| 11007 | * |
| 11008 | */ |
| 11009 | __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;} |
| 11010 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_134)); |
| 11011 | + __Pyx_GOTREF(__pyx_k_tuple_134); |
| 11012 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_133)); |
| 11013 | PyTuple_SET_ITEM(__pyx_k_tuple_134, 0, ((PyObject *)__pyx_kp_s_133)); |
| 11014 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_133)); |
| 11015 | @@ -20263,7 +20916,7 @@ |
| 11016 | * |
| 11017 | */ |
| 11018 | __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;} |
| 11019 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_135)); |
| 11020 | + __Pyx_GOTREF(__pyx_k_tuple_135); |
| 11021 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_133)); |
| 11022 | PyTuple_SET_ITEM(__pyx_k_tuple_135, 0, ((PyObject *)__pyx_kp_s_133)); |
| 11023 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_133)); |
| 11024 | @@ -20277,7 +20930,7 @@ |
| 11025 | * raise ValueError("p > 1.0") |
| 11026 | */ |
| 11027 | __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;} |
| 11028 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_137)); |
| 11029 | + __Pyx_GOTREF(__pyx_k_tuple_137); |
| 11030 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_136)); |
| 11031 | PyTuple_SET_ITEM(__pyx_k_tuple_137, 0, ((PyObject *)__pyx_kp_s_136)); |
| 11032 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_136)); |
| 11033 | @@ -20291,7 +20944,7 @@ |
| 11034 | * |
| 11035 | */ |
| 11036 | __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;} |
| 11037 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_139)); |
| 11038 | + __Pyx_GOTREF(__pyx_k_tuple_139); |
| 11039 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_138)); |
| 11040 | PyTuple_SET_ITEM(__pyx_k_tuple_139, 0, ((PyObject *)__pyx_kp_s_138)); |
| 11041 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_138)); |
| 11042 | @@ -20305,7 +20958,7 @@ |
| 11043 | * raise ValueError("p > 1.0") |
| 11044 | */ |
| 11045 | __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;} |
| 11046 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_140)); |
| 11047 | + __Pyx_GOTREF(__pyx_k_tuple_140); |
| 11048 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_136)); |
| 11049 | PyTuple_SET_ITEM(__pyx_k_tuple_140, 0, ((PyObject *)__pyx_kp_s_136)); |
| 11050 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_136)); |
| 11051 | @@ -20319,7 +20972,7 @@ |
| 11052 | * |
| 11053 | */ |
| 11054 | __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;} |
| 11055 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_141)); |
| 11056 | + __Pyx_GOTREF(__pyx_k_tuple_141); |
| 11057 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_138)); |
| 11058 | PyTuple_SET_ITEM(__pyx_k_tuple_141, 0, ((PyObject *)__pyx_kp_s_138)); |
| 11059 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_138)); |
| 11060 | @@ -20333,7 +20986,7 @@ |
| 11061 | * raise ValueError("nbad < 1") |
| 11062 | */ |
| 11063 | __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;} |
| 11064 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_143)); |
| 11065 | + __Pyx_GOTREF(__pyx_k_tuple_143); |
| 11066 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_142)); |
| 11067 | PyTuple_SET_ITEM(__pyx_k_tuple_143, 0, ((PyObject *)__pyx_kp_s_142)); |
| 11068 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_142)); |
| 11069 | @@ -20347,7 +21000,7 @@ |
| 11070 | * raise ValueError("nsample < 1") |
| 11071 | */ |
| 11072 | __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;} |
| 11073 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_145)); |
| 11074 | + __Pyx_GOTREF(__pyx_k_tuple_145); |
| 11075 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_144)); |
| 11076 | PyTuple_SET_ITEM(__pyx_k_tuple_145, 0, ((PyObject *)__pyx_kp_s_144)); |
| 11077 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_144)); |
| 11078 | @@ -20361,7 +21014,7 @@ |
| 11079 | * raise ValueError("ngood + nbad < nsample") |
| 11080 | */ |
| 11081 | __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;} |
| 11082 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_147)); |
| 11083 | + __Pyx_GOTREF(__pyx_k_tuple_147); |
| 11084 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_146)); |
| 11085 | PyTuple_SET_ITEM(__pyx_k_tuple_147, 0, ((PyObject *)__pyx_kp_s_146)); |
| 11086 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_146)); |
| 11087 | @@ -20375,7 +21028,7 @@ |
| 11088 | * lngood, lnbad, lnsample) |
| 11089 | */ |
| 11090 | __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;} |
| 11091 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_149)); |
| 11092 | + __Pyx_GOTREF(__pyx_k_tuple_149); |
| 11093 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_148)); |
| 11094 | PyTuple_SET_ITEM(__pyx_k_tuple_149, 0, ((PyObject *)__pyx_kp_s_148)); |
| 11095 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_148)); |
| 11096 | @@ -20389,7 +21042,7 @@ |
| 11097 | * raise ValueError("nbad < 1") |
| 11098 | */ |
| 11099 | __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;} |
| 11100 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_150)); |
| 11101 | + __Pyx_GOTREF(__pyx_k_tuple_150); |
| 11102 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_142)); |
| 11103 | PyTuple_SET_ITEM(__pyx_k_tuple_150, 0, ((PyObject *)__pyx_kp_s_142)); |
| 11104 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_142)); |
| 11105 | @@ -20403,7 +21056,7 @@ |
| 11106 | * raise ValueError("nsample < 1") |
| 11107 | */ |
| 11108 | __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;} |
| 11109 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_151)); |
| 11110 | + __Pyx_GOTREF(__pyx_k_tuple_151); |
| 11111 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_144)); |
| 11112 | PyTuple_SET_ITEM(__pyx_k_tuple_151, 0, ((PyObject *)__pyx_kp_s_144)); |
| 11113 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_144)); |
| 11114 | @@ -20417,7 +21070,7 @@ |
| 11115 | * raise ValueError("ngood + nbad < nsample") |
| 11116 | */ |
| 11117 | __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;} |
| 11118 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_152)); |
| 11119 | + __Pyx_GOTREF(__pyx_k_tuple_152); |
| 11120 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_146)); |
| 11121 | PyTuple_SET_ITEM(__pyx_k_tuple_152, 0, ((PyObject *)__pyx_kp_s_146)); |
| 11122 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_146)); |
| 11123 | @@ -20431,7 +21084,7 @@ |
| 11124 | * ongood, onbad, onsample) |
| 11125 | */ |
| 11126 | __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;} |
| 11127 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_153)); |
| 11128 | + __Pyx_GOTREF(__pyx_k_tuple_153); |
| 11129 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_148)); |
| 11130 | PyTuple_SET_ITEM(__pyx_k_tuple_153, 0, ((PyObject *)__pyx_kp_s_148)); |
| 11131 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_148)); |
| 11132 | @@ -20445,7 +21098,7 @@ |
| 11133 | * raise ValueError("p >= 1.0") |
| 11134 | */ |
| 11135 | __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;} |
| 11136 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_155)); |
| 11137 | + __Pyx_GOTREF(__pyx_k_tuple_155); |
| 11138 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_154)); |
| 11139 | PyTuple_SET_ITEM(__pyx_k_tuple_155, 0, ((PyObject *)__pyx_kp_s_154)); |
| 11140 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_154)); |
| 11141 | @@ -20459,7 +21112,7 @@ |
| 11142 | * |
| 11143 | */ |
| 11144 | __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;} |
| 11145 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_157)); |
| 11146 | + __Pyx_GOTREF(__pyx_k_tuple_157); |
| 11147 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_156)); |
| 11148 | PyTuple_SET_ITEM(__pyx_k_tuple_157, 0, ((PyObject *)__pyx_kp_s_156)); |
| 11149 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_156)); |
| 11150 | @@ -20473,7 +21126,7 @@ |
| 11151 | * raise ValueError("p >= 1.0") |
| 11152 | */ |
| 11153 | __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;} |
| 11154 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_158)); |
| 11155 | + __Pyx_GOTREF(__pyx_k_tuple_158); |
| 11156 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_154)); |
| 11157 | PyTuple_SET_ITEM(__pyx_k_tuple_158, 0, ((PyObject *)__pyx_kp_s_154)); |
| 11158 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_154)); |
| 11159 | @@ -20487,7 +21140,7 @@ |
| 11160 | * |
| 11161 | */ |
| 11162 | __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;} |
| 11163 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_159)); |
| 11164 | + __Pyx_GOTREF(__pyx_k_tuple_159); |
| 11165 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_156)); |
| 11166 | PyTuple_SET_ITEM(__pyx_k_tuple_159, 0, ((PyObject *)__pyx_kp_s_156)); |
| 11167 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_156)); |
| 11168 | @@ -20501,7 +21154,7 @@ |
| 11169 | * raise ValueError("cov must be 2 dimensional and square") |
| 11170 | */ |
| 11171 | __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;} |
| 11172 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_161)); |
| 11173 | + __Pyx_GOTREF(__pyx_k_tuple_161); |
| 11174 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_160)); |
| 11175 | PyTuple_SET_ITEM(__pyx_k_tuple_161, 0, ((PyObject *)__pyx_kp_s_160)); |
| 11176 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_160)); |
| 11177 | @@ -20515,7 +21168,7 @@ |
| 11178 | * raise ValueError("mean and cov must have same length") |
| 11179 | */ |
| 11180 | __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;} |
| 11181 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_163)); |
| 11182 | + __Pyx_GOTREF(__pyx_k_tuple_163); |
| 11183 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_162)); |
| 11184 | PyTuple_SET_ITEM(__pyx_k_tuple_163, 0, ((PyObject *)__pyx_kp_s_162)); |
| 11185 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_162)); |
| 11186 | @@ -20529,7 +21182,7 @@ |
| 11187 | * if isinstance(shape, int): |
| 11188 | */ |
| 11189 | __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;} |
| 11190 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_165)); |
| 11191 | + __Pyx_GOTREF(__pyx_k_tuple_165); |
| 11192 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_164)); |
| 11193 | PyTuple_SET_ITEM(__pyx_k_tuple_165, 0, ((PyObject *)__pyx_kp_s_164)); |
| 11194 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_164)); |
| 11195 | @@ -20543,7 +21196,7 @@ |
| 11196 | * if size is None: |
| 11197 | */ |
| 11198 | __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;} |
| 11199 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_168)); |
| 11200 | + __Pyx_GOTREF(__pyx_k_tuple_168); |
| 11201 | __Pyx_INCREF(((PyObject *)__pyx_kp_s_167)); |
| 11202 | PyTuple_SET_ITEM(__pyx_k_tuple_168, 0, ((PyObject *)__pyx_kp_s_167)); |
| 11203 | __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_167)); |
| 11204 | @@ -20557,13 +21210,13 @@ |
| 11205 | * def __init__(self, seed=None): |
| 11206 | */ |
| 11207 | __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;} |
| 11208 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_169)); |
| 11209 | + __Pyx_GOTREF(__pyx_k_tuple_169); |
| 11210 | __Pyx_INCREF(((PyObject *)__pyx_n_s__l)); |
| 11211 | PyTuple_SET_ITEM(__pyx_k_tuple_169, 0, ((PyObject *)__pyx_n_s__l)); |
| 11212 | __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l)); |
| 11213 | __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_169)); |
| 11214 | __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;} |
| 11215 | - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_170)); |
| 11216 | + __Pyx_GOTREF(__pyx_k_tuple_170); |
| 11217 | __Pyx_INCREF(((PyObject *)__pyx_n_s__l)); |
| 11218 | PyTuple_SET_ITEM(__pyx_k_tuple_170, 0, ((PyObject *)__pyx_n_s__l)); |
| 11219 | __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l)); |
| 11220 | @@ -20608,12 +21261,18 @@ |
| 11221 | Py_FatalError("failed to import 'refnanny' module"); |
| 11222 | } |
| 11223 | #endif |
| 11224 | - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_mtrand(void)"); |
| 11225 | + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_mtrand(void)", 0); |
| 11226 | if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 11227 | __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;} |
| 11228 | __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;} |
| 11229 | - #ifdef __pyx_binding_PyCFunctionType_USED |
| 11230 | - if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 11231 | + #ifdef __Pyx_CyFunction_USED |
| 11232 | + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 11233 | + #endif |
| 11234 | + #ifdef __Pyx_FusedFunction_USED |
| 11235 | + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 11236 | + #endif |
| 11237 | + #ifdef __Pyx_Generator_USED |
| 11238 | + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 11239 | #endif |
| 11240 | /*--- Library function declarations ---*/ |
| 11241 | /*--- Threads initialization code ---*/ |
| 11242 | @@ -20624,16 +21283,15 @@ |
| 11243 | #endif |
| 11244 | /*--- Module creation code ---*/ |
| 11245 | #if PY_MAJOR_VERSION < 3 |
| 11246 | - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("mtrand"), __pyx_methods, 0, 0, PYTHON_API_VERSION); |
| 11247 | + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("mtrand"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); |
| 11248 | #else |
| 11249 | __pyx_m = PyModule_Create(&__pyx_moduledef); |
| 11250 | #endif |
| 11251 | - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; |
| 11252 | - #if PY_MAJOR_VERSION < 3 |
| 11253 | - Py_INCREF(__pyx_m); |
| 11254 | + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 11255 | + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 11256 | + #if CYTHON_COMPILING_IN_PYPY |
| 11257 | + Py_INCREF(__pyx_b); |
| 11258 | #endif |
| 11259 | - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); |
| 11260 | - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; |
| 11261 | if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; |
| 11262 | /*--- Initialize various global constants etc. ---*/ |
| 11263 | if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} |
| 11264 | @@ -20716,7 +21374,7 @@ |
| 11265 | __Pyx_GOTREF(__pyx_t_4); |
| 11266 | __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| 11267 | __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;} |
| 11268 | - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); |
| 11269 | + __Pyx_GOTREF(__pyx_t_1); |
| 11270 | PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); |
| 11271 | __Pyx_GIVEREF(__pyx_t_4); |
| 11272 | __pyx_t_4 = 0; |
| 11273 | @@ -21667,7 +22325,6 @@ |
| 11274 | } |
| 11275 | |
| 11276 | /* Runtime support code */ |
| 11277 | - |
| 11278 | #if CYTHON_REFNANNY |
| 11279 | static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { |
| 11280 | PyObject *m = NULL, *p = NULL; |
| 11281 | @@ -21700,9 +22357,9 @@ |
| 11282 | } |
| 11283 | |
| 11284 | static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { |
| 11285 | +#if CYTHON_COMPILING_IN_CPYTHON |
| 11286 | PyObject *tmp_type, *tmp_value, *tmp_tb; |
| 11287 | PyThreadState *tstate = PyThreadState_GET(); |
| 11288 | - |
| 11289 | tmp_type = tstate->curexc_type; |
| 11290 | tmp_value = tstate->curexc_value; |
| 11291 | tmp_tb = tstate->curexc_traceback; |
| 11292 | @@ -21712,55 +22369,60 @@ |
| 11293 | Py_XDECREF(tmp_type); |
| 11294 | Py_XDECREF(tmp_value); |
| 11295 | Py_XDECREF(tmp_tb); |
| 11296 | +#else |
| 11297 | + PyErr_Restore(type, value, tb); |
| 11298 | +#endif |
| 11299 | } |
| 11300 | - |
| 11301 | static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { |
| 11302 | +#if CYTHON_COMPILING_IN_CPYTHON |
| 11303 | PyThreadState *tstate = PyThreadState_GET(); |
| 11304 | *type = tstate->curexc_type; |
| 11305 | *value = tstate->curexc_value; |
| 11306 | *tb = tstate->curexc_traceback; |
| 11307 | - |
| 11308 | tstate->curexc_type = 0; |
| 11309 | tstate->curexc_value = 0; |
| 11310 | tstate->curexc_traceback = 0; |
| 11311 | +#else |
| 11312 | + PyErr_Fetch(type, value, tb); |
| 11313 | +#endif |
| 11314 | } |
| 11315 | |
| 11316 | - |
| 11317 | #if PY_MAJOR_VERSION < 3 |
| 11318 | -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { |
| 11319 | - /* cause is unused */ |
| 11320 | +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, |
| 11321 | + CYTHON_UNUSED PyObject *cause) { |
| 11322 | Py_XINCREF(type); |
| 11323 | - Py_XINCREF(value); |
| 11324 | - Py_XINCREF(tb); |
| 11325 | - /* First, check the traceback argument, replacing None with NULL. */ |
| 11326 | - if (tb == Py_None) { |
| 11327 | - Py_DECREF(tb); |
| 11328 | - tb = 0; |
| 11329 | - } |
| 11330 | - else if (tb != NULL && !PyTraceBack_Check(tb)) { |
| 11331 | - PyErr_SetString(PyExc_TypeError, |
| 11332 | - "raise: arg 3 must be a traceback or None"); |
| 11333 | - goto raise_error; |
| 11334 | - } |
| 11335 | - /* Next, replace a missing value with None */ |
| 11336 | - if (value == NULL) { |
| 11337 | - value = Py_None; |
| 11338 | + if (!value || value == Py_None) |
| 11339 | + value = NULL; |
| 11340 | + else |
| 11341 | Py_INCREF(value); |
| 11342 | + if (!tb || tb == Py_None) |
| 11343 | + tb = NULL; |
| 11344 | + else { |
| 11345 | + Py_INCREF(tb); |
| 11346 | + if (!PyTraceBack_Check(tb)) { |
| 11347 | + PyErr_SetString(PyExc_TypeError, |
| 11348 | + "raise: arg 3 must be a traceback or None"); |
| 11349 | + goto raise_error; |
| 11350 | + } |
| 11351 | } |
| 11352 | #if PY_VERSION_HEX < 0x02050000 |
| 11353 | - if (!PyClass_Check(type)) |
| 11354 | + if (PyClass_Check(type)) { |
| 11355 | #else |
| 11356 | - if (!PyType_Check(type)) |
| 11357 | + if (PyType_Check(type)) { |
| 11358 | #endif |
| 11359 | - { |
| 11360 | - /* Raising an instance. The value should be a dummy. */ |
| 11361 | - if (value != Py_None) { |
| 11362 | +#if CYTHON_COMPILING_IN_PYPY |
| 11363 | + if (!value) { |
| 11364 | + Py_INCREF(Py_None); |
| 11365 | + value = Py_None; |
| 11366 | + } |
| 11367 | +#endif |
| 11368 | + PyErr_NormalizeException(&type, &value, &tb); |
| 11369 | + } else { |
| 11370 | + if (value) { |
| 11371 | PyErr_SetString(PyExc_TypeError, |
| 11372 | "instance exception may not have a separate value"); |
| 11373 | goto raise_error; |
| 11374 | } |
| 11375 | - /* Normalize to raise <class>, <instance> */ |
| 11376 | - Py_DECREF(value); |
| 11377 | value = type; |
| 11378 | #if PY_VERSION_HEX < 0x02050000 |
| 11379 | if (PyInstance_Check(type)) { |
| 11380 | @@ -21783,7 +22445,6 @@ |
| 11381 | } |
| 11382 | #endif |
| 11383 | } |
| 11384 | - |
| 11385 | __Pyx_ErrRestore(type, value, tb); |
| 11386 | return; |
| 11387 | raise_error: |
| 11388 | @@ -21792,10 +22453,9 @@ |
| 11389 | Py_XDECREF(tb); |
| 11390 | return; |
| 11391 | } |
| 11392 | - |
| 11393 | #else /* Python 3+ */ |
| 11394 | - |
| 11395 | static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { |
| 11396 | + PyObject* owned_instance = NULL; |
| 11397 | if (tb == Py_None) { |
| 11398 | tb = 0; |
| 11399 | } else if (tb && !PyTraceBack_Check(tb)) { |
| 11400 | @@ -21805,7 +22465,6 @@ |
| 11401 | } |
| 11402 | if (value == Py_None) |
| 11403 | value = 0; |
| 11404 | - |
| 11405 | if (PyExceptionInstance_Check(type)) { |
| 11406 | if (value) { |
| 11407 | PyErr_SetString(PyExc_TypeError, |
| 11408 | @@ -21814,13 +22473,36 @@ |
| 11409 | } |
| 11410 | value = type; |
| 11411 | type = (PyObject*) Py_TYPE(value); |
| 11412 | - } else if (!PyExceptionClass_Check(type)) { |
| 11413 | + } else if (PyExceptionClass_Check(type)) { |
| 11414 | + PyObject *args; |
| 11415 | + if (!value) |
| 11416 | + args = PyTuple_New(0); |
| 11417 | + else if (PyTuple_Check(value)) { |
| 11418 | + Py_INCREF(value); |
| 11419 | + args = value; |
| 11420 | + } |
| 11421 | + else |
| 11422 | + args = PyTuple_Pack(1, value); |
| 11423 | + if (!args) |
| 11424 | + goto bad; |
| 11425 | + owned_instance = PyEval_CallObject(type, args); |
| 11426 | + Py_DECREF(args); |
| 11427 | + if (!owned_instance) |
| 11428 | + goto bad; |
| 11429 | + value = owned_instance; |
| 11430 | + if (!PyExceptionInstance_Check(value)) { |
| 11431 | + PyErr_Format(PyExc_TypeError, |
| 11432 | + "calling %R should have returned an instance of " |
| 11433 | + "BaseException, not %R", |
| 11434 | + type, Py_TYPE(value)); |
| 11435 | + goto bad; |
| 11436 | + } |
| 11437 | + } else { |
| 11438 | PyErr_SetString(PyExc_TypeError, |
| 11439 | "raise: exception class must be a subclass of BaseException"); |
| 11440 | goto bad; |
| 11441 | } |
| 11442 | - |
| 11443 | - if (cause) { |
| 11444 | + if (cause && cause != Py_None) { |
| 11445 | PyObject *fixed_cause; |
| 11446 | if (PyExceptionClass_Check(cause)) { |
| 11447 | fixed_cause = PyObject_CallObject(cause, NULL); |
| 11448 | @@ -21837,14 +22519,9 @@ |
| 11449 | "BaseException"); |
| 11450 | goto bad; |
| 11451 | } |
| 11452 | - if (!value) { |
| 11453 | - value = PyObject_CallObject(type, NULL); |
| 11454 | - } |
| 11455 | PyException_SetCause(value, fixed_cause); |
| 11456 | } |
| 11457 | - |
| 11458 | PyErr_SetObject(type, value); |
| 11459 | - |
| 11460 | if (tb) { |
| 11461 | PyThreadState *tstate = PyThreadState_GET(); |
| 11462 | PyObject* tmp_tb = tstate->curexc_traceback; |
| 11463 | @@ -21854,8 +22531,8 @@ |
| 11464 | Py_XDECREF(tmp_tb); |
| 11465 | } |
| 11466 | } |
| 11467 | - |
| 11468 | bad: |
| 11469 | + Py_XDECREF(owned_instance); |
| 11470 | return; |
| 11471 | } |
| 11472 | #endif |
| 11473 | @@ -21869,7 +22546,7 @@ |
| 11474 | "%s() got multiple values for keyword argument '%U'", func_name, kw_name); |
| 11475 | #else |
| 11476 | "%s() got multiple values for keyword argument '%s'", func_name, |
| 11477 | - PyString_AS_STRING(kw_name)); |
| 11478 | + PyString_AsString(kw_name)); |
| 11479 | #endif |
| 11480 | } |
| 11481 | |
| 11482 | @@ -21885,55 +22562,77 @@ |
| 11483 | Py_ssize_t pos = 0; |
| 11484 | PyObject*** name; |
| 11485 | PyObject*** first_kw_arg = argnames + num_pos_args; |
| 11486 | - |
| 11487 | while (PyDict_Next(kwds, &pos, &key, &value)) { |
| 11488 | name = first_kw_arg; |
| 11489 | while (*name && (**name != key)) name++; |
| 11490 | if (*name) { |
| 11491 | values[name-argnames] = value; |
| 11492 | - } else { |
| 11493 | - #if PY_MAJOR_VERSION < 3 |
| 11494 | - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { |
| 11495 | - #else |
| 11496 | - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { |
| 11497 | - #endif |
| 11498 | - goto invalid_keyword_type; |
| 11499 | - } else { |
| 11500 | - for (name = first_kw_arg; *name; name++) { |
| 11501 | - #if PY_MAJOR_VERSION >= 3 |
| 11502 | - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && |
| 11503 | - PyUnicode_Compare(**name, key) == 0) break; |
| 11504 | - #else |
| 11505 | - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && |
| 11506 | - _PyString_Eq(**name, key)) break; |
| 11507 | - #endif |
| 11508 | - } |
| 11509 | - if (*name) { |
| 11510 | + continue; |
| 11511 | + } |
| 11512 | + name = first_kw_arg; |
| 11513 | + #if PY_MAJOR_VERSION < 3 |
| 11514 | + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { |
| 11515 | + while (*name) { |
| 11516 | + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) |
| 11517 | + && _PyString_Eq(**name, key)) { |
| 11518 | values[name-argnames] = value; |
| 11519 | - } else { |
| 11520 | - /* unexpected keyword found */ |
| 11521 | - for (name=argnames; name != first_kw_arg; name++) { |
| 11522 | - if (**name == key) goto arg_passed_twice; |
| 11523 | - #if PY_MAJOR_VERSION >= 3 |
| 11524 | - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && |
| 11525 | - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; |
| 11526 | - #else |
| 11527 | - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && |
| 11528 | - _PyString_Eq(**name, key)) goto arg_passed_twice; |
| 11529 | - #endif |
| 11530 | - } |
| 11531 | - if (kwds2) { |
| 11532 | - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; |
| 11533 | - } else { |
| 11534 | - goto invalid_keyword; |
| 11535 | + break; |
| 11536 | + } |
| 11537 | + name++; |
| 11538 | + } |
| 11539 | + if (*name) continue; |
| 11540 | + else { |
| 11541 | + PyObject*** argname = argnames; |
| 11542 | + while (argname != first_kw_arg) { |
| 11543 | + if ((**argname == key) || ( |
| 11544 | + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) |
| 11545 | + && _PyString_Eq(**argname, key))) { |
| 11546 | + goto arg_passed_twice; |
| 11547 | } |
| 11548 | + argname++; |
| 11549 | } |
| 11550 | } |
| 11551 | + } else |
| 11552 | + #endif |
| 11553 | + if (likely(PyUnicode_Check(key))) { |
| 11554 | + while (*name) { |
| 11555 | + int cmp = (**name == key) ? 0 : |
| 11556 | + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 |
| 11557 | + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : |
| 11558 | + #endif |
| 11559 | + PyUnicode_Compare(**name, key); |
| 11560 | + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; |
| 11561 | + if (cmp == 0) { |
| 11562 | + values[name-argnames] = value; |
| 11563 | + break; |
| 11564 | + } |
| 11565 | + name++; |
| 11566 | + } |
| 11567 | + if (*name) continue; |
| 11568 | + else { |
| 11569 | + PyObject*** argname = argnames; |
| 11570 | + while (argname != first_kw_arg) { |
| 11571 | + int cmp = (**argname == key) ? 0 : |
| 11572 | + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 |
| 11573 | + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : |
| 11574 | + #endif |
| 11575 | + PyUnicode_Compare(**argname, key); |
| 11576 | + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; |
| 11577 | + if (cmp == 0) goto arg_passed_twice; |
| 11578 | + argname++; |
| 11579 | + } |
| 11580 | + } |
| 11581 | + } else |
| 11582 | + goto invalid_keyword_type; |
| 11583 | + if (kwds2) { |
| 11584 | + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; |
| 11585 | + } else { |
| 11586 | + goto invalid_keyword; |
| 11587 | } |
| 11588 | } |
| 11589 | return 0; |
| 11590 | arg_passed_twice: |
| 11591 | - __Pyx_RaiseDoubleKeywordsError(function_name, **name); |
| 11592 | + __Pyx_RaiseDoubleKeywordsError(function_name, key); |
| 11593 | goto bad; |
| 11594 | invalid_keyword_type: |
| 11595 | PyErr_Format(PyExc_TypeError, |
| 11596 | @@ -21961,7 +22660,6 @@ |
| 11597 | { |
| 11598 | Py_ssize_t num_expected; |
| 11599 | const char *more_or_less; |
| 11600 | - |
| 11601 | if (num_found < num_min) { |
| 11602 | num_expected = num_min; |
| 11603 | more_or_less = "at least"; |
| 11604 | @@ -21973,21 +22671,54 @@ |
| 11605 | more_or_less = "exactly"; |
| 11606 | } |
| 11607 | PyErr_Format(PyExc_TypeError, |
| 11608 | - "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", |
| 11609 | + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", |
| 11610 | func_name, more_or_less, num_expected, |
| 11611 | (num_expected == 1) ? "" : "s", num_found); |
| 11612 | } |
| 11613 | |
| 11614 | +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { |
| 11615 | + PyErr_Format(PyExc_ValueError, |
| 11616 | + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); |
| 11617 | +} |
| 11618 | |
| 11619 | static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { |
| 11620 | PyErr_Format(PyExc_ValueError, |
| 11621 | - "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", |
| 11622 | + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", |
| 11623 | index, (index == 1) ? "" : "s"); |
| 11624 | } |
| 11625 | |
| 11626 | -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { |
| 11627 | - PyErr_Format(PyExc_ValueError, |
| 11628 | - "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); |
| 11629 | +static CYTHON_INLINE int __Pyx_IterFinish(void) { |
| 11630 | +#if CYTHON_COMPILING_IN_CPYTHON |
| 11631 | + PyThreadState *tstate = PyThreadState_GET(); |
| 11632 | + PyObject* exc_type = tstate->curexc_type; |
| 11633 | + if (unlikely(exc_type)) { |
| 11634 | + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { |
| 11635 | + PyObject *exc_value, *exc_tb; |
| 11636 | + exc_value = tstate->curexc_value; |
| 11637 | + exc_tb = tstate->curexc_traceback; |
| 11638 | + tstate->curexc_type = 0; |
| 11639 | + tstate->curexc_value = 0; |
| 11640 | + tstate->curexc_traceback = 0; |
| 11641 | + Py_DECREF(exc_type); |
| 11642 | + Py_XDECREF(exc_value); |
| 11643 | + Py_XDECREF(exc_tb); |
| 11644 | + return 0; |
| 11645 | + } else { |
| 11646 | + return -1; |
| 11647 | + } |
| 11648 | + } |
| 11649 | + return 0; |
| 11650 | +#else |
| 11651 | + if (unlikely(PyErr_Occurred())) { |
| 11652 | + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { |
| 11653 | + PyErr_Clear(); |
| 11654 | + return 0; |
| 11655 | + } else { |
| 11656 | + return -1; |
| 11657 | + } |
| 11658 | + } |
| 11659 | + return 0; |
| 11660 | +#endif |
| 11661 | } |
| 11662 | |
| 11663 | static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { |
| 11664 | @@ -21995,19 +22726,15 @@ |
| 11665 | Py_DECREF(retval); |
| 11666 | __Pyx_RaiseTooManyValuesError(expected); |
| 11667 | return -1; |
| 11668 | - } else if (PyErr_Occurred()) { |
| 11669 | - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { |
| 11670 | - PyErr_Clear(); |
| 11671 | - return 0; |
| 11672 | - } else { |
| 11673 | - return -1; |
| 11674 | - } |
| 11675 | + } else { |
| 11676 | + return __Pyx_IterFinish(); |
| 11677 | } |
| 11678 | return 0; |
| 11679 | } |
| 11680 | |
| 11681 | static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { |
| 11682 | PyObject *local_type, *local_value, *local_tb; |
| 11683 | +#if CYTHON_COMPILING_IN_CPYTHON |
| 11684 | PyObject *tmp_type, *tmp_value, *tmp_tb; |
| 11685 | PyThreadState *tstate = PyThreadState_GET(); |
| 11686 | local_type = tstate->curexc_type; |
| 11687 | @@ -22016,19 +22743,27 @@ |
| 11688 | tstate->curexc_type = 0; |
| 11689 | tstate->curexc_value = 0; |
| 11690 | tstate->curexc_traceback = 0; |
| 11691 | +#else |
| 11692 | + PyErr_Fetch(&local_type, &local_value, &local_tb); |
| 11693 | +#endif |
| 11694 | PyErr_NormalizeException(&local_type, &local_value, &local_tb); |
| 11695 | +#if CYTHON_COMPILING_IN_CPYTHON |
| 11696 | if (unlikely(tstate->curexc_type)) |
| 11697 | +#else |
| 11698 | + if (unlikely(PyErr_Occurred())) |
| 11699 | +#endif |
| 11700 | goto bad; |
| 11701 | #if PY_MAJOR_VERSION >= 3 |
| 11702 | if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) |
| 11703 | goto bad; |
| 11704 | #endif |
| 11705 | - *type = local_type; |
| 11706 | - *value = local_value; |
| 11707 | - *tb = local_tb; |
| 11708 | Py_INCREF(local_type); |
| 11709 | Py_INCREF(local_value); |
| 11710 | Py_INCREF(local_tb); |
| 11711 | + *type = local_type; |
| 11712 | + *value = local_value; |
| 11713 | + *tb = local_tb; |
| 11714 | +#if CYTHON_COMPILING_IN_CPYTHON |
| 11715 | tmp_type = tstate->exc_type; |
| 11716 | tmp_value = tstate->exc_value; |
| 11717 | tmp_tb = tstate->exc_traceback; |
| 11718 | @@ -22036,10 +22771,13 @@ |
| 11719 | tstate->exc_value = local_value; |
| 11720 | tstate->exc_traceback = local_tb; |
| 11721 | /* Make sure tstate is in a consistent state when we XDECREF |
| 11722 | - these objects (XDECREF may run arbitrary code). */ |
| 11723 | + these objects (DECREF may run arbitrary code). */ |
| 11724 | Py_XDECREF(tmp_type); |
| 11725 | Py_XDECREF(tmp_value); |
| 11726 | Py_XDECREF(tmp_tb); |
| 11727 | +#else |
| 11728 | + PyErr_SetExcInfo(local_type, local_value, local_tb); |
| 11729 | +#endif |
| 11730 | return 0; |
| 11731 | bad: |
| 11732 | *type = 0; |
| 11733 | @@ -22051,7 +22789,6 @@ |
| 11734 | return -1; |
| 11735 | } |
| 11736 | |
| 11737 | - |
| 11738 | static CYTHON_INLINE int __Pyx_CheckKeywordStrings( |
| 11739 | PyObject *kwdict, |
| 11740 | const char* function_name, |
| 11741 | @@ -22059,13 +22796,17 @@ |
| 11742 | { |
| 11743 | PyObject* key = 0; |
| 11744 | Py_ssize_t pos = 0; |
| 11745 | +#if CPYTHON_COMPILING_IN_PYPY |
| 11746 | + if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0)) |
| 11747 | + goto invalid_keyword; |
| 11748 | + return 1; |
| 11749 | +#else |
| 11750 | while (PyDict_Next(kwdict, &pos, &key, 0)) { |
| 11751 | #if PY_MAJOR_VERSION < 3 |
| 11752 | if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) |
| 11753 | - #else |
| 11754 | - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) |
| 11755 | #endif |
| 11756 | - goto invalid_keyword_type; |
| 11757 | + if (unlikely(!PyUnicode_Check(key))) |
| 11758 | + goto invalid_keyword_type; |
| 11759 | } |
| 11760 | if ((!kw_allowed) && unlikely(key)) |
| 11761 | goto invalid_keyword; |
| 11762 | @@ -22074,6 +22815,7 @@ |
| 11763 | PyErr_Format(PyExc_TypeError, |
| 11764 | "%s() keywords must be strings", function_name); |
| 11765 | return 0; |
| 11766 | +#endif |
| 11767 | invalid_keyword: |
| 11768 | PyErr_Format(PyExc_TypeError, |
| 11769 | #if PY_MAJOR_VERSION < 3 |
| 11770 | @@ -22098,8 +22840,8 @@ |
| 11771 | return 0; |
| 11772 | } |
| 11773 | |
| 11774 | - |
| 11775 | static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { |
| 11776 | +#if CYTHON_COMPILING_IN_CPYTHON |
| 11777 | PyThreadState *tstate = PyThreadState_GET(); |
| 11778 | *type = tstate->exc_type; |
| 11779 | *value = tstate->exc_value; |
| 11780 | @@ -22107,9 +22849,12 @@ |
| 11781 | Py_XINCREF(*type); |
| 11782 | Py_XINCREF(*value); |
| 11783 | Py_XINCREF(*tb); |
| 11784 | +#else |
| 11785 | + PyErr_GetExcInfo(type, value, tb); |
| 11786 | +#endif |
| 11787 | } |
| 11788 | - |
| 11789 | static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { |
| 11790 | +#if CYTHON_COMPILING_IN_CPYTHON |
| 11791 | PyObject *tmp_type, *tmp_value, *tmp_tb; |
| 11792 | PyThreadState *tstate = PyThreadState_GET(); |
| 11793 | tmp_type = tstate->exc_type; |
| 11794 | @@ -22121,6 +22866,9 @@ |
| 11795 | Py_XDECREF(tmp_type); |
| 11796 | Py_XDECREF(tmp_value); |
| 11797 | Py_XDECREF(tmp_tb); |
| 11798 | +#else |
| 11799 | + PyErr_SetExcInfo(type, value, tb); |
| 11800 | +#endif |
| 11801 | } |
| 11802 | |
| 11803 | static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { |
| 11804 | @@ -22149,12 +22897,33 @@ |
| 11805 | goto bad; |
| 11806 | #if PY_VERSION_HEX >= 0x02050000 |
| 11807 | { |
| 11808 | - PyObject *py_level = PyInt_FromLong(level); |
| 11809 | - if (!py_level) |
| 11810 | - goto bad; |
| 11811 | - module = PyObject_CallFunctionObjArgs(py_import, |
| 11812 | - name, global_dict, empty_dict, list, py_level, NULL); |
| 11813 | - Py_DECREF(py_level); |
| 11814 | + #if PY_MAJOR_VERSION >= 3 |
| 11815 | + if (level == -1) { |
| 11816 | + if (strchr(__Pyx_MODULE_NAME, '.')) { |
| 11817 | + /* try package relative import first */ |
| 11818 | + PyObject *py_level = PyInt_FromLong(1); |
| 11819 | + if (!py_level) |
| 11820 | + goto bad; |
| 11821 | + module = PyObject_CallFunctionObjArgs(py_import, |
| 11822 | + name, global_dict, empty_dict, list, py_level, NULL); |
| 11823 | + Py_DECREF(py_level); |
| 11824 | + if (!module) { |
| 11825 | + if (!PyErr_ExceptionMatches(PyExc_ImportError)) |
| 11826 | + goto bad; |
| 11827 | + PyErr_Clear(); |
| 11828 | + } |
| 11829 | + } |
| 11830 | + level = 0; /* try absolute import on failure */ |
| 11831 | + } |
| 11832 | + #endif |
| 11833 | + if (!module) { |
| 11834 | + PyObject *py_level = PyInt_FromLong(level); |
| 11835 | + if (!py_level) |
| 11836 | + goto bad; |
| 11837 | + module = PyObject_CallFunctionObjArgs(py_import, |
| 11838 | + name, global_dict, empty_dict, list, py_level, NULL); |
| 11839 | + Py_DECREF(py_level); |
| 11840 | + } |
| 11841 | } |
| 11842 | #else |
| 11843 | if (level>0) { |
| 11844 | @@ -22171,66 +22940,65 @@ |
| 11845 | return module; |
| 11846 | } |
| 11847 | |
| 11848 | -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { |
| 11849 | - if (s1 == s2) { /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */ |
| 11850 | - return (equals == Py_EQ); |
| 11851 | - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { |
| 11852 | - if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) { |
| 11853 | - return (equals == Py_NE); |
| 11854 | - } else if (PyBytes_GET_SIZE(s1) == 1) { |
| 11855 | - if (equals == Py_EQ) |
| 11856 | - return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]); |
| 11857 | - else |
| 11858 | - return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]); |
| 11859 | - } else { |
| 11860 | - int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1)); |
| 11861 | - return (equals == Py_EQ) ? (result == 0) : (result != 0); |
| 11862 | +static CYTHON_INLINE npy_intp __Pyx_PyInt_from_py_npy_intp(PyObject* x) { |
| 11863 | + const npy_intp neg_one = (npy_intp)-1, const_zero = (npy_intp)0; |
| 11864 | + const int is_unsigned = const_zero < neg_one; |
| 11865 | + if (sizeof(npy_intp) == sizeof(char)) { |
| 11866 | + if (is_unsigned) |
| 11867 | + return (npy_intp)__Pyx_PyInt_AsUnsignedChar(x); |
| 11868 | + else |
| 11869 | + return (npy_intp)__Pyx_PyInt_AsSignedChar(x); |
| 11870 | + } else if (sizeof(npy_intp) == sizeof(short)) { |
| 11871 | + if (is_unsigned) |
| 11872 | + return (npy_intp)__Pyx_PyInt_AsUnsignedShort(x); |
| 11873 | + else |
| 11874 | + return (npy_intp)__Pyx_PyInt_AsSignedShort(x); |
| 11875 | + } else if (sizeof(npy_intp) == sizeof(int)) { |
| 11876 | + if (is_unsigned) |
| 11877 | + return (npy_intp)__Pyx_PyInt_AsUnsignedInt(x); |
| 11878 | + else |
| 11879 | + return (npy_intp)__Pyx_PyInt_AsSignedInt(x); |
| 11880 | + } else if (sizeof(npy_intp) == sizeof(long)) { |
| 11881 | + if (is_unsigned) |
| 11882 | + return (npy_intp)__Pyx_PyInt_AsUnsignedLong(x); |
| 11883 | + else |
| 11884 | + return (npy_intp)__Pyx_PyInt_AsSignedLong(x); |
| 11885 | + } else if (sizeof(npy_intp) == sizeof(PY_LONG_LONG)) { |
| 11886 | + if (is_unsigned) |
| 11887 | + return (npy_intp)__Pyx_PyInt_AsUnsignedLongLong(x); |
| 11888 | + else |
| 11889 | + return (npy_intp)__Pyx_PyInt_AsSignedLongLong(x); |
| 11890 | + } else { |
| 11891 | + npy_intp val; |
| 11892 | + PyObject *v = __Pyx_PyNumber_Int(x); |
| 11893 | + #if PY_VERSION_HEX < 0x03000000 |
| 11894 | + if (likely(v) && !PyLong_Check(v)) { |
| 11895 | + PyObject *tmp = v; |
| 11896 | + v = PyNumber_Long(tmp); |
| 11897 | + Py_DECREF(tmp); |
| 11898 | } |
| 11899 | - } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { |
| 11900 | - return (equals == Py_NE); |
| 11901 | - } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { |
| 11902 | - return (equals == Py_NE); |
| 11903 | - } else { |
| 11904 | - int result; |
| 11905 | - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); |
| 11906 | - if (!py_result) |
| 11907 | - return -1; |
| 11908 | - result = __Pyx_PyObject_IsTrue(py_result); |
| 11909 | - Py_DECREF(py_result); |
| 11910 | - return result; |
| 11911 | + #endif |
| 11912 | + if (likely(v)) { |
| 11913 | + int one = 1; int is_little = (int)*(unsigned char *)&one; |
| 11914 | + unsigned char *bytes = (unsigned char *)&val; |
| 11915 | + int ret = _PyLong_AsByteArray((PyLongObject *)v, |
| 11916 | + bytes, sizeof(val), |
| 11917 | + is_little, !is_unsigned); |
| 11918 | + Py_DECREF(v); |
| 11919 | + if (likely(!ret)) |
| 11920 | + return val; |
| 11921 | + } |
| 11922 | + return (npy_intp)-1; |
| 11923 | } |
| 11924 | } |
| 11925 | |
| 11926 | -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { |
| 11927 | - if (s1 == s2) { /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */ |
| 11928 | - return (equals == Py_EQ); |
| 11929 | - } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) { |
| 11930 | - if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) { |
| 11931 | - return (equals == Py_NE); |
| 11932 | - } else if (PyUnicode_GET_SIZE(s1) == 1) { |
| 11933 | - if (equals == Py_EQ) |
| 11934 | - return (PyUnicode_AS_UNICODE(s1)[0] == PyUnicode_AS_UNICODE(s2)[0]); |
| 11935 | - else |
| 11936 | - return (PyUnicode_AS_UNICODE(s1)[0] != PyUnicode_AS_UNICODE(s2)[0]); |
| 11937 | - } else { |
| 11938 | - int result = PyUnicode_Compare(s1, s2); |
| 11939 | - if ((result == -1) && unlikely(PyErr_Occurred())) |
| 11940 | - return -1; |
| 11941 | - return (equals == Py_EQ) ? (result == 0) : (result != 0); |
| 11942 | - } |
| 11943 | - } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) { |
| 11944 | - return (equals == Py_NE); |
| 11945 | - } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) { |
| 11946 | - return (equals == Py_NE); |
| 11947 | - } else { |
| 11948 | - int result; |
| 11949 | - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); |
| 11950 | - if (!py_result) |
| 11951 | - return -1; |
| 11952 | - result = __Pyx_PyObject_IsTrue(py_result); |
| 11953 | - Py_DECREF(py_result); |
| 11954 | - return result; |
| 11955 | - } |
| 11956 | +static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name) { |
| 11957 | +#if PY_MAJOR_VERSION < 3 |
| 11958 | + PyErr_Format(PyExc_ImportError, "cannot import name %.230s", |
| 11959 | + PyString_AsString(name)); |
| 11960 | +#else |
| 11961 | + PyErr_Format(PyExc_ImportError, "cannot import name %S", name); |
| 11962 | +#endif |
| 11963 | } |
| 11964 | |
| 11965 | static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { |
| 11966 | @@ -22658,58 +23426,6 @@ |
| 11967 | } |
| 11968 | } |
| 11969 | |
| 11970 | -static CYTHON_INLINE npy_intp __Pyx_PyInt_from_py_npy_intp(PyObject* x) { |
| 11971 | - const npy_intp neg_one = (npy_intp)-1, const_zero = (npy_intp)0; |
| 11972 | - const int is_unsigned = const_zero < neg_one; |
| 11973 | - if (sizeof(npy_intp) == sizeof(char)) { |
| 11974 | - if (is_unsigned) |
| 11975 | - return (npy_intp)__Pyx_PyInt_AsUnsignedChar(x); |
| 11976 | - else |
| 11977 | - return (npy_intp)__Pyx_PyInt_AsSignedChar(x); |
| 11978 | - } else if (sizeof(npy_intp) == sizeof(short)) { |
| 11979 | - if (is_unsigned) |
| 11980 | - return (npy_intp)__Pyx_PyInt_AsUnsignedShort(x); |
| 11981 | - else |
| 11982 | - return (npy_intp)__Pyx_PyInt_AsSignedShort(x); |
| 11983 | - } else if (sizeof(npy_intp) == sizeof(int)) { |
| 11984 | - if (is_unsigned) |
| 11985 | - return (npy_intp)__Pyx_PyInt_AsUnsignedInt(x); |
| 11986 | - else |
| 11987 | - return (npy_intp)__Pyx_PyInt_AsSignedInt(x); |
| 11988 | - } else if (sizeof(npy_intp) == sizeof(long)) { |
| 11989 | - if (is_unsigned) |
| 11990 | - return (npy_intp)__Pyx_PyInt_AsUnsignedLong(x); |
| 11991 | - else |
| 11992 | - return (npy_intp)__Pyx_PyInt_AsSignedLong(x); |
| 11993 | - } else if (sizeof(npy_intp) == sizeof(PY_LONG_LONG)) { |
| 11994 | - if (is_unsigned) |
| 11995 | - return (npy_intp)__Pyx_PyInt_AsUnsignedLongLong(x); |
| 11996 | - else |
| 11997 | - return (npy_intp)__Pyx_PyInt_AsSignedLongLong(x); |
| 11998 | - } else { |
| 11999 | - npy_intp val; |
| 12000 | - PyObject *v = __Pyx_PyNumber_Int(x); |
| 12001 | - #if PY_VERSION_HEX < 0x03000000 |
| 12002 | - if (likely(v) && !PyLong_Check(v)) { |
| 12003 | - PyObject *tmp = v; |
| 12004 | - v = PyNumber_Long(tmp); |
| 12005 | - Py_DECREF(tmp); |
| 12006 | - } |
| 12007 | - #endif |
| 12008 | - if (likely(v)) { |
| 12009 | - int one = 1; int is_little = (int)*(unsigned char *)&one; |
| 12010 | - unsigned char *bytes = (unsigned char *)&val; |
| 12011 | - int ret = _PyLong_AsByteArray((PyLongObject *)v, |
| 12012 | - bytes, sizeof(val), |
| 12013 | - is_little, !is_unsigned); |
| 12014 | - Py_DECREF(v); |
| 12015 | - if (likely(!ret)) |
| 12016 | - return val; |
| 12017 | - } |
| 12018 | - return (npy_intp)-1; |
| 12019 | - } |
| 12020 | -} |
| 12021 | - |
| 12022 | static int __Pyx_check_binary_version(void) { |
| 12023 | char ctversion[4], rtversion[4]; |
| 12024 | PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); |
| 12025 | @@ -22729,6 +23445,23 @@ |
| 12026 | return 0; |
| 12027 | } |
| 12028 | |
| 12029 | +#ifndef __PYX_HAVE_RT_ImportModule |
| 12030 | +#define __PYX_HAVE_RT_ImportModule |
| 12031 | +static PyObject *__Pyx_ImportModule(const char *name) { |
| 12032 | + PyObject *py_name = 0; |
| 12033 | + PyObject *py_module = 0; |
| 12034 | + py_name = __Pyx_PyIdentifier_FromString(name); |
| 12035 | + if (!py_name) |
| 12036 | + goto bad; |
| 12037 | + py_module = PyImport_Import(py_name); |
| 12038 | + Py_DECREF(py_name); |
| 12039 | + return py_module; |
| 12040 | +bad: |
| 12041 | + Py_XDECREF(py_name); |
| 12042 | + return 0; |
| 12043 | +} |
| 12044 | +#endif |
| 12045 | + |
| 12046 | #ifndef __PYX_HAVE_RT_ImportType |
| 12047 | #define __PYX_HAVE_RT_ImportType |
| 12048 | static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, |
| 12049 | @@ -22738,15 +23471,10 @@ |
| 12050 | PyObject *result = 0; |
| 12051 | PyObject *py_name = 0; |
| 12052 | char warning[200]; |
| 12053 | - |
| 12054 | py_module = __Pyx_ImportModule(module_name); |
| 12055 | if (!py_module) |
| 12056 | goto bad; |
| 12057 | - #if PY_MAJOR_VERSION < 3 |
| 12058 | - py_name = PyString_FromString(class_name); |
| 12059 | - #else |
| 12060 | - py_name = PyUnicode_FromString(class_name); |
| 12061 | - #endif |
| 12062 | + py_name = __Pyx_PyIdentifier_FromString(class_name); |
| 12063 | if (!py_name) |
| 12064 | goto bad; |
| 12065 | result = PyObject_GetAttr(py_module, py_name); |
| 12066 | @@ -22762,7 +23490,7 @@ |
| 12067 | module_name, class_name); |
| 12068 | goto bad; |
| 12069 | } |
| 12070 | - if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) { |
| 12071 | + if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { |
| 12072 | PyOS_snprintf(warning, sizeof(warning), |
| 12073 | "%s.%s size changed, may indicate binary incompatibility", |
| 12074 | module_name, class_name); |
| 12075 | @@ -22772,7 +23500,7 @@ |
| 12076 | if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; |
| 12077 | #endif |
| 12078 | } |
| 12079 | - else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) { |
| 12080 | + else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { |
| 12081 | PyErr_Format(PyExc_ValueError, |
| 12082 | "%s.%s has the wrong size, try recompiling", |
| 12083 | module_name, class_name); |
| 12084 | @@ -22786,51 +23514,105 @@ |
| 12085 | } |
| 12086 | #endif |
| 12087 | |
| 12088 | -#ifndef __PYX_HAVE_RT_ImportModule |
| 12089 | -#define __PYX_HAVE_RT_ImportModule |
| 12090 | -static PyObject *__Pyx_ImportModule(const char *name) { |
| 12091 | - PyObject *py_name = 0; |
| 12092 | - PyObject *py_module = 0; |
| 12093 | - |
| 12094 | - #if PY_MAJOR_VERSION < 3 |
| 12095 | - py_name = PyString_FromString(name); |
| 12096 | - #else |
| 12097 | - py_name = PyUnicode_FromString(name); |
| 12098 | - #endif |
| 12099 | - if (!py_name) |
| 12100 | - goto bad; |
| 12101 | - py_module = PyImport_Import(py_name); |
| 12102 | - Py_DECREF(py_name); |
| 12103 | - return py_module; |
| 12104 | -bad: |
| 12105 | - Py_XDECREF(py_name); |
| 12106 | - return 0; |
| 12107 | +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { |
| 12108 | + int start = 0, mid = 0, end = count - 1; |
| 12109 | + if (end >= 0 && code_line > entries[end].code_line) { |
| 12110 | + return count; |
| 12111 | + } |
| 12112 | + while (start < end) { |
| 12113 | + mid = (start + end) / 2; |
| 12114 | + if (code_line < entries[mid].code_line) { |
| 12115 | + end = mid; |
| 12116 | + } else if (code_line > entries[mid].code_line) { |
| 12117 | + start = mid + 1; |
| 12118 | + } else { |
| 12119 | + return mid; |
| 12120 | + } |
| 12121 | + } |
| 12122 | + if (code_line <= entries[mid].code_line) { |
| 12123 | + return mid; |
| 12124 | + } else { |
| 12125 | + return mid + 1; |
| 12126 | + } |
| 12127 | +} |
| 12128 | +static PyCodeObject *__pyx_find_code_object(int code_line) { |
| 12129 | + PyCodeObject* code_object; |
| 12130 | + int pos; |
| 12131 | + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { |
| 12132 | + return NULL; |
| 12133 | + } |
| 12134 | + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); |
| 12135 | + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { |
| 12136 | + return NULL; |
| 12137 | + } |
| 12138 | + code_object = __pyx_code_cache.entries[pos].code_object; |
| 12139 | + Py_INCREF(code_object); |
| 12140 | + return code_object; |
| 12141 | +} |
| 12142 | +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { |
| 12143 | + int pos, i; |
| 12144 | + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; |
| 12145 | + if (unlikely(!code_line)) { |
| 12146 | + return; |
| 12147 | + } |
| 12148 | + if (unlikely(!entries)) { |
| 12149 | + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); |
| 12150 | + if (likely(entries)) { |
| 12151 | + __pyx_code_cache.entries = entries; |
| 12152 | + __pyx_code_cache.max_count = 64; |
| 12153 | + __pyx_code_cache.count = 1; |
| 12154 | + entries[0].code_line = code_line; |
| 12155 | + entries[0].code_object = code_object; |
| 12156 | + Py_INCREF(code_object); |
| 12157 | + } |
| 12158 | + return; |
| 12159 | + } |
| 12160 | + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); |
| 12161 | + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { |
| 12162 | + PyCodeObject* tmp = entries[pos].code_object; |
| 12163 | + entries[pos].code_object = code_object; |
| 12164 | + Py_DECREF(tmp); |
| 12165 | + return; |
| 12166 | + } |
| 12167 | + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { |
| 12168 | + int new_max = __pyx_code_cache.max_count + 64; |
| 12169 | + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( |
| 12170 | + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); |
| 12171 | + if (unlikely(!entries)) { |
| 12172 | + return; |
| 12173 | + } |
| 12174 | + __pyx_code_cache.entries = entries; |
| 12175 | + __pyx_code_cache.max_count = new_max; |
| 12176 | + } |
| 12177 | + for (i=__pyx_code_cache.count; i>pos; i--) { |
| 12178 | + entries[i] = entries[i-1]; |
| 12179 | + } |
| 12180 | + entries[pos].code_line = code_line; |
| 12181 | + entries[pos].code_object = code_object; |
| 12182 | + __pyx_code_cache.count++; |
| 12183 | + Py_INCREF(code_object); |
| 12184 | } |
| 12185 | -#endif |
| 12186 | |
| 12187 | #include "compile.h" |
| 12188 | #include "frameobject.h" |
| 12189 | #include "traceback.h" |
| 12190 | - |
| 12191 | -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, |
| 12192 | - int __pyx_lineno, const char *__pyx_filename) { |
| 12193 | +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( |
| 12194 | + const char *funcname, int c_line, |
| 12195 | + int py_line, const char *filename) { |
| 12196 | + PyCodeObject *py_code = 0; |
| 12197 | PyObject *py_srcfile = 0; |
| 12198 | PyObject *py_funcname = 0; |
| 12199 | - PyObject *py_globals = 0; |
| 12200 | - PyCodeObject *py_code = 0; |
| 12201 | - PyFrameObject *py_frame = 0; |
| 12202 | - |
| 12203 | #if PY_MAJOR_VERSION < 3 |
| 12204 | - py_srcfile = PyString_FromString(__pyx_filename); |
| 12205 | + py_srcfile = PyString_FromString(filename); |
| 12206 | #else |
| 12207 | - py_srcfile = PyUnicode_FromString(__pyx_filename); |
| 12208 | + py_srcfile = PyUnicode_FromString(filename); |
| 12209 | #endif |
| 12210 | if (!py_srcfile) goto bad; |
| 12211 | - if (__pyx_clineno) { |
| 12212 | + if (c_line) { |
| 12213 | #if PY_MAJOR_VERSION < 3 |
| 12214 | - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); |
| 12215 | + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); |
| 12216 | #else |
| 12217 | - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); |
| 12218 | + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); |
| 12219 | #endif |
| 12220 | } |
| 12221 | else { |
| 12222 | @@ -22841,28 +23623,45 @@ |
| 12223 | #endif |
| 12224 | } |
| 12225 | if (!py_funcname) goto bad; |
| 12226 | - py_globals = PyModule_GetDict(__pyx_m); |
| 12227 | - if (!py_globals) goto bad; |
| 12228 | - py_code = PyCode_New( |
| 12229 | + py_code = __Pyx_PyCode_New( |
| 12230 | 0, /*int argcount,*/ |
| 12231 | - #if PY_MAJOR_VERSION >= 3 |
| 12232 | 0, /*int kwonlyargcount,*/ |
| 12233 | - #endif |
| 12234 | 0, /*int nlocals,*/ |
| 12235 | 0, /*int stacksize,*/ |
| 12236 | 0, /*int flags,*/ |
| 12237 | __pyx_empty_bytes, /*PyObject *code,*/ |
| 12238 | - __pyx_empty_tuple, /*PyObject *consts,*/ |
| 12239 | - __pyx_empty_tuple, /*PyObject *names,*/ |
| 12240 | - __pyx_empty_tuple, /*PyObject *varnames,*/ |
| 12241 | - __pyx_empty_tuple, /*PyObject *freevars,*/ |
| 12242 | - __pyx_empty_tuple, /*PyObject *cellvars,*/ |
| 12243 | + __pyx_empty_tuple, /*PyObject *consts,*/ |
| 12244 | + __pyx_empty_tuple, /*PyObject *names,*/ |
| 12245 | + __pyx_empty_tuple, /*PyObject *varnames,*/ |
| 12246 | + __pyx_empty_tuple, /*PyObject *freevars,*/ |
| 12247 | + __pyx_empty_tuple, /*PyObject *cellvars,*/ |
| 12248 | py_srcfile, /*PyObject *filename,*/ |
| 12249 | py_funcname, /*PyObject *name,*/ |
| 12250 | - __pyx_lineno, /*int firstlineno,*/ |
| 12251 | + py_line, /*int firstlineno,*/ |
| 12252 | __pyx_empty_bytes /*PyObject *lnotab*/ |
| 12253 | ); |
| 12254 | - if (!py_code) goto bad; |
| 12255 | + Py_DECREF(py_srcfile); |
| 12256 | + Py_DECREF(py_funcname); |
| 12257 | + return py_code; |
| 12258 | +bad: |
| 12259 | + Py_XDECREF(py_srcfile); |
| 12260 | + Py_XDECREF(py_funcname); |
| 12261 | + return NULL; |
| 12262 | +} |
| 12263 | +static void __Pyx_AddTraceback(const char *funcname, int c_line, |
| 12264 | + int py_line, const char *filename) { |
| 12265 | + PyCodeObject *py_code = 0; |
| 12266 | + PyObject *py_globals = 0; |
| 12267 | + PyFrameObject *py_frame = 0; |
| 12268 | + py_code = __pyx_find_code_object(c_line ? c_line : py_line); |
| 12269 | + if (!py_code) { |
| 12270 | + py_code = __Pyx_CreateCodeObjectForTraceback( |
| 12271 | + funcname, c_line, py_line, filename); |
| 12272 | + if (!py_code) goto bad; |
| 12273 | + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); |
| 12274 | + } |
| 12275 | + py_globals = PyModule_GetDict(__pyx_m); |
| 12276 | + if (!py_globals) goto bad; |
| 12277 | py_frame = PyFrame_New( |
| 12278 | PyThreadState_GET(), /*PyThreadState *tstate,*/ |
| 12279 | py_code, /*PyCodeObject *code,*/ |
| 12280 | @@ -22870,11 +23669,9 @@ |
| 12281 | 0 /*PyObject *locals*/ |
| 12282 | ); |
| 12283 | if (!py_frame) goto bad; |
| 12284 | - py_frame->f_lineno = __pyx_lineno; |
| 12285 | + py_frame->f_lineno = py_line; |
| 12286 | PyTraceBack_Here(py_frame); |
| 12287 | bad: |
| 12288 | - Py_XDECREF(py_srcfile); |
| 12289 | - Py_XDECREF(py_funcname); |
| 12290 | Py_XDECREF(py_code); |
| 12291 | Py_XDECREF(py_frame); |
| 12292 | } |
| 12293 | @@ -22909,6 +23706,7 @@ |
| 12294 | return 0; |
| 12295 | } |
| 12296 | |
| 12297 | + |
| 12298 | /* Type Conversion Functions */ |
| 12299 | |
| 12300 | static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { |